summaryrefslogtreecommitdiffstats
path: root/Lib/test/test_site.py
diff options
context:
space:
mode:
authorINADA Naoki <methane@users.noreply.github.com>2017-06-28 15:31:53 (GMT)
committerGitHub <noreply@github.com>2017-06-28 15:31:53 (GMT)
commita8f8d5b4bd30dbe0828550469d98f12d2ebb2ef4 (patch)
treec980c5c35f6c0a8710b7c3ea1bda301b67a395eb /Lib/test/test_site.py
parent79d37ae979a65ada0b2ac820279ccc3b1cd41ba6 (diff)
downloadcpython-a8f8d5b4bd30dbe0828550469d98f12d2ebb2ef4.zip
cpython-a8f8d5b4bd30dbe0828550469d98f12d2ebb2ef4.tar.gz
cpython-a8f8d5b4bd30dbe0828550469d98f12d2ebb2ef4.tar.bz2
bpo-29585: optimize site.py startup time (GH-136)
Avoid importing `sysconfig` from `site` by copying minimum code. Python startup is 5% faster on Linux and 30% faster on macOS
Diffstat (limited to 'Lib/test/test_site.py')
-rw-r--r--Lib/test/test_site.py7
1 files changed, 7 insertions, 0 deletions
diff --git a/Lib/test/test_site.py b/Lib/test/test_site.py
index 1501622..bf7be4e 100644
--- a/Lib/test/test_site.py
+++ b/Lib/test/test_site.py
@@ -180,6 +180,13 @@ class HelperFunctionsTests(unittest.TestCase):
finally:
pth_file.cleanup()
+ def test_getuserbase(self):
+ self.assertEqual(site._getuserbase(), sysconfig._getuserbase())
+
+ def test_get_path(self):
+ self.assertEqual(site._get_path(site._getuserbase()),
+ sysconfig.get_path('purelib', os.name + '_user'))
+
@unittest.skipUnless(site.ENABLE_USER_SITE, "requires access to PEP 370 "
"user-site (site.ENABLE_USER_SITE)")
def test_s_option(self):