Skip to content

Commit d10f084

Browse files
committed
Use the new hatch test command to run tests
Signed-off-by: Nic Cope <[email protected]>
1 parent 33ee9e1 commit d10f084

File tree

4 files changed

+8
-16
lines changed

4 files changed

+8
-16
lines changed

.github/workflows/ci.yml

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ concurrency:
2828
env:
2929
# Common versions
3030
PYTHON_VERSION: '3.11.5'
31+
HATCH_VERSION: '1.12.0'
3132

3233
# The PyPi project version to push. The default is v0.0.0+gitdate-gitsha.
3334
PYPI_VERSION: ${{ inputs.version }}
@@ -45,7 +46,7 @@ jobs:
4546
python-version: ${{ env.PYTHON_VERSION }}
4647

4748
- name: Setup Hatch
48-
run: pipx install hatch==1.7.0
49+
run: pipx install hatch==${{ env.HATCH_VERSION }}
4950

5051
- name: Lint
5152
run: hatch run lint:check
@@ -62,10 +63,10 @@ jobs:
6263
python-version: ${{ env.PYTHON_VERSION }}
6364

6465
- name: Setup Hatch
65-
run: pipx install hatch==1.7.0
66+
run: pipx install hatch==${{ env.HATCH_VERSION }}
6667

6768
- name: Run Unit Tests
68-
run: hatch run test:unit
69+
run: hatch test --all --randomize
6970

7071

7172
build:
@@ -80,7 +81,7 @@ jobs:
8081
python-version: ${{ env.PYTHON_VERSION }}
8182

8283
- name: Setup Hatch
83-
run: pipx install hatch==1.7.0
84+
run: pipx install hatch==${{ env.HATCH_VERSION }}
8485

8586
# If a version wasn't explicitly passed as a workflow_dispatch input we
8687
# default to version v0.0.0+<git-commit-date>-<git-short-sha>, for example
@@ -143,7 +144,7 @@ jobs:
143144
python-version: ${{ env.PYTHON_VERSION }}
144145

145146
- name: Setup Hatch
146-
run: pipx install hatch==1.7.0
147+
run: pipx install hatch==${{ env.HATCH_VERSION }}
147148

148149
- name: Build Documentation
149150
run: hatch run docs:pdoc -d google crossplane/function -o docs

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ hatch run generate:protoc
3838
hatch run lint:check
3939

4040
# Run unit tests.
41-
hatch run test:unit
41+
hatch test
4242

4343
# Build an sdist and wheel.
4444
hatch build

pyproject.toml

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -58,14 +58,6 @@ dependencies = ["ruff==0.6.9"]
5858
[tool.hatch.envs.lint.scripts]
5959
check = "ruff format crossplane tests && ruff check --fix crossplane tests"
6060

61-
62-
[tool.hatch.envs.test]
63-
type = "virtual"
64-
path = ".venv-test"
65-
66-
[tool.hatch.envs.test.scripts]
67-
unit = "python -m unittest tests/*.py"
68-
6961
[tool.hatch.envs.docs]
7062
type = "virtual"
7163
path = ".venv-docs"

tests/test_resource.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,7 @@
2222

2323
import crossplane.function.proto.v1.run_function_pb2 as fnv1
2424
from crossplane.function import logging, resource
25-
26-
from .testdata.models.io.upbound.aws.s3 import v1beta2
25+
from tests.testdata.models.io.upbound.aws.s3 import v1beta2
2726

2827

2928
class TestResource(unittest.TestCase):

0 commit comments

Comments
 (0)