Skip to content

Commit 1db47a5

Browse files
committed
Start removing "nose" from functional tests
1 parent 53b0259 commit 1db47a5

13 files changed

Lines changed: 115 additions & 133 deletions

File tree

__pkginfo__.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,9 @@
4646
# 3.4 | pip | 19.1.1 |
4747

4848
# Things that change more often go here.
49-
copyright = """Copyright (C) 2013, 2015-2021, 2023 Rocky Bernstein <rocky@gnu.org>."""
49+
copyright = (
50+
"""Copyright (C) 2013, 2015-2021, 2023-2024 Rocky Bernstein <rocky@gnu.org>."""
51+
)
5052
classifiers = [
5153
"Development Status :: 5 - Production/Stable",
5254
"Environment :: Console",
@@ -65,6 +67,8 @@
6567
"Programming Language :: Python :: 3.8",
6668
"Programming Language :: Python :: 3.9",
6769
"Programming Language :: Python :: 3.10",
70+
"Programming Language :: Python :: 3.11",
71+
"Programming Language :: Python :: 3.12",
6872
"Programming Language :: Python :: Implementation :: PyPy",
6973
]
7074

setup.cfg

Lines changed: 0 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,3 @@
1-
[nosetests]
2-
# If "where is a directory, then that's the working directory.
3-
tests=./test/unit
4-
5-
# Our tests are also executable since they are allowed to be run
6-
# individually. By default nose excludes these.
7-
exe=on
8-
9-
# Show individual tests run
10-
verbosity = 2
11-
12-
# debug=nose.loader
13-
# pdb=on
14-
detailed-errors = on
15-
161
[upload]
172
show_response = 1
183

setup.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@
44
from setuptools import find_packages, setup
55

66
SYS_VERSION = sys.version_info[0:2]
7-
if not ((3, 1) <= SYS_VERSION <= (3, 12)):
8-
mess = "Python Versions 3.1 to 3.11 are supported only in this package."
7+
if not ((3, 1) <= SYS_VERSION < (3, 13)):
8+
mess = "Python Versions 3.1 to 3.12 are supported only in this package."
99
if (2, 4) <= SYS_VERSION <= (2, 7):
1010
mess += "\nFor your Python, version %s, See trepan2" % sys.version[0:3]
1111
elif SYS_VERSION < (2, 4):

test/functional/Makefile

Lines changed: 1 addition & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -4,25 +4,12 @@ PHONY=all check check-short test-functional test-functional-short
44

55
#: Same as test-functional
66
all, test, check:
7-
$(MAKE) test-functional
7+
$(PYTHON) -m pytest .
88

99
#: Same as test-functional-short
1010
check-short:
1111
$(MAKE) test-functional-short
1212

13-
#: Run functional tests
14-
test-functional:
15-
$(PYTHON) ./setup.py nosetests
16-
17-
#: Run functional tests reduced verbosity
18-
test-functional-short:
19-
$(PYTHON) ./setup.py nosetests | \
20-
$(PYTHON) ../../make-check-filter.py
21-
22-
#: Remove derived files
23-
clean:
24-
-rm -fr *.egg-info || true
25-
2613
# Whatever else it is you want to do, it should be forwarded to the
2714
# to top-level directories
2815
%:

test/functional/__init__.py

Whitespace-only changes.

test/functional/example/jump.py

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
# This code fragment what is embedded inside ../test_jump.py
2+
# We have it here to make it easy to test things when things go wrong.
3+
4+
5+
# commands are:
6+
# step
7+
# jump 13 # 6 + 7
8+
# continue
9+
############################## # 3...
10+
x = 4
11+
x = 5
12+
x = 6
13+
z = 7 # NOQA

test/functional/fn_helper.py

Lines changed: 26 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1,44 +1,45 @@
1+
"""
2+
Helper module for functional testing.
3+
"""
4+
import re
15
import sys
26

3-
import trepan.inout.stringarray
4-
from trepan import debugger as Mdebugger
5-
from trepan.inout import stringarray as Mstringarray
7+
from trepan.debugger import Trepan
8+
from trepan.inout.stringarray import StringArrayInput, StringArrayOutput
69

