diff options
author | Ned Batchelder <ned@nedbatchelder.com> | 2015-08-28 14:30:26 -0400 |
---|---|---|
committer | Ned Batchelder <ned@nedbatchelder.com> | 2015-08-28 14:30:26 -0400 |
commit | dc025f2e9cd0dfe1c39bf8c62eed451ef7cad256 (patch) | |
tree | c0befed0296c78b4e9729c4d175185b99a43c682 /tests/test_data.py | |
parent | 6c572033ebb6d68655f44a092c6ededfb8c07b74 (diff) | |
download | python-coveragepy-git-dc025f2e9cd0dfe1c39bf8c62eed451ef7cad256.tar.gz |
Fix a crash when reporting on an unmeasured file. #403
Diffstat (limited to 'tests/test_data.py')
-rw-r--r-- | tests/test_data.py | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/tests/test_data.py b/tests/test_data.py index 93e482d7..b3882726 100644 --- a/tests/test_data.py +++ b/tests/test_data.py @@ -381,6 +381,29 @@ class CoverageDataTest(DataTestHelpers, CoverageTest): mock.call.update("hologram_plugin"), # file_tracer name ]) + def test_add_to_lines_hash_with_missing_file(self): + # https://bitbucket.org/ned/coveragepy/issues/403 + covdata = CoverageData() + covdata.add_lines(LINES_1) + hasher = mock.Mock() + covdata.add_to_hash("missing.py", hasher) + self.assertEqual(hasher.method_calls, [ + mock.call.update([]), + mock.call.update(None), + ]) + + def test_add_to_arcs_hash_with_missing_file(self): + # https://bitbucket.org/ned/coveragepy/issues/403 + covdata = CoverageData() + covdata.add_arcs(ARCS_3) + covdata.add_file_tracers({"y.py": "hologram_plugin"}) + hasher = mock.Mock() + covdata.add_to_hash("missing.py", hasher) + self.assertEqual(hasher.method_calls, [ + mock.call.update([]), + mock.call.update(None), + ]) + def test_empty_lines_are_still_lines(self): covdata = CoverageData() covdata.add_lines({}) |