summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRobert Collins <robertc@robertcollins.net>2015-10-20 15:11:05 +1300
committerRobert Collins <robertc@robertcollins.net>2015-10-20 15:11:05 +1300
commit5649ea88a8341c73b9911689436cc6d6018b779c (patch)
treedd692aa2958b13edbe848c39277c1e165fc84bb1
parent562084f373274540387b6e024eb735f3fa5aff28 (diff)
downloadsubunit-5649ea88a8341c73b9911689436cc6d6018b779c.tar.gz
Skip hypothesis tests on 3.2
(It's not 3.2 compatible at the moment).
-rw-r--r--python/subunit/tests/test_test_protocol2.py25
-rwxr-xr-xsetup.py3
2 files changed, 17 insertions, 11 deletions
diff --git a/python/subunit/tests/test_test_protocol2.py b/python/subunit/tests/test_test_protocol2.py
index 9a84a84..bbf510e 100644
--- a/python/subunit/tests/test_test_protocol2.py
+++ b/python/subunit/tests/test_test_protocol2.py
@@ -17,11 +17,15 @@
from io import BytesIO
import datetime
-from hypothesis import given
+try:
+ from hypothesis import given
# To debug hypothesis
# from hypothesis import Settings, Verbosity
# Settings.default.verbosity = Verbosity.verbose
-import hypothesis.strategies as st
+ import hypothesis.strategies as st
+except ImportError:
+ given = None
+ st = None
from testtools import TestCase
from testtools.matchers import Contains, HasLength
from testtools.tests.test_testresult import TestStreamResultContract
@@ -440,11 +444,12 @@ class TestByteStreamToStreamResult(TestCase):
self.check_event(content.getvalue(), test_id=None, file_name='bar',
route_code='0', mime_type='text/plain', file_bytes=b'foo')
- @given(st.binary())
- def test_hypothesis_decoding(self, code_bytes):
- source = BytesIO(code_bytes)
- result = StreamResult()
- stream = subunit.ByteStreamToStreamResult(
- source, non_subunit_name="stdout")
- stream.run(result)
- self.assertEqual(b'', source.read())
+ if st is not None:
+ @given(st.binary())
+ def test_hypothesis_decoding(self, code_bytes):
+ source = BytesIO(code_bytes)
+ result = StreamResult()
+ stream = subunit.ByteStreamToStreamResult(
+ source, non_subunit_name="stdout")
+ stream.run(result)
+ self.assertEqual(b'', source.read())
diff --git a/setup.py b/setup.py
index f8ac67a..6d5a371 100755
--- a/setup.py
+++ b/setup.py
@@ -20,7 +20,8 @@ else:
],
'extras_require': {
'docs': ['docutils'],
- 'test': ['fixtures', 'hypothesis', 'testscenarios'],
+ 'test': ['fixtures', 'testscenarios'],
+ 'test:python_version!="3.2"': ['hypothesis'],
},
}