From 7dbbcb2d82165786d2d6d68bf45b7274905e9d26 Mon Sep 17 00:00:00 2001 From: Alec Delaney Date: Fri, 23 Feb 2024 17:43:19 -0500 Subject: [PATCH 1/3] Add issues project link --- pyproject.toml | 1 + 1 file changed, 1 insertion(+) diff --git a/pyproject.toml b/pyproject.toml index d46162a..a1e5644 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -50,6 +50,7 @@ dynamic = ["version", "dependencies", "optional-dependencies"] [project.urls] Homepage = "https://github.com/tekktrik/circfirm" Repository = "https://github.com/tekktrik/circfirm.git" +Issues = "https://github.com/tekktrik/circfirm/issues" [project.scripts] circfirm = "circfirm.cli:cli" From f98d09e81d9ede98b0c98a21a8edb40bd020ff15 Mon Sep 17 00:00:00 2001 From: Alec Delaney Date: Fri, 23 Feb 2024 18:07:30 -0500 Subject: [PATCH 2/3] Mark as typed --- circfirm/py.typed | 3 +++ pyproject.toml | 4 +--- 2 files changed, 4 insertions(+), 3 deletions(-) create mode 100644 circfirm/py.typed diff --git a/circfirm/py.typed b/circfirm/py.typed new file mode 100644 index 0000000..0f4980d --- /dev/null +++ b/circfirm/py.typed @@ -0,0 +1,3 @@ +SPDX-FileCopyrightText: 2024 Alec Delaney, for Adafruit Industries + +SPDX-License-Identifier: MIT diff --git a/pyproject.toml b/pyproject.toml index a1e5644..12f293a 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -44,6 +44,7 @@ classifiers = [ "Operating System :: Unix", "Operating System :: Microsoft :: Windows", "Operating System :: MacOS", + "Typing :: Typed", ] dynamic = ["version", "dependencies", "optional-dependencies"] @@ -59,9 +60,6 @@ circfirm = "circfirm.cli:cli" packages = ["circfirm"] include-package-data = true -[tool.setuptools.package-data] -templates = ["*.yaml"] - [tool.setuptools.dynamic.version] file = "VERSION" From a6365ff37c8293f54855dfced7bfd39143a1266f Mon Sep 17 00:00:00 2001 From: Alec Delaney Date: Fri, 23 Feb 2024 22:58:28 -0500 Subject: [PATCH 3/3] Ensure test cleanup regardless of result --- .github/workflows/push.yml | 10 +++++-- Makefile | 57 +++++++++++++++++++++----------------- 2 files changed, 40 insertions(+), 27 deletions(-) diff --git a/.github/workflows/push.yml b/.github/workflows/push.yml index 2f1ff55..76a05df 100644 --- a/.github/workflows/push.yml +++ b/.github/workflows/push.yml @@ -39,9 +39,15 @@ jobs: - name: Run pre-commit via make run: | make check - - name: Run pytest via coverage.py + - name: Prepare tests + run : | + make test-prep + - name: Run tests run: | - make test + make test-run + - name: Clean up after tests + run: | + make test-clean - name: Create coverage.py XML report run: | coverage xml -o coverage_${{ matrix.os }}_${{ matrix.py-version }}.xml diff --git a/Makefile b/Makefile index a1c5a73..baec6ce 100644 --- a/Makefile +++ b/Makefile @@ -15,42 +15,49 @@ format: check: @pre-commit run --all-files -.PHONY: test -test: -# Test setup +.PHONY: test-prep +test-prep: ifeq "$(OS)" "Windows_NT" - @mkdir testmount - @xcopy tests\assets\info_uf2.txt testmount - @subst T: testmount + -@mkdir testmount + -@xcopy tests\assets\info_uf2.txt testmount + -@subst T: testmount else ifeq "$(shell uname -s)" "Linux" - @truncate testfs -s 1M - @mkfs.vfat -F12 -S512 testfs - @mkdir testmount - @sudo mount -o loop,user,umask=000 testfs testmount/ - @cp tests/assets/info_uf2.txt testmount/ + -@truncate testfs -s 1M + -@mkfs.vfat -F12 -S512 testfs + -@mkdir testmount + -@sudo mount -o loop,user,umask=000 testfs testmount/ + -@cp tests/assets/info_uf2.txt testmount/ else ifeq "$(shell uname -s)" "Darwin" - @hdiutil create -size 512m -volname TESTMOUNT -fs FAT32 testfs.dmg - @hdiutil attach testfs.dmg - @cp tests/assets/info_uf2.txt /Volumes/TESTMOUNT + -@hdiutil create -size 512m -volname TESTMOUNT -fs FAT32 testfs.dmg + -@hdiutil attach testfs.dmg + -@cp tests/assets/info_uf2.txt /Volumes/TESTMOUNT else @echo "Current OS not supported" @exit 1 endif -# Run tests +.PHONY: test +test: + -@${MAKE} test-prep --no-print-directory + -@${MAKE} test-run --no-print-directory + -@${MAKE} test-clean --no-print-directory + +.PHONY: +test-run: @coverage run -m pytest - @coverage report - @coverage html + -@coverage report + -@coverage html -# Test cleanup +.PHONY: test-clean +test-clean: ifeq "$(OS)" "Windows_NT" - @subst T: /d - @python scripts/rmdir.py testmount + -@subst T: /d + -@python scripts/rmdir.py testmount else ifeq "$(shell uname -s)" "Linux" - @sudo umount testmount - @sudo rm -rf testmount - @rm testfs + -@sudo umount testmount + -@sudo rm -rf testmount + -@rm testfs -f else - @hdiutil detach /Volumes/TESTMOUNT - @rm testfs.dmg + -@hdiutil detach /Volumes/TESTMOUNT + -@rm testfs.dmg -f endif