summaryrefslogtreecommitdiffstats
path: root/Lib/test/test_site.py
diff options
context:
space:
mode:
authorSteve Dower <steve.dower@microsoft.com>2017-05-23 23:25:25 (GMT)
committerGitHub <noreply@github.com>2017-05-23 23:25:25 (GMT)
commit9b33bf50dae997b01dfe24878a58100da61b89e1 (patch)
tree53f8a3012f23ba54c53a87a541e27d9901c39ea8 /Lib/test/test_site.py
parent66dc33b6822be93f85d84d24d3f9159ff568fbbb (diff)
downloadcpython-9b33bf50dae997b01dfe24878a58100da61b89e1.zip
cpython-9b33bf50dae997b01dfe24878a58100da61b89e1.tar.gz
cpython-9b33bf50dae997b01dfe24878a58100da61b89e1.tar.bz2
Improves test_underpth_nosite_file to reveal why it fails. (#1763)
* Improves test_underpth_nosite_file to reveal why it fails. * Enable building with Windows 10 SDK. * Fix WinSDK detection * Fix initialization on Windows when a ._pth file exists. * Fix tabs * Adds comment about Py_GetPath call.
Diffstat (limited to 'Lib/test/test_site.py')
-rw-r--r--Lib/test/test_site.py16
1 files changed, 10 insertions, 6 deletions
diff --git a/Lib/test/test_site.py b/Lib/test/test_site.py
index 0924f01..1501622 100644
--- a/Lib/test/test_site.py
+++ b/Lib/test/test_site.py
@@ -547,12 +547,16 @@ class _pthFileTests(unittest.TestCase):
env = os.environ.copy()
env['PYTHONPATH'] = 'from-env'
env['PATH'] = '{};{}'.format(exe_prefix, os.getenv('PATH'))
- rc = subprocess.call([exe_file, '-c',
- 'import sys; sys.exit(sys.flags.no_site and '
- 'len(sys.path) > 200 and '
- 'sys.path == %r)' % sys_path,
- ], env=env)
- self.assertTrue(rc, "sys.path is incorrect")
+ output = subprocess.check_output([exe_file, '-c',
+ 'import sys; print("\\n".join(sys.path) if sys.flags.no_site else "")'
+ ], env=env, encoding='ansi')
+ actual_sys_path = output.rstrip().split('\n')
+ self.assert_(actual_sys_path, "sys.flags.no_site was False")
+ self.assertEqual(
+ actual_sys_path,
+ sys_path,
+ "sys.path is incorrect"
+ )
def test_underpth_file(self):
libpath = os.path.dirname(os.path.dirname(encodings.__file__))