diff options
author | Ned Batchelder <ned@nedbatchelder.com> | 2021-01-18 18:08:56 -0500 |
---|---|---|
committer | Ned Batchelder <ned@nedbatchelder.com> | 2021-01-18 18:23:27 -0500 |
commit | a09b1714c26cde1542044f44295600679d4368fc (patch) | |
tree | b0330905216c5a80f6c5c675494a95a00b3997a2 /tests/test_config.py | |
parent | 94239ad30e56f8f4bf01dcaf8700cdecca86e7f1 (diff) | |
download | python-coveragepy-git-a09b1714c26cde1542044f44295600679d4368fc.tar.gz |
Simplify the testing of the toml extra, fixing #1084
Diffstat (limited to 'tests/test_config.py')
-rw-r--r-- | tests/test_config.py | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/tests/test_config.py b/tests/test_config.py index dd86303f..4225540c 100644 --- a/tests/test_config.py +++ b/tests/test_config.py @@ -10,9 +10,9 @@ import mock import coverage from coverage.misc import CoverageException -import coverage.optional from tests.coveragetest import CoverageTest, UsingModulesMixin +from tests.helpers import without_module class ConfigTest(CoverageTest): @@ -712,7 +712,7 @@ class ConfigFileTest(UsingModulesMixin, CoverageTest): def test_no_toml_installed_no_toml(self): # Can't read a toml file that doesn't exist. - with coverage.optional.without('toml'): + with without_module(coverage.tomlconfig, 'toml'): msg = "Couldn't read 'cov.toml' as a config file" with self.assertRaisesRegex(CoverageException, msg): coverage.Coverage(config_file="cov.toml") @@ -720,7 +720,7 @@ class ConfigFileTest(UsingModulesMixin, CoverageTest): def test_no_toml_installed_explicit_toml(self): # Can't specify a toml config file if toml isn't installed. self.make_file("cov.toml", "# A toml file!") - with coverage.optional.without('toml'): + with without_module(coverage.tomlconfig, 'toml'): msg = "Can't read 'cov.toml' without TOML support" with self.assertRaisesRegex(CoverageException, msg): coverage.Coverage(config_file="cov.toml") @@ -732,7 +732,7 @@ class ConfigFileTest(UsingModulesMixin, CoverageTest): [tool.coverage.run] xyzzy = 17 """) - with coverage.optional.without('toml'): + with without_module(coverage.tomlconfig, 'toml'): msg = "Can't read 'pyproject.toml' without TOML support" with self.assertRaisesRegex(CoverageException, msg): coverage.Coverage() @@ -744,7 +744,7 @@ class ConfigFileTest(UsingModulesMixin, CoverageTest): [tool.something] xyzzy = 17 """) - with coverage.optional.without('toml'): + with without_module(coverage.tomlconfig, 'toml'): cov = coverage.Coverage() # We get default settings: self.assertFalse(cov.config.timid) |