Skip to content
This repository was archived by the owner on Jul 16, 2025. It is now read-only.

Commit 4de8fc2

Browse files
fix: allow for .. explicit file search (#432)
1 parent 3c2bac8 commit 4de8fc2

File tree

2 files changed

+28
-1
lines changed

2 files changed

+28
-1
lines changed

codecov_cli/services/upload/file_finder.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -253,7 +253,11 @@ def get_user_specified_files(self, regex_patterns_to_exclude):
253253
user_files_paths_resolved = [path.resolve() for path in user_files_paths]
254254
for filepath in self.explicitly_listed_files:
255255
if filepath.resolve() not in user_files_paths_resolved:
256-
not_found_files.append(filepath)
256+
## The file given might be linked or in a parent dir, check to see if it exists
257+
if filepath.exists():
258+
user_files_paths.append(filepath)
259+
else:
260+
not_found_files.append(filepath)
257261

258262
if not_found_files:
259263
logger.warning(

tests/services/upload/test_coverage_file_finder.py

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -206,6 +206,29 @@ def test_find_coverage_files_with_existing_files(
206206
expected_paths = sorted([file.get_filename() for file in expected])
207207
assert result == expected_paths
208208

209+
def test_find_coverage_files_with_file_in_parent(
210+
self, coverage_file_finder_fixture
211+
):
212+
# Create some sample coverage coverage_file_finder_fixture
213+
(
214+
project_root,
215+
coverage_file_finder,
216+
) = coverage_file_finder_fixture
217+
coverage_files = [
218+
project_root.parent / "coverage.xml",
219+
]
220+
for file in coverage_files:
221+
file.touch()
222+
223+
coverage_file_finder.explicitly_listed_files = [project_root.parent / "coverage.xml"]
224+
225+
result = sorted(
226+
[file.get_filename() for file in coverage_file_finder.find_files()]
227+
)
228+
expected = [UploadCollectionResultFile(Path(f"{project_root.parent}/coverage.xml"))]
229+
expected_paths = sorted([file.get_filename() for file in expected])
230+
assert result == expected_paths
231+
209232
def test_find_coverage_files_with_no_files(self, coverage_file_finder_fixture):
210233
(
211234
_,

0 commit comments

Comments
 (0)