Browse Source

overlay_setup(): use passed value of repo_root

The MMGen Project 3 years ago
parent
commit
554670b713
7 changed files with 7 additions and 8 deletions
  1. 1 1
      scripts/exec_wrapper.py
  2. 1 1
      test/gentest.py
  3. 1 1
      test/objtest.py
  4. 1 2
      test/overlay/__init__.py
  5. 1 1
      test/test.py
  6. 1 1
      test/tooltest.py
  7. 1 1
      test/tooltest2.py

+ 1 - 1
scripts/exec_wrapper.py

@@ -19,7 +19,7 @@ def exec_wrapper_init(): # don't change: name is used to test if script is runni
 		sys.path[0] = 'test'
 	else:
 		from test.overlay import overlay_setup
-		sys.path[0] = overlay_setup()
+		sys.path[0] = overlay_setup(repo_root=os.getcwd()) # assume we're in the repo root
 
 	os.environ['MMGEN_TRACEBACK'] = '1'
 	os.environ['PYTHONPATH'] = '.'

+ 1 - 1
test/gentest.py

@@ -24,7 +24,7 @@ import sys,os
 
 from include.tests_header import repo_root
 from test.overlay import overlay_setup
-sys.path.insert(0,overlay_setup())
+sys.path.insert(0,overlay_setup(repo_root))
 
 # Import these _after_ local path's been added to sys.path
 from mmgen.common import *

+ 1 - 1
test/objtest.py

@@ -24,7 +24,7 @@ import sys,os,re
 
 from include.tests_header import repo_root
 from test.overlay import overlay_setup
-sys.path.insert(0,overlay_setup())
+sys.path.insert(0,overlay_setup(repo_root))
 
 os.environ['MMGEN_TEST_SUITE'] = '1'
 

+ 1 - 2
test/overlay/__init__.py

@@ -1,6 +1,6 @@
 import sys,os
 
-def overlay_setup():
+def overlay_setup(repo_root):
 
 	def process_srcdir(d):
 		srcdir = os.path.join(repo_root,*d.split('.'))
@@ -23,7 +23,6 @@ def overlay_setup():
 					os.path.join(srcdir,fn),
 					os.path.join(destdir,link_fn) )
 
-	repo_root = os.path.dirname(os.path.abspath(os.path.dirname(sys.argv[0])))
 	overlay_dir = os.path.join(repo_root,'test','overlay','tree')
 	fakemod_dir = os.path.join(repo_root,'test','overlay','fakemods')
 	fakemods  = os.listdir(fakemod_dir)

+ 1 - 1
test/test.py

@@ -74,7 +74,7 @@ import sys,os,time
 
 from include.tests_header import repo_root
 from test.overlay import overlay_setup
-overlay_dir = overlay_setup()
+overlay_dir = overlay_setup(repo_root)
 sys.path.insert(0,overlay_dir)
 
 try: os.unlink(os.path.join(repo_root,'my.err'))

+ 1 - 1
test/tooltest.py

@@ -25,7 +25,7 @@ from subprocess import run,PIPE
 
 from include.tests_header import repo_root
 from test.overlay import overlay_setup
-sys.path.insert(0,overlay_setup())
+sys.path.insert(0,overlay_setup(repo_root))
 
 from mmgen.common import *
 from test.include.common import *

+ 1 - 1
test/tooltest2.py

@@ -29,7 +29,7 @@ from decimal import Decimal
 
 from include.tests_header import repo_root
 from test.overlay import overlay_setup
-sys.path.insert(0,overlay_setup())
+sys.path.insert(0,overlay_setup(repo_root))
 
 from mmgen.common import *
 from test.include.common import *