summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorColin Watson <cjwatson@canonical.com>2022-04-23 18:32:07 +0100
committerColin Watson <cjwatson@canonical.com>2022-04-23 18:32:07 +0100
commitf89872e2f6535d8f91d2fc0c4b4182f0b39fc2c1 (patch)
tree529a160e58ad3f5eb2e53ab27be645179eeb8f33
parenta6f91288bec517762b74e228b8d6c5087cd1252f (diff)
downloadfixtures-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.rst4
-rw-r--r--fixtures/_fixtures/streams.py9
-rw-r--r--setup.cfg3
3 files changed, 13 insertions, 3 deletions
diff --git a/README.rst b/README.rst
index b60d993..9faafa3 100644
--- a/README.rst
+++ b/README.rst
@@ -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():
diff --git a/setup.cfg b/setup.cfg
index 0016fa7..21589e9 100644
--- a/setup.cfg
+++ b/setup.cfg
@@ -31,7 +31,10 @@ packages =
fixtures
[extras]
+streams =
+ testtools
test =
mock
+ testtools
docs =
docutils