Hi,

On Sun, Jun 09, 2024 at 03:20:13PM +0530, Nilesh Patra wrote:
Additionally replaced
setup.py tests with pytest to fix autopkgtests. I have attached the
debdiff containing these changes for your review.

Why is replacing setup.py test with pytest fixing the tests?

It won't fix any failed tests. In the latest update I have migrated the
tests to autopkgtest testsuite and created a patch. I have attached the
updated debdiff.

diff -Nru python-xmlrunner-3.2.0/debian/rules 
python-xmlrunner-3.2.0/debian/rules
--- python-xmlrunner-3.2.0/debian/rules 2023-01-21 20:37:57.000000000 +0000
+++ python-xmlrunner-3.2.0/debian/rules 2024-06-09 03:00:00.000000000 +0000
@@ -6,3 +6,7 @@

 %:
        dh $@ --with python3 --buildsystem=pybuild
+
+override_dh_auto_install:

You can use execute_after_dh_auto_install

+       dh_auto_install
+       rm -f debian/python3-xmlrunner/usr/LICENSE

There is no very strong reason for upstream to install the LICENSE in the
upstream package too. Instead of removing it in d/rules, can you patch the code
itself and make a PR upstream?

As you recommended, I have created a patch to fix the issue, and
forwarded the patch to the upstream.

diff -Nru python-xmlrunner-3.2.0/debian/tests/control 
python-xmlrunner-3.2.0/debian/tests/control
--- python-xmlrunner-3.2.0/debian/tests/control 2023-01-21 20:37:57.000000000 
+0000
+++ python-xmlrunner-3.2.0/debian/tests/control 2024-06-09 03:00:00.000000000 
+0000
@@ -1,2 +1,2 @@
Tests: upstreamtestsuite
-Depends: @, python3-setuptools, python3-django
+Depends: @, python3-pytest, python3-django
diff -Nru python-xmlrunner-3.2.0/debian/tests/upstreamtestsuite 
python-xmlrunner-3.2.0/debian/tests/upstreamtestsuite
--- python-xmlrunner-3.2.0/debian/tests/upstreamtestsuite       2023-01-21 
20:37:57.000000000 +0000
+++ python-xmlrunner-3.2.0/debian/tests/upstreamtestsuite       2024-06-09 
03:00:00.000000000 +0000
@@ -1,3 +1,4 @@
 #!/bin/sh
 set -e
-python3 setup.py test 2>&1
+# Disabled two tests -AttributeError need further investigation.

You disabled 2 tests that are passing at build time. That means there's
something wrong with the way autopkgtests are run or something else. Can you try
to fix the autopkgtests w/o skipping anything?

After migrating the tests to the autopkgtest testsuite, one of the tests
failed. I have created a patch for that failed test, and forwarded the
patch to the upstream.

+pytest -k "not test_basic_unittest_constructs and not test_unexpected_success"

I have forked the git in Salsa to fix these issues,
https://salsa.debian.org/yogu/python-xmlrunner

Once you review the changes, I will do a MR.

