20 lines
606 B
Python
20 lines
606 B
Python
"""Run a reviewed demonstration file and verify its observable behavior."""
|
|||
|
|
import argparse
|
||
|
|
import subprocess
|
||
|
|
import sys
|
||
|
|
|
||
|
|
|
||
|
|
def smoke(path):
|
||
|
|
try:
|
||
|
|
result = subprocess.run([sys.executable, str(path)], capture_output=True,
|
||
|
|
text=True, timeout=10)
|
||
|
|
return 0 if result.returncode == 0 and result.stdout == 'hello\n' else 1
|
||
|
|
except (OSError, subprocess.TimeoutExpired):
|
||
|
|
return 1
|
||
|
|
|
||
|
|
|
||
|
|
if __name__ == '__main__':
|
||
|
|
parser = argparse.ArgumentParser(description=__doc__)
|
||
|
|
parser.add_argument('path')
|
||
|
|
raise SystemExit(smoke(parser.parse_args().path))
|