From 51ac8fd5607cb65ca061380b7890006ce791df0c Mon Sep 17 00:00:00 2001 From: Kelly Sovacool Date: Mon, 15 Apr 2024 09:55:18 -0400 Subject: [PATCH] test: setup testing infra --- .github/workflows/test.yml | 33 +++++++++++++++++++++++++++++++++ pyproject.toml | 18 +++++++++++++++--- tests/test_cli.py | 9 +++++++++ 3 files changed, 57 insertions(+), 3 deletions(-) create mode 100644 .github/workflows/test.yml create mode 100644 tests/test_cli.py diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml new file mode 100644 index 0000000..1805e2a --- /dev/null +++ b/.github/workflows/test.yml @@ -0,0 +1,33 @@ +name: test + +on: + push: + branches: + - main + - develop + pull_request: + branches: + - main + - develop + +jobs: + test: + runs-on: ubuntu-latest + timeout-minutes: 2 + strategy: + matrix: + python-version: ["3.11"] + steps: + - uses: actions/checkout@v3 + - name: Set up Python ${{ matrix.python-version }} + uses: actions/setup-python@v4 + with: + python-version: ${{ matrix.python-version }} + cache: "pip" + - name: Install dependencies + run: | + python -m pip install --upgrade pip setuptools + pip install .[dev,test] + - name: Test + run: | + python -m pytest diff --git a/pyproject.toml b/pyproject.toml index 8cd3033..5af1d3f 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -8,7 +8,7 @@ build-backend = "setuptools.build_meta" [project] name = "parkit" -version = "2.0.0" +dynamic = ['version','readme'] description = "Parkit" authors = [ { name="kopardev", email="vishal.koparde@nih.gov" }, @@ -17,13 +17,21 @@ license = {file = "LICENSE.md"} readme = "README.md" requires-python = ">=3.11" # keywords = [] -dependencies = ["pandas"] - # classifiers = [ # "Programming Language :: Python :: 3", # "License :: OSI Approved :: MIT License", # "Operating System :: OS Independent", # ] +dependencies = ["pandas"] + +[project.optional-dependencies] +dev = [ + "black >= 22.0.0", + "pre-commit" +] +test = [ + "pytest" +] # [project.urls] # Homepage = "https://github.com/pypa/sampleproject" @@ -34,3 +42,7 @@ parkit = "parkit.__main__:main" parkit_folder2hpcdme = "parkit.parkit_folder2hpcdme:main" parkit_tarball2hpcdme = "parkit.parkit_tarball2hpcdme:main" update_collection_metadata = "parkit.update_collection_metadata:main" + +[tool.setuptools.dynamic] +version = {file = "VERSION"} +readme = {file = "README.md"} diff --git a/tests/test_cli.py b/tests/test_cli.py new file mode 100644 index 0000000..ab3a8d0 --- /dev/null +++ b/tests/test_cli.py @@ -0,0 +1,9 @@ +import pytest +import subprocess + + +def test_help(): + output = subprocess.run( + "parkit --help", capture_output=True, shell=True, text=True + ).stdout + assert "ERROR:HPC_DM_UTILS in unset!" in output