Skip to content

Commit 9b5199d

Browse files
committed
luatest: disable stdout buffering
Follows up #119
1 parent 6e9c7de commit 9b5199d

File tree

1 file changed

+9
-5
lines changed

1 file changed

+9
-5
lines changed

lib/luatest_server.py

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -41,14 +41,17 @@ def execute(self, server):
4141
"""
4242
server.current_test = self
4343
script = os.path.join(os.path.basename(server.testdir), self.name)
44-
command = ['luatest', '-c', '--verbose', script, '--output', 'tap']
44+
45+
# Disable stdout buffering.
46+
command = [server.binary, '-e', "io.stdout:setvbuf('no')"]
47+
# Add luatest as the script.
48+
command.extend([server.luatest])
49+
# Add luatest command-line options.
50+
command.extend(['-c', '--verbose', script, '--output', 'tap'])
4551
if Options().args.pattern:
4652
for p in Options().args.pattern:
4753
command.extend(['--pattern', p])
4854

49-
# Tarantool's build directory is added to PATH in
50-
# TarantoolServer.find_exe().
51-
#
5255
# We start luatest from the project source directory, it
5356
# is the usual way to use luatest.
5457
#
@@ -110,14 +113,15 @@ def find_exe(cls, builddir):
110113
cls.binary = TarantoolServer.binary
111114
cls.debug = bool(re.findall(r'^Target:.*-Debug$', str(cls.version()),
112115
re.M))
116+
cls.luatest = os.environ['TEST_RUN_DIR'] + '/lib/luatest/bin/luatest'
113117

114118
@classmethod
115119
def verify_luatest_exe(cls):
116120
"""Verify that luatest executable is available."""
117121
try:
118122
# Just check that the command returns zero exit code.
119123
with open(os.devnull, 'w') as devnull:
120-
returncode = Popen(['luatest', '--version'],
124+
returncode = Popen([cls.luatest, '--version'],
121125
stdout=devnull,
122126
stderr=devnull).wait()
123127
if returncode != 0:

0 commit comments

Comments
 (0)