Skip to content

Commit

Permalink
test: add a test for #1405
Browse files Browse the repository at this point in the history
  • Loading branch information
nedbat committed Aug 6, 2022
1 parent 36f508f commit eaf5592
Show file tree
Hide file tree
Showing 3 changed files with 34 additions and 0 deletions.
5 changes: 5 additions & 0 deletions CHANGES.rst
Expand Up @@ -20,6 +20,10 @@ development at the same time, such as 4.5.x and 5.0.
Unreleased
----------

- Fix a failure when combining data files due to file names containing
glob-like patterns (`pull 1405`_). Thanks, Michael Krebs and Benjamin
Schubert.

- Fix a messaging failure when combining Windows data files on a different
drive than the current directory. (`pull 1430`_, fixing `issue 1428`_).
Thanks, Lorenzo Micò.
Expand All @@ -32,6 +36,7 @@ Unreleased

.. _issue 972: https://github.com/nedbat/coveragepy/issues/972
.. _pull 1347: https://github.com/nedbat/coveragepy/pull/1347
.. _pull 1405: https://github.com/nedbat/coveragepy/issues/1405
.. _pull 1413: https://github.com/nedbat/coveragepy/issues/1413
.. _pull 1428: https://github.com/nedbat/coveragepy/issues/1428
.. _pull 1430: https://github.com/nedbat/coveragepy/pull/1430
Expand Down
2 changes: 2 additions & 0 deletions CONTRIBUTORS.txt
Expand Up @@ -23,6 +23,7 @@ Artem Dayneko
Arthur Deygin
Ben Carlsson
Ben Finney
Benjamin Schubert
Bernát Gábor
Bill Hart
Bradley Burns
Expand Down Expand Up @@ -111,6 +112,7 @@ Matthew Boehm
Matthew Desmarais
Matus Valo
Max Linke
Michael Krebs
Michał Bultrowicz
Mickie Betz
Mike Fiedler
Expand Down
27 changes: 27 additions & 0 deletions tests/test_data.py
Expand Up @@ -878,6 +878,33 @@ def test_interleaved_erasing_bug716(self):
# "no such table: meta"
covdata2.add_lines(LINES_1)

@pytest.mark.parametrize(
"dpart, fpart",
[
("", "[b-a]"),
("[3-1]", ""),
("[3-1]", "[b-a]"),
],
)
def test_combining_with_crazy_filename(self, dpart, fpart):
dirname = f"py{dpart}"
basename = f"{dirname}/.coverage{fpart}"
os.makedirs(dirname)

covdata1 = CoverageData(basename=basename, suffix="1")
covdata1.add_lines(LINES_1)
covdata1.write()

covdata2 = CoverageData(basename=basename, suffix="2")
covdata2.add_lines(LINES_2)
covdata2.write()

covdata3 = CoverageData(basename=basename)
combine_parallel_data(covdata3)
assert_line_counts(covdata3, SUMMARY_1_2)
assert_measured_files(covdata3, MEASURED_FILES_1_2)
self.assert_file_count(glob.escape(basename) + ".*", 0)


class DumpsLoadsTest(CoverageTest):
"""Tests of CoverageData.dumps and loads."""
Expand Down

0 comments on commit eaf5592

Please sign in to comment.