Skip to content

Commit 78885c9

Browse files
committed
Upgrade Python syntax with pyupgrade
1 parent 05f4589 commit 78885c9

File tree

4 files changed

+8
-8
lines changed

4 files changed

+8
-8
lines changed

pytest_django/live_server_helper.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ def stop(self):
6868

6969
@property
7070
def url(self):
71-
return "http://%s:%s" % (self.thread.host, self.thread.port)
71+
return "http://{}:{}".format(self.thread.host, self.thread.port)
7272

7373
if sys.version_info < (3, 0):
7474

pytest_django/plugin.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -302,7 +302,7 @@ def pytest_load_initial_conftests(early_config, parser, args):
302302
ds_source = None
303303

304304
if ds:
305-
early_config._dsm_report_header = "Django settings: %s (from %s)" % (
305+
early_config._dsm_report_header = "Django settings: {} (from {})".format(
306306
ds,
307307
ds_source,
308308
)
@@ -366,13 +366,13 @@ def _classmethod_is_defined_at_leaf(cls, method_name):
366366
try:
367367
f = method.__func__
368368
except AttributeError:
369-
pytest.fail("%s.%s should be a classmethod" % (cls, method_name))
369+
pytest.fail("{}.{} should be a classmethod".format(cls, method_name))
370370
if PY2 and not (
371371
inspect.ismethod(method)
372372
and inspect.isclass(method.__self__)
373373
and issubclass(cls, method.__self__)
374374
):
375-
pytest.fail("%s.%s should be a classmethod" % (cls, method_name))
375+
pytest.fail("{}.{} should be a classmethod".format(cls, method_name))
376376
return f is not super_method.__func__
377377

378378

@@ -677,7 +677,7 @@ def __mod__(self, var):
677677
"""Handle TEMPLATE_STRING_IF_INVALID % var."""
678678
origin = self._get_origin()
679679
if origin:
680-
msg = "Undefined template variable '%s' in '%s'" % (var, origin)
680+
msg = "Undefined template variable '{}' in '{}'".format(var, origin)
681681
else:
682682
msg = "Undefined template variable '%s'" % var
683683
if self.fail:

pytest_django_test/db_helpers.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ def db_exists(db_suffix=None):
8787
db_engine = get_db_engine()
8888

8989
if db_suffix:
90-
name = "%s_%s" % (name, db_suffix)
90+
name = "{}_{}".format(name, db_suffix)
9191

9292
if db_engine == "postgresql_psycopg2":
9393
r = run_cmd("psql", name, "-c", "SELECT 1")

tests/test_fixtures.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -308,7 +308,7 @@ def test_settings_before(self):
308308
from django.conf import settings
309309

310310
assert (
311-
"%s.%s" % (settings.__class__.__module__, settings.__class__.__name__)
311+
"{}.{}".format(settings.__class__.__module__, settings.__class__.__name__)
312312
== "django.conf.Settings"
313313
)
314314
TestLiveServer._test_settings_before_run = True
@@ -326,7 +326,7 @@ def test_settings_restored(self):
326326

327327
assert TestLiveServer._test_settings_before_run is True
328328
assert (
329-
"%s.%s" % (settings.__class__.__module__, settings.__class__.__name__)
329+
"{}.{}".format(settings.__class__.__module__, settings.__class__.__name__)
330330
== "django.conf.Settings"
331331
)
332332
if django.VERSION >= (1, 11):

0 commit comments

Comments
 (0)