Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Major Version Change Requried] Revert "Revert "feat: disable search means don't search for explicitly mentioned files"" #481

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion codecov_cli/helpers/folder_searcher.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ def search_files(
filename_exclude_regex: typing.Optional[typing.Pattern] = None,
multipart_include_regex: typing.Optional[typing.Pattern] = None,
multipart_exclude_regex: typing.Optional[typing.Pattern] = None,
search_for_directories: bool = False
search_for_directories: bool = False,
) -> typing.Generator[pathlib.Path, None, None]:
""" "
Searches for files or directories in a given folder
Expand Down
9 changes: 9 additions & 0 deletions codecov_cli/services/upload/file_finder.py
Original file line number Diff line number Diff line change
Expand Up @@ -226,8 +226,17 @@ def find_files(self) -> typing.List[UploadCollectionResultFile]:
return list(set(result_files + user_result_files))

def get_user_specified_files(self, regex_patterns_to_exclude):
if self.disable_search:
result = []
for file in self.explicitly_listed_files:
filepath = Path(file)
if filepath.exists():
result.append(filepath)
return result

user_filenames_to_include = []
files_excluded_but_user_includes = []

for file in self.explicitly_listed_files:
user_filenames_to_include.append(file.name)
if regex_patterns_to_exclude.match(file.name):
Expand Down
9 changes: 2 additions & 7 deletions tests/commands/test_process_test_results.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import logging
import os

from click.testing import CliRunner
Expand All @@ -11,7 +10,6 @@ def test_process_test_results(
mocker,
tmpdir,
):

tmp_file = tmpdir.mkdir("folder").join("summary.txt")

mocker.patch.dict(
Expand Down Expand Up @@ -44,7 +42,6 @@ def test_process_test_results(

assert result.exit_code == 0


mocked_post.assert_called_with(
url="https://api.github.com/repos/fake/repo/issues/pull/comments",
data={
Expand All @@ -58,7 +55,6 @@ def test_process_test_results(
)



def test_process_test_results_non_existent_file(mocker, tmpdir):
tmp_file = tmpdir.mkdir("folder").join("summary.txt")

Expand Down Expand Up @@ -93,7 +89,7 @@ def test_process_test_results_non_existent_file(mocker, tmpdir):
assert result.exit_code == 1
expected_logs = [
"ci service found",
'Some files were not found',
"No JUnit XML files were found",
]
for log in expected_logs:
assert log in result.output
Expand Down Expand Up @@ -182,7 +178,6 @@ def test_process_test_results_missing_ref(mocker, tmpdir):
assert log in result.output



def test_process_test_results_missing_step_summary(mocker, tmpdir):
tmp_file = tmpdir.mkdir("folder").join("summary.txt")

Expand Down Expand Up @@ -221,4 +216,4 @@ def test_process_test_results_missing_step_summary(mocker, tmpdir):
"Error: Error getting step summary file path from environment. Can't find GITHUB_STEP_SUMMARY environment variable.",
]
for log in expected_logs:
assert log in result.output
assert log in result.output
Loading