Skip to content

Commit 3eb4973

Browse files
author
boris
committed
remove %s formatting from docs
1 parent a77c83a commit 3eb4973

File tree

9 files changed

+18
-18
lines changed

9 files changed

+18
-18
lines changed

doc/en/capture.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ is that you can use print statements for debugging:
5757
5858
5959
def setup_function(function):
60-
print("setting up %s" % function)
60+
print("setting up", function)
6161
6262
6363
def test_func1():

doc/en/example/assertion/failure_demo.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -177,7 +177,7 @@ def test_tupleerror(self):
177177

178178
def test_reinterpret_fails_with_print_for_the_fun_of_it(self):
179179
items = [1, 2, 3]
180-
print("items is %r" % items)
180+
print("items is {!r}".format(items))
181181
a, b = items.pop()
182182

183183
def test_some_error(self):

doc/en/example/markers.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -384,7 +384,7 @@ specifies via named environments:
384384
envnames = [mark.args[0] for mark in item.iter_markers(name="env")]
385385
if envnames:
386386
if item.config.getoption("-E") not in envnames:
387-
pytest.skip("test requires env in %r" % envnames)
387+
pytest.skip("test requires env in {!r}".format(envnames))
388388
389389
A test file using this local plugin:
390390

@@ -578,7 +578,7 @@ for your particular platform, you could use the following plugin:
578578
supported_platforms = ALL.intersection(mark.name for mark in item.iter_markers())
579579
plat = sys.platform
580580
if supported_platforms and plat not in supported_platforms:
581-
pytest.skip("cannot run on platform %s" % (plat))
581+
pytest.skip("cannot run on platform {}".format(plat))
582582
583583
then tests will be skipped if they were specified for a different platform.
584584
Let's do a little test file to show how this looks like:

doc/en/example/multipython.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,4 +69,4 @@ def load_and_is_true(self, expression):
6969
@pytest.mark.parametrize("obj", [42, {}, {1: 3}])
7070
def test_basic_objects(python1, python2, obj):
7171
python1.dumps(obj)
72-
python2.load_and_is_true("obj == %s" % obj)
72+
python2.load_and_is_true("obj == {}".format(obj))

doc/en/example/nonpython/conftest.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,13 +33,13 @@ def repr_failure(self, excinfo):
3333
return "\n".join(
3434
[
3535
"usecase execution failed",
36-
" spec failed: %r: %r" % excinfo.value.args[1:3],
36+
" spec failed: {1!r}: {2!r}".format(*excinfo.value.args),
3737
" no further details known at this point.",
3838
]
3939
)
4040

4141
def reportinfo(self):
42-
return self.fspath, 0, "usecase: %s" % self.name
42+
return self.fspath, 0, "usecase: {}".format(self.name)
4343

4444

4545
class YamlException(Exception):

doc/en/example/reportingdemo.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -434,7 +434,7 @@ Here is a nice run of several failures and how ``pytest`` presents things:
434434
435435
def test_reinterpret_fails_with_print_for_the_fun_of_it(self):
436436
items = [1, 2, 3]
437-
print("items is %r" % items)
437+
print("items is {!r}".format(items))
438438
> a, b = items.pop()
439439
E TypeError: 'int' object is not iterable
440440

doc/en/example/simple.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -478,7 +478,7 @@ an ``incremental`` marker which is to be used on classes:
478478
if "incremental" in item.keywords:
479479
previousfailed = getattr(item.parent, "_previousfailed", None)
480480
if previousfailed is not None:
481-
pytest.xfail("previous test failed (%s)" % previousfailed.name)
481+
pytest.xfail("previous test failed ({})".format(previousfailed.name))
482482
483483
These two hook implementations work together to abort incremental-marked
484484
tests in a class. Here is a test module example:
@@ -684,7 +684,7 @@ case we just write some information out to a ``failures`` file:
684684
with open("failures", mode) as f:
685685
# let's also access a fixture for the fun of it
686686
if "tmpdir" in item.fixturenames:
687-
extra = " (%s)" % item.funcargs["tmpdir"]
687+
extra = " ({})".format(item.funcargs["tmpdir"])
688688
else:
689689
extra = ""
690690

doc/en/fixture.rst

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -629,7 +629,7 @@ through the special :py:class:`request <FixtureRequest>` object:
629629
def smtp_connection(request):
630630
smtp_connection = smtplib.SMTP(request.param, 587, timeout=5)
631631
yield smtp_connection
632-
print("finalizing %s" % smtp_connection)
632+
print("finalizing {}".format(smtp_connection))
633633
smtp_connection.close()
634634
635635
The main change is the declaration of ``params`` with
@@ -902,25 +902,25 @@ to show the setup/teardown flow:
902902
@pytest.fixture(scope="module", params=["mod1", "mod2"])
903903
def modarg(request):
904904
param = request.param
905-
print(" SETUP modarg %s" % param)
905+
print(" SETUP modarg", param)
906906
yield param
907-
print(" TEARDOWN modarg %s" % param)
907+
print(" TEARDOWN modarg", param)
908908
909909
910910
@pytest.fixture(scope="function", params=[1, 2])
911911
def otherarg(request):
912912
param = request.param
913-
print(" SETUP otherarg %s" % param)
913+
print(" SETUP otherarg", param)
914914
yield param
915-
print(" TEARDOWN otherarg %s" % param)
915+
print(" TEARDOWN otherarg", param)
916916
917917
918918
def test_0(otherarg):
919-
print(" RUN test0 with otherarg %s" % otherarg)
919+
print(" RUN test0 with otherarg", otherarg)
920920
921921
922922
def test_1(modarg):
923-
print(" RUN test1 with modarg %s" % modarg)
923+
print(" RUN test1 with modarg", modarg)
924924
925925
926926
def test_2(otherarg, modarg):

doc/en/getting-started.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ Install ``pytest``
2828
.. code-block:: bash
2929
3030
$ pytest --version
31-
This is pytest version 5.x.y, imported from $PYTHON_PREFIX/lib/python3.6/site-packages/pytest.py
31+
This is pytest version 5.x.y, imported from $PYTHON_PREFIX/lib/python3.x/site-packages/pytest.py
3232
3333
.. _`simpletest`:
3434

0 commit comments

Comments
 (0)