From 14678f371ee9b873f5928a3a48a430d5e00c63a0 Mon Sep 17 00:00:00 2001 From: The MMGen Project Date: Fri, 29 Sep 2023 12:24:22 +0000 Subject: [PATCH] Config: new attribute: `test_datadir` --- mmgen/cfg.py | 4 ++-- test/include/common.py | 3 --- test/test.py | 4 +--- 3 files changed, 3 insertions(+), 8 deletions(-) diff --git a/mmgen/cfg.py b/mmgen/cfg.py index f52acc2d..616b6f18 100755 --- a/mmgen/cfg.py +++ b/mmgen/cfg.py @@ -215,6 +215,7 @@ class Config(Lockable): exit_after = '' resuming = False skipping_deps = False + test_datadir = os.path.join('test','data_dir' + ('','-α')[bool(os.getenv('MMGEN_DEBUG_UTF8'))]) mnemonic_entry_modes = {} @@ -369,8 +370,7 @@ class Config(Lockable): if self._data_dir_root_override: self._data_dir_root = os.path.normpath(os.path.abspath(self._data_dir_root_override)) elif self.test_suite: - from test.include.common import get_test_data_dir - self._data_dir_root = get_test_data_dir() + self._data_dir_root = self.test_datadir else: self._data_dir_root = os.path.join(gc.home_dir,'.'+gc.proj_name.lower()) return self._data_dir_root diff --git a/test/include/common.py b/test/include/common.py index 9f4d7e72..c57e0ace 100755 --- a/test/include/common.py +++ b/test/include/common.py @@ -117,9 +117,6 @@ def getrandstr(num_chars,no_space=False): n,m = (94,33) if no_space else (95,32) return ''.join( chr(i % n + m) for i in list(getrand(num_chars)) ) -def get_test_data_dir(): - return os.path.join('test','data_dir' + ('','-α')[bool(os.getenv('MMGEN_DEBUG_UTF8'))]) - # Windows uses non-UTF8 encodings in filesystem, so use raw bytes here def cleandir(d,do_msg=False): d_enc = d.encode() diff --git a/test/test.py b/test/test.py index 190fcbbc..1f6ae28c 100755 --- a/test/test.py +++ b/test/test.py @@ -175,9 +175,7 @@ environment var # we need some opt values before running opts.init, so parse without initializing: po = Config(opts_data=opts_data,parse_only=True)._parsed_opts -from test.include.common import get_test_data_dir - -data_dir = get_test_data_dir() # include/common.py +data_dir = Config.test_datadir # step 1: delete data_dir symlink in ./test; if not po.user_opts.get('skipping_deps'):