Skip to content

Instantly share code, notes, and snippets.

@pjz
Last active April 7, 2020 14:41
Show Gist options
  • Save pjz/2fdb860ee5654d9a3bf5408baf85564d to your computer and use it in GitHub Desktop.
Save pjz/2fdb860ee5654d9a3bf5408baf85564d to your computer and use it in GitHub Desktop.
results_dir = Path(__file__).parent / 'expected_results_dir'
def test_one_process(bash):
bash.run_script('prog1', ['arg1', 'arg2'])
assert bash.path_exists('/path/to/outfile')
assert bash.file_contents('/path/to/outfile') == 'expected_result_text'
assert bash.file_contents('/path/to/outfile') == bash.file_contents(results_dir / 'one_process_results.txt')
def test_two_processes(bash):
bash.run_script('prog1', ['arg1', 'arg2'])
bash.run_script('prog2', ['arg1', 'arg2'])
assert bash.path_exists('/path/to/outfile')
assert bash.file_contents('/path/to/outfile1') == 'expected_result_text1'
assert bash.file_contents('/path/to/outfile1') == bash.file_contents(results_dir / 'one_process_results.txt1')
assert bash.file_contents('/path/to/outfile1') == 'expected_result_text2'
assert bash.file_contents('/path/to/outfile1') == bash.file_contents(results_dir / 'one_process_results.txt2')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment