-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #75 from uclahs-cds/nwiltsie-pyproject.toml
Migrate package configuration to pyproject.toml, establish dynamic versioning
- Loading branch information
Showing
7 changed files
with
83 additions
and
66 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,37 +1,41 @@ | ||
--- | ||
name: pytest | ||
name: Run PyTest | ||
|
||
on: | ||
pull_request: | ||
branches: | ||
- main | ||
push: | ||
branches: | ||
- main | ||
|
||
jobs: | ||
pytest: | ||
runs-on: ubuntu-latest | ||
|
||
timeout-minutes: 15 | ||
strategy: | ||
fail-fast: false | ||
matrix: | ||
python-version: | ||
- "3.8" | ||
- "3.12" | ||
|
||
steps: | ||
- uses: actions/checkout@v4 | ||
- name: Set up Python | ||
uses: actions/setup-python@v4 | ||
uses: actions/setup-python@v5 | ||
with: | ||
python-version: '3.8' | ||
- name: Install dependencies | ||
run: | | ||
python -m pip install --upgrade pip | ||
pip install . | ||
- name: Test with pytest | ||
python-version: ${{ matrix.python-version }} | ||
|
||
- name: Run tests | ||
run: | | ||
pytest test \ | ||
--doctest-modules \ | ||
--junitxml=junit/test-results.xml | ||
pip install tox | ||
tox -e py${{matrix.python-version}} | ||
- name: Upload pytest test results | ||
uses: actions/upload-artifact@v3 | ||
uses: actions/upload-artifact@v4 | ||
if: success() || failure() | ||
with: | ||
name: test-results.xml | ||
name: "pytest-${{ matrix.python-version }}.xml" | ||
path: junit/test-results.xml | ||
if-no-files-found: error | ||
# Use always() to always run this step to publish test results when | ||
# there are test failures | ||
if: ${{ always() }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -16,3 +16,6 @@ build | |
venv | ||
.env | ||
junit | ||
.tox/ | ||
.pytest_cache/ | ||
_version.py |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,10 @@ | ||
"""nftest module""" | ||
"""NFTest module.""" | ||
|
||
__version__ = "1.1.0" | ||
try: | ||
from nftest._version import version as __version__ # noqa: F401 | ||
except ModuleNotFoundError as err: | ||
# The user is probably trying to run this without having installed | ||
# the package, so complain. | ||
raise RuntimeError( | ||
"NFTest is not correctly installed. Please install it with pip." | ||
) from err |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,51 @@ | ||
[build-system] | ||
requires = ["hatchling", "hatch-vcs"] | ||
build-backend = "hatchling.build" | ||
|
||
requires = [ | ||
"setuptools>=42", | ||
"wheel" | ||
[project] | ||
name = "nftest" | ||
dynamic = ["version"] | ||
description = "CLI testing tool for Nextflow" | ||
readme = "README.md" | ||
authors = [ | ||
{ name = "Chenghao Zhu", email = "[email protected]" } | ||
] | ||
classifiers = [ | ||
"Programming Language :: Python :: 3", | ||
"License :: OSI Approved :: GNU General Public License (GPL)", | ||
"Operating System :: OS Independent" | ||
] | ||
requires-python = ">=3.8" | ||
dependencies = [ | ||
"PyYAML", | ||
"python-dotenv", | ||
"pytest", | ||
"mock" | ||
] | ||
|
||
[project.optional-dependencies] | ||
dev = ["pytest", "mock"] | ||
|
||
[project.scripts] | ||
nftest = "nftest.__main__:main" | ||
|
||
[tool.hatch.metadata] | ||
package-data = { "nftest" = ["data/*"] } | ||
|
||
[tool.hatch.version] | ||
source = "vcs" | ||
|
||
[tool.hatch.build.hooks.vcs] | ||
version-file = "nftest/_version.py" | ||
|
||
[tool.tox] | ||
legacy_tox_ini = """ | ||
[tox] | ||
env_list = | ||
py3.8 | ||
py3.12 | ||
build-backend = "setuptools.build_meta" | ||
[testenv] | ||
deps = pytest | ||
commands = pytest test --doctest-modules --junitxml=junit/test-results.xml | ||
""" |