Skip to content

Commit cee578e

Browse files
committed
Fix trailing whitespace in terminal output
1 parent b28749e commit cee578e

File tree

5 files changed

+17
-5
lines changed

5 files changed

+17
-5
lines changed

AUTHORS

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@ Dave Hunt
4343
David Díaz-Barquero
4444
David Mohr
4545
David Vierra
46+
Denis Kirisov
4647
Diego Russo
4748
Dmitry Dygalo
4849
Duncan Betts

CHANGELOG.rst

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,8 @@
2727

2828
* Skipping plugin now also works with test items generated by custom collectors (`#2231`_).
2929
Thanks to `@vidartf`_.
30-
31-
*
30+
31+
* Fix trailing whitespace in console output if no .ini file presented (`#2281`_). Thanks `@fbjorn`_ for the PR.
3232

3333
* Conditionless ``xfail`` markers no longer rely on the underlying test item
3434
being an instance of ``PyobjMixin``, and can therefore apply to tests not
@@ -44,13 +44,15 @@
4444
.. _@vidartf: https://github.com/vidartf
4545
.. _@kkoukiou: https://github.com/KKoukiou
4646
.. _@omerhadari: https://github.com/omerhadari
47+
.. _@fbjorn: https://github.com/fbjorn
4748

4849
.. _#2248: https://github.com/pytest-dev/pytest/issues/2248
4950
.. _#2137: https://github.com/pytest-dev/pytest/issues/2137
5051
.. _#2160: https://github.com/pytest-dev/pytest/issues/2160
5152
.. _#2231: https://github.com/pytest-dev/pytest/issues/2231
5253
.. _#2234: https://github.com/pytest-dev/pytest/issues/2234
5354
.. _#2238: https://github.com/pytest-dev/pytest/issues/2238
55+
.. _#2281: https://github.com/pytest-dev/pytest/issues/2281
5456

5557
.. _PEP-479: https://www.python.org/dev/peps/pep-0479/
5658

_pytest/terminal.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -295,8 +295,8 @@ def pytest_sessionstart(self, session):
295295
def pytest_report_header(self, config):
296296
inifile = ""
297297
if config.inifile:
298-
inifile = config.rootdir.bestrelpath(config.inifile)
299-
lines = ["rootdir: %s, inifile: %s" %(config.rootdir, inifile)]
298+
inifile = " " + config.rootdir.bestrelpath(config.inifile)
299+
lines = ["rootdir: %s, inifile:%s" % (config.rootdir, inifile)]
300300

301301
plugininfo = config.pluginmanager.list_plugin_distinfo()
302302
if plugininfo:

testing/test_config.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -519,7 +519,7 @@ def test_consider_args_after_options_for_rootdir_and_inifile(testdir, args):
519519
args[i] = d2
520520
with root.as_cwd():
521521
result = testdir.runpytest(*args)
522-
result.stdout.fnmatch_lines(['*rootdir: *myroot, inifile: '])
522+
result.stdout.fnmatch_lines(['*rootdir: *myroot, inifile:'])
523523

524524

525525
@pytest.mark.skipif("sys.platform == 'win32'")

testing/test_terminal.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -906,3 +906,12 @@ def test_summary_stats(exp_line, exp_color, stats_arg):
906906
print("Actually got: \"%s\"; with color \"%s\"" % (line, color))
907907
assert line == exp_line
908908
assert color == exp_color
909+
910+
911+
def test_no_trailing_whitespace_after_inifile_word(testdir):
912+
result = testdir.runpytest('')
913+
assert 'inifile:\n' in result.stdout.str()
914+
915+
testdir.makeini('[pytest]')
916+
result = testdir.runpytest('')
917+
assert 'inifile: tox.ini\n' in result.stdout.str()

0 commit comments

Comments
 (0)