Skip to content

Commit 60ed7cc

Browse files
committed
Add back {project} placeholders to CIBW_TEST_COMMAND in tests
1 parent 9bc3209 commit 60ed7cc

File tree

7 files changed

+26
-39
lines changed

7 files changed

+26
-39
lines changed

docs/configuration.md

Lines changed: 6 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ cibuildwheel to run tests, add the following YAML to your CI config file:
1717
```yaml
1818
env:
1919
CIBW_TEST_REQUIRES: pytest
20-
CIBW_TEST_COMMAND: "pytest ./tests"
20+
CIBW_TEST_COMMAND: "pytest {project}/tests"
2121
```
2222

2323
!!! tab "Azure Pipelines"
@@ -27,7 +27,7 @@ cibuildwheel to run tests, add the following YAML to your CI config file:
2727
```yaml
2828
variables:
2929
CIBW_TEST_REQUIRES: pytest
30-
CIBW_TEST_COMMAND: "pytest ./tests"
30+
CIBW_TEST_COMMAND: "pytest {project}/tests"
3131
```
3232

3333
!!! tab "Travis CI"
@@ -38,18 +38,7 @@ cibuildwheel to run tests, add the following YAML to your CI config file:
3838
env:
3939
global:
4040
- CIBW_TEST_REQUIRES=pytest
41-
- CIBW_TEST_COMMAND="pytest ./tests"
42-
```
43-
44-
!!! tab "AppVeyor"
45-
46-
> appveyor.yml ([docs](https://www.appveyor.com/docs/build-configuration/#environment-variables))
47-
48-
```yaml
49-
environment:
50-
global:
51-
CIBW_TEST_REQUIRES: pytest
52-
CIBW_TEST_COMMAND: "pytest {project}\\tests"
41+
- CIBW_TEST_COMMAND="pytest {project}/tests"
5342
```
5443

5544
!!! tab "CircleCI"
@@ -61,7 +50,7 @@ cibuildwheel to run tests, add the following YAML to your CI config file:
6150
job_name:
6251
environment:
6352
CIBW_TEST_REQUIRES: pytest
64-
CIBW_TEST_COMMAND: "pytest ./tests"
53+
CIBW_TEST_COMMAND: "pytest {project}/tests"
6554
```
6655

6756
!!! tab "Gitlab CI"
@@ -72,7 +61,7 @@ cibuildwheel to run tests, add the following YAML to your CI config file:
7261
linux:
7362
variables:
7463
CIBW_TEST_REQUIRES: pytest
75-
CIBW_TEST_COMMAND: "pytest ./tests"
64+
CIBW_TEST_COMMAND: "pytest {project}/tests"
7665
```
7766

7867
!!! tab "Cirrus CI"
@@ -82,7 +71,7 @@ cibuildwheel to run tests, add the following YAML to your CI config file:
8271
```yaml
8372
env:
8473
CIBW_TEST_REQUIRES: pytest
85-
CIBW_TEST_COMMAND: "pytest ./tests"
74+
CIBW_TEST_COMMAND: "pytest {project}/tests"
8675
```
8776

8877
## Configuration file {: #configuration-file}

docs/options.md

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ This option can also be set using the [command-line option](#command-line) `--pl
2828

2929
```bash
3030
export CIBW_BUILD='cp37-*'
31-
export CIBW_TEST_COMMAND='pytest ./tests'
31+
export CIBW_TEST_COMMAND='pytest {project}/tests'
3232
cibuildwheel --platform linux .
3333
```
3434

@@ -1318,18 +1318,18 @@ Platform-specific environment variables are also available:<br/>
13181318
```toml
13191319
[tool.cibuildwheel]
13201320
# Run the package tests using `pytest`
1321-
test-command = "pytest ./tests"
1321+
test-command = "pytest {project}/tests"
13221322

13231323
# Trigger an install of the package, but run nothing of note
13241324
test-command = "echo Wheel installed"
13251325

13261326
# Multiline example
13271327
test-command = [
1328-
"pytest ./tests",
1329-
"python ./test.py",
1328+
"pytest {project}/tests",
1329+
"python {project}/test.py",
13301330
]
13311331

1332-
# run tests on ios
1332+
# run tests on ios - when test-sources is set, use relative paths, not {project} or {package}
13331333
[tool.cibuildwheel.ios]
13341334
test-sources = ["tests"]
13351335
test-command = "python -m pytest ./tests"
@@ -1341,17 +1341,17 @@ Platform-specific environment variables are also available:<br/>
13411341

13421342
```yaml
13431343
# Run the package tests using `pytest`
1344-
CIBW_TEST_COMMAND: pytest ./tests
1344+
CIBW_TEST_COMMAND: pytest {project}/tests
13451345

13461346
# Trigger an install of the package, but run nothing of note
13471347
CIBW_TEST_COMMAND: "echo Wheel installed"
13481348

13491349
# Multi-line example - join with && on all platforms
13501350
CIBW_TEST_COMMAND: >
1351-
pytest ./tests &&
1352-
python ./test.py
1351+
pytest {project}/tests &&
1352+
python {project}/test.py
13531353

