diff options
| author | Thomi Richards <thomi.richards@canonical.com> | 2013-11-19 15:28:28 +1300 |
|---|---|---|
| committer | Thomi Richards <thomi.richards@canonical.com> | 2013-11-19 15:28:28 +1300 |
| commit | 30bca6a29df3a608f9b1b4ad5f0a8d561e478e15 (patch) | |
| tree | 33a68396ec2cdd20d0df29cc2b40d622e62054f8 /python/subunit/tests | |
| parent | 9e0907fe6e961e0007584d97283d87cb7a720bb7 (diff) | |
| download | subunit-30bca6a29df3a608f9b1b4ad5f0a8d561e478e15.tar.gz | |
Python 3 compatibility fixes.
Diffstat (limited to 'python/subunit/tests')
| -rw-r--r-- | python/subunit/tests/test_output_filter.py | 26 |
1 files changed, 13 insertions, 13 deletions
diff --git a/python/subunit/tests/test_output_filter.py b/python/subunit/tests/test_output_filter.py index fac47ff..be42ea6 100644 --- a/python/subunit/tests/test_output_filter.py +++ b/python/subunit/tests/test_output_filter.py @@ -21,6 +21,7 @@ from functools import partial from io import BytesIO from tempfile import NamedTemporaryFile from testtools import TestCase +from testtools.compat import _b from testtools.matchers import ( Equals, IsInstance, @@ -102,7 +103,6 @@ class OutputFilterArgumentParserTests(TestCase): args = safe_parse_arguments( args=[command, 'foo', '--attach-file', tmp_file.name] ) - self.assertThat(args.attach_file, IsInstance(file)) self.assertThat(args.attach_file.name, Equals(tmp_file.name)) def test_all_commands_accept_mimetype_argument(self): @@ -298,26 +298,26 @@ class FileChunkingTests(TestCase): return result def test_file_chunk_size_is_honored(self): - result = self._write_chunk_file("Hello", 1) + result = self._write_chunk_file(_b("Hello"), 1) self.assertThat( result._events, MatchesListwise([ - MatchesCall(call='status', file_bytes='H', mime_type=None, eof=False), - MatchesCall(call='status', file_bytes='e', mime_type=None, eof=False), - MatchesCall(call='status', file_bytes='l', mime_type=None, eof=False), - MatchesCall(call='status', file_bytes='l', mime_type=None, eof=False), - MatchesCall(call='status', file_bytes='o', mime_type=None, eof=False), - MatchesCall(call='status', file_bytes='', mime_type=None, eof=True), + MatchesCall(call='status', file_bytes=_b('H'), mime_type=None, eof=False), + MatchesCall(call='status', file_bytes=_b('e'), mime_type=None, eof=False), + MatchesCall(call='status', file_bytes=_b('l'), mime_type=None, eof=False), + MatchesCall(call='status', file_bytes=_b('l'), mime_type=None, eof=False), + MatchesCall(call='status', file_bytes=_b('o'), mime_type=None, eof=False), + MatchesCall(call='status', file_bytes=_b(''), mime_type=None, eof=True), ]) ) def test_file_mimetype_is_honored(self): - result = self._write_chunk_file("SomeData", 1024, "text/plain") + result = self._write_chunk_file(_b("SomeData"), 1024, "text/plain") self.assertThat( result._events, MatchesListwise([ - MatchesCall(call='status', file_bytes='SomeData', mime_type="text/plain"), - MatchesCall(call='status', file_bytes='', mime_type="text/plain"), + MatchesCall(call='status', file_bytes=_b('SomeData'), mime_type="text/plain"), + MatchesCall(call='status', file_bytes=_b(''), mime_type="text/plain"), ]) ) @@ -339,10 +339,10 @@ class MatchesCall(Matcher): } def __init__(self, **kwargs): - unknown_kwargs = filter( + unknown_kwargs = list(filter( lambda k: k not in self._position_lookup, kwargs - ) + )) if unknown_kwargs: raise ValueError("Unknown keywords: %s" % ','.join(unknown_kwargs)) self._filters = kwargs |
