Skip to content

Commit 4148663

Browse files
authored
Merge pull request #4979 from blueyed/minor
Minor: whitespace, typo, docs
2 parents 6eff306 + 5efe6ab commit 4148663

File tree

9 files changed

+20
-21
lines changed

9 files changed

+20
-21
lines changed

doc/en/reference.rst

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
21
Reference
32
=========
43

@@ -49,7 +48,7 @@ pytest.main
4948
.. autofunction:: _pytest.config.main
5049

5150
pytest.param
52-
~~~~~~~~~~~~~
51+
~~~~~~~~~~~~
5352

5453
.. autofunction:: pytest.param(*values, [id], [marks])
5554

src/_pytest/main.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -225,7 +225,7 @@ def wrap_session(config, doit):
225225
config.notify_exception(excinfo, config.option)
226226
session.exitstatus = EXIT_INTERNALERROR
227227
if excinfo.errisinstance(SystemExit):
228-
sys.stderr.write("mainloop: caught Spurious SystemExit!\n")
228+
sys.stderr.write("mainloop: caught unexpected SystemExit!\n")
229229

230230
finally:
231231
excinfo = None # Explicitly break reference cycle.

src/_pytest/warnings.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -103,8 +103,9 @@ def catch_warnings_for_item(config, ihook, when, item):
103103

104104

105105
def warning_record_to_str(warning_message):
106-
"""Convert a warnings.WarningMessage to a string, taking in account a lot of unicode shenaningans in Python 2.
106+
"""Convert a warnings.WarningMessage to a string.
107107
108+
This takes lot of unicode shenaningans into account for Python 2.
108109
When Python 2 support is dropped this function can be greatly simplified.
109110
"""
110111
warn_msg = warning_message.message

testing/acceptance_test.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -677,6 +677,8 @@ def test_cmdline_python_package(self, testdir, monkeypatch):
677677
def test_cmdline_python_namespace_package(self, testdir, monkeypatch):
678678
"""
679679
test --pyargs option with namespace packages (#1567)
680+
681+
Ref: https://packaging.python.org/guides/packaging-namespace-packages/
680682
"""
681683
monkeypatch.delenv("PYTHONDONTWRITEBYTECODE", raising=False)
682684

testing/logging/test_reporting.py

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,7 @@ def test_root_logger_affected(testdir):
5454
"""
5555
import logging
5656
logger = logging.getLogger()
57+
5758
def test_foo():
5859
logger.info('info text ' + 'going to logger')
5960
logger.warning('warning text ' + 'going to logger')
@@ -66,15 +67,14 @@ def test_foo():
6667
result = testdir.runpytest("--log-level=ERROR", "--log-file=pytest.log")
6768
assert result.ret == 1
6869

69-
# the capture log calls in the stdout section only contain the
70-
# logger.error msg, because --log-level=ERROR
70+
# The capture log calls in the stdout section only contain the
71+
# logger.error msg, because of --log-level=ERROR.
7172
result.stdout.fnmatch_lines(["*error text going to logger*"])
72-
with pytest.raises(pytest.fail.Exception):
73-
result.stdout.fnmatch_lines(["*warning text going to logger*"])
74-
with pytest.raises(pytest.fail.Exception):
75-
result.stdout.fnmatch_lines(["*info text going to logger*"])
73+
stdout = result.stdout.str()
74+
assert "warning text going to logger" not in stdout
75+
assert "info text going to logger" not in stdout
7676

77-
# the log file should contain the warning and the error log messages and
77+
# The log file should contain the warning and the error log messages and
7878
# not the info one, because the default level of the root logger is
7979
# WARNING.
8080
assert os.path.isfile(log_file)
@@ -635,7 +635,6 @@ def test_log_cli_auto_enable(testdir, request, cli_args):
635635
"""
636636
testdir.makepyfile(
637637
"""
638-
import pytest
639638
import logging
640639
641640
def test_log_1():
@@ -653,6 +652,7 @@ def test_log_1():
653652
)
654653

655654
result = testdir.runpytest(cli_args)
655+
stdout = result.stdout.str()
656656
if cli_args == "--log-cli-level=WARNING":
657657
result.stdout.fnmatch_lines(
658658
[
@@ -663,13 +663,13 @@ def test_log_1():
663663
"=* 1 passed in *=",
664664
]
665665
)
666-
assert "INFO" not in result.stdout.str()
666+
assert "INFO" not in stdout
667667
else:
668668
result.stdout.fnmatch_lines(
669669
["*test_log_cli_auto_enable*100%*", "=* 1 passed in *="]
670670
)
671-
assert "INFO" not in result.stdout.str()
672-
assert "WARNING" not in result.stdout.str()
671+
assert "INFO" not in stdout
672+
assert "WARNING" not in stdout
673673

674674

675675
def test_log_file_cli(testdir):

testing/test_cacheprovider.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -884,7 +884,7 @@ def test_always_passes():
884884
def test_readme_failed(self, testdir):
885885
testdir.makepyfile(
886886
"""
887-
def test_always_passes():
887+
def test_always_fails():
888888
assert 0
889889
"""
890890
)

testing/test_session.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -124,14 +124,14 @@ def test_implicit_bad_repr1(self):
124124
)
125125
reprec = testdir.inline_run(p)
126126
passed, skipped, failed = reprec.listoutcomes()
127-
assert len(failed) == 1
127+
assert (len(passed), len(skipped), len(failed)) == (1, 0, 1)
128128
out = failed[0].longrepr.reprcrash.message
129129
assert (
130130
out.find(
131131
"""[Exception("Ha Ha fooled you, I'm a broken repr().") raised in repr()]"""
132132
)
133133
!= -1
134-
) # '
134+
)
135135

136136
def test_skip_file_by_conftest(self, testdir):
137137
testdir.makepyfile(

testing/test_terminal.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -660,7 +660,6 @@ def check(x):
660660
)
661661

662662
def test_verbose_reporting(self, verbose_testfile, testdir, pytestconfig):
663-
664663
result = testdir.runpytest(
665664
verbose_testfile, "-v", "-Walways::pytest.PytestWarning"
666665
)

tox.ini

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,6 @@ commands = {[testenv:py27-trial]commands}
8181

8282
[testenv:docs]
8383
basepython = python3
84-
skipsdist = True
8584
usedevelop = True
8685
changedir = doc/en
8786
deps = -r{toxinidir}/doc/en/requirements.txt
@@ -135,7 +134,6 @@ commands =
135134
[testenv:release]
136135
decription = do a release, required posarg of the version number
137136
basepython = python3.6
138-
skipsdist = True
139137
usedevelop = True
140138
passenv = *
141139
deps =

0 commit comments

Comments
 (0)