Skip to content

Commit c4ba5ce

Browse files
committed
Linting again
1 parent 02798aa commit c4ba5ce

File tree

3 files changed

+14
-10
lines changed

3 files changed

+14
-10
lines changed

tests/performance/manage.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ def main():
99
"""Run administrative tasks."""
1010
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "perftest.settings")
1111
try:
12-
from django.core.management import execute_from_command_line
12+
from django.core.management import execute_from_command_line # noqa: PLC0415
1313
except ImportError as exc:
1414
raise ImportError(
1515
"Couldn't import Django. Are you sure it's installed and "

tests/performance/perftest/settings.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
# See https://docs.djangoproject.com/en/5.2/howto/deployment/checklist/
2121

2222
# SECURITY WARNING: keep the secret key used in production secret!
23-
SECRET_KEY = "django-insecure-xle!u*(htb-zn^-*kap_3s5u1#sm8p#f%@j@-6j6+97%p*n_ho"
23+
SECRET_KEY = "django-insecure-xle!u*(htb-zn^-*kap_3s5u1#sm8p#f%@j@-6j6+97%p*n_ho" # noqa: S105
2424

2525
# SECURITY WARNING: don't run with debug turned on in production!
2626
DEBUG = True

tests/performance/perftest/tests.py

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -31,10 +31,10 @@
3131
def tearDownModule():
3232
output = json.dumps(result_data, indent=4)
3333
if OUTPUT_FILE:
34-
with open(OUTPUT_FILE, "w") as opf:
34+
with open(OUTPUT_FILE, "w") as opf: # noqa: PTH123
3535
opf.write(output)
3636
else:
37-
print(output)
37+
print(output) # noqa: T201
3838

3939

4040
class Timer:
@@ -61,8 +61,9 @@ def tearDown(self):
6161
name = self.__class__.__name__[4:]
6262
median = self.percentile(50)
6363
megabytes_per_sec = self.data_size / median / 1000000
64-
print(
65-
f"Completed {self.__class__.__name__} {megabytes_per_sec:.3f} MB/s, MEDIAN={self.percentile(50):.3f}s, "
64+
print( # noqa: T201
65+
f"Completed {self.__class__.__name__} {megabytes_per_sec:.3f} MB/s, "
66+
f"MEDIAN={self.percentile(50):.3f}s, "
6667
f"total time={duration:.3f}s, iterations={len(self.results)}"
6768
)
6869
result_data.append(
@@ -119,7 +120,9 @@ def runTest(self):
119120
with warnings.catch_warnings():
120121
warnings.simplefilter("default")
121122
warnings.warn(
122-
f"{self.__class__.__name__} timed out after {MAX_ITERATION_TIME}s, completed {i}/{NUM_ITERATIONS} iterations."
123+
f"{self.__class__.__name__} timed out after {MAX_ITERATION_TIME}s, "
124+
f"completed {i}/{NUM_ITERATIONS} iterations.",
125+
stacklevel=2,
123126
)
124127

125128
break
@@ -132,7 +135,7 @@ class SmallFlatDocTest(PerformanceTest):
132135

133136
def setUp(self):
134137
super().setUp()
135-
with open(self.dataset) as data:
138+
with open(self.dataset) as data: # noqa: PTH123
136139
self.document = json.load(data)
137140

138141
self.data_size = len(encode(self.document)) * NUM_DOCS
@@ -204,14 +207,15 @@ def do_task(self):
204207
def tearDown(self):
205208
super().tearDown()
206209
SmallFlatModelFk.objects.all().delete()
210+
ForeignKeyModel.objects.all().delete()
207211

208212

209213
class LargeFlatDocTest(PerformanceTest):
210214
dataset = "large_doc.json"
211215

212216
def setUp(self):
213217
super().setUp()
214-
with open(self.dataset) as data:
218+
with open(self.dataset) as data: # noqa: PTH123
215219
self.document = json.load(data)
216220

217221
self.data_size = len(encode(self.document)) * NUM_DOCS
@@ -251,7 +255,7 @@ class LargeNestedDocTest(PerformanceTest):
251255

252256
def setUp(self):
253257
super().setUp()
254-
with open(self.dataset) as data:
258+
with open(self.dataset) as data: # noqa: PTH123
255259
self.document = json.load(data)
256260

257261
self.data_size = len(encode(self.document)) * NUM_DOCS

0 commit comments

Comments
 (0)