Files
cibuildwheel/test/test_pure_wheel.py
T

40 lines
936 B
Python
Raw Normal View History

import subprocess
2021-01-06 13:50:58 -05:00
import pytest
from test import test_projects
from . import utils
pure_python_project = test_projects.TestProject()
2023-10-27 01:21:20 -04:00
pure_python_project.files["setup.py"] = """
from setuptools import Extension, setup
setup(
name="spam",
py_modules=['spam'],
version="0.1.0",
)
2021-05-03 11:45:43 -04:00
"""
2023-10-27 01:21:20 -04:00
pure_python_project.files["spam.py"] = """
def a_function():
pass
2021-05-03 11:45:43 -04:00
"""
def test(tmp_path, capfd):
# this test checks that if a pure wheel is generated, the build should
# fail.
2021-05-03 11:45:43 -04:00
project_dir = tmp_path / "project"
pure_python_project.generate(project_dir)
with pytest.raises(subprocess.CalledProcessError) as exc_info:
2023-01-30 15:53:44 -05:00
print("produced wheels:", utils.cibuildwheel_run(project_dir))
captured = capfd.readouterr()
2021-05-03 11:45:43 -04:00
print("out", captured.out)
print("err", captured.err)
assert exc_info.value.returncode == 5
assert "Build failed because a pure Python wheel was generated" in captured.err