codecov-cli 0.3.3__tar.gz → 0.3.4__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {codecov-cli-0.3.3/codecov_cli.egg-info → codecov-cli-0.3.4}/PKG-INFO +1 -1
- codecov-cli-0.3.4/codecov_cli/__init__.py +4 -0
- {codecov-cli-0.3.3 → codecov-cli-0.3.4}/codecov_cli/commands/upload.py +9 -0
- {codecov-cli-0.3.3 → codecov-cli-0.3.4}/codecov_cli/commands/upload_process.py +3 -0
- {codecov-cli-0.3.3 → codecov-cli-0.3.4}/codecov_cli/runners/python_standard_runner.py +3 -115
- {codecov-cli-0.3.3 → codecov-cli-0.3.4}/codecov_cli/services/staticanalysis/__init__.py +35 -19
- {codecov-cli-0.3.3 → codecov-cli-0.3.4}/codecov_cli/services/upload/__init__.py +2 -1
- {codecov-cli-0.3.3 → codecov-cli-0.3.4}/codecov_cli/services/upload/upload_collector.py +3 -1
- {codecov-cli-0.3.3 → codecov-cli-0.3.4/codecov_cli.egg-info}/PKG-INFO +1 -1
- {codecov-cli-0.3.3 → codecov-cli-0.3.4}/codecov_cli.egg-info/requires.txt +0 -2
- {codecov-cli-0.3.3 → codecov-cli-0.3.4}/setup.py +2 -4
- codecov-cli-0.3.3/codecov_cli/__init__.py +0 -1
- {codecov-cli-0.3.3 → codecov-cli-0.3.4}/LICENSE +0 -0
- {codecov-cli-0.3.3 → codecov-cli-0.3.4}/MANIFEST.in +0 -0
- {codecov-cli-0.3.3 → codecov-cli-0.3.4}/README.md +0 -0
- {codecov-cli-0.3.3 → codecov-cli-0.3.4}/codecov_cli/commands/__init__.py +0 -0
- {codecov-cli-0.3.3 → codecov-cli-0.3.4}/codecov_cli/commands/base_picking.py +0 -0
- {codecov-cli-0.3.3 → codecov-cli-0.3.4}/codecov_cli/commands/commit.py +0 -0
- {codecov-cli-0.3.3 → codecov-cli-0.3.4}/codecov_cli/commands/create_report_result.py +0 -0
- {codecov-cli-0.3.3 → codecov-cli-0.3.4}/codecov_cli/commands/empty_upload.py +0 -0
- {codecov-cli-0.3.3 → codecov-cli-0.3.4}/codecov_cli/commands/get_report_results.py +0 -0
- {codecov-cli-0.3.3 → codecov-cli-0.3.4}/codecov_cli/commands/labelanalysis.py +0 -0
- {codecov-cli-0.3.3 → codecov-cli-0.3.4}/codecov_cli/commands/report.py +0 -0
- {codecov-cli-0.3.3 → codecov-cli-0.3.4}/codecov_cli/commands/send_notifications.py +0 -0
- {codecov-cli-0.3.3 → codecov-cli-0.3.4}/codecov_cli/commands/staticanalysis.py +0 -0
- {codecov-cli-0.3.3 → codecov-cli-0.3.4}/codecov_cli/fallbacks.py +0 -0
- {codecov-cli-0.3.3 → codecov-cli-0.3.4}/codecov_cli/helpers/__init__.py +0 -0
- {codecov-cli-0.3.3 → codecov-cli-0.3.4}/codecov_cli/helpers/ci_adapters/__init__.py +0 -0
- {codecov-cli-0.3.3 → codecov-cli-0.3.4}/codecov_cli/helpers/ci_adapters/appveyor_ci.py +0 -0
- {codecov-cli-0.3.3 → codecov-cli-0.3.4}/codecov_cli/helpers/ci_adapters/azure_pipelines.py +0 -0
- {codecov-cli-0.3.3 → codecov-cli-0.3.4}/codecov_cli/helpers/ci_adapters/base.py +0 -0
- {codecov-cli-0.3.3 → codecov-cli-0.3.4}/codecov_cli/helpers/ci_adapters/bitbucket_ci.py +0 -0
- {codecov-cli-0.3.3 → codecov-cli-0.3.4}/codecov_cli/helpers/ci_adapters/bitrise_ci.py +0 -0
- {codecov-cli-0.3.3 → codecov-cli-0.3.4}/codecov_cli/helpers/ci_adapters/buildkite.py +0 -0
- {codecov-cli-0.3.3 → codecov-cli-0.3.4}/codecov_cli/helpers/ci_adapters/circleci.py +0 -0
- {codecov-cli-0.3.3 → codecov-cli-0.3.4}/codecov_cli/helpers/ci_adapters/cirrus_ci.py +0 -0
- {codecov-cli-0.3.3 → codecov-cli-0.3.4}/codecov_cli/helpers/ci_adapters/codebuild.py +0 -0
- {codecov-cli-0.3.3 → codecov-cli-0.3.4}/codecov_cli/helpers/ci_adapters/droneci.py +0 -0
- {codecov-cli-0.3.3 → codecov-cli-0.3.4}/codecov_cli/helpers/ci_adapters/github_actions.py +0 -0
- {codecov-cli-0.3.3 → codecov-cli-0.3.4}/codecov_cli/helpers/ci_adapters/gitlab_ci.py +0 -0
- {codecov-cli-0.3.3 → codecov-cli-0.3.4}/codecov_cli/helpers/ci_adapters/heroku.py +0 -0
- {codecov-cli-0.3.3 → codecov-cli-0.3.4}/codecov_cli/helpers/ci_adapters/jenkins.py +0 -0
- {codecov-cli-0.3.3 → codecov-cli-0.3.4}/codecov_cli/helpers/ci_adapters/local.py +0 -0
- {codecov-cli-0.3.3 → codecov-cli-0.3.4}/codecov_cli/helpers/ci_adapters/teamcity.py +0 -0
- {codecov-cli-0.3.3 → codecov-cli-0.3.4}/codecov_cli/helpers/ci_adapters/travis_ci.py +0 -0
- {codecov-cli-0.3.3 → codecov-cli-0.3.4}/codecov_cli/helpers/ci_adapters/woodpeckerci.py +0 -0
- {codecov-cli-0.3.3 → codecov-cli-0.3.4}/codecov_cli/helpers/config.py +0 -0
- {codecov-cli-0.3.3 → codecov-cli-0.3.4}/codecov_cli/helpers/encoder.py +0 -0
- {codecov-cli-0.3.3 → codecov-cli-0.3.4}/codecov_cli/helpers/folder_searcher.py +0 -0
- {codecov-cli-0.3.3 → codecov-cli-0.3.4}/codecov_cli/helpers/git.py +0 -0
- {codecov-cli-0.3.3 → codecov-cli-0.3.4}/codecov_cli/helpers/logging_utils.py +0 -0
- {codecov-cli-0.3.3 → codecov-cli-0.3.4}/codecov_cli/helpers/options.py +0 -0
- {codecov-cli-0.3.3 → codecov-cli-0.3.4}/codecov_cli/helpers/request.py +0 -0
- {codecov-cli-0.3.3 → codecov-cli-0.3.4}/codecov_cli/helpers/validators.py +0 -0
- {codecov-cli-0.3.3 → codecov-cli-0.3.4}/codecov_cli/helpers/versioning_systems.py +0 -0
- {codecov-cli-0.3.3 → codecov-cli-0.3.4}/codecov_cli/main.py +0 -0
- {codecov-cli-0.3.3 → codecov-cli-0.3.4}/codecov_cli/plugins/__init__.py +0 -0
- {codecov-cli-0.3.3 → codecov-cli-0.3.4}/codecov_cli/plugins/compress_pycoverage_contexts.py +0 -0
- {codecov-cli-0.3.3 → codecov-cli-0.3.4}/codecov_cli/plugins/gcov.py +0 -0
- {codecov-cli-0.3.3 → codecov-cli-0.3.4}/codecov_cli/plugins/pycoverage.py +0 -0
- {codecov-cli-0.3.3 → codecov-cli-0.3.4}/codecov_cli/plugins/types.py +0 -0
- {codecov-cli-0.3.3 → codecov-cli-0.3.4}/codecov_cli/plugins/xcode.py +0 -0
- {codecov-cli-0.3.3 → codecov-cli-0.3.4}/codecov_cli/runners/__init__.py +0 -0
- {codecov-cli-0.3.3 → codecov-cli-0.3.4}/codecov_cli/runners/dan_runner.py +0 -0
- {codecov-cli-0.3.3 → codecov-cli-0.3.4}/codecov_cli/runners/types.py +0 -0
- {codecov-cli-0.3.3 → codecov-cli-0.3.4}/codecov_cli/services/__init__.py +0 -0
- {codecov-cli-0.3.3 → codecov-cli-0.3.4}/codecov_cli/services/commit/__init__.py +0 -0
- {codecov-cli-0.3.3 → codecov-cli-0.3.4}/codecov_cli/services/commit/base_picking.py +0 -0
- {codecov-cli-0.3.3 → codecov-cli-0.3.4}/codecov_cli/services/empty_upload/__init__.py +0 -0
- {codecov-cli-0.3.3 → codecov-cli-0.3.4}/codecov_cli/services/report/__init__.py +0 -0
- {codecov-cli-0.3.3 → codecov-cli-0.3.4}/codecov_cli/services/staticanalysis/analyzers/__init__.py +0 -0
- {codecov-cli-0.3.3 → codecov-cli-0.3.4}/codecov_cli/services/staticanalysis/analyzers/general.py +0 -0
- {codecov-cli-0.3.3 → codecov-cli-0.3.4}/codecov_cli/services/staticanalysis/analyzers/javascript_es6/__init__.py +0 -0
- {codecov-cli-0.3.3 → codecov-cli-0.3.4}/codecov_cli/services/staticanalysis/analyzers/javascript_es6/node_wrappers.py +0 -0
- {codecov-cli-0.3.3 → codecov-cli-0.3.4}/codecov_cli/services/staticanalysis/analyzers/python/__init__.py +0 -0
- {codecov-cli-0.3.3 → codecov-cli-0.3.4}/codecov_cli/services/staticanalysis/analyzers/python/node_wrappers.py +0 -0
- {codecov-cli-0.3.3 → codecov-cli-0.3.4}/codecov_cli/services/staticanalysis/exceptions.py +0 -0
- {codecov-cli-0.3.3 → codecov-cli-0.3.4}/codecov_cli/services/staticanalysis/finders.py +0 -0
- {codecov-cli-0.3.3 → codecov-cli-0.3.4}/codecov_cli/services/staticanalysis/types.py +0 -0
- {codecov-cli-0.3.3 → codecov-cli-0.3.4}/codecov_cli/services/upload/coverage_file_finder.py +0 -0
- {codecov-cli-0.3.3 → codecov-cli-0.3.4}/codecov_cli/services/upload/legacy_upload_sender.py +0 -0
- {codecov-cli-0.3.3 → codecov-cli-0.3.4}/codecov_cli/services/upload/network_finder.py +0 -0
- {codecov-cli-0.3.3 → codecov-cli-0.3.4}/codecov_cli/services/upload/upload_sender.py +0 -0
- {codecov-cli-0.3.3 → codecov-cli-0.3.4}/codecov_cli/services/upload_completion/__init__.py +0 -0
- {codecov-cli-0.3.3 → codecov-cli-0.3.4}/codecov_cli/types.py +0 -0
- {codecov-cli-0.3.3 → codecov-cli-0.3.4}/codecov_cli.egg-info/SOURCES.txt +0 -0
- {codecov-cli-0.3.3 → codecov-cli-0.3.4}/codecov_cli.egg-info/dependency_links.txt +0 -0
- {codecov-cli-0.3.3 → codecov-cli-0.3.4}/codecov_cli.egg-info/entry_points.txt +0 -0
- {codecov-cli-0.3.3 → codecov-cli-0.3.4}/codecov_cli.egg-info/top_level.txt +0 -0
- {codecov-cli-0.3.3 → codecov-cli-0.3.4}/languages/languages.c +0 -0
- {codecov-cli-0.3.3 → codecov-cli-0.3.4}/languages/treesitterjavascript/src/parser.c +0 -0
- {codecov-cli-0.3.3 → codecov-cli-0.3.4}/languages/treesitterjavascript/src/scanner.c +0 -0
- {codecov-cli-0.3.3 → codecov-cli-0.3.4}/languages/treesitterjavascript/src/tree_sitter/parser.h +0 -0
- {codecov-cli-0.3.3 → codecov-cli-0.3.4}/languages/treesitterpython/src/parser.c +0 -0
- {codecov-cli-0.3.3 → codecov-cli-0.3.4}/languages/treesitterpython/src/scanner.cc +0 -0
- {codecov-cli-0.3.3 → codecov-cli-0.3.4}/languages/treesitterpython/src/tree_sitter/parser.h +0 -0
- {codecov-cli-0.3.3 → codecov-cli-0.3.4}/setup.cfg +0 -0
|
@@ -65,6 +65,12 @@ _global_upload_options = [
|
|
|
65
65
|
is_flag=True,
|
|
66
66
|
default=False,
|
|
67
67
|
),
|
|
68
|
+
click.option(
|
|
69
|
+
"--disable-file-fixes",
|
|
70
|
+
help="Disable file fixes to ignore common lines from coverage (e.g. blank lines or empty brackets)",
|
|
71
|
+
is_flag=True,
|
|
72
|
+
default=False,
|
|
73
|
+
),
|
|
68
74
|
click.option(
|
|
69
75
|
"-b",
|
|
70
76
|
"--build",
|
|
@@ -178,6 +184,7 @@ def do_upload(
|
|
|
178
184
|
coverage_files_search_exclude_folders: typing.List[pathlib.Path],
|
|
179
185
|
coverage_files_search_explicitly_listed_files: typing.List[pathlib.Path],
|
|
180
186
|
disable_search: bool,
|
|
187
|
+
disable_file_fixes: bool,
|
|
181
188
|
token: typing.Optional[uuid.UUID],
|
|
182
189
|
plugin_names: typing.List[str],
|
|
183
190
|
branch: typing.Optional[str],
|
|
@@ -218,6 +225,7 @@ def do_upload(
|
|
|
218
225
|
git_service=git_service,
|
|
219
226
|
enterprise_url=enterprise_url,
|
|
220
227
|
disable_search=disable_search,
|
|
228
|
+
disable_file_fixes=disable_file_fixes,
|
|
221
229
|
handle_no_reports_found=handle_no_reports_found,
|
|
222
230
|
)
|
|
223
231
|
),
|
|
@@ -254,4 +262,5 @@ def do_upload(
|
|
|
254
262
|
enterprise_url=enterprise_url,
|
|
255
263
|
disable_search=disable_search,
|
|
256
264
|
handle_no_reports_found=handle_no_reports_found,
|
|
265
|
+
disable_file_fixes=disable_file_fixes,
|
|
257
266
|
)
|
|
@@ -37,6 +37,7 @@ def upload_process(
|
|
|
37
37
|
coverage_files_search_exclude_folders: typing.List[pathlib.Path],
|
|
38
38
|
coverage_files_search_explicitly_listed_files: typing.List[pathlib.Path],
|
|
39
39
|
disable_search: bool,
|
|
40
|
+
disable_file_fixes: bool,
|
|
40
41
|
token: typing.Optional[uuid.UUID],
|
|
41
42
|
plugin_names: typing.List[str],
|
|
42
43
|
branch: typing.Optional[str],
|
|
@@ -72,6 +73,7 @@ def upload_process(
|
|
|
72
73
|
pull_request_number=pull_request_number,
|
|
73
74
|
git_service=git_service,
|
|
74
75
|
disable_search=disable_search,
|
|
76
|
+
disable_file_fixes=disable_file_fixes,
|
|
75
77
|
fail_on_error=fail_on_error,
|
|
76
78
|
handle_no_reports_found=handle_no_reports_found,
|
|
77
79
|
)
|
|
@@ -123,4 +125,5 @@ def upload_process(
|
|
|
123
125
|
dry_run=dry_run,
|
|
124
126
|
git_service=git_service,
|
|
125
127
|
handle_no_reports_found=handle_no_reports_found,
|
|
128
|
+
disable_file_fixes=disable_file_fixes,
|
|
126
129
|
)
|
|
@@ -1,17 +1,11 @@
|
|
|
1
1
|
import logging
|
|
2
2
|
import random
|
|
3
3
|
import subprocess
|
|
4
|
-
from contextlib import redirect_stdout
|
|
5
|
-
from io import StringIO, TextIOWrapper
|
|
6
|
-
from multiprocessing import Process, Queue, get_context
|
|
7
|
-
from os import getcwd
|
|
8
|
-
from queue import Empty
|
|
9
4
|
from subprocess import CalledProcessError
|
|
10
|
-
from sys import
|
|
5
|
+
from sys import stdout
|
|
11
6
|
from typing import List, Optional
|
|
12
7
|
|
|
13
8
|
import click
|
|
14
|
-
import pytest
|
|
15
9
|
|
|
16
10
|
from codecov_cli.runners.types import (
|
|
17
11
|
LabelAnalysisRequestResult,
|
|
@@ -43,58 +37,6 @@ class PythonStandardRunnerConfigParams(dict):
|
|
|
43
37
|
"""
|
|
44
38
|
return self.get("coverage_root", "./")
|
|
45
39
|
|
|
46
|
-
@property
|
|
47
|
-
def strict_mode(self) -> bool:
|
|
48
|
-
"""
|
|
49
|
-
Run pytest from within Python instead of using subprocess.run
|
|
50
|
-
This is potentailly safer than using subprocess.run because it guarantees better that
|
|
51
|
-
the program running is indeed pytest.
|
|
52
|
-
But it might not work everytime due to import issues related to Python caching modules.
|
|
53
|
-
"""
|
|
54
|
-
return self.get("strict_mode", False)
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
def _include_curr_dir(method):
|
|
58
|
-
"""
|
|
59
|
-
Account for the difference 'pytest' vs 'python -m pytest'
|
|
60
|
-
https://docs.pytest.org/en/7.1.x/how-to/usage.html#calling-pytest-through-python-m-pytest
|
|
61
|
-
Used only in strict_mode
|
|
62
|
-
"""
|
|
63
|
-
|
|
64
|
-
def call_method(self, *args, **kwargs):
|
|
65
|
-
curr_dir = getcwd()
|
|
66
|
-
path.append(curr_dir)
|
|
67
|
-
|
|
68
|
-
result = method(self, *args, **kwargs)
|
|
69
|
-
|
|
70
|
-
path.remove(curr_dir)
|
|
71
|
-
return result
|
|
72
|
-
|
|
73
|
-
return call_method
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
def _execute_pytest_subprocess(
|
|
77
|
-
pytest_args: List[str],
|
|
78
|
-
queue: Queue,
|
|
79
|
-
parent_stdout: TextIOWrapper,
|
|
80
|
-
capture_output: bool = True,
|
|
81
|
-
):
|
|
82
|
-
"""Runs pytest from python in a subprocess.
|
|
83
|
-
This is because we call it twice in the label-analysis process,
|
|
84
|
-
so we might have import errors if calling it directly.
|
|
85
|
-
Check the warning: https://docs.pytest.org/en/7.1.x/how-to/usage.html#calling-pytest-from-python-code
|
|
86
|
-
|
|
87
|
-
Returns the output value and pytest exit code via queue
|
|
88
|
-
"""
|
|
89
|
-
subproces_stdout = parent_stdout
|
|
90
|
-
if capture_output:
|
|
91
|
-
subproces_stdout = StringIO()
|
|
92
|
-
with redirect_stdout(subproces_stdout):
|
|
93
|
-
result = pytest.main(pytest_args)
|
|
94
|
-
if capture_output:
|
|
95
|
-
queue.put({"output": subproces_stdout.getvalue()})
|
|
96
|
-
queue.put({"result": result})
|
|
97
|
-
|
|
98
40
|
|
|
99
41
|
class PythonStandardRunner(LabelAnalysisRunnerInterface):
|
|
100
42
|
|
|
@@ -106,54 +48,6 @@ class PythonStandardRunner(LabelAnalysisRunnerInterface):
|
|
|
106
48
|
config_params = {}
|
|
107
49
|
self.params = PythonStandardRunnerConfigParams(config_params)
|
|
108
50
|
|
|
109
|
-
def _wait_pytest(self, pytest_process: Process, queue: Queue):
|
|
110
|
-
pytest_process.start()
|
|
111
|
-
result = None
|
|
112
|
-
output = None
|
|
113
|
-
while pytest_process.exitcode == 0 or pytest_process.exitcode == None:
|
|
114
|
-
from_queue = None
|
|
115
|
-
try:
|
|
116
|
-
from_queue = queue.get(timeout=1)
|
|
117
|
-
except Empty:
|
|
118
|
-
pass
|
|
119
|
-
if from_queue and "output" in from_queue:
|
|
120
|
-
output = from_queue["output"]
|
|
121
|
-
if from_queue and "result" in from_queue:
|
|
122
|
-
result = from_queue["result"]
|
|
123
|
-
if result is not None:
|
|
124
|
-
break
|
|
125
|
-
pytest_process.join()
|
|
126
|
-
return result, output
|
|
127
|
-
|
|
128
|
-
@_include_curr_dir
|
|
129
|
-
def _execute_pytest_strict(
|
|
130
|
-
self, pytest_args: List[str], capture_output: bool = True
|
|
131
|
-
) -> str:
|
|
132
|
-
"""Handles calling pytest from Python in a subprocess.
|
|
133
|
-
Raises Exception if pytest fails
|
|
134
|
-
Returns the complete pytest output
|
|
135
|
-
"""
|
|
136
|
-
ctx = get_context(method="fork")
|
|
137
|
-
queue = ctx.Queue(2)
|
|
138
|
-
p = ctx.Process(
|
|
139
|
-
target=_execute_pytest_subprocess,
|
|
140
|
-
args=[pytest_args, queue, stdout, capture_output],
|
|
141
|
-
)
|
|
142
|
-
result, output = self._wait_pytest(p, queue)
|
|
143
|
-
|
|
144
|
-
if p.exitcode != 0 or (result != pytest.ExitCode.OK and result != 0):
|
|
145
|
-
message = f"Pytest exited with non-zero code {result}."
|
|
146
|
-
message += "\nThis is likely not a problem with label-analysis. Check pytest's output and options."
|
|
147
|
-
if capture_output:
|
|
148
|
-
# If pytest failed but we captured its output the user won't know what's wrong
|
|
149
|
-
# So we need to include that in the error message
|
|
150
|
-
message += "\nPYTEST OUTPUT:"
|
|
151
|
-
message += "\n" + output
|
|
152
|
-
else:
|
|
153
|
-
message += "\n(you can check pytest options on the logs before the test session start)"
|
|
154
|
-
raise click.ClickException(message)
|
|
155
|
-
return output
|
|
156
|
-
|
|
157
51
|
def parse_captured_output_error(self, exp: CalledProcessError) -> str:
|
|
158
52
|
result = ""
|
|
159
53
|
for out_stream in [exp.stdout, exp.stderr]:
|
|
@@ -202,10 +96,7 @@ class PythonStandardRunner(LabelAnalysisRunnerInterface):
|
|
|
202
96
|
),
|
|
203
97
|
)
|
|
204
98
|
|
|
205
|
-
|
|
206
|
-
output = self._execute_pytest_strict(options_to_use)
|
|
207
|
-
else:
|
|
208
|
-
output = self._execute_pytest(options_to_use)
|
|
99
|
+
output = self._execute_pytest(options_to_use)
|
|
209
100
|
lines = output.split(sep="\n")
|
|
210
101
|
test_names = list(line for line in lines if ("::" in line and "test" in line))
|
|
211
102
|
return test_names
|
|
@@ -254,10 +145,7 @@ class PythonStandardRunner(LabelAnalysisRunnerInterface):
|
|
|
254
145
|
"List of tests executed",
|
|
255
146
|
extra=dict(extra_log_attributes=dict(executed_tests=tests_to_run)),
|
|
256
147
|
)
|
|
257
|
-
|
|
258
|
-
output = self._execute_pytest_strict(command_array, capture_output=False)
|
|
259
|
-
else:
|
|
260
|
-
output = self._execute_pytest(command_array, capture_output=False)
|
|
148
|
+
output = self._execute_pytest(command_array, capture_output=False)
|
|
261
149
|
logger.info(f"Finished running {len(tests_to_run)} tests successfully")
|
|
262
150
|
logger.info(f" pytest options: \"{' '.join(default_options)}\"")
|
|
263
151
|
logger.debug(output)
|
|
@@ -109,7 +109,14 @@ async def run_analysis_entrypoint(
|
|
|
109
109
|
for el in files_that_need_upload:
|
|
110
110
|
all_tasks.append(send_single_upload_put(client, all_data, el))
|
|
111
111
|
bar.update(1, all_data[el["filepath"]])
|
|
112
|
-
|
|
112
|
+
try:
|
|
113
|
+
resps = await asyncio.gather(*all_tasks)
|
|
114
|
+
except asyncio.CancelledError:
|
|
115
|
+
message = (
|
|
116
|
+
"Unknown error cancelled the upload tasks.\n"
|
|
117
|
+
+ f"Uploaded {len(uploaded_files)}/{len(files_that_need_upload)} files successfully."
|
|
118
|
+
)
|
|
119
|
+
raise click.ClickException(message)
|
|
113
120
|
for resp in resps:
|
|
114
121
|
if resp["succeeded"]:
|
|
115
122
|
uploaded_files.append(resp["filepath"])
|
|
@@ -188,35 +195,44 @@ async def process_files(
|
|
|
188
195
|
)
|
|
189
196
|
|
|
190
197
|
|
|
191
|
-
async def send_single_upload_put(client, all_data, el):
|
|
198
|
+
async def send_single_upload_put(client, all_data, el) -> typing.Dict:
|
|
192
199
|
retryable_statuses = (429,)
|
|
193
200
|
presigned_put = el["raw_upload_location"]
|
|
194
201
|
number_retries = 5
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
202
|
+
try:
|
|
203
|
+
for current_retry in range(number_retries):
|
|
204
|
+
response = await client.put(
|
|
205
|
+
presigned_put, data=json.dumps(all_data[el["filepath"]])
|
|
206
|
+
)
|
|
207
|
+
if response.status_code < 300:
|
|
208
|
+
return {
|
|
209
|
+
"status_code": response.status_code,
|
|
210
|
+
"filepath": el["filepath"],
|
|
211
|
+
"succeeded": True,
|
|
212
|
+
}
|
|
213
|
+
if response.status_code in retryable_statuses:
|
|
214
|
+
await asyncio.sleep(2**current_retry)
|
|
215
|
+
status_code = response.status_code
|
|
216
|
+
message_to_warn = response.text
|
|
217
|
+
exception = None
|
|
218
|
+
except httpx.HTTPError as exp:
|
|
219
|
+
status_code = None
|
|
220
|
+
exception = type(exp)
|
|
221
|
+
message_to_warn = str(exp)
|
|
207
222
|
logger.warning(
|
|
208
|
-
"Unable to send
|
|
223
|
+
"Unable to send single_upload_put",
|
|
209
224
|
extra=dict(
|
|
210
225
|
extra_log_attributes=dict(
|
|
211
|
-
|
|
226
|
+
message=message_to_warn,
|
|
227
|
+
exception=exception,
|
|
212
228
|
filepath=el["filepath"],
|
|
213
|
-
|
|
214
|
-
latest_status_code=response.status_code,
|
|
229
|
+
latest_status_code=status_code,
|
|
215
230
|
)
|
|
216
231
|
),
|
|
217
232
|
)
|
|
218
233
|
return {
|
|
219
|
-
"status_code":
|
|
234
|
+
"status_code": status_code,
|
|
235
|
+
"exception": exception,
|
|
220
236
|
"filepath": el["filepath"],
|
|
221
237
|
"succeeded": False,
|
|
222
238
|
}
|
|
@@ -50,6 +50,7 @@ def do_upload_logic(
|
|
|
50
50
|
enterprise_url: typing.Optional[str],
|
|
51
51
|
disable_search: bool = False,
|
|
52
52
|
handle_no_reports_found: bool = False,
|
|
53
|
+
disable_file_fixes: bool = False,
|
|
53
54
|
):
|
|
54
55
|
preparation_plugins = select_preparation_plugins(cli_config, plugin_names)
|
|
55
56
|
coverage_file_selector = select_coverage_file_finder(
|
|
@@ -60,7 +61,7 @@ def do_upload_logic(
|
|
|
60
61
|
)
|
|
61
62
|
network_finder = select_network_finder(versioning_system)
|
|
62
63
|
collector = UploadCollector(
|
|
63
|
-
preparation_plugins, network_finder, coverage_file_selector
|
|
64
|
+
preparation_plugins, network_finder, coverage_file_selector, disable_file_fixes
|
|
64
65
|
)
|
|
65
66
|
try:
|
|
66
67
|
upload_data = collector.generate_upload_data()
|
|
@@ -29,15 +29,17 @@ class UploadCollector(object):
|
|
|
29
29
|
preparation_plugins: typing.List[PreparationPluginInterface],
|
|
30
30
|
network_finder: NetworkFinder,
|
|
31
31
|
coverage_file_finder: CoverageFileFinder,
|
|
32
|
+
disable_file_fixes: bool = False,
|
|
32
33
|
):
|
|
33
34
|
self.preparation_plugins = preparation_plugins
|
|
34
35
|
self.network_finder = network_finder
|
|
35
36
|
self.coverage_file_finder = coverage_file_finder
|
|
37
|
+
self.disable_file_fixes = disable_file_fixes
|
|
36
38
|
|
|
37
39
|
def _produce_file_fixes_for_network(
|
|
38
40
|
self, network: typing.List[str]
|
|
39
41
|
) -> typing.List[UploadCollectionResultFileFixer]:
|
|
40
|
-
if not network:
|
|
42
|
+
if not network or self.disable_file_fixes:
|
|
41
43
|
return []
|
|
42
44
|
# patterns that we don't need to specify a reason for
|
|
43
45
|
empty_line_regex = re.compile(r"^\s*$")
|
|
@@ -8,8 +8,8 @@ here = path.abspath(path.dirname(__file__))
|
|
|
8
8
|
with open(path.join(here, "README.md"), encoding="utf-8") as f:
|
|
9
9
|
long_description = f.read()
|
|
10
10
|
|
|
11
|
-
with open(path.join(here, "
|
|
12
|
-
version = f.
|
|
11
|
+
with open(path.join(here, "VERSION"), encoding="utf-8") as f:
|
|
12
|
+
version = f.readline().strip()
|
|
13
13
|
|
|
14
14
|
setup(
|
|
15
15
|
name="codecov-cli",
|
|
@@ -24,8 +24,6 @@ setup(
|
|
|
24
24
|
"click==8.*",
|
|
25
25
|
"httpx==0.23.*",
|
|
26
26
|
"ijson==3.*",
|
|
27
|
-
"pytest==7.*",
|
|
28
|
-
"pytest-cov>=3",
|
|
29
27
|
"pyyaml==6.*",
|
|
30
28
|
"responses==0.21.*",
|
|
31
29
|
"smart-open==6.*",
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
__version__ = "0.3.3"
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{codecov-cli-0.3.3 → codecov-cli-0.3.4}/codecov_cli/services/staticanalysis/analyzers/__init__.py
RENAMED
|
File without changes
|
{codecov-cli-0.3.3 → codecov-cli-0.3.4}/codecov_cli/services/staticanalysis/analyzers/general.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{codecov-cli-0.3.3 → codecov-cli-0.3.4}/languages/treesitterjavascript/src/tree_sitter/parser.h
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|