forked from pool/python-entrypoint2
- Use pytest instead of nose - Add remove_nose.patch OBS-URL: https://build.opensuse.org/request/show/789030 OBS-URL: https://build.opensuse.org/package/show/devel:languages:python/python-entrypoint2?expand=0&rev=19
245 lines
6.2 KiB
Diff
245 lines
6.2 KiB
Diff
diff -ru a/requirements-test.txt b/requirements-test.txt
|
|
--- a/requirements-test.txt 2020-03-27 14:00:49.587654335 +0100
|
|
+++ b/requirements-test.txt 2020-03-27 14:01:04.815678385 +0100
|
|
@@ -1,5 +1,4 @@
|
|
tox
|
|
-nose
|
|
coverage
|
|
path.py
|
|
easyprocess
|
|
\ No newline at end of file
|
|
diff -ru a/setup.py b/setup.py
|
|
--- a/setup.py 2020-03-27 14:00:49.587654335 +0100
|
|
+++ b/setup.py 2020-03-27 14:01:04.815678385 +0100
|
|
@@ -56,7 +56,6 @@
|
|
license='BSD',
|
|
packages=PACKAGES,
|
|
# include_package_data=True,
|
|
- # test_suite='nose.collector',
|
|
# zip_safe=False,
|
|
install_requires=install_requires,
|
|
# **extra
|
|
Only in entrypoint2-0.2: setup.py.orig
|
|
diff -ru a/tests/test.py b/tests/test.py
|
|
--- a/tests/test.py 2020-03-27 14:00:49.587654335 +0100
|
|
+++ b/tests/test.py 2020-03-27 14:01:08.703684524 +0100
|
|
@@ -1,5 +1,4 @@
|
|
from easyprocess import EasyProcess
|
|
-from nose.tools import eq_, ok_
|
|
from path import Path
|
|
import sys
|
|
|
|
@@ -13,133 +12,138 @@
|
|
PY3 = sys.version_info[0] >= 3
|
|
|
|
|
|
+def ported_eq(a, b, msg=None):
|
|
+ if not a == b:
|
|
+ raise AssertionError(msg or "%r != %r" % (a, b))
|
|
+
|
|
+
|
|
def test_1_call():
|
|
import example1
|
|
- eq_(example1.f(3), 3)
|
|
- eq_('description' in example1.f.__doc__, True)
|
|
- eq_(example1.f.__name__, 'f')
|
|
+ ported_eq(example1.f(3), 3)
|
|
+ ported_eq('description' in example1.f.__doc__, True)
|
|
+ ported_eq(example1.f.__name__, 'f')
|
|
|
|
|
|
def test_2_call():
|
|
import example2
|
|
- eq_(example2.f(5, 1), 6)
|
|
- eq_(example2.f.__doc__, None)
|
|
- eq_(example2.f.__name__, 'f')
|
|
+ ported_eq(example2.f(5, 1), 6)
|
|
+ ported_eq(example2.f.__doc__, None)
|
|
+ ported_eq(example2.f.__name__, 'f')
|
|
|
|
|
|
def test_3_call():
|
|
import example3
|
|
- eq_(example3.f(), 7)
|
|
- eq_(example3.f.__doc__, None)
|
|
- eq_(example3.f.__name__, 'f')
|
|
+ ported_eq(example3.f(), 7)
|
|
+ ported_eq(example3.f.__doc__, None)
|
|
+ ported_eq(example3.f.__name__, 'f')
|
|
|
|
|
|
def test_1_cli():
|
|
cmd = [python, example1_py, '5']
|
|
p = EasyProcess(cmd).call()
|
|
- eq_(p.return_code, 0)
|
|
- eq_(p.stdout, '')
|
|
- eq_(p.stderr, '')
|
|
+ ported_eq(p.return_code, 0)
|
|
+ ported_eq(p.stdout, '')
|
|
+ ported_eq(p.stderr, '')
|
|
|
|
cmd = [python, example1_py, '5', '--two', '7', '--debug']
|
|
p = EasyProcess(cmd).call()
|
|
- eq_(p.return_code, 0)
|
|
- eq_(p.stdout, '')
|
|
- eq_(p.stderr, '')
|
|
+ ported_eq(p.return_code, 0)
|
|
+ ported_eq(p.stdout, '')
|
|
+ ported_eq(p.stderr, '')
|
|
|
|
cmd = [python, example1_py, '5', '--three', '-t', '2', '--debug']
|
|
p = EasyProcess(cmd).call()
|
|
- eq_(p.return_code, 0)
|
|
- eq_(p.stdout, '')
|
|
- eq_(p.stderr, '')
|
|
+ ported_eq(p.return_code, 0)
|
|
+ ported_eq(p.stdout, '')
|
|
+ ported_eq(p.stderr, '')
|
|
|
|
cmd = [python, example1_py, '5', '-t', 'x']
|
|
p = EasyProcess(cmd).call()
|
|
- eq_(p.return_code > 0, 1)
|
|
- eq_(p.stdout, '')
|
|
- eq_(p.stderr != '', 1)
|
|
+ ported_eq(p.return_code > 0, 1)
|
|
+ ported_eq(p.stdout, '')
|
|
+ ported_eq(p.stderr != '', 1)
|
|
|
|
cmd = [python, example1_py, '-t', '1', '5', '--debug']
|
|
p = EasyProcess(cmd).call()
|
|
- eq_(p.return_code, 0)
|
|
- eq_(p.stdout, '')
|
|
- eq_(p.stderr, '')
|
|
+ ported_eq(p.return_code, 0)
|
|
+ ported_eq(p.stdout, '')
|
|
+ ported_eq(p.stderr, '')
|
|
|
|
|
|
def test_2_cli():
|
|
cmd = [python, example2_py, '5', '2']
|
|
p = EasyProcess(cmd).call()
|
|
- eq_(p.return_code, 0)
|
|
- eq_(p.stdout, '')
|
|
- eq_(p.stderr, '')
|
|
+ ported_eq(p.return_code, 0)
|
|
+ ported_eq(p.stdout, '')
|
|
+ ported_eq(p.stderr, '')
|
|
|
|
cmd = [python, example2_py, '--debug', '5', '2']
|
|
p = EasyProcess(cmd).call()
|
|
- eq_(p.return_code, 0)
|
|
- eq_(p.stdout, '')
|
|
- ok_('root - DEBUG - 5' in p.stderr)
|
|
+ ported_eq(p.return_code, 0)
|
|
+ ported_eq(p.stdout, '')
|
|
+ assert 'root - DEBUG - 5' in p.stderr
|
|
|
|
|
|
def test_3_cli():
|
|
cmd = [python, example3_py]
|
|
p = EasyProcess(cmd).call()
|
|
- eq_(p.return_code, 0)
|
|
- eq_(p.stdout, '')
|
|
- eq_(p.stderr, '')
|
|
+ ported_eq(p.return_code, 0)
|
|
+ ported_eq(p.stdout, '')
|
|
+ ported_eq(p.stderr, '')
|
|
|
|
|
|
def test_1_ver():
|
|
cmd = [python, example1_py, '--version']
|
|
p = EasyProcess(cmd).call()
|
|
if PY3:
|
|
- eq_(p.stderr, '')
|
|
- eq_(p.stdout, '3.2')
|
|
+ ported_eq(p.stderr, '')
|
|
+ ported_eq(p.stdout, '3.2')
|
|
else:
|
|
- eq_(p.stdout, '')
|
|
- eq_(p.stderr, '3.2')
|
|
- eq_(p.return_code, 0)
|
|
+ ported_eq(p.stdout, '')
|
|
+ ported_eq(p.stderr, '3.2')
|
|
+ ported_eq(p.return_code, 0)
|
|
|
|
|
|
def test_2_ver():
|
|
cmd = [python, example2_py, '--version']
|
|
p = EasyProcess(cmd).call()
|
|
if PY3:
|
|
- eq_(p.stderr, '')
|
|
- eq_(p.stdout, '1.2')
|
|
+ ported_eq(p.stderr, '')
|
|
+ ported_eq(p.stdout, '1.2')
|
|
else:
|
|
- eq_(p.stdout, '')
|
|
- eq_(p.stderr, '1.2')
|
|
- eq_(p.return_code, 0)
|
|
+ ported_eq(p.stdout, '')
|
|
+ ported_eq(p.stderr, '1.2')
|
|
+ ported_eq(p.return_code, 0)
|
|
|
|
|
|
def test_3_ver():
|
|
cmd = [python, example3_py, '--version']
|
|
p = EasyProcess(cmd).call()
|
|
- eq_(p.stdout, '')
|
|
- ok_(p.stderr)
|
|
- ok_(p.return_code != 0)
|
|
+ ported_eq(p.stdout, '')
|
|
+ assert p.stderr
|
|
+ assert p.return_code != 0
|
|
|
|
|
|
def test_1_help():
|
|
cmd = [python, example1_py, '--help']
|
|
p = EasyProcess(cmd).call()
|
|
- eq_(p.stderr, '')
|
|
- eq_(p.return_code, 0)
|
|
- eq_('one' in p.stdout, 1)
|
|
- eq_('--two' in p.stdout, 1)
|
|
- eq_('-t' in p.stdout, 1)
|
|
- eq_('--three' in p.stdout, 1)
|
|
+ ported_eq(p.stderr, '')
|
|
+ ported_eq(p.return_code, 0)
|
|
+ ported_eq('one' in p.stdout, 1)
|
|
+ ported_eq('--two' in p.stdout, 1)
|
|
+ ported_eq('-t' in p.stdout, 1)
|
|
+ ported_eq('--three' in p.stdout, 1)
|
|
|
|
|
|
def test_2_help():
|
|
cmd = [python, example2_py, '--help']
|
|
p = EasyProcess(cmd).call()
|
|
- eq_(p.stderr, '')
|
|
- eq_(p.return_code, 0)
|
|
+ ported_eq(p.stderr, '')
|
|
+ ported_eq(p.return_code, 0)
|
|
|
|
|
|
def test_3_help():
|
|
cmd = [python, example3_py, '--help']
|
|
p = EasyProcess(cmd).call()
|
|
- eq_(p.stderr, '')
|
|
- eq_(p.return_code, 0)
|
|
+ ported_eq(p.stderr, '')
|
|
+ ported_eq(p.return_code, 0)
|
|
diff -ru a/tox.ini b/tox.ini
|
|
--- a/tox.ini 2020-03-27 14:00:49.587654335 +0100
|
|
+++ b/tox.ini 2020-03-27 14:01:04.815678385 +0100
|
|
@@ -8,12 +8,12 @@
|
|
|
|
[testenv]
|
|
deps=
|
|
- nose
|
|
+ pytest
|
|
easyprocess
|
|
path.py
|
|
setenv=
|
|
PYTHONPATH=
|
|
changedir=tests
|
|
|
|
-commands=nosetests --verbose
|
|
+commands=pytest
|
|
|