Skip to content

Commit

Permalink
test_lazy_imports: it's OK if some slow imports do not happen. #349
Browse files Browse the repository at this point in the history
  • Loading branch information
lemon24 committed Aug 26, 2024
1 parent 9347b80 commit 63e8ec3
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion tests/test_lazy_imports.py
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,12 @@ def get_imported_modules(code):
def test_only_expected_modules_are_imported(code, expected_modules):
modules = set(get_imported_modules(code))
actual_modules = LAZY_MODULES & modules

# sanity check
assert 'reader' in modules
assert actual_modules == expected_modules, expected_modules

# not using == because imports can vary based on library versions,
# and we care more about slow stuff being imported accidentally
# than the other way around
# https://github.com/lemon24/reader/issues/349
assert actual_modules <= expected_modules, expected_modules

0 comments on commit 63e8ec3

Please sign in to comment.