-
Notifications
You must be signed in to change notification settings - Fork 577
/
tests.py
36 lines (29 loc) · 1021 Bytes
/
tests.py
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
35
36
#!/usr/bin/env python
"""Custom tests runner script for tox and python3"""
import random # noseq
import sys
import unittest
def unittest_discover():
"""Explicit test suite creation"""
if sys.hexversion >= 0x3000000:
from pybitmessage import pathmagic
pathmagic.setup()
loader = unittest.defaultTestLoader
# randomize the order of tests in test cases
loader.sortTestMethodsUsing = lambda a, b: random.randint(-1, 1)
# pybitmessage symlink disappears on Windows!
testsuite = loader.discover('pybitmessage.tests')
testsuite.addTests([loader.discover('pybitmessage.pyelliptic')])
return testsuite
if __name__ == "__main__":
success = unittest.TextTestRunner(verbosity=2).run(
unittest_discover()).wasSuccessful()
try:
from pybitmessage.tests import common
except ImportError:
checkup = False
else:
checkup = common.checkup()
if checkup and not success:
print(checkup)
sys.exit(not success or checkup)