File: dev_skip_test.py

package info (click to toggle)
python-cytoolz 1.0.1-3
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 588 kB
  • sloc: python: 3,913; makefile: 34
file content (34 lines) | stat: -rw-r--r-- 1,054 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
"""
Determine when dev tests should be skipped by regular users.

Some tests are only intended to be tested during development right
before performing a release.  These do not test core functionality
of `cytoolz` and may be skipped.  These tests are only run if the
following conditions are true:

    - toolz is installed
    - toolz is the correct version
    - cytoolz is a release version
"""
import sys
import cytoolz

istest = lambda func: setattr(func, '__test__', True) or func
nottest = lambda func: setattr(func, '__test__', False) or func

try:
    import toolz
    do_toolz_tests = True
except ImportError:
    do_toolz_tests = False

if do_toolz_tests:
    do_toolz_tests = toolz.__version__.startswith(cytoolz.__toolz_version__)
    do_toolz_tests &= '+' not in cytoolz.__version__

# Decorator used to skip tests for developmental versions of CyToolz.
# Also, skip these tests on PyPy, which may handle docs differently.
if do_toolz_tests and sys.implementation.name != "pypy":
    dev_skip_test = istest
else:
    dev_skip_test = nottest