[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

[lintian] 04/04: data/files/fnames: Warn about packages that ship (eg.) test_foo.py files in the global Python module namespace.



This is an automated email from the git hooks/post-receive script.

lamby pushed a commit to branch master
in repository lintian.

commit c3d40218dbebe95b23660a3007685b7ac6acc678
Author: Chris Lamb <lamby@debian.org>
Date:   Tue Jan 9 22:47:08 2018 +0530

    data/files/fnames: Warn about packages that ship (eg.) test_foo.py files in the global Python module namespace.
---
 checks/files.desc                         | 11 +++++++++++
 data/files/fnames                         |  1 +
 debian/changelog                          |  4 ++++
 t/tests/files-general/debian/debian/dirs  |  1 +
 t/tests/files-general/debian/debian/rules |  1 +
 t/tests/files-general/desc                |  1 +
 t/tests/files-general/tags                |  1 +
 7 files changed, 20 insertions(+)

diff --git a/checks/files.desc b/checks/files.desc
index c4a16f5..a7dd313 100644
--- a/checks/files.desc
+++ b/checks/files.desc
@@ -1889,3 +1889,14 @@ Info: This package appears to contain the output of running a Python
    override_dh_auto_clean:
            dh_auto_clean
            rm -rf $(CURDIR)/debian/hypothesis
+
+Tag: package-contains-python-tests-in-global-namespace
+Severity: normal
+Certainty: certain
+Info: This package appears to contain Python test files such as
+ <tt>test_foo.py</tt> in the global module namespace.
+ .
+ Whilst the tests may be useful in the binary package, it is probably a
+ mistake to pollute the "top-level" namespace in this way.
+ .
+ Please install them in an subdirectory instead.
diff --git a/data/files/fnames b/data/files/fnames
index b63b94d..2cd0179 100644
--- a/data/files/fnames
+++ b/data/files/fnames
@@ -5,3 +5,4 @@ package-contains-compiled-glib-schema   ~~ ^usr/share/glib-[^\/]+/schemas/gschem
 package-contains-python-coverage-file   ~~ (^|/)\.coverage$
 package-contains-python-doctree-file    ~~ \.doctree$
 package-contains-python-hypothesis-example    ~~ /\.hypothesis/examples/[^\)]+/.+
+package-contains-python-tests-in-global-namespace    ~~ ^usr/lib/python[^\/]+/(dist|site)-packages/test_.+\.py$
diff --git a/debian/changelog b/debian/changelog
index b21e81a..1f5bc8a 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -10,6 +10,10 @@ lintian (2.5.69) UNRELEASED; urgency=medium
     + [CL] Include the offending package name when warning about
       new-package-should-not-package-python2-module.
 
+  * data/files/fnames:
+    + [CL] Warn about packages that ship (eg.) test_foo.py files in the
+      global Python module namespace.
+
  -- Chris Lamb <lamby@debian.org>  Tue, 09 Jan 2018 20:55:21 +0530
 
 lintian (2.5.68) unstable; urgency=medium
diff --git a/t/tests/files-general/debian/debian/dirs b/t/tests/files-general/debian/debian/dirs
index 4108011..5c5efb7 100644
--- a/t/tests/files-general/debian/debian/dirs
+++ b/t/tests/files-general/debian/debian/dirs
@@ -1,6 +1,7 @@
 etc
 usr/bin
 usr/doc
+usr/lib/python3/dist-packages
 usr/share/foo
 usr/share/fonts/X11/misc
 usr/share/glib-2.0/schemas
diff --git a/t/tests/files-general/debian/debian/rules b/t/tests/files-general/debian/debian/rules
index 8334fe2..78bfd54 100755
--- a/t/tests/files-general/debian/debian/rules
+++ b/t/tests/files-general/debian/debian/rules
@@ -31,6 +31,7 @@ override_dh_install:
 	touch $(tmp)/usr/share/foo/foo.doctree
 	touch $(tmp)/usr/share/foo/gschemas.compiled
 	touch $(tmp)/usr/share/glib-2.0/schemas/gschemas.compiled
+	touch $(tmp)/usr/lib/python3/dist-packages/test_foo.py
 	# If the following line gets messed up, it can be
 	# restored with something like:
 	#   sed -i 's/@FILE@/bokm\xe5l/'
diff --git a/t/tests/files-general/desc b/t/tests/files-general/desc
index f514d6d..b692d30 100644
--- a/t/tests/files-general/desc
+++ b/t/tests/files-general/desc
@@ -30,6 +30,7 @@ Test-For:
  package-contains-mimeinfo.cache-file
  package-modifies-ld.so-search-path
  package-contains-python-doctree-file
+ package-contains-python-tests-in-global-namespace
  raster-image-in-scalable-directory
  star-file
  stray-directory-in-manpage-directory
diff --git a/t/tests/files-general/tags b/t/tests/files-general/tags
index 72f97b8..b3907a9 100644
--- a/t/tests/files-general/tags
+++ b/t/tests/files-general/tags
@@ -36,5 +36,6 @@ W: files-general: icon-size-and-directory-name-mismatch usr/share/icons/hicolor/
 W: files-general: nfs-temporary-file-in-package usr/share/foo/.nfs-fake-tmpfile
 W: files-general: obsolete-comments-style-in-php-ini etc/php/7.0/mods-available/php-foo.ini
 W: files-general: package-contains-python-doctree-file usr/share/foo/foo.doctree
+W: files-general: package-contains-python-tests-in-global-namespace usr/lib/python3/dist-packages/test_foo.py
 W: files-general: raster-image-in-scalable-directory usr/share/icons/hicolor/scalable/apps/lintian-16x16.png
 W: files-general: windows-devel-file-in-package usr/lib/foo/foo.vcproj

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/lintian/lintian.git


Reply to: