Skip to content

Commit 2d58de2

Browse files
Fix several small things found by copilot
Fixing assertion Fixing wrong split in path Fixing pytest global arguments
1 parent feb9863 commit 2d58de2

5 files changed

Lines changed: 12 additions & 11 deletions

File tree

pyproject.toml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,6 @@ extend-exclude = [
2323
".venv*/**",
2424
]
2525
[tool.pytest.ini_options]
26-
addopts = ["-v", "-s"]
2726
log_cli = true
2827
log_cli_level = "Debug"
2928
log_cli_format = "[%(asctime)s.%(msecs)03d] [%(levelname)-3s] [%(name)s] %(message)s"

src/extensions/score_source_code_linker/tests/test_helpers.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -323,6 +323,7 @@ def test_get_github_link_with_real_repo(git_repo: Path) -> None:
323323
assert hash_from_link == actual_hash
324324

325325

326+
326327
def test_complete_workflow(known_good_json: Path):
327328
"""Test complete workflow from path to GitHub link."""
328329

src/extensions/score_source_code_linker/tests/test_repo_source_link_integration.py

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,11 @@
1010
#
1111
# SPDX-License-Identifier: Apache-2.0
1212
# *******************************************************************************
13+
14+
# ╓ ╖
15+
# ║ Some portions generated by CoPilot ║
16+
# ╙ ╜
17+
1318
import contextlib
1419
import json
1520
import os
@@ -322,11 +327,7 @@ def test_repo_grouping_multiple_needs_per_repo(
322327

323328
# All 3 MOD_REQ should be in this repo
324329
need_ids = {need.need for need in local_repo.needs}
325-
assert (
326-
"MOD_REQ_1" in need_ids
327-
or "MOD_REQ_2" in need_ids
328-
or "MOD_REQ_3" in need_ids
329-
)
330+
assert {"MOD_REQ_1", "MOD_REQ_2", "MOD_REQ_3"}.issubset(need_ids)
330331

331332
finally:
332333
app.cleanup()

src/extensions/score_source_code_linker/tests/test_xml_parser.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -359,7 +359,7 @@ def test_clean_test_file_name_combo_path():
359359
def test_clean_test_file_name_tests_report_path():
360360
raw_path = Path("/some/path/tests-report/test-report/unit/test_module.xml")
361361
result = xml_parser.clean_test_file_name(raw_path)
362-
assert result == Path("unit/test_module.xml")
362+
assert result == Path("test-report/unit/test_module.xml")
363363

364364

365365
def test_clean_test_file_name_nested_bazel_testlogs():
@@ -371,14 +371,14 @@ def test_clean_test_file_name_nested_bazel_testlogs():
371371
def test_clean_test_file_name_invalid_path_raises_error():
372372
raw_path = Path("/invalid/path/without/markers/test.xml")
373373
with pytest.raises(
374-
ValueError, match="Filepath does not have 'bazel-testlogs' nor 'test-report'"
374+
ValueError, match="Filepath does not have 'bazel-testlogs' nor 'tests-report'"
375375
):
376376
xml_parser.clean_test_file_name(raw_path)
377377

378378

379379
def test_clean_test_file_name_empty_path_raises_error():
380380
raw_path = Path("")
381381
with pytest.raises(
382-
ValueError, match="Filepath does not have 'bazel-testlogs' nor 'test-report'"
382+
ValueError, match="Filepath does not have 'bazel-testlogs' nor 'tests-report'"
383383
):
384384
xml_parser.clean_test_file_name(raw_path)

src/extensions/score_source_code_linker/xml_parser.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -71,10 +71,10 @@ def clean_test_file_name(raw_filepath: Path) -> Path:
7171
if "bazel-testlogs" in str(raw_filepath):
7272
return Path(str(raw_filepath).split("bazel-testlogs/")[-1])
7373
if "tests-report" in str(raw_filepath):
74-
return Path(str(raw_filepath).split("test-report/")[-1])
74+
return Path(str(raw_filepath).split("tests-report/")[-1])
7575
raise ValueError(
7676
"Filepath does not have 'bazel-testlogs' nor "
77-
f"'test-report'. Filepath: {raw_filepath}"
77+
+ f"'tests-report'. Filepath: {raw_filepath}"
7878
)
7979

8080

0 commit comments

Comments
 (0)