Skip to content

Commit

Permalink
split tests on a dir into one subtest per file
Browse files Browse the repository at this point in the history
  • Loading branch information
bryan-brancotte committed Dec 21, 2023
1 parent ed87285 commit 9e4b680
Showing 1 changed file with 9 additions and 5 deletions.
14 changes: 9 additions & 5 deletions tests/test_functional_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,13 +64,17 @@ def _test_subdir(self, subdir, input_file):

try:
for file in os.listdir(os.path.join(subdir, self.exp_dir)):
with open(
os.path.join(subdir, self.exp_dir, file), "r"
with self.subTest(
file=file
), open(
os.path.join(subdir, self.exp_dir, file),
"r",
) as expected, open(
os.path.join(os.path.join(subdir, self.prd_dir), file), "r"
os.path.join(os.path.join(subdir, self.prd_dir), file),
"r",
) as produced:
expected_lines = cleaned_lines(expected)
produced_lines = cleaned_lines(produced)
expected_lines = cleaned_lines(expected, filename=file)
produced_lines = cleaned_lines(produced, filename=file)
self.assertSetEqual(expected_lines, produced_lines, file)
except AssertionError as ae:
print(out.getvalue().strip(), err.getvalue().strip())
Expand Down

0 comments on commit 9e4b680

Please sign in to comment.