t__init__.py - electrum - Electrum Bitcoin wallet
HTML git clone https://git.parazyd.org/electrum
DIR Log
DIR Files
DIR Refs
DIR Submodules
---
t__init__.py (1200B)
---
1 import unittest
2 import threading
3 import tempfile
4 import shutil
5
6 from electrum import constants
7
8
9 # Set this locally to make the test suite run faster.
10 # If set, unit tests that would normally test functions with multiple implementations,
11 # will only be run once, using the fastest implementation.
12 # e.g. libsecp256k1 vs python-ecdsa. pycryptodomex vs pyaes.
13 FAST_TESTS = False
14
15
16 # some unit tests are modifying globals...
17 class SequentialTestCase(unittest.TestCase):
18
19 test_lock = threading.Lock()
20
21 def setUp(self):
22 super().setUp()
23 self.test_lock.acquire()
24
25 def tearDown(self):
26 super().tearDown()
27 self.test_lock.release()
28
29
30 class ElectrumTestCase(SequentialTestCase):
31 """Base class for our unit tests."""
32
33 def setUp(self):
34 super().setUp()
35 self.electrum_path = tempfile.mkdtemp()
36
37 def tearDown(self):
38 super().tearDown()
39 shutil.rmtree(self.electrum_path)
40
41
42 class TestCaseForTestnet(ElectrumTestCase):
43
44 @classmethod
45 def setUpClass(cls):
46 super().setUpClass()
47 constants.set_testnet()
48
49 @classmethod
50 def tearDownClass(cls):
51 super().tearDownClass()
52 constants.set_mainnet()