()
| 22 | |
| 23 | |
| 24 | def execute(): |
| 25 | import os |
| 26 | import sys |
| 27 | |
| 28 | files = None |
| 29 | if "combine" not in sys.argv: |
| 30 | if "--pydev-analyze" in sys.argv: |
| 31 | # Ok, what we want here is having the files passed through stdin (because |
| 32 | # there may be too many files for passing in the command line -- we could |
| 33 | # just pass a dir and make the find files here, but as that's already |
| 34 | # given in the java side, let's just gather that info here). |
| 35 | sys.argv.remove("--pydev-analyze") |
| 36 | s = input() |
| 37 | s = s.replace("\r", "") |
| 38 | s = s.replace("\n", "") |
| 39 | |
| 40 | files = [] |
| 41 | invalid_files = [] |
| 42 | for v in s.split("|"): |
| 43 | if is_valid_py_file(v): |
| 44 | files.append(v) |
| 45 | else: |
| 46 | invalid_files.append(v) |
| 47 | if invalid_files: |
| 48 | sys.stderr.write("Invalid files not passed to coverage: %s\n" % ", ".join(invalid_files)) |
| 49 | |
| 50 | # Note that in this case we'll already be in the working dir with the coverage files, |
| 51 | # so, the coverage file location is not passed. |
| 52 | |
| 53 | else: |
| 54 | # For all commands, the coverage file is configured in pydev, and passed as the first |
| 55 | # argument in the command line, so, let's make sure this gets to the coverage module. |
| 56 | os.environ["COVERAGE_FILE"] = sys.argv[1] |
| 57 | del sys.argv[1] |
| 58 | |
| 59 | try: |
| 60 | import coverage # @UnresolvedImport |
| 61 | except: |
| 62 | sys.stderr.write("Error: coverage module could not be imported\n") |
| 63 | sys.stderr.write("Please make sure that the coverage module (http://nedbatchelder.com/code/coverage/)\n") |
| 64 | sys.stderr.write("is properly installed in your interpreter: %s\n" % (sys.executable,)) |
| 65 | |
| 66 | import traceback |
| 67 | |
| 68 | traceback.print_exc() |
| 69 | return |
| 70 | |
| 71 | if hasattr(coverage, "__version__"): |
| 72 | version = tuple(map(int, coverage.__version__.split(".")[:2])) |
| 73 | if version < (4, 3): |
| 74 | sys.stderr.write( |
| 75 | "Error: minimum supported coverage version is 4.3." |
| 76 | "\nFound: %s\nLocation: %s\n" % (".".join(str(x) for x in version), coverage.__file__) |
| 77 | ) |
| 78 | sys.exit(1) |
| 79 | else: |
| 80 | sys.stderr.write("Warning: Could not determine version of python module coverage.\nEnsure coverage version is >= 4.3\n") |
| 81 |
no test coverage detected