Skip to content

Commit

Permalink
reword assertion error message
Browse files Browse the repository at this point in the history
  • Loading branch information
zacharyburnett committed Sep 12, 2024
1 parent ea730e1 commit dcb3f3e
Showing 1 changed file with 10 additions and 15 deletions.
25 changes: 10 additions & 15 deletions test/test_dms_requirements.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,15 +13,13 @@ def test_requirements():
with open(test_requirements_filename) as test_requirements_file:
requirements = json.load(test_requirements_file)

required_tests = sorted(
{
test
for requirement_tests in requirements.values()
for test in requirement_tests
}
)

existing_tests = []
required_tests = {
test
for requirement_tests in requirements.values()
for test in requirement_tests
}

existing_tests = set()
test_regex = re.compile(r"def (test_[^\(]+)\(.*\):")
for test_filename in test_directory.glob("**/test_*.py"):
with open(test_filename) as test_file:
Expand All @@ -30,10 +28,7 @@ def test_requirements():
for match in re.finditer(test_regex, test_file_contents):
test = f"{test_directory.stem}.{str(test_filename.relative_to(test_directory).parent).replace('/', '.')}.{test_filename.stem}.{match.group(1)}"
if test in required_tests:
existing_tests.append(test)

existing_tests = sorted(existing_tests)

assert existing_tests == required_tests

existing_tests.add(test)

missing_tests = required_tests - existing_tests
assert not missing_tests, f"could not find the following tests correlated with DMS requirements: {missing_tests}"

0 comments on commit dcb3f3e

Please sign in to comment.