summaryrefslogtreecommitdiff
path: root/tests/test_api.py
diff options
context:
space:
mode:
authorNed Batchelder <ned@nedbatchelder.com>2021-02-02 10:53:27 -0500
committerGitHub <noreply@github.com>2021-02-02 10:53:27 -0500
commitb7160a896252bb92ffe921a37e3cde98c5cb78b9 (patch)
treea0edae6ca0996217b9f0fa3213f824eab8b1cbe1 /tests/test_api.py
parent35d91c7aa186a84d0edb333bad60b520f3b1d719 (diff)
parent80c021d9174e7ae3e5183f1902903fb90a891246 (diff)
downloadpython-coveragepy-git-b7160a896252bb92ffe921a37e3cde98c5cb78b9.tar.gz
Merge pull request #1113 from nedbat/nedbat/capsys
More unittest removal
Diffstat (limited to 'tests/test_api.py')
-rw-r--r--tests/test_api.py12
1 files changed, 4 insertions, 8 deletions
diff --git a/tests/test_api.py b/tests/test_api.py
index bce431f3..ea625ff1 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):
@@ -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
@@ -794,7 +790,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