codecov-cli 0.1.8__tar.gz → 0.1.9__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.1.8/codecov_cli.egg-info → codecov-cli-0.1.9}/PKG-INFO +1 -1
- codecov-cli-0.1.9/codecov_cli/commands/empty_upload.py +66 -0
- {codecov-cli-0.1.8 → codecov-cli-0.1.9}/codecov_cli/commands/labelanalysis.py +20 -13
- {codecov-cli-0.1.8 → codecov-cli-0.1.9}/codecov_cli/main.py +2 -0
- {codecov-cli-0.1.8 → codecov-cli-0.1.9}/codecov_cli/runners/dan_runner.py +14 -9
- {codecov-cli-0.1.8 → codecov-cli-0.1.9}/codecov_cli/runners/python_standard_runner.py +25 -15
- codecov-cli-0.1.9/codecov_cli/runners/types.py +32 -0
- codecov-cli-0.1.9/codecov_cli/services/empty_upload/__init__.py +19 -0
- {codecov-cli-0.1.8 → codecov-cli-0.1.9/codecov_cli.egg-info}/PKG-INFO +1 -1
- {codecov-cli-0.1.8 → codecov-cli-0.1.9}/codecov_cli.egg-info/SOURCES.txt +2 -0
- {codecov-cli-0.1.8 → codecov-cli-0.1.9}/setup.py +1 -1
- codecov-cli-0.1.8/codecov_cli/runners/types.py +0 -18
- {codecov-cli-0.1.8 → codecov-cli-0.1.9}/LICENSE +0 -0
- {codecov-cli-0.1.8 → codecov-cli-0.1.9}/MANIFEST.in +0 -0
- {codecov-cli-0.1.8 → codecov-cli-0.1.9}/README.md +0 -0
- {codecov-cli-0.1.8 → codecov-cli-0.1.9}/codecov_cli/__init__.py +0 -0
- {codecov-cli-0.1.8 → codecov-cli-0.1.9}/codecov_cli/commands/__init__.py +0 -0
- {codecov-cli-0.1.8 → codecov-cli-0.1.9}/codecov_cli/commands/base_picking.py +0 -0
- {codecov-cli-0.1.8 → codecov-cli-0.1.9}/codecov_cli/commands/commit.py +0 -0
- {codecov-cli-0.1.8 → codecov-cli-0.1.9}/codecov_cli/commands/create_report_result.py +0 -0
- {codecov-cli-0.1.8 → codecov-cli-0.1.9}/codecov_cli/commands/get_report_results.py +0 -0
- {codecov-cli-0.1.8 → codecov-cli-0.1.9}/codecov_cli/commands/report.py +0 -0
- {codecov-cli-0.1.8 → codecov-cli-0.1.9}/codecov_cli/commands/staticanalysis.py +0 -0
- {codecov-cli-0.1.8 → codecov-cli-0.1.9}/codecov_cli/commands/upload.py +0 -0
- {codecov-cli-0.1.8 → codecov-cli-0.1.9}/codecov_cli/fallbacks.py +0 -0
- {codecov-cli-0.1.8 → codecov-cli-0.1.9}/codecov_cli/helpers/__init__.py +0 -0
- {codecov-cli-0.1.8 → codecov-cli-0.1.9}/codecov_cli/helpers/ci_adapters/__init__.py +0 -0
- {codecov-cli-0.1.8 → codecov-cli-0.1.9}/codecov_cli/helpers/ci_adapters/appveyor_ci.py +0 -0
- {codecov-cli-0.1.8 → codecov-cli-0.1.9}/codecov_cli/helpers/ci_adapters/azure_pipelines.py +0 -0
- {codecov-cli-0.1.8 → codecov-cli-0.1.9}/codecov_cli/helpers/ci_adapters/base.py +0 -0
- {codecov-cli-0.1.8 → codecov-cli-0.1.9}/codecov_cli/helpers/ci_adapters/bitbucket_ci.py +0 -0
- {codecov-cli-0.1.8 → codecov-cli-0.1.9}/codecov_cli/helpers/ci_adapters/bitrise_ci.py +0 -0
- {codecov-cli-0.1.8 → codecov-cli-0.1.9}/codecov_cli/helpers/ci_adapters/buildkite.py +0 -0
- {codecov-cli-0.1.8 → codecov-cli-0.1.9}/codecov_cli/helpers/ci_adapters/circleci.py +0 -0
- {codecov-cli-0.1.8 → codecov-cli-0.1.9}/codecov_cli/helpers/ci_adapters/cirrus_ci.py +0 -0
- {codecov-cli-0.1.8 → codecov-cli-0.1.9}/codecov_cli/helpers/ci_adapters/codebuild.py +0 -0
- {codecov-cli-0.1.8 → codecov-cli-0.1.9}/codecov_cli/helpers/ci_adapters/droneci.py +0 -0
- {codecov-cli-0.1.8 → codecov-cli-0.1.9}/codecov_cli/helpers/ci_adapters/github_actions.py +0 -0
- {codecov-cli-0.1.8 → codecov-cli-0.1.9}/codecov_cli/helpers/ci_adapters/gitlab_ci.py +0 -0
- {codecov-cli-0.1.8 → codecov-cli-0.1.9}/codecov_cli/helpers/ci_adapters/heroku.py +0 -0
- {codecov-cli-0.1.8 → codecov-cli-0.1.9}/codecov_cli/helpers/ci_adapters/jenkins.py +0 -0
- {codecov-cli-0.1.8 → codecov-cli-0.1.9}/codecov_cli/helpers/ci_adapters/local.py +0 -0
- {codecov-cli-0.1.8 → codecov-cli-0.1.9}/codecov_cli/helpers/ci_adapters/teamcity.py +0 -0
- {codecov-cli-0.1.8 → codecov-cli-0.1.9}/codecov_cli/helpers/ci_adapters/travis_ci.py +0 -0
- {codecov-cli-0.1.8 → codecov-cli-0.1.9}/codecov_cli/helpers/ci_adapters/woodpeckerci.py +0 -0
- {codecov-cli-0.1.8 → codecov-cli-0.1.9}/codecov_cli/helpers/config.py +0 -0
- {codecov-cli-0.1.8 → codecov-cli-0.1.9}/codecov_cli/helpers/encoder.py +0 -0
- {codecov-cli-0.1.8 → codecov-cli-0.1.9}/codecov_cli/helpers/folder_searcher.py +0 -0
- {codecov-cli-0.1.8 → codecov-cli-0.1.9}/codecov_cli/helpers/git.py +0 -0
- {codecov-cli-0.1.8 → codecov-cli-0.1.9}/codecov_cli/helpers/logging_utils.py +0 -0
- {codecov-cli-0.1.8 → codecov-cli-0.1.9}/codecov_cli/helpers/request.py +0 -0
- {codecov-cli-0.1.8 → codecov-cli-0.1.9}/codecov_cli/helpers/versioning_systems.py +0 -0
- {codecov-cli-0.1.8 → codecov-cli-0.1.9}/codecov_cli/plugins/__init__.py +0 -0
- {codecov-cli-0.1.8 → codecov-cli-0.1.9}/codecov_cli/plugins/gcov.py +0 -0
- {codecov-cli-0.1.8 → codecov-cli-0.1.9}/codecov_cli/plugins/pycoverage.py +0 -0
- {codecov-cli-0.1.8 → codecov-cli-0.1.9}/codecov_cli/plugins/types.py +0 -0
- {codecov-cli-0.1.8 → codecov-cli-0.1.9}/codecov_cli/plugins/xcode.py +0 -0
- {codecov-cli-0.1.8 → codecov-cli-0.1.9}/codecov_cli/runners/__init__.py +0 -0
- {codecov-cli-0.1.8 → codecov-cli-0.1.9}/codecov_cli/services/__init__.py +0 -0
- {codecov-cli-0.1.8 → codecov-cli-0.1.9}/codecov_cli/services/commit/__init__.py +0 -0
- {codecov-cli-0.1.8 → codecov-cli-0.1.9}/codecov_cli/services/commit/base_picking.py +0 -0
- {codecov-cli-0.1.8 → codecov-cli-0.1.9}/codecov_cli/services/report/__init__.py +0 -0
- {codecov-cli-0.1.8 → codecov-cli-0.1.9}/codecov_cli/services/staticanalysis/__init__.py +0 -0
- {codecov-cli-0.1.8 → codecov-cli-0.1.9}/codecov_cli/services/staticanalysis/analyzers/__init__.py +0 -0
- {codecov-cli-0.1.8 → codecov-cli-0.1.9}/codecov_cli/services/staticanalysis/analyzers/ecmascriptsix.py +0 -0
- {codecov-cli-0.1.8 → codecov-cli-0.1.9}/codecov_cli/services/staticanalysis/analyzers/general.py +0 -0
- {codecov-cli-0.1.8 → codecov-cli-0.1.9}/codecov_cli/services/staticanalysis/analyzers/python/__init__.py +0 -0
- {codecov-cli-0.1.8 → codecov-cli-0.1.9}/codecov_cli/services/staticanalysis/analyzers/python/node_wrappers.py +0 -0
- {codecov-cli-0.1.8 → codecov-cli-0.1.9}/codecov_cli/services/staticanalysis/exceptions.py +0 -0
- {codecov-cli-0.1.8 → codecov-cli-0.1.9}/codecov_cli/services/staticanalysis/finders.py +0 -0
- {codecov-cli-0.1.8 → codecov-cli-0.1.9}/codecov_cli/services/staticanalysis/types.py +0 -0
- {codecov-cli-0.1.8 → codecov-cli-0.1.9}/codecov_cli/services/upload/__init__.py +0 -0
- {codecov-cli-0.1.8 → codecov-cli-0.1.9}/codecov_cli/services/upload/coverage_file_finder.py +0 -0
- {codecov-cli-0.1.8 → codecov-cli-0.1.9}/codecov_cli/services/upload/legacy_upload_sender.py +0 -0
- {codecov-cli-0.1.8 → codecov-cli-0.1.9}/codecov_cli/services/upload/network_finder.py +0 -0
- {codecov-cli-0.1.8 → codecov-cli-0.1.9}/codecov_cli/services/upload/upload_collector.py +0 -0
- {codecov-cli-0.1.8 → codecov-cli-0.1.9}/codecov_cli/services/upload/upload_sender.py +0 -0
- {codecov-cli-0.1.8 → codecov-cli-0.1.9}/codecov_cli/types.py +0 -0
- {codecov-cli-0.1.8 → codecov-cli-0.1.9}/codecov_cli.egg-info/dependency_links.txt +0 -0
- {codecov-cli-0.1.8 → codecov-cli-0.1.9}/codecov_cli.egg-info/entry_points.txt +0 -0
- {codecov-cli-0.1.8 → codecov-cli-0.1.9}/codecov_cli.egg-info/requires.txt +0 -0
- {codecov-cli-0.1.8 → codecov-cli-0.1.9}/codecov_cli.egg-info/top_level.txt +0 -0
- {codecov-cli-0.1.8 → codecov-cli-0.1.9}/languages/languages.c +0 -0
- {codecov-cli-0.1.8 → codecov-cli-0.1.9}/languages/treesitterjavascript/src/parser.c +0 -0
- {codecov-cli-0.1.8 → codecov-cli-0.1.9}/languages/treesitterjavascript/src/scanner.c +0 -0
- {codecov-cli-0.1.8 → codecov-cli-0.1.9}/languages/treesitterjavascript/src/tree_sitter/parser.h +0 -0
- {codecov-cli-0.1.8 → codecov-cli-0.1.9}/languages/treesitterpython/src/parser.c +0 -0
- {codecov-cli-0.1.8 → codecov-cli-0.1.9}/languages/treesitterpython/src/scanner.cc +0 -0
- {codecov-cli-0.1.8 → codecov-cli-0.1.9}/languages/treesitterpython/src/tree_sitter/parser.h +0 -0
- {codecov-cli-0.1.8 → codecov-cli-0.1.9}/setup.cfg +0 -0
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
import logging
|
|
2
|
+
import typing
|
|
3
|
+
import uuid
|
|
4
|
+
|
|
5
|
+
import click
|
|
6
|
+
|
|
7
|
+
from codecov_cli.fallbacks import CodecovOption, FallbackFieldEnum
|
|
8
|
+
from codecov_cli.helpers.git import GitService
|
|
9
|
+
from codecov_cli.services.empty_upload import empty_upload_logic
|
|
10
|
+
|
|
11
|
+
logger = logging.getLogger("codecovcli")
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
@click.command()
|
|
15
|
+
@click.option(
|
|
16
|
+
"-C",
|
|
17
|
+
"--sha",
|
|
18
|
+
"--commit-sha",
|
|
19
|
+
"commit_sha",
|
|
20
|
+
help="Commit SHA (with 40 chars)",
|
|
21
|
+
cls=CodecovOption,
|
|
22
|
+
fallback_field=FallbackFieldEnum.commit_sha,
|
|
23
|
+
required=True,
|
|
24
|
+
)
|
|
25
|
+
@click.option(
|
|
26
|
+
"-r",
|
|
27
|
+
"--slug",
|
|
28
|
+
"slug",
|
|
29
|
+
cls=CodecovOption,
|
|
30
|
+
fallback_field=FallbackFieldEnum.slug,
|
|
31
|
+
help="owner/repo slug used instead of the private repo token in Self-hosted",
|
|
32
|
+
envvar="CODECOV_SLUG",
|
|
33
|
+
)
|
|
34
|
+
@click.option(
|
|
35
|
+
"-t",
|
|
36
|
+
"--token",
|
|
37
|
+
help="Codecov upload token",
|
|
38
|
+
type=click.UUID,
|
|
39
|
+
envvar="CODECOV_TOKEN",
|
|
40
|
+
)
|
|
41
|
+
@click.option(
|
|
42
|
+
"--git-service",
|
|
43
|
+
cls=CodecovOption,
|
|
44
|
+
fallback_field=FallbackFieldEnum.git_service,
|
|
45
|
+
type=click.Choice(service.value for service in GitService),
|
|
46
|
+
)
|
|
47
|
+
@click.pass_context
|
|
48
|
+
def empty_upload(
|
|
49
|
+
ctx,
|
|
50
|
+
commit_sha: str,
|
|
51
|
+
slug: typing.Optional[str],
|
|
52
|
+
token: typing.Optional[uuid.UUID],
|
|
53
|
+
git_service: typing.Optional[str],
|
|
54
|
+
):
|
|
55
|
+
logger.debug(
|
|
56
|
+
"Starting empty upload process",
|
|
57
|
+
extra=dict(
|
|
58
|
+
extra_log_attributes=dict(
|
|
59
|
+
commit_sha=commit_sha,
|
|
60
|
+
slug=slug,
|
|
61
|
+
token=token,
|
|
62
|
+
service=git_service,
|
|
63
|
+
)
|
|
64
|
+
),
|
|
65
|
+
)
|
|
66
|
+
return empty_upload_logic(commit_sha, slug, token, git_service)
|
|
@@ -6,6 +6,7 @@ import requests
|
|
|
6
6
|
|
|
7
7
|
from codecov_cli.fallbacks import CodecovOption, FallbackFieldEnum
|
|
8
8
|
from codecov_cli.runners import get_runner
|
|
9
|
+
from codecov_cli.runners.types import LabelAnalysisRequestResult
|
|
9
10
|
|
|
10
11
|
logger = logging.getLogger("codecovcli")
|
|
11
12
|
|
|
@@ -86,12 +87,14 @@ def label_analysis(
|
|
|
86
87
|
logger.info(
|
|
87
88
|
"Could not get set of tests to run. Falling back to running all collected tests."
|
|
88
89
|
)
|
|
89
|
-
fake_response =
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
90
|
+
fake_response = LabelAnalysisRequestResult(
|
|
91
|
+
{
|
|
92
|
+
"present_report_labels": [],
|
|
93
|
+
"absent_labels": requested_labels,
|
|
94
|
+
"present_diff_labels": [],
|
|
95
|
+
"global_level_labels": [],
|
|
96
|
+
}
|
|
97
|
+
)
|
|
95
98
|
return runner.process_labelanalysis_result(fake_response)
|
|
96
99
|
raise click.ClickException("Sorry. Codecov is having problems")
|
|
97
100
|
if response.status_code >= 400:
|
|
@@ -119,7 +122,9 @@ def label_analysis(
|
|
|
119
122
|
)
|
|
120
123
|
resp_json = resp_data.json()
|
|
121
124
|
if resp_json["state"] == "finished":
|
|
122
|
-
runner.process_labelanalysis_result(
|
|
125
|
+
runner.process_labelanalysis_result(
|
|
126
|
+
LabelAnalysisRequestResult(resp_data.json()["result"])
|
|
127
|
+
)
|
|
123
128
|
return
|
|
124
129
|
if resp_json["state"] == "error":
|
|
125
130
|
logger.error(
|
|
@@ -128,12 +133,14 @@ def label_analysis(
|
|
|
128
133
|
)
|
|
129
134
|
if requested_labels:
|
|
130
135
|
logger.info("Using requested labels as tests to run")
|
|
131
|
-
fake_response =
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
136
|
+
fake_response = LabelAnalysisRequestResult(
|
|
137
|
+
{
|
|
138
|
+
"present_report_labels": [],
|
|
139
|
+
"absent_labels": requested_labels,
|
|
140
|
+
"present_diff_labels": [],
|
|
141
|
+
"global_level_labels": [],
|
|
142
|
+
}
|
|
143
|
+
)
|
|
137
144
|
return runner.process_labelanalysis_result(fake_response)
|
|
138
145
|
return
|
|
139
146
|
logger.info("Waiting more time for result")
|
|
@@ -7,6 +7,7 @@ import click
|
|
|
7
7
|
from codecov_cli.commands.base_picking import pr_base_picking
|
|
8
8
|
from codecov_cli.commands.commit import create_commit
|
|
9
9
|
from codecov_cli.commands.create_report_result import create_report_results
|
|
10
|
+
from codecov_cli.commands.empty_upload import empty_upload
|
|
10
11
|
from codecov_cli.commands.get_report_results import get_report_results
|
|
11
12
|
from codecov_cli.commands.labelanalysis import label_analysis
|
|
12
13
|
from codecov_cli.commands.report import create_report
|
|
@@ -61,6 +62,7 @@ cli.add_command(get_report_results)
|
|
|
61
62
|
cli.add_command(pr_base_picking)
|
|
62
63
|
cli.add_command(label_analysis)
|
|
63
64
|
cli.add_command(static_analysis)
|
|
65
|
+
cli.add_command(empty_upload)
|
|
64
66
|
|
|
65
67
|
|
|
66
68
|
def run():
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import subprocess
|
|
2
|
-
from typing import List,
|
|
2
|
+
from typing import List, Optional, Union
|
|
3
3
|
|
|
4
4
|
from codecov_cli.runners.types import (
|
|
5
5
|
LabelAnalysisRequestResult,
|
|
@@ -7,20 +7,25 @@ from codecov_cli.runners.types import (
|
|
|
7
7
|
)
|
|
8
8
|
|
|
9
9
|
|
|
10
|
-
class DoAnythingNowConfigParams(
|
|
11
|
-
|
|
12
|
-
|
|
10
|
+
class DoAnythingNowConfigParams(dict):
|
|
11
|
+
@property
|
|
12
|
+
def collect_tests_command(self) -> Union[List[str], str]:
|
|
13
|
+
return self.get("collect_tests_command", None)
|
|
14
|
+
|
|
15
|
+
@property
|
|
16
|
+
def process_labelanalysis_result_command(self) -> Union[List[str], str]:
|
|
17
|
+
return self.get("process_labelanalysis_result_command", None)
|
|
13
18
|
|
|
14
19
|
|
|
15
20
|
class DoAnythingNowRunner(LabelAnalysisRunnerInterface):
|
|
16
|
-
def __init__(self, config_params:
|
|
21
|
+
def __init__(self, config_params: Optional[dict] = None) -> None:
|
|
17
22
|
super().__init__()
|
|
18
23
|
if config_params is None:
|
|
19
|
-
config_params =
|
|
20
|
-
self.params = config_params
|
|
24
|
+
config_params = {}
|
|
25
|
+
self.params = DoAnythingNowConfigParams(config_params)
|
|
21
26
|
|
|
22
27
|
def collect_tests(self) -> List[str]:
|
|
23
|
-
command = self.params.
|
|
28
|
+
command = self.params.collect_tests_command
|
|
24
29
|
if command is None:
|
|
25
30
|
raise Exception(
|
|
26
31
|
"DAN runner missing 'collect_tests_command' configuration value"
|
|
@@ -28,7 +33,7 @@ class DoAnythingNowRunner(LabelAnalysisRunnerInterface):
|
|
|
28
33
|
return subprocess.run(command, check=True, capture_output=True).stdout.decode()
|
|
29
34
|
|
|
30
35
|
def process_labelanalysis_result(self, result: LabelAnalysisRequestResult):
|
|
31
|
-
command = self.params.
|
|
36
|
+
command = self.params.process_labelanalysis_result_command
|
|
32
37
|
if command is None:
|
|
33
38
|
raise Exception(
|
|
34
39
|
"DAN runner missing 'process_labelanalysis_result_command' configuration value"
|
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
import logging
|
|
2
|
+
import random
|
|
2
3
|
from contextlib import redirect_stdout
|
|
3
4
|
from io import StringIO, TextIOWrapper
|
|
4
5
|
from multiprocessing import Queue, get_context
|
|
5
6
|
from os import getcwd
|
|
6
7
|
from sys import path, stdout
|
|
7
|
-
from typing import List,
|
|
8
|
+
from typing import List, Optional
|
|
8
9
|
|
|
9
10
|
import pytest
|
|
10
11
|
|
|
@@ -16,16 +17,23 @@ from codecov_cli.runners.types import (
|
|
|
16
17
|
logger = logging.getLogger("codecovcli")
|
|
17
18
|
|
|
18
19
|
|
|
19
|
-
class PythonStandardRunnerConfigParams(
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
20
|
+
class PythonStandardRunnerConfigParams(dict):
|
|
21
|
+
@property
|
|
22
|
+
def collect_tests_options(self) -> List[str]:
|
|
23
|
+
return self.get("collect_tests_options", [])
|
|
24
|
+
|
|
25
|
+
@property
|
|
26
|
+
def include_curr_dir(self) -> bool:
|
|
27
|
+
""" "
|
|
28
|
+
Account for the difference 'pytest' vs 'python -m pytest'
|
|
29
|
+
https://docs.pytest.org/en/7.1.x/how-to/usage.html#calling-pytest-through-python-m-pytest
|
|
30
|
+
"""
|
|
31
|
+
return self.get("include_curr_dir", True)
|
|
24
32
|
|
|
25
33
|
|
|
26
34
|
def _include_curr_dir(method):
|
|
27
35
|
def call_method(self, *args, **kwargs):
|
|
28
|
-
include_curr_dir = self.params
|
|
36
|
+
include_curr_dir = self.params.include_curr_dir
|
|
29
37
|
curr_dir = getcwd()
|
|
30
38
|
if include_curr_dir:
|
|
31
39
|
path.append(curr_dir)
|
|
@@ -61,15 +69,11 @@ def _execute_pytest_subprocess(
|
|
|
61
69
|
|
|
62
70
|
|
|
63
71
|
class PythonStandardRunner(LabelAnalysisRunnerInterface):
|
|
64
|
-
def __init__(self, config_params:
|
|
72
|
+
def __init__(self, config_params: Optional[dict] = None) -> None:
|
|
65
73
|
super().__init__()
|
|
66
|
-
default_config: PythonStandardRunnerConfigParams = {
|
|
67
|
-
"collect_tests_options": [],
|
|
68
|
-
"include_curr_dir": True,
|
|
69
|
-
}
|
|
70
74
|
if config_params is None:
|
|
71
|
-
config_params =
|
|
72
|
-
self.params =
|
|
75
|
+
config_params = {}
|
|
76
|
+
self.params = PythonStandardRunnerConfigParams(config_params)
|
|
73
77
|
|
|
74
78
|
@_include_curr_dir
|
|
75
79
|
def _execute_pytest(
|
|
@@ -102,7 +106,7 @@ class PythonStandardRunner(LabelAnalysisRunnerInterface):
|
|
|
102
106
|
|
|
103
107
|
def collect_tests(self):
|
|
104
108
|
default_options = ["-q", "--collect-only"]
|
|
105
|
-
extra_args = self.params
|
|
109
|
+
extra_args = self.params.collect_tests_options
|
|
106
110
|
options_to_use = default_options + extra_args
|
|
107
111
|
logger.debug(
|
|
108
112
|
"Collecting tests",
|
|
@@ -143,6 +147,12 @@ class PythonStandardRunner(LabelAnalysisRunnerInterface):
|
|
|
143
147
|
),
|
|
144
148
|
)
|
|
145
149
|
|
|
150
|
+
if len(all_labels) == 0:
|
|
151
|
+
all_labels = [random.choice(result["present_report_labels"])]
|
|
152
|
+
logger.info(
|
|
153
|
+
"All tests are being skipped. Selected random label to run",
|
|
154
|
+
extra=dict(extra_log_attributes=dict(selected_label=all_labels[0])),
|
|
155
|
+
)
|
|
146
156
|
command_array = default_options + [
|
|
147
157
|
label.split("[")[0] if "[" in label else label for label in all_labels
|
|
148
158
|
]
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
from typing import List
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
# This is supposed to be a TypedDict,
|
|
5
|
+
# But that is Python >= 3.7 only
|
|
6
|
+
# So we are not using those
|
|
7
|
+
class LabelAnalysisRequestResult(dict):
|
|
8
|
+
@property
|
|
9
|
+
def present_report_labels(self) -> List[str]:
|
|
10
|
+
return self.get("present_report_labels", [])
|
|
11
|
+
|
|
12
|
+
@property
|
|
13
|
+
def absent_labels(self) -> List[str]:
|
|
14
|
+
return self.get("absent_labels", [])
|
|
15
|
+
|
|
16
|
+
@property
|
|
17
|
+
def present_diff_labels(self) -> List[str]:
|
|
18
|
+
return self.get("present_diff_labels", [])
|
|
19
|
+
|
|
20
|
+
@property
|
|
21
|
+
def global_level_labels(self) -> List[str]:
|
|
22
|
+
return self.get("global_level_labels", [])
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
class LabelAnalysisRunnerInterface(object):
|
|
26
|
+
params = None
|
|
27
|
+
|
|
28
|
+
def collect_tests(self) -> List[str]:
|
|
29
|
+
raise NotImplementedError()
|
|
30
|
+
|
|
31
|
+
def process_labelanalysis_result(self, result: LabelAnalysisRequestResult):
|
|
32
|
+
raise NotImplementedError()
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import logging
|
|
2
|
+
|
|
3
|
+
from codecov_cli.helpers.encoder import encode_slug
|
|
4
|
+
from codecov_cli.helpers.request import (
|
|
5
|
+
get_token_header_or_fail,
|
|
6
|
+
log_warnings_and_errors_if_any,
|
|
7
|
+
send_post_request,
|
|
8
|
+
)
|
|
9
|
+
|
|
10
|
+
logger = logging.getLogger("codecovcli")
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
def empty_upload_logic(commit_sha, slug, token, git_service):
|
|
14
|
+
encoded_slug = encode_slug(slug)
|
|
15
|
+
headers = get_token_header_or_fail(token)
|
|
16
|
+
url = f"https://api.codecov.io/upload/{git_service}/{encoded_slug}/commits/{commit_sha}/empty-upload"
|
|
17
|
+
sending_result = send_post_request(url=url, headers=headers)
|
|
18
|
+
log_warnings_and_errors_if_any(sending_result, "Empty Upload")
|
|
19
|
+
return sending_result
|
|
@@ -16,6 +16,7 @@ codecov_cli/commands/__init__.py
|
|
|
16
16
|
codecov_cli/commands/base_picking.py
|
|
17
17
|
codecov_cli/commands/commit.py
|
|
18
18
|
codecov_cli/commands/create_report_result.py
|
|
19
|
+
codecov_cli/commands/empty_upload.py
|
|
19
20
|
codecov_cli/commands/get_report_results.py
|
|
20
21
|
codecov_cli/commands/labelanalysis.py
|
|
21
22
|
codecov_cli/commands/report.py
|
|
@@ -60,6 +61,7 @@ codecov_cli/runners/types.py
|
|
|
60
61
|
codecov_cli/services/__init__.py
|
|
61
62
|
codecov_cli/services/commit/__init__.py
|
|
62
63
|
codecov_cli/services/commit/base_picking.py
|
|
64
|
+
codecov_cli/services/empty_upload/__init__.py
|
|
63
65
|
codecov_cli/services/report/__init__.py
|
|
64
66
|
codecov_cli/services/staticanalysis/__init__.py
|
|
65
67
|
codecov_cli/services/staticanalysis/exceptions.py
|
|
@@ -10,7 +10,7 @@ with open(path.join(here, "README.md"), encoding="utf-8") as f:
|
|
|
10
10
|
|
|
11
11
|
setup(
|
|
12
12
|
name="codecov-cli",
|
|
13
|
-
version="0.1.
|
|
13
|
+
version="0.1.9",
|
|
14
14
|
packages=find_packages(exclude=["contrib", "docs", "tests*"]),
|
|
15
15
|
description="Codecov Command Line Interface",
|
|
16
16
|
long_description=long_description,
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
from typing import List, TypedDict
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
class LabelAnalysisRequestResult(TypedDict):
|
|
5
|
-
present_report_labels: List[str]
|
|
6
|
-
absent_labels: List[str]
|
|
7
|
-
present_diff_labels: List[str]
|
|
8
|
-
global_level_labels: List[str]
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
class LabelAnalysisRunnerInterface(object):
|
|
12
|
-
params = None
|
|
13
|
-
|
|
14
|
-
def collect_tests(self) -> List[str]:
|
|
15
|
-
raise NotImplementedError()
|
|
16
|
-
|
|
17
|
-
def process_labelanalysis_result(self, result: LabelAnalysisRequestResult):
|
|
18
|
-
raise NotImplementedError()
|
|
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.1.8 → codecov-cli-0.1.9}/codecov_cli/services/staticanalysis/analyzers/__init__.py
RENAMED
|
File without changes
|
|
File without changes
|
{codecov-cli-0.1.8 → codecov-cli-0.1.9}/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
|
{codecov-cli-0.1.8 → codecov-cli-0.1.9}/languages/treesitterjavascript/src/tree_sitter/parser.h
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|