Package: autodep8
Version: 0.18
Severity: normal
Tags: patch
User: [email protected]
Usertags: origin-ubuntu eoan ubuntu-patch
Dear maintainers,
In Ubuntu, I discovered when dropping python2 support from python-os-api-ref
that autodep8 has some bugginess in how it decides what versions of python
to run tests for. (The python-os-api-ref Debian maintainer also found this,
but handled it by adding manual tests; we have not synced the Debian
solution because it's a new upstream version of the package and we're in
feature freeze.)
Specifically, python-os-api-ref has the following setup:
Source: python-os-api-ref
Binary: python-os-api-ref-common
Binary: python3-os-api-ref
The correct module to test imports of is os_api_ref, of course, not
os_api_ref_common; and it should be tested only for python3.
The attached patch fixes this, and also adds a test case for this situation.
--
Steve Langasek Give me a lever long enough and a Free OS
Debian Developer to set it on, and I can move the world.
Ubuntu Developer https://www.debian.org/
[email protected] [email protected]
diff -Nru autodep8-0.18/support/python/generate
autodep8-0.18ubuntu2/support/python/generate
--- autodep8-0.18/support/python/generate 2019-01-30 11:17:41.000000000
-0800
+++ autodep8-0.18ubuntu2/support/python/generate 2019-09-10
15:16:56.000000000 -0700
@@ -13,10 +13,12 @@
py3_package=python3-$module
fi
-source_package=$(grep-dctrl -n -s Source -F Source -r '^pypy-.*$'
debian/control || true)
-if [ -n "$source_package" ] ; then
- module=${source_package#pypy-}
- pypy_package=pypy-$module
+if [ -z "$module" ]; then
+ source_package=$(grep-dctrl -n -s Source -F Source -r '^pypy-.*$'
debian/control || true)
+ if [ -n "$source_package" ] ; then
+ module=${source_package#pypy-}
+ pypy_package=pypy-$module
+ fi
fi
# Try binary package(s)
@@ -39,7 +41,7 @@
fi
# Try binary package(s)
-if [ -z "$source_package" ] ; then
+if [ -z "$pypy_package" ]; then
binary_packages=$(grep-dctrl -n -s Package -F Package -r '^pypy-.*$'
debian/control || true)
if [ -n "$binary_packages" ] ; then
for binary_package in $binary_packages ; do
diff -Nru autodep8-0.18/test/python_test.sh
autodep8-0.18ubuntu2/test/python_test.sh
--- autodep8-0.18/test/python_test.sh 2019-01-30 11:17:41.000000000 -0800
+++ autodep8-0.18ubuntu2/test/python_test.sh 2019-09-10 15:16:41.000000000
-0700
@@ -85,6 +85,14 @@
assertTrue 'have pypy test' 'grep --quiet "pypy -c" stdout'
}
+test_python_ignore_py2_non_module() {
+ has 'debian/control' 'Source: python-foo\n\nPackage:
python-foo-common\n\nPackage: python3-foo'
+ check_run autodep8
+ assertTrue 'get upstream name' 'grep --quiet "import foo;" stdout'
+ assertFalse 'dont have py2 test' 'grep --quiet "pyversions" stdout'
+ assertTrue 'have py3 test' 'grep --quiet "py3versions" stdout'
+}
+
test_Testsuite_autopkgtest_pkg_python() {
has debian/control "Testsuite: autopkgtest-pkg-python"
check_run autodep8