Skip to content

Commit

Permalink
fix running pytest in github and locally with pytest 8.0.0
Browse files Browse the repository at this point in the history
  • Loading branch information
mjmader committed Feb 2, 2024
1 parent 1581c53 commit 17385e9
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 11 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/check-datasources.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,8 @@ jobs:
- name: "[DE/BNA] Data retrieval check"
run: |
pytest tests/integration/test_int_de_bna.py
python -m pytest tests/integration/test_int_de_bna.py
- name: "[FR] Data retrieval check"
run: |
pytest tests/integration/test_int_fr_france.py
python -m pytest tests/integration/test_int_fr_france.py
2 changes: 1 addition & 1 deletion .github/workflows/python-app.yml
Original file line number Diff line number Diff line change
Expand Up @@ -45,4 +45,4 @@ jobs:
- name: Run tests
run: |
pip install -r test/requirements.txt
pytest -m "not check_datasource"
python -m pytest -m "not check_datasource"
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -193,14 +193,14 @@ Before you run the tests you need to install test dependencies by
pip install -r test/requirements.txt
```

You can run all tests under `/test` by running the following command:
You can run all tests by running the following command:

```bash
# to run all tests, use:
pytest
python -m pytest

# ... or the following to run only the unit tests, i.e. not the integration tests (which run a bit longer):
pytest -m 'not integration_test' -W ignore::DeprecationWarning
python -m pytest -m 'not integration_test'
```

#### Testdata import / Integration test for the merger
Expand Down
14 changes: 9 additions & 5 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -15,16 +15,20 @@ requires = [
build-backend = "setuptools.build_meta"

[tool.pytest.ini_options]

# Set logging for code under test
addopts = "--verbose --capture=no --log-cli-level=DEBUG --log-cli-format='%(asctime)s %(levelname)s %(message)s' --log-cli-date-format='%Y-%m-%d %H:%M:%S' -W ignore::DeprecationWarning"

addopts = [
"--import-mode=importlib",
"--capture=no",
"--log-level=WARN",
"--log-cli-level=DEBUG",
"--log-cli-format='%(asctime)s %(levelname)s %(message)s'",
"--log-cli-date-format='%Y-%m-%d %H:%M:%S'",
"-W ignore::DeprecationWarning"
]
# Limit search for tests to following folders
testpaths = [
"test", # TODO: move content to tests/unit/ folder
"tests",
]

# Declare custom markers
markers = [
"integration_test: marks tests as integration tests (deselect with '-m \"not integration_test\"')",
Expand Down

0 comments on commit 17385e9

Please sign in to comment.