diff options
| author | Jelmer Vernooij <jelmer@jelmer.uk> | 2023-01-31 19:08:26 +0000 |
|---|---|---|
| committer | Jelmer Vernooij <jelmer@jelmer.uk> | 2023-01-31 19:53:38 +0000 |
| commit | 291b44e10e448be5439e510ef02f2fe709649b8f (patch) | |
| tree | ab85339cda13dfcdaec84e98c41600d379125e80 /python/subunit/tests | |
| parent | e9f6eef3a0961cdb0a1b823ebbfd7bc289f63cf3 (diff) | |
| download | subunit-git-291b44e10e448be5439e510ef02f2fe709649b8f.tar.gz | |
Sort Python import definitions with isort
Diffstat (limited to 'python/subunit/tests')
| -rw-r--r-- | python/subunit/tests/__init__.py | 23 | ||||
| -rwxr-xr-x | python/subunit/tests/sample-script.py | 4 | ||||
| -rwxr-xr-x | python/subunit/tests/sample-two-script.py | 1 | ||||
| -rw-r--r-- | python/subunit/tests/test_chunked.py | 2 | ||||
| -rw-r--r-- | python/subunit/tests/test_filter_to_disk.py | 5 | ||||
| -rw-r--r-- | python/subunit/tests/test_filters.py | 3 | ||||
| -rw-r--r-- | python/subunit/tests/test_output_filter.py | 28 | ||||
| -rw-r--r-- | python/subunit/tests/test_subunit_filter.py | 11 | ||||
| -rw-r--r-- | python/subunit/tests/test_subunit_stats.py | 3 | ||||
| -rw-r--r-- | python/subunit/tests/test_tap2subunit.py | 2 | ||||
| -rw-r--r-- | python/subunit/tests/test_test_protocol.py | 37 | ||||
| -rw-r--r-- | python/subunit/tests/test_test_protocol2.py | 10 | ||||
| -rw-r--r-- | python/subunit/tests/test_test_results.py | 10 |
13 files changed, 52 insertions, 87 deletions
diff --git a/python/subunit/tests/__init__.py b/python/subunit/tests/__init__.py index 4c8b2ae..a49a0b2 100644 --- a/python/subunit/tests/__init__.py +++ b/python/subunit/tests/__init__.py @@ -19,7 +19,6 @@ from unittest import TestLoader from testscenarios import generate_scenarios - # Before the test module imports to avoid circularity. # For testing: different pythons have different str() implementations. _remote_exception_repr = "testtools.testresult.real._StringException" @@ -28,22 +27,12 @@ _remote_exception_str = "Traceback (most recent call last):\ntesttools.testresul _remote_exception_str_chunked = "57\r\n" + _remote_exception_str + ": boo qux\n0\r\n" -from subunit.tests import ( - test_chunked, - test_details, - test_filters, - test_filter_to_disk, - test_output_filter, - test_progress_model, - test_run, - test_subunit_filter, - test_subunit_stats, - test_subunit_tags, - test_tap2subunit, - test_test_protocol, - test_test_protocol2, - test_test_results, - ) +from subunit.tests import (test_chunked, test_details, test_filter_to_disk, + test_filters, test_output_filter, + test_progress_model, test_run, test_subunit_filter, + test_subunit_stats, test_subunit_tags, + test_tap2subunit, test_test_protocol, + test_test_protocol2, test_test_results) def test_suite(): diff --git a/python/subunit/tests/sample-script.py b/python/subunit/tests/sample-script.py index f89f6c1..d8cdc76 100755 --- a/python/subunit/tests/sample-script.py +++ b/python/subunit/tests/sample-script.py @@ -1,7 +1,9 @@ #!/usr/bin/env python3 import sys + if sys.platform == "win32": - import msvcrt, os + import msvcrt + import os msvcrt.setmode(sys.stdout.fileno(), os.O_BINARY) if len(sys.argv) == 2: # subunit.tests.test_test_protocol.TestExecTestCase.test_sample_method_args diff --git a/python/subunit/tests/sample-two-script.py b/python/subunit/tests/sample-two-script.py index a687601..ecddc2e 100755 --- a/python/subunit/tests/sample-two-script.py +++ b/python/subunit/tests/sample-two-script.py @@ -1,5 +1,6 @@ #!/usr/bin/env python3 import sys + print("test old mcdonald") print("success old mcdonald") print("test bing crosby") diff --git a/python/subunit/tests/test_chunked.py b/python/subunit/tests/test_chunked.py index 21f4814..bb7ccd6 100644 --- a/python/subunit/tests/test_chunked.py +++ b/python/subunit/tests/test_chunked.py @@ -15,8 +15,8 @@ # limitations under that license. # -from io import BytesIO import unittest +from io import BytesIO from testtools.compat import _b diff --git a/python/subunit/tests/test_filter_to_disk.py b/python/subunit/tests/test_filter_to_disk.py index c2b0996..c0654f5 100644 --- a/python/subunit/tests/test_filter_to_disk.py +++ b/python/subunit/tests/test_filter_to_disk.py @@ -18,13 +18,12 @@ import os.path from fixtures import TempDir from testtools import TestCase -from testtools.matchers import ( - FileContains - ) +from testtools.matchers import FileContains from subunit import _to_disk from subunit.v2 import StreamResultToBytes + class SmokeTest(TestCase): def test_smoke(self): diff --git a/python/subunit/tests/test_filters.py b/python/subunit/tests/test_filters.py index bc797da..21cca42 100644 --- a/python/subunit/tests/test_filters.py +++ b/python/subunit/tests/test_filters.py @@ -19,9 +19,8 @@ from tempfile import NamedTemporaryFile from testtools import TestCase -from subunit.filters import find_stream - from subunit import read_test_list +from subunit.filters import find_stream class TestReadTestList(TestCase): diff --git a/python/subunit/tests/test_output_filter.py b/python/subunit/tests/test_output_filter.py index 0f61ac5..e247e35 100644 --- a/python/subunit/tests/test_output_filter.py +++ b/python/subunit/tests/test_output_filter.py @@ -15,34 +15,24 @@ # import datetime -from functools import partial -from io import BytesIO, StringIO, TextIOWrapper import optparse import sys +from contextlib import contextmanager +from functools import partial +from io import BytesIO, StringIO, TextIOWrapper from tempfile import NamedTemporaryFile -from contextlib import contextmanager from testtools import TestCase from testtools.compat import _u -from testtools.matchers import ( - Equals, - Matcher, - MatchesAny, - MatchesListwise, - Mismatch, - raises, -) +from testtools.matchers import (Equals, Matcher, MatchesAny, MatchesListwise, + Mismatch, raises) from testtools.testresult.doubles import StreamResult -from subunit.iso8601 import UTC -from subunit.v2 import StreamResultToBytes, ByteStreamToStreamResult -from subunit._output import ( - _ALL_ACTIONS, - _FINAL_ACTIONS, - generate_stream_results, - parse_arguments, -) import subunit._output as _o +from subunit._output import (_ALL_ACTIONS, _FINAL_ACTIONS, + generate_stream_results, parse_arguments) +from subunit.iso8601 import UTC +from subunit.v2 import ByteStreamToStreamResult, StreamResultToBytes class SafeOptionParser(optparse.OptionParser): diff --git a/python/subunit/tests/test_subunit_filter.py b/python/subunit/tests/test_subunit_filter.py index 3ae2a08..81494ad 100644 --- a/python/subunit/tests/test_subunit_filter.py +++ b/python/subunit/tests/test_subunit_filter.py @@ -16,21 +16,20 @@ """Tests for subunit.TestResultFilter.""" -from datetime import datetime -from io import BytesIO import os import subprocess import sys import unittest +from datetime import datetime +from io import BytesIO -from testtools.compat import _b from testtools import TestCase +from testtools.compat import _b from testtools.testresult.doubles import ExtendedTestResult, StreamResult import subunit -from subunit import iso8601 -from subunit.test_results import make_tag_filter, TestResultFilter -from subunit import ByteStreamToStreamResult, StreamResultToBytes +from subunit import ByteStreamToStreamResult, StreamResultToBytes, iso8601 +from subunit.test_results import TestResultFilter, make_tag_filter class TestTestResultFilter(TestCase): diff --git a/python/subunit/tests/test_subunit_stats.py b/python/subunit/tests/test_subunit_stats.py index 46be5c2..a4f29f2 100644 --- a/python/subunit/tests/test_subunit_stats.py +++ b/python/subunit/tests/test_subunit_stats.py @@ -16,9 +16,8 @@ """Tests for subunit.TestResultStats.""" -from io import BytesIO -from io import StringIO import unittest +from io import BytesIO, StringIO from testtools.compat import _b diff --git a/python/subunit/tests/test_tap2subunit.py b/python/subunit/tests/test_tap2subunit.py index 5b7c07a..14b5086 100644 --- a/python/subunit/tests/test_tap2subunit.py +++ b/python/subunit/tests/test_tap2subunit.py @@ -16,8 +16,8 @@ """Tests for TAP2SubUnit.""" -from io import BytesIO, StringIO import unittest +from io import BytesIO, StringIO from testtools import TestCase from testtools.compat import _u diff --git a/python/subunit/tests/test_test_protocol.py b/python/subunit/tests/test_test_protocol.py index 74cb1ce..52be34c 100644 --- a/python/subunit/tests/test_test_protocol.py +++ b/python/subunit/tests/test_test_protocol.py @@ -16,39 +16,35 @@ import datetime import io -from io import BytesIO -from io import StringIO import os import tempfile import unittest +from io import BytesIO, StringIO -from testtools import PlaceHolder, skipIf, TestCase, TestResult +from testtools import PlaceHolder, TestCase, TestResult, skipIf from testtools.compat import _b, _u from testtools.content import Content, TracebackContent, text_content from testtools.content_type import ContentType + try: - from testtools.testresult.doubles import ( - Python26TestResult, - Python27TestResult, - ExtendedTestResult, - ) + from testtools.testresult.doubles import (ExtendedTestResult, + Python26TestResult, + Python27TestResult) except ImportError: from testtools.tests.helpers import ( Python26TestResult, Python27TestResult, ExtendedTestResult, ) + from testtools.matchers import Contains, Equals, MatchesAny import subunit -from subunit.tests import ( - _remote_exception_repr, - _remote_exception_repr_chunked, - _remote_exception_str, - _remote_exception_str_chunked, - ) import subunit.iso8601 as iso8601 - +from subunit.tests import (_remote_exception_repr, + _remote_exception_repr_chunked, + _remote_exception_str, + _remote_exception_str_chunked) tb_prelude = "Traceback (most recent call last):\n" @@ -90,14 +86,9 @@ class TestHelpers(TestCase): class TestTestImports(unittest.TestCase): def test_imports(self): - from subunit import DiscardStream - from subunit import TestProtocolServer - from subunit import RemotedTestCase - from subunit import RemoteError - from subunit import ExecTestCase - from subunit import IsolatedTestCase - from subunit import TestProtocolClient - from subunit import ProtocolTestCase + from subunit import (DiscardStream, ExecTestCase, IsolatedTestCase, + ProtocolTestCase, RemotedTestCase, RemoteError, + TestProtocolClient, TestProtocolServer) class TestDiscardStream(unittest.TestCase): diff --git a/python/subunit/tests/test_test_protocol2.py b/python/subunit/tests/test_test_protocol2.py index 0b40929..1f542d5 100644 --- a/python/subunit/tests/test_test_protocol2.py +++ b/python/subunit/tests/test_test_protocol2.py @@ -14,22 +14,22 @@ # limitations under that license. # -from io import BytesIO import datetime +from io import BytesIO try: from hypothesis import given -# To debug hypothesis -# from hypothesis import Settings, Verbosity -# Settings.default.verbosity = Verbosity.verbose + # To debug hypothesis + # from hypothesis import Settings, Verbosity + # Settings.default.verbosity = Verbosity.verbose 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 from testtools.testresult.doubles import StreamResult +from testtools.tests.test_testresult import TestStreamResultContract import subunit import subunit.iso8601 as iso8601 diff --git a/python/subunit/tests/test_test_results.py b/python/subunit/tests/test_test_results.py index 31fd0ac..7362624 100644 --- a/python/subunit/tests/test_test_results.py +++ b/python/subunit/tests/test_test_results.py @@ -16,23 +16,19 @@ import csv import datetime -from io import StringIO import sys import unittest +from io import StringIO +import testtools from testtools import TestCase -from testtools.content import ( - text_content, - TracebackContent, -) +from testtools.content import TracebackContent, text_content from testtools.testresult.doubles import ExtendedTestResult import subunit import subunit.iso8601 as iso8601 import subunit.test_results -import testtools - class LoggingDecorator(subunit.test_results.HookedTestResultDecorator): |
