Sample build uses a testcase failure project

This commit is contained in:
Joe Rickerby
2020-11-04 16:08:40 +00:00
parent fbbc295901
commit c9ea0251fe
2 changed files with 20 additions and 13 deletions
+7 -11
View File
@@ -24,17 +24,13 @@ jobs:
- name: Generate sample project - name: Generate sample project
run: | run: |
python -m test.test_projects test.test_testing.project_with_a_test sample_project if $should_fail; then
python -m test.test_projects test.test_testing.project_with_a_failing_test sample_project
- name: Add a failing test else
if: matrix.result == 'failure' python -m test.test_projects test.test_testing.project_with_a_test sample_project
run: | fi
cd sample_project env:
echo ' should_fail: ${{ matrix.result == 'failure' }}
class AnotherTest:
def test_something(self):
self.fail("sabotage!")
' >> test/spam_test.py
- name: Build & test wheels - name: Build & test wheels
run: | run: |
+13 -2
View File
@@ -103,15 +103,26 @@ def test_extras_require(tmp_path):
assert set(actual_wheels) == set(expected_wheels) assert set(actual_wheels) == set(expected_wheels)
project_with_a_failing_test = test_projects.new_c_project()
project_with_a_failing_test.files['test/spam_test.py'] = r'''
from unittest import TestCase
class TestSpam(TestCase):
def test_something(self):
self.fail('this test is supposed to fail')
'''
def test_failing_test(tmp_path): def test_failing_test(tmp_path):
"""Ensure a failing test causes cibuildwheel to error out and exit""" """Ensure a failing test causes cibuildwheel to error out and exit"""
project_dir = tmp_path / 'project' project_dir = tmp_path / 'project'
output_dir = tmp_path / 'output' output_dir = tmp_path / 'output'
project_with_a_test.generate(project_dir) project_with_a_failing_test.generate(project_dir)
with pytest.raises(subprocess.CalledProcessError): with pytest.raises(subprocess.CalledProcessError):
utils.cibuildwheel_run(project_dir, output_dir=output_dir, add_env={ utils.cibuildwheel_run(project_dir, output_dir=output_dir, add_env={
'CIBW_TEST_COMMAND': 'false', 'CIBW_TEST_REQUIRES': 'nose',
'CIBW_TEST_COMMAND': 'nosetests {project}/test',
# manylinux1 has a version of bash that's been shown to have # manylinux1 has a version of bash that's been shown to have
# problems with this, so let's check that. # problems with this, so let's check that.
'CIBW_MANYLINUX_I686_IMAGE': 'manylinux1', 'CIBW_MANYLINUX_I686_IMAGE': 'manylinux1',