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