Skip to content
This repository was archived by the owner on May 4, 2020. It is now read-only.

Commit 9fc77c9

Browse files
committed
Check the console output first.
It'll often contain reasons why the expected output files are missing.
1 parent 248b5d4 commit 9fc77c9

1 file changed

Lines changed: 15 additions & 11 deletions

File tree

tests/test_examples.py

Lines changed: 15 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,20 @@ def check_example(package, filename):
5151
before_listing = set(os.listdir(actual.path))
5252
call([runner, filename], stdout=output, stderr=STDOUT)
5353
after_listing = set(os.listdir(actual.path))
54-
54+
55+
# check the console output
56+
output.seek(0)
57+
actual_output = output.read().strip().replace('\r', '')
58+
for re, rp in sub_res:
59+
actual_output = re.sub(rp, actual_output)
60+
expected_path = expected_base+'.txt'
61+
if not path.exists(expected_path):
62+
expected_output = ''
63+
else:
64+
expected_output = open(expected_path).read().strip().replace('\r', '')
65+
compare(expected_output, actual_output)
66+
67+
# check the files created
5568
created = after_listing.difference(before_listing)
5669

5770
expected_names = set()
@@ -79,18 +92,9 @@ def check_example(package, filename):
7992

8093
for name in expected_names:
8194
if name != '.svn':
95+
print created
8296
raise AssertionError("expected output missing: %s" % name)
8397

84-
output.seek(0)
85-
actual_output = output.read().strip().replace('\r', '')
86-
for re, rp in sub_res:
87-
actual_output = re.sub(rp, actual_output)
88-
expected_path = expected_base+'.txt'
89-
if not path.exists(expected_path):
90-
expected_output = ''
91-
else:
92-
expected_output = open(expected_path).read().strip().replace('\r', '')
93-
compare(expected_output, actual_output)
9498

9599
finally:
96100
os.chdir(initial)

0 commit comments

Comments
 (0)