710

811
def strarray_setup(debugger_cmds):
9-
''' Common setup to create a debugger with stringio attached '''
10-
stringin = Mstringarray.StringArrayInput(debugger_cmds)
11-
stringout = Mstringarray.StringArrayOutput()
12-
d_opts = {'input' : stringin,
13-
'output': stringout}
14-
d = Mdebugger.Trepan(d_opts)
15-
d.settings['basename'] = True
16-
d.settings['different'] = False
17-
d.settings['autoeval'] = False
18-
d.settings['highlight'] = 'plain'
12+
"""Common setup to create a debugger with stringio attached"""
13+
stringin = StringArrayInput(debugger_cmds)
14+
stringout = StringArrayOutput()
15+
d_opts = {"input": stringin, "output": stringout}
16+
d = Trepan(d_opts)
17+
d.settings["basename"] = True
18+
d.settings["different"] = False
19+
d.settings["autoeval"] = False
20+
d.settings["highlight"] = "plain"
1921
return d
2022

21-
import re
22-
trepan_prompt = re.compile(r'^.. \d+.*\n\(trepan3k(:.+)?\) ')
23-
trepan_loc = re.compile(r'^\(.+:\d+\): ')
23+
24+
trepan_prompt = re.compile(r"^.. \d+.*\n\(trepan3k(:.+)?\) ")
25+
trepan_loc = re.compile(r"^\(.+:\d+\): ")
2426

2527

2628
def filter_line_cmd(a):
27-
'''Return output with source lines prompt and command removed'''
29+
"""Return output with source lines prompt and command removed"""
2830
# Remove extra leading spaces.
2931
# For example:
3032
# -- 42 y = 5
3133
# becomes
3234
# -- y = 5
33-
a1 = [re.sub(r'^(..) \d+\s+', r'\1 ', s) for s in a
34-
if re.match(r'^.. \d+\s+', s)]
35+
a1 = [re.sub(r"^(..) \d+\s+", r"\1 ", s) for s in a if re.match(r"^.. \d+\s+", s)]
3536
# Remove debugger prompts
3637
# For example:
3738
# (trepan3k)
38-
a2 = [re.sub(r'\n\(trepan3k\) .*', '', s) for s in a1]
39+
a2 = [re.sub(r"\n\(trepan3k\) .*", "", s) for s in a1]
3940

4041
# Remove locations (test-next.py:41): test_next_between_fn
41-
a3 = [re.sub(r'\n\(.*:\d+\):.*', '', s) for s in a2]
42+
a3 = [re.sub(r"\n\(.*:\d+\):.*", "", s) for s in a2]
4243
return a3
4344

4445

@@ -48,7 +49,7 @@ def get_lineno():
4849
return caller.f_lineno
4950

5051

51-
def compare_output(obj, right, d, debugger_cmds):
52+
def compare_output(obj, right, d):
5253
got = filter_line_cmd(d.intf[-1].output.output)
5354
if got != right:
5455
for i in range(len(got)):
@@ -58,7 +59,7 @@ def compare_output(obj, right, d, debugger_cmds):
5859
print(" ", got[i])
5960
pass
6061
pass
61-
print('-' * 10)
62+
print("-" * 10)
6263
for i in range(len(right)):
6364
if i < len(got) and got[i] != right[i]:
6465
print("! ", right[i])
@@ -70,7 +71,8 @@ def compare_output(obj, right, d, debugger_cmds):
7071
obj.assertEqual(right, got)
7172
return
7273

74+
7375
# Demo it
74-
if __name__=='__main__':
76+
if __name__ == "__main__":
7577
print(get_lineno())
7678
pass

test/functional/setup.cfg

Lines changed: 0 additions & 11 deletions
This file was deleted.

test/functional/setup.py

Lines changed: 0 additions & 17 deletions
This file was deleted.

test/functional/test-jump.py

Lines changed: 0 additions & 34 deletions
This file was deleted.

0 commit comments

Comments
 (0)