| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -1,4 +1,5 @@ | |||
| 1 | 1 | import os | |
| 2 | + from pickle import dump | ||
| 2 | 3 | import sys | |
| 3 | 4 | from test.support import captured_stdout | |
| 4 | 5 | from test.support.os_helper import (TESTFN, rmtree, unlink) | |
@@ -412,6 +413,15 @@ def test_issue9936(self): | |||
| 412 | 413 | self.assertIn(modname, coverage) | |
| 413 | 414 | self.assertEqual(coverage[modname], (5, 100)) | |
| 414 | 415 | ||
| 416 | + def test_coverageresults_update(self): | ||
| 417 | + # Update empty CoverageResults with a non-empty infile. | ||
| 418 | + infile = TESTFN + '-infile' | ||
| 419 | + with open(infile, 'wb') as f: | ||
| 420 | + dump(({}, {}, {'caller': 1}), f, protocol=1) | ||
| 421 | + self.addCleanup(unlink, infile) | ||
| 422 | + results = trace.CoverageResults({}, {}, infile, {}) | ||
| 423 | + self.assertEqual(results.callers, {'caller': 1}) | ||
| 424 | + | ||
| 415 | 425 | ### Tests that don't mess with sys.settrace and can be traced | |
| 416 | 426 | ### themselves TODO: Skip tests that do mess with sys.settrace when | |
| 417 | 427 | ### regrtest is invoked with -T option. | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -172,7 +172,7 @@ def __init__(self, counts=None, calledfuncs=None, infile=None, | |||
| 172 | 172 | try: | |
| 173 | 173 | with open(self.infile, 'rb') as f: | |
| 174 | 174 | counts, calledfuncs, callers = pickle.load(f) | |
| 175 | - self.update(self.__class__(counts, calledfuncs, callers)) | ||
| 175 | + self.update(self.__class__(counts, calledfuncs, callers=callers)) | ||
| 176 | 176 | except (OSError, EOFError, ValueError) as err: | |
| 177 | 177 | print(("Skipping counts file %r: %s" | |
| 178 | 178 | % (self.infile, err)), file=sys.stderr) | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -0,0 +1 @@ | |||
| 1 | + Fix bug when calling trace.CoverageResults with valid infile. | ||
| Back | FazBrowse Home | New Git URL |
0 commit comments