File tree Expand file tree Collapse file tree 1 file changed +5
-7
lines changed
Expand file tree Collapse file tree 1 file changed +5
-7
lines changed Original file line number Diff line number Diff line change @@ -177,24 +177,22 @@ def test_addpackage_empty_lines(self):
177177
178178 def test_addpackage_import_bad_pth_file (self ):
179179 # Issue 5258
180+ # A .pth line with null bytes should not add anything to sys.path.
180181 pth_dir , pth_fn = self .make_pth ("abc\x00 def\n " )
181- with captured_stderr () as err_out :
182- self .assertFalse (site .addpackage (pth_dir , pth_fn , set ()))
183- self .maxDiff = None
184- self .assertEqual (err_out .getvalue (), "" )
182+ site .addpackage (pth_dir , pth_fn , set ())
185183 for path in sys .path :
186184 if isinstance (path , str ):
187185 self .assertNotIn ("abc\x00 def" , path )
188186
189187 def test_addsitedir (self ):
190- # Same tests for test_addpackage since addsitedir() essentially just
191- # calls _read_pth_file() for every .pth file in the directory
188+ # addsitedir() reads .pth files and, when called standalone
189+ # (known_paths=None), flushes paths and import lines immediately.
192190 pth_file = PthFile ()
193191 pth_file .cleanup (prep = True ) # Make sure that nothing is pre-existing
194192 # that is tested for
195193 try :
196194 pth_file .create ()
197- site .addsitedir (pth_file .base_dir , set () )
195+ site .addsitedir (pth_file .base_dir )
198196 self .pth_file_tests (pth_file )
199197 finally :
200198 pth_file .cleanup ()
You can’t perform that action at this time.
0 commit comments