Skip to content
This repository has been archived by the owner on Apr 20, 2023. It is now read-only.

failed to exec coverage #71

Closed
jayvdb opened this issue Jul 27, 2016 · 3 comments · Fixed by #202
Closed

failed to exec coverage #71

jayvdb opened this issue Jul 27, 2016 · 3 comments · Fixed by #202

Comments

@jayvdb
Copy link
Contributor

jayvdb commented Jul 27, 2016

On Windows, if the Python "Scripts" directory is not in the PATH, and codecov is invoked like C:\...\Scripts\codecov, try_to_run will fail to exec coverage. The same could happen on Unix, but it is less likely.

This can be avoided a few ways, e.g. by calling coverage as a Python package, adding the "Scripts" directory to the PATH for the exec, using sys.executable -m coverage on Python 2.7+, etc.

@stevepeak
Copy link
Contributor

Thanks for expressing this issue @jayvdb.

Would you recommend us trying something like:

if try_to_run('coverage xml') fails:
  try_to_run('sys.executable -m coverage')

@jayvdb
Copy link
Contributor Author

jayvdb commented Jul 28, 2016

On Py2.7+, then yes, if the failure was that coverage was not found.
Rather than trying to work out why coverage xml failed, on Python 2.7+ the approach should be to check if coverage exists , then invoke sys.executable.

try:
    import coverage
    try_to_run('sys.executable -m coverage xml')
except ImportError:
    try_to_run('coverage xml')

Py2.6 has problems with -m , and I am not sure that it can be worked around.

However. if you can import and use coverage within Python, rather than creating a subprocess, that would work on Py 2.6, be faster, and give greater control over how coverage failures.

takluyver added a commit to takluyver/codecov-python that referenced this issue Jun 3, 2019
This means coverage can still be called to convert its data to XML even if it's not on PATH.

Closes codecov#71.
@takluyver
Copy link
Contributor

#202 is my attempt to fix this.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants