summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMatt Clay <matt@mystile.com>2018-11-14 11:03:24 -0800
committerToshio Kuratomi <a.badger@gmail.com>2018-11-14 22:48:31 -0800
commit6dca1d77849ff4ef7ff4f30fbbba32362eb470a9 (patch)
treea67f202a1b38af54f90d351062b284034e5e51a8
parent177160d2168b89e8bcead9c630c67166ed9a6cbd (diff)
downloadansible-6dca1d77849ff4ef7ff4f30fbbba32362eb470a9.tar.gz
Correct ansible-test injector python behavior.
Inject a symlink to the correct python into the copied injector directory instead of altering the shebang of the injector. This has the side-effect of also intercepting `python` for integration tests which simplifies cases where it needs to be directly invoked without collecting code coverage. (cherry picked from commit d6bf45cd9d62e59923df13ffb71900f7dde92497)
-rw-r--r--test/runner/lib/util.py11
1 files changed, 2 insertions, 9 deletions
diff --git a/test/runner/lib/util.py b/test/runner/lib/util.py
index 5087da790a..14f3543b8e 100644
--- a/test/runner/lib/util.py
+++ b/test/runner/lib/util.py
@@ -248,15 +248,6 @@ def get_coverage_path(args, version, interpreter):
shutil.copytree(src, os.path.join(coverage_path, 'coverage'))
shutil.copy('.coveragerc', os.path.join(coverage_path, 'coverage', '.coveragerc'))
- injector = os.path.join(coverage_path, 'coverage', 'injector.py')
-
- with open(injector, 'r+') as injector_fd:
- code = injector_fd.read()
- code = re.sub(r'^#!.*', '#!%s' % interpreter, code, count=1)
- injector_fd.seek(0)
- injector_fd.write(code)
- injector_fd.truncate()
-
for root, dir_names, file_names in os.walk(coverage_path):
for name in dir_names + file_names:
os.chmod(os.path.join(root, name), stat.S_IRWXU | stat.S_IRGRP | stat.S_IXGRP | stat.S_IROTH | stat.S_IXOTH)
@@ -265,6 +256,8 @@ def get_coverage_path(args, version, interpreter):
os.mkdir(os.path.join(coverage_path, directory))
os.chmod(os.path.join(coverage_path, directory), stat.S_IRWXU | stat.S_IRWXG | stat.S_IRWXO)
+ os.symlink(interpreter, os.path.join(coverage_path, 'coverage', 'python'))
+
if not COVERAGE_PATHS:
atexit.register(cleanup_coverage_dirs)