From 4bce9dff1c81475d1779c8508f08032c3b21f21a Mon Sep 17 00:00:00 2001 From: Yukihiko Shinoda Date: Thu, 23 Feb 2023 16:22:08 +0900 Subject: [PATCH 1/5] Add FlatLayoutPackageFinder's test for Coverage.py --- setuptools/tests/test_find_packages.py | 1 + 1 file changed, 1 insertion(+) diff --git a/setuptools/tests/test_find_packages.py b/setuptools/tests/test_find_packages.py index efcce924e5..6c605e02b4 100644 --- a/setuptools/tests/test_find_packages.py +++ b/setuptools/tests/test_find_packages.py @@ -217,6 +217,7 @@ class TestFlatLayoutPackageFinder: ), "tool-specific": ( [ + "htmlcov/index.html", "pkg/__init__.py", "tasks/__init__.py", "tasks/subpackage/__init__.py", From 17aa0a62c24041055ba09373901beb318a6e9845 Mon Sep 17 00:00:00 2001 From: Yukihiko Shinoda Date: Thu, 23 Feb 2023 12:48:37 +0900 Subject: [PATCH 2/5] Hotfix add htmlcov to FlatLayoutPackageFinder.DEFAULT_EXCLUDE --- setuptools/discovery.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/setuptools/discovery.py b/setuptools/discovery.py index 6244a18558..75c6e8357f 100644 --- a/setuptools/discovery.py +++ b/setuptools/discovery.py @@ -234,6 +234,7 @@ class FlatLayoutPackageFinder(PEP420PackageFinder): "benchmarks", "exercise", "exercises", + "htmlcov", # Coverage.py # ---- Hidden directories/Private packages ---- "[._]*", ) @@ -273,7 +274,7 @@ class FlatLayoutModuleFinder(ModuleFinder): "benchmarks", "exercise", "exercises", - "htmlcov", + "htmlcov", # Coverage.py # ---- Hidden files/Private modules ---- "[._]*", ) From 9bfb5bfb861e631964718c95e1897adf4557bfd0 Mon Sep 17 00:00:00 2001 From: Yukihiko Shinoda Date: Thu, 23 Feb 2023 12:57:02 +0900 Subject: [PATCH 3/5] Add changelog entry --- changelog.d/3594.change.rst | 1 + 1 file changed, 1 insertion(+) create mode 100644 changelog.d/3594.change.rst diff --git a/changelog.d/3594.change.rst b/changelog.d/3594.change.rst new file mode 100644 index 0000000000..acb74c47b3 --- /dev/null +++ b/changelog.d/3594.change.rst @@ -0,0 +1 @@ +Added ``htmlcov`` to FlatLayoutPackageFinder.DEFAULT_EXCLUDE -- by :user:`yukihiko-shinoda` From 89e7f64ffd4e57bc2a764c885382d99a28133a2d Mon Sep 17 00:00:00 2001 From: Anderson Bravalheri Date: Mon, 27 Feb 2023 10:36:58 +0000 Subject: [PATCH 4/5] Remove htmlcov from auto **module** discovery It seems that it was previously added there by mistake. After some inspection ``htmlcov`` should be a folder (by default) and therefore can only be confused by a package (not a module) --- setuptools/discovery.py | 1 - 1 file changed, 1 deletion(-) diff --git a/setuptools/discovery.py b/setuptools/discovery.py index 75c6e8357f..f053dba837 100644 --- a/setuptools/discovery.py +++ b/setuptools/discovery.py @@ -274,7 +274,6 @@ class FlatLayoutModuleFinder(ModuleFinder): "benchmarks", "exercise", "exercises", - "htmlcov", # Coverage.py # ---- Hidden files/Private modules ---- "[._]*", ) From 46db21ae30d2d0d3c216434cfa603aef24f3a97c Mon Sep 17 00:00:00 2001 From: Anderson Bravalheri Date: Mon, 27 Feb 2023 10:44:50 +0000 Subject: [PATCH 5/5] Adjust news fragment for more descriptiveness --- changelog.d/3594.change.rst | 1 - changelog.d/3836.misc.rst | 9 +++++++++ 2 files changed, 9 insertions(+), 1 deletion(-) delete mode 100644 changelog.d/3594.change.rst create mode 100644 changelog.d/3836.misc.rst diff --git a/changelog.d/3594.change.rst b/changelog.d/3594.change.rst deleted file mode 100644 index acb74c47b3..0000000000 --- a/changelog.d/3594.change.rst +++ /dev/null @@ -1 +0,0 @@ -Added ``htmlcov`` to FlatLayoutPackageFinder.DEFAULT_EXCLUDE -- by :user:`yukihiko-shinoda` diff --git a/changelog.d/3836.misc.rst b/changelog.d/3836.misc.rst new file mode 100644 index 0000000000..95232cca4e --- /dev/null +++ b/changelog.d/3836.misc.rst @@ -0,0 +1,9 @@ +Fixed interaction between ``setuptools``' package auto-discovery and +auto-generated ``htmlcov`` files. + +Previously, the ``htmlcov`` name was ignored when searching for single-file +modules, however the correct behaviour is to ignore it when searching for +packages (since it is supposed to be a directory, see `coverage config`_) +-- by :user:`yukihiko-shinoda`. + +.. _coverage config: https://coverage.readthedocs.io/en/stable/config.html#html-directory