Merge master into features (#5332)

Merge master into features
This commit is contained in:
Bruno Oliveira 2019-05-29 20:39:27 -03:00 committed by GitHub
commit b0f090890c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 14 additions and 7 deletions

View File

@ -627,7 +627,7 @@ Removals
See our `docs <https://docs.pytest.org/en/latest/deprecations.html#passing-command-line-string-to-pytest-main>`__ on information on how to update your code. See our `docs <https://docs.pytest.org/en/latest/deprecations.html#passing-command-line-string-to-pytest-main>`__ on information on how to update your code.
- `#3086 <https://github.com/pytest-dev/pytest/issues/3086>`_: ``[pytest]`` section in **setup.cfg** files is not longer supported, use ``[tool:pytest]`` instead. ``setup.cfg`` files - `#3086 <https://github.com/pytest-dev/pytest/issues/3086>`_: ``[pytest]`` section in **setup.cfg** files is no longer supported, use ``[tool:pytest]`` instead. ``setup.cfg`` files
are meant for use with ``distutils``, and a section named ``pytest`` has notoriously been a source of conflicts and bugs. are meant for use with ``distutils``, and a section named ``pytest`` has notoriously been a source of conflicts and bugs.
Note that for **pytest.ini** and **tox.ini** files the section remains ``[pytest]``. Note that for **pytest.ini** and **tox.ini** files the section remains ``[pytest]``.
@ -1849,7 +1849,7 @@ Features
exits the debugger. On python 3.2 and higher, use CTRL+D. (`#3299 exits the debugger. On python 3.2 and higher, use CTRL+D. (`#3299
<https://github.com/pytest-dev/pytest/issues/3299>`_) <https://github.com/pytest-dev/pytest/issues/3299>`_)
- pytest not longer changes the log level of the root logger when the - pytest no longer changes the log level of the root logger when the
``log-level`` parameter has greater numeric value than that of the level of ``log-level`` parameter has greater numeric value than that of the level of
the root logger, which makes it play better with custom logging configuration the root logger, which makes it play better with custom logging configuration
in user code. (`#3307 <https://github.com/pytest-dev/pytest/issues/3307>`_) in user code. (`#3307 <https://github.com/pytest-dev/pytest/issues/3307>`_)

View File

@ -11,9 +11,10 @@ def pytest_collection_modifyitems(config, items):
""" """
fast_items = [] fast_items = []
slow_items = [] slow_items = []
slowest_items = []
neutral_items = [] neutral_items = []
slow_fixturenames = ("testdir",) spawn_names = {"spawn_pytest", "spawn"}
for item in items: for item in items:
try: try:
@ -23,15 +24,19 @@ def pytest_collection_modifyitems(config, items):
# (https://github.com/pytest-dev/pytest/issues/5070) # (https://github.com/pytest-dev/pytest/issues/5070)
neutral_items.append(item) neutral_items.append(item)
else: else:
if any(x for x in fixtures if x in slow_fixturenames): if "testdir" in fixtures:
if spawn_names.intersection(item.function.__code__.co_names):
item.add_marker(pytest.mark.uses_pexpect)
slowest_items.append(item)
else:
slow_items.append(item) slow_items.append(item)
else: else:
marker = item.get_closest_marker("slow") marker = item.get_closest_marker("slow")
if marker: if marker:
slow_items.append(item) slowest_items.append(item)
else: else:
fast_items.append(item) fast_items.append(item)
items[:] = fast_items + neutral_items + slow_items items[:] = fast_items + neutral_items + slow_items + slowest_items
yield yield

View File

@ -175,6 +175,8 @@ markers =
baz baz
# conftest.py reorders tests moving slow ones to the end of the list # conftest.py reorders tests moving slow ones to the end of the list
slow slow
# experimental mark for all tests using pexpect
uses_pexpect
[flake8] [flake8]
max-line-length = 120 max-line-length = 120