summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorColin Watson <cjwatson@canonical.com>2022-04-23 18:53:53 +0100
committerJelmer Vernooij <jelmer@jelmer.uk>2022-07-01 19:30:35 +0100
commit0d9f1c7e0e414603d212f0aaffaa193748a15e3f (patch)
tree627d4d81d693325f2057702a81519841b65cacbc
parent621553dd73ff076c00aa80a1afcf87d4ab415981 (diff)
downloadtesttools-0d9f1c7e0e414603d212f0aaffaa193748a15e3f.tar.gz
Use CompoundFixture from fixtures>=2.0 rather than rolling our own
`fixtures` 2.0 was released in 2016.
-rw-r--r--NEWS3
-rw-r--r--requirements.txt2
-rw-r--r--testtools/twistedsupport/_runtest.py18
3 files changed, 6 insertions, 17 deletions
diff --git a/NEWS b/NEWS
index 91068c2..e159343 100644
--- a/NEWS
+++ b/NEWS
@@ -18,6 +18,9 @@ Improvements
* Distutils integration is deprecated and will be removed in the next major
version.
+* Use ``CompoundFixture`` from ``fixtures>=2.0`` rather than rolling our
+ own.
+
2.5.0
~~~~~
diff --git a/requirements.txt b/requirements.txt
index 4a7c1d4..3cfa9bd 100644
--- a/requirements.txt
+++ b/requirements.txt
@@ -2,4 +2,4 @@ pbr>=0.11
# TODO(stephenfin): Remove this once fixtures no longer depends on extras
# or explicitly specifies the dependency
extras>=1.0.0
-fixtures>=1.3.0
+fixtures>=2.0
diff --git a/testtools/twistedsupport/_runtest.py b/testtools/twistedsupport/_runtest.py
index c8860e9..d4f7775 100644
--- a/testtools/twistedsupport/_runtest.py
+++ b/testtools/twistedsupport/_runtest.py
@@ -30,7 +30,7 @@ import io
import warnings
import sys
-from fixtures import Fixture
+from fixtures import CompoundFixture, Fixture
from testtools.content import Content, text_content
from testtools.content_type import UTF8_TEXT
@@ -194,20 +194,6 @@ def run_with_log_observers(observers, function, *args, **kwargs):
_log_observer = _LogObserver()
-# XXX: Should really be in python-fixtures.
-# See https://github.com/testing-cabal/fixtures/pull/22.
-class _CompoundFixture(Fixture):
- """A fixture that combines many fixtures."""
-
- def __init__(self, fixtures):
- super().__init__()
- self._fixtures = fixtures
-
- def _setUp(self):
- for fixture in self._fixtures:
- self.useFixture(fixture)
-
-
def flush_logged_errors(*error_types):
"""Flush errors of the given types from the global Twisted log.
@@ -411,7 +397,7 @@ class AsynchronousDeferredRunTest(_DeferredRunTest):
fixtures.append(_NoTwistedLogObservers())
if self._store_twisted_logs:
fixtures.append(CaptureTwistedLogs())
- return _CompoundFixture(fixtures)
+ return CompoundFixture(fixtures)
def _run_core(self):
# XXX: Blatting over the namespace of the test case isn't a nice thing