I'm having trouble getting the "coverage" module for Python working correctly.
I have no permissions to modify or add to Python directory, so am unable to install easy_install to setup coverage.
Worked around this by adding the coverage directory to my python path.
Coverage works fine, inputting coverage --version
to shell outputs the version. coverage help
displays all the commands available. Everything seems fine.
I can run coverage fine on small simple scripts.
However, when running a large script with a number of imports across 5 modules (a script that has been tested as working), when running the command with coverage run [normal commands]
, the script executes and fails, because some modules cannot be found.
Here's a breakdown:
Command line without coverage (working fine):
I invoke the script by running: ./script_name.py arg1 arg2 arg3
When I try running the script by inputting: python script_name.py arg1 arg2 arg3
, the script fails, failing to import modules:
ImportError: No module named cx_Oracle
Command line with coverage:
$ coverage run ./script_name.py arg1 arg2 arg3
"No file to run: 'main.py'"
$ coverage run {full_path_to_module_name}/script_name.py arg1 arg2 arg3
Now we are getting somewhere. Coverage is clearly invoked and working, but I get that import error:
ImportError: No module named cx_Oracle