Description: migrate from nose to pytest
Author: Étienne Mollier <emollier@debian.org>
Bug-Debian: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=1018582
Forwarded: no
Last-Update: 2022-12-03
---
This patch header follows DEP-3: http://dep.debian.net/deps/dep3/
--- python-sqt.orig/setup.py
+++ python-sqt/setup.py
@@ -130,7 +130,7 @@
 		'xopen',
 	],
 	ext_modules = extensions,
-	test_suite = 'nose.collector',
+	test_suite = 'pytest',
 	classifiers = [
 		"Development Status :: 4 - Beta",
 		#Development Status :: 5 - Production/Stable
--- python-sqt.orig/tests/testalign.py
+++ python-sqt/tests/testalign.py
@@ -1,7 +1,7 @@
 from sqt.align import (edit_distance as ed, GlobalAlignment as GA, consensus,
 	hamming_distance)
 from random import choice, seed, randint
-from nose.tools import raises
+import pytest
 
 STRING_PAIRS = [
 	('', ''),
@@ -125,6 +125,6 @@
 	assert hamming_distance('ABC', 'DEF') == 3
 
 
-@raises(IndexError)
 def test_hamming_distance_incorrect_length():
-	hamming_distance('A', 'BC')
+	with pytest.raises(IndexError):
+		hamming_distance('A', 'BC')
--- python-sqt.orig/tests/testcigar.py
+++ python-sqt/tests/testcigar.py
@@ -1,5 +1,4 @@
-from nose.tools import raises
-
+import pytest
 from sqt.cigar import parse, Cigar, reference_to_query_length
 
 def test_parse():
@@ -20,19 +19,19 @@
 	assert Cigar('3M2S')._as_string(join_by=' ') == '3M 2S'
 
 
-@raises(ValueError)
 def test_parse_error_1():
-	Cigar("4S5")
+	with pytest.raises(ValueError):
+		Cigar("4S5")
 
 
-@raises(ValueError)
 def test_parse_error_2():
-	Cigar("4S-5M")
+	with pytest.raises(ValueError):
+		Cigar("4S-5M")
 
 
-@raises(ValueError)
 def test_parse_error_3():
-	Cigar("M")
+	with pytest.raises(ValueError):
+		Cigar("M")
 
 
 def test_elements():
--- python-sqt.orig/tests/testfasta.py
+++ python-sqt/tests/testfasta.py
@@ -2,7 +2,7 @@
 Tests for the sqt.io.fasta module
 """
 from io import StringIO
-from nose.tools import raises
+import pytest
 
 from sqt.io.fasta import (FastaReader, FastaWriter, Sequence, FastqWriter,
 	SequenceReader, fastq_header)
@@ -68,15 +68,15 @@
 	os.remove(tmp)
 
 
-@raises(ValueError)
 def test_fastawriter_contextmanager():
-	tmp = dpath("tmp.fasta")
-	fr = FastaWriter(tmp)
-	os.remove(tmp)
-	with fr as frw:
-		pass
-	with fr as frw:
-		pass
+	with pytest.raises(ValueError):
+		tmp = dpath("tmp.fasta")
+		fr = FastaWriter(tmp)
+		os.remove(tmp)
+		with fr as frw:
+			pass
+		with fr as frw:
+			pass
 
 
 def test_fastareader():
@@ -140,13 +140,13 @@
 		assert sr.format == 'fastq'
 
 
-@raises(ValueError)
 def test_fastareader_contextmanager():
-	fr = FastaReader(dpath("seq.fa"))
-	with fr as frw:
-		pass
-	with fr as frw:
-		pass
+	with pytest.raises(ValueError):
+		fr = FastaReader(dpath("seq.fa"))
+		with fr as frw:
+			pass
+		with fr as frw:
+			pass
 
 
 def test_fastq_header():
--- python-sqt.orig/tests/testindexedfasta.py
+++ python-sqt/tests/testindexedfasta.py
@@ -1,4 +1,4 @@
-from nose.tools import raises
+import pytest
 from sqt.io.fasta import IndexedFasta, NonIndexedFasta, FastaReader
 import os.path
 
@@ -6,13 +6,13 @@
 	return os.path.join(os.path.dirname(__file__), path)
 
 
-@raises(ValueError)
 def test_indexedfasta_contextmanager():
-	indfasta = IndexedFasta(dpath("seq.fa"))
-	with indfasta as ifw:
-		pass
-	with indfasta as ifw:
-		pass
+	with pytest.raises(ValueError):
+		indfasta = IndexedFasta(dpath("seq.fa"))
+		with indfasta as ifw:
+			pass
+		with indfasta as ifw:
+			pass
 
 
 def test_indexedfasta():
--- python-sqt.orig/tests/testintervaltree.py
+++ python-sqt/tests/testintervaltree.py
@@ -1,7 +1,6 @@
 """
 Tests for the sqt.intervaltree module
 """
-from nose.tools import raises
 import sys
 from sqt.intervaltree import IntervalTree
 
--- python-sqt.orig/tox.ini
+++ python-sqt/tox.ini
@@ -5,6 +5,6 @@
 deps =
     pip>=8.0.0
     wheel
-    nose
+    pytest
 
-commands = nosetests -P tests/
+commands = pytest-3 -v tests/*.py
--- /dev/null
+++ python-sqt/pytest.ini
@@ -0,0 +1,2 @@
+[pytest]
+python_files = test*.py
