From 792c791910096759c234d10dbc073c32f06ec218 Mon Sep 17 00:00:00 2001 From: MMGen Date: Wed, 5 Jun 2019 13:57:22 +0000 Subject: [PATCH] unit_tests.py: minor changes --- test/unit_tests.py | 7 +++---- test/unit_tests_d/ut_subseed.py | 4 ++-- test/unit_tests_d/ut_tx_deserialize.py | 7 ++++--- 3 files changed, 9 insertions(+), 9 deletions(-) diff --git a/test/unit_tests.py b/test/unit_tests.py index 780f6cbc..5ddb68e1 100755 --- a/test/unit_tests.py +++ b/test/unit_tests.py @@ -68,12 +68,11 @@ try: die(1,"'{}': test not recognized".format(test)) for test in (cmd_args or all_tests): - exec('from test.unit_tests_d.ut_{m} import {m}'.format(m=test)) + exec('from test.unit_tests_d.ut_{m} import unit_test'.format(m=test)) gmsg('Running unit test {}'.format(test)) - t = globals()[test]() - if not t.run_test(test): + if not unit_test().run_test(test): rdie(1,'Unit test {!r} failed'.format(test)) - exec('del {}'.format(test)) + exec('del unit_test'.format(test)) exit_msg() except KeyboardInterrupt: diff --git a/test/unit_tests_d/ut_subseed.py b/test/unit_tests_d/ut_subseed.py index 07776df3..90473dd0 100755 --- a/test/unit_tests_d/ut_subseed.py +++ b/test/unit_tests_d/ut_subseed.py @@ -5,7 +5,7 @@ test/unit_tests_d/ut_subseed: subseed unit test for the MMGen suite from mmgen.common import * -class subseed(object): +class unit_test(object): def run_test(self,name): from mmgen.seed import Seed @@ -173,7 +173,7 @@ class subseed(object): collisions += ss.data[k][sid][1] assert collisions == collisions_chk, collisions - msg_r('({} collisions, last_sid {}) '.format(collisions,last_sid)) + vmsg_r('\n{} collisions, last_sid {}'.format(collisions,last_sid)) msg('OK') basic_ops() diff --git a/test/unit_tests_d/ut_tx_deserialize.py b/test/unit_tests_d/ut_tx_deserialize.py index 45a2c82f..88a623ed 100755 --- a/test/unit_tests_d/ut_tx_deserialize.py +++ b/test/unit_tests_d/ut_tx_deserialize.py @@ -6,7 +6,7 @@ test/unit_tests_d/ut_tx_deserialize: TX deserialization unit test for the MMGen import os from mmgen.common import * -class tx_deserialize(object): +class unit_test(object): def _get_core_repo_root(self): self.core_repo_root = os.getenv('CORE_REPO_ROOT') @@ -87,9 +87,10 @@ class tx_deserialize(object): def test_core_vectors(): self._get_core_repo_root() - fn = os.path.join(self.core_repo_root,'src/test/data/tx_valid.json') + fn_b = 'src/test/data/tx_valid.json' + fn = os.path.join(self.core_repo_root,fn_b) data = json.loads(open(fn).read()) - print_info(fn,'Core test vectors') + print_info(fn_b,'Core test vectors') n = 1 for e in data: if type(e[0]) == list: