From 7e566e46eee4b37c54bfa7881b50c3676091cad5 Mon Sep 17 00:00:00 2001 From: Grzegorz Bokota Date: Sun, 8 Mar 2020 14:25:36 +0100 Subject: [PATCH] uses sys.prefix instead of sys.executable in before_test --- test/11_before_test/cibuildwheel_test.py | 4 ++-- test/11_before_test/test/spam_test.py | 16 ++++++++-------- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/test/11_before_test/cibuildwheel_test.py b/test/11_before_test/cibuildwheel_test.py index 7db1b127..5aa1c4ca 100644 --- a/test/11_before_test/cibuildwheel_test.py +++ b/test/11_before_test/cibuildwheel_test.py @@ -9,8 +9,8 @@ def test(): actual_wheels = utils.cibuildwheel_run(project_dir, add_env={ # write python version information to a temporary file, this is # checked in setup.py - 'CIBW_BEFORE_TEST': '''python -c "import sys; open('/tmp/pythonversion.txt', 'w').write(sys.version)" && python -c "import sys; open('/tmp/pythonexecutable.txt', 'w').write(sys.executable)"''', - 'CIBW_BEFORE_TEST_WINDOWS': '''python -c "import sys; open('c:\\pythonversion.txt', 'w').write(sys.version)" && python -c "import sys; open('c:\\pythonexecutable.txt', 'w').write(sys.executable)"''', + 'CIBW_BEFORE_TEST': '''python -c "import sys; open('/tmp/pythonversion.txt', 'w').write(sys.version)" && python -c "import sys; open('/tmp/pythonprefix.txt', 'w').write(sys.prefix)"''', + 'CIBW_BEFORE_TEST_WINDOWS': '''python -c "import sys; open('c:\\pythonversion.txt', 'w').write(sys.version)" && python -c "import sys; open('c:\\pythonprefix.txt', 'w').write(sys.prefix)"''', 'CIBW_TEST_REQUIRES': 'nose', # the 'false ||' bit is to ensure this command runs in a shell on # mac/linux. diff --git a/test/11_before_test/test/spam_test.py b/test/11_before_test/test/spam_test.py index e25cc0c7..21bad8c2 100644 --- a/test/11_before_test/test/spam_test.py +++ b/test/11_before_test/test/spam_test.py @@ -15,14 +15,14 @@ class TestBeforeTest(TestCase): print('sys.version', sys.version) assert stored_version == sys.version - def test_executable(self): - # check that the executable also was written - executable_file = 'c:\\pythonexecutable.txt' if sys.platform == 'win32' else '/tmp/pythonexecutable.txt' - with open(executable_file) as f: - stored_executable = f.read() - print('stored_executable', stored_executable) - print('sys.executable', sys.executable) + def test_prefix(self): + # check that the prefix also was written + prefix_file = 'c:\\pythonprefix.txt' if sys.platform == 'win32' else '/tmp/pythonprefix.txt' + with open(prefix_file) as f: + stored_prefix = f.read() + print('stored_prefix', stored_prefix) + print('sys.prefix', sys.prefix) # Works around path-comparison bugs caused by short-paths on Windows e.g. # vssadm~1 instead of vssadministrator - assert os.stat(stored_executable) == os.stat(sys.executable) + assert os.stat(stored_prefix) == os.stat(sys.prefix)