diff options
author | Colin Watson <cjwatson@canonical.com> | 2022-04-23 18:32:07 +0100 |
---|---|---|
committer | Colin Watson <cjwatson@canonical.com> | 2022-04-23 18:32:07 +0100 |
commit | f89872e2f6535d8f91d2fc0c4b4182f0b39fc2c1 (patch) | |
tree | 529a160e58ad3f5eb2e53ab27be645179eeb8f33 | |
parent | a6f91288bec517762b74e228b8d6c5087cd1252f (diff) | |
download | fixtures-git-f89872e2f6535d8f91d2fc0c4b4182f0b39fc2c1.tar.gz |
Move testtools requirement to a "streams" extra
Now that the core of `fixtures` no longer uses `testtools`, all that
remains to make it optional and break the cyclic requirement is to deal
with its use by streams fixtures. These intrinsically rely on
`testtools`, but are also very much optional, so move the requirement to
a new `fixtures[streams]` extra.
Fixes #38.
-rw-r--r-- | README.rst | 4 | ||||
-rw-r--r-- | fixtures/_fixtures/streams.py | 9 | ||||
-rw-r--r-- | setup.cfg | 3 |
3 files changed, 13 insertions, 3 deletions
@@ -336,6 +336,8 @@ in test failure descriptions. Very useful in combination with MonkeyPatch. ... pass >>> fixture.cleanUp() +This requires the ``fixtures[streams]`` extra. + EnvironmentVariable +++++++++++++++++++ @@ -450,6 +452,8 @@ in test failure descriptions. Very useful in combination with MonkeyPatch. ... pass >>> fixture.cleanUp() +This requires the ``fixtures[streams]`` extra. + TempDir +++++++ diff --git a/fixtures/_fixtures/streams.py b/fixtures/_fixtures/streams.py index 7686376..c0fb60a 100644 --- a/fixtures/_fixtures/streams.py +++ b/fixtures/_fixtures/streams.py @@ -22,7 +22,6 @@ __all__ = [ import io from fixtures import Fixture -import testtools class Stream(Fixture): @@ -42,10 +41,14 @@ class Stream(Fixture): self._stream_factory = stream_factory def _setUp(self): + # Available with the fixtures[streams] extra. + from testtools.content import content_from_stream + write_stream, read_stream = self._stream_factory() self.stream = write_stream - self.addDetail(self._detail_name, - testtools.content.content_from_stream(read_stream, seek_offset=0)) + self.addDetail( + self._detail_name, + content_from_stream(read_stream, seek_offset=0)) def _byte_stream_factory(): @@ -31,7 +31,10 @@ packages = fixtures [extras] +streams = + testtools test = mock + testtools docs = docutils |