Skip to content

Commit dbee8d0

Browse files
committed
Configure PYTHONPATH via pytest configuration file
Previously, the python:test task set PYTHONPATH via environment variable. That approach is fine when running the tests via the task, but meant that PYTHONPATH was not correctly configured when running the tests via the interface of an IDE. Each contributor would be forced to configure their IDE in order to allow it to run the tests successfully. Configuring PYTHONPATH via the pytest.ini file makes this universal.
1 parent d3b096d commit dbee8d0

File tree

3 files changed

+3
-1
lines changed

3 files changed

+3
-1
lines changed

.github/workflows/test-python-poetry-task.yml

+2
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ on:
1616
- "pyproject.toml"
1717
- "compilesketches/tests/**"
1818
- "**.py"
19+
- "**/pytest.ini"
1920
pull_request:
2021
paths:
2122
- ".github/workflows/test-python-poetry-task.ya?ml"
@@ -28,6 +29,7 @@ on:
2829
- "pyproject.toml"
2930
- "compilesketches/tests/**"
3031
- "**.py"
32+
- "**/pytest.ini"
3133
schedule:
3234
# Run periodically to catch breakage caused by external changes.
3335
- cron: "0 12 * * WED"

Taskfile.yml

-1
Original file line numberDiff line numberDiff line change
@@ -434,7 +434,6 @@ tasks:
434434
POETRY_GROUPS: dev,main
435435
cmds:
436436
- |
437-
export PYTHONPATH="${PWD}/{{.PYTHON_PROJECT_PATH}}"
438437
poetry run \
439438
coverage run \
440439
--source="{{.PYTHON_PROJECT_PATH}}" \

pytest.ini

+1
Original file line numberDiff line numberDiff line change
@@ -8,3 +8,4 @@ filterwarnings =
88
# --capture=no - disable per-test capture
99
# --tb=long sets the length of the traceback in case of failures
1010
addopts = --capture=no --tb=long --verbose
11+
pythonpath = compilesketches

0 commit comments

Comments
 (0)