Skip to content

Commit e4e764f

Browse files
committed
python3: make path to unit test absolute
When Tarantool unit tests runs using test-run error with output like below may happen: [027] small/small_class.test [027] Test.run() received the following error: [027] Traceback (most recent call last): [027] File "/__w/tarantool/tarantool/test-run/lib/test.py", line 192, in run [027] self.execute(server) [027] File "/__w/tarantool/tarantool/test-run/lib/unittest_server.py", line 20, in execute [027] proc = Popen(execs, cwd=server.vardir, stdout=PIPE, stderr=STDOUT) [027] File "/usr/lib/python3.5/subprocess.py", line 676, in __init__ [027] restore_signals, start_new_session) [027] File "/usr/lib/python3.5/subprocess.py", line 1282, in _execute_child [027] raise child_exception_type(errno_num, err_msg) [027] FileNotFoundError: [Errno 2] No such file or directory: '../test/small/small_class.test' [027] [ fail ] The root cause of error is changed behaviour of Popen in Python 3 in comparison to Python 2. One should explicitly set path to a current work dir: Python 2 [1]: "If cwd is not None, the child’s current directory will be changed to cwd before it is executed. Note that this directory is not considered when searching the executable, so you can’t specify the program’s path relative to cwd." Python 3 [2]: "If cwd is not None, the function changes the working directory to cwd before executing the child. <...> In particular, the function looks for executable (or for the first item in args) relative to cwd if the executable path is a relative path." 1. https://docs.python.org/2/library/subprocess.html#subprocess.Popen 2. https://docs.python.org/3/library/subprocess.html#subprocess.Popen Part of #20
1 parent 046c958 commit e4e764f

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

lib/unittest_server.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ def binary(self):
5050
def prepare_args(self, args=[]):
5151
executable_path = os.path.join(self.builddir, "test",
5252
self.current_test.name)
53-
return [executable_path] + args
53+
return [os.path.abspath(executable_path)] + args
5454

5555
def deploy(self, vardir=None, silent=True, wait=True):
5656
self.vardir = vardir

0 commit comments

Comments
 (0)