File: pytest.patch

package info (click to toggle)
python-sqt 0.8.0-6
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 728 kB
  • sloc: python: 5,964; sh: 38; makefile: 9
file content (182 lines) | stat: -rw-r--r-- 4,028 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
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