From 22c42b92803d1c7e15d7e7f083e646da7217aa83 Mon Sep 17 00:00:00 2001 From: Sky Brewer <sky.brewer@ess.eu> Date: Thu, 28 Nov 2024 14:04:16 +0100 Subject: [PATCH 1/5] Use hatch built in test env --- .gitlab-ci.yml | 17 +++++++++++++++-- README.md | 2 +- hatch.toml | 49 +++++++++++++++++++++++++++---------------------- 3 files changed, 43 insertions(+), 25 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index a14bb38..fed1534 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -47,19 +47,26 @@ test: stage: test image: $IMAGE script: - - hatch run test --junitxml=report.xml + - hatch test --junitxml=report.xml artifacts: when: always reports: junit: report.xml parallel: !reference [.parallel,parallel] +jupyter-check: + stage: test + image: $IMAGE + script: + - hatch run jupyter-check + parallel: !reference [.parallel,parallel] + cov: stage: analyse image: $IMAGE script: - - hatch run cov + - hatch test -c coverage: /(?i)total.*? (100(?:\.0+)?\%|[1-9]?\d(?:\.\d+)?\%)$/ artifacts: reports: @@ -74,6 +81,12 @@ lint: image: $IMAGE script: - hatch fmt --check + parallel: !reference [.parallel,parallel] + +link-types: + stage: check + image: $IMAGE + script: - hatch run types:check parallel: !reference [.parallel,parallel] diff --git a/README.md b/README.md index d1050e4..a77b9fd 100644 --- a/README.md +++ b/README.md @@ -85,7 +85,7 @@ hatch run all Run tests: ```console -hatch run test +hatch test ``` Run formatting and check: diff --git a/hatch.toml b/hatch.toml index d4590a7..1d1ec38 100644 --- a/hatch.toml +++ b/hatch.toml @@ -13,40 +13,45 @@ include = ["/epicsarchiver", "/tests"] [build.targets.wheel] packages = ["epicsarchiver"] -[envs.default] -dependencies = [ - "coverage[toml]>=6.5", - "pytest>=7.2.0", - "pytest-asyncio", - "sybil", - "typing-extensions", - "responses", - "aioresponses", - "pytest-mock", - "pytest-aiohttp", - "types-requests", # Types in test dependancies for IDE integration of mypy - "types-python-dateutil", - "types-protobuf", -] - [envs.default.scripts] protoc-gen = "protoc -I=epicsarchiver --python_out=epicsarchiver --mypy_out=epicsarchiver epicsarchiver/EPICSEvent.proto" -test = "pytest {args:tests}" -test-cov = "coverage run -m pytest {args:tests}" -cov-report = ["- coverage combine", "coverage report", "coverage xml"] -cov = ["test-cov", "cov-report"] docs-check = "hatch run docs:check" type-check = "hatch run types:check" jupyter-check = "hatch run jupyter:check" -all = ["hatch fmt --check", "type-check", "cov", "jupyter-check", "docs-check"] +all = ["hatch fmt --check", "type-check", "jupyter-check", "docs-check", "hatch test"] -[[envs.test.matrix]] +[[envs.hatch-test.matrix]] python = ["3.8", "3.9", "3.10", "3.11", "3.12", "3.13"] +[envs.hatch-test] +extra-dependencies = [ + "pytest-asyncio", + "responses", + "aioresponses", + "pytest-mock", + "pytest-aiohttp", +] + +[envs.hatch-test.scripts] +run = "pytest{env:HATCH_TEST_ARGS:} {args}" +run-cov = "coverage run -m pytest{env:HATCH_TEST_ARGS:} {args}" +cov-combine = "coverage combine" +cov-report = "coverage report --format=xml" + [envs.types] extra-dependencies = [ "mypy", "mypy-protobuf", + "pytest", + "pytest-asyncio", + "responses", + "aioresponses", + "pytest-mock", + "pytest-aiohttp", + "typing-extensions", + "types-requests", + "types-python-dateutil", + "types-protobuf", ] [envs.types.scripts] -- GitLab From ef62ef1cec6d914b5ecef798c78fd3864568498a Mon Sep 17 00:00:00 2001 From: Sky Brewer <sky.brewer@ess.eu> Date: Thu, 12 Dec 2024 14:55:15 +0100 Subject: [PATCH 2/5] Only test jupyter against used python version --- .gitlab-ci.yml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index fed1534..f363056 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -56,10 +56,9 @@ test: jupyter-check: stage: test - image: $IMAGE + image: python:3.10 script: - hatch run jupyter-check - parallel: !reference [.parallel,parallel] cov: -- GitLab From 167aecea5983b8db4e880103d5ad12d3b63343b9 Mon Sep 17 00:00:00 2001 From: Sky Brewer <sky.brewer@ess.eu> Date: Thu, 12 Dec 2024 16:09:11 +0100 Subject: [PATCH 3/5] create xml format of coverage --- hatch.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hatch.toml b/hatch.toml index 1d1ec38..f12666b 100644 --- a/hatch.toml +++ b/hatch.toml @@ -36,7 +36,7 @@ extra-dependencies = [ run = "pytest{env:HATCH_TEST_ARGS:} {args}" run-cov = "coverage run -m pytest{env:HATCH_TEST_ARGS:} {args}" cov-combine = "coverage combine" -cov-report = "coverage report --format=xml" +cov-report = "coverage xml" [envs.types] extra-dependencies = [ -- GitLab From 4e1bf29dd4fcf8a096af807eb76414720e93445f Mon Sep 17 00:00:00 2001 From: Sky Brewer <sky.brewer@ess.eu> Date: Thu, 12 Dec 2024 16:25:03 +0100 Subject: [PATCH 4/5] coverage on just one python version --- .gitlab-ci.yml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index f363056..b28c71a 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -63,7 +63,7 @@ jupyter-check: cov: stage: analyse - image: $IMAGE + image: python:3.10 script: - hatch test -c coverage: /(?i)total.*? (100(?:\.0+)?\%|[1-9]?\d(?:\.\d+)?\%)$/ @@ -72,7 +72,6 @@ cov: coverage_report: coverage_format: cobertura path: coverage.xml - parallel: !reference [.parallel,parallel] lint: -- GitLab From 8a7fb4fc64ec99d4bf102635224adce0db36595b Mon Sep 17 00:00:00 2001 From: Sky Brewer <sky.brewer@ess.eu> Date: Fri, 13 Dec 2024 11:39:06 +0100 Subject: [PATCH 5/5] typo fix --- .gitlab-ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index b28c71a..6a8730f 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -81,7 +81,7 @@ lint: - hatch fmt --check parallel: !reference [.parallel,parallel] -link-types: +lint-types: stage: check image: $IMAGE script: -- GitLab