forked from Epistimio/orion
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
added test_user_script_crash test (Epistimio#709)
Detects if a by-design crashing black-box script Traceback is visible in the stderr output of orion.
- Loading branch information
Showing
2 changed files
with
54 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
#!/usr/bin/env python | ||
# -*- coding: utf-8 -*- | ||
"""User script that exits with code given in argument.""" | ||
import argparse | ||
import sys | ||
from xmlrpc.client import boolean | ||
|
||
|
||
def execute(): | ||
"""Execute a simple pipeline as an example.""" | ||
# 1. Get the wanted exit code | ||
parser = argparse.ArgumentParser() | ||
parser.add_argument( | ||
"--exitcode", "-e", type=int, default=0, help="wanted exit code" | ||
) | ||
parser.add_argument( | ||
"--crash", "-c", action="store_true", help="make a crash happen" | ||
) | ||
parser.add_argument("-x", type=float, required=True) | ||
inputs = parser.parse_args() | ||
|
||
# 2. if needed, crash ! | ||
if inputs.crash: | ||
print("%b" % False) # black_box_fail.py : this line should crash | ||
|
||
# 3. exit with the wanted code | ||
sys.exit(inputs.exitcode) | ||
|
||
|
||
if __name__ == "__main__": | ||
execute() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters