Skip to content
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

Add cytoolz.utils.dev_skip_test decorator to skip tests for dev versions #23

Merged
merged 3 commits into from
May 6, 2014
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
@@ -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/
8 changes: 8 additions & 0 deletions cytoolz/tests/dev_skip_test.py
Original file line number Diff line number Diff line change
@@ -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
4 changes: 4 additions & 0 deletions cytoolz/tests/test_curried_toolzlike.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand All @@ -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):
Expand Down
21 changes: 21 additions & 0 deletions cytoolz/tests/test_dev_skip_test.py
Original file line number Diff line number Diff line change
@@ -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
2 changes: 2 additions & 0 deletions cytoolz/tests/test_docstrings.py
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand All @@ -30,6 +31,7 @@ def convertdoc(doc):
return doc


@dev_skip_test
def test_docstrings_uptodate():
differ = difflib.Differ()

Expand Down
3 changes: 3 additions & 0 deletions cytoolz/tests/test_embedded_sigs.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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``.
Expand Down Expand Up @@ -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.
Expand Down