testtools 2.9.1__tar.gz → 2.9.2__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {testtools-2.9.1 → testtools-2.9.2}/.github/workflows/publish.yml +2 -2
- {testtools-2.9.1 → testtools-2.9.2}/.github/workflows/test.yml +10 -10
- {testtools-2.9.1 → testtools-2.9.2}/NEWS +14 -0
- {testtools-2.9.1 → testtools-2.9.2}/PKG-INFO +4 -3
- {testtools-2.9.1 → testtools-2.9.2}/doc/for-framework-folk.rst +1 -1
- {testtools-2.9.1 → testtools-2.9.2}/pyproject.toml +2 -2
- testtools-2.9.2/requirements.txt +1 -0
- {testtools-2.9.1 → testtools-2.9.2}/tests/test_fixturesupport.py +17 -13
- {testtools-2.9.1 → testtools-2.9.2}/tests/test_run.py +56 -77
- {testtools-2.9.1 → testtools-2.9.2}/tests/test_testcase.py +377 -28
- {testtools-2.9.1 → testtools-2.9.2}/tests/test_testresult.py +14 -22
- {testtools-2.9.1 → testtools-2.9.2}/tests/test_testsuite.py +5 -13
- {testtools-2.9.1 → testtools-2.9.2}/testtools/_version.py +2 -2
- {testtools-2.9.1 → testtools-2.9.2}/testtools/runtest.py +10 -3
- {testtools-2.9.1 → testtools-2.9.2}/testtools/testcase.py +187 -14
- {testtools-2.9.1 → testtools-2.9.2}/testtools/testresult/doubles.py +47 -23
- {testtools-2.9.1 → testtools-2.9.2}/testtools/testresult/real.py +24 -7
- {testtools-2.9.1 → testtools-2.9.2}/testtools/twistedsupport/_runtest.py +4 -1
- testtools-2.9.1/requirements.txt +0 -1
- {testtools-2.9.1 → testtools-2.9.2}/.git-blame-ignore-revs +0 -0
- {testtools-2.9.1 → testtools-2.9.2}/.github/dependabot.yaml +0 -0
- {testtools-2.9.1 → testtools-2.9.2}/.gitignore +0 -0
- {testtools-2.9.1 → testtools-2.9.2}/.gitreview +0 -0
- {testtools-2.9.1 → testtools-2.9.2}/.testr.conf +0 -0
- {testtools-2.9.1 → testtools-2.9.2}/LICENSE +0 -0
- {testtools-2.9.1 → testtools-2.9.2}/MANIFEST.in +0 -0
- {testtools-2.9.1 → testtools-2.9.2}/Makefile +0 -0
- {testtools-2.9.1 → testtools-2.9.2}/README.rst +0 -0
- {testtools-2.9.1 → testtools-2.9.2}/disperse.conf +0 -0
- {testtools-2.9.1 → testtools-2.9.2}/doc/Makefile +0 -0
- {testtools-2.9.1 → testtools-2.9.2}/doc/_static/placeholder.txt +0 -0
- {testtools-2.9.1 → testtools-2.9.2}/doc/_templates/placeholder.txt +0 -0
- {testtools-2.9.1 → testtools-2.9.2}/doc/api.rst +0 -0
- {testtools-2.9.1 → testtools-2.9.2}/doc/conf.py +0 -0
- {testtools-2.9.1 → testtools-2.9.2}/doc/for-test-authors.rst +0 -0
- {testtools-2.9.1 → testtools-2.9.2}/doc/hacking.rst +0 -0
- {testtools-2.9.1 → testtools-2.9.2}/doc/index.rst +0 -0
- {testtools-2.9.1 → testtools-2.9.2}/doc/make.bat +0 -0
- {testtools-2.9.1 → testtools-2.9.2}/doc/news.rst +0 -0
- {testtools-2.9.1 → testtools-2.9.2}/doc/overview.rst +0 -0
- {testtools-2.9.1 → testtools-2.9.2}/doc/twisted-support.rst +0 -0
- {testtools-2.9.1 → testtools-2.9.2}/readthedocs-requirements.txt +0 -0
- {testtools-2.9.1 → testtools-2.9.2}/scripts/README +0 -0
- {testtools-2.9.1 → testtools-2.9.2}/scripts/all-pythons +0 -0
- {testtools-2.9.1 → testtools-2.9.2}/scripts/update-rtfd +0 -0
- {testtools-2.9.1 → testtools-2.9.2}/tests/__init__.py +0 -0
- {testtools-2.9.1 → testtools-2.9.2}/tests/helpers.py +0 -0
- {testtools-2.9.1 → testtools-2.9.2}/tests/matchers/__init__.py +0 -0
- {testtools-2.9.1 → testtools-2.9.2}/tests/matchers/test_basic.py +0 -0
- {testtools-2.9.1 → testtools-2.9.2}/tests/matchers/test_const.py +0 -0
- {testtools-2.9.1 → testtools-2.9.2}/tests/matchers/test_datastructures.py +0 -0
- {testtools-2.9.1 → testtools-2.9.2}/tests/matchers/test_dict.py +0 -0
- {testtools-2.9.1 → testtools-2.9.2}/tests/matchers/test_doctest.py +0 -0
- {testtools-2.9.1 → testtools-2.9.2}/tests/matchers/test_exception.py +0 -0
- {testtools-2.9.1 → testtools-2.9.2}/tests/matchers/test_filesystem.py +0 -0
- {testtools-2.9.1 → testtools-2.9.2}/tests/matchers/test_higherorder.py +0 -0
- {testtools-2.9.1 → testtools-2.9.2}/tests/matchers/test_impl.py +0 -0
- {testtools-2.9.1 → testtools-2.9.2}/tests/matchers/test_warnings.py +0 -0
- {testtools-2.9.1 → testtools-2.9.2}/tests/samplecases.py +0 -0
- {testtools-2.9.1 → testtools-2.9.2}/tests/test_assert_that.py +0 -0
- {testtools-2.9.1 → testtools-2.9.2}/tests/test_compat.py +0 -0
- {testtools-2.9.1 → testtools-2.9.2}/tests/test_content.py +0 -0
- {testtools-2.9.1 → testtools-2.9.2}/tests/test_content_type.py +0 -0
- {testtools-2.9.1 → testtools-2.9.2}/tests/test_helpers.py +0 -0
- {testtools-2.9.1 → testtools-2.9.2}/tests/test_monkey.py +0 -0
- {testtools-2.9.1 → testtools-2.9.2}/tests/test_runtest.py +0 -0
- {testtools-2.9.1 → testtools-2.9.2}/tests/test_tags.py +0 -0
- {testtools-2.9.1 → testtools-2.9.2}/tests/test_with_with.py +0 -0
- {testtools-2.9.1 → testtools-2.9.2}/tests/twistedsupport/__init__.py +0 -0
- {testtools-2.9.1 → testtools-2.9.2}/tests/twistedsupport/_helpers.py +0 -0
- {testtools-2.9.1 → testtools-2.9.2}/tests/twistedsupport/test_deferred.py +0 -0
- {testtools-2.9.1 → testtools-2.9.2}/tests/twistedsupport/test_matchers.py +0 -0
- {testtools-2.9.1 → testtools-2.9.2}/tests/twistedsupport/test_runtest.py +0 -0
- {testtools-2.9.1 → testtools-2.9.2}/tests/twistedsupport/test_spinner.py +0 -0
- {testtools-2.9.1 → testtools-2.9.2}/testtools/__init__.py +0 -0
- {testtools-2.9.1 → testtools-2.9.2}/testtools/_types.py +0 -0
- {testtools-2.9.1 → testtools-2.9.2}/testtools/_version.pyi +0 -0
- {testtools-2.9.1 → testtools-2.9.2}/testtools/assertions.py +0 -0
- {testtools-2.9.1 → testtools-2.9.2}/testtools/compat.py +0 -0
- {testtools-2.9.1 → testtools-2.9.2}/testtools/content.py +0 -0
- {testtools-2.9.1 → testtools-2.9.2}/testtools/content_type.py +0 -0
- {testtools-2.9.1 → testtools-2.9.2}/testtools/helpers.py +0 -0
- {testtools-2.9.1 → testtools-2.9.2}/testtools/matchers/__init__.py +0 -0
- {testtools-2.9.1 → testtools-2.9.2}/testtools/matchers/_basic.py +0 -0
- {testtools-2.9.1 → testtools-2.9.2}/testtools/matchers/_const.py +0 -0
- {testtools-2.9.1 → testtools-2.9.2}/testtools/matchers/_datastructures.py +0 -0
- {testtools-2.9.1 → testtools-2.9.2}/testtools/matchers/_dict.py +0 -0
- {testtools-2.9.1 → testtools-2.9.2}/testtools/matchers/_doctest.py +0 -0
- {testtools-2.9.1 → testtools-2.9.2}/testtools/matchers/_exception.py +0 -0
- {testtools-2.9.1 → testtools-2.9.2}/testtools/matchers/_filesystem.py +0 -0
- {testtools-2.9.1 → testtools-2.9.2}/testtools/matchers/_higherorder.py +0 -0
- {testtools-2.9.1 → testtools-2.9.2}/testtools/matchers/_impl.py +0 -0
- {testtools-2.9.1 → testtools-2.9.2}/testtools/matchers/_warnings.py +0 -0
- {testtools-2.9.1 → testtools-2.9.2}/testtools/matchers/test.py +0 -0
- {testtools-2.9.1 → testtools-2.9.2}/testtools/monkey.py +0 -0
- {testtools-2.9.1 → testtools-2.9.2}/testtools/py.typed +0 -0
- {testtools-2.9.1 → testtools-2.9.2}/testtools/run.py +0 -0
- {testtools-2.9.1 → testtools-2.9.2}/testtools/tags.py +0 -0
- {testtools-2.9.1 → testtools-2.9.2}/testtools/testresult/__init__.py +0 -0
- {testtools-2.9.1 → testtools-2.9.2}/testtools/tests/__init__.py +0 -0
- {testtools-2.9.1 → testtools-2.9.2}/testtools/tests/helpers.py +0 -0
- {testtools-2.9.1 → testtools-2.9.2}/testtools/tests/matchers/__init__.py +0 -0
- {testtools-2.9.1 → testtools-2.9.2}/testtools/tests/matchers/helpers.py +0 -0
- {testtools-2.9.1 → testtools-2.9.2}/testtools/testsuite.py +0 -0
- {testtools-2.9.1 → testtools-2.9.2}/testtools/twistedsupport/__init__.py +0 -0
- {testtools-2.9.1 → testtools-2.9.2}/testtools/twistedsupport/_deferred.py +0 -0
- {testtools-2.9.1 → testtools-2.9.2}/testtools/twistedsupport/_deferreddebug.py +0 -0
- {testtools-2.9.1 → testtools-2.9.2}/testtools/twistedsupport/_matchers.py +0 -0
- {testtools-2.9.1 → testtools-2.9.2}/testtools/twistedsupport/_spinner.py +0 -0
- {testtools-2.9.1 → testtools-2.9.2}/tox.ini +0 -0
|
@@ -7,17 +7,17 @@ jobs:
|
|
|
7
7
|
lint:
|
|
8
8
|
runs-on: ubuntu-latest
|
|
9
9
|
steps:
|
|
10
|
-
- uses: actions/checkout@
|
|
10
|
+
- uses: actions/checkout@v7
|
|
11
11
|
with:
|
|
12
12
|
fetch-depth: 0
|
|
13
13
|
|
|
14
14
|
- name: Set up Python 3.13
|
|
15
|
-
uses: actions/setup-python@
|
|
15
|
+
uses: actions/setup-python@v7
|
|
16
16
|
with:
|
|
17
17
|
python-version: "3.13"
|
|
18
18
|
|
|
19
19
|
- name: Cache
|
|
20
|
-
uses: actions/cache@
|
|
20
|
+
uses: actions/cache@v6
|
|
21
21
|
with:
|
|
22
22
|
path: ~/.cache/pip
|
|
23
23
|
key: ${{ runner.os }}-lint-${{ hashFiles('**/setup.py') }}
|
|
@@ -44,20 +44,20 @@ jobs:
|
|
|
44
44
|
strategy:
|
|
45
45
|
fail-fast: false
|
|
46
46
|
matrix:
|
|
47
|
-
python-version: ["3.10", "3.11", "3.12", "3.13", "3.14", "pypy3.
|
|
47
|
+
python-version: ["3.10", "3.11", "3.12", "3.13", "3.14", "pypy3.11"]
|
|
48
48
|
|
|
49
49
|
steps:
|
|
50
|
-
- uses: actions/checkout@
|
|
50
|
+
- uses: actions/checkout@v7
|
|
51
51
|
with:
|
|
52
52
|
fetch-depth: 0
|
|
53
53
|
|
|
54
54
|
- name: Set up Python ${{ matrix.python-version }}
|
|
55
|
-
uses: actions/setup-python@
|
|
55
|
+
uses: actions/setup-python@v7
|
|
56
56
|
with:
|
|
57
57
|
python-version: ${{ matrix.python-version }}
|
|
58
58
|
|
|
59
59
|
- name: Cache
|
|
60
|
-
uses: actions/cache@
|
|
60
|
+
uses: actions/cache@v6
|
|
61
61
|
with:
|
|
62
62
|
path: ~/.cache/pip
|
|
63
63
|
key: ${{ matrix.os }}-${{ matrix.python-version }}-${{ hashFiles('**/setup.py') }}
|
|
@@ -77,17 +77,17 @@ jobs:
|
|
|
77
77
|
docs:
|
|
78
78
|
runs-on: ubuntu-latest
|
|
79
79
|
steps:
|
|
80
|
-
- uses: actions/checkout@
|
|
80
|
+
- uses: actions/checkout@v7
|
|
81
81
|
with:
|
|
82
82
|
fetch-depth: 0
|
|
83
83
|
|
|
84
84
|
- name: Set up Python 3.13
|
|
85
|
-
uses: actions/setup-python@
|
|
85
|
+
uses: actions/setup-python@v7
|
|
86
86
|
with:
|
|
87
87
|
python-version: "3.13"
|
|
88
88
|
|
|
89
89
|
- name: Cache
|
|
90
|
-
uses: actions/cache@
|
|
90
|
+
uses: actions/cache@v6
|
|
91
91
|
with:
|
|
92
92
|
path: ~/.cache/pip
|
|
93
93
|
key: ${{ runner.os }}-docs-${{ hashFiles('**/setup.py') }}
|
|
@@ -3,6 +3,20 @@ testtools NEWS
|
|
|
3
3
|
|
|
4
4
|
Changes and improvements to testtools_, grouped by release.
|
|
5
5
|
|
|
6
|
+
NEXT
|
|
7
|
+
~~~~
|
|
8
|
+
|
|
9
|
+
2.9.2
|
|
10
|
+
~~~~~
|
|
11
|
+
|
|
12
|
+
Improvements
|
|
13
|
+
------------
|
|
14
|
+
* Add support for ``TestCase.subTest``, reporting each subtest with its own
|
|
15
|
+
parameters. (Cyril Roelandt, Jelmer Vernooij, #317, #633)
|
|
16
|
+
|
|
17
|
+
* Align the return type of ``TestCase.run`` with the stdlib, which allows
|
|
18
|
+
``None``. (Stephen Finucane, #636)
|
|
19
|
+
|
|
6
20
|
2.9.1
|
|
7
21
|
~~~~~
|
|
8
22
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
Metadata-Version: 2.
|
|
1
|
+
Metadata-Version: 2.5
|
|
2
2
|
Name: testtools
|
|
3
|
-
Version: 2.9.
|
|
3
|
+
Version: 2.9.2
|
|
4
4
|
Summary: Extensions to the Python standard library unit testing framework
|
|
5
5
|
Project-URL: Homepage, https://github.com/testing-cabal/testtools
|
|
6
6
|
Author-email: "Jonathan M. Lange" <jml+testtools@mumak.net>
|
|
@@ -26,9 +26,10 @@ Classifier: Typing :: Typed
|
|
|
26
26
|
Requires-Python: >=3.10
|
|
27
27
|
Provides-Extra: dev
|
|
28
28
|
Requires-Dist: mypy>=1.20.0; extra == 'dev'
|
|
29
|
-
Requires-Dist: ruff==0.
|
|
29
|
+
Requires-Dist: ruff==0.17.5; extra == 'dev'
|
|
30
30
|
Requires-Dist: typing-extensions; (python_version < '3.11') and extra == 'dev'
|
|
31
31
|
Provides-Extra: test
|
|
32
|
+
Requires-Dist: fixtures; extra == 'test'
|
|
32
33
|
Requires-Dist: testresources; extra == 'test'
|
|
33
34
|
Requires-Dist: testscenarios; extra == 'test'
|
|
34
35
|
Provides-Extra: twisted
|
|
@@ -362,7 +362,7 @@ Test Doubles
|
|
|
362
362
|
------------
|
|
363
363
|
|
|
364
364
|
In testtools.testresult.doubles there are several test doubles that testtools
|
|
365
|
-
uses for its own testing: ``
|
|
365
|
+
uses for its own testing: ``LoggingTestResult``, and ``ExtendedTestResult``.
|
|
366
366
|
These TestResult objects implement a single variation of
|
|
367
367
|
the TestResult API each, and log activity to a list ``self._events``. These are
|
|
368
368
|
made available for the convenience of people writing their own extensions.
|
|
@@ -34,10 +34,10 @@ requires-python = ">=3.10"
|
|
|
34
34
|
Homepage = "https://github.com/testing-cabal/testtools"
|
|
35
35
|
|
|
36
36
|
[project.optional-dependencies]
|
|
37
|
-
test = ["testscenarios", "testresources"]
|
|
37
|
+
test = ["fixtures", "testscenarios", "testresources"]
|
|
38
38
|
twisted = ["Twisted", "fixtures"]
|
|
39
39
|
dev = [
|
|
40
|
-
"ruff==0.
|
|
40
|
+
"ruff==0.17.5",
|
|
41
41
|
"mypy>=1.20.0",
|
|
42
42
|
"typing-extensions;python_version<'3.11'",
|
|
43
43
|
]
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
fixtures>=4.3.2
|
|
@@ -2,6 +2,8 @@
|
|
|
2
2
|
|
|
3
3
|
import unittest
|
|
4
4
|
|
|
5
|
+
import fixtures
|
|
6
|
+
|
|
5
7
|
from testtools import (
|
|
6
8
|
TestCase,
|
|
7
9
|
content,
|
|
@@ -15,23 +17,25 @@ from testtools.testresult.doubles import (
|
|
|
15
17
|
ExtendedTestResult,
|
|
16
18
|
)
|
|
17
19
|
|
|
18
|
-
try:
|
|
19
|
-
import fixtures
|
|
20
|
-
except ImportError:
|
|
21
|
-
fixtures = None # type: ignore
|
|
22
|
-
|
|
23
|
-
try:
|
|
24
|
-
from fixtures.tests.helpers import LoggingFixture
|
|
25
|
-
except ImportError:
|
|
26
|
-
LoggingFixture = None
|
|
27
20
|
|
|
21
|
+
class LoggingFixture(fixtures.Fixture):
|
|
22
|
+
def __init__(self, suffix: str = "", calls: list[str] | None = None) -> None:
|
|
23
|
+
super().__init__()
|
|
24
|
+
if calls is None:
|
|
25
|
+
calls = []
|
|
26
|
+
self.calls = calls
|
|
27
|
+
self.suffix = suffix
|
|
28
28
|
|
|
29
|
-
|
|
30
|
-
def setUp(self):
|
|
29
|
+
def setUp(self) -> None:
|
|
31
30
|
super().setUp()
|
|
32
|
-
|
|
33
|
-
|
|
31
|
+
self.calls.append("setUp" + self.suffix)
|
|
32
|
+
self.addCleanup(self.calls.append, "cleanUp" + self.suffix)
|
|
34
33
|
|
|
34
|
+
def reset(self) -> None:
|
|
35
|
+
self.calls.append("reset" + self.suffix)
|
|
36
|
+
|
|
37
|
+
|
|
38
|
+
class TestFixtureSupport(TestCase):
|
|
35
39
|
def test_useFixture(self):
|
|
36
40
|
fixture = LoggingFixture()
|
|
37
41
|
|
|
@@ -9,6 +9,8 @@ import unittest
|
|
|
9
9
|
from textwrap import dedent
|
|
10
10
|
from unittest import TestSuite
|
|
11
11
|
|
|
12
|
+
import fixtures
|
|
13
|
+
|
|
12
14
|
import testtools
|
|
13
15
|
from testtools import TestCase, run, skipUnless
|
|
14
16
|
from testtools.matchers import (
|
|
@@ -17,29 +19,17 @@ from testtools.matchers import (
|
|
|
17
19
|
MatchesRegex,
|
|
18
20
|
)
|
|
19
21
|
|
|
20
|
-
try:
|
|
21
|
-
import fixtures
|
|
22
|
-
except ImportError:
|
|
23
|
-
fixtures = None # type: ignore
|
|
24
|
-
|
|
25
|
-
try:
|
|
26
|
-
import testresources
|
|
27
|
-
except ImportError:
|
|
28
|
-
testresources = None
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
if fixtures:
|
|
32
22
|
|
|
33
|
-
|
|
34
|
-
|
|
23
|
+
class SampleTestFixture(fixtures.Fixture):
|
|
24
|
+
"""Creates testtools.runexample temporarily."""
|
|
35
25
|
|
|
36
|
-
|
|
37
|
-
|
|
26
|
+
def __init__(self, broken=False):
|
|
27
|
+
"""Create a SampleTestFixture.
|
|
38
28
|
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
29
|
+
:param broken: If True, the sample file will not be importable.
|
|
30
|
+
"""
|
|
31
|
+
if not broken:
|
|
32
|
+
init_contents = b"""\
|
|
43
33
|
from testtools import TestCase
|
|
44
34
|
|
|
45
35
|
class TestFoo(TestCase):
|
|
@@ -51,33 +41,31 @@ def test_suite():
|
|
|
51
41
|
from unittest import TestLoader
|
|
52
42
|
return TestLoader().loadTestsFromName(__name__)
|
|
53
43
|
"""
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
def setUp(self):
|
|
61
|
-
super().setUp()
|
|
62
|
-
self.useFixture(self.package)
|
|
63
|
-
testtools.__path__.append(self.package.base)
|
|
64
|
-
self.addCleanup(testtools.__path__.remove, self.package.base)
|
|
65
|
-
self.addCleanup(sys.modules.pop, "testtools.runexample", None)
|
|
44
|
+
else:
|
|
45
|
+
init_contents = b"class not in\n"
|
|
46
|
+
self.package = fixtures.PythonPackage(
|
|
47
|
+
"runexample", [("__init__.py", init_contents)]
|
|
48
|
+
)
|
|
66
49
|
|
|
50
|
+
def setUp(self):
|
|
51
|
+
super().setUp()
|
|
52
|
+
self.useFixture(self.package)
|
|
53
|
+
testtools.__path__.append(self.package.base)
|
|
54
|
+
self.addCleanup(testtools.__path__.remove, self.package.base)
|
|
55
|
+
self.addCleanup(sys.modules.pop, "testtools.runexample", None)
|
|
67
56
|
|
|
68
|
-
if fixtures and testresources:
|
|
69
57
|
|
|
70
|
-
|
|
71
|
-
|
|
58
|
+
class SampleResourcedFixture(fixtures.Fixture):
|
|
59
|
+
"""Creates a test suite that uses testresources."""
|
|
72
60
|
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
61
|
+
def __init__(self):
|
|
62
|
+
super().__init__()
|
|
63
|
+
self.package = fixtures.PythonPackage(
|
|
64
|
+
"resourceexample",
|
|
65
|
+
[
|
|
66
|
+
(
|
|
67
|
+
"__init__.py",
|
|
68
|
+
b"""
|
|
81
69
|
from fixtures import Fixture
|
|
82
70
|
from testresources import (
|
|
83
71
|
FixtureResource,
|
|
@@ -109,30 +97,28 @@ def test_suite():
|
|
|
109
97
|
from unittest import TestLoader
|
|
110
98
|
return OptimisingTestSuite(TestLoader().loadTestsFromName(__name__))
|
|
111
99
|
""",
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
def setUp(self):
|
|
117
|
-
super().setUp()
|
|
118
|
-
self.useFixture(self.package)
|
|
119
|
-
self.addCleanup(testtools.__path__.remove, self.package.base)
|
|
120
|
-
testtools.__path__.append(self.package.base)
|
|
100
|
+
)
|
|
101
|
+
],
|
|
102
|
+
)
|
|
121
103
|
|
|
104
|
+
def setUp(self):
|
|
105
|
+
super().setUp()
|
|
106
|
+
self.useFixture(self.package)
|
|
107
|
+
self.addCleanup(testtools.__path__.remove, self.package.base)
|
|
108
|
+
testtools.__path__.append(self.package.base)
|
|
122
109
|
|
|
123
|
-
if fixtures:
|
|
124
110
|
|
|
125
|
-
|
|
126
|
-
|
|
111
|
+
class SampleLoadTestsPackage(fixtures.Fixture):
|
|
112
|
+
"""Creates a test suite package using load_tests."""
|
|
127
113
|
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
114
|
+
def __init__(self):
|
|
115
|
+
super().__init__()
|
|
116
|
+
self.package = fixtures.PythonPackage(
|
|
117
|
+
"discoverexample",
|
|
118
|
+
[
|
|
119
|
+
(
|
|
120
|
+
"__init__.py",
|
|
121
|
+
b"""
|
|
136
122
|
from testtools import TestCase, clone_test_with_new_id
|
|
137
123
|
|
|
138
124
|
class TestExample(TestCase):
|
|
@@ -143,22 +129,17 @@ def load_tests(loader, tests, pattern):
|
|
|
143
129
|
tests.addTest(clone_test_with_new_id(tests._tests[1]._tests[0], "fred"))
|
|
144
130
|
return tests
|
|
145
131
|
""",
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
def setUp(self):
|
|
151
|
-
super().setUp()
|
|
152
|
-
self.useFixture(self.package)
|
|
153
|
-
self.addCleanup(sys.path.remove, self.package.base)
|
|
154
|
-
|
|
132
|
+
)
|
|
133
|
+
],
|
|
134
|
+
)
|
|
155
135
|
|
|
156
|
-
class TestRun(TestCase):
|
|
157
136
|
def setUp(self):
|
|
158
137
|
super().setUp()
|
|
159
|
-
|
|
160
|
-
|
|
138
|
+
self.useFixture(self.package)
|
|
139
|
+
self.addCleanup(sys.path.remove, self.package.base)
|
|
161
140
|
|
|
141
|
+
|
|
142
|
+
class TestRun(TestCase):
|
|
162
143
|
def test_run_custom_list(self):
|
|
163
144
|
self.useFixture(SampleTestFixture())
|
|
164
145
|
tests = []
|
|
@@ -347,8 +328,6 @@ testtools.runexample.missingtest
|
|
|
347
328
|
)
|
|
348
329
|
|
|
349
330
|
def test_load_list_preserves_custom_suites(self):
|
|
350
|
-
if testresources is None:
|
|
351
|
-
self.skipTest("Need testresources")
|
|
352
331
|
self.useFixture(SampleResourcedFixture())
|
|
353
332
|
# We load two tests, not loading one. Both share a resource, so we
|
|
354
333
|
# should see just one resource setup occur.
|