Use the new hatch test command to run tests
Signed-off-by: Nic Cope <nicc@rk0n.org>
This commit is contained in:
parent
33ee9e1c4a
commit
d10f084b84
|
@ -28,6 +28,7 @@ concurrency:
|
||||||
env:
|
env:
|
||||||
# Common versions
|
# Common versions
|
||||||
PYTHON_VERSION: '3.11.5'
|
PYTHON_VERSION: '3.11.5'
|
||||||
|
HATCH_VERSION: '1.12.0'
|
||||||
|
|
||||||
# The PyPi project version to push. The default is v0.0.0+gitdate-gitsha.
|
# The PyPi project version to push. The default is v0.0.0+gitdate-gitsha.
|
||||||
PYPI_VERSION: ${{ inputs.version }}
|
PYPI_VERSION: ${{ inputs.version }}
|
||||||
|
@ -45,7 +46,7 @@ jobs:
|
||||||
python-version: ${{ env.PYTHON_VERSION }}
|
python-version: ${{ env.PYTHON_VERSION }}
|
||||||
|
|
||||||
- name: Setup Hatch
|
- name: Setup Hatch
|
||||||
run: pipx install hatch==1.7.0
|
run: pipx install hatch==${{ env.HATCH_VERSION }}
|
||||||
|
|
||||||
- name: Lint
|
- name: Lint
|
||||||
run: hatch run lint:check
|
run: hatch run lint:check
|
||||||
|
@ -62,10 +63,10 @@ jobs:
|
||||||
python-version: ${{ env.PYTHON_VERSION }}
|
python-version: ${{ env.PYTHON_VERSION }}
|
||||||
|
|
||||||
- name: Setup Hatch
|
- name: Setup Hatch
|
||||||
run: pipx install hatch==1.7.0
|
run: pipx install hatch==${{ env.HATCH_VERSION }}
|
||||||
|
|
||||||
- name: Run Unit Tests
|
- name: Run Unit Tests
|
||||||
run: hatch run test:unit
|
run: hatch test --all --randomize
|
||||||
|
|
||||||
|
|
||||||
build:
|
build:
|
||||||
|
@ -80,7 +81,7 @@ jobs:
|
||||||
python-version: ${{ env.PYTHON_VERSION }}
|
python-version: ${{ env.PYTHON_VERSION }}
|
||||||
|
|
||||||
- name: Setup Hatch
|
- name: Setup Hatch
|
||||||
run: pipx install hatch==1.7.0
|
run: pipx install hatch==${{ env.HATCH_VERSION }}
|
||||||
|
|
||||||
# If a version wasn't explicitly passed as a workflow_dispatch input we
|
# If a version wasn't explicitly passed as a workflow_dispatch input we
|
||||||
# default to version v0.0.0+<git-commit-date>-<git-short-sha>, for example
|
# default to version v0.0.0+<git-commit-date>-<git-short-sha>, for example
|
||||||
|
@ -143,7 +144,7 @@ jobs:
|
||||||
python-version: ${{ env.PYTHON_VERSION }}
|
python-version: ${{ env.PYTHON_VERSION }}
|
||||||
|
|
||||||
- name: Setup Hatch
|
- name: Setup Hatch
|
||||||
run: pipx install hatch==1.7.0
|
run: pipx install hatch==${{ env.HATCH_VERSION }}
|
||||||
|
|
||||||
- name: Build Documentation
|
- name: Build Documentation
|
||||||
run: hatch run docs:pdoc -d google crossplane/function -o docs
|
run: hatch run docs:pdoc -d google crossplane/function -o docs
|
||||||
|
|
|
@ -38,7 +38,7 @@ hatch run generate:protoc
|
||||||
hatch run lint:check
|
hatch run lint:check
|
||||||
|
|
||||||
# Run unit tests.
|
# Run unit tests.
|
||||||
hatch run test:unit
|
hatch test
|
||||||
|
|
||||||
# Build an sdist and wheel.
|
# Build an sdist and wheel.
|
||||||
hatch build
|
hatch build
|
||||||
|
|
|
@ -58,14 +58,6 @@ dependencies = ["ruff==0.6.9"]
|
||||||
[tool.hatch.envs.lint.scripts]
|
[tool.hatch.envs.lint.scripts]
|
||||||
check = "ruff format crossplane tests && ruff check --fix crossplane tests"
|
check = "ruff format crossplane tests && ruff check --fix crossplane tests"
|
||||||
|
|
||||||
|
|
||||||
[tool.hatch.envs.test]
|
|
||||||
type = "virtual"
|
|
||||||
path = ".venv-test"
|
|
||||||
|
|
||||||
[tool.hatch.envs.test.scripts]
|
|
||||||
unit = "python -m unittest tests/*.py"
|
|
||||||
|
|
||||||
[tool.hatch.envs.docs]
|
[tool.hatch.envs.docs]
|
||||||
type = "virtual"
|
type = "virtual"
|
||||||
path = ".venv-docs"
|
path = ".venv-docs"
|
||||||
|
|
|
@ -22,8 +22,7 @@ from google.protobuf import struct_pb2 as structpb
|
||||||
|
|
||||||
import crossplane.function.proto.v1.run_function_pb2 as fnv1
|
import crossplane.function.proto.v1.run_function_pb2 as fnv1
|
||||||
from crossplane.function import logging, resource
|
from crossplane.function import logging, resource
|
||||||
|
from tests.testdata.models.io.upbound.aws.s3 import v1beta2
|
||||||
from .testdata.models.io.upbound.aws.s3 import v1beta2
|
|
||||||
|
|
||||||
|
|
||||||
class TestResource(unittest.TestCase):
|
class TestResource(unittest.TestCase):
|
||||||
|
|
Loading…
Reference in New Issue