1354-
# run tests on ios
1354+
# run tests on ios - when test-sources is set, use relative paths, not {project} or {package}
13551355
CIBW_TEST_SOURCES_IOS: tests
13561356
CIBW_TEST_COMMAND_IOS: python -m pytest ./tests
13571357
```

test/test_before_test.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -62,10 +62,10 @@ def test(tmp_path, build_frontend_env):
6262
"CIBW_TEST_REQUIRES": "pytest",
6363
# the 'false ||' bit is to ensure this command runs in a shell on
6464
# mac/linux.
65-
"CIBW_TEST_COMMAND": f"false || {utils.invoke_pytest()} ./test",
65+
"CIBW_TEST_COMMAND": f"false || {utils.invoke_pytest()} {{project}}/test",
6666
# pytest fails on GraalPy 24.2.0 on Windows so we skip it there
6767
# until https://github.com/oracle/graalpython/issues/490 is fixed
68-
"CIBW_TEST_COMMAND_WINDOWS": "where graalpy || pytest ./test",
68+
"CIBW_TEST_COMMAND_WINDOWS": "where graalpy || pytest {{project}}/test",
6969
**build_frontend_env,
7070
},
7171
)

test/test_emulation.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ def test(tmp_path, request):
3232
project_dir,
3333
add_env={
3434
"CIBW_TEST_REQUIRES": "pytest",
35-
"CIBW_TEST_COMMAND": "pytest ./test",
35+
"CIBW_TEST_COMMAND": "pytest {project}/test",
3636
"CIBW_ARCHS": archs,
3737
# TODO remove me once proper support is added
3838
"CIBW_MANYLINUX_RISCV64_IMAGE": "ghcr.io/mayeut/manylinux_2_35:2025.05.11-1",

test/test_macos_archs.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,11 +42,9 @@ def test_cross_compiled_build(tmp_path):
4242
@pytest.mark.parametrize(
4343
"test_config",
4444
[
45-
# Run the test suite in the project folder
4645
{
4746
"CIBW_TEST_COMMAND": '''python -c "import platform; print('running tests on ' + platform.machine())"''',
4847
},
49-
# Nominate the set of test sources to copy
5048
{
5149
"CIBW_TEST_COMMAND": "python tests/test_suite.py",
5250
"CIBW_TEST_SOURCES": "tests",

test/test_pyodide.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,7 @@ def test_filter():
129129
add_args=["--platform", "pyodide"],
130130
add_env={
131131
"CIBW_TEST_REQUIRES": "pytest",
132-
"CIBW_TEST_COMMAND": "python -m pytest",
132+
"CIBW_TEST_COMMAND": "python -m pytest {project}",
133133
},
134134
)
135135
# check that the expected wheels are produced

test/test_testing.py

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -86,10 +86,10 @@ def test(tmp_path):
8686
"CIBW_TEST_REQUIRES": "pytest",
8787
# the 'false ||' bit is to ensure this command runs in a shell on
8888
# mac/linux.
89-
"CIBW_TEST_COMMAND": f"false || {utils.invoke_pytest()} ./test",
89+
"CIBW_TEST_COMMAND": f"false || {utils.invoke_pytest()} {{project}}/test",
9090
# pytest fails on GraalPy 24.2.0 on Windows so we skip it there
9191
# until https://github.com/oracle/graalpython/issues/490 is fixed
92-
"CIBW_TEST_COMMAND_WINDOWS": "COLOR 00 || where graalpy || pytest ./test",
92+
"CIBW_TEST_COMMAND_WINDOWS": "COLOR 00 || where graalpy || pytest {project}/test",
9393
},
9494
)
9595

@@ -109,10 +109,10 @@ def test_extras_require(tmp_path):
109109
"CIBW_TEST_EXTRAS": "test",
110110
# the 'false ||' bit is to ensure this command runs in a shell on
111111
# mac/linux.
112-
"CIBW_TEST_COMMAND": f"false || {utils.invoke_pytest()} ./test",
112+
"CIBW_TEST_COMMAND": f"false || {utils.invoke_pytest()} {{project}}/test",
113113
# pytest fails on GraalPy 24.2.0 on Windows so we skip it there
114114
# until https://github.com/oracle/graalpython/issues/490 is fixed
115-
"CIBW_TEST_COMMAND_WINDOWS": "COLOR 00 || where graalpy || pytest ./test",
115+
"CIBW_TEST_COMMAND_WINDOWS": "COLOR 00 || where graalpy || pytest {project}/test",
116116
},
117117
single_python=True,
118118
)
@@ -143,10 +143,10 @@ def test_dependency_groups(tmp_path):
143143
"CIBW_TEST_GROUPS": "dev",
144144
# the 'false ||' bit is to ensure this command runs in a shell on
145145
# mac/linux.
146-
"CIBW_TEST_COMMAND": f"false || {utils.invoke_pytest()} ./test",
146+
"CIBW_TEST_COMMAND": f"false || {utils.invoke_pytest()} {{project}}/test",
147147
# pytest fails on GraalPy 24.2.0 on Windows so we skip it there
148148
# until https://github.com/oracle/graalpython/issues/490 is fixed
149-
"CIBW_TEST_COMMAND_WINDOWS": "COLOR 00 || where graalpy || pytest ./test",
149+
"CIBW_TEST_COMMAND_WINDOWS": "COLOR 00 || where graalpy || pytest {project}/test",
150150
},
151151
single_python=True,
152152
)
@@ -178,7 +178,7 @@ def test_failing_test(tmp_path):
178178
output_dir=output_dir,
179179
add_env={
180180
"CIBW_TEST_REQUIRES": "pytest",
181-
"CIBW_TEST_COMMAND": f"{utils.invoke_pytest()} ./test",
181+
"CIBW_TEST_COMMAND": f"{utils.invoke_pytest()} {{project}}/test",
182182
# CPython 3.8 when running on macOS arm64 is unusual. The build
183183
# always runs in x86_64, so the arm64 tests are not run. See
184184
# #1169 for reasons why. That means the build succeeds, which

0 commit comments

Comments
 (0)