Thank you!
Yogeswaran.
diff -Nru python-xmlrunner-3.2.0/debian/changelog 
python-xmlrunner-3.2.0/debian/changelog
--- python-xmlrunner-3.2.0/debian/changelog     2023-01-21 20:39:47.000000000 
+0000
+++ python-xmlrunner-3.2.0/debian/changelog     2024-06-09 14:30:00.000000000 
+0000
@@ -1,3 +1,16 @@
+python-xmlrunner (3.2.0-3) UNRELEASED; urgency=medium
+
+  * Team upload.
+  * Patch to remove LICENSE from usr/LICENSE.(Closes: #1068500)
+  * Migrated tests to autopkgtest suite.
+    - d/control: Added autopkgtest-pkg-pybuild in Testsuite.
+    - Removed debian/tests directory.
+    - d/control: Updated Build-Depends.
+    - Patch to fix AssertionError in autopkgtest in Py 3.12.
+  * d/control: Bumped Standards-Version to 4.7.0.
+
+ -- Yogeswaran Umasankar <kd8...@gmail.com>  Sun, 09 Jun 2024 14:30:00 +0000
+
 python-xmlrunner (3.2.0-2) unstable; urgency=medium
 
   * Team upload
diff -Nru python-xmlrunner-3.2.0/debian/control 
python-xmlrunner-3.2.0/debian/control
--- python-xmlrunner-3.2.0/debian/control       2023-01-21 20:37:57.000000000 
+0000
+++ python-xmlrunner-3.2.0/debian/control       2024-06-09 14:30:00.000000000 
+0000
@@ -3,16 +3,19 @@
 Uploaders: Julien Puydt <jpu...@debian.org>
 Section: python
 Priority: optional
-Standards-Version: 4.6.1
+Standards-Version: 4.7.0
 Homepage: https://github.com/xmlrunner/unittest-xml-reporting
 Build-Depends: debhelper-compat (= 13),
-               dh-python,
-               python3,
+               dh-sequence-python3,
+               python3-all,
                python3-lxml,
-               python3-setuptools
+               python3-setuptools,
+               python3-django <!nocheck>,
+               python3-pytest <!nocheck>,
 Rules-Requires-Root: no
 Vcs-Git: https://salsa.debian.org/python-team/packages/python-xmlrunner.git
 Vcs-Browser: https://salsa.debian.org/python-team/packages/python-xmlrunner
+Testsuite: autopkgtest-pkg-pybuild
 
 Package: python3-xmlrunner
 Architecture: all
diff -Nru 
python-xmlrunner-3.2.0/debian/patches/0002-fix-LICENSE-in-unusual-dir.patch 
python-xmlrunner-3.2.0/debian/patches/0002-fix-LICENSE-in-unusual-dir.patch
--- python-xmlrunner-3.2.0/debian/patches/0002-fix-LICENSE-in-unusual-dir.patch 
1970-01-01 00:00:00.000000000 +0000
+++ python-xmlrunner-3.2.0/debian/patches/0002-fix-LICENSE-in-unusual-dir.patch 
2024-06-09 14:30:00.000000000 +0000
@@ -0,0 +1,17 @@
+Description: Fix for LICENSE file in unusual dir.
+ LICENSE file installing in usr/LICENSE against the convention and
+ standard practices. Removing LICENSE from data_files in setup.py.
+Author: Yogeswaran Umasankar <kd8...@gmail.com>
+Last-Update: 2024-06-09
+Forwarded: https://github.com/xmlrunner/unittest-xml-reporting/issues/284
+
+--- a/setup.py
++++ b/setup.py
+@@ -27,7 +27,6 @@ setup(
+     description = 'unittest-based test runner with Ant/JUnit like XML 
reporting.',
+     long_description = long_description,
+     long_description_content_type = 'text/markdown',
+-    data_files = [('', ['LICENSE'])],
+     install_requires = ['lxml'],
+     license = 'BSD',
+     platforms = ['Any'],
diff -Nru 
python-xmlrunner-3.2.0/debian/patches/0003-fix-autopkgtest-failure-py312.patch 
python-xmlrunner-3.2.0/debian/patches/0003-fix-autopkgtest-failure-py312.patch
--- 
python-xmlrunner-3.2.0/debian/patches/0003-fix-autopkgtest-failure-py312.patch  
    1970-01-01 00:00:00.000000000 +0000
+++ 
python-xmlrunner-3.2.0/debian/patches/0003-fix-autopkgtest-failure-py312.patch  
    2024-06-09 14:30:00.000000000 +0000
@@ -0,0 +1,27 @@
+Description: Fix AssertionError in autopkgtest in Python 3.12.
+ Garbage collection was introduced in test_xmlrunner_hold_traceback
+ to ensure that any lingering references are cleared before we check
+ the reference count.
+Author: Yogeswaran Umasankar <kd8...@gmail.com>
+Last-Update: 2024-06-09
+Forwarded: https://github.com/xmlrunner/unittest-xml-reporting/issues/285
+
+--- a/tests/testsuite.py
++++ b/tests/testsuite.py
+@@ -802,10 +802,16 @@ class XMLTestRunnerTestCase(unittest.Tes
+                      'skip - test not garbage collected. '
+                      'https://bugs.python.org/issue11798.')
+     def test_xmlrunner_hold_traceback(self):
++        import gc
+         suite = unittest.TestSuite()
+         suite.addTest(self.DummyRefCountTest('test_fail'))
+         countBeforeTest = sys.getrefcount(self.DummyRefCountTest.dummy)
+         runner = self._test_xmlrunner(suite)
++
++        gc.collect()
++        for obj in gc.get_referrers(self.DummyRefCountTest.dummy):
++            print("Referrer:", obj)
++
+         countAfterTest = sys.getrefcount(self.DummyRefCountTest.dummy)
+         self.assertEqual(countBeforeTest, countAfterTest)
+ 
diff -Nru python-xmlrunner-3.2.0/debian/patches/series 
python-xmlrunner-3.2.0/debian/patches/series
--- python-xmlrunner-3.2.0/debian/patches/series        2023-01-21 
20:39:22.000000000 +0000
+++ python-xmlrunner-3.2.0/debian/patches/series        2024-06-09 
14:30:00.000000000 +0000
@@ -1 +1,3 @@
+0003-fix-autopkgtest-failure-py312.patch
+0002-fix-LICENSE-in-unusual-dir.patch
 0001-Fix-test-result-description-fetching-on-Python-3.11.patch
diff -Nru python-xmlrunner-3.2.0/debian/rules 
python-xmlrunner-3.2.0/debian/rules
--- python-xmlrunner-3.2.0/debian/rules 2023-01-21 20:37:57.000000000 +0000
+++ python-xmlrunner-3.2.0/debian/rules 2024-06-09 14:30:00.000000000 +0000
@@ -5,4 +5,8 @@
 export SETUPTOOLS_SCM_PRETEND_VERSION=$(DEB_VERSION_UPSTREAM)
 
 %:
-       dh $@ --with python3 --buildsystem=pybuild
+       dh $@ --buildsystem=pybuild
+
+execute_after_dh_auto_install:
+       # Remove xml file generated during tests.
+       find $(CURDIR)/debian/python3-xmlrunner \( -name '*.xml' \) -type f 
-delete
diff -Nru python-xmlrunner-3.2.0/debian/tests/control 
python-xmlrunner-3.2.0/debian/tests/control
--- python-xmlrunner-3.2.0/debian/tests/control 2023-01-21 20:37:57.000000000 
+0000
+++ python-xmlrunner-3.2.0/debian/tests/control 1970-01-01 00:00:00.000000000 
+0000
@@ -1,2 +0,0 @@
-Tests: upstreamtestsuite
-Depends: @, python3-setuptools, python3-django
diff -Nru python-xmlrunner-3.2.0/debian/tests/upstreamtestsuite 
python-xmlrunner-3.2.0/debian/tests/upstreamtestsuite
--- python-xmlrunner-3.2.0/debian/tests/upstreamtestsuite       2023-01-21 
20:37:57.000000000 +0000
+++ python-xmlrunner-3.2.0/debian/tests/upstreamtestsuite       1970-01-01 
00:00:00.000000000 +0000
@@ -1,3 +0,0 @@
-#!/bin/sh
-set -e
-python3 setup.py test 2>&1

Attachment: signature.asc
Description: PGP signature

Reply via email to