From 9012623110f49635fff61d19a4f5bb779de91b99 Mon Sep 17 00:00:00 2001 From: Ned Batchelder Date: Tue, 2 Feb 2021 09:04:58 -0500 Subject: refactor: move test mixins to their own file --- tests/test_api.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'tests/test_api.py') diff --git a/tests/test_api.py b/tests/test_api.py index bce431f3..6c322795 100644 --- a/tests/test_api.py +++ b/tests/test_api.py @@ -22,7 +22,7 @@ from coverage.data import line_counts from coverage.files import abs_file, relative_filename from coverage.misc import CoverageException -from tests.coveragetest import CoverageTest, CoverageTestMethodsMixin, TESTS_DIR, UsingModulesMixin +from tests.coveragetest import CoverageTest, StopEverythingMixin, TESTS_DIR, UsingModulesMixin class ApiTest(CoverageTest): @@ -794,7 +794,7 @@ class NamespaceModuleTest(UsingModulesMixin, CoverageTest): cov.report() -class IncludeOmitTestsMixin(UsingModulesMixin, CoverageTestMethodsMixin): +class IncludeOmitTestsMixin(UsingModulesMixin, StopEverythingMixin): """Test methods for coverage methods taking include and omit.""" # We don't write any source files, but the data file will collide with -- cgit v1.2.1 From 80c021d9174e7ae3e5183f1902903fb90a891246 Mon Sep 17 00:00:00 2001 From: Ned Batchelder Date: Tue, 2 Feb 2021 09:12:47 -0500 Subject: refactor: remove reliance on unittest_mixins.StdStreamCapturingMixin This is another step toward removing unittest.TestCase as a base class. --- tests/test_api.py | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) (limited to 'tests/test_api.py') diff --git a/tests/test_api.py b/tests/test_api.py index 6c322795..ea625ff1 100644 --- a/tests/test_api.py +++ b/tests/test_api.py @@ -520,10 +520,8 @@ class ApiTest(CoverageTest): self.start_import_stop(cov, "hello") cov.get_data() - out = self.stdout() + out, err = self.stdouterr() assert "Hello\n" in out - - err = self.stderr() assert textwrap.dedent("""\ Coverage.py warning: Module sys has no Python source. (module-not-python) Coverage.py warning: Module xyzzy was never imported. (module-not-imported) @@ -544,10 +542,8 @@ class ApiTest(CoverageTest): self.start_import_stop(cov, "hello") cov.get_data() - out = self.stdout() + out, err = self.stdouterr() assert "Hello\n" in out - - err = self.stderr() assert "Coverage.py warning: Module sys has no Python source. (module-not-python)" in err assert "module-not-imported" not in err assert "no-data-collected" not in err -- cgit v1.2.1