Skip to content

Commit

Permalink
Merge pull request #523 from afuetterer/hatch-test
Browse files Browse the repository at this point in the history
build: switch to hatch test environment
  • Loading branch information
huberrob authored Aug 6, 2024
2 parents bc3cc11 + c7f2086 commit 32b09d8
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 23 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ jobs:
- run: |
python -m pip install --upgrade pip
python -m pip install hatch
- name: Run test suite with coverage
run: hatch run cov --cov-report=xml
- name: Run test suite in parallel with measuring code coverage
run: hatch test --cover-quiet --parallel
- name: Upload coverage data to coveralls.io
uses: coverallsapp/github-action@643bc377ffa44ace6394b2b5d0d3950076de9f63 # v2.3.0
6 changes: 3 additions & 3 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ Here's how to set up F-UJI for local development.
tests:
```console
$ hatch run lint
$ hatch run test
$ hatch test
```

6. Commit your changes and push your branch to GitHub:
Expand Down Expand Up @@ -108,8 +108,8 @@ Before you submit a pull request, check that it meets these guidelines:
To run a subset of tests:

```console
$ hatch run test tests/api
$ hatch run test -m smoke
$ hatch test tests/api
$ hatch test -m smoke
```

---
Expand Down
37 changes: 19 additions & 18 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -64,28 +64,15 @@ requires-python = "~=3.11" # at the moment only Python 3.11 is supported
version = "3.2.2"

[project.optional-dependencies]
dev = [
"fuji[lint,testing]"
]
docs = [
"myst-parser~=3.0",
"sphinx~=7.2",
"sphinx-rtd-theme~=2.0"
]
lint = [
"pre-commit~=3.4"
]
report = [
"bokeh~=3.2",
"jupyter~=1.0"
]
testing = [
"pytest~=8.0",
"pytest-cov~=5.0",
"pytest-randomly~=3.15",
"pytest-recording~=0.13",
"pytest-xdist~=3.3"
]

[project.urls]
Homepage = "https://www.f-uji.net"
Expand Down Expand Up @@ -115,18 +102,32 @@ include = [
packages = ["fuji_server"]

[tool.hatch.envs.default]
features = [
"lint",
"testing"
dependencies = [
"pre-commit"
]
post-install-commands = [
"pre-commit install"
]

[tool.hatch.envs.default.scripts]
cov = "pytest --cov {args}"
lint = "pre-commit run --all-files --color=always {args}"
test = "pytest {args}"

[tool.hatch.envs.hatch-test]
# Ref: https://hatch.pypa.io/latest/config/internal/testing/
extra-dependencies = [
"pytest-recording~=0.13"
]
randomize = true # run tests in random order

[tool.hatch.envs.hatch-test.scripts]
cov-combine = """
coverage combine
coverage xml
"""
cov-report = "coverage report"
# Ref: https://hatch.pypa.io/latest/config/internal/testing/#scripts
run = "pytest{env:HATCH_TEST_ARGS:} {args}"
run-cov = "coverage run -m pytest{env:HATCH_TEST_ARGS:} {args}"

[tool.pytest.ini_options]
filterwarnings = [
Expand Down

0 comments on commit 32b09d8

Please sign in to comment.