mirror of
https://github.com/RustPython/RustPython.git
synced 2026-10-28 18:59:04 +08:00
Update test_site.py to 3.14.4 (#7822)
This commit is contained in:
1 parent
8e8b70fb33
commit
3bd79e6b5b
2 files changed
+15
-15
No files matched your search
Vendored
+1
-1
@@ -290,7 +290,7 @@ def check_enableusersite():
|
||||
|
||||
# Copy of sysconfig._get_implementation()
|
||||
def _get_implementation():
|
||||
return 'RustPython' # XXX: RustPython; for site-packages
|
||||
return 'RustPython' # XXX: RUSTPYTHON; for site-packages
|
||||
|
||||
# Copy of sysconfig._getuserbase()
|
||||
def _getuserbase():
|
||||
|
||||
Vendored
+14
-14
@@ -309,7 +309,7 @@ class HelperFunctionsTests(unittest.TestCase):
|
||||
|
||||
with EnvironmentVarGuard() as environ:
|
||||
environ['PYTHONUSERBASE'] = 'xoxo'
|
||||
self.assertTrue(site.getuserbase().startswith('xoxo'))
|
||||
self.assertStartsWith(site.getuserbase(), 'xoxo')
|
||||
|
||||
@unittest.skipUnless(HAS_USER_SITE, 'need user site')
|
||||
def test_getusersitepackages(self):
|
||||
@@ -319,7 +319,7 @@ class HelperFunctionsTests(unittest.TestCase):
|
||||
|
||||
# the call sets USER_BASE *and* USER_SITE
|
||||
self.assertEqual(site.USER_SITE, user_site)
|
||||
self.assertTrue(user_site.startswith(site.USER_BASE))
|
||||
self.assertStartsWith(user_site, site.USER_BASE)
|
||||
self.assertEqual(site.USER_BASE, site.getuserbase())
|
||||
|
||||
def test_getsitepackages(self):
|
||||
@@ -362,10 +362,10 @@ class HelperFunctionsTests(unittest.TestCase):
|
||||
environ.unset('PYTHONUSERBASE', 'APPDATA')
|
||||
|
||||
user_base = site.getuserbase()
|
||||
self.assertTrue(user_base.startswith('~' + os.sep))
|
||||
self.assertStartsWith(user_base, '~' + os.sep)
|
||||
|
||||
user_site = site.getusersitepackages()
|
||||
self.assertTrue(user_site.startswith(user_base))
|
||||
self.assertStartsWith(user_site, user_base)
|
||||
|
||||
with mock.patch('os.path.isdir', return_value=False) as mock_isdir, \
|
||||
mock.patch.object(site, 'addsitedir') as mock_addsitedir, \
|
||||
@@ -497,18 +497,18 @@ class ImportSideEffectTests(unittest.TestCase):
|
||||
|
||||
def test_setting_quit(self):
|
||||
# 'quit' and 'exit' should be injected into builtins
|
||||
self.assertTrue(hasattr(builtins, "quit"))
|
||||
self.assertTrue(hasattr(builtins, "exit"))
|
||||
self.assertHasAttr(builtins, "quit")
|
||||
self.assertHasAttr(builtins, "exit")
|
||||
|
||||
def test_setting_copyright(self):
|
||||
# 'copyright', 'credits', and 'license' should be in builtins
|
||||
self.assertTrue(hasattr(builtins, "copyright"))
|
||||
self.assertTrue(hasattr(builtins, "credits"))
|
||||
self.assertTrue(hasattr(builtins, "license"))
|
||||
self.assertHasAttr(builtins, "copyright")
|
||||
self.assertHasAttr(builtins, "credits")
|
||||
self.assertHasAttr(builtins, "license")
|
||||
|
||||
def test_setting_help(self):
|
||||
# 'help' should be set in builtins
|
||||
self.assertTrue(hasattr(builtins, "help"))
|
||||
self.assertHasAttr(builtins, "help")
|
||||
|
||||
def test_sitecustomize_executed(self):
|
||||
# If sitecustomize is available, it should have been imported.
|
||||
@@ -723,7 +723,7 @@ class _pthFileTests(unittest.TestCase):
|
||||
pth_lines.append('import site')
|
||||
return pth_lines
|
||||
|
||||
@unittest.expectedFailure # TODO: RUSTPYTHON
|
||||
@unittest.expectedFailure # TODO: RUSTPYTHON
|
||||
@support.requires_subprocess()
|
||||
def test_underpth_basic(self):
|
||||
pth_lines = ['#.', '# ..', *sys.path, '.', '..']
|
||||
@@ -743,7 +743,7 @@ class _pthFileTests(unittest.TestCase):
|
||||
"sys.path is incorrect"
|
||||
)
|
||||
|
||||
@unittest.expectedFailure # TODO: RUSTPYTHON
|
||||
@unittest.expectedFailure # TODO: RUSTPYTHON
|
||||
@support.requires_subprocess()
|
||||
def test_underpth_nosite_file(self):
|
||||
libpath = test.support.STDLIB_DIR
|
||||
@@ -768,7 +768,7 @@ class _pthFileTests(unittest.TestCase):
|
||||
"sys.path is incorrect"
|
||||
)
|
||||
|
||||
@unittest.expectedFailure # TODO: RUSTPYTHON
|
||||
@unittest.expectedFailure # TODO: RUSTPYTHON
|
||||
@support.requires_subprocess()
|
||||
def test_underpth_file(self):
|
||||
libpath = test.support.STDLIB_DIR
|
||||
@@ -789,7 +789,7 @@ class _pthFileTests(unittest.TestCase):
|
||||
)], env=env)
|
||||
self.assertTrue(rc, "sys.path is incorrect")
|
||||
|
||||
@unittest.expectedFailure # TODO: RUSTPYTHON
|
||||
@unittest.expectedFailure # TODO: RUSTPYTHON
|
||||
@support.requires_subprocess()
|
||||
def test_underpth_dll_file(self):
|
||||
libpath = test.support.STDLIB_DIR
|
||||
|
||||
Reference in new issue
Block a user