diff options
author | Jelmer Vernooij <jelmer@jelmer.uk> | 2022-07-01 19:39:13 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-07-01 19:39:13 +0100 |
commit | 58d5c3f9b91f572e1fa174f5472e3d0a92f948c3 (patch) | |
tree | 92b2c0de99f7edd22376aa7f5a92ff7a2a08af3a | |
parent | 4c352be4d3ba2dbf870b1e19885c4a4135264295 (diff) | |
parent | 73eb82e06c6578fc964a2bf4b6710ed71f3b045c (diff) | |
download | testtools-58d5c3f9b91f572e1fa174f5472e3d0a92f948c3.tar.gz |
Merge pull request #326 from cjwatson/compound-fixture
Use CompoundFixture from fixtures>=2.0 rather than rolling our own
-rw-r--r-- | NEWS | 3 | ||||
-rw-r--r-- | requirements.txt | 2 | ||||
-rw-r--r-- | testtools/twistedsupport/_runtest.py | 18 |
3 files changed, 6 insertions, 17 deletions
@@ -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. + * Provide a ``testtools[twisted]`` extra documenting dependencies needed for ``testtools.twistedsupport``. 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 |