diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml new file mode 100644 index 0000000..c2b5b4a --- /dev/null +++ b/.github/workflows/test.yml @@ -0,0 +1,35 @@ +name: Run tests + +on: + push: + branches: + - main + pull_request: + branches: + - main + +jobs: + test: + runs-on: ${{ matrix.os }} + strategy: + matrix: + python-version: ['3.10', '3.11', '3.12'] + os: [ubuntu-latest, macOS-latest, windows-latest] + fail-fast: false # Continue running jobs even if one fails + + steps: + - name: Checkout repository + uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 #v4.1.17 + + - name: Set up PDM + uses: pdm-project/setup-pdm@568ddd69406b30de1774ec0044b73ae06e716aa4 # v4.1 + with: + python-version: ${{ matrix.python-version }} + + - name: Install dependencies + run: | + pdm sync --dev --group testing + + - name: Run Tests + run: | + pdm run --verbose pytest tests diff --git a/pdm.lock b/pdm.lock index 2cd31e6..3e4af65 100644 --- a/pdm.lock +++ b/pdm.lock @@ -2,10 +2,10 @@ # It is not intended for manual editing. [metadata] -groups = ["default"] +groups = ["default", "testing"] strategy = ["inherit_metadata"] lock_version = "4.5.0" -content_hash = "sha256:77f729e07ab9b8f6a4c137d4a3f3eeefb2a9cc45d9f8c7f42fc82f6ebf17c478" +content_hash = "sha256:7ce8c6de2bc4c00032a81d7b941be8eb14a4b6bc550a517ef83e3d8d14b4e2dd" [[metadata.targets]] requires_python = ">=3.10" @@ -72,8 +72,8 @@ name = "colorama" version = "0.4.6" requires_python = "!=3.0.*,!=3.1.*,!=3.2.*,!=3.3.*,!=3.4.*,!=3.5.*,!=3.6.*,>=2.7" summary = "Cross-platform colored terminal text." -groups = ["default"] -marker = "platform_system == \"Windows\"" +groups = ["default", "testing"] +marker = "sys_platform == \"win32\" or platform_system == \"Windows\"" files = [ {file = "colorama-0.4.6-py2.py3-none-any.whl", hash = "sha256:4f1d9991f5acc0ca119f9d443620b77f9d6b33703e51011c16baf57afb285fc6"}, {file = "colorama-0.4.6.tar.gz", hash = "sha256:08695f5cb7ed6e0531a20572697297273c47b8cae5a63ffc6d6ed5c201be6e44"}, @@ -84,7 +84,7 @@ name = "exceptiongroup" version = "1.2.2" requires_python = ">=3.7" summary = "Backport of PEP 654 (exception groups)" -groups = ["default"] +groups = ["default", "testing"] marker = "python_version < \"3.11\"" files = [ {file = "exceptiongroup-1.2.2-py3-none-any.whl", hash = "sha256:3111b9d131c238bec2f8f516e123e14ba243563fb135d3fe885990585aa7795b"}, @@ -118,6 +118,17 @@ files = [ {file = "idna-3.7.tar.gz", hash = "sha256:028ff3aadf0609c1fd278d8ea3089299412a7a8b9bd005dd08b9f8285bcb5cfc"}, ] +[[package]] +name = "iniconfig" +version = "2.0.0" +requires_python = ">=3.7" +summary = "brain-dead simple config-ini parsing" +groups = ["testing"] +files = [ + {file = "iniconfig-2.0.0-py3-none-any.whl", hash = "sha256:b6a85871a79d2e3b22d2d1b94ac2824226a63c6b741c88f7ae975f18b6778374"}, + {file = "iniconfig-2.0.0.tar.gz", hash = "sha256:2d91e135bf72d31a410b17c16da610a82cb55f6b0477d1a902134b24a455b8b3"}, +] + [[package]] name = "markdown-it-py" version = "3.0.0" @@ -143,6 +154,28 @@ files = [ {file = "mdurl-0.1.2.tar.gz", hash = "sha256:bb413d29f5eea38f31dd4754dd7377d4465116fb207585f97bf925588687c1ba"}, ] +[[package]] +name = "packaging" +version = "24.1" +requires_python = ">=3.8" +summary = "Core utilities for Python packages" +groups = ["testing"] +files = [ + {file = "packaging-24.1-py3-none-any.whl", hash = "sha256:5b8f2217dbdbd2f7f384c41c628544e6d52f2d0f53c6d0c3ea61aa5d1d7ff124"}, + {file = "packaging-24.1.tar.gz", hash = "sha256:026ed72c8ed3fcce5bf8950572258698927fd1dbda10a5e981cdf0ac37f4f002"}, +] + +[[package]] +name = "pluggy" +version = "1.5.0" +requires_python = ">=3.8" +summary = "plugin and hook calling mechanisms for python" +groups = ["testing"] +files = [ + {file = "pluggy-1.5.0-py3-none-any.whl", hash = "sha256:44e1ad92c8ca002de6377e165f3e0f1be63266ab4d554740532335b9d75ea669"}, + {file = "pluggy-1.5.0.tar.gz", hash = "sha256:2cffa88e94fdc978c4c574f15f9e59b7f4201d439195c3715ca9e2486f1d0cf1"}, +] + [[package]] name = "prometheus-client" version = "0.20.0" @@ -266,6 +299,25 @@ files = [ {file = "pygments-2.18.0.tar.gz", hash = "sha256:786ff802f32e91311bff3889f6e9a86e81505fe99f2735bb6d60ae0c5004f199"}, ] +[[package]] +name = "pytest" +version = "8.3.2" +requires_python = ">=3.8" +summary = "pytest: simple powerful testing with Python" +groups = ["testing"] +dependencies = [ + "colorama; sys_platform == \"win32\"", + "exceptiongroup>=1.0.0rc8; python_version < \"3.11\"", + "iniconfig", + "packaging", + "pluggy<2,>=1.5", + "tomli>=1; python_version < \"3.11\"", +] +files = [ + {file = "pytest-8.3.2-py3-none-any.whl", hash = "sha256:4ba08f9ae7dcf84ded419494d229b48d0903ea6407b030eaec46df5e6a73bba5"}, + {file = "pytest-8.3.2.tar.gz", hash = "sha256:c132345d12ce551242c87269de812483f5bcc87cdbb4722e48487ba194f9fdce"}, +] + [[package]] name = "rich" version = "13.7.1" @@ -350,6 +402,18 @@ files = [ {file = "starlette-0.38.2.tar.gz", hash = "sha256:c7c0441065252160993a1a37cf2a73bb64d271b17303e0b0c1eb7191cfb12d75"}, ] +[[package]] +name = "tomli" +version = "2.0.1" +requires_python = ">=3.7" +summary = "A lil' TOML parser" +groups = ["testing"] +marker = "python_version < \"3.11\"" +files = [ + {file = "tomli-2.0.1-py3-none-any.whl", hash = "sha256:939de3e7a6161af0c887ef91b7d41a53e7c5a1ca976325f429cb46ea9bc30ecc"}, + {file = "tomli-2.0.1.tar.gz", hash = "sha256:de526c12914f0c550d15924c62d72abc48d6fe7364aa87328337a31007fe8a4f"}, +] + [[package]] name = "typer" version = "0.12.4" diff --git a/pyproject.toml b/pyproject.toml index a3789ea..5bd5b1a 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -11,9 +11,9 @@ classifiers = [ ] requires-python = ">=3.10" dependencies = [ - "prometheus-fastapi-instrumentator>=7.0.0,<8", - "sentry-sdk[fastapi]>=2.13.0,<3", - "typer>=0.12.4,<1", + "prometheus-fastapi-instrumentator>=7.0.0", + "sentry-sdk[fastapi]>=2.13.0", + "typer>=0.12.4", ] dynamic = ["version"] @@ -21,6 +21,10 @@ dynamic = ["version"] [project.urls] Homepage = "https://github.com/watonomous/watcloud-utils" +[project.optional-dependencies] +testing = [ + "pytest>=8.3.2", +] [build-system] requires = ["pdm-backend"] build-backend = "pdm.backend" diff --git a/tests/test_sanity.py b/tests/test_sanity.py new file mode 100644 index 0000000..f8991b2 --- /dev/null +++ b/tests/test_sanity.py @@ -0,0 +1,4 @@ +import watcloud_utils + +def test_version(): + assert hasattr(watcloud_utils, "__version__") and watcloud_utils.__version__ is not None