@@ -47,7 +47,7 @@ def test_found_module() -> None:
47
47
("import ast, pathlib" , ["ast" , "pathlib" ]),
48
48
("from pathlib import Path" , ["pathlib" ]),
49
49
("from string import hexdigits" , ["string" ]),
50
- ("import distutils.command.check" , ["distutils.command.check " ]),
50
+ ("import distutils.command.check" , ["distutils" ]),
51
51
("import spam" , []), # don't break because bad programmer
52
52
("from .foo import bar" , []), # don't break on relative imports
53
53
("from . import baz" , []),
@@ -94,24 +94,21 @@ def test_pyfiles_package(tmp_path: Path) -> None:
94
94
]
95
95
96
96
97
- # Beware - using `sys` or `os` here can have weird results.
98
- # See the comment in the implementation.
99
- # We don't mind so much as we only really use this for third party packages.
100
97
@pytest .mark .parametrize (
101
98
["ignore_ham" , "ignore_hashlib" , "expect" , "locs" ],
102
99
[
103
100
(
104
101
False ,
105
102
False ,
106
- ["ast" , "pathlib" , "hashlib" ],
103
+ ["ast" , "pathlib" , "hashlib" , "sys" ],
107
104
[
108
105
("spam.py" , 2 ),
109
106
("ham.py" , 2 ),
110
107
],
111
108
),
112
- (False , True , ["ast" , "pathlib" ], [("spam.py" , 2 ), ("ham.py" , 2 )]),
113
- (True , False , ["ast" ], [("spam.py" , 2 )]),
114
- (True , True , ["ast" ], [("spam.py" , 2 )]),
109
+ (False , True , ["ast" , "pathlib" , "sys" ], [("spam.py" , 2 ), ("ham.py" , 2 )]),
110
+ (True , False , ["ast" , "sys" ], [("spam.py" , 2 )]),
111
+ (True , True , ["ast" , "sys" ], [("spam.py" , 2 )]),
115
112
],
116
113
)
117
114
def test_find_imported_modules (
0 commit comments