diff options
author | Shantanu <12621235+hauntsaninja@users.noreply.github.com> | 2022-05-15 15:45:55 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-05-15 15:45:55 -0700 |
commit | 0d67ae1b7938ada3fe5df680b643d69290f0c099 (patch) | |
tree | 8fa5d3325837a27cf950dec47883c4cd6c3a6215 /tests/test_config.py | |
parent | e8973c5f50e9510c6ec7addf8fad70eceff6ab89 (diff) | |
download | python-coveragepy-git-0d67ae1b7938ada3fe5df680b643d69290f0c099.tar.gz |
Use tomllib on Python 3.11 (#1359)
Co-authored-by: hauntsaninja <>
Diffstat (limited to 'tests/test_config.py')
-rw-r--r-- | tests/test_config.py | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/tests/test_config.py b/tests/test_config.py index d85dfc7b..6aa43511 100644 --- a/tests/test_config.py +++ b/tests/test_config.py @@ -4,6 +4,7 @@ """Test the config file handling for coverage.py""" import math +import sys from collections import OrderedDict from unittest import mock @@ -706,19 +707,21 @@ class ConfigFileTest(UsingModulesMixin, CoverageTest): def test_no_toml_installed_no_toml(self): # Can't read a toml file that doesn't exist. - with without_module(coverage.tomlconfig, 'tomli'): + with without_module(coverage.tomlconfig, 'tomllib'): msg = "Couldn't read 'cov.toml' as a config file" with pytest.raises(ConfigError, match=msg): coverage.Coverage(config_file="cov.toml") + @pytest.mark.skipif(sys.version_info >= (3, 11), reason="Python 3.11 has toml in stdlib") 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 without_module(coverage.tomlconfig, 'tomli'): + with without_module(coverage.tomlconfig, 'tomllib'): msg = "Can't read 'cov.toml' without TOML support" with pytest.raises(ConfigError, match=msg): coverage.Coverage(config_file="cov.toml") + @pytest.mark.skipif(sys.version_info >= (3, 11), reason="Python 3.11 has toml in stdlib") def test_no_toml_installed_pyproject_toml(self): # Can't have coverage config in pyproject.toml without toml installed. self.make_file("pyproject.toml", """\ @@ -726,7 +729,7 @@ class ConfigFileTest(UsingModulesMixin, CoverageTest): [tool.coverage.run] xyzzy = 17 """) - with without_module(coverage.tomlconfig, 'tomli'): + with without_module(coverage.tomlconfig, 'tomllib'): msg = "Can't read 'pyproject.toml' without TOML support" with pytest.raises(ConfigError, match=msg): coverage.Coverage() @@ -738,7 +741,7 @@ class ConfigFileTest(UsingModulesMixin, CoverageTest): [tool.something] xyzzy = 17 """) - with without_module(coverage.tomlconfig, 'tomli'): + with without_module(coverage.tomlconfig, 'tomllib'): cov = coverage.Coverage() # We get default settings: assert not cov.config.timid |