diff --git a/CHANGES.rst b/CHANGES.rst index f3e2cdb88..952a975bb 100644 --- a/CHANGES.rst +++ b/CHANGES.rst @@ -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ò. @@ -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 diff --git a/CONTRIBUTORS.txt b/CONTRIBUTORS.txt index d4a1e760f..4c6dfaf15 100644 --- a/CONTRIBUTORS.txt +++ b/CONTRIBUTORS.txt @@ -23,6 +23,7 @@ Artem Dayneko Arthur Deygin Ben Carlsson Ben Finney +Benjamin Schubert Bernát Gábor Bill Hart Bradley Burns @@ -111,6 +112,7 @@ Matthew Boehm Matthew Desmarais Matus Valo Max Linke +Michael Krebs Michał Bultrowicz Mickie Betz Mike Fiedler diff --git a/tests/test_data.py b/tests/test_data.py index 3cb519ca4..8f05ada0d 100644 --- a/tests/test_data.py +++ b/tests/test_data.py @@ -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."""