mirror of
https://github.com/trezor/trezor-firmware.git
synced 2024-11-29 02:48:18 +00:00
test(core): replace __init__ in unit tests with setUpClass and tearDownClass
[no changelog]
This commit is contained in:
parent
d9a6c3f72f
commit
5ab357f0e0
@ -23,9 +23,11 @@ from apps.common import coins
|
||||
|
||||
class TestApprover(unittest.TestCase):
|
||||
|
||||
def __init__(self):
|
||||
def setUpClass(self):
|
||||
context.CURRENT_CONTEXT = CodecContext(None, bytearray(64))
|
||||
super().__init__()
|
||||
|
||||
def tearDownClass(self):
|
||||
context.CURRENT_CONTEXT = None
|
||||
|
||||
def setUp(self):
|
||||
self.coin = coins.by_name("Bitcoin")
|
||||
|
@ -14,12 +14,14 @@ _ROUND_ID_LEN = 32
|
||||
|
||||
class TestAuthorization(unittest.TestCase):
|
||||
|
||||
def __init__(self):
|
||||
context.CURRENT_CONTEXT = CodecContext(None, bytearray(64))
|
||||
super().__init__()
|
||||
|
||||
coin = coins.by_name("Bitcoin")
|
||||
|
||||
def setUpClass(self):
|
||||
context.CURRENT_CONTEXT = CodecContext(None, bytearray(64))
|
||||
|
||||
def tearDownClass(self):
|
||||
context.CURRENT_CONTEXT = None
|
||||
|
||||
def setUp(self):
|
||||
self.msg_auth = AuthorizeCoinJoin(
|
||||
coordinator="www.example.com",
|
||||
|
@ -12,9 +12,11 @@ from storage import cache_codec
|
||||
|
||||
class TestBitcoinKeychain(unittest.TestCase):
|
||||
|
||||
def __init__(self):
|
||||
def setUpClass(self):
|
||||
context.CURRENT_CONTEXT = CodecContext(None, bytearray(64))
|
||||
super().__init__()
|
||||
|
||||
def tearDownClass(self):
|
||||
context.CURRENT_CONTEXT = None
|
||||
|
||||
def setUp(self):
|
||||
cache_codec.start_session()
|
||||
@ -97,13 +99,11 @@ class TestBitcoinKeychain(unittest.TestCase):
|
||||
@unittest.skipUnless(not utils.BITCOIN_ONLY, "altcoin")
|
||||
class TestAltcoinKeychains(unittest.TestCase):
|
||||
|
||||
def __init__(self):
|
||||
# Context is needed to test decorators and handleInitialize
|
||||
# It allows access to codec cache from different parts of the code
|
||||
from trezor.wire import context
|
||||
|
||||
def setUpClass(self):
|
||||
context.CURRENT_CONTEXT = CodecContext(None, bytearray(64))
|
||||
super().__init__()
|
||||
|
||||
def tearDownClass(self):
|
||||
context.CURRENT_CONTEXT = None
|
||||
|
||||
def setUp(self):
|
||||
cache_codec.start_session()
|
||||
|
@ -16,9 +16,11 @@ from storage import cache_codec
|
||||
|
||||
class TestKeychain(unittest.TestCase):
|
||||
|
||||
def __init__(self):
|
||||
def setUpClass(self):
|
||||
context.CURRENT_CONTEXT = CodecContext(None, bytearray(64))
|
||||
super().__init__()
|
||||
|
||||
def tearDownClass(self):
|
||||
context.CURRENT_CONTEXT = None
|
||||
|
||||
def setUp(self):
|
||||
cache_codec.start_session()
|
||||
|
@ -74,9 +74,11 @@ class TestEthereumKeychain(unittest.TestCase):
|
||||
addr,
|
||||
)
|
||||
|
||||
def __init__(self):
|
||||
def setUpClass(self):
|
||||
context.CURRENT_CONTEXT = CodecContext(None, bytearray(64))
|
||||
super().__init__()
|
||||
|
||||
def tearDownClass(self):
|
||||
context.CURRENT_CONTEXT = None
|
||||
|
||||
def setUp(self):
|
||||
cache_codec.start_session()
|
||||
|
@ -11,9 +11,6 @@ if not utils.BITCOIN_ONLY:
|
||||
|
||||
@unittest.skipUnless(not utils.BITCOIN_ONLY, "altcoin")
|
||||
class TestMoneroSerializer(unittest.TestCase):
|
||||
def __init__(self, *args, **kwargs):
|
||||
super(TestMoneroSerializer, self).__init__(*args, **kwargs)
|
||||
|
||||
def test_varint(self):
|
||||
"""
|
||||
Var int
|
||||
|
@ -19,9 +19,11 @@ def is_session_started() -> bool:
|
||||
|
||||
class TestStorageCache(unittest.TestCase):
|
||||
|
||||
def __init__(self):
|
||||
def setUpClass(self):
|
||||
context.CURRENT_CONTEXT = CodecContext(None, bytearray(64))
|
||||
super().__init__()
|
||||
|
||||
def tearDownClass(self):
|
||||
context.CURRENT_CONTEXT = None
|
||||
|
||||
def setUp(self):
|
||||
cache.clear_all()
|
||||
|
Loading…
Reference in New Issue
Block a user