Skip to content

Commit

Permalink
A test for bug 990
Browse files Browse the repository at this point in the history
  • Loading branch information
nedbat committed May 23, 2020
1 parent a462ab4 commit f0d3921
Showing 1 changed file with 10 additions and 4 deletions.
14 changes: 10 additions & 4 deletions tests/test_config.py
Expand Up @@ -3,6 +3,7 @@
# For details: https://github.com/nedbat/coveragepy/blob/master/NOTICE.txt

"""Test the config file handling for coverage.py"""

from collections import OrderedDict

import mock
Expand Down Expand Up @@ -62,6 +63,8 @@ def test_toml_config_file(self):
# A .coveragerc file will be read into the configuration.
self.make_file("pyproject.toml", """\
# This is just a bogus toml file for testing.
[tool.somethingelse]
authors = ["Joe D'Ávila <joe@gmail.com>"]
[tool.coverage.run]
concurrency = ["a", "b"]
timid = true
Expand All @@ -70,20 +73,23 @@ def test_toml_config_file(self):
[tool.coverage.report]
precision = 3
fail_under = 90.5
[tool.coverage.html]
title = "tabblo & «ταБЬℓσ»"
[tool.coverage.plugins.a_plugin]
hello = "world"
""")
cov = coverage.Coverage(config_file="pyproject.toml")
self.assertTrue(cov.config.timid)
self.assertFalse(cov.config.branch)
self.assertEqual(cov.config.concurrency, ["a", "b"])
self.assertEqual(cov.config.data_file, ".hello_kitty.data")
self.assertEqual(cov.config.plugins, ["plugins.a_plugin"])
self.assertEqual(cov.config.concurrency, [u"a", u"b"])
self.assertEqual(cov.config.data_file, u".hello_kitty.data")
self.assertEqual(cov.config.plugins, [u"plugins.a_plugin"])
self.assertEqual(cov.config.precision, 3)
self.assertEqual(cov.config.html_title, u"tabblo & «ταБЬℓσ»")
self.assertAlmostEqual(cov.config.fail_under, 90.5)
self.assertEqual(
cov.config.get_plugin_options("plugins.a_plugin"),
{'hello': 'world'}
{u"hello": u"world"}
)

# Test that our class doesn't reject integers when loading floats
Expand Down

0 comments on commit f0d3921

Please sign in to comment.