Lines Matching refs:site

1 """Tests for 'site'.
19 # Need to make sure to not import 'site' if someone specified ``-S`` at the
20 # command-line. Detect this by just making sure 'site' has not been imported
22 if "site" in sys.modules:
23 import site
25 raise unittest.SkipTest("importation of site.py suppressed")
27 if site.ENABLE_USER_SITE and not os.path.isdir(site.USER_SITE):
28 # need to add user site directory for tests
30 os.makedirs(site.USER_SITE)
31 site.addsitedir(site.USER_SITE)
33 raise unittest.SkipTest('unable to create user site directory (%r): %s'
34 % (site.USER_SITE, exc))
48 self.old_base = site.USER_BASE
49 self.old_site = site.USER_SITE
50 self.old_prefixes = site.PREFIXES
56 site.USER_BASE = self.old_base
57 site.USER_SITE = self.old_site
58 site.PREFIXES = self.old_prefixes
67 abs_dir, norm_dir = site.makepath(*path_parts)
75 dir_set = site._init_pathinfo()
76 for entry in [site.makepath(path)[1] for path in sys.path
86 self.assertIn(site.makepath(pth_file.good_dir_path)[0], sys.path)
99 site.addpackage(pth_file.base_dir, pth_file.filename, set())
119 site.addpackage(pth_dir, pth_fn, set())
134 site.addpackage(pth_dir, pth_fn, set())
148 site.addpackage(pth_dir, pth_fn, set())
164 site.addsitedir(pth_file.base_dir, set())
169 @unittest.skipUnless(site.ENABLE_USER_SITE, "requires access to PEP 370 "
170 "user-site (site.ENABLE_USER_SITE)")
172 usersite = site.USER_SITE
198 'import sys, site; sys.exit(site.USER_BASE.startswith("/tmp"))'],
203 site.USER_BASE = None
204 user_base = site.getuserbase()
206 # the call sets site.USER_BASE
207 self.assertEqual(site.USER_BASE, user_base)
210 site.USER_BASE = None
216 self.assertTrue(site.getuserbase().startswith('xoxo'),
217 site.getuserbase())
220 site.USER_SITE = None
221 site.USER_BASE = None
222 user_site = site.getusersitepackages()
225 self.assertEqual(site.USER_SITE, user_site)
226 self.assertTrue(user_site.startswith(site.USER_BASE), user_site)
229 site.PREFIXES = ['xoxo']
230 dirs = site.getsitepackages()
234 wanted = os.path.join('xoxo', 'Lib', 'site-packages')
240 'site-packages')
242 wanted = os.path.join('xoxo', 'lib', 'site-python')
248 wanted = os.path.join('xoxo', 'lib', 'site-packages')
307 """Test side-effects from importing 'site'."""
321 site.abs__file__()
334 site.removeduppaths()