This repository has been archived on 2025-02-16. You can view files and clone it, but cannot push or open issues or pull requests.
Dmitri Bogomolov 6360c2773d
Separate pyelliptic tests from crypto tests and add simple tests for
changebase(), decode(), encode(), hex_to_point() and point_to_hex()
2021-08-17 15:57:08 +03:00

38 lines
1.0 KiB
Python

#!/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 may disappear on Windows
testsuite = loader.discover('src.tests')
testsuite.addTests([loader.discover('src.pyelliptic')])
return testsuite
if __name__ == "__main__":
success = unittest.TextTestRunner(verbosity=2).run(
unittest_discover()).wasSuccessful()
try:
from src.tests import common
except ImportError:
checkup = False
print('ImportError from src.tests')
else:
checkup = common.checkup()
if checkup and not success:
print(checkup)
sys.exit(not success or checkup)