[med-svn] [Git][med-team/python-gffutils][master] 2 commits: Patch out usage of nose in favor of pytest. Closes: #1018501

Michael R. Crusoe (@crusoe) gitlab at salsa.debian.org
Wed Nov 16 16:38:13 GMT 2022



Michael R. Crusoe pushed to branch master at Debian Med / python-gffutils


Commits:
7a3e0dee by Michael R. Crusoe at 2022-11-16T17:32:24+01:00
Patch out usage of nose in favor of pytest. Closes: #1018501

- - - - -
9787f2b5 by Michael R. Crusoe at 2022-11-16T17:34:36+01:00
Mark the python3 patch as not needing forwarding. Update my email address in more places

- - - - -


9 changed files:

- debian/changelog
- debian/control
- debian/copyright
- + debian/patches/pytest
- debian/patches/python3
- debian/patches/series
- debian/rules
- debian/tests/control
- debian/tests/run-unit-test


Changes:

=====================================
debian/changelog
=====================================
@@ -1,3 +1,11 @@
+python-gffutils (0.11.1-2) UNRELEASED; urgency=medium
+
+  * Patch out usage of nose in favor of pytest. Closes: #1018501
+  * Mark the python3 patch as not needing forwarding. Update my email
+    address in more places
+
+ -- Michael R. Crusoe <crusoe at debian.org>  Wed, 16 Nov 2022 17:28:06 +0100
+
 python-gffutils (0.11.1-1) unstable; urgency=medium
 
   * Team upload.


=====================================
debian/control
=====================================
@@ -14,7 +14,7 @@ Build-Depends: debhelper-compat (= 13),
                python3-argcomplete,
                python3-argh,
                python3-pyfaidx,
-               python3-nose,
+               python3-pytest,
                python3-biopython,
                python3-pybedtools,
                help2man


