This repository has been archived on 2024-08-21. You can view files and clone it, but cannot push or open issues or pull requests.
PyBitmessage-2024-08-21/tests.py

38 lines
1012 B
Python
Raw Normal View History

#!/usr/bin/env python
"""Custom tests runner script for tox and python3"""
import random # noseq
import sys
import unittest
2024-05-25 02:06:02 +02:00
import six
def unittest_discover():
"""Explicit test suite creation"""
2024-05-25 02:06:02 +02:00
if six.PY3:
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)