File: testing.py

package info (click to toggle)
python-pyface 6.1.2-2
  • links: PTS, VCS
  • area: main
  • in suites: bullseye
  • size: 11,756 kB
  • sloc: python: 39,728; makefile: 79
file content (21 lines) | stat: -rw-r--r-- 453 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
from functools import wraps


def has_traitsui():
    """ Is traitsui installed? """
    try:
        import traitsui
    except ImportError:
        return False
    return True


def skip_if_no_traitsui(test):
    """ Decorator that skips test if traitsui not available """
    @wraps(test)
    def new_test(self):
        if has_traitsui():
            test(self)
        else:
            self.skipTest("Can't import traitsui.")
    return new_test