Ensure tests are up-to-date with master

This commit is contained in:
Joe Rickerby
2020-05-02 22:42:35 +01:00
parent 3b35882f87
commit 007be7aea7
8 changed files with 94 additions and 117 deletions
+14 -24
View File
@@ -9,28 +9,21 @@ project_with_before_build_asserts = CTemplateProject(
# assert that the Python version as written to pythonversion.txt in the CIBW_BEFORE_BUILD step
# is the same one as is currently running.
version_file = (
"c:\\pythonversion.txt" if sys.platform == "win32" else "/tmp/pythonversion.txt"
)
version_file = 'c:\\pythonversion.txt' if sys.platform == 'win32' else '/tmp/pythonversion.txt'
with open(version_file) as f:
stored_version = f.read()
print("stored_version", stored_version)
print("sys.version", sys.version)
print('stored_version', stored_version)
print('sys.version', sys.version)
assert stored_version == sys.version
# check that the executable also was written
executable_file = (
"c:\\pythonexecutable.txt" if sys.platform == "win32" else "/tmp/pythonexecutable.txt"
)
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)
print('stored_executable', stored_executable)
print('sys.executable', sys.executable)
# windows/mac are case insensitive
assert (
os.path.realpath(stored_executable).lower()
== os.path.realpath(sys.executable).lower()
)
assert os.path.realpath(stored_executable).lower() == os.path.realpath(sys.executable).lower()
''')
)
@@ -40,16 +33,13 @@ def test(tmpdir):
project_with_before_build_asserts.generate(project_dir)
# build the wheels
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_BUILD": '''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_BUILD_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)"''',
},
)
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_BUILD': '''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_BUILD_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)"''',
})
# also check that we got the right wheels
expected_wheels = utils.expected_wheels("spam", "0.1.0")
expected_wheels = utils.expected_wheels('spam', '0.1.0')
assert set(actual_wheels) == set(expected_wheels)