Skip to content

Commit 154486b

Browse files
committed
-
1 parent 72b8452 commit 154486b

File tree

40 files changed

+59
-130
lines changed

40 files changed

+59
-130
lines changed

README.markdown

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ The Python Toolbox supports Python versions 3.6+.
5252
Tests can be run by running the `_test_python_toolbox.py` script that's
5353
installed automatically with the Python Toolbox.
5454

55-
When `python_toolbox` isn't installed, you may run `nosetests` at the repo root
55+
When `python_toolbox` isn't installed, you may run `pytest` at the repo root
5656
to run the tests.
5757

5858

python_toolbox/cute_testing.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33

44
'''This module defines tools for testing.'''
55

6-
import nose
76
import sys
87
import inspect
98
import unittest

setup.cfg

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

setup.py

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ def get_packages():
9595
Test can be run by running the ``_test_python_toolbox.py`` script that's
9696
installed automatically with the Python Toolbox.
9797
98-
When ``python_toolbox`` isn't installed, you may run ``nosetests`` at the repo
98+
When ``python_toolbox`` isn't installed, you may run ``pytest`` at the repo
9999
root to run the tests.
100100
101101
@@ -127,10 +127,7 @@ def get_packages():
127127
setuptools.setup(
128128
name='python_toolbox',
129129
version=version,
130-
test_suite='nose.collector',
131130
install_requires=install_requires,
132-
tests_require=['nose>=1.0.0',
133-
'docutils>=0.8'],
134131
description='A collection of Python tools for various tasks',
135132
author='Ram Rachum',
136133
author_email='ram@rachum.com',
@@ -139,13 +136,19 @@ def get_packages():
139136
scripts=['test_python_toolbox/scripts/_test_python_toolbox.py'],
140137
entry_points={
141138
'console_scripts': [
142-
'_test_python_toolbox = test_python_toolbox:invoke_nose',
139+
'_test_python_toolbox = test_python_toolbox:invoke_tests',
143140
],
144141
},
145142
long_description=my_long_description,
146143
license='MIT',
147144
classifiers=my_classifiers,
148145
include_package_data=True,
149146
zip_safe=False,
147+
extras_require={
148+
'tests': {
149+
'pytest',
150+
'docutils>=0.8',
151+
},
152+
},
150153
)
151154

test_python_toolbox/__init__.py

Lines changed: 6 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,8 @@
66
import sys
77
import pathlib
88

9+
import pytest
910

10-
import nose
11-
12-
13-
if nose.__versioninfo__ < (1, 0, 0):
14-
raise Exception('Nose version 1.0.0 or higher is required to run tests.')
1511

1612

1713
def __bootstrap():
@@ -52,17 +48,8 @@ def exists(module_name):
5248
__bootstrap()
5349

5450

55-
_default_nose_arguments = [
56-
'--verbosity=3',
57-
'--detailed-errors',
58-
'--with-xunit',
59-
'--cover-erase',
60-
'--cover-package=python_toolbox,test_python_toolbox',
61-
'--exe', # Needed because `setup.py` makes our test modules executable
62-
]
63-
64-
65-
def invoke_nose(arguments=_default_nose_arguments):
66-
'''Start Nose using this `test_python_toolbox` test package.'''
67-
nose.run(defaultTest='test_python_toolbox',
68-
argv=(arguments + sys.argv[1:]))
51+
def invoke_tests():
52+
'''Start Pytest using this `test_python_toolbox` test package.'''
53+
pytest.main()
54+
# nose.run(defaultTest='test_python_toolbox',
55+
# argv=(arguments + sys.argv[1:]))

test_python_toolbox/scripts/_test_python_toolbox.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,4 +12,4 @@
1212

1313

1414
if __name__ == '__main__':
15-
test_python_toolbox.invoke_nose()
15+
test_python_toolbox.invoke_tests()

test_python_toolbox/test_abc_tools/test_abstract_static_method.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,6 @@
66
import sys
77
import abc
88

9-
import nose
10-
119
from python_toolbox.abc_tools import AbstractStaticMethod
1210

1311

@@ -19,7 +17,7 @@ class A(metaclass=abc.ABCMeta):
1917
def f():
2018
pass
2119

22-
nose.tools.assert_raises(TypeError, lambda: A())
20+
pytest.raises(TypeError, lambda: A())
2321

2422

2523
def test_override():

test_python_toolbox/test_address_tools/test_describe.py

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,7 @@
33

44
'''Testing module for `python_toolbox.address_tools.describe`.'''
55

6-
7-
import nose
6+
import pytest
87

98
from python_toolbox import import_tools
109
from python_toolbox.temp_value_setting import TempValueSetter
@@ -27,8 +26,8 @@ def test_on_locally_defined_class():
2726
# Testing for locally defined class:
2827

2928

30-
raise nose.SkipTest("This test doesn't currently pass because `describe` "
31-
"doesn't support nested classes yet.")
29+
pytest.skip("This test doesn't currently pass because `describe` "
30+
"doesn't support nested classes yet.")
3231

3332
result = describe(A.B)
3433
assert result == prefix + 'A.B'
@@ -243,7 +242,7 @@ def test_bad_module_name():
243242

244243
def test_function_in_something():
245244
'''Test `describe` doesn't fail when describing `{1: sum}`.'''
246-
raise nose.SkipTest("This test doesn't pass yet.")
245+
pytest.skip("This test doesn't pass yet.")
247246
assert describe({1: sum}) == '{1: sum}'
248247
describe((sum, sum, list, chr)) == '(sum, sum, list, chr)'
249248

test_python_toolbox/test_address_tools/test_resolve.py

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,6 @@
33

44
'''Testing module for `python_toolbox.address_tools.resolve`.'''
55

6-
import nose.tools
7-
86
from python_toolbox.address_tools import describe, resolve
97

108

@@ -139,14 +137,14 @@ def test_address_in_expression():
139137
def test_illegal_input():
140138
'''Test `resolve` raises exception when given illegal input.'''
141139

142-
nose.tools.assert_raises(Exception,
140+
pytest.raises(Exception,
143141
resolve,
144142
'asdgfasdgas if 4 else asdfasdfa ')
145143

146-
nose.tools.assert_raises(Exception,
144+
pytest.raises(Exception,
147145
resolve,
148146
'dgf sdfg sdfga ')
149147

150-
nose.tools.assert_raises(Exception,
148+
pytest.raises(Exception,
151149
resolve,
152150
'4- ')

test_python_toolbox/test_caching/test_cache.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,6 @@
88
import re
99
import weakref
1010

11-
import nose.tools
12-
1311
from python_toolbox import caching
1412
from python_toolbox.caching import cache
1513
from python_toolbox import misc_tools

0 commit comments

Comments
 (0)