Browse Source

test suite: remove --system option, minor cleanups

The MMGen Project 1 year ago
parent
commit
845470302d
5 changed files with 9 additions and 27 deletions
  1. 0 4
      test/scrambletest.py
  2. 0 5
      test/test.py
  3. 4 8
      test/tooltest.py
  4. 2 8
      test/tooltest2.py
  5. 3 2
      test/unit_tests.py

+ 0 - 4
test/scrambletest.py

@@ -39,8 +39,6 @@ opts_data = {
 -a, --no-altcoin    Skip altcoin tests
 -C, --coverage      Produce code coverage info using trace module
 -l, --list-cmds     List and describe the tests and commands in this test suite
--s, --system        Test scripts and modules installed on system rather than
-                    those in the repo root
 -v, --verbose       Produce more verbose output
 """,
 	'notes': """
@@ -101,8 +99,6 @@ cmd_base = f'python3{cvr_opts} cmds/mmgen-{{}}gen -qS'
 
 run_env = dict(os.environ)
 run_env['MMGEN_DEBUG_ADDRLIST'] = '1'
-if not cfg.system:
-	run_env['PYTHONPATH'] = repo_root
 
 def get_cmd_output(cmd):
 	cp = run( cmd.split(), stdout=PIPE, stderr=PIPE, env=run_env )

+ 0 - 5
test/test.py

@@ -141,8 +141,6 @@ opts_data = {
 -r, --resume=c       Resume at command 'c' after interrupted run
 -R, --resume-after=c Same, but resume at command following 'c'
 -t, --step           After resuming, execute one command and stop
--s, --system         Test scripts and modules installed on system rather
-                     than those in the repo root
 -S, --skip-deps      Skip dependency checking for command
 -u, --usr-random     Get random data interactively from user
 -T, --pexpect-timeout=T Set the timeout for pexpect
@@ -201,9 +199,6 @@ cfg.skipping_deps = cfg.resuming or 'skip_deps' in po.user_opts
 
 cmd_args = cfg._args
 
-if not cfg.system:
-	os.environ['PYTHONPATH'] = repo_root
-
 if cfg.pexpect_spawn and gc.platform == 'win':
 	die(1,'--pexpect-spawn option not supported on Windows platform, exiting')
 

+ 4 - 8
test/tooltest.py

@@ -41,8 +41,6 @@ opts_data = {
 --, --longhelp      Print help message for long options (common options)
 -l, --list-cmds     List and describe the tests and commands in this test suite
 -L, --list-names    List the names of all tested 'mmgen-tool' commands
--s, --system        Test scripts and modules installed on system rather than
-                    those in the repo root
 -t, --type=t        Specify address type (valid choices: 'zcash_z')
 -v, --verbose       Produce more verbose output
 """,
@@ -133,13 +131,11 @@ ref_subdir  = '' if proto.base_coin == 'BTC' else proto.name.lower()
 altcoin_pfx = '' if proto.base_coin == 'BTC' else '-'+proto.base_coin
 tn_ext = ('','.testnet')[proto.testnet]
 
-mmgen_cmd = 'mmgen-tool'
+os.environ['PYTHONPATH'] = repo_root
 
-if not cfg.system:
-	os.environ['PYTHONPATH'] = repo_root
-	mmgen_cmd = os.path.relpath(os.path.join(repo_root,'cmds',mmgen_cmd))
-
-spawn_cmd = ['scripts/exec_wrapper.py',mmgen_cmd]
+spawn_cmd = [
+	'scripts/exec_wrapper.py',
+	os.path.relpath(os.path.join(repo_root,'cmds','mmgen-tool')) ]
 
 if cfg.coverage:
 	d,f = init_coverage()

+ 2 - 8
test/tooltest2.py

@@ -76,8 +76,6 @@ opts_data = {
 -L, --list-tested-cmds Output the 'mmgen-tool' commands that are tested by this test suite
 -n, --names          Print command names instead of descriptions
 -q, --quiet          Produce quieter output
--s, --system         Test scripts and modules installed on system rather than
-                     those in the repo root
 -t, --type=          Specify coin type
 -f, --fork           Run commands via tool executable instead of importing tool module
 -v, --verbose        Produce more verbose output
@@ -972,12 +970,8 @@ if cfg.list_tested_cmds:
 	list_tested_cmds()
 	sys.exit(0)
 
-if cfg.system:
-	tool_exec = 'mmgen-tool'
-	sys.path.pop(0)
-else:
-	os.environ['PYTHONPATH'] = repo_root
-	tool_exec = os.path.relpath(os.path.join('cmds','mmgen-tool'))
+os.environ['PYTHONPATH'] = repo_root
+tool_exec = os.path.relpath(os.path.join('cmds','mmgen-tool'))
 
 if cfg.fork:
 	passthru_args = ['coin','type','testnet','token']

+ 3 - 2
test/unit_tests.py

@@ -65,8 +65,9 @@ os.environ['PYTHONPATH'] = repo_root
 
 file_pfx = 'ut_'
 
-all_tests = sorted(
-	[fn[3:-3] for fn in os.listdir(os.path.join(repo_root,'test','unit_tests_d')) if fn[:3] == file_pfx])
+tests_d = os.path.join(repo_root,'test','unit_tests_d')
+
+all_tests = sorted(fn[len(file_pfx):-len('.py')] for fn in os.listdir(tests_d) if fn.startswith(file_pfx))
 
 exclude = cfg.exclude.split(',') if cfg.exclude else []