Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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"]
Expand Down
20 changes: 0 additions & 20 deletions Makefile

This file was deleted.

2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -80,4 +80,4 @@ ignore = [
]

[tool.ruff.lint.per-file-ignores]
"testresources/tests/*" = ["S"]
"tests/*" = ["S"]
6 changes: 0 additions & 6 deletions testresources/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -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.

Expand Down
19 changes: 0 additions & 19 deletions testresources/tests/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -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."""
Expand Down
File renamed without changes.
34 changes: 34 additions & 0 deletions tests/__init__.py
Original file line number Diff line number Diff line change
@@ -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
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@


def test_suite():
from testresources.tests import TestUtil
from . import TestUtil

loader = TestUtil.TestLoader()
result = loader.loadTestsFromName(__name__)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@


def test_suite():
from testresources.tests import TestUtil
from . import TestUtil

loader = TestUtil.TestLoader()
result = loader.loadTestsFromName(__name__)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,9 @@


def test_suite():
loader = testresources.tests.TestUtil.TestLoader()
from . import TestUtil

loader = TestUtil.TestLoader()
result = loader.loadTestsFromName(__name__)
return result

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,9 @@


def test_suite():
loader = testresources.tests.TestUtil.TestLoader()
from . import TestUtil

loader = TestUtil.TestLoader()
result = loader.loadTestsFromName(__name__)
return result

Expand Down
5 changes: 3 additions & 2 deletions tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,14 @@ 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 =
Run style checks and reformat code.
deps =
ruff
commands =
ruff format .
ruff check --fix --unsafe-fixes --exit-non-zero-on-fix .
ruff format .