Skip to content

Commit

Permalink
t/python: fix tests for systems with multiple python installations
Browse files Browse the repository at this point in the history
 - use a LOG_DRIVER rather than direct execution
 - rename python tests to have .py extension rather than .t
 - tests now run under the same python interpreter that flux was configured with

This commit adds a thin wrapper around the tap-driver.sh to retain test output
granularity while still ensuring the python tests are executed with the python
interpreter that flux was configured with.
  • Loading branch information
SteVwonder committed Sep 29, 2018
1 parent 9496acd commit 8310bd9
Show file tree
Hide file tree
Showing 11 changed files with 47 additions and 19 deletions.
1 change: 1 addition & 0 deletions Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ SUBDIRS = . src doc etc t

EXTRA_DIST = \
config/tap-driver.sh \
config/tap-driver.py \
DISCLAIMER.LLNS \
README.md

Expand Down
26 changes: 26 additions & 0 deletions config/tap-driver.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
#!/usr/bin/env python
from __future__ import print_function

import sys
import os
from os import path

def main():
arguments = sys.argv[1:] # 0 is me
try:
args_split_point = arguments.index('--')
driver_args = arguments[:args_split_point]
test_command = arguments[args_split_point+1:]
except ValueError:
for idx, value in enumerate(arguments):
if not value.startswith('--'):
driver_args = arguments[:idx]
test_command = arguments[idx:]
break

driver = path.join(path.dirname(path.realpath(__file__)), "tap-driver.sh")
full_command = [driver] + driver_args + ["--", sys.executable] + test_command
os.execv(driver, full_command)

if __name__ == "__main__":
main()
39 changes: 20 additions & 19 deletions t/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -21,14 +21,15 @@ AM_TESTS_ENVIRONMENT = \
test -n "$$LUA_PATH" && export LUA_PATH="$(builddir)/?.lua;$$LUA_PATH";\
test -n "$$FLUX_TEST_INSTALLED_PATH" && \
export LUA_CPATH="$(abs_top_builddir)/src/bindings/lua/.libs/?.so;$$LUA_CPATH;;"; \
PYTHONPATH="$(top_builddir)/src/bindings/python:$(top_srcdir)/t/python/tap:$$PYTHONPATH";
export PYTHONPATH="$(top_builddir)/src/bindings/python:$(top_srcdir)/t/python/tap:$(PYTHON_SITE_PKG):$$PYTHONPATH";

TEST_EXTENSIONS = .t
TEST_EXTENSIONS = .t .py
T_LOG_DRIVER = env AM_TAP_AWK='$(AWK)' $(SHELL) \
$(top_srcdir)/config/tap-driver.sh
$(top_srcdir)/config/tap-driver.sh
PY_LOG_DRIVER = $(PYTHON) $(top_srcdir)/config/tap-driver.py

lua_SCRIPTS = \
fluxometer.lua
fluxometer.lua

install-data-local:
$(INSTALL) -m644 fluxometer/conf.lua.installed \
Expand Down Expand Up @@ -119,14 +120,14 @@ endif

if HAVE_PYTHON
TESTS += \
python/t0001-handle.t \
python/t0002-wrapper.t \
python/t0003-barrier.t \
python/t0004-event.t \
python/t0005-kvs.t \
python/t0006-request.t \
python/t0007-watchers.t \
python/t0008-jsc.t
python/t0001-handle.py \
python/t0002-wrapper.py \
python/t0003-barrier.py \
python/t0004-event.py \
python/t0005-kvs.py \
python/t0006-request.py \
python/t0007-watchers.py \
python/t0008-jsc.py
endif

EXTRA_DIST= \
Expand Down Expand Up @@ -223,13 +224,13 @@ check_SCRIPTS = \
python/__init__.py \
python/subflux.py \
python/tap \
python/t0001-handle.t \
python/t0002-wrapper.t \
python/t0003-barrier.t \
python/t0004-event.t \
python/t0005-kvs.t \
python/t0006-request.t \
python/t0007-watchers.t \
python/t0001-handle.py \
python/t0002-wrapper.py \
python/t0003-barrier.py \
python/t0004-event.py \
python/t0005-kvs.py \
python/t0006-request.py \
python/t0007-watchers.py \
python/t0008-jsc.py

check_PROGRAMS = \
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.

0 comments on commit 8310bd9

Please sign in to comment.