-
Notifications
You must be signed in to change notification settings - Fork 50
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
0.10.0: cycler test suite is using nose
module
#73
Milestone
Comments
I've done quick patch using --- a/run_tests.py 2016-02-16 04:53:24.000000000 +0000
+++ b/run_tests.py 1970-01-01 01:00:00.000000000 +0100
@@ -1,27 +0,0 @@
-#!/usr/bin/env python
-# This file is closely based on tests.py from matplotlib
-#
-# This allows running the matplotlib tests from the command line: e.g.
-#
-# $ python run_tests.py -v -d
-#
-# The arguments are identical to the arguments accepted by nosetests.
-#
-# See https://nose.readthedocs.org/ for a detailed description of
-# these options.
-import nose
-
-
-env = {"NOSE_WITH_COVERAGE": 1,
- 'NOSE_COVER_PACKAGE': ['cycler'],
- 'NOSE_COVER_HTML': 1}
-plugins = []
-
-
-def run():
-
- nose.main(addplugins=[x() for x in plugins], env=env)
-
-
-if __name__ == '__main__':
- run()
--- a/test_cycler.py 2016-02-16 04:53:24.000000000 +0000
+++ b/test_cycler.py 2021-09-03 17:12:23.739752350 +0100
@@ -3,25 +3,25 @@
import six
from six.moves import zip, range
from cycler import cycler, Cycler, concat
-from nose.tools import (assert_equal, assert_not_equal,
- assert_raises, assert_true)
+import pytest
+
from itertools import product, cycle, chain
from operator import add, iadd, mul, imul
from collections import defaultdict
def _cycler_helper(c, length, keys, values):
- assert_equal(len(c), length)
- assert_equal(len(c), len(list(c)))
- assert_equal(c.keys, set(keys))
+ assert len(c) == length
+ assert len(c) == len(list(c))
+ assert c.keys == set(keys)
for k, vals in zip(keys, values):
for v, v_target in zip(c, vals):
- assert_equal(v[k], v_target)
+ assert v[k] == v_target
def _cycles_equal(c1, c2):
- assert_equal(list(c1), list(c2))
+ assert list(c1) == list(c2)
def test_creation():
@@ -42,8 +42,8 @@
yield _cycler_helper, c2+c1, 3, ['c', 'lw'], [list('rgb'), range(3)]
yield _cycles_equal, c2+c1, c1+c2
# miss-matched add lengths
- assert_raises(ValueError, add, c1, c3)
- assert_raises(ValueError, add, c3, c1)
+ pytest.raises(ValueError, add, c1, c3)
+ pytest.raises(ValueError, add, c3, c1)
# multiplication
target = zip(*product(list('rgb'), range(3)))
@@ -92,16 +92,16 @@
def test_failures():
c1 = cycler(c='rgb')
c2 = cycler(c=c1)
- assert_raises(ValueError, add, c1, c2)
- assert_raises(ValueError, iadd, c1, c2)
- assert_raises(ValueError, mul, c1, c2)
- assert_raises(ValueError, imul, c1, c2)
- assert_raises(TypeError, iadd, c2, 'aardvark')
- assert_raises(TypeError, imul, c2, 'aardvark')
+ pytest.raises(ValueError, add, c1, c2)
+ pytest.raises(ValueError, iadd, c1, c2)
+ pytest.raises(ValueError, mul, c1, c2)
+ pytest.raises(ValueError, imul, c1, c2)
+ pytest.raises(TypeError, iadd, c2, 'aardvark')
+ pytest.raises(TypeError, imul, c2, 'aardvark')
c3 = cycler(ec=c1)
- assert_raises(ValueError, cycler, c=c2+c3)
+ pytest.raises(ValueError, cycler, c=c2+c3)
def test_simplify():
@@ -123,9 +123,9 @@
def test_mul_fails():
c1 = cycler(c='rgb')
- assert_raises(TypeError, mul, c1, 2.0)
- assert_raises(TypeError, mul, c1, 'a')
- assert_raises(TypeError, mul, c1, [])
+ pytest.raises(TypeError, mul, c1, 2.0)
+ pytest.raises(TypeError, mul, c1, 'a')
+ pytest.raises(TypeError, mul, c1, [])
def test_getitem():
@@ -140,14 +140,14 @@
def test_fail_getime():
c1 = cycler(lw=range(15))
- assert_raises(ValueError, Cycler.__getitem__, c1, 0)
- assert_raises(ValueError, Cycler.__getitem__, c1, [0, 1])
+ pytest.raises(ValueError, Cycler.__getitem__, c1, 0)
+ pytest.raises(ValueError, Cycler.__getitem__, c1, [0, 1])
def _repr_tester_helper(rpr_func, cyc, target_repr):
test_repr = getattr(cyc, rpr_func)()
- assert_equal(six.text_type(test_repr),
+ assert (six.text_type(test_repr) ==
six.text_type(target_repr))
@@ -172,13 +172,13 @@
def test_call():
c = cycler(c='rgb')
c_cycle = c()
- assert_true(isinstance(c_cycle, cycle))
+ assert isinstance(c_cycle, cycle)
j = 0
for a, b in zip(2*c, c_cycle):
j += 1
- assert_equal(a, b)
+ assert a == b
- assert_equal(j, len(c) * 2)
+ assert j == len(c) * 2
def test_copying():
@@ -202,21 +202,21 @@
c_after = (c1 + c2) * c3
- assert_equal(c1, cycler('c', [1, 2, 3]))
- assert_equal(c2, cycler('lw', ['r', 'g', 'b']))
- assert_equal(c3, cycler('foo', [['y', 'g', 'blue'], ['b', 'k']]))
- assert_equal(c_before, (cycler(c=[1, 2, 3], lw=['r', 'g', 'b']) *
- cycler('foo', [['y', 'g', 'blue'], ['b', 'k']])))
- assert_equal(c_after, (cycler(c=[1, 2, 3], lw=['r', 'g', 'b']) *
- cycler('foo', [['y', 'g', 'blue'], ['b', 'k']])))
+ assert c1 == cycler('c', [1, 2, 3])
+ assert c2 == cycler('lw', ['r', 'g', 'b'])
+ assert c3 == cycler('foo', [['y', 'g', 'blue'], ['b', 'k']])
+ assert c_before == (cycler(c=[1, 2, 3], lw=['r', 'g', 'b']) *
+ cycler('foo', [['y', 'g', 'blue'], ['b', 'k']]))
+ assert c_after == (cycler(c=[1, 2, 3], lw=['r', 'g', 'b']) *
+ cycler('foo', [['y', 'g', 'blue'], ['b', 'k']]))
# Make sure that changing the key for a specific cycler
# doesn't break things for a composed cycler
c = (c1 + c2) * c3
c4 = cycler('bar', c3)
- assert_equal(c, (cycler(c=[1, 2, 3], lw=['r', 'g', 'b']) *
- cycler('foo', [['y', 'g', 'blue'], ['b', 'k']])))
- assert_equal(c3, cycler('foo', [['y', 'g', 'blue'], ['b', 'k']]))
+ assert c == (cycler(c=[1, 2, 3], lw=['r', 'g', 'b']) *
+ cycler('foo', [['y', 'g', 'blue'], ['b', 'k']]))
+ assert c3 == cycler('foo', [['y', 'g', 'blue'], ['b', 'k']])
def test_keychange():
@@ -225,35 +225,35 @@
c3 = cycler('ec', 'yk')
c3.change_key('ec', 'edgecolor')
- assert_equal(c3, cycler('edgecolor', c3))
+ assert c3 == cycler('edgecolor', c3)
c = c1 + c2
c.change_key('lw', 'linewidth')
# Changing a key in one cycler should have no
# impact in the original cycler.
- assert_equal(c2, cycler('lw', [1, 2, 3]))
- assert_equal(c, c1 + cycler('linewidth', c2))
+ assert c2 == cycler('lw', [1, 2, 3])
+ assert c == c1 + cycler('linewidth', c2)
c = (c1 + c2) * c3
c.change_key('c', 'color')
- assert_equal(c1, cycler('c', 'rgb'))
- assert_equal(c, (cycler('color', c1) + c2) * c3)
+ assert c1 == cycler('c', 'rgb')
+ assert c == (cycler('color', c1) + c2) * c3
# Perfectly fine, it is a no-op
c.change_key('color', 'color')
- assert_equal(c, (cycler('color', c1) + c2) * c3)
+ assert c == (cycler('color', c1) + c2) * c3
# Can't change a key to one that is already in there
- assert_raises(ValueError, Cycler.change_key, c, 'color', 'lw')
+ pytest.raises(ValueError, Cycler.change_key, c, 'color', 'lw')
# Can't change a key you don't have
- assert_raises(KeyError, Cycler.change_key, c, 'c', 'foobar')
+ pytest.raises(KeyError, Cycler.change_key, c, 'c', 'foobar')
def _eq_test_helper(a, b, res):
if res:
- assert_equal(a, b)
+ assert a == b
else:
- assert_not_equal(a, b)
+ assert a != b
def test_eq():
@@ -273,34 +273,34 @@
def test_cycler_exceptions():
- assert_raises(TypeError, cycler)
- assert_raises(TypeError, cycler, 'c', 'rgb', lw=range(3))
- assert_raises(TypeError, cycler, 'c')
- assert_raises(TypeError, cycler, 'c', 'rgb', 'lw', range(3))
+ pytest.raises(TypeError, cycler)
+ pytest.raises(TypeError, cycler, 'c', 'rgb', lw=range(3))
+ pytest.raises(TypeError, cycler, 'c')
+ pytest.raises(TypeError, cycler, 'c', 'rgb', 'lw', range(3))
def test_starange_init():
c = cycler('r', 'rgb')
c2 = cycler('lw', range(3))
cy = Cycler(list(c), list(c2), zip)
- assert_equal(cy, c + c2)
+ assert cy == c + c2
def test_concat():
a = cycler('a', range(3))
b = cycler('a', 'abc')
for con, chn in zip(a.concat(b), chain(a, b)):
- assert_equal(con, chn)
+ assert con == chn
for con, chn in zip(concat(a, b), chain(a, b)):
- assert_equal(con, chn)
+ assert con == chn
def test_concat_fail():
a = cycler('a', range(3))
b = cycler('b', range(3))
- assert_raises(ValueError, concat, a, b)
- assert_raises(ValueError, a.concat, b)
+ pytest.raises(ValueError, concat, a, b)
+ pytest.raises(ValueError, a.concat, b)
def _by_key_helper(cy):
@@ -310,14 +310,14 @@
for k, v in sty.items():
target[k].append(v)
- assert_equal(res, target)
+ assert res == target
def test_by_key_add():
input_dict = dict(c=list('rgb'), lw=[1, 2, 3])
cy = cycler(c=input_dict['c']) + cycler(lw=input_dict['lw'])
res = cy.by_key()
- assert_equal(res, input_dict)
+ assert res == input_dict
yield _by_key_helper, cy
@@ -325,6 +325,6 @@
input_dict = dict(c=list('rg'), lw=[1, 2, 3])
cy = cycler(c=input_dict['c']) * cycler(lw=input_dict['lw'])
res = cy.by_key()
- assert_equal(input_dict['lw'] * len(input_dict['c']),
+ assert (input_dict['lw'] * len(input_dict['c']) ==
res['lw'])
yield _by_key_helper, cy
Result + PYTHONPATH=/home/tkloczko/rpmbuild/BUILDROOT/python-cycler-0.10.0~no_loopy_deps-21.fc35.x86_64/usr/lib64/python3.8/site-packages:/home/tkloczko/rpmbuild/BUILDROOT/python-cycler-0.10.0~no_loopy_deps-21.fc35.x86_64/usr/lib/python3.8/site-packages
+ /usr/bin/pytest -ra
=========================================================================== test session starts ============================================================================
platform linux -- Python 3.8.12, pytest-6.2.5, py-1.10.0, pluggy-0.13.1
benchmark: 3.4.1 (defaults: timer=time.perf_counter disable_gc=False min_rounds=5 min_time=0.000005 max_time=1.0 calibration_precision=10 warmup=False warmup_iterations=100000)
Using --randomly-seed=1441122937
rootdir: /home/tkloczko/rpmbuild/BUILD/cycler-0.10.0
plugins: forked-1.3.0, shutil-1.7.0, virtualenv-1.7.0, expect-1.1.0, flake8-1.0.7, timeout-1.4.2, betamax-0.8.1, freezegun-0.4.2, aspectlib-1.5.2, toolbox-0.5, rerunfailures-9.1.1, requests-mock-1.9.3, cov-2.12.1, flaky-3.7.0, benchmark-3.4.1, xdist-2.3.0, pylama-7.7.1, datadir-1.3.1, regressions-2.2.0, cases-3.6.3, xprocess-0.18.1, black-0.3.12, anyio-3.3.0, asyncio-0.15.1, trio-0.7.0, subtests-0.5.0, isort-2.0.0, hypothesis-6.14.6, mock-3.6.1, profiling-1.7.0, randomly-3.8.0, Faker-8.12.1, nose2pytest-1.0.8, pyfakefs-4.5.1, tornado-0.8.1, twisted-1.13.3
collected 21 items
test_cycler.py xx.xxxxxx..xx....x... [100%]
============================================================================= warnings summary =============================================================================
test_cycler.py:27
test_cycler.py:27: PytestCollectionWarning: yield tests were removed in pytest 4.0 - test_creation will be ignored
def test_creation():
test_cycler.py:36
test_cycler.py:36: PytestCollectionWarning: yield tests were removed in pytest 4.0 - test_compose will be ignored
def test_compose():
test_cycler.py:59
test_cycler.py:59: PytestCollectionWarning: yield tests were removed in pytest 4.0 - test_inplace will be ignored
def test_inplace():
test_cycler.py:72
test_cycler.py:72: PytestCollectionWarning: yield tests were removed in pytest 4.0 - test_constructor will be ignored
def test_constructor():
test_cycler.py:107
test_cycler.py:107: PytestCollectionWarning: yield tests were removed in pytest 4.0 - test_simplify will be ignored
def test_simplify():
test_cycler.py:114
test_cycler.py:114: PytestCollectionWarning: yield tests were removed in pytest 4.0 - test_multiply will be ignored
def test_multiply():
test_cycler.py:131
test_cycler.py:131: PytestCollectionWarning: yield tests were removed in pytest 4.0 - test_getitem will be ignored
def test_getitem():
test_cycler.py:154
test_cycler.py:154: PytestCollectionWarning: yield tests were removed in pytest 4.0 - test_repr will be ignored
def test_repr():
test_cycler.py:259
test_cycler.py:259: PytestCollectionWarning: yield tests were removed in pytest 4.0 - test_eq will be ignored
def test_eq():
test_cycler.py:316
test_cycler.py:316: PytestCollectionWarning: yield tests were removed in pytest 4.0 - test_by_key_add will be ignored
def test_by_key_add():
test_cycler.py:324
test_cycler.py:324: PytestCollectionWarning: yield tests were removed in pytest 4.0 - test_by_key_mul will be ignored
def test_by_key_mul():
-- Docs: https://docs.pytest.org/en/stable/warnings.html
========================================================================= short test summary info ==========================================================================
XFAIL test_cycler.py::test_getitem
reason: [NOTRUN] yield tests were removed in pytest 4.0 - test_getitem will be ignored
XFAIL test_cycler.py::test_simplify
reason: [NOTRUN] yield tests were removed in pytest 4.0 - test_simplify will be ignored
XFAIL test_cycler.py::test_creation
reason: [NOTRUN] yield tests were removed in pytest 4.0 - test_creation will be ignored
XFAIL test_cycler.py::test_repr
reason: [NOTRUN] yield tests were removed in pytest 4.0 - test_repr will be ignored
XFAIL test_cycler.py::test_inplace
reason: [NOTRUN] yield tests were removed in pytest 4.0 - test_inplace will be ignored
XFAIL test_cycler.py::test_multiply
reason: [NOTRUN] yield tests were removed in pytest 4.0 - test_multiply will be ignored
XFAIL test_cycler.py::test_compose
reason: [NOTRUN] yield tests were removed in pytest 4.0 - test_compose will be ignored
XFAIL test_cycler.py::test_eq
reason: [NOTRUN] yield tests were removed in pytest 4.0 - test_eq will be ignored
XFAIL test_cycler.py::test_by_key_mul
reason: [NOTRUN] yield tests were removed in pytest 4.0 - test_by_key_mul will be ignored
XFAIL test_cycler.py::test_by_key_add
reason: [NOTRUN] yield tests were removed in pytest 4.0 - test_by_key_add will be ignored
XFAIL test_cycler.py::test_constructor
reason: [NOTRUN] yield tests were removed in pytest 4.0 - test_constructor will be ignored
=============================================================== 10 passed, 11 xfailed, 11 warnings in 0.78s ================================================================
pytest-xprocess reminder::Be sure to terminate the started process by running 'pytest --xkill' if you have not explicitly done so in your fixture with 'xprocess.getinfo(<process_name>).terminate()'. Still |
Thanks! Yes, turning this into a PR would be very welcome. |
There's no need for a PR; it's already done in #37. |
After so many years .. hmm .. don't you think that it would be good to make neew release?🤔 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
nose
module is for python 2.x and for 3.x id deprecated https://nose.readthedocs.io/en/latest/I recommend use
pytest
The text was updated successfully, but these errors were encountered: