Files
cibuildwheel/test/test_pure_wheel.py
T

45 lines
967 B
Python
Raw Normal View History

from __future__ import annotations
import subprocess
from test import test_projects
2021-01-06 13:50:58 -05:00
import pytest
from . import utils
pure_python_project = test_projects.TestProject()
2021-04-30 17:56:34 -04:00
pure_python_project.files[
2021-05-03 11:45:43 -04:00
"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
"""
2021-04-30 17:56:34 -04:00
pure_python_project.files[
2021-05-03 11:45:43 -04:00
"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):
actual_wheels = utils.cibuildwheel_run(project_dir)
2021-05-03 11:45:43 -04:00
print("produced wheels:", actual_wheels)
captured = capfd.readouterr()
2021-05-03 11:45:43 -04:00
print("out", captured.out)
print("err", captured.err)
assert "Build failed because a pure Python wheel was generated" in captured.err