Merge pull request #4979 from blueyed/minor
Minor: whitespace, typo, docs
This commit is contained in:
commit
4148663706
|
@ -1,4 +1,3 @@
|
|||
|
||||
Reference
|
||||
=========
|
||||
|
||||
|
@ -49,7 +48,7 @@ pytest.main
|
|||
.. autofunction:: _pytest.config.main
|
||||
|
||||
pytest.param
|
||||
~~~~~~~~~~~~~
|
||||
~~~~~~~~~~~~
|
||||
|
||||
.. autofunction:: pytest.param(*values, [id], [marks])
|
||||
|
||||
|
|
|
@ -225,7 +225,7 @@ def wrap_session(config, doit):
|
|||
config.notify_exception(excinfo, config.option)
|
||||
session.exitstatus = EXIT_INTERNALERROR
|
||||
if excinfo.errisinstance(SystemExit):
|
||||
sys.stderr.write("mainloop: caught Spurious SystemExit!\n")
|
||||
sys.stderr.write("mainloop: caught unexpected SystemExit!\n")
|
||||
|
||||
finally:
|
||||
excinfo = None # Explicitly break reference cycle.
|
||||
|
|
|
@ -103,8 +103,9 @@ def catch_warnings_for_item(config, ihook, when, item):
|
|||
|
||||
|
||||
def warning_record_to_str(warning_message):
|
||||
"""Convert a warnings.WarningMessage to a string, taking in account a lot of unicode shenaningans in Python 2.
|
||||
"""Convert a warnings.WarningMessage to a string.
|
||||
|
||||
This takes lot of unicode shenaningans into account for Python 2.
|
||||
When Python 2 support is dropped this function can be greatly simplified.
|
||||
"""
|
||||
warn_msg = warning_message.message
|
||||
|
|
|
@ -677,6 +677,8 @@ class TestInvocationVariants(object):
|
|||
def test_cmdline_python_namespace_package(self, testdir, monkeypatch):
|
||||
"""
|
||||
test --pyargs option with namespace packages (#1567)
|
||||
|
||||
Ref: https://packaging.python.org/guides/packaging-namespace-packages/
|
||||
"""
|
||||
monkeypatch.delenv("PYTHONDONTWRITEBYTECODE", raising=False)
|
||||
|
||||
|
|
|
@ -54,6 +54,7 @@ def test_root_logger_affected(testdir):
|
|||
"""
|
||||
import logging
|
||||
logger = logging.getLogger()
|
||||
|
||||
def test_foo():
|
||||
logger.info('info text ' + 'going to logger')
|
||||
logger.warning('warning text ' + 'going to logger')
|
||||
|
@ -66,15 +67,14 @@ def test_root_logger_affected(testdir):
|
|||
result = testdir.runpytest("--log-level=ERROR", "--log-file=pytest.log")
|
||||
assert result.ret == 1
|
||||
|
||||
# the capture log calls in the stdout section only contain the
|
||||
# logger.error msg, because --log-level=ERROR
|
||||
# The capture log calls in the stdout section only contain the
|
||||
# logger.error msg, because of --log-level=ERROR.
|
||||
result.stdout.fnmatch_lines(["*error text going to logger*"])
|
||||
with pytest.raises(pytest.fail.Exception):
|
||||
result.stdout.fnmatch_lines(["*warning text going to logger*"])
|
||||
with pytest.raises(pytest.fail.Exception):
|
||||
result.stdout.fnmatch_lines(["*info text going to logger*"])
|
||||
stdout = result.stdout.str()
|
||||
assert "warning text going to logger" not in stdout
|
||||
assert "info text going to logger" not in stdout
|
||||
|
||||
# the log file should contain the warning and the error log messages and
|
||||
# The log file should contain the warning and the error log messages and
|
||||
# not the info one, because the default level of the root logger is
|
||||
# WARNING.
|
||||
assert os.path.isfile(log_file)
|
||||
|
@ -635,7 +635,6 @@ def test_log_cli_auto_enable(testdir, request, cli_args):
|
|||
"""
|
||||
testdir.makepyfile(
|
||||
"""
|
||||
import pytest
|
||||
import logging
|
||||
|
||||
def test_log_1():
|
||||
|
@ -653,6 +652,7 @@ def test_log_cli_auto_enable(testdir, request, cli_args):
|
|||
)
|
||||
|
||||
result = testdir.runpytest(cli_args)
|
||||
stdout = result.stdout.str()
|
||||
if cli_args == "--log-cli-level=WARNING":
|
||||
result.stdout.fnmatch_lines(
|
||||
[
|
||||
|
@ -663,13 +663,13 @@ def test_log_cli_auto_enable(testdir, request, cli_args):
|
|||
"=* 1 passed in *=",
|
||||
]
|
||||
)
|
||||
assert "INFO" not in result.stdout.str()
|
||||
assert "INFO" not in stdout
|
||||
else:
|
||||
result.stdout.fnmatch_lines(
|
||||
["*test_log_cli_auto_enable*100%*", "=* 1 passed in *="]
|
||||
)
|
||||
assert "INFO" not in result.stdout.str()
|
||||
assert "WARNING" not in result.stdout.str()
|
||||
assert "INFO" not in stdout
|
||||
assert "WARNING" not in stdout
|
||||
|
||||
|
||||
def test_log_file_cli(testdir):
|
||||
|
|
|
@ -884,7 +884,7 @@ class TestReadme(object):
|
|||
def test_readme_failed(self, testdir):
|
||||
testdir.makepyfile(
|
||||
"""
|
||||
def test_always_passes():
|
||||
def test_always_fails():
|
||||
assert 0
|
||||
"""
|
||||
)
|
||||
|
|
|
@ -124,14 +124,14 @@ class SessionTests(object):
|
|||
)
|
||||
reprec = testdir.inline_run(p)
|
||||
passed, skipped, failed = reprec.listoutcomes()
|
||||
assert len(failed) == 1
|
||||
assert (len(passed), len(skipped), len(failed)) == (1, 0, 1)
|
||||
out = failed[0].longrepr.reprcrash.message
|
||||
assert (
|
||||
out.find(
|
||||
"""[Exception("Ha Ha fooled you, I'm a broken repr().") raised in repr()]"""
|
||||
)
|
||||
!= -1
|
||||
) # '
|
||||
)
|
||||
|
||||
def test_skip_file_by_conftest(self, testdir):
|
||||
testdir.makepyfile(
|
||||
|
|
|
@ -660,7 +660,6 @@ class TestTerminalFunctional(object):
|
|||
)
|
||||
|
||||
def test_verbose_reporting(self, verbose_testfile, testdir, pytestconfig):
|
||||
|
||||
result = testdir.runpytest(
|
||||
verbose_testfile, "-v", "-Walways::pytest.PytestWarning"
|
||||
)
|
||||
|
|
2
tox.ini
2
tox.ini
|
@ -81,7 +81,6 @@ commands = {[testenv:py27-trial]commands}
|
|||
|
||||
[testenv:docs]
|
||||
basepython = python3
|
||||
skipsdist = True
|
||||
usedevelop = True
|
||||
changedir = doc/en
|
||||
deps = -r{toxinidir}/doc/en/requirements.txt
|
||||
|
@ -135,7 +134,6 @@ commands =
|
|||
[testenv:release]
|
||||
decription = do a release, required posarg of the version number
|
||||
basepython = python3.6
|
||||
skipsdist = True
|
||||
usedevelop = True
|
||||
passenv = *
|
||||
deps =
|
||||
|
|
Loading…
Reference in New Issue