Hide keyboard shortcuts

Hot-keys on this page

r m x p   toggle line displays

j k   next/prev highlighted chunk

0   (zero) top of page

1   (one) first highlighted chunk

1""" 

2Entrypoint for testing from the top-level namespace. 

3""" 

4import os 

5import sys 

6 

7PKG = os.path.dirname(os.path.dirname(__file__)) 

8 

9 

10def test(extra_args=None): 

11 try: 

12 import pytest 

13 except ImportError: 

14 raise ImportError("Need pytest>=5.0.1 to run tests") 

15 try: 

16 import hypothesis # noqa 

17 except ImportError: 

18 raise ImportError("Need hypothesis>=3.58 to run tests") 

19 cmd = ["--skip-slow", "--skip-network", "--skip-db"] 

20 if extra_args: 

21 if not isinstance(extra_args, list): 

22 extra_args = [extra_args] 

23 cmd = extra_args 

24 cmd += [PKG] 

25 joined = " ".join(cmd) 

26 print(f"running: pytest {joined}") 

27 sys.exit(pytest.main(cmd)) 

28 

29 

30__all__ = ["test"]