summaryrefslogtreecommitdiff
path: root/tests/test_testing.py
diff options
context:
space:
mode:
authorNed Batchelder <ned@nedbatchelder.com>2021-01-18 18:08:56 -0500
committerNed Batchelder <ned@nedbatchelder.com>2021-01-18 18:23:27 -0500
commita09b1714c26cde1542044f44295600679d4368fc (patch)
treeb0330905216c5a80f6c5c675494a95a00b3997a2 /tests/test_testing.py
parent94239ad30e56f8f4bf01dcaf8700cdecca86e7f1 (diff)
downloadpython-coveragepy-git-a09b1714c26cde1542044f44295600679d4368fc.tar.gz
Simplify the testing of the toml extra, fixing #1084
Diffstat (limited to 'tests/test_testing.py')
-rw-r--r--tests/test_testing.py19
1 files changed, 10 insertions, 9 deletions
diff --git a/tests/test_testing.py b/tests/test_testing.py
index c5d46430..34ea3263 100644
--- a/tests/test_testing.py
+++ b/tests/test_testing.py
@@ -12,14 +12,16 @@ import sys
import pytest
import coverage
+from coverage import tomlconfig
from coverage.backunittest import TestCase, unittest
from coverage.files import actual_path
from coverage.misc import StopEverything
-import coverage.optional
from tests.coveragetest import CoverageTest, convert_skip_exceptions
-from tests.helpers import arcs_to_arcz_repr, arcz_to_arcs
-from tests.helpers import CheckUniqueFilenames, re_lines, re_line
+from tests.helpers import (
+ arcs_to_arcz_repr, arcz_to_arcs,
+ CheckUniqueFilenames, re_lines, re_line, without_module,
+)
def test_xdist_sys_path_nuttiness_is_fixed():
@@ -323,12 +325,11 @@ def _same_python_executable(e1, e2):
return False # pragma: only failure
-def test_optional_without():
- # pylint: disable=reimported
- from coverage.optional import toml as toml1
- with coverage.optional.without('toml'):
- from coverage.optional import toml as toml2
- from coverage.optional import toml as toml3
+def test_without_module():
+ toml1 = tomlconfig.toml
+ with without_module(tomlconfig, 'toml'):
+ toml2 = tomlconfig.toml
+ toml3 = tomlconfig.toml
assert toml1 is toml3 is not None
assert toml2 is None