=====================================
debian/copyright
=====================================
@@ -7,7 +7,7 @@ Copyright: 2013 Ryan Dale
 License: MIT
 
 Files: debian/*
-Copyright: © 2017 Michael R. Crusoe <michael.crusoe at gmail.com>
+Copyright: © 2017-2022 Michael R. Crusoe <crusoe at debian.org>
 License: MIT
 
 License: MIT


=====================================
debian/patches/pytest
=====================================
@@ -0,0 +1,225 @@
+From: Michael R. Crusoe <crusoe at debian.org>
+Subject: Use pytest instead of the Py3.11 incompatible nose
+Forwarded: https://github.com/daler/gffutils/pull/200
+
+"Nose" is no longer developed for many years now.
+--- python-gffutils.orig/gffutils/test/parser_test.py
++++ python-gffutils/gffutils/test/parser_test.py
+@@ -1,10 +1,11 @@
+ import tempfile
+-from nose.tools import assert_raises
+ from gffutils import parser, create, feature, iterators, constants, helpers, exceptions
+ from gffutils import example_filename, create_db
+ from . import attr_test_cases
+ from textwrap import dedent
+ 
++import pytest
++
+ TEST_FILENAMES = [
+     example_filename(i)
+     for i in [
+@@ -88,10 +89,10 @@
+     reconstructing attributes with incomplete information returns empty string
+     """
+     assert parser._reconstruct(None, constants.dialect) == ""
+-    assert_raises(
+-        exceptions.AttributeStringError, parser._reconstruct, dict(ID="asdf"), None
+-    )
+-    assert_raises(exceptions.AttributeStringError, parser._reconstruct, None, None)
++    with pytest.raises(exceptions.AttributeStringError):
++        parser._reconstruct(dict(ID="asdf"), None)
++    with pytest.raises(exceptions.AttributeStringError):
++        parser._reconstruct(None, None)
+ 
+ 
+ def test_empty_split_keyvals():
+--- python-gffutils.orig/gffutils/test/test_issues.py
++++ python-gffutils/gffutils/test/test_issues.py
+@@ -10,8 +10,8 @@
+ import gffutils
+ from gffutils import feature
+ from gffutils import merge_criteria as mc
+-from nose.tools import assert_raises
+ 
++import pytest
+ 
+ def test_issue_79():
+     gtf = gffutils.example_filename("keep-order-test.gtf")
+@@ -324,9 +324,12 @@
+     #   TypeError: merge() got an unexpected keyword argument 'ignore_strand'
+     #
+     # Now changing to ValueError and suggesting a fix. 
+-    assert_raises(ValueError, db.children_bp, gene, child_featuretype='exon', merge=True, ignore_strand=True)
+-    assert_raises(ValueError, db.children_bp, gene, ignore_strand=True, nonexistent=True)
+-    assert_raises(TypeError, db.children_bp, gene, nonexistent=True)
++    with pytest.raises(ValueError):
++        db.children_bp(gene, child_featuretype='exon', merge=True, ignore_strand=True)
++    with pytest.raises(ValueError):
++        db.children_bp(gene, ignore_strand=True, nonexistent=True)
++    with pytest.raises(TypeError):
++        db.children_bp(gene, nonexistent=True)
+ 
+     # The way to do it now is the following (we can omit the mc.feature_type
+     # since we're preselecting for exons anyway):
+@@ -393,7 +396,8 @@
+     introns = db.create_introns()
+ 
+     # This now warns that the provided ID key has multiple values.
+-    assert_raises(ValueError, db.update, introns)
++    with pytest.raises(ValueError):
++        db.update(introns)
+ 
+     # The fix is to provide a custom intron ID converter.
+     def intron_id(f):
+--- python-gffutils.orig/gffutils/test/test.py
++++ python-gffutils/gffutils/test/test.py
+@@ -1,7 +1,7 @@
+ import warnings
+ from textwrap import dedent
+ from . import expected
+-from gffutils import example_filename, create, parser, feature
++from gffutils import example_filename, create, feature
+ import gffutils
+ import gffutils.helpers as helpers
+ import gffutils.gffwriter as gffwriter
+@@ -13,8 +13,6 @@
+ import shutil
+ import threading
+ import tempfile
+-from textwrap import dedent
+-from nose.tools import assert_raises
+ from six.moves import SimpleHTTPServer
+ 
+ if sys.version_info.major == 3:
+@@ -24,11 +22,10 @@
+ 
+ import multiprocessing
+ import json
+-import tempfile
+-import shutil
+-import glob
+ import difflib
+ 
++import pytest
++
+ testdbfn_gtf = ":memory:"
+ testdbfn_gff = ":memory:"
+ 
+@@ -631,17 +628,16 @@
+     x = db["fake"]
+     y = db["fake_1"]
+ 
+-    assert_raises(
+-        ValueError,
+-        gffutils.create_db,
+-        gtfdata,
+-        ":memory:",
+-        from_string=True,
+-        merge_strategy="merge",
+-        id_spec="gene_id",
+-        force_merge_fields=["start"],
+-        keep_order=True,
+-    )
++    with pytest.raises(ValueError):
++        gffutils.create_db(
++            gtfdata,
++            ":memory:",
++            from_string=True,
++            merge_strategy="merge",
++            id_spec="gene_id",
++            force_merge_fields=["start"],
++            keep_order=True,
++            )
+ 
+     # test that warnings are raised because of strand and frame
+     with warnings.catch_warnings(record=True) as w:
+@@ -750,7 +746,8 @@
+     fn = tempfile.NamedTemporaryFile(delete=False).name
+     a = open(fn, "w")
+     a.close()
+-    assert_raises(gffutils.exceptions.EmptyInputError, gffutils.create_db, fn, fn + ".db")
++    with pytest.raises(gffutils.exceptions.EmptyInputError):
++        gffutils.create_db(fn, fn + ".db")
+ 
+ 
+ def test_false_function():
+@@ -1107,23 +1104,21 @@
+     return
+ 
+     # TODO: when infer_gene_extent actually gets deprecated, test here.
+-    assert_raises(
+-        ValueError,
+-        gffutils.create_db,
+-        gffutils.example_filename("FBgn0031208.gtf"),
+-        ":memory:",
+-        infer_gene_extent=False,
+-    )
++    with pytest.raises(ValueError):
++        gffutils.create_db(
++            gffutils.example_filename("FBgn0031208.gtf"),
++            ":memory:",
++            infer_gene_extent=False,
++            )
+ 
+ 
+ def test_nonsense_kwarg():
+-    assert_raises(
+-        TypeError,
+-        gffutils.create_db,
+-        gffutils.example_filename("FBgn0031208.gtf"),
+-        ":memory:",
+-        asdf=True,
+-    )
++    with pytest.raises(TypeError):
++        gffutils.create_db(
++            gffutils.example_filename("FBgn0031208.gtf"),
++            ":memory:",
++            asdf=True,
++            )
+ 
+ 
+ def test_infer_gene_extent():
+--- /dev/null
++++ python-gffutils/gffutils/test/conftest.py
+@@ -0,0 +1 @@
++collect_ignore=["data"]
+--- python-gffutils.orig/gffutils/test/performance_evaluation.py
++++ python-gffutils/gffutils/test/performance_evaluation.py
+@@ -1,8 +1,8 @@
+ """
+-Performance testing. Run them with https://github.com/mahmoudimus/nose-timer:
++Performance testing. Run them with https://pypi.org/project/pytest-timer/:
+ 
+ ```
+-nosetests --nocapture -a slow --with-timer
++pytest --capture=no -m slow --with-timer
+ ```
+ 
+ WARNING: These tests can take about 1.5 hours to run!
+@@ -15,7 +15,7 @@
+ import unittest
+ import os
+ 
+-from nose.plugins import attrib
++import pytest
+ 
+ import gffutils
+ 
+@@ -187,7 +187,7 @@
+         )
+ 
+ 
+- at attrib.attr("slow")
++ at pytest.mark.slow
+ class TestPerformanceOnSacCer(PerformanceTestFeatureDB, unittest.TestCase):
+     """
+     Test frequent scenarios on medium size genome of yeast.
+@@ -205,7 +205,7 @@
+     )
+ 
+ 
+- at attrib.attr("slow")
++ at pytest.mark.slow
+ class TestPerformanceOnMouse(PerformanceTestFeatureDB, unittest.TestCase):
+     """
+     Test frequent scenarios on large genome of mouse.


=====================================
debian/patches/python3
=====================================
@@ -1,5 +1,6 @@
-Author: Michael R. Crusoe <michael.crusoe at gmail.com>
+Author: Michael R. Crusoe <crusoe at debian.org>
 Description: set #! early so help2man works easily
+Forwarded: not-needed
 --- python-gffutils.orig/gffutils/scripts/gffutils-cli
 +++ python-gffutils/gffutils/scripts/gffutils-cli
 @@ -1,4 +1,4 @@


=====================================
debian/patches/series
=====================================
@@ -1,2 +1,3 @@
 newer_bedtools
 python3
+pytest


=====================================
debian/rules
=====================================
@@ -6,7 +6,8 @@ DH_VERBOSE := 1
 include /usr/share/dpkg/pkg-info.mk
 
 export PYBUILD_NAME=gffutils
-export PYBUILD_TEST_ARGS=--with-doctest -a '!slow'
+export PYBUILD_TEST_ARGS=--doctest-modules -m 'not slow'
+export PYBUILD_TEST_PYTEST=true
 export PYBUILD_AFTER_TEST=find . -name tmp.db -delete
 
 %:


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


=====================================
debian/tests/run-unit-test
=====================================
@@ -8,4 +8,4 @@ fi
 cd "$AUTOPKGTEST_TMP"
 export HOME="${AUTOPKGTEST_TMP}"
 cp -r /usr/lib/python3/dist-packages/gffutils/test ./
-nosetests3 --with-doctest -a '!slow' test
+pytest --doctest-modules -m 'not slow' test



View it on GitLab: https://salsa.debian.org/med-team/python-gffutils/-/compare/67b8df0b39fb6ba281acf508281d6b6de418c3b3...9787f2b5c3990ece14499acfa4e794513c17a0f2

-- 
View it on GitLab: https://salsa.debian.org/med-team/python-gffutils/-/compare/67b8df0b39fb6ba281acf508281d6b6de418c3b3...9787f2b5c3990ece14499acfa4e794513c17a0f2
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/20221116/36334cf6/attachment-0001.htm>


More information about the debian-med-commit mailing list