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

Commit 8db93ad

Browse files
authored
fix or ignore print statements (#486)
1 parent e854f50 commit 8db93ad

File tree

17 files changed

+7
-34
lines changed

17 files changed

+7
-34
lines changed

ruff.toml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -36,9 +36,9 @@ indent-width = 4
3636
target-version = "py312"
3737

3838
[lint]
39-
# Currently only enabled for F (Pyflakes), I (isort), E,W (pycodestyle:Error/Warning), PLC/PLE/PLW (Pylint:Convention/Error/Warning)
40-
# and PERF (Perflint) rules: https://docs.astral.sh/ruff/rules/
41-
select = ["F", "I", "E", "W", "PLC", "PLE", "PLW", "PERF"]
39+
# Currently only enabled for F (Pyflakes), I (isort), E,W (pycodestyle:Error/Warning), PLC/PLE/PLW (Pylint:Convention/Error/Warning),
40+
# PERF (Perflint), and T20 (Flake8-print) rules: https://docs.astral.sh/ruff/rules/
41+
select = ["F", "I", "E", "W", "PLC", "PLE", "PLW", "PERF", "T20"]
4242
ignore = ["F403", "F405", "E501", "E712"]
4343

4444
# Allow fix for all enabled rules (when `--fix`) is provided.

shared/django_apps/reports/migrations/0019_auto_20240424_1824.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ class Migration(migrations.Migration):
2424
]
2525

2626
def populate_test_instances(apps, schema_editor):
27-
print("Not running due to performance")
27+
print("Not running due to performance") # noqa: T201
2828
return
2929
TestInstance = apps.get_model("reports", "TestInstance")
3030

shared/license/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -100,4 +100,4 @@ def startup_license_logging():
100100

101101
# printing the message in a single statement so the lines won't get split up
102102
# among all the other messages during startup
103-
print(*statements_to_print, sep="\n")
103+
print(*statements_to_print, sep="\n") # noqa: T201

shared/storage/minio.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -246,7 +246,7 @@ def delete_files(self, bucket_name: str, paths: list[str]) -> list[bool]:
246246
for del_err in self.minio_client.remove_objects(
247247
bucket_name, [DeleteObject(path) for path in paths]
248248
):
249-
print("Deletion error: {}".format(del_err))
249+
print("Deletion error: {}".format(del_err)) # noqa: T201
250250
return [True] * len(paths)
251251
except MinioException:
252252
raise

shared/storage/new_minio.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -310,7 +310,7 @@ def delete_files(self, bucket_name, urls=[]):
310310
for del_err in self.minio_client.remove_objects(
311311
bucket_name, [DeleteObject(url) for url in urls]
312312
):
313-
print("Deletion error: {}".format(del_err))
313+
print("Deletion error: {}".format(del_err)) # noqa: T201
314314
return [True] * len(urls)
315315
except MinioException:
316316
raise

tests/integration/test_bitbucket.py

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -525,7 +525,6 @@ async def test_get_compare(self, valid_handler, codecov_vcr):
525525
"commits": [{"commitid": "b92edba"}, {"commitid": "6ae5f17"}],
526526
}
527527
res = await valid_handler.get_compare(base, head)
528-
print(res)
529528
assert sorted(list(res.keys())) == sorted(list(expected_result.keys()))
530529
assert res == expected_result
531530

@@ -1043,7 +1042,6 @@ async def test_list_repos_no_username(self, valid_handler, codecov_vcr):
10431042
}
10441043
]
10451044
res = await valid_handler.list_repos()
1046-
print(res)
10471045
assert sorted(res, key=lambda x: x["repo"]["service_id"]) == sorted(
10481046
expected_result, key=lambda x: x["repo"]["service_id"]
10491047
)
@@ -1089,7 +1087,6 @@ async def test_list_teams(self, valid_handler, codecov_vcr):
10891087
},
10901088
]
10911089
res = await valid_handler.list_teams()
1092-
print(res)
10931090
assert res == expected_result
10941091

10951092
@pytest.mark.asyncio

tests/integration/test_gitlab.py

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -316,7 +316,6 @@ async def test_get_commit_diff(self, valid_handler, codecov_vcr):
316316
res = await valid_handler.get_commit_diff(
317317
"c739768fcac68144a3a6d82305b9c4106934d31a"
318318
)
319-
print(list(res.keys()))
320319
assert res == expected_result
321320

322321
@pytest.mark.asyncio
@@ -364,7 +363,6 @@ async def test_set_commit_status(self, valid_handler, codecov_vcr):
364363
@pytest.mark.asyncio
365364
async def test_get_branches(self, valid_handler, codecov_vcr):
366365
branches = sorted(await valid_handler.get_branches())
367-
print(branches)
368366
assert list(map(lambda a: a[0], branches)) == ["main", "other-branch"]
369367

370368
@pytest.mark.asyncio
@@ -374,7 +372,6 @@ async def test_get_branch(self, valid_handler, codecov_vcr):
374372
"sha": "0fc784af11c401449e56b24a174bae7b9af86c98",
375373
}
376374
branch = await valid_handler.get_branch("main")
377-
print(branch)
378375
assert branch == expected_result
379376

380377
@pytest.mark.asyncio
@@ -507,7 +504,6 @@ async def test_get_compare(self, valid_handler, codecov_vcr):
507504
],
508505
}
509506
res = await valid_handler.get_compare(base, head)
510-
print(res)
511507
assert sorted(list(res.keys())) == sorted(list(expected_result.keys()))
512508
for key in res:
513509
assert res[key] == expected_result[key]

tests/unit/reports/samples/test_filtered.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -866,7 +866,6 @@ def test_apply_diff_not_saving(self, sample_report):
866866
}
867867

868868
def test_network(self, sample_report):
869-
print(list(sample_report.filter(paths=[".*go"]).network))
870869
assert list(sample_report.filter(paths=[".*go"]).network) == [
871870
(
872871
"file_1.go",

tests/unit/reports/test_carryforward.py

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
import dataclasses
2-
import pprint
32
from json import loads
43

54
import pytest
@@ -400,7 +399,6 @@ def test_generate_carryforward_report_one_file_not_covered(self, sample_report):
400399
assert res.files == ["file_1.go"]
401400
readable_report = self.convert_report_to_better_readable(res)
402401

403-
pprint.pprint(readable_report)
404402
expected_result = {
405403
"archive": {
406404
"file_1.go": [
@@ -473,7 +471,6 @@ def test_generate_carryforward_report_session_extras(self, sample_report):
473471
assert res.files == ["file_1.go"]
474472
readable_report = self.convert_report_to_better_readable(res)
475473

476-
pprint.pprint(readable_report)
477474
expected_result = {
478475
"archive": {
479476
"file_1.go": [

tests/unit/reports/test_changes.py

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,6 @@ def test_run_comparison_using_rust(sample_rust_report):
8383
}
8484
}
8585
k = run_comparison_using_rust(base_report, head_report, diff)
86-
print(k)
8786
assert k == {
8887
"files": [
8988
{
@@ -154,7 +153,6 @@ def test_get_changes_using_rust(sample_rust_report):
154153
}
155154
}
156155
k = get_changes_using_rust(base_report, head_report, diff)
157-
print(k)
158156
assert k == [
159157
Change(
160158
path="tests/__init__.py",
@@ -532,5 +530,4 @@ def test_rustify_diff_new_file(self):
532530
[((43, 7, 43, 7), [" ", " ", " ", "-", "+", " ", " ", " "])],
533531
),
534532
}
535-
print(rustify_diff(user_input))
536533
assert rustify_diff(user_input) == expected_result

0 commit comments

Comments
 (0)