From 1e71ba39aeb8d996e7abbb2c21233eb0719e03d4 Mon Sep 17 00:00:00 2001 From: Stephen Finucane Date: Fri, 17 Apr 2026 11:17:38 +0100 Subject: [PATCH 1/2] Remove Makefile CTags are less useful than they once were for Python, given the rise of LSPs, and the release target is massively outdated. Better to just remove the entire file than attempt to fix it. Signed-off-by: Stephen Finucane --- Makefile | 20 -------------------- 1 file changed, 20 deletions(-) delete mode 100644 Makefile diff --git a/Makefile b/Makefile deleted file mode 100644 index a5ca6dd..0000000 --- a/Makefile +++ /dev/null @@ -1,20 +0,0 @@ -PYTHONPATH:=$(shell pwd)/lib:${PYTHONPATH} - -all: - -check: - PYTHONPATH=$(PYTHONPATH) python -m testtools.run discover . - -clean: - find . -name '*.pyc' -print0 | xargs -0 rm -f - -TAGS: lib/testresources/*.py lib/testresources/tests/*.py - ctags -e -R lib/testresources/ - -tags: lib/testresources/*.py lib/testresources/tests/*.py - ctags -R lib/testresources/ - -release: - python setup.py sdist upload bdist_wheel --sign - -.PHONY: all check clean From 385319e5be5f32bae7bb44c1104a8e462bf5102e Mon Sep 17 00:00:00 2001 From: Stephen Finucane Date: Fri, 17 Apr 2026 11:16:44 +0100 Subject: [PATCH 2/2] Move tests out of testresources This aligns us with other testing-cabal projects. Signed-off-by: Stephen Finucane --- .github/workflows/test.yml | 2 +- pyproject.toml | 2 +- testresources/__init__.py | 6 ---- testresources/tests/__init__.py | 19 ----------- {testresources/tests => tests}/TestUtil.py | 0 tests/__init__.py | 34 +++++++++++++++++++ .../test_optimising_test_suite.py | 2 +- .../tests => tests}/test_resource_graph.py | 2 +- .../test_resourced_test_case.py | 4 ++- .../tests => tests}/test_test_loader.py | 3 +- .../tests => tests}/test_test_resource.py | 4 ++- tox.ini | 5 +-- 12 files changed, 49 insertions(+), 34 deletions(-) rename {testresources/tests => tests}/TestUtil.py (100%) create mode 100644 tests/__init__.py rename {testresources/tests => tests}/test_optimising_test_suite.py (99%) rename {testresources/tests => tests}/test_resource_graph.py (99%) rename {testresources/tests => tests}/test_resourced_test_case.py (99%) rename {testresources/tests => tests}/test_test_loader.py (96%) rename {testresources/tests => tests}/test_test_resource.py (99%) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index bae7589..5ee3a0e 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -66,7 +66,7 @@ jobs: - name: Run tests run: | - python -W once -m testtools.run testresources.tests.test_suite + python -W once -m testtools.run tests.test_suite success: needs: ["lint", "test"] diff --git a/pyproject.toml b/pyproject.toml index a9f4e07..a14892b 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -80,4 +80,4 @@ ignore = [ ] [tool.ruff.lint.per-file-ignores] -"testresources/tests/*" = ["S"] +"tests/*" = ["S"] diff --git a/testresources/__init__.py b/testresources/__init__.py index 3b53e9f..8d7f240 100644 --- a/testresources/__init__.py +++ b/testresources/__init__.py @@ -86,12 +86,6 @@ def __get_git_version() -> str | None: __version__ = (0, 0, 0) -def test_suite(): - import testresources.tests - - return testresources.tests.test_suite() - - def _digraph_to_graph(digraph, prime_node_mapping): """Convert digraph to a graph. diff --git a/testresources/tests/__init__.py b/testresources/tests/__init__.py index 29e2ebb..50d33d1 100644 --- a/testresources/tests/__init__.py +++ b/testresources/tests/__init__.py @@ -13,28 +13,9 @@ # CONDITIONS OF ANY KIND, either express or implied. See the license you chose # for the specific language governing permissions and limitations under that # license. -# from unittest import TestResult -from testresources.tests import TestUtil - - -def test_suite(): - import testresources.tests.test_optimising_test_suite - import testresources.tests.test_resource_graph - import testresources.tests.test_resourced_test_case - import testresources.tests.test_test_loader - import testresources.tests.test_test_resource - - result = TestUtil.TestSuite() - result.addTest(testresources.tests.test_test_loader.test_suite()) - result.addTest(testresources.tests.test_test_resource.test_suite()) - result.addTest(testresources.tests.test_resourced_test_case.test_suite()) - result.addTest(testresources.tests.test_resource_graph.test_suite()) - result.addTest(testresources.tests.test_optimising_test_suite.test_suite()) - return result - class ResultWithoutResourceExtensions: """A test fake which does not have resource extensions.""" diff --git a/testresources/tests/TestUtil.py b/tests/TestUtil.py similarity index 100% rename from testresources/tests/TestUtil.py rename to tests/TestUtil.py diff --git a/tests/__init__.py b/tests/__init__.py new file mode 100644 index 0000000..254eb6f --- /dev/null +++ b/tests/__init__.py @@ -0,0 +1,34 @@ +# testresources: extensions to python unittest to allow declaritive use +# of resources by test cases. +# +# Copyright (c) 2005-2010 Testresources Contributors +# +# Licensed under either the Apache License, Version 2.0 or the BSD 3-clause +# license at the users choice. A copy of both licenses are available in the +# project source as Apache-2.0 and BSD. You may not use this file except in +# compliance with one of these two licences. +# +# Unless required by applicable law or agreed to in writing, software distributed +# under these licenses is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR +# CONDITIONS OF ANY KIND, either express or implied. See the license you chose +# for the specific language governing permissions and limitations under that +# license. + + +def test_suite(): + from . import ( + TestUtil, + test_optimising_test_suite, + test_resource_graph, + test_resourced_test_case, + test_test_loader, + test_test_resource, + ) + + result = TestUtil.TestSuite() + result.addTest(test_test_loader.test_suite()) + result.addTest(test_test_resource.test_suite()) + result.addTest(test_resourced_test_case.test_suite()) + result.addTest(test_resource_graph.test_suite()) + result.addTest(test_optimising_test_suite.test_suite()) + return result diff --git a/testresources/tests/test_optimising_test_suite.py b/tests/test_optimising_test_suite.py similarity index 99% rename from testresources/tests/test_optimising_test_suite.py rename to tests/test_optimising_test_suite.py index f481039..36c3e0f 100644 --- a/testresources/tests/test_optimising_test_suite.py +++ b/tests/test_optimising_test_suite.py @@ -26,7 +26,7 @@ def test_suite(): - from testresources.tests import TestUtil + from . import TestUtil loader = TestUtil.TestLoader() result = loader.loadTestsFromName(__name__) diff --git a/testresources/tests/test_resource_graph.py b/tests/test_resource_graph.py similarity index 99% rename from testresources/tests/test_resource_graph.py rename to tests/test_resource_graph.py index 54d7da9..aea5a4e 100644 --- a/testresources/tests/test_resource_graph.py +++ b/tests/test_resource_graph.py @@ -25,7 +25,7 @@ def test_suite(): - from testresources.tests import TestUtil + from . import TestUtil loader = TestUtil.TestLoader() result = loader.loadTestsFromName(__name__) diff --git a/testresources/tests/test_resourced_test_case.py b/tests/test_resourced_test_case.py similarity index 99% rename from testresources/tests/test_resourced_test_case.py rename to tests/test_resourced_test_case.py index 7db8410..1a711ab 100644 --- a/testresources/tests/test_resourced_test_case.py +++ b/tests/test_resourced_test_case.py @@ -24,7 +24,9 @@ def test_suite(): - loader = testresources.tests.TestUtil.TestLoader() + from . import TestUtil + + loader = TestUtil.TestLoader() result = loader.loadTestsFromName(__name__) return result diff --git a/testresources/tests/test_test_loader.py b/tests/test_test_loader.py similarity index 96% rename from testresources/tests/test_test_loader.py rename to tests/test_test_loader.py index e348f7f..d03eebf 100644 --- a/testresources/tests/test_test_loader.py +++ b/tests/test_test_loader.py @@ -18,10 +18,11 @@ import testtools from testresources import OptimisingTestSuite, TestLoader -from testresources.tests import TestUtil def test_suite(): + from . import TestUtil + loader = TestUtil.TestLoader() result = loader.loadTestsFromName(__name__) return result diff --git a/testresources/tests/test_test_resource.py b/tests/test_test_resource.py similarity index 99% rename from testresources/tests/test_test_resource.py rename to tests/test_test_resource.py index b9e9257..d50e698 100644 --- a/testresources/tests/test_test_resource.py +++ b/tests/test_test_resource.py @@ -26,7 +26,9 @@ def test_suite(): - loader = testresources.tests.TestUtil.TestLoader() + from . import TestUtil + + loader = TestUtil.TestLoader() result = loader.loadTestsFromName(__name__) return result diff --git a/tox.ini b/tox.ini index 3a4a9df..9c59eac 100644 --- a/tox.ini +++ b/tox.ini @@ -6,7 +6,8 @@ minversion = 4.0 usedevelop = true extras = test -commands = python -m testtools.run testresources.tests.test_suite +commands = + python -W once -m testtools.run tests.test_suite {posargs} [testenv:ruff] description = @@ -14,5 +15,5 @@ description = deps = ruff commands = - ruff format . ruff check --fix --unsafe-fixes --exit-non-zero-on-fix . + ruff format .