diff --git a/Makefile b/Makefile index 69a668e..413fc46 100644 --- a/Makefile +++ b/Makefile @@ -1,7 +1,7 @@ PYTHON ?= python inplace: - $(PYTHON) setup.py build_ext --inplace + $(PYTHON) setup.py build_ext --inplace --cython test: inplace nosetests -s --with-doctest cytoolz/ diff --git a/cytoolz/tests/dev_skip_test.py b/cytoolz/tests/dev_skip_test.py new file mode 100644 index 0000000..3546f8a --- /dev/null +++ b/cytoolz/tests/dev_skip_test.py @@ -0,0 +1,8 @@ +import cytoolz +from nose.tools import nottest, istest + +# Decorator used to skip tests for developmental versions of CyToolz +if 'dev' in cytoolz.__version__: + dev_skip_test = nottest +else: + dev_skip_test = istest diff --git a/cytoolz/tests/test_curried_toolzlike.py b/cytoolz/tests/test_curried_toolzlike.py index b45e3f7..333e229 100644 --- a/cytoolz/tests/test_curried_toolzlike.py +++ b/cytoolz/tests/test_curried_toolzlike.py @@ -3,16 +3,19 @@ import toolz import toolz.curried import types +from dev_skip_test import dev_skip_test # Note that the tests in this file assume `toolz.curry` is a class, but we # may some day make `toolz.curry` a function and `toolz.Curry` a class. +@dev_skip_test def test_toolzcurry_is_class(): assert isinstance(toolz.curry, type) is True assert isinstance(toolz.curry, types.FunctionType) is False +@dev_skip_test def test_cytoolz_like_toolz(): for key, val in toolz.curried.__dict__.items(): if isinstance(val, toolz.curry): @@ -22,6 +25,7 @@ def test_cytoolz_like_toolz(): 'cytoolz.curried.%s should be curried' % key) +@dev_skip_test def test_toolz_like_cytoolz(): for key, val in cytoolz.curried.__dict__.items(): if isinstance(val, cytoolz.curry): diff --git a/cytoolz/tests/test_dev_skip_test.py b/cytoolz/tests/test_dev_skip_test.py new file mode 100644 index 0000000..0c25271 --- /dev/null +++ b/cytoolz/tests/test_dev_skip_test.py @@ -0,0 +1,21 @@ +from dev_skip_test import istest, nottest, dev_skip_test + +d = {} + + +@istest +def test_passes(): + d['istest'] = True + assert True + + +@nottest +def test_fails(): + d['nottest'] = True + assert False + + +def test_dev_skip_test(): + assert dev_skip_test is istest or dev_skip_test is nottest + assert d.get('istest', False) is True + assert d.get('nottest', False) is False diff --git a/cytoolz/tests/test_docstrings.py b/cytoolz/tests/test_docstrings.py index 18cdd93..4be663c 100644 --- a/cytoolz/tests/test_docstrings.py +++ b/cytoolz/tests/test_docstrings.py @@ -4,6 +4,7 @@ from cytoolz import curry, identity, keyfilter, valfilter, merge_with from cytoolz.utils import raises +from dev_skip_test import dev_skip_test # `cytoolz` functions for which "# doctest: +SKIP" were added. @@ -30,6 +31,7 @@ def convertdoc(doc): return doc +@dev_skip_test def test_docstrings_uptodate(): differ = difflib.Differ() diff --git a/cytoolz/tests/test_embedded_sigs.py b/cytoolz/tests/test_embedded_sigs.py index 07fbb1b..d2cd69f 100644 --- a/cytoolz/tests/test_embedded_sigs.py +++ b/cytoolz/tests/test_embedded_sigs.py @@ -4,6 +4,7 @@ from types import BuiltinFunctionType from cytoolz import curry, identity, keyfilter, valfilter, merge_with +from dev_skip_test import dev_skip_test @curry @@ -12,6 +13,7 @@ def isfrommod(modname, func): return modname in mod +@dev_skip_test def test_class_sigs(): """ Test that all ``cdef class`` extension types in ``cytoolz`` have correctly embedded the function signature as done in ``toolz``. @@ -54,6 +56,7 @@ def test_class_sigs(): aliases = {'comp': 'compose'} +@dev_skip_test def test_sig_at_beginning(): """ Test that the function signature is at the beginning of the docstring and is followed by exactly one blank line.