[med-svn] [Git][med-team/python-iow][master] 4 commits: Added patch to fix tests

Israel Komolehin (@Komolehin) gitlab at salsa.debian.org
Sat Dec 23 17:36:54 GMT 2023



Israel Komolehin pushed to branch master at Debian Med / python-iow


Commits:
2e0a7534 by Komolehin Israel Timilehin at 2023-12-23T16:35:31+00:00
Added patch to fix tests

- - - - -
62a65de7 by Komolehin Israel Timilehin at 2023-12-23T16:36:25+00:00
Added Autopkgtest

- - - - -
609408d0 by Komolehin Israel Timilehin at 2023-12-23T16:56:39+00:00
Updated Patch

- - - - -
e9a7d87f by Komolehin Israel Timilehin at 2023-12-23T17:21:01+00:00
Document test observation when run with python3.12

- - - - -


5 changed files:

- + debian/patches/fix_test.diff
- debian/patches/series
- + debian/tests/README.md
- + debian/tests/control
- + debian/tests/run-unit-test


Changes:

=====================================
debian/patches/fix_test.diff
=====================================
@@ -0,0 +1,61 @@
+--- a/bp/tests/test_insert.py
++++ b/bp/tests/test_insert.py
+@@ -1,5 +1,5 @@
+ import unittest
+-import pkg_resources
++import os
+ from bp import parse_jplace, insert_fully_resolved
+ import skbio
+ import pandas as pd
+@@ -8,15 +8,14 @@
+ class InsertTests(unittest.TestCase):
+     package = 'bp.tests'
+     def setUp(self):
+-        self.jplacedata_multiple = \
+-            open(self.get_data_path('300/placement_mul.jplace')).read()
++        with open(self.get_data_path('300/placement_mul.jplace'), 'r') as file:
++            self.jplacedata_multiple = file.read()
+         self.final_multiple_fully_resolved = \
+             skbio.TreeNode.read(self.get_data_path('300/placement.full_resolve.newick'))
+ 
+     def get_data_path(self, filename):
+-        # adapted from qiime2.plugin.testing.TestPluginBase
+-        return pkg_resources.resource_filename(self.package,
+-                                               'data/%s' % filename)
++        current_directory = os.getcwd()
++        return current_directory + "/tests/data/" + filename
+ 
+     def test_insert_fully_resolved(self):
+         exp = self.final_multiple_fully_resolved
+--- a/bp/tests/test_io.py
++++ b/bp/tests/test_io.py
+@@ -4,7 +4,7 @@
+ import json
+ import pandas as pd
+ import pandas.testing as pdt
+-import pkg_resources
++import os
+ import skbio
+ import io
+ import numpy as np
+@@ -205,16 +205,15 @@
+     package = 'bp.tests'
+ 
+     def setUp(self):
+-        self.jplacedata = open(self.get_data_path('200/placement.jplace'))
+-        self.jplacedata = self.jplacedata.read()
++        with open(self.get_data_path('200/placement.jplace'), 'r') as file:
++            self.jplacedata = file.read()
+         no_edge_numbers = re.sub(r"{\d+}", '',
+                                  json.loads(self.jplacedata)['tree'])
+         self.tree = skbio.TreeNode.read([no_edge_numbers])
+ 
+     def get_data_path(self, filename):
+-        # adapted from qiime2.plugin.testing.TestPluginBase
+-        return pkg_resources.resource_filename(self.package,
+-                                               'data/%s' % filename)
++        current_directory = os.getcwd()
++        return current_directory + "/tests/data/" + filename
+ 
+     def test_place_jplace_square_braces(self):
+         self.jplacedata = json.loads(self.jplacedata)


=====================================
debian/patches/series
=====================================
@@ -1 +1,2 @@
 no-runtime-cython.patch
+fix_test.diff


=====================================
debian/tests/README.md
=====================================
@@ -0,0 +1,10 @@
+##  Run Tests
+
+`sh ./debian/tests/run-unit-test`
+
+##  Observation with Python3.12
+Test fails when run with python3.12. The error appears to be from pandas with the following exception.
+
+`File "/usr/lib/python3/dist-packages/pandas/_libs/__init__.py", line 13, in <module>`
+    `from pandas._libs.interval import Interval`
+`ModuleNotFoundError: No module named 'pandas._libs.interval'`


=====================================
debian/tests/control
=====================================
@@ -0,0 +1,3 @@
+Tests: run-unit-test
+Depends: python3-iow
+Restrictions: allow-stderr


=====================================
debian/tests/run-unit-test
=====================================
@@ -0,0 +1,27 @@
+#!/bin/bash
+
+CUR_DIR=`pwd`
+
+if [ "$AUTOPKGTEST_TMP" = "" ]; then
+	AUTOPKGTEST_TMP=`mktemp -d /tmp/${pkg}-test.XXXX`
+
+	trap "rm -rf $AUTOPKG_TMP" 0 INT QUIT ABRT PIPE TERM
+
+fi
+
+mkdir -p "$AUTOPKGTEST_TMP"/tests
+
+cp -a "${CUR_DIR}"/bp/* "$AUTOPKGTEST_TMP"/tests
+
+cd "$AUTOPKGTEST_TMP"/tests/
+
+
+for py in $(py3versions -s 2> /dev/null)
+
+do
+
+    # Run upstream tests
+    $py -m unittest
+   
+
+done



View it on GitLab: https://salsa.debian.org/med-team/python-iow/-/compare/a12fccb9097fb21084c336330f8647acef0cb45c...e9a7d87f19b9e6903a888ef0056acb5947737632

-- 
View it on GitLab: https://salsa.debian.org/med-team/python-iow/-/compare/a12fccb9097fb21084c336330f8647acef0cb45c...e9a7d87f19b9e6903a888ef0056acb5947737632
You're receiving this email because of your account on salsa.debian.org.


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://alioth-lists.debian.net/pipermail/debian-med-commit/attachments/20231223/623baa8f/attachment-0001.htm>


More information about the debian-med-commit mailing list