MCPcopy Index your code
hub / github.com/python/cpython / test_addpackage

Method test_addpackage

Lib/test/test_site.py:120–133  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

118 self.assertFalse(os.path.exists(pth_file.bad_dir_path))
119
120 def test_addpackage(self):
121 # Make sure addpackage() imports if the line starts with 'import',
122 # adds directories to sys.path for any line in the file that is not a
123 # comment or import that is a valid directory name for where the .pth
124 # file resides; invalid directories are not added
125 pth_file = PthFile()
126 pth_file.cleanup(prep=True) # to make sure that nothing is
127 # pre-existing that shouldn't be
128 try:
129 pth_file.create()
130 site.addpackage(pth_file.base_dir, pth_file.filename, set())
131 self.pth_file_tests(pth_file)
132 finally:
133 pth_file.cleanup()
134
135 def make_pth(self, contents, pth_dir='.', pth_name=TESTFN):
136 # Create a .pth file and return its (abspath, basename).

Callers

nothing calls this directly

Calls 5

cleanupMethod · 0.95
createMethod · 0.95
pth_file_testsMethod · 0.95
PthFileClass · 0.85
setFunction · 0.85

Tested by

no test coverage detected