diff options
author | Ned Batchelder <ned@nedbatchelder.com> | 2018-01-21 12:32:03 -0500 |
---|---|---|
committer | Ned Batchelder <ned@nedbatchelder.com> | 2018-01-21 12:32:03 -0500 |
commit | e756776c0a9f3c78389bcc93e067ac3ac0f45ad9 (patch) | |
tree | 6175b059058e9c1db47bdb3e4ac9f3488bef6877 /tests/test_process.py | |
parent | f6e05b8c9b69ad1b8b847d8e9078d0c99480dac7 (diff) | |
download | python-coveragepy-git-e756776c0a9f3c78389bcc93e067ac3ac0f45ad9.tar.gz |
fail_under can now be a float. #631.
Diffstat (limited to 'tests/test_process.py')
-rw-r--r-- | tests/test_process.py | 22 |
1 files changed, 13 insertions, 9 deletions
diff --git a/tests/test_process.py b/tests/test_process.py index 2d4e72f0..42a6d983 100644 --- a/tests/test_process.py +++ b/tests/test_process.py @@ -960,18 +960,22 @@ class FailUnderTest(CoverageTest): """) st, _ = self.run_command_status("coverage run forty_two_plus.py") self.assertEqual(st, 0) - st, out = self.run_command_status("coverage report") - self.assertEqual(st, 0) - self.assertEqual( - self.last_line_squeezed(out), - "forty_two_plus.py 7 4 43%" - ) - def test_report(self): - st, _ = self.run_command_status("coverage report --fail-under=43") + def test_report_43_is_ok(self): + st, out = self.run_command_status("coverage report --fail-under=43") self.assertEqual(st, 0) - st, _ = self.run_command_status("coverage report --fail-under=44") + self.assertEqual(self.last_line_squeezed(out), "forty_two_plus.py 7 4 43%") + + def test_report_43_is_not_ok(self): + st, out = self.run_command_status("coverage report --fail-under=44") + self.assertEqual(st, 2) + self.assertEqual(self.last_line_squeezed(out), "forty_two_plus.py 7 4 43%") + + def test_report_42p86_is_not_ok(self): + self.make_file(".coveragerc", "[report]\nprecision = 2") + st, out = self.run_command_status("coverage report --fail-under=42.88") self.assertEqual(st, 2) + self.assertEqual(self.last_line_squeezed(out), "forty_two_plus.py 7 4 42.86%") class FailUnderNoFilesTest(CoverageTest): |