Bug 1472201 - Vendor pytest 3.6.2 and dependencies; r?ahal draft
authorDave Hunt <dhunt@mozilla.com>
Fri, 29 Jun 2018 15:37:31 +0100
changeset 812552 b24708f98a7e5517c36d3a79bb7ce4e75d01e59a
parent 812437 bf149090f6b5db3fe86618b5f1047b70b1bff8b5
push id114584
push userbmo:dave.hunt@gmail.com
push dateFri, 29 Jun 2018 15:35:51 +0000
reviewersahal
bugs1472201
milestone63.0a1
Bug 1472201 - Vendor pytest 3.6.2 and dependencies; r?ahal MozReview-Commit-ID: 5qfK6OygVMH
Pipfile
Pipfile.lock
build/virtualenv_packages.txt
third_party/python/atomicwrites/LICENSE
third_party/python/atomicwrites/MANIFEST.in
third_party/python/atomicwrites/PKG-INFO
third_party/python/atomicwrites/README.rst
third_party/python/atomicwrites/atomicwrites/__init__.py
third_party/python/atomicwrites/docs/Makefile
third_party/python/atomicwrites/docs/conf.py
third_party/python/atomicwrites/docs/index.rst
third_party/python/atomicwrites/docs/make.bat
third_party/python/atomicwrites/setup.cfg
third_party/python/atomicwrites/setup.py
third_party/python/atomicwrites/tests/test_atomicwrites.py
third_party/python/funcsigs/CHANGELOG
third_party/python/funcsigs/LICENSE
third_party/python/funcsigs/MANIFEST.in
third_party/python/funcsigs/PKG-INFO
third_party/python/funcsigs/README.rst
third_party/python/funcsigs/docs/Makefile
third_party/python/funcsigs/docs/_templates/page.html
third_party/python/funcsigs/docs/conf.py
third_party/python/funcsigs/docs/index.rst
third_party/python/funcsigs/funcsigs/__init__.py
third_party/python/funcsigs/funcsigs/version.py
third_party/python/funcsigs/setup.cfg
third_party/python/funcsigs/setup.py
third_party/python/funcsigs/tests/__init__.py
third_party/python/funcsigs/tests/test_formatannotation.py
third_party/python/funcsigs/tests/test_funcsigs.py
third_party/python/funcsigs/tests/test_inspect.py
third_party/python/more-itertools/LICENSE
third_party/python/more-itertools/MANIFEST.in
third_party/python/more-itertools/PKG-INFO
third_party/python/more-itertools/README.rst
third_party/python/more-itertools/docs/Makefile
third_party/python/more-itertools/docs/api.rst
third_party/python/more-itertools/docs/conf.py
third_party/python/more-itertools/docs/index.rst
third_party/python/more-itertools/docs/license.rst
third_party/python/more-itertools/docs/make.bat
third_party/python/more-itertools/docs/testing.rst
third_party/python/more-itertools/docs/versions.rst
third_party/python/more-itertools/more_itertools/__init__.py
third_party/python/more-itertools/more_itertools/more.py
third_party/python/more-itertools/more_itertools/recipes.py
third_party/python/more-itertools/more_itertools/tests/__init__.py
third_party/python/more-itertools/more_itertools/tests/test_more.py
third_party/python/more-itertools/more_itertools/tests/test_recipes.py
third_party/python/more-itertools/setup.cfg
third_party/python/more-itertools/setup.py
third_party/python/more-itertools/tox.ini
third_party/python/pluggy/LICENSE
third_party/python/pluggy/MANIFEST.in
third_party/python/pluggy/PKG-INFO
third_party/python/pluggy/README.rst
third_party/python/pluggy/pluggy/__init__.py
third_party/python/pluggy/pluggy/callers.py
third_party/python/pluggy/setup.cfg
third_party/python/pluggy/setup.py
third_party/python/pluggy/testing/benchmark.py
third_party/python/pluggy/testing/conftest.py
third_party/python/pluggy/testing/test_details.py
third_party/python/pluggy/testing/test_helpers.py
third_party/python/pluggy/testing/test_hookrelay.py
third_party/python/pluggy/testing/test_method_ordering.py
third_party/python/pluggy/testing/test_multicall.py
third_party/python/pluggy/testing/test_pluginmanager.py
third_party/python/pluggy/testing/test_tracer.py
third_party/python/pluggy/tox.ini
third_party/python/py/.gitignore
third_party/python/py/.hgignore
third_party/python/py/.hgtags
third_party/python/py/.travis.yml
third_party/python/py/CHANGELOG
third_party/python/py/HOWTORELEASE.rst
third_party/python/py/PKG-INFO
third_party/python/py/README.rst
third_party/python/py/appveyor.yml
third_party/python/py/doc/path.txt
third_party/python/py/py/__init__.py
third_party/python/py/py/_path/local.py
third_party/python/py/py/_version.py
third_party/python/py/setup.py
third_party/python/py/testing/path/test_local.py
third_party/python/pytest/.coveragerc
third_party/python/pytest/.github/PULL_REQUEST_TEMPLATE.md
third_party/python/pytest/.gitignore
third_party/python/pytest/.pre-commit-config.yaml
third_party/python/pytest/.travis.yml
third_party/python/pytest/AUTHORS
third_party/python/pytest/CHANGELOG.rst
third_party/python/pytest/CONTRIBUTING.rst
third_party/python/pytest/HOWTORELEASE.rst
third_party/python/pytest/PKG-INFO
third_party/python/pytest/README.rst
third_party/python/pytest/_pytest/__init__.py
third_party/python/pytest/_pytest/_argcomplete.py
third_party/python/pytest/_pytest/_code/__init__.py
third_party/python/pytest/_pytest/_code/_py2traceback.py
third_party/python/pytest/_pytest/_code/code.py
third_party/python/pytest/_pytest/_code/source.py
third_party/python/pytest/_pytest/_pluggy.py
third_party/python/pytest/_pytest/_version.py
third_party/python/pytest/_pytest/assertion/__init__.py
third_party/python/pytest/_pytest/assertion/rewrite.py
third_party/python/pytest/_pytest/assertion/truncate.py
third_party/python/pytest/_pytest/assertion/util.py
third_party/python/pytest/_pytest/cacheprovider.py
third_party/python/pytest/_pytest/capture.py
third_party/python/pytest/_pytest/compat.py
third_party/python/pytest/_pytest/config.py
third_party/python/pytest/_pytest/debugging.py
third_party/python/pytest/_pytest/deprecated.py
third_party/python/pytest/_pytest/doctest.py
third_party/python/pytest/_pytest/fixtures.py
third_party/python/pytest/_pytest/freeze_support.py
third_party/python/pytest/_pytest/helpconfig.py
third_party/python/pytest/_pytest/hookspec.py
third_party/python/pytest/_pytest/junitxml.py
third_party/python/pytest/_pytest/main.py
third_party/python/pytest/_pytest/mark.py
third_party/python/pytest/_pytest/monkeypatch.py
third_party/python/pytest/_pytest/nodes.py
third_party/python/pytest/_pytest/nose.py
third_party/python/pytest/_pytest/outcomes.py
third_party/python/pytest/_pytest/pastebin.py
third_party/python/pytest/_pytest/pytester.py
third_party/python/pytest/_pytest/python.py
third_party/python/pytest/_pytest/python_api.py
third_party/python/pytest/_pytest/recwarn.py
third_party/python/pytest/_pytest/resultlog.py
third_party/python/pytest/_pytest/runner.py
third_party/python/pytest/_pytest/setuponly.py
third_party/python/pytest/_pytest/setupplan.py
third_party/python/pytest/_pytest/skipping.py
third_party/python/pytest/_pytest/terminal.py
third_party/python/pytest/_pytest/tmpdir.py
third_party/python/pytest/_pytest/unittest.py
third_party/python/pytest/_pytest/vendored_packages/README.md
third_party/python/pytest/_pytest/vendored_packages/__init__.py
third_party/python/pytest/_pytest/vendored_packages/pluggy-0.4.0.dist-info/DESCRIPTION.rst
third_party/python/pytest/_pytest/vendored_packages/pluggy-0.4.0.dist-info/INSTALLER
third_party/python/pytest/_pytest/vendored_packages/pluggy-0.4.0.dist-info/LICENSE.txt
third_party/python/pytest/_pytest/vendored_packages/pluggy-0.4.0.dist-info/METADATA
third_party/python/pytest/_pytest/vendored_packages/pluggy-0.4.0.dist-info/RECORD
third_party/python/pytest/_pytest/vendored_packages/pluggy-0.4.0.dist-info/WHEEL
third_party/python/pytest/_pytest/vendored_packages/pluggy-0.4.0.dist-info/metadata.json
third_party/python/pytest/_pytest/vendored_packages/pluggy-0.4.0.dist-info/top_level.txt
third_party/python/pytest/_pytest/vendored_packages/pluggy.py
third_party/python/pytest/_pytest/warnings.py
third_party/python/pytest/appveyor.yml
third_party/python/pytest/bench/bench.py
third_party/python/pytest/bench/bench_argcomplete.py
third_party/python/pytest/bench/empty.py
third_party/python/pytest/bench/manyparam.py
third_party/python/pytest/bench/skip.py
third_party/python/pytest/changelog/README.rst
third_party/python/pytest/doc/en/Makefile
third_party/python/pytest/doc/en/_templates/globaltoc.html
third_party/python/pytest/doc/en/_templates/links.html
third_party/python/pytest/doc/en/_themes/flask/theme.conf
third_party/python/pytest/doc/en/_themes/flask_theme_support.py
third_party/python/pytest/doc/en/announce/index.rst
third_party/python/pytest/doc/en/announce/release-2.0.3.rst
third_party/python/pytest/doc/en/announce/release-2.1.1.rst
third_party/python/pytest/doc/en/announce/release-2.1.2.rst
third_party/python/pytest/doc/en/announce/release-2.1.3.rst
third_party/python/pytest/doc/en/announce/release-2.2.1.rst
third_party/python/pytest/doc/en/announce/release-2.2.2.rst
third_party/python/pytest/doc/en/announce/release-2.2.4.rst
third_party/python/pytest/doc/en/announce/release-2.3.0.rst
third_party/python/pytest/doc/en/announce/release-2.3.1.rst
third_party/python/pytest/doc/en/announce/release-2.3.2.rst
third_party/python/pytest/doc/en/announce/release-2.3.3.rst
third_party/python/pytest/doc/en/announce/release-2.3.4.rst
third_party/python/pytest/doc/en/announce/release-2.3.5.rst
third_party/python/pytest/doc/en/announce/release-2.4.0.rst
third_party/python/pytest/doc/en/announce/release-2.4.1.rst
third_party/python/pytest/doc/en/announce/release-2.4.2.rst
third_party/python/pytest/doc/en/announce/release-2.5.0.rst
third_party/python/pytest/doc/en/announce/release-2.5.1.rst
third_party/python/pytest/doc/en/announce/release-2.5.2.rst
third_party/python/pytest/doc/en/announce/release-2.6.1.rst
third_party/python/pytest/doc/en/announce/release-2.6.2.rst
third_party/python/pytest/doc/en/announce/release-2.6.3.rst
third_party/python/pytest/doc/en/announce/release-2.7.0.rst
third_party/python/pytest/doc/en/announce/release-2.7.2.rst
third_party/python/pytest/doc/en/announce/release-2.8.3.rst
third_party/python/pytest/doc/en/announce/release-2.8.7.rst
third_party/python/pytest/doc/en/announce/release-2.9.0.rst
third_party/python/pytest/doc/en/announce/release-2.9.1.rst
third_party/python/pytest/doc/en/announce/release-3.0.0.rst
third_party/python/pytest/doc/en/announce/release-3.0.1.rst
third_party/python/pytest/doc/en/announce/release-3.0.2.rst
third_party/python/pytest/doc/en/announce/release-3.0.3.rst
third_party/python/pytest/doc/en/announce/release-3.0.4.rst
third_party/python/pytest/doc/en/announce/release-3.0.5.rst
third_party/python/pytest/doc/en/announce/release-3.0.6.rst
third_party/python/pytest/doc/en/announce/release-3.0.7.rst
third_party/python/pytest/doc/en/announce/release-3.1.1.rst
third_party/python/pytest/doc/en/announce/release-3.1.2.rst
third_party/python/pytest/doc/en/announce/release-3.1.3.rst
third_party/python/pytest/doc/en/announce/release-3.2.1.rst
third_party/python/pytest/doc/en/announce/release-3.2.2.rst
third_party/python/pytest/doc/en/announce/release-3.2.3.rst
third_party/python/pytest/doc/en/announce/release-3.2.4.rst
third_party/python/pytest/doc/en/announce/release-3.2.5.rst
third_party/python/pytest/doc/en/announce/release-3.3.0.rst
third_party/python/pytest/doc/en/announce/release-3.3.1.rst
third_party/python/pytest/doc/en/announce/release-3.3.2.rst
third_party/python/pytest/doc/en/announce/release-3.4.0.rst
third_party/python/pytest/doc/en/announce/release-3.4.1.rst
third_party/python/pytest/doc/en/announce/release-3.4.2.rst
third_party/python/pytest/doc/en/announce/release-3.5.0.rst
third_party/python/pytest/doc/en/announce/release-3.5.1.rst
third_party/python/pytest/doc/en/announce/release-3.6.0.rst
third_party/python/pytest/doc/en/announce/release-3.6.1.rst
third_party/python/pytest/doc/en/announce/release-3.6.2.rst
third_party/python/pytest/doc/en/assert.rst
third_party/python/pytest/doc/en/backwards-compatibility.rst
third_party/python/pytest/doc/en/bash-completion.rst
third_party/python/pytest/doc/en/builtin.rst
third_party/python/pytest/doc/en/cache.rst
third_party/python/pytest/doc/en/capture.rst
third_party/python/pytest/doc/en/check_sphinx.py
third_party/python/pytest/doc/en/conf.py
third_party/python/pytest/doc/en/contact.rst
third_party/python/pytest/doc/en/contents.rst
third_party/python/pytest/doc/en/customize.rst
third_party/python/pytest/doc/en/development_guide.rst
third_party/python/pytest/doc/en/doctest.rst
third_party/python/pytest/doc/en/example/assertion/failure_demo.py
third_party/python/pytest/doc/en/example/assertion/global_testmodule_config/conftest.py
third_party/python/pytest/doc/en/example/assertion/global_testmodule_config/test_hello.py
third_party/python/pytest/doc/en/example/assertion/global_testmodule_config/test_hello_world.py
third_party/python/pytest/doc/en/example/assertion/test_failures.py
third_party/python/pytest/doc/en/example/assertion/test_setup_flow_example.py
third_party/python/pytest/doc/en/example/attic.rst
third_party/python/pytest/doc/en/example/costlysetup/conftest.py
third_party/python/pytest/doc/en/example/costlysetup/sub1/__init__.py
third_party/python/pytest/doc/en/example/costlysetup/sub1/test_quick.py
third_party/python/pytest/doc/en/example/costlysetup/sub2/__init__.py
third_party/python/pytest/doc/en/example/costlysetup/sub2/test_two.py
third_party/python/pytest/doc/en/example/costlysetup/sub_a/__init__.py
third_party/python/pytest/doc/en/example/costlysetup/sub_a/test_quick.py
third_party/python/pytest/doc/en/example/costlysetup/sub_b/__init__.py
third_party/python/pytest/doc/en/example/costlysetup/sub_b/test_two.py
third_party/python/pytest/doc/en/example/markers.rst
third_party/python/pytest/doc/en/example/multipython.py
third_party/python/pytest/doc/en/example/nonpython.rst
third_party/python/pytest/doc/en/example/nonpython/conftest.py
third_party/python/pytest/doc/en/example/parametrize.rst
third_party/python/pytest/doc/en/example/py2py3/conftest.py
third_party/python/pytest/doc/en/example/py2py3/test_py2.py
third_party/python/pytest/doc/en/example/py2py3/test_py3.py
third_party/python/pytest/doc/en/example/pythoncollection.py
third_party/python/pytest/doc/en/example/pythoncollection.rst
third_party/python/pytest/doc/en/example/reportingdemo.rst
third_party/python/pytest/doc/en/example/simple.rst
third_party/python/pytest/doc/en/example/xfail_demo.py
third_party/python/pytest/doc/en/faq.rst
third_party/python/pytest/doc/en/fixture.rst
third_party/python/pytest/doc/en/funcarg_compare.rst
third_party/python/pytest/doc/en/funcargs.rst
third_party/python/pytest/doc/en/genapi.py
third_party/python/pytest/doc/en/getting-started.rst
third_party/python/pytest/doc/en/goodpractices.rst
third_party/python/pytest/doc/en/index.rst
third_party/python/pytest/doc/en/links.inc
third_party/python/pytest/doc/en/logging.rst
third_party/python/pytest/doc/en/mark.rst
third_party/python/pytest/doc/en/monkeypatch.rst
third_party/python/pytest/doc/en/nose.rst
third_party/python/pytest/doc/en/parametrize.rst
third_party/python/pytest/doc/en/plugins.rst
third_party/python/pytest/doc/en/projects.rst
third_party/python/pytest/doc/en/proposals/parametrize_with_fixtures.rst
third_party/python/pytest/doc/en/reference.rst
third_party/python/pytest/doc/en/requirements.txt
third_party/python/pytest/doc/en/skipping.rst
third_party/python/pytest/doc/en/talks.rst
third_party/python/pytest/doc/en/test/attic.rst
third_party/python/pytest/doc/en/test/config.html
third_party/python/pytest/doc/en/test/dist.html
third_party/python/pytest/doc/en/test/extend.html
third_party/python/pytest/doc/en/test/index.rst
third_party/python/pytest/doc/en/test/mission.rst
third_party/python/pytest/doc/en/test/plugin/cov.rst
third_party/python/pytest/doc/en/test/plugin/coverage.rst
third_party/python/pytest/doc/en/test/plugin/django.rst
third_party/python/pytest/doc/en/test/plugin/figleaf.rst
third_party/python/pytest/doc/en/test/plugin/helpconfig.rst
third_party/python/pytest/doc/en/test/plugin/index.rst
third_party/python/pytest/doc/en/test/plugin/links.rst
third_party/python/pytest/doc/en/test/plugin/nose.rst
third_party/python/pytest/doc/en/test/plugin/oejskit.rst
third_party/python/pytest/doc/en/test/plugin/terminal.rst
third_party/python/pytest/doc/en/test/plugin/xdist.rst
third_party/python/pytest/doc/en/test/test.html
third_party/python/pytest/doc/en/tmpdir.rst
third_party/python/pytest/doc/en/unittest.rst
third_party/python/pytest/doc/en/usage.rst
third_party/python/pytest/doc/en/warnings.rst
third_party/python/pytest/doc/en/writing_plugins.rst
third_party/python/pytest/doc/en/xunit_setup.rst
third_party/python/pytest/extra/get_issues.py
third_party/python/pytest/pyproject.toml
third_party/python/pytest/pytest.py
third_party/python/pytest/scripts/check-rst.py
third_party/python/pytest/setup.py
third_party/python/pytest/src/_pytest/__init__.py
third_party/python/pytest/src/_pytest/_argcomplete.py
third_party/python/pytest/src/_pytest/_code/__init__.py
third_party/python/pytest/src/_pytest/_code/_py2traceback.py
third_party/python/pytest/src/_pytest/_code/code.py
third_party/python/pytest/src/_pytest/_code/source.py
third_party/python/pytest/src/_pytest/_version.py
third_party/python/pytest/src/_pytest/assertion/__init__.py
third_party/python/pytest/src/_pytest/assertion/rewrite.py
third_party/python/pytest/src/_pytest/assertion/truncate.py
third_party/python/pytest/src/_pytest/assertion/util.py
third_party/python/pytest/src/_pytest/cacheprovider.py
third_party/python/pytest/src/_pytest/capture.py
third_party/python/pytest/src/_pytest/compat.py
third_party/python/pytest/src/_pytest/config/__init__.py
third_party/python/pytest/src/_pytest/config/argparsing.py
third_party/python/pytest/src/_pytest/config/exceptions.py
third_party/python/pytest/src/_pytest/config/findpaths.py
third_party/python/pytest/src/_pytest/debugging.py
third_party/python/pytest/src/_pytest/deprecated.py
third_party/python/pytest/src/_pytest/doctest.py
third_party/python/pytest/src/_pytest/fixtures.py
third_party/python/pytest/src/_pytest/freeze_support.py
third_party/python/pytest/src/_pytest/helpconfig.py
third_party/python/pytest/src/_pytest/hookspec.py
third_party/python/pytest/src/_pytest/junitxml.py
third_party/python/pytest/src/_pytest/logging.py
third_party/python/pytest/src/_pytest/main.py
third_party/python/pytest/src/_pytest/mark/__init__.py
third_party/python/pytest/src/_pytest/mark/evaluate.py
third_party/python/pytest/src/_pytest/mark/legacy.py
third_party/python/pytest/src/_pytest/mark/structures.py
third_party/python/pytest/src/_pytest/monkeypatch.py
third_party/python/pytest/src/_pytest/nodes.py
third_party/python/pytest/src/_pytest/nose.py
third_party/python/pytest/src/_pytest/outcomes.py
third_party/python/pytest/src/_pytest/pastebin.py
third_party/python/pytest/src/_pytest/pytester.py
third_party/python/pytest/src/_pytest/python.py
third_party/python/pytest/src/_pytest/python_api.py
third_party/python/pytest/src/_pytest/recwarn.py
third_party/python/pytest/src/_pytest/resultlog.py
third_party/python/pytest/src/_pytest/runner.py
third_party/python/pytest/src/_pytest/setuponly.py
third_party/python/pytest/src/_pytest/setupplan.py
third_party/python/pytest/src/_pytest/skipping.py
third_party/python/pytest/src/_pytest/terminal.py
third_party/python/pytest/src/_pytest/tmpdir.py
third_party/python/pytest/src/_pytest/unittest.py
third_party/python/pytest/src/_pytest/warnings.py
third_party/python/pytest/src/pytest.py
third_party/python/pytest/tasks/__init__.py
third_party/python/pytest/tasks/generate.py
third_party/python/pytest/tasks/release.minor.rst
third_party/python/pytest/tasks/release.patch.rst
third_party/python/pytest/tasks/requirements.txt
third_party/python/pytest/tasks/vendoring.py
third_party/python/pytest/testing/acceptance_test.py
third_party/python/pytest/testing/code/test_code.py
third_party/python/pytest/testing/code/test_excinfo.py
third_party/python/pytest/testing/code/test_source.py
third_party/python/pytest/testing/code/test_source_multiline_block.py
third_party/python/pytest/testing/deprecated_test.py
third_party/python/pytest/testing/freeze/.gitignore
third_party/python/pytest/testing/freeze/create_executable.py
third_party/python/pytest/testing/freeze/runtests_script.py
third_party/python/pytest/testing/freeze/tests/test_trivial.py
third_party/python/pytest/testing/freeze/tox_run.py
third_party/python/pytest/testing/logging/test_fixture.py
third_party/python/pytest/testing/logging/test_formatter.py
third_party/python/pytest/testing/logging/test_reporting.py
third_party/python/pytest/testing/python/approx.py
third_party/python/pytest/testing/python/collect.py
third_party/python/pytest/testing/python/fixture.py
third_party/python/pytest/testing/python/integration.py
third_party/python/pytest/testing/python/metafunc.py
third_party/python/pytest/testing/python/raises.py
third_party/python/pytest/testing/python/setup_only.py
third_party/python/pytest/testing/python/setup_plan.py
third_party/python/pytest/testing/python/show_fixtures_per_test.py
third_party/python/pytest/testing/python/test_deprecations.py
third_party/python/pytest/testing/test_argcomplete.py
third_party/python/pytest/testing/test_assertion.py
third_party/python/pytest/testing/test_assertrewrite.py
third_party/python/pytest/testing/test_cache.py
third_party/python/pytest/testing/test_cacheprovider.py
third_party/python/pytest/testing/test_capture.py
third_party/python/pytest/testing/test_collection.py
third_party/python/pytest/testing/test_compat.py
third_party/python/pytest/testing/test_config.py
third_party/python/pytest/testing/test_conftest.py
third_party/python/pytest/testing/test_doctest.py
third_party/python/pytest/testing/test_entry_points.py
third_party/python/pytest/testing/test_helpconfig.py
third_party/python/pytest/testing/test_junitxml.py
third_party/python/pytest/testing/test_mark.py
third_party/python/pytest/testing/test_modimport.py
third_party/python/pytest/testing/test_monkeypatch.py
third_party/python/pytest/testing/test_nodes.py
third_party/python/pytest/testing/test_nose.py
third_party/python/pytest/testing/test_parseopt.py
third_party/python/pytest/testing/test_pastebin.py
third_party/python/pytest/testing/test_pdb.py
third_party/python/pytest/testing/test_pluginmanager.py
third_party/python/pytest/testing/test_pytester.py
third_party/python/pytest/testing/test_recwarn.py
third_party/python/pytest/testing/test_resultlog.py
third_party/python/pytest/testing/test_runner.py
third_party/python/pytest/testing/test_runner_xunit.py
third_party/python/pytest/testing/test_session.py
third_party/python/pytest/testing/test_skipping.py
third_party/python/pytest/testing/test_terminal.py
third_party/python/pytest/testing/test_tmpdir.py
third_party/python/pytest/testing/test_unittest.py
third_party/python/pytest/testing/test_warnings.py
third_party/python/pytest/tox.ini
--- a/Pipfile
+++ b/Pipfile
@@ -6,14 +6,14 @@ name = "pypi"
 [dev-packages]
 
 [packages]
 attrs = "==18.1.0"
 blessings = "==1.7"
 jsmin = "==2.1.0"
 json-e = "==2.5.0"
 pipenv = "==2018.5.18"
-pytest = "==3.2.5"
+pytest = "==3.6.2"
 python-hglib = "==2.4"
 requests = "==2.9.1"
 six = "==1.10.0"
 virtualenv = "==15.2.0"
 voluptuous = "==0.10.5"
--- a/Pipfile.lock
+++ b/Pipfile.lock
@@ -1,24 +1,31 @@
 {
     "_meta": {
         "hash": {
-            "sha256": "7e168601e5f93e71900ebc68d8c18ff17edb6d5e224bcc83286b9bafaac41fe8"
+            "sha256": "609a35f65e9a4c07e0e1473ec982c6b5028622e9a795b6cfb8555ad8574804f3"
         },
         "pipfile-spec": 6,
         "requires": {},
         "sources": [
             {
                 "name": "pypi",
                 "url": "https://pypi.org/simple",
                 "verify_ssl": true
             }
         ]
     },
     "default": {
+        "atomicwrites": {
+            "hashes": [
+                "sha256:240831ea22da9ab882b551b31d4225591e5e447a68c5e188db5b89ca1d487585",
+                "sha256:a24da68318b08ac9c9c45029f4a10371ab5b20e4226738e150e6e7c571630ae6"
+            ],
+            "version": "==1.1.5"
+        },
         "attrs": {
             "hashes": [
                 "sha256:4b90b09eeeb9b88c35bc642cbac057e45a5fd85367b985bd2809c62b7b939265",
                 "sha256:e0d0eb91441a3b53dab4d9b743eafc1ac44476296a2053b6ca3af0b139faf87b"
             ],
             "index": "pypi",
             "version": "==18.1.0"
         },
@@ -33,52 +40,76 @@
         },
         "certifi": {
             "hashes": [
                 "sha256:13e698f54293db9f89122b0581843a782ad0934a4fe0172d2a980ba77fc61bb7",
                 "sha256:9fa520c1bacfb634fa7af20a76bcbd3d5fb390481724c597da32c719a7dca4b0"
             ],
             "version": "==2018.4.16"
         },
+        "funcsigs": {
+            "hashes": [
+                "sha256:330cc27ccbf7f1e992e69fef78261dc7c6569012cf397db8d3de0234e6c937ca",
+                "sha256:a7bb0f2cf3a3fd1ab2732cb49eba4252c2af4240442415b4abce3b87022a8f50"
+            ],
+            "markers": "python_version < '3.0'",
+            "version": "==1.0.2"
+        },
         "jsmin": {
             "hashes": [
                 "sha256:5d07bf0251a4128e5e8e8eef603849b6b5741c337bff087731a248f9cc774f56"
             ],
             "index": "pypi",
             "version": "==2.1.0"
         },
         "json-e": {
             "hashes": [
                 "sha256:f9114a25ed4b575395fbb2daa1183c5b781a647b387fdf28596220bb114673e8"
             ],
             "index": "pypi",
             "version": "==2.5.0"
         },
+        "more-itertools": {
+            "hashes": [
+                "sha256:2b6b9893337bfd9166bee6a62c2b0c9fe7735dcf85948b387ec8cba30e85d8e8",
+                "sha256:6703844a52d3588f951883005efcf555e49566a48afd4db4e965d69b883980d3",
+                "sha256:a18d870ef2ffca2b8463c0070ad17b5978056f403fb64e3f15fe62a52db21cc0"
+            ],
+            "version": "==4.2.0"
+        },
         "pipenv": {
             "hashes": [
                 "sha256:04b9a8b02a3ff12a5502b335850cfdb192adcfd1d6bbdb7a7c47cae9ab9ddece",
                 "sha256:e96d5bfa6822a17b2200d455aa5f9002c14361c50df1b1e51921479d7c09e741"
             ],
             "index": "pypi",
             "version": "==2018.5.18"
         },
+        "pluggy": {
+            "hashes": [
+                "sha256:7f8ae7f5bdf75671a718d2daf0a64b7885f74510bcd98b1a0bb420eb9a9d0cff",
+                "sha256:d345c8fe681115900d6da8d048ba67c25df42973bda370783cd58826442dcd7c",
+                "sha256:e160a7fcf25762bb60efc7e171d4497ff1d8d2d75a3d0df7a21b76821ecbf5c5"
+            ],
+            "version": "==0.6.0"
+        },
         "py": {
             "hashes": [
-                "sha256:29c9fab495d7528e80ba1e343b958684f4ace687327e6f789a94bf3d1915f881",
-                "sha256:983f77f3331356039fdd792e9220b7b8ee1aa6bd2b25f567a963ff1de5a64f6a"
+                "sha256:3fd59af7435864e1a243790d322d763925431213b6b8529c6ca71081ace3bbf7",
+                "sha256:e31fb2767eb657cbde86c454f02e99cb846d3cd9d61b318525140214fdc0e98e"
             ],
-            "version": "==1.5.3"
+            "version": "==1.5.4"
         },
         "pytest": {
             "hashes": [
-                "sha256:241d7e7798d79192a123ceaf64c602b4d233eacf6d6e42ae27caa97f498b7dc6",
-                "sha256:6d5bd4f7113b444c55a3bbb5c738a3dd80d43563d063fc42dcb0aaefbdd78b81"
+                "sha256:8ea01fc4fcc8e1b1e305252b4bc80a1528019ab99fd3b88666c9dc38d754406c",
+                "sha256:90898786b3d0b880b47645bae7b51aa9bbf1e9d1e4510c2cfd15dd65c70ea0cd"
             ],
             "index": "pypi",
-            "version": "==3.2.5"
+            "version": "==3.6.2"
         },
         "python-hglib": {
             "hashes": [
                 "sha256:693d6ed92a6566e78802c7a03c256cda33d08c63ad3f00fcfa11379b184b9462"
             ],
             "index": "pypi",
             "version": "==2.4"
         },
--- a/build/virtualenv_packages.txt
+++ b/build/virtualenv_packages.txt
@@ -1,37 +1,41 @@
 mozilla.pth:python/mach
 mozilla.pth:python/mozboot
 mozilla.pth:python/mozbuild
 mozilla.pth:python/mozlint
 mozilla.pth:python/mozrelease
 mozilla.pth:python/mozterm
 mozilla.pth:python/mozversioncontrol
 mozilla.pth:python/l10n
+mozilla.pth:third_party/python/atomicwrites
 mozilla.pth:third_party/python/attrs/src
 mozilla.pth:third_party/python/blessings
 mozilla.pth:third_party/python/compare-locales
 mozilla.pth:third_party/python/configobj
 mozilla.pth:third_party/python/cram
 mozilla.pth:third_party/python/dlmanager
 mozilla.pth:third_party/python/fluent
+mozilla.pth:third_party/python/funcsigs
 mozilla.pth:third_party/python/futures
+mozilla.pth:third_party/python/more-itertools
 mozilla.pth:third_party/python/python-hglib
+mozilla.pth:third_party/python/pluggy
 mozilla.pth:third_party/python/jsmin
 optional:setup.py:third_party/python/psutil:build_ext:--inplace
 mozilla.pth:third_party/python/psutil
 mozilla.pth:third_party/python/pylru
 mozilla.pth:third_party/python/which
 mozilla.pth:third_party/python/pystache
 mozilla.pth:third_party/python/pyyaml/lib
 mozilla.pth:third_party/python/requests
 mozilla.pth:third_party/python/requests-unixsocket
 mozilla.pth:third_party/python/slugid
 mozilla.pth:third_party/python/py
-mozilla.pth:third_party/python/pytest
+mozilla.pth:third_party/python/pytest/src
 mozilla.pth:third_party/python/pytoml
 mozilla.pth:third_party/python/redo
 mozilla.pth:third_party/python/six
 mozilla.pth:third_party/python/voluptuous
 mozilla.pth:third_party/python/json-e
 mozilla.pth:build
 objdir:build
 mozilla.pth:build/pymake
new file mode 100644
--- /dev/null
+++ b/third_party/python/atomicwrites/LICENSE
@@ -0,0 +1,19 @@
+Copyright (c) 2015-2016 Markus Unterwaditzer
+
+Permission is hereby granted, free of charge, to any person obtaining a copy of
+this software and associated documentation files (the "Software"), to deal in
+the Software without restriction, including without limitation the rights to
+use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
+of the Software, and to permit persons to whom the Software is furnished to do
+so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in all
+copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+SOFTWARE.
new file mode 100644
--- /dev/null
+++ b/third_party/python/atomicwrites/MANIFEST.in
@@ -0,0 +1,6 @@
+include LICENSE
+include README.rst
+
+recursive-include docs *
+recursive-include tests *
+prune docs/_build
new file mode 100644
--- /dev/null
+++ b/third_party/python/atomicwrites/PKG-INFO
@@ -0,0 +1,112 @@
+Metadata-Version: 1.0
+Name: atomicwrites
+Version: 1.1.5
+Summary: Atomic file writes.
+Home-page: https://github.com/untitaker/python-atomicwrites
+Author: Markus Unterwaditzer
+Author-email: markus@unterwaditzer.net
+License: MIT
+Description: ===================
+        python-atomicwrites
+        ===================
+        
+        .. image:: https://travis-ci.org/untitaker/python-atomicwrites.svg?branch=master
+            :target: https://travis-ci.org/untitaker/python-atomicwrites
+        
+        .. image:: https://ci.appveyor.com/api/projects/status/vadc4le3c27to59x/branch/master?svg=true
+           :target: https://ci.appveyor.com/project/untitaker/python-atomicwrites/branch/master
+        
+        Atomic file writes.
+        
+        .. code-block:: python
+        
+            from atomicwrites import atomic_write
+        
+            with atomic_write('foo.txt', overwrite=True) as f:
+                f.write('Hello world.')
+                # "foo.txt" doesn't exist yet.
+        
+            # Now it does.
+        
+        
+        Features that distinguish it from other similar libraries (see `Alternatives and Credit`_):
+        
+        - Race-free assertion that the target file doesn't yet exist. This can be
+          controlled with the ``overwrite`` parameter.
+        
+        - Windows support, although not well-tested. The MSDN resources are not very
+          explicit about which operations are atomic.
+        
+        - Simple high-level API that wraps a very flexible class-based API.
+        
+        - Consistent error handling across platforms.
+        
+        
+        How it works
+        ============
+        
+        It uses a temporary file in the same directory as the given path. This ensures
+        that the temporary file resides on the same filesystem.
+        
+        The temporary file will then be atomically moved to the target location: On
+        POSIX, it will use ``rename`` if files should be overwritten, otherwise a
+        combination of ``link`` and ``unlink``. On Windows, it uses MoveFileEx_ through
+        stdlib's ``ctypes`` with the appropriate flags.
+        
+        Note that with ``link`` and ``unlink``, there's a timewindow where the file
+        might be available under two entries in the filesystem: The name of the
+        temporary file, and the name of the target file.
+        
+        Also note that the permissions of the target file may change this way. In some
+        situations a ``chmod`` can be issued without any concurrency problems, but
+        since that is not always the case, this library doesn't do it by itself.
+        
+        .. _MoveFileEx: https://msdn.microsoft.com/en-us/library/windows/desktop/aa365240%28v=vs.85%29.aspx
+        
+        fsync
+        -----
+        
+        On POSIX, ``fsync`` is invoked on the temporary file after it is written (to
+        flush file content and metadata), and on the parent directory after the file is
+        moved (to flush filename).
+        
+        ``fsync`` does not take care of disks' internal buffers, but there don't seem
+        to be any standard POSIX APIs for that. On OS X, ``fcntl`` is used with
+        ``F_FULLFSYNC`` instead of ``fsync`` for that reason.
+        
+        On Windows, `_commit <https://msdn.microsoft.com/en-us/library/17618685.aspx>`_
+        is used, but there are no guarantees about disk internal buffers.
+        
+        Alternatives and Credit
+        =======================
+        
+        Atomicwrites is directly inspired by the following libraries (and shares a
+        minimal amount of code):
+        
+        - The Trac project's `utility functions
+          <http://www.edgewall.org/docs/tags-trac-0.11.7/epydoc/trac.util-pysrc.html>`_,
+          also used in `Werkzeug <http://werkzeug.pocoo.org/>`_ and
+          `mitsuhiko/python-atomicfile
+          <https://github.com/mitsuhiko/python-atomicfile>`_. The idea to use
+          ``ctypes`` instead of ``PyWin32`` originated there.
+        
+        - `abarnert/fatomic <https://github.com/abarnert/fatomic>`_. Windows support
+          (based on ``PyWin32``) was originally taken from there.
+        
+        Other alternatives to atomicwrites include:
+        
+        - `sashka/atomicfile <https://github.com/sashka/atomicfile>`_. Originally I
+          considered using that, but at the time it was lacking a lot of features I
+          needed (Windows support, overwrite-parameter, overriding behavior through
+          subclassing).
+        
+        - The `Boltons library collection <https://github.com/mahmoud/boltons>`_
+          features a class for atomic file writes, which seems to have a very similar
+          ``overwrite`` parameter. It is lacking Windows support though.
+        
+        License
+        =======
+        
+        Licensed under the MIT, see ``LICENSE``.
+        
+Platform: UNKNOWN
new file mode 100644
--- /dev/null
+++ b/third_party/python/atomicwrites/README.rst
@@ -0,0 +1,102 @@
+===================
+python-atomicwrites
+===================
+
+.. image:: https://travis-ci.org/untitaker/python-atomicwrites.svg?branch=master
+    :target: https://travis-ci.org/untitaker/python-atomicwrites
+
+.. image:: https://ci.appveyor.com/api/projects/status/vadc4le3c27to59x/branch/master?svg=true
+   :target: https://ci.appveyor.com/project/untitaker/python-atomicwrites/branch/master
+
+Atomic file writes.
+
+.. code-block:: python
+
+    from atomicwrites import atomic_write
+
+    with atomic_write('foo.txt', overwrite=True) as f:
+        f.write('Hello world.')
+        # "foo.txt" doesn't exist yet.
+
+    # Now it does.
+
+
+Features that distinguish it from other similar libraries (see `Alternatives and Credit`_):
+
+- Race-free assertion that the target file doesn't yet exist. This can be
+  controlled with the ``overwrite`` parameter.
+
+- Windows support, although not well-tested. The MSDN resources are not very
+  explicit about which operations are atomic.
+
+- Simple high-level API that wraps a very flexible class-based API.
+
+- Consistent error handling across platforms.
+
+
+How it works
+============
+
+It uses a temporary file in the same directory as the given path. This ensures
+that the temporary file resides on the same filesystem.
+
+The temporary file will then be atomically moved to the target location: On
+POSIX, it will use ``rename`` if files should be overwritten, otherwise a
+combination of ``link`` and ``unlink``. On Windows, it uses MoveFileEx_ through
+stdlib's ``ctypes`` with the appropriate flags.
+
+Note that with ``link`` and ``unlink``, there's a timewindow where the file
+might be available under two entries in the filesystem: The name of the
+temporary file, and the name of the target file.
+
+Also note that the permissions of the target file may change this way. In some
+situations a ``chmod`` can be issued without any concurrency problems, but
+since that is not always the case, this library doesn't do it by itself.
+
+.. _MoveFileEx: https://msdn.microsoft.com/en-us/library/windows/desktop/aa365240%28v=vs.85%29.aspx
+
+fsync
+-----
+
+On POSIX, ``fsync`` is invoked on the temporary file after it is written (to
+flush file content and metadata), and on the parent directory after the file is
+moved (to flush filename).
+
+``fsync`` does not take care of disks' internal buffers, but there don't seem
+to be any standard POSIX APIs for that. On OS X, ``fcntl`` is used with
+``F_FULLFSYNC`` instead of ``fsync`` for that reason.
+
+On Windows, `_commit <https://msdn.microsoft.com/en-us/library/17618685.aspx>`_
+is used, but there are no guarantees about disk internal buffers.
+
+Alternatives and Credit
+=======================
+
+Atomicwrites is directly inspired by the following libraries (and shares a
+minimal amount of code):
+
+- The Trac project's `utility functions
+  <http://www.edgewall.org/docs/tags-trac-0.11.7/epydoc/trac.util-pysrc.html>`_,
+  also used in `Werkzeug <http://werkzeug.pocoo.org/>`_ and
+  `mitsuhiko/python-atomicfile
+  <https://github.com/mitsuhiko/python-atomicfile>`_. The idea to use
+  ``ctypes`` instead of ``PyWin32`` originated there.
+
+- `abarnert/fatomic <https://github.com/abarnert/fatomic>`_. Windows support
+  (based on ``PyWin32``) was originally taken from there.
+
+Other alternatives to atomicwrites include:
+
+- `sashka/atomicfile <https://github.com/sashka/atomicfile>`_. Originally I
+  considered using that, but at the time it was lacking a lot of features I
+  needed (Windows support, overwrite-parameter, overriding behavior through
+  subclassing).
+
+- The `Boltons library collection <https://github.com/mahmoud/boltons>`_
+  features a class for atomic file writes, which seems to have a very similar
+  ``overwrite`` parameter. It is lacking Windows support though.
+
+License
+=======
+
+Licensed under the MIT, see ``LICENSE``.
new file mode 100644
--- /dev/null
+++ b/third_party/python/atomicwrites/atomicwrites/__init__.py
@@ -0,0 +1,201 @@
+import contextlib
+import os
+import sys
+import tempfile
+
+try:
+    import fcntl
+except ImportError:
+    fcntl = None
+
+__version__ = '1.1.5'
+
+
+PY2 = sys.version_info[0] == 2
+
+text_type = unicode if PY2 else str  # noqa
+
+
+def _path_to_unicode(x):
+    if not isinstance(x, text_type):
+        return x.decode(sys.getfilesystemencoding())
+    return x
+
+
+_proper_fsync = os.fsync
+
+
+if sys.platform != 'win32':
+    if hasattr(fcntl, 'F_FULLFSYNC'):
+        def _proper_fsync(fd):
+            # https://lists.apple.com/archives/darwin-dev/2005/Feb/msg00072.html
+            # https://developer.apple.com/library/mac/documentation/Darwin/Reference/ManPages/man2/fsync.2.html
+            # https://github.com/untitaker/python-atomicwrites/issues/6
+            fcntl.fcntl(fd, fcntl.F_FULLFSYNC)
+
+    def _sync_directory(directory):
+        # Ensure that filenames are written to disk
+        fd = os.open(directory, 0)
+        try:
+            _proper_fsync(fd)
+        finally:
+            os.close(fd)
+
+    def _replace_atomic(src, dst):
+        os.rename(src, dst)
+        _sync_directory(os.path.normpath(os.path.dirname(dst)))
+
+    def _move_atomic(src, dst):
+        os.link(src, dst)
+        os.unlink(src)
+
+        src_dir = os.path.normpath(os.path.dirname(src))
+        dst_dir = os.path.normpath(os.path.dirname(dst))
+        _sync_directory(dst_dir)
+        if src_dir != dst_dir:
+            _sync_directory(src_dir)
+else:
+    from ctypes import windll, WinError
+
+    _MOVEFILE_REPLACE_EXISTING = 0x1
+    _MOVEFILE_WRITE_THROUGH = 0x8
+    _windows_default_flags = _MOVEFILE_WRITE_THROUGH
+
+    def _handle_errors(rv):
+        if not rv:
+            raise WinError()
+
+    def _replace_atomic(src, dst):
+        _handle_errors(windll.kernel32.MoveFileExW(
+            _path_to_unicode(src), _path_to_unicode(dst),
+            _windows_default_flags | _MOVEFILE_REPLACE_EXISTING
+        ))
+
+    def _move_atomic(src, dst):
+        _handle_errors(windll.kernel32.MoveFileExW(
+            _path_to_unicode(src), _path_to_unicode(dst),
+            _windows_default_flags
+        ))
+
+
+def replace_atomic(src, dst):
+    '''
+    Move ``src`` to ``dst``. If ``dst`` exists, it will be silently
+    overwritten.
+
+    Both paths must reside on the same filesystem for the operation to be
+    atomic.
+    '''
+    return _replace_atomic(src, dst)
+
+
+def move_atomic(src, dst):
+    '''
+    Move ``src`` to ``dst``. There might a timewindow where both filesystem
+    entries exist. If ``dst`` already exists, :py:exc:`FileExistsError` will be
+    raised.
+
+    Both paths must reside on the same filesystem for the operation to be
+    atomic.
+    '''
+    return _move_atomic(src, dst)
+
+
+class AtomicWriter(object):
+    '''
+    A helper class for performing atomic writes. Usage::
+
+        with AtomicWriter(path).open() as f:
+            f.write(...)
+
+    :param path: The destination filepath. May or may not exist.
+    :param mode: The filemode for the temporary file.
+    :param overwrite: If set to false, an error is raised if ``path`` exists.
+        Errors are only raised after the file has been written to.  Either way,
+        the operation is atomic.
+
+    If you need further control over the exact behavior, you are encouraged to
+    subclass.
+    '''
+
+    def __init__(self, path, mode='w', overwrite=False):
+        if 'a' in mode:
+            raise ValueError(
+                'Appending to an existing file is not supported, because that '
+                'would involve an expensive `copy`-operation to a temporary '
+                'file. Open the file in normal `w`-mode and copy explicitly '
+                'if that\'s what you\'re after.'
+            )
+        if 'x' in mode:
+            raise ValueError('Use the `overwrite`-parameter instead.')
+        if 'w' not in mode:
+            raise ValueError('AtomicWriters can only be written to.')
+
+        self._path = path
+        self._mode = mode
+        self._overwrite = overwrite
+
+    def open(self):
+        '''
+        Open the temporary file.
+        '''
+        return self._open(self.get_fileobject)
+
+    @contextlib.contextmanager
+    def _open(self, get_fileobject):
+        f = None  # make sure f exists even if get_fileobject() fails
+        try:
+            success = False
+            with get_fileobject() as f:
+                yield f
+                self.sync(f)
+            self.commit(f)
+            success = True
+        finally:
+            if not success:
+                try:
+                    self.rollback(f)
+                except Exception:
+                    pass
+
+    def get_fileobject(self, dir=None, **kwargs):
+        '''Return the temporary file to use.'''
+        if dir is None:
+            dir = os.path.normpath(os.path.dirname(self._path))
+        return tempfile.NamedTemporaryFile(mode=self._mode, dir=dir,
+                                           delete=False, **kwargs)
+
+    def sync(self, f):
+        '''responsible for clearing as many file caches as possible before
+        commit'''
+        f.flush()
+        _proper_fsync(f.fileno())
+
+    def commit(self, f):
+        '''Move the temporary file to the target location.'''
+        if self._overwrite:
+            replace_atomic(f.name, self._path)
+        else:
+            move_atomic(f.name, self._path)
+
+    def rollback(self, f):
+        '''Clean up all temporary resources.'''
+        os.unlink(f.name)
+
+
+def atomic_write(path, writer_cls=AtomicWriter, **cls_kwargs):
+    '''
+    Simple atomic writes. This wraps :py:class:`AtomicWriter`::
+
+        with atomic_write(path) as f:
+            f.write(...)
+
+    :param path: The target path to write to.
+    :param writer_cls: The writer class to use. This parameter is useful if you
+        subclassed :py:class:`AtomicWriter` to change some behavior and want to
+        use that new subclass.
+
+    Additional keyword arguments are passed to the writer class. See
+    :py:class:`AtomicWriter`.
+    '''
+    return writer_cls(path, **cls_kwargs).open()
new file mode 100644
--- /dev/null
+++ b/third_party/python/atomicwrites/docs/Makefile
@@ -0,0 +1,177 @@
+# Makefile for Sphinx documentation
+#
+
+# You can set these variables from the command line.
+SPHINXOPTS    =
+SPHINXBUILD   = sphinx-build
+PAPER         =
+BUILDDIR      = _build
+
+# User-friendly check for sphinx-build
+ifeq ($(shell which $(SPHINXBUILD) >/dev/null 2>&1; echo $$?), 1)
+$(error The '$(SPHINXBUILD)' command was not found. Make sure you have Sphinx installed, then set the SPHINXBUILD environment variable to point to the full path of the '$(SPHINXBUILD)' executable. Alternatively you can add the directory with the executable to your PATH. If you don't have Sphinx installed, grab it from http://sphinx-doc.org/)
+endif
+
+# Internal variables.
+PAPEROPT_a4     = -D latex_paper_size=a4
+PAPEROPT_letter = -D latex_paper_size=letter
+ALLSPHINXOPTS   = -d $(BUILDDIR)/doctrees $(PAPEROPT_$(PAPER)) $(SPHINXOPTS) .
+# the i18n builder cannot share the environment and doctrees with the others
+I18NSPHINXOPTS  = $(PAPEROPT_$(PAPER)) $(SPHINXOPTS) .
+
+.PHONY: help clean html dirhtml singlehtml pickle json htmlhelp qthelp devhelp epub latex latexpdf text man changes linkcheck doctest gettext
+
+help:
+	@echo "Please use \`make <target>' where <target> is one of"
+	@echo "  html       to make standalone HTML files"
+	@echo "  dirhtml    to make HTML files named index.html in directories"
+	@echo "  singlehtml to make a single large HTML file"
+	@echo "  pickle     to make pickle files"
+	@echo "  json       to make JSON files"
+	@echo "  htmlhelp   to make HTML files and a HTML help project"
+	@echo "  qthelp     to make HTML files and a qthelp project"
+	@echo "  devhelp    to make HTML files and a Devhelp project"
+	@echo "  epub       to make an epub"
+	@echo "  latex      to make LaTeX files, you can set PAPER=a4 or PAPER=letter"
+	@echo "  latexpdf   to make LaTeX files and run them through pdflatex"
+	@echo "  latexpdfja to make LaTeX files and run them through platex/dvipdfmx"
+	@echo "  text       to make text files"
+	@echo "  man        to make manual pages"
+	@echo "  texinfo    to make Texinfo files"
+	@echo "  info       to make Texinfo files and run them through makeinfo"
+	@echo "  gettext    to make PO message catalogs"
+	@echo "  changes    to make an overview of all changed/added/deprecated items"
+	@echo "  xml        to make Docutils-native XML files"
+	@echo "  pseudoxml  to make pseudoxml-XML files for display purposes"
+	@echo "  linkcheck  to check all external links for integrity"
+	@echo "  doctest    to run all doctests embedded in the documentation (if enabled)"
+
+clean:
+	rm -rf $(BUILDDIR)/*
+
+html:
+	$(SPHINXBUILD) -b html $(ALLSPHINXOPTS) $(BUILDDIR)/html
+	@echo
+	@echo "Build finished. The HTML pages are in $(BUILDDIR)/html."
+
+dirhtml:
+	$(SPHINXBUILD) -b dirhtml $(ALLSPHINXOPTS) $(BUILDDIR)/dirhtml
+	@echo
+	@echo "Build finished. The HTML pages are in $(BUILDDIR)/dirhtml."
+
+singlehtml:
+	$(SPHINXBUILD) -b singlehtml $(ALLSPHINXOPTS) $(BUILDDIR)/singlehtml
+	@echo
+	@echo "Build finished. The HTML page is in $(BUILDDIR)/singlehtml."
+
+pickle:
+	$(SPHINXBUILD) -b pickle $(ALLSPHINXOPTS) $(BUILDDIR)/pickle
+	@echo
+	@echo "Build finished; now you can process the pickle files."
+
+json:
+	$(SPHINXBUILD) -b json $(ALLSPHINXOPTS) $(BUILDDIR)/json
+	@echo
+	@echo "Build finished; now you can process the JSON files."
+
+htmlhelp:
+	$(SPHINXBUILD) -b htmlhelp $(ALLSPHINXOPTS) $(BUILDDIR)/htmlhelp
+	@echo
+	@echo "Build finished; now you can run HTML Help Workshop with the" \
+	      ".hhp project file in $(BUILDDIR)/htmlhelp."
+
+qthelp:
+	$(SPHINXBUILD) -b qthelp $(ALLSPHINXOPTS) $(BUILDDIR)/qthelp
+	@echo
+	@echo "Build finished; now you can run "qcollectiongenerator" with the" \
+	      ".qhcp project file in $(BUILDDIR)/qthelp, like this:"
+	@echo "# qcollectiongenerator $(BUILDDIR)/qthelp/atomicwrites.qhcp"
+	@echo "To view the help file:"
+	@echo "# assistant -collectionFile $(BUILDDIR)/qthelp/atomicwrites.qhc"
+
+devhelp:
+	$(SPHINXBUILD) -b devhelp $(ALLSPHINXOPTS) $(BUILDDIR)/devhelp
+	@echo
+	@echo "Build finished."
+	@echo "To view the help file:"
+	@echo "# mkdir -p $$HOME/.local/share/devhelp/atomicwrites"
+	@echo "# ln -s $(BUILDDIR)/devhelp $$HOME/.local/share/devhelp/atomicwrites"
+	@echo "# devhelp"
+
+epub:
+	$(SPHINXBUILD) -b epub $(ALLSPHINXOPTS) $(BUILDDIR)/epub
+	@echo
+	@echo "Build finished. The epub file is in $(BUILDDIR)/epub."
+
+latex:
+	$(SPHINXBUILD) -b latex $(ALLSPHINXOPTS) $(BUILDDIR)/latex
+	@echo
+	@echo "Build finished; the LaTeX files are in $(BUILDDIR)/latex."
+	@echo "Run \`make' in that directory to run these through (pdf)latex" \
+	      "(use \`make latexpdf' here to do that automatically)."
+
+latexpdf:
+	$(SPHINXBUILD) -b latex $(ALLSPHINXOPTS) $(BUILDDIR)/latex
+	@echo "Running LaTeX files through pdflatex..."
+	$(MAKE) -C $(BUILDDIR)/latex all-pdf
+	@echo "pdflatex finished; the PDF files are in $(BUILDDIR)/latex."
+
+latexpdfja:
+	$(SPHINXBUILD) -b latex $(ALLSPHINXOPTS) $(BUILDDIR)/latex
+	@echo "Running LaTeX files through platex and dvipdfmx..."
+	$(MAKE) -C $(BUILDDIR)/latex all-pdf-ja
+	@echo "pdflatex finished; the PDF files are in $(BUILDDIR)/latex."
+
+text:
+	$(SPHINXBUILD) -b text $(ALLSPHINXOPTS) $(BUILDDIR)/text
+	@echo
+	@echo "Build finished. The text files are in $(BUILDDIR)/text."
+
+man:
+	$(SPHINXBUILD) -b man $(ALLSPHINXOPTS) $(BUILDDIR)/man
+	@echo
+	@echo "Build finished. The manual pages are in $(BUILDDIR)/man."
+
+texinfo:
+	$(SPHINXBUILD) -b texinfo $(ALLSPHINXOPTS) $(BUILDDIR)/texinfo
+	@echo
+	@echo "Build finished. The Texinfo files are in $(BUILDDIR)/texinfo."
+	@echo "Run \`make' in that directory to run these through makeinfo" \
+	      "(use \`make info' here to do that automatically)."
+
+info:
+	$(SPHINXBUILD) -b texinfo $(ALLSPHINXOPTS) $(BUILDDIR)/texinfo
+	@echo "Running Texinfo files through makeinfo..."
+	make -C $(BUILDDIR)/texinfo info
+	@echo "makeinfo finished; the Info files are in $(BUILDDIR)/texinfo."
+
+gettext:
+	$(SPHINXBUILD) -b gettext $(I18NSPHINXOPTS) $(BUILDDIR)/locale
+	@echo
+	@echo "Build finished. The message catalogs are in $(BUILDDIR)/locale."
+
+changes:
+	$(SPHINXBUILD) -b changes $(ALLSPHINXOPTS) $(BUILDDIR)/changes
+	@echo
+	@echo "The overview file is in $(BUILDDIR)/changes."
+
+linkcheck:
+	$(SPHINXBUILD) -b linkcheck $(ALLSPHINXOPTS) $(BUILDDIR)/linkcheck
+	@echo
+	@echo "Link check complete; look for any errors in the above output " \
+	      "or in $(BUILDDIR)/linkcheck/output.txt."
+
+doctest:
+	$(SPHINXBUILD) -b doctest $(ALLSPHINXOPTS) $(BUILDDIR)/doctest
+	@echo "Testing of doctests in the sources finished, look at the " \
+	      "results in $(BUILDDIR)/doctest/output.txt."
+
+xml:
+	$(SPHINXBUILD) -b xml $(ALLSPHINXOPTS) $(BUILDDIR)/xml
+	@echo
+	@echo "Build finished. The XML files are in $(BUILDDIR)/xml."
+
+pseudoxml:
+	$(SPHINXBUILD) -b pseudoxml $(ALLSPHINXOPTS) $(BUILDDIR)/pseudoxml
+	@echo
+	@echo "Build finished. The pseudo-XML files are in $(BUILDDIR)/pseudoxml."
new file mode 100644
--- /dev/null
+++ b/third_party/python/atomicwrites/docs/conf.py
@@ -0,0 +1,107 @@
+#!/usr/bin/env python
+
+import os
+import sys
+import pkg_resources
+
+extensions = [
+    'sphinx.ext.autodoc',
+    'sphinx.ext.intersphinx',
+    'sphinx.ext.viewcode',
+]
+
+# Add any paths that contain templates here, relative to this directory.
+templates_path = ['_templates']
+
+# The suffix of source filenames.
+source_suffix = '.rst'
+
+# The master toctree document.
+master_doc = 'index'
+
+# General information about the project.
+project = 'atomicwrites'
+copyright = '2015, Markus Unterwaditzer'
+
+try:
+    # The full version, including alpha/beta/rc tags.
+    release = pkg_resources.require('atomicwrites')[0].version
+except pkg_resources.DistributionNotFound:
+    print('To build the documentation, the distribution information of '
+          'atomicwrites has to be available. Run "setup.py develop" to do '
+          'this.')
+    sys.exit(1)
+
+version = '.'.join(release.split('.')[:2])  # The short X.Y version.
+
+on_rtd = os.environ.get('READTHEDOCS', None) == 'True'
+
+try:
+    import sphinx_rtd_theme
+    html_theme = 'sphinx_rtd_theme'
+    html_theme_path = [sphinx_rtd_theme.get_html_theme_path()]
+except ImportError:
+    html_theme = 'default'
+    if not on_rtd:
+        print('-' * 74)
+        print('Warning: sphinx-rtd-theme not installed, building with default '
+              'theme.')
+        print('-' * 74)
+
+
+# List of patterns, relative to source directory, that match files and
+# directories to ignore when looking for source files.
+exclude_patterns = ['_build']
+
+# The name of the Pygments (syntax highlighting) style to use.
+pygments_style = 'sphinx'
+
+# Add any paths that contain custom static files (such as style sheets) here,
+# relative to this directory. They are copied after the builtin static files,
+# so a file named "default.css" will overwrite the builtin "default.css".
+html_static_path = ['_static']
+
+
+# Output file base name for HTML help builder.
+htmlhelp_basename = 'atomicwritesdoc'
+
+
+# -- Options for LaTeX output ---------------------------------------------
+
+latex_elements = {}
+
+# Grouping the document tree into LaTeX files. List of tuples
+# (source start file, target name, title,
+#  author, documentclass [howto, manual, or own class]).
+latex_documents = [
+  ('index', 'atomicwrites.tex', 'atomicwrites Documentation',
+   'Markus Unterwaditzer', 'manual'),
+]
+
+# One entry per manual page. List of tuples
+# (source start file, name, description, authors, manual section).
+man_pages = [
+    ('index', 'atomicwrites', 'atomicwrites Documentation',
+     ['Markus Unterwaditzer'], 1)
+]
+
+# Grouping the document tree into Texinfo files. List of tuples
+# (source start file, target name, title, author,
+#  dir menu entry, description, category)
+texinfo_documents = [
+  ('index', 'atomicwrites', 'atomicwrites Documentation',
+   'Markus Unterwaditzer', 'atomicwrites', 'One line description of project.',
+   'Miscellaneous'),
+]
+
+# Bibliographic Dublin Core info.
+epub_title = 'atomicwrites'
+epub_author = 'Markus Unterwaditzer'
+epub_publisher = 'Markus Unterwaditzer'
+epub_copyright = '2015, Markus Unterwaditzer'
+
+# A list of files that should not be packed into the epub file.
+epub_exclude_files = ['search.html']
+
+# Example configuration for intersphinx: refer to the Python standard library.
+intersphinx_mapping = {'http://docs.python.org/': None}
new file mode 100644
--- /dev/null
+++ b/third_party/python/atomicwrites/docs/index.rst
@@ -0,0 +1,35 @@
+.. include:: ../README.rst
+
+.. module:: atomicwrites
+
+API
+===
+
+.. autofunction:: atomic_write
+
+
+Errorhandling
+-------------
+
+All filesystem errors are subclasses of :py:exc:`OSError`.
+
+- On UNIX systems, errors from the Python stdlib calls are thrown.
+- On Windows systems, errors from Python's ``ctypes`` are thrown.
+
+In either case, the ``errno`` attribute on the thrown exception maps to an
+errorcode in the ``errno`` module.
+
+Low-level API
+-------------
+
+.. autofunction:: replace_atomic
+
+.. autofunction:: move_atomic
+
+.. autoclass:: AtomicWriter
+   :members:
+
+License
+=======
+
+.. include:: ../LICENSE
new file mode 100644
--- /dev/null
+++ b/third_party/python/atomicwrites/docs/make.bat
@@ -0,0 +1,242 @@
+@ECHO OFF
+
+REM Command file for Sphinx documentation
+
+if "%SPHINXBUILD%" == "" (
+	set SPHINXBUILD=sphinx-build
+)
+set BUILDDIR=_build
+set ALLSPHINXOPTS=-d %BUILDDIR%/doctrees %SPHINXOPTS% .
+set I18NSPHINXOPTS=%SPHINXOPTS% .
+if NOT "%PAPER%" == "" (
+	set ALLSPHINXOPTS=-D latex_paper_size=%PAPER% %ALLSPHINXOPTS%
+	set I18NSPHINXOPTS=-D latex_paper_size=%PAPER% %I18NSPHINXOPTS%
+)
+
+if "%1" == "" goto help
+
+if "%1" == "help" (
+	:help
+	echo.Please use `make ^<target^>` where ^<target^> is one of
+	echo.  html       to make standalone HTML files
+	echo.  dirhtml    to make HTML files named index.html in directories
+	echo.  singlehtml to make a single large HTML file
+	echo.  pickle     to make pickle files
+	echo.  json       to make JSON files
+	echo.  htmlhelp   to make HTML files and a HTML help project
+	echo.  qthelp     to make HTML files and a qthelp project
+	echo.  devhelp    to make HTML files and a Devhelp project
+	echo.  epub       to make an epub
+	echo.  latex      to make LaTeX files, you can set PAPER=a4 or PAPER=letter
+	echo.  text       to make text files
+	echo.  man        to make manual pages
+	echo.  texinfo    to make Texinfo files
+	echo.  gettext    to make PO message catalogs
+	echo.  changes    to make an overview over all changed/added/deprecated items
+	echo.  xml        to make Docutils-native XML files
+	echo.  pseudoxml  to make pseudoxml-XML files for display purposes
+	echo.  linkcheck  to check all external links for integrity
+	echo.  doctest    to run all doctests embedded in the documentation if enabled
+	goto end
+)
+
+if "%1" == "clean" (
+	for /d %%i in (%BUILDDIR%\*) do rmdir /q /s %%i
+	del /q /s %BUILDDIR%\*
+	goto end
+)
+
+
+%SPHINXBUILD% 2> nul
+if errorlevel 9009 (
+	echo.
+	echo.The 'sphinx-build' command was not found. Make sure you have Sphinx
+	echo.installed, then set the SPHINXBUILD environment variable to point
+	echo.to the full path of the 'sphinx-build' executable. Alternatively you
+	echo.may add the Sphinx directory to PATH.
+	echo.
+	echo.If you don't have Sphinx installed, grab it from
+	echo.http://sphinx-doc.org/
+	exit /b 1
+)
+
+if "%1" == "html" (
+	%SPHINXBUILD% -b html %ALLSPHINXOPTS% %BUILDDIR%/html
+	if errorlevel 1 exit /b 1
+	echo.
+	echo.Build finished. The HTML pages are in %BUILDDIR%/html.
+	goto end
+)
+
+if "%1" == "dirhtml" (
+	%SPHINXBUILD% -b dirhtml %ALLSPHINXOPTS% %BUILDDIR%/dirhtml
+	if errorlevel 1 exit /b 1
+	echo.
+	echo.Build finished. The HTML pages are in %BUILDDIR%/dirhtml.
+	goto end
+)
+
+if "%1" == "singlehtml" (
+	%SPHINXBUILD% -b singlehtml %ALLSPHINXOPTS% %BUILDDIR%/singlehtml
+	if errorlevel 1 exit /b 1
+	echo.
+	echo.Build finished. The HTML pages are in %BUILDDIR%/singlehtml.
+	goto end
+)
+
+if "%1" == "pickle" (
+	%SPHINXBUILD% -b pickle %ALLSPHINXOPTS% %BUILDDIR%/pickle
+	if errorlevel 1 exit /b 1
+	echo.
+	echo.Build finished; now you can process the pickle files.
+	goto end
+)
+
+if "%1" == "json" (
+	%SPHINXBUILD% -b json %ALLSPHINXOPTS% %BUILDDIR%/json
+	if errorlevel 1 exit /b 1
+	echo.
+	echo.Build finished; now you can process the JSON files.
+	goto end
+)
+
+if "%1" == "htmlhelp" (
+	%SPHINXBUILD% -b htmlhelp %ALLSPHINXOPTS% %BUILDDIR%/htmlhelp
+	if errorlevel 1 exit /b 1
+	echo.
+	echo.Build finished; now you can run HTML Help Workshop with the ^
+.hhp project file in %BUILDDIR%/htmlhelp.
+	goto end
+)
+
+if "%1" == "qthelp" (
+	%SPHINXBUILD% -b qthelp %ALLSPHINXOPTS% %BUILDDIR%/qthelp
+	if errorlevel 1 exit /b 1
+	echo.
+	echo.Build finished; now you can run "qcollectiongenerator" with the ^
+.qhcp project file in %BUILDDIR%/qthelp, like this:
+	echo.^> qcollectiongenerator %BUILDDIR%\qthelp\atomicwrites.qhcp
+	echo.To view the help file:
+	echo.^> assistant -collectionFile %BUILDDIR%\qthelp\atomicwrites.ghc
+	goto end
+)
+
+if "%1" == "devhelp" (
+	%SPHINXBUILD% -b devhelp %ALLSPHINXOPTS% %BUILDDIR%/devhelp
+	if errorlevel 1 exit /b 1
+	echo.
+	echo.Build finished.
+	goto end
+)
+
+if "%1" == "epub" (
+	%SPHINXBUILD% -b epub %ALLSPHINXOPTS% %BUILDDIR%/epub
+	if errorlevel 1 exit /b 1
+	echo.
+	echo.Build finished. The epub file is in %BUILDDIR%/epub.
+	goto end
+)
+
+if "%1" == "latex" (
+	%SPHINXBUILD% -b latex %ALLSPHINXOPTS% %BUILDDIR%/latex
+	if errorlevel 1 exit /b 1
+	echo.
+	echo.Build finished; the LaTeX files are in %BUILDDIR%/latex.
+	goto end
+)
+
+if "%1" == "latexpdf" (
+	%SPHINXBUILD% -b latex %ALLSPHINXOPTS% %BUILDDIR%/latex
+	cd %BUILDDIR%/latex
+	make all-pdf
+	cd %BUILDDIR%/..
+	echo.
+	echo.Build finished; the PDF files are in %BUILDDIR%/latex.
+	goto end
+)
+
+if "%1" == "latexpdfja" (
+	%SPHINXBUILD% -b latex %ALLSPHINXOPTS% %BUILDDIR%/latex
+	cd %BUILDDIR%/latex
+	make all-pdf-ja
+	cd %BUILDDIR%/..
+	echo.
+	echo.Build finished; the PDF files are in %BUILDDIR%/latex.
+	goto end
+)
+
+if "%1" == "text" (
+	%SPHINXBUILD% -b text %ALLSPHINXOPTS% %BUILDDIR%/text
+	if errorlevel 1 exit /b 1
+	echo.
+	echo.Build finished. The text files are in %BUILDDIR%/text.
+	goto end
+)
+
+if "%1" == "man" (
+	%SPHINXBUILD% -b man %ALLSPHINXOPTS% %BUILDDIR%/man
+	if errorlevel 1 exit /b 1
+	echo.
+	echo.Build finished. The manual pages are in %BUILDDIR%/man.
+	goto end
+)
+
+if "%1" == "texinfo" (
+	%SPHINXBUILD% -b texinfo %ALLSPHINXOPTS% %BUILDDIR%/texinfo
+	if errorlevel 1 exit /b 1
+	echo.
+	echo.Build finished. The Texinfo files are in %BUILDDIR%/texinfo.
+	goto end
+)
+
+if "%1" == "gettext" (
+	%SPHINXBUILD% -b gettext %I18NSPHINXOPTS% %BUILDDIR%/locale
+	if errorlevel 1 exit /b 1
+	echo.
+	echo.Build finished. The message catalogs are in %BUILDDIR%/locale.
+	goto end
+)
+
+if "%1" == "changes" (
+	%SPHINXBUILD% -b changes %ALLSPHINXOPTS% %BUILDDIR%/changes
+	if errorlevel 1 exit /b 1
+	echo.
+	echo.The overview file is in %BUILDDIR%/changes.
+	goto end
+)
+
+if "%1" == "linkcheck" (
+	%SPHINXBUILD% -b linkcheck %ALLSPHINXOPTS% %BUILDDIR%/linkcheck
+	if errorlevel 1 exit /b 1
+	echo.
+	echo.Link check complete; look for any errors in the above output ^
+or in %BUILDDIR%/linkcheck/output.txt.
+	goto end
+)
+
+if "%1" == "doctest" (
+	%SPHINXBUILD% -b doctest %ALLSPHINXOPTS% %BUILDDIR%/doctest
+	if errorlevel 1 exit /b 1
+	echo.
+	echo.Testing of doctests in the sources finished, look at the ^
+results in %BUILDDIR%/doctest/output.txt.
+	goto end
+)
+
+if "%1" == "xml" (
+	%SPHINXBUILD% -b xml %ALLSPHINXOPTS% %BUILDDIR%/xml
+	if errorlevel 1 exit /b 1
+	echo.
+	echo.Build finished. The XML files are in %BUILDDIR%/xml.
+	goto end
+)
+
+if "%1" == "pseudoxml" (
+	%SPHINXBUILD% -b pseudoxml %ALLSPHINXOPTS% %BUILDDIR%/pseudoxml
+	if errorlevel 1 exit /b 1
+	echo.
+	echo.Build finished. The pseudo-XML files are in %BUILDDIR%/pseudoxml.
+	goto end
+)
+
+:end
new file mode 100644
--- /dev/null
+++ b/third_party/python/atomicwrites/setup.cfg
@@ -0,0 +1,8 @@
+[wheel]
+universal = 1
+
+[egg_info]
+tag_date = 0
+tag_svn_revision = 0
+tag_build = 
+
new file mode 100644
--- /dev/null
+++ b/third_party/python/atomicwrites/setup.py
@@ -0,0 +1,27 @@
+# -*- coding: utf-8 -*-
+
+import ast
+import re
+
+from setuptools import find_packages, setup
+
+
+_version_re = re.compile(r'__version__\s+=\s+(.*)')
+
+
+with open('atomicwrites/__init__.py', 'rb') as f:
+    version = str(ast.literal_eval(_version_re.search(
+        f.read().decode('utf-8')).group(1)))
+
+setup(
+    name='atomicwrites',
+    version=version,
+    author='Markus Unterwaditzer',
+    author_email='markus@unterwaditzer.net',
+    url='https://github.com/untitaker/python-atomicwrites',
+    description='Atomic file writes.',
+    license='MIT',
+    long_description=open('README.rst').read(),
+    packages=find_packages(exclude=['tests.*', 'tests']),
+    include_package_data=True,
+)
new file mode 100644
--- /dev/null
+++ b/third_party/python/atomicwrites/tests/test_atomicwrites.py
@@ -0,0 +1,89 @@
+import errno
+import os
+
+from atomicwrites import atomic_write
+
+import pytest
+
+
+def test_atomic_write(tmpdir):
+    fname = tmpdir.join('ha')
+    for i in range(2):
+        with atomic_write(str(fname), overwrite=True) as f:
+            f.write('hoho')
+
+    with pytest.raises(OSError) as excinfo:
+        with atomic_write(str(fname), overwrite=False) as f:
+            f.write('haha')
+
+    assert excinfo.value.errno == errno.EEXIST
+
+    assert fname.read() == 'hoho'
+    assert len(tmpdir.listdir()) == 1
+
+
+def test_teardown(tmpdir):
+    fname = tmpdir.join('ha')
+    with pytest.raises(AssertionError):
+        with atomic_write(str(fname), overwrite=True):
+            assert False
+
+    assert not tmpdir.listdir()
+
+
+def test_replace_simultaneously_created_file(tmpdir):
+    fname = tmpdir.join('ha')
+    with atomic_write(str(fname), overwrite=True) as f:
+        f.write('hoho')
+        fname.write('harhar')
+        assert fname.read() == 'harhar'
+    assert fname.read() == 'hoho'
+    assert len(tmpdir.listdir()) == 1
+
+
+def test_dont_remove_simultaneously_created_file(tmpdir):
+    fname = tmpdir.join('ha')
+    with pytest.raises(OSError) as excinfo:
+        with atomic_write(str(fname), overwrite=False) as f:
+            f.write('hoho')
+            fname.write('harhar')
+            assert fname.read() == 'harhar'
+
+    assert excinfo.value.errno == errno.EEXIST
+    assert fname.read() == 'harhar'
+    assert len(tmpdir.listdir()) == 1
+
+
+# Verify that nested exceptions during rollback do not overwrite the initial
+# exception that triggered a rollback.
+def test_open_reraise(tmpdir):
+    fname = tmpdir.join('ha')
+    with pytest.raises(AssertionError):
+        with atomic_write(str(fname), overwrite=False) as f:
+            # Mess with f, so rollback will trigger an OSError. We're testing
+            # that the initial AssertionError triggered below is propagated up
+            # the stack, not the second exception triggered during rollback.
+            f.name = "asdf"
+            # Now trigger our own exception.
+            assert False, "Intentional failure for testing purposes"
+
+
+def test_atomic_write_in_pwd(tmpdir):
+    orig_curdir = os.getcwd()
+    try:
+        os.chdir(str(tmpdir))
+        fname = 'ha'
+        for i in range(2):
+            with atomic_write(str(fname), overwrite=True) as f:
+                f.write('hoho')
+
+        with pytest.raises(OSError) as excinfo:
+            with atomic_write(str(fname), overwrite=False) as f:
+                f.write('haha')
+
+        assert excinfo.value.errno == errno.EEXIST
+
+        assert open(fname).read() == 'hoho'
+        assert len(tmpdir.listdir()) == 1
+    finally:
+        os.chdir(orig_curdir)
new file mode 100644
--- /dev/null
+++ b/third_party/python/funcsigs/CHANGELOG
@@ -0,0 +1,24 @@
+Changelog
+---------
+
+0.5
+```
+
+* Fix binding with self as a kwarg. (Robert Collins #14)
+
+0.4 (2013-12-20)
+````````````````
+* Fix unbound methods getting their first parameter curried
+* Publish Python wheel packages
+
+0.3 (2013-05-29)
+````````````````
+* Fix annotation formatting of builtin types on Python 2.x
+
+0.2 (2012-01-07)
+````````````````
+* PyPy compatability
+
+0.1 (2012-01-06)
+````````````````
+* Initial release
new file mode 100644
--- /dev/null
+++ b/third_party/python/funcsigs/LICENSE
@@ -0,0 +1,13 @@
+Copyright 2013 Aaron Iles
+
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+
+  http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
new file mode 100644
--- /dev/null
+++ b/third_party/python/funcsigs/MANIFEST.in
@@ -0,0 +1,7 @@
+recursive-include docs *
+recursive-include tests *.py
+include *.py
+include CHANGELOG
+include LICENSE
+include MANIFEST.in
+include README.rst
new file mode 100644
--- /dev/null
+++ b/third_party/python/funcsigs/PKG-INFO
@@ -0,0 +1,378 @@
+Metadata-Version: 1.1
+Name: funcsigs
+Version: 1.0.2
+Summary: Python function signatures from PEP362 for Python 2.6, 2.7 and 3.2+
+Home-page: http://funcsigs.readthedocs.org
+Author: Testing Cabal
+Author-email: testing-in-python@lists.idyll.org
+License: ASL
+Description: .. funcsigs documentation master file, created by
+           sphinx-quickstart on Fri Apr 20 20:27:52 2012.
+           You can adapt this file completely to your liking, but it should at least
+           contain the root `toctree` directive.
+        
+        Introducing funcsigs
+        ====================
+        
+        The Funcsigs Package
+        --------------------
+        
+        ``funcsigs`` is a backport of the `PEP 362`_ function signature features from
+        Python 3.3's `inspect`_ module. The backport is compatible with Python 2.6, 2.7
+        as well as 3.3 and up. 3.2 was supported by version 0.4, but with setuptools and
+        pip no longer supporting 3.2, we cannot make any statement about 3.2
+        compatibility.
+        
+        Compatibility
+        `````````````
+        
+        The ``funcsigs`` backport has been tested against:
+        
+        * CPython 2.6
+        * CPython 2.7
+        * CPython 3.3
+        * CPython 3.4
+        * CPython 3.5
+        * CPython nightlies
+        * PyPy and PyPy3(currently failing CI)
+        
+        Continuous integration testing is provided by `Travis CI`_.
+        
+        Under Python 2.x there is a compatibility issue when a function is assigned to
+        the ``__wrapped__`` property of a class after it has been constructed.
+        Similiarily there under PyPy directly passing the ``__call__`` method of a
+        builtin is also a compatibility issues.  Otherwise the functionality is
+        believed to be uniform between both Python2 and Python3.
+        
+        Issues
+        ``````
+        
+        Source code for ``funcsigs`` is hosted on `GitHub`_. Any bug reports or feature
+        requests can be made using GitHub's `issues system`_. |build_status| |coverage|
+        
+        Example
+        -------
+        
+        To obtain a `Signature` object, pass the target function to the
+        ``funcsigs.signature`` function.
+        
+        .. code-block:: python
+        
+            >>> from funcsigs import signature
+            >>> def foo(a, b=None, *args, **kwargs):
+            ...     pass
+            ...
+            >>> sig = signature(foo)
+            >>> sig
+            <funcsigs.Signature object at 0x...>
+            >>> sig.parameters
+            OrderedDict([('a', <Parameter at 0x... 'a'>), ('b', <Parameter at 0x... 'b'>), ('args', <Parameter at 0x... 'args'>), ('kwargs', <Parameter at 0x... 'kwargs'>)])
+            >>> sig.return_annotation
+            <class 'funcsigs._empty'>
+        
+        Introspecting callables with the Signature object
+        -------------------------------------------------
+        
+        .. note::
+        
+           This section of documentation is a direct reproduction of the Python
+           standard library documentation for the inspect module.
+        
+        The Signature object represents the call signature of a callable object and its
+        return annotation.  To retrieve a Signature object, use the :func:`signature`
+        function.
+        
+        .. function:: signature(callable)
+        
+           Return a :class:`Signature` object for the given ``callable``::
+        
+              >>> from funcsigs import signature
+              >>> def foo(a, *, b:int, **kwargs):
+              ...     pass
+        
+              >>> sig = signature(foo)
+        
+              >>> str(sig)
+              '(a, *, b:int, **kwargs)'
+        
+              >>> str(sig.parameters['b'])
+              'b:int'
+        
+              >>> sig.parameters['b'].annotation
+              <class 'int'>
+        
+           Accepts a wide range of python callables, from plain functions and classes to
+           :func:`functools.partial` objects.
+        
+           .. note::
+        
+              Some callables may not be introspectable in certain implementations of
+              Python.  For example, in CPython, built-in functions defined in C provide
+              no metadata about their arguments.
+        
+        
+        .. class:: Signature
+        
+           A Signature object represents the call signature of a function and its return
+           annotation.  For each parameter accepted by the function it stores a
+           :class:`Parameter` object in its :attr:`parameters` collection.
+        
+           Signature objects are *immutable*.  Use :meth:`Signature.replace` to make a
+           modified copy.
+        
+           .. attribute:: Signature.empty
+        
+              A special class-level marker to specify absence of a return annotation.
+        
+           .. attribute:: Signature.parameters
+        
+              An ordered mapping of parameters' names to the corresponding
+              :class:`Parameter` objects.
+        
+           .. attribute:: Signature.return_annotation
+        
+              The "return" annotation for the callable.  If the callable has no "return"
+              annotation, this attribute is set to :attr:`Signature.empty`.
+        
+           .. method:: Signature.bind(*args, **kwargs)
+        
+              Create a mapping from positional and keyword arguments to parameters.
+              Returns :class:`BoundArguments` if ``*args`` and ``**kwargs`` match the
+              signature, or raises a :exc:`TypeError`.
+        
+           .. method:: Signature.bind_partial(*args, **kwargs)
+        
+              Works the same way as :meth:`Signature.bind`, but allows the omission of
+              some required arguments (mimics :func:`functools.partial` behavior.)
+              Returns :class:`BoundArguments`, or raises a :exc:`TypeError` if the
+              passed arguments do not match the signature.
+        
+           .. method:: Signature.replace(*[, parameters][, return_annotation])
+        
+              Create a new Signature instance based on the instance replace was invoked
+              on.  It is possible to pass different ``parameters`` and/or
+              ``return_annotation`` to override the corresponding properties of the base
+              signature.  To remove return_annotation from the copied Signature, pass in
+              :attr:`Signature.empty`.
+        
+              ::
+        
+                 >>> def test(a, b):
+                 ...     pass
+                 >>> sig = signature(test)
+                 >>> new_sig = sig.replace(return_annotation="new return anno")
+                 >>> str(new_sig)
+                 "(a, b) -> 'new return anno'"
+        
+        
+        .. class:: Parameter
+        
+           Parameter objects are *immutable*.  Instead of modifying a Parameter object,
+           you can use :meth:`Parameter.replace` to create a modified copy.
+        
+           .. attribute:: Parameter.empty
+        
+              A special class-level marker to specify absence of default values and
+              annotations.
+        
+           .. attribute:: Parameter.name
+        
+              The name of the parameter as a string.  Must be a valid python identifier
+              name (with the exception of ``POSITIONAL_ONLY`` parameters, which can have
+              it set to ``None``).
+        
+           .. attribute:: Parameter.default
+        
+              The default value for the parameter.  If the parameter has no default
+              value, this attribute is set to :attr:`Parameter.empty`.
+        
+           .. attribute:: Parameter.annotation
+        
+              The annotation for the parameter.  If the parameter has no annotation,
+              this attribute is set to :attr:`Parameter.empty`.
+        
+           .. attribute:: Parameter.kind
+        
+              Describes how argument values are bound to the parameter.  Possible values
+              (accessible via :class:`Parameter`, like ``Parameter.KEYWORD_ONLY``):
+        
+              +------------------------+----------------------------------------------+
+              |    Name                | Meaning                                      |
+              +========================+==============================================+
+              | *POSITIONAL_ONLY*      | Value must be supplied as a positional       |
+              |                        | argument.                                    |
+              |                        |                                              |
+              |                        | Python has no explicit syntax for defining   |
+              |                        | positional-only parameters, but many built-in|
+              |                        | and extension module functions (especially   |
+              |                        | those that accept only one or two parameters)|
+              |                        | accept them.                                 |
+              +------------------------+----------------------------------------------+
+              | *POSITIONAL_OR_KEYWORD*| Value may be supplied as either a keyword or |
+              |                        | positional argument (this is the standard    |
+              |                        | binding behaviour for functions implemented  |
+              |                        | in Python.)                                  |
+              +------------------------+----------------------------------------------+
+              | *VAR_POSITIONAL*       | A tuple of positional arguments that aren't  |
+              |                        | bound to any other parameter. This           |
+              |                        | corresponds to a ``*args`` parameter in a    |
+              |                        | Python function definition.                  |
+              +------------------------+----------------------------------------------+
+              | *KEYWORD_ONLY*         | Value must be supplied as a keyword argument.|
+              |                        | Keyword only parameters are those which      |
+              |                        | appear after a ``*`` or ``*args`` entry in a |
+              |                        | Python function definition.                  |
+              +------------------------+----------------------------------------------+
+              | *VAR_KEYWORD*          | A dict of keyword arguments that aren't bound|
+              |                        | to any other parameter. This corresponds to a|
+              |                        | ``**kwargs`` parameter in a Python function  |
+              |                        | definition.                                  |
+              +------------------------+----------------------------------------------+
+        
+              Example: print all keyword-only arguments without default values::
+        
+                 >>> def foo(a, b, *, c, d=10):
+                 ...     pass
+        
+                 >>> sig = signature(foo)
+                 >>> for param in sig.parameters.values():
+                 ...     if (param.kind == param.KEYWORD_ONLY and
+                 ...                        param.default is param.empty):
+                 ...         print('Parameter:', param)
+                 Parameter: c
+        
+           .. method:: Parameter.replace(*[, name][, kind][, default][, annotation])
+        
+              Create a new Parameter instance based on the instance replaced was invoked
+              on.  To override a :class:`Parameter` attribute, pass the corresponding
+              argument.  To remove a default value or/and an annotation from a
+              Parameter, pass :attr:`Parameter.empty`.
+        
+              ::
+        
+                 >>> from funcsigs import Parameter
+                 >>> param = Parameter('foo', Parameter.KEYWORD_ONLY, default=42)
+                 >>> str(param)
+                 'foo=42'
+        
+                 >>> str(param.replace()) # Will create a shallow copy of 'param'
+                 'foo=42'
+        
+                 >>> str(param.replace(default=Parameter.empty, annotation='spam'))
+                 "foo:'spam'"
+        
+        
+        .. class:: BoundArguments
+        
+           Result of a :meth:`Signature.bind` or :meth:`Signature.bind_partial` call.
+           Holds the mapping of arguments to the function's parameters.
+        
+           .. attribute:: BoundArguments.arguments
+        
+              An ordered, mutable mapping (:class:`collections.OrderedDict`) of
+              parameters' names to arguments' values.  Contains only explicitly bound
+              arguments.  Changes in :attr:`arguments` will reflect in :attr:`args` and
+              :attr:`kwargs`.
+        
+              Should be used in conjunction with :attr:`Signature.parameters` for any
+              argument processing purposes.
+        
+              .. note::
+        
+                 Arguments for which :meth:`Signature.bind` or
+                 :meth:`Signature.bind_partial` relied on a default value are skipped.
+                 However, if needed, it is easy to include them.
+        
+              ::
+        
+                >>> def foo(a, b=10):
+                ...     pass
+        
+                >>> sig = signature(foo)
+                >>> ba = sig.bind(5)
+        
+                >>> ba.args, ba.kwargs
+                ((5,), {})
+        
+                >>> for param in sig.parameters.values():
+                ...     if param.name not in ba.arguments:
+                ...         ba.arguments[param.name] = param.default
+        
+                >>> ba.args, ba.kwargs
+                ((5, 10), {})
+        
+        
+           .. attribute:: BoundArguments.args
+        
+              A tuple of positional arguments values.  Dynamically computed from the
+              :attr:`arguments` attribute.
+        
+           .. attribute:: BoundArguments.kwargs
+        
+              A dict of keyword arguments values.  Dynamically computed from the
+              :attr:`arguments` attribute.
+        
+           The :attr:`args` and :attr:`kwargs` properties can be used to invoke
+           functions::
+        
+              def test(a, *, b):
+                 ...
+        
+              sig = signature(test)
+              ba = sig.bind(10, b=20)
+              test(*ba.args, **ba.kwargs)
+        
+        
+        .. seealso::
+        
+           :pep:`362` - Function Signature Object.
+              The detailed specification, implementation details and examples.
+        
+        Copyright
+        ---------
+        
+        *funcsigs* is a derived work of CPython under the terms of the `PSF License
+        Agreement`_. The original CPython inspect module, its unit tests and
+        documentation are the copyright of the Python Software Foundation. The derived
+        work is distributed under the `Apache License Version 2.0`_.
+        
+        .. _PSF License Agreement: http://docs.python.org/3/license.html#terms-and-conditions-for-accessing-or-otherwise-using-python
+        .. _Apache License Version 2.0: http://opensource.org/licenses/Apache-2.0
+        .. _GitHub: https://github.com/testing-cabal/funcsigs
+        .. _PSF License Agreement: http://docs.python.org/3/license.html#terms-and-conditions-for-accessing-or-otherwise-using-python
+        .. _Travis CI: http://travis-ci.org/
+        .. _Read The Docs: http://funcsigs.readthedocs.org/
+        .. _PEP 362: http://www.python.org/dev/peps/pep-0362/
+        .. _inspect: http://docs.python.org/3/library/inspect.html#introspecting-callables-with-the-signature-object
+        .. _issues system: https://github.com/testing-cabal/funcsigs/issues
+        
+        .. |build_status| image:: https://secure.travis-ci.org/aliles/funcsigs.png?branch=master
+           :target: http://travis-ci.org/#!/aliles/funcsigs
+           :alt: Current build status
+        
+        .. |coverage| image:: https://coveralls.io/repos/aliles/funcsigs/badge.png?branch=master
+           :target: https://coveralls.io/r/aliles/funcsigs?branch=master
+           :alt: Coverage status
+        
+        .. |pypi_version| image:: https://pypip.in/v/funcsigs/badge.png
+           :target: https://crate.io/packages/funcsigs/
+           :alt: Latest PyPI version
+        
+        
+        
+Platform: UNKNOWN
+Classifier: Development Status :: 4 - Beta
+Classifier: Intended Audience :: Developers
+Classifier: License :: OSI Approved :: Apache Software License
+Classifier: Operating System :: OS Independent
+Classifier: Programming Language :: Python
+Classifier: Programming Language :: Python :: 2
+Classifier: Programming Language :: Python :: 2.6
+Classifier: Programming Language :: Python :: 2.7
+Classifier: Programming Language :: Python :: 3
+Classifier: Programming Language :: Python :: 3.3
+Classifier: Programming Language :: Python :: 3.4
+Classifier: Programming Language :: Python :: 3.5
+Classifier: Programming Language :: Python :: Implementation :: CPython
+Classifier: Programming Language :: Python :: Implementation :: PyPy
+Classifier: Topic :: Software Development :: Libraries :: Python Modules
new file mode 100644
--- /dev/null
+++ b/third_party/python/funcsigs/README.rst
@@ -0,0 +1,353 @@
+.. funcsigs documentation master file, created by
+   sphinx-quickstart on Fri Apr 20 20:27:52 2012.
+   You can adapt this file completely to your liking, but it should at least
+   contain the root `toctree` directive.
+
+Introducing funcsigs
+====================
+
+The Funcsigs Package
+--------------------
+
+``funcsigs`` is a backport of the `PEP 362`_ function signature features from
+Python 3.3's `inspect`_ module. The backport is compatible with Python 2.6, 2.7
+as well as 3.3 and up. 3.2 was supported by version 0.4, but with setuptools and
+pip no longer supporting 3.2, we cannot make any statement about 3.2
+compatibility.
+
+Compatibility
+`````````````
+
+The ``funcsigs`` backport has been tested against:
+
+* CPython 2.6
+* CPython 2.7
+* CPython 3.3
+* CPython 3.4
+* CPython 3.5
+* CPython nightlies
+* PyPy and PyPy3(currently failing CI)
+
+Continuous integration testing is provided by `Travis CI`_.
+
+Under Python 2.x there is a compatibility issue when a function is assigned to
+the ``__wrapped__`` property of a class after it has been constructed.
+Similiarily there under PyPy directly passing the ``__call__`` method of a
+builtin is also a compatibility issues.  Otherwise the functionality is
+believed to be uniform between both Python2 and Python3.
+
+Issues
+``````
+
+Source code for ``funcsigs`` is hosted on `GitHub`_. Any bug reports or feature
+requests can be made using GitHub's `issues system`_. |build_status| |coverage|
+
+Example
+-------
+
+To obtain a `Signature` object, pass the target function to the
+``funcsigs.signature`` function.
+
+.. code-block:: python
+
+    >>> from funcsigs import signature
+    >>> def foo(a, b=None, *args, **kwargs):
+    ...     pass
+    ...
+    >>> sig = signature(foo)
+    >>> sig
+    <funcsigs.Signature object at 0x...>
+    >>> sig.parameters
+    OrderedDict([('a', <Parameter at 0x... 'a'>), ('b', <Parameter at 0x... 'b'>), ('args', <Parameter at 0x... 'args'>), ('kwargs', <Parameter at 0x... 'kwargs'>)])
+    >>> sig.return_annotation
+    <class 'funcsigs._empty'>
+
+Introspecting callables with the Signature object
+-------------------------------------------------
+
+.. note::
+
+   This section of documentation is a direct reproduction of the Python
+   standard library documentation for the inspect module.
+
+The Signature object represents the call signature of a callable object and its
+return annotation.  To retrieve a Signature object, use the :func:`signature`
+function.
+
+.. function:: signature(callable)
+
+   Return a :class:`Signature` object for the given ``callable``::
+
+      >>> from funcsigs import signature
+      >>> def foo(a, *, b:int, **kwargs):
+      ...     pass
+
+      >>> sig = signature(foo)
+
+      >>> str(sig)
+      '(a, *, b:int, **kwargs)'
+
+      >>> str(sig.parameters['b'])
+      'b:int'
+
+      >>> sig.parameters['b'].annotation
+      <class 'int'>
+
+   Accepts a wide range of python callables, from plain functions and classes to
+   :func:`functools.partial` objects.
+
+   .. note::
+
+      Some callables may not be introspectable in certain implementations of
+      Python.  For example, in CPython, built-in functions defined in C provide
+      no metadata about their arguments.
+
+
+.. class:: Signature
+
+   A Signature object represents the call signature of a function and its return
+   annotation.  For each parameter accepted by the function it stores a
+   :class:`Parameter` object in its :attr:`parameters` collection.
+
+   Signature objects are *immutable*.  Use :meth:`Signature.replace` to make a
+   modified copy.
+
+   .. attribute:: Signature.empty
+
+      A special class-level marker to specify absence of a return annotation.
+
+   .. attribute:: Signature.parameters
+
+      An ordered mapping of parameters' names to the corresponding
+      :class:`Parameter` objects.
+
+   .. attribute:: Signature.return_annotation
+
+      The "return" annotation for the callable.  If the callable has no "return"
+      annotation, this attribute is set to :attr:`Signature.empty`.
+
+   .. method:: Signature.bind(*args, **kwargs)
+
+      Create a mapping from positional and keyword arguments to parameters.
+      Returns :class:`BoundArguments` if ``*args`` and ``**kwargs`` match the
+      signature, or raises a :exc:`TypeError`.
+
+   .. method:: Signature.bind_partial(*args, **kwargs)
+
+      Works the same way as :meth:`Signature.bind`, but allows the omission of
+      some required arguments (mimics :func:`functools.partial` behavior.)
+      Returns :class:`BoundArguments`, or raises a :exc:`TypeError` if the
+      passed arguments do not match the signature.
+
+   .. method:: Signature.replace(*[, parameters][, return_annotation])
+
+      Create a new Signature instance based on the instance replace was invoked
+      on.  It is possible to pass different ``parameters`` and/or
+      ``return_annotation`` to override the corresponding properties of the base
+      signature.  To remove return_annotation from the copied Signature, pass in
+      :attr:`Signature.empty`.
+
+      ::
+
+         >>> def test(a, b):
+         ...     pass
+         >>> sig = signature(test)
+         >>> new_sig = sig.replace(return_annotation="new return anno")
+         >>> str(new_sig)
+         "(a, b) -> 'new return anno'"
+
+
+.. class:: Parameter
+
+   Parameter objects are *immutable*.  Instead of modifying a Parameter object,
+   you can use :meth:`Parameter.replace` to create a modified copy.
+
+   .. attribute:: Parameter.empty
+
+      A special class-level marker to specify absence of default values and
+      annotations.
+
+   .. attribute:: Parameter.name
+
+      The name of the parameter as a string.  Must be a valid python identifier
+      name (with the exception of ``POSITIONAL_ONLY`` parameters, which can have
+      it set to ``None``).
+
+   .. attribute:: Parameter.default
+
+      The default value for the parameter.  If the parameter has no default
+      value, this attribute is set to :attr:`Parameter.empty`.
+
+   .. attribute:: Parameter.annotation
+
+      The annotation for the parameter.  If the parameter has no annotation,
+      this attribute is set to :attr:`Parameter.empty`.
+
+   .. attribute:: Parameter.kind
+
+      Describes how argument values are bound to the parameter.  Possible values
+      (accessible via :class:`Parameter`, like ``Parameter.KEYWORD_ONLY``):
+
+      +------------------------+----------------------------------------------+
+      |    Name                | Meaning                                      |
+      +========================+==============================================+
+      | *POSITIONAL_ONLY*      | Value must be supplied as a positional       |
+      |                        | argument.                                    |
+      |                        |                                              |
+      |                        | Python has no explicit syntax for defining   |
+      |                        | positional-only parameters, but many built-in|
+      |                        | and extension module functions (especially   |
+      |                        | those that accept only one or two parameters)|
+      |                        | accept them.                                 |
+      +------------------------+----------------------------------------------+
+      | *POSITIONAL_OR_KEYWORD*| Value may be supplied as either a keyword or |
+      |                        | positional argument (this is the standard    |
+      |                        | binding behaviour for functions implemented  |
+      |                        | in Python.)                                  |
+      +------------------------+----------------------------------------------+
+      | *VAR_POSITIONAL*       | A tuple of positional arguments that aren't  |
+      |                        | bound to any other parameter. This           |
+      |                        | corresponds to a ``*args`` parameter in a    |
+      |                        | Python function definition.                  |
+      +------------------------+----------------------------------------------+
+      | *KEYWORD_ONLY*         | Value must be supplied as a keyword argument.|
+      |                        | Keyword only parameters are those which      |
+      |                        | appear after a ``*`` or ``*args`` entry in a |
+      |                        | Python function definition.                  |
+      +------------------------+----------------------------------------------+
+      | *VAR_KEYWORD*          | A dict of keyword arguments that aren't bound|
+      |                        | to any other parameter. This corresponds to a|
+      |                        | ``**kwargs`` parameter in a Python function  |
+      |                        | definition.                                  |
+      +------------------------+----------------------------------------------+
+
+      Example: print all keyword-only arguments without default values::
+
+         >>> def foo(a, b, *, c, d=10):
+         ...     pass
+
+         >>> sig = signature(foo)
+         >>> for param in sig.parameters.values():
+         ...     if (param.kind == param.KEYWORD_ONLY and
+         ...                        param.default is param.empty):
+         ...         print('Parameter:', param)
+         Parameter: c
+
+   .. method:: Parameter.replace(*[, name][, kind][, default][, annotation])
+
+      Create a new Parameter instance based on the instance replaced was invoked
+      on.  To override a :class:`Parameter` attribute, pass the corresponding
+      argument.  To remove a default value or/and an annotation from a
+      Parameter, pass :attr:`Parameter.empty`.
+
+      ::
+
+         >>> from funcsigs import Parameter
+         >>> param = Parameter('foo', Parameter.KEYWORD_ONLY, default=42)
+         >>> str(param)
+         'foo=42'
+
+         >>> str(param.replace()) # Will create a shallow copy of 'param'
+         'foo=42'
+
+         >>> str(param.replace(default=Parameter.empty, annotation='spam'))
+         "foo:'spam'"
+
+
+.. class:: BoundArguments
+
+   Result of a :meth:`Signature.bind` or :meth:`Signature.bind_partial` call.
+   Holds the mapping of arguments to the function's parameters.
+
+   .. attribute:: BoundArguments.arguments
+
+      An ordered, mutable mapping (:class:`collections.OrderedDict`) of
+      parameters' names to arguments' values.  Contains only explicitly bound
+      arguments.  Changes in :attr:`arguments` will reflect in :attr:`args` and
+      :attr:`kwargs`.
+
+      Should be used in conjunction with :attr:`Signature.parameters` for any
+      argument processing purposes.
+
+      .. note::
+
+         Arguments for which :meth:`Signature.bind` or
+         :meth:`Signature.bind_partial` relied on a default value are skipped.
+         However, if needed, it is easy to include them.
+
+      ::
+
+        >>> def foo(a, b=10):
+        ...     pass
+
+        >>> sig = signature(foo)
+        >>> ba = sig.bind(5)
+
+        >>> ba.args, ba.kwargs
+        ((5,), {})
+
+        >>> for param in sig.parameters.values():
+        ...     if param.name not in ba.arguments:
+        ...         ba.arguments[param.name] = param.default
+
+        >>> ba.args, ba.kwargs
+        ((5, 10), {})
+
+
+   .. attribute:: BoundArguments.args
+
+      A tuple of positional arguments values.  Dynamically computed from the
+      :attr:`arguments` attribute.
+
+   .. attribute:: BoundArguments.kwargs
+
+      A dict of keyword arguments values.  Dynamically computed from the
+      :attr:`arguments` attribute.
+
+   The :attr:`args` and :attr:`kwargs` properties can be used to invoke
+   functions::
+
+      def test(a, *, b):
+         ...
+
+      sig = signature(test)
+      ba = sig.bind(10, b=20)
+      test(*ba.args, **ba.kwargs)
+
+
+.. seealso::
+
+   :pep:`362` - Function Signature Object.
+      The detailed specification, implementation details and examples.
+
+Copyright
+---------
+
+*funcsigs* is a derived work of CPython under the terms of the `PSF License
+Agreement`_. The original CPython inspect module, its unit tests and
+documentation are the copyright of the Python Software Foundation. The derived
+work is distributed under the `Apache License Version 2.0`_.
+
+.. _PSF License Agreement: http://docs.python.org/3/license.html#terms-and-conditions-for-accessing-or-otherwise-using-python
+.. _Apache License Version 2.0: http://opensource.org/licenses/Apache-2.0
+.. _GitHub: https://github.com/testing-cabal/funcsigs
+.. _PSF License Agreement: http://docs.python.org/3/license.html#terms-and-conditions-for-accessing-or-otherwise-using-python
+.. _Travis CI: http://travis-ci.org/
+.. _Read The Docs: http://funcsigs.readthedocs.org/
+.. _PEP 362: http://www.python.org/dev/peps/pep-0362/
+.. _inspect: http://docs.python.org/3/library/inspect.html#introspecting-callables-with-the-signature-object
+.. _issues system: https://github.com/testing-cabal/funcsigs/issues
+
+.. |build_status| image:: https://secure.travis-ci.org/aliles/funcsigs.png?branch=master
+   :target: http://travis-ci.org/#!/aliles/funcsigs
+   :alt: Current build status
+
+.. |coverage| image:: https://coveralls.io/repos/aliles/funcsigs/badge.png?branch=master
+   :target: https://coveralls.io/r/aliles/funcsigs?branch=master
+   :alt: Coverage status
+
+.. |pypi_version| image:: https://pypip.in/v/funcsigs/badge.png
+   :target: https://crate.io/packages/funcsigs/
+   :alt: Latest PyPI version
+
+
new file mode 100644
--- /dev/null
+++ b/third_party/python/funcsigs/docs/Makefile
@@ -0,0 +1,153 @@
+# Makefile for Sphinx documentation
+#
+
+# You can set these variables from the command line.
+SPHINXOPTS    =
+SPHINXBUILD   = sphinx-build
+PAPER         =
+BUILDDIR      = _build
+
+# Internal variables.
+PAPEROPT_a4     = -D latex_paper_size=a4
+PAPEROPT_letter = -D latex_paper_size=letter
+ALLSPHINXOPTS   = -d $(BUILDDIR)/doctrees $(PAPEROPT_$(PAPER)) $(SPHINXOPTS) .
+# the i18n builder cannot share the environment and doctrees with the others
+I18NSPHINXOPTS  = $(PAPEROPT_$(PAPER)) $(SPHINXOPTS) .
+
+.PHONY: help clean html dirhtml singlehtml pickle json htmlhelp qthelp devhelp epub latex latexpdf text man changes linkcheck doctest gettext
+
+help:
+	@echo "Please use \`make <target>' where <target> is one of"
+	@echo "  html       to make standalone HTML files"
+	@echo "  dirhtml    to make HTML files named index.html in directories"
+	@echo "  singlehtml to make a single large HTML file"
+	@echo "  pickle     to make pickle files"
+	@echo "  json       to make JSON files"
+	@echo "  htmlhelp   to make HTML files and a HTML help project"
+	@echo "  qthelp     to make HTML files and a qthelp project"
+	@echo "  devhelp    to make HTML files and a Devhelp project"
+	@echo "  epub       to make an epub"
+	@echo "  latex      to make LaTeX files, you can set PAPER=a4 or PAPER=letter"
+	@echo "  latexpdf   to make LaTeX files and run them through pdflatex"
+	@echo "  text       to make text files"
+	@echo "  man        to make manual pages"
+	@echo "  texinfo    to make Texinfo files"
+	@echo "  info       to make Texinfo files and run them through makeinfo"
+	@echo "  gettext    to make PO message catalogs"
+	@echo "  changes    to make an overview of all changed/added/deprecated items"
+	@echo "  linkcheck  to check all external links for integrity"
+	@echo "  doctest    to run all doctests embedded in the documentation (if enabled)"
+
+clean:
+	-rm -rf $(BUILDDIR)
+
+html:
+	$(SPHINXBUILD) -b html $(ALLSPHINXOPTS) $(BUILDDIR)/html
+	@echo
+	@echo "Build finished. The HTML pages are in $(BUILDDIR)/html."
+
+dirhtml:
+	$(SPHINXBUILD) -b dirhtml $(ALLSPHINXOPTS) $(BUILDDIR)/dirhtml
+	@echo
+	@echo "Build finished. The HTML pages are in $(BUILDDIR)/dirhtml."
+
+singlehtml:
+	$(SPHINXBUILD) -b singlehtml $(ALLSPHINXOPTS) $(BUILDDIR)/singlehtml
+	@echo
+	@echo "Build finished. The HTML page is in $(BUILDDIR)/singlehtml."
+
+pickle:
+	$(SPHINXBUILD) -b pickle $(ALLSPHINXOPTS) $(BUILDDIR)/pickle
+	@echo
+	@echo "Build finished; now you can process the pickle files."
+
+json:
+	$(SPHINXBUILD) -b json $(ALLSPHINXOPTS) $(BUILDDIR)/json
+	@echo
+	@echo "Build finished; now you can process the JSON files."
+
+htmlhelp:
+	$(SPHINXBUILD) -b htmlhelp $(ALLSPHINXOPTS) $(BUILDDIR)/htmlhelp
+	@echo
+	@echo "Build finished; now you can run HTML Help Workshop with the" \
+	      ".hhp project file in $(BUILDDIR)/htmlhelp."
+
+qthelp:
+	$(SPHINXBUILD) -b qthelp $(ALLSPHINXOPTS) $(BUILDDIR)/qthelp
+	@echo
+	@echo "Build finished; now you can run "qcollectiongenerator" with the" \
+	      ".qhcp project file in $(BUILDDIR)/qthelp, like this:"
+	@echo "# qcollectiongenerator $(BUILDDIR)/qthelp/funcsigs.qhcp"
+	@echo "To view the help file:"
+	@echo "# assistant -collectionFile $(BUILDDIR)/qthelp/funcsigs.qhc"
+
+devhelp:
+	$(SPHINXBUILD) -b devhelp $(ALLSPHINXOPTS) $(BUILDDIR)/devhelp
+	@echo
+	@echo "Build finished."
+	@echo "To view the help file:"
+	@echo "# mkdir -p $$HOME/.local/share/devhelp/funcsigs"
+	@echo "# ln -s $(BUILDDIR)/devhelp $$HOME/.local/share/devhelp/funcsigs"
+	@echo "# devhelp"
+
+epub:
+	$(SPHINXBUILD) -b epub $(ALLSPHINXOPTS) $(BUILDDIR)/epub
+	@echo
+	@echo "Build finished. The epub file is in $(BUILDDIR)/epub."
+
+latex:
+	$(SPHINXBUILD) -b latex $(ALLSPHINXOPTS) $(BUILDDIR)/latex
+	@echo
+	@echo "Build finished; the LaTeX files are in $(BUILDDIR)/latex."
+	@echo "Run \`make' in that directory to run these through (pdf)latex" \
+	      "(use \`make latexpdf' here to do that automatically)."
+
+latexpdf:
+	$(SPHINXBUILD) -b latex $(ALLSPHINXOPTS) $(BUILDDIR)/latex
+	@echo "Running LaTeX files through pdflatex..."
+	$(MAKE) -C $(BUILDDIR)/latex all-pdf
+	@echo "pdflatex finished; the PDF files are in $(BUILDDIR)/latex."
+
+text:
+	$(SPHINXBUILD) -b text $(ALLSPHINXOPTS) $(BUILDDIR)/text
+	@echo
+	@echo "Build finished. The text files are in $(BUILDDIR)/text."
+
+man:
+	$(SPHINXBUILD) -b man $(ALLSPHINXOPTS) $(BUILDDIR)/man
+	@echo
+	@echo "Build finished. The manual pages are in $(BUILDDIR)/man."
+
+texinfo:
+	$(SPHINXBUILD) -b texinfo $(ALLSPHINXOPTS) $(BUILDDIR)/texinfo
+	@echo
+	@echo "Build finished. The Texinfo files are in $(BUILDDIR)/texinfo."
+	@echo "Run \`make' in that directory to run these through makeinfo" \
+	      "(use \`make info' here to do that automatically)."
+
+info:
+	$(SPHINXBUILD) -b texinfo $(ALLSPHINXOPTS) $(BUILDDIR)/texinfo
+	@echo "Running Texinfo files through makeinfo..."
+	make -C $(BUILDDIR)/texinfo info
+	@echo "makeinfo finished; the Info files are in $(BUILDDIR)/texinfo."
+
+gettext:
+	$(SPHINXBUILD) -b gettext $(I18NSPHINXOPTS) $(BUILDDIR)/locale
+	@echo
+	@echo "Build finished. The message catalogs are in $(BUILDDIR)/locale."
+
+changes:
+	$(SPHINXBUILD) -b changes $(ALLSPHINXOPTS) $(BUILDDIR)/changes
+	@echo
+	@echo "The overview file is in $(BUILDDIR)/changes."
+
+linkcheck:
+	$(SPHINXBUILD) -b linkcheck $(ALLSPHINXOPTS) $(BUILDDIR)/linkcheck
+	@echo
+	@echo "Link check complete; look for any errors in the above output " \
+	      "or in $(BUILDDIR)/linkcheck/output.txt."
+
+doctest:
+	$(SPHINXBUILD) -b doctest $(ALLSPHINXOPTS) $(BUILDDIR)/doctest
+	@echo "Testing of doctests in the sources finished, look at the " \
+	      "results in $(BUILDDIR)/doctest/output.txt."
new file mode 100644
--- /dev/null
+++ b/third_party/python/funcsigs/docs/_templates/page.html
@@ -0,0 +1,9 @@
+{% extends "!page.html" %}
+{% block extrahead %}
+    <a href="https://github.com/aliles/funcsigs">
+        <img style="position: absolute; top: 0; right: 0; border: 0;"
+             src="https://s3.amazonaws.com/github/ribbons/forkme_right_red_aa0000.png"
+             alt="Fork me on GitHub">
+    </a>
+    {{ super() }}
+{% endblock %}
new file mode 100644
--- /dev/null
+++ b/third_party/python/funcsigs/docs/conf.py
@@ -0,0 +1,251 @@
+#!/usr/bin/env python3
+# -*- coding: utf-8 -*-
+#
+# funcsigs documentation build configuration file, created by
+# sphinx-quickstart on Fri Apr 20 20:27:52 2012.
+#
+# This file is execfile()d with the current directory set to its containing dir.
+#
+# Note that not all possible configuration values are present in this
+# autogenerated file.
+#
+# All configuration values have a default; values that are commented out
+# serve to show the default.
+
+import sys, os
+
+# If extensions (or modules to document with autodoc) are in another directory,
+# add these directories to sys.path here. If the directory is relative to the
+# documentation root, use os.path.abspath to make it absolute, like shown here.
+sys.path.insert(0, os.path.abspath('..'))
+
+# -- General configuration -----------------------------------------------------
+
+# If your documentation needs a minimal Sphinx version, state it here.
+#needs_sphinx = '1.0'
+
+# Add any Sphinx extension module names here, as strings. They can be extensions
+# coming with Sphinx (named 'sphinx.ext.*') or your custom ones.
+extensions = ['sphinx.ext.autodoc', 'sphinx.ext.intersphinx', 'sphinx.ext.viewcode']
+
+# Add any paths that contain templates here, relative to this directory.
+templates_path = ['_templates']
+
+# The suffix of source filenames.
+source_suffix = '.rst'
+
+# The encoding of source files.
+#source_encoding = 'utf-8-sig'
+
+# The master toctree document.
+master_doc = 'index'
+
+# General information about the project.
+project = 'funcsigs'
+copyright = '2013, Aaron Iles'
+
+# The version info for the project you're documenting, acts as replacement for
+# |version| and |release|, also used in various other places throughout the
+# built documents.
+#
+# The short X.Y version.
+from funcsigs import __version__
+version = '.'.join(__version__.split('.')[:2])
+# The full version, including alpha/beta/rc tags.
+release = __version__
+
+# The language for content autogenerated by Sphinx. Refer to documentation
+# for a list of supported languages.
+#language = None
+
+# There are two options for replacing |today|: either, you set today to some
+# non-false value, then it is used:
+#today = ''
+# Else, today_fmt is used as the format for a strftime call.
+#today_fmt = '%B %d, %Y'
+
+# List of patterns, relative to source directory, that match files and
+# directories to ignore when looking for source files.
+exclude_patterns = ['_build']
+
+# The reST default role (used for this markup: `text`) to use for all documents.
+#default_role = None
+
+# If true, '()' will be appended to :func: etc. cross-reference text.
+#add_function_parentheses = True
+
+# If true, the current module name will be prepended to all description
+# unit titles (such as .. function::).
+#add_module_names = True
+
+# If true, sectionauthor and moduleauthor directives will be shown in the
+# output. They are ignored by default.
+#show_authors = False
+
+# The name of the Pygments (syntax highlighting) style to use.
+pygments_style = 'sphinx'
+
+# A list of ignored prefixes for module index sorting.
+#modindex_common_prefix = []
+
+
+# -- Options for HTML output ---------------------------------------------------
+
+# The theme to use for HTML and HTML Help pages.  See the documentation for
+# a list of builtin themes.
+html_theme = 'agogo'
+
+# Theme options are theme-specific and customize the look and feel of a theme
+# further.  For a list of options available for each theme, see the
+# documentation.
+#html_theme_options = {}
+
+# Add any paths that contain custom themes here, relative to this directory.
+#html_theme_path = []
+
+# The name for this set of Sphinx documents.  If None, it defaults to
+# "<project> v<release> documentation".
+#html_title = None
+
+# A shorter title for the navigation bar.  Default is the same as html_title.
+#html_short_title = None
+
+# The name of an image file (relative to this directory) to place at the top
+# of the sidebar.
+#html_logo = None
+
+# The name of an image file (within the static path) to use as favicon of the
+# docs.  This file should be a Windows icon file (.ico) being 16x16 or 32x32
+# pixels large.
+#html_favicon = None
+
+# Add any paths that contain custom static files (such as style sheets) here,
+# relative to this directory. They are copied after the builtin static files,
+# so a file named "default.css" will overwrite the builtin "default.css".
+html_static_path = []
+
+# If not '', a 'Last updated on:' timestamp is inserted at every page bottom,
+# using the given strftime format.
+#html_last_updated_fmt = '%b %d, %Y'
+
+# If true, SmartyPants will be used to convert quotes and dashes to
+# typographically correct entities.
+#html_use_smartypants = True
+
+# Custom sidebar templates, maps document names to template names.
+#html_sidebars = {}
+
+# Additional templates that should be rendered to pages, maps page names to
+# template names.
+#html_additional_pages = {}
+
+# If false, no module index is generated.
+#html_domain_indices = True
+
+# If false, no index is generated.
+#html_use_index = True
+
+# If true, the index is split into individual pages for each letter.
+#html_split_index = False
+
+# If true, links to the reST sources are added to the pages.
+#html_show_sourcelink = True
+
+# If true, "Created using Sphinx" is shown in the HTML footer. Default is True.
+#html_show_sphinx = True
+
+# If true, "(C) Copyright ..." is shown in the HTML footer. Default is True.
+#html_show_copyright = True
+
+# If true, an OpenSearch description file will be output, and all pages will
+# contain a <link> tag referring to it.  The value of this option must be the
+# base URL from which the finished HTML is served.
+#html_use_opensearch = ''
+
+# This is the file name suffix for HTML files (e.g. ".xhtml").
+#html_file_suffix = None
+
+# Output file base name for HTML help builder.
+htmlhelp_basename = 'funcsigsdoc'
+
+
+# -- Options for LaTeX output --------------------------------------------------
+
+latex_elements = {
+# The paper size ('letterpaper' or 'a4paper').
+#'papersize': 'letterpaper',
+
+# The font size ('10pt', '11pt' or '12pt').
+#'pointsize': '10pt',
+
+# Additional stuff for the LaTeX preamble.
+#'preamble': '',
+}
+
+# Grouping the document tree into LaTeX files. List of tuples
+# (source start file, target name, title, author, documentclass [howto/manual]).
+latex_documents = [
+  ('index', 'funcsigs.tex', 'funcsigs Documentation',
+   'Aaron Iles', 'manual'),
+]
+
+# The name of an image file (relative to this directory) to place at the top of
+# the title page.
+#latex_logo = None
+
+# For "manual" documents, if this is true, then toplevel headings are parts,
+# not chapters.
+#latex_use_parts = False
+
+# If true, show page references after internal links.
+#latex_show_pagerefs = False
+
+# If true, show URL addresses after external links.
+#latex_show_urls = False
+
+# Documents to append as an appendix to all manuals.
+#latex_appendices = []
+
+# If false, no module index is generated.
+#latex_domain_indices = True
+
+
+# -- Options for manual page output --------------------------------------------
+
+# One entry per manual page. List of tuples
+# (source start file, name, description, authors, manual section).
+man_pages = [
+    ('index', 'funcsigs', 'funcsigs Documentation',
+     ['Aaron Iles'], 1)
+]
+
+# If true, show URL addresses after external links.
+#man_show_urls = False
+
+
+# -- Options for Texinfo output ------------------------------------------------
+
+# Grouping the document tree into Texinfo files. List of tuples
+# (source start file, target name, title, author,
+#  dir menu entry, description, category)
+texinfo_documents = [
+  ('index', 'funcsigs', 'funcsigs Documentation',
+   'Aaron Iles', 'funcsigs', 'One line description of project.',
+   'Miscellaneous'),
+]
+
+# Documents to append as an appendix to all manuals.
+#texinfo_appendices = []
+
+# If false, no module index is generated.
+#texinfo_domain_indices = True
+
+# How to display URL addresses: 'footnote', 'no', or 'inline'.
+#texinfo_show_urls = 'footnote'
+
+
+# Example configuration for intersphinx: refer to the Python standard library.
+intersphinx_mapping = {
+        'python3': ('http://docs.python.org/py3k', None),
+        'python': ('http://docs.python.org/', None)
+}
new file mode 100644
--- /dev/null
+++ b/third_party/python/funcsigs/docs/index.rst
@@ -0,0 +1,353 @@
+.. funcsigs documentation master file, created by
+   sphinx-quickstart on Fri Apr 20 20:27:52 2012.
+   You can adapt this file completely to your liking, but it should at least
+   contain the root `toctree` directive.
+
+Introducing funcsigs
+====================
+
+The Funcsigs Package
+--------------------
+
+``funcsigs`` is a backport of the `PEP 362`_ function signature features from
+Python 3.3's `inspect`_ module. The backport is compatible with Python 2.6, 2.7
+as well as 3.3 and up. 3.2 was supported by version 0.4, but with setuptools and
+pip no longer supporting 3.2, we cannot make any statement about 3.2
+compatibility.
+
+Compatibility
+`````````````
+
+The ``funcsigs`` backport has been tested against:
+
+* CPython 2.6
+* CPython 2.7
+* CPython 3.3
+* CPython 3.4
+* CPython 3.5
+* CPython nightlies
+* PyPy and PyPy3(currently failing CI)
+
+Continuous integration testing is provided by `Travis CI`_.
+
+Under Python 2.x there is a compatibility issue when a function is assigned to
+the ``__wrapped__`` property of a class after it has been constructed.
+Similiarily there under PyPy directly passing the ``__call__`` method of a
+builtin is also a compatibility issues.  Otherwise the functionality is
+believed to be uniform between both Python2 and Python3.
+
+Issues
+``````
+
+Source code for ``funcsigs`` is hosted on `GitHub`_. Any bug reports or feature
+requests can be made using GitHub's `issues system`_. |build_status| |coverage|
+
+Example
+-------
+
+To obtain a `Signature` object, pass the target function to the
+``funcsigs.signature`` function.
+
+.. code-block:: python
+
+    >>> from funcsigs import signature
+    >>> def foo(a, b=None, *args, **kwargs):
+    ...     pass
+    ...
+    >>> sig = signature(foo)
+    >>> sig
+    <funcsigs.Signature object at 0x...>
+    >>> sig.parameters
+    OrderedDict([('a', <Parameter at 0x... 'a'>), ('b', <Parameter at 0x... 'b'>), ('args', <Parameter at 0x... 'args'>), ('kwargs', <Parameter at 0x... 'kwargs'>)])
+    >>> sig.return_annotation
+    <class 'funcsigs._empty'>
+
+Introspecting callables with the Signature object
+-------------------------------------------------
+
+.. note::
+
+   This section of documentation is a direct reproduction of the Python
+   standard library documentation for the inspect module.
+
+The Signature object represents the call signature of a callable object and its
+return annotation.  To retrieve a Signature object, use the :func:`signature`
+function.
+
+.. function:: signature(callable)
+
+   Return a :class:`Signature` object for the given ``callable``::
+
+      >>> from funcsigs import signature
+      >>> def foo(a, *, b:int, **kwargs):
+      ...     pass
+
+      >>> sig = signature(foo)
+
+      >>> str(sig)
+      '(a, *, b:int, **kwargs)'
+
+      >>> str(sig.parameters['b'])
+      'b:int'
+
+      >>> sig.parameters['b'].annotation
+      <class 'int'>
+
+   Accepts a wide range of python callables, from plain functions and classes to
+   :func:`functools.partial` objects.
+
+   .. note::
+
+      Some callables may not be introspectable in certain implementations of
+      Python.  For example, in CPython, built-in functions defined in C provide
+      no metadata about their arguments.
+
+
+.. class:: Signature
+
+   A Signature object represents the call signature of a function and its return
+   annotation.  For each parameter accepted by the function it stores a
+   :class:`Parameter` object in its :attr:`parameters` collection.
+
+   Signature objects are *immutable*.  Use :meth:`Signature.replace` to make a
+   modified copy.
+
+   .. attribute:: Signature.empty
+
+      A special class-level marker to specify absence of a return annotation.
+
+   .. attribute:: Signature.parameters
+
+      An ordered mapping of parameters' names to the corresponding
+      :class:`Parameter` objects.
+
+   .. attribute:: Signature.return_annotation
+
+      The "return" annotation for the callable.  If the callable has no "return"
+      annotation, this attribute is set to :attr:`Signature.empty`.
+
+   .. method:: Signature.bind(*args, **kwargs)
+
+      Create a mapping from positional and keyword arguments to parameters.
+      Returns :class:`BoundArguments` if ``*args`` and ``**kwargs`` match the
+      signature, or raises a :exc:`TypeError`.
+
+   .. method:: Signature.bind_partial(*args, **kwargs)
+
+      Works the same way as :meth:`Signature.bind`, but allows the omission of
+      some required arguments (mimics :func:`functools.partial` behavior.)
+      Returns :class:`BoundArguments`, or raises a :exc:`TypeError` if the
+      passed arguments do not match the signature.
+
+   .. method:: Signature.replace(*[, parameters][, return_annotation])
+
+      Create a new Signature instance based on the instance replace was invoked
+      on.  It is possible to pass different ``parameters`` and/or
+      ``return_annotation`` to override the corresponding properties of the base
+      signature.  To remove return_annotation from the copied Signature, pass in
+      :attr:`Signature.empty`.
+
+      ::
+
+         >>> def test(a, b):
+         ...     pass
+         >>> sig = signature(test)
+         >>> new_sig = sig.replace(return_annotation="new return anno")
+         >>> str(new_sig)
+         "(a, b) -> 'new return anno'"
+
+
+.. class:: Parameter
+
+   Parameter objects are *immutable*.  Instead of modifying a Parameter object,
+   you can use :meth:`Parameter.replace` to create a modified copy.
+
+   .. attribute:: Parameter.empty
+
+      A special class-level marker to specify absence of default values and
+      annotations.
+
+   .. attribute:: Parameter.name
+
+      The name of the parameter as a string.  Must be a valid python identifier
+      name (with the exception of ``POSITIONAL_ONLY`` parameters, which can have
+      it set to ``None``).
+
+   .. attribute:: Parameter.default
+
+      The default value for the parameter.  If the parameter has no default
+      value, this attribute is set to :attr:`Parameter.empty`.
+
+   .. attribute:: Parameter.annotation
+
+      The annotation for the parameter.  If the parameter has no annotation,
+      this attribute is set to :attr:`Parameter.empty`.
+
+   .. attribute:: Parameter.kind
+
+      Describes how argument values are bound to the parameter.  Possible values
+      (accessible via :class:`Parameter`, like ``Parameter.KEYWORD_ONLY``):
+
+      +------------------------+----------------------------------------------+
+      |    Name                | Meaning                                      |
+      +========================+==============================================+
+      | *POSITIONAL_ONLY*      | Value must be supplied as a positional       |
+      |                        | argument.                                    |
+      |                        |                                              |
+      |                        | Python has no explicit syntax for defining   |
+      |                        | positional-only parameters, but many built-in|
+      |                        | and extension module functions (especially   |
+      |                        | those that accept only one or two parameters)|
+      |                        | accept them.                                 |
+      +------------------------+----------------------------------------------+
+      | *POSITIONAL_OR_KEYWORD*| Value may be supplied as either a keyword or |
+      |                        | positional argument (this is the standard    |
+      |                        | binding behaviour for functions implemented  |
+      |                        | in Python.)                                  |
+      +------------------------+----------------------------------------------+
+      | *VAR_POSITIONAL*       | A tuple of positional arguments that aren't  |
+      |                        | bound to any other parameter. This           |
+      |                        | corresponds to a ``*args`` parameter in a    |
+      |                        | Python function definition.                  |
+      +------------------------+----------------------------------------------+
+      | *KEYWORD_ONLY*         | Value must be supplied as a keyword argument.|
+      |                        | Keyword only parameters are those which      |
+      |                        | appear after a ``*`` or ``*args`` entry in a |
+      |                        | Python function definition.                  |
+      +------------------------+----------------------------------------------+
+      | *VAR_KEYWORD*          | A dict of keyword arguments that aren't bound|
+      |                        | to any other parameter. This corresponds to a|
+      |                        | ``**kwargs`` parameter in a Python function  |
+      |                        | definition.                                  |
+      +------------------------+----------------------------------------------+
+
+      Example: print all keyword-only arguments without default values::
+
+         >>> def foo(a, b, *, c, d=10):
+         ...     pass
+
+         >>> sig = signature(foo)
+         >>> for param in sig.parameters.values():
+         ...     if (param.kind == param.KEYWORD_ONLY and
+         ...                        param.default is param.empty):
+         ...         print('Parameter:', param)
+         Parameter: c
+
+   .. method:: Parameter.replace(*[, name][, kind][, default][, annotation])
+
+      Create a new Parameter instance based on the instance replaced was invoked
+      on.  To override a :class:`Parameter` attribute, pass the corresponding
+      argument.  To remove a default value or/and an annotation from a
+      Parameter, pass :attr:`Parameter.empty`.
+
+      ::
+
+         >>> from funcsigs import Parameter
+         >>> param = Parameter('foo', Parameter.KEYWORD_ONLY, default=42)
+         >>> str(param)
+         'foo=42'
+
+         >>> str(param.replace()) # Will create a shallow copy of 'param'
+         'foo=42'
+
+         >>> str(param.replace(default=Parameter.empty, annotation='spam'))
+         "foo:'spam'"
+
+
+.. class:: BoundArguments
+
+   Result of a :meth:`Signature.bind` or :meth:`Signature.bind_partial` call.
+   Holds the mapping of arguments to the function's parameters.
+
+   .. attribute:: BoundArguments.arguments
+
+      An ordered, mutable mapping (:class:`collections.OrderedDict`) of
+      parameters' names to arguments' values.  Contains only explicitly bound
+      arguments.  Changes in :attr:`arguments` will reflect in :attr:`args` and
+      :attr:`kwargs`.
+
+      Should be used in conjunction with :attr:`Signature.parameters` for any
+      argument processing purposes.
+
+      .. note::
+
+         Arguments for which :meth:`Signature.bind` or
+         :meth:`Signature.bind_partial` relied on a default value are skipped.
+         However, if needed, it is easy to include them.
+
+      ::
+
+        >>> def foo(a, b=10):
+        ...     pass
+
+        >>> sig = signature(foo)
+        >>> ba = sig.bind(5)
+
+        >>> ba.args, ba.kwargs
+        ((5,), {})
+
+        >>> for param in sig.parameters.values():
+        ...     if param.name not in ba.arguments:
+        ...         ba.arguments[param.name] = param.default
+
+        >>> ba.args, ba.kwargs
+        ((5, 10), {})
+
+
+   .. attribute:: BoundArguments.args
+
+      A tuple of positional arguments values.  Dynamically computed from the
+      :attr:`arguments` attribute.
+
+   .. attribute:: BoundArguments.kwargs
+
+      A dict of keyword arguments values.  Dynamically computed from the
+      :attr:`arguments` attribute.
+
+   The :attr:`args` and :attr:`kwargs` properties can be used to invoke
+   functions::
+
+      def test(a, *, b):
+         ...
+
+      sig = signature(test)
+      ba = sig.bind(10, b=20)
+      test(*ba.args, **ba.kwargs)
+
+
+.. seealso::
+
+   :pep:`362` - Function Signature Object.
+      The detailed specification, implementation details and examples.
+
+Copyright
+---------
+
+*funcsigs* is a derived work of CPython under the terms of the `PSF License
+Agreement`_. The original CPython inspect module, its unit tests and
+documentation are the copyright of the Python Software Foundation. The derived
+work is distributed under the `Apache License Version 2.0`_.
+
+.. _PSF License Agreement: http://docs.python.org/3/license.html#terms-and-conditions-for-accessing-or-otherwise-using-python
+.. _Apache License Version 2.0: http://opensource.org/licenses/Apache-2.0
+.. _GitHub: https://github.com/testing-cabal/funcsigs
+.. _PSF License Agreement: http://docs.python.org/3/license.html#terms-and-conditions-for-accessing-or-otherwise-using-python
+.. _Travis CI: http://travis-ci.org/
+.. _Read The Docs: http://funcsigs.readthedocs.org/
+.. _PEP 362: http://www.python.org/dev/peps/pep-0362/
+.. _inspect: http://docs.python.org/3/library/inspect.html#introspecting-callables-with-the-signature-object
+.. _issues system: https://github.com/testing-cabal/funcsigs/issues
+
+.. |build_status| image:: https://secure.travis-ci.org/aliles/funcsigs.png?branch=master
+   :target: http://travis-ci.org/#!/aliles/funcsigs
+   :alt: Current build status
+
+.. |coverage| image:: https://coveralls.io/repos/aliles/funcsigs/badge.png?branch=master
+   :target: https://coveralls.io/r/aliles/funcsigs?branch=master
+   :alt: Coverage status
+
+.. |pypi_version| image:: https://pypip.in/v/funcsigs/badge.png
+   :target: https://crate.io/packages/funcsigs/
+   :alt: Latest PyPI version
+
+
new file mode 100644
--- /dev/null
+++ b/third_party/python/funcsigs/funcsigs/__init__.py
@@ -0,0 +1,829 @@
+# Copyright 2001-2013 Python Software Foundation; All Rights Reserved
+"""Function signature objects for callables
+
+Back port of Python 3.3's function signature tools from the inspect module,
+modified to be compatible with Python 2.6, 2.7 and 3.3+.
+"""
+from __future__ import absolute_import, division, print_function
+import itertools
+import functools
+import re
+import types
+
+try:
+    from collections import OrderedDict
+except ImportError:
+    from ordereddict import OrderedDict
+
+from funcsigs.version import __version__
+
+__all__ = ['BoundArguments', 'Parameter', 'Signature', 'signature']
+
+
+_WrapperDescriptor = type(type.__call__)
+_MethodWrapper = type(all.__call__)
+
+_NonUserDefinedCallables = (_WrapperDescriptor,
+                            _MethodWrapper,
+                            types.BuiltinFunctionType)
+
+
+def formatannotation(annotation, base_module=None):
+    if isinstance(annotation, type):
+        if annotation.__module__ in ('builtins', '__builtin__', base_module):
+            return annotation.__name__
+        return annotation.__module__+'.'+annotation.__name__
+    return repr(annotation)
+
+
+def _get_user_defined_method(cls, method_name, *nested):
+    try:
+        if cls is type:
+            return
+        meth = getattr(cls, method_name)
+        for name in nested:
+            meth = getattr(meth, name, meth)
+    except AttributeError:
+        return
+    else:
+        if not isinstance(meth, _NonUserDefinedCallables):
+            # Once '__signature__' will be added to 'C'-level
+            # callables, this check won't be necessary
+            return meth
+
+
+def signature(obj):
+    '''Get a signature object for the passed callable.'''
+
+    if not callable(obj):
+        raise TypeError('{0!r} is not a callable object'.format(obj))
+
+    if isinstance(obj, types.MethodType):
+        sig = signature(obj.__func__)
+        if obj.__self__ is None:
+            # Unbound method - preserve as-is.
+            return sig
+        else:
+            # Bound method. Eat self - if we can.
+            params = tuple(sig.parameters.values())
+
+            if not params or params[0].kind in (_VAR_KEYWORD, _KEYWORD_ONLY):
+                raise ValueError('invalid method signature')
+
+            kind = params[0].kind
+            if kind in (_POSITIONAL_OR_KEYWORD, _POSITIONAL_ONLY):
+                # Drop first parameter:
+                # '(p1, p2[, ...])' -> '(p2[, ...])'
+                params = params[1:]
+            else:
+                if kind is not _VAR_POSITIONAL:
+                    # Unless we add a new parameter type we never
+                    # get here
+                    raise ValueError('invalid argument type')
+                # It's a var-positional parameter.
+                # Do nothing. '(*args[, ...])' -> '(*args[, ...])'
+
+            return sig.replace(parameters=params)
+
+    try:
+        sig = obj.__signature__
+    except AttributeError:
+        pass
+    else:
+        if sig is not None:
+            return sig
+
+    try:
+        # Was this function wrapped by a decorator?
+        wrapped = obj.__wrapped__
+    except AttributeError:
+        pass
+    else:
+        return signature(wrapped)
+
+    if isinstance(obj, types.FunctionType):
+        return Signature.from_function(obj)
+
+    if isinstance(obj, functools.partial):
+        sig = signature(obj.func)
+
+        new_params = OrderedDict(sig.parameters.items())
+
+        partial_args = obj.args or ()
+        partial_keywords = obj.keywords or {}
+        try:
+            ba = sig.bind_partial(*partial_args, **partial_keywords)
+        except TypeError as ex:
+            msg = 'partial object {0!r} has incorrect arguments'.format(obj)
+            raise ValueError(msg)
+
+        for arg_name, arg_value in ba.arguments.items():
+            param = new_params[arg_name]
+            if arg_name in partial_keywords:
+                # We set a new default value, because the following code
+                # is correct:
+                #
+                #   >>> def foo(a): print(a)
+                #   >>> print(partial(partial(foo, a=10), a=20)())
+                #   20
+                #   >>> print(partial(partial(foo, a=10), a=20)(a=30))
+                #   30
+                #
+                # So, with 'partial' objects, passing a keyword argument is
+                # like setting a new default value for the corresponding
+                # parameter
+                #
+                # We also mark this parameter with '_partial_kwarg'
+                # flag.  Later, in '_bind', the 'default' value of this
+                # parameter will be added to 'kwargs', to simulate
+                # the 'functools.partial' real call.
+                new_params[arg_name] = param.replace(default=arg_value,
+                                                     _partial_kwarg=True)
+
+            elif (param.kind not in (_VAR_KEYWORD, _VAR_POSITIONAL) and
+                            not param._partial_kwarg):
+                new_params.pop(arg_name)
+
+        return sig.replace(parameters=new_params.values())
+
+    sig = None
+    if isinstance(obj, type):
+        # obj is a class or a metaclass
+
+        # First, let's see if it has an overloaded __call__ defined
+        # in its metaclass
+        call = _get_user_defined_method(type(obj), '__call__')
+        if call is not None:
+            sig = signature(call)
+        else:
+            # Now we check if the 'obj' class has a '__new__' method
+            new = _get_user_defined_method(obj, '__new__')
+            if new is not None:
+                sig = signature(new)
+            else:
+                # Finally, we should have at least __init__ implemented
+                init = _get_user_defined_method(obj, '__init__')
+                if init is not None:
+                    sig = signature(init)
+    elif not isinstance(obj, _NonUserDefinedCallables):
+        # An object with __call__
+        # We also check that the 'obj' is not an instance of
+        # _WrapperDescriptor or _MethodWrapper to avoid
+        # infinite recursion (and even potential segfault)
+        call = _get_user_defined_method(type(obj), '__call__', 'im_func')
+        if call is not None:
+            sig = signature(call)
+
+    if sig is not None:
+        # For classes and objects we skip the first parameter of their
+        # __call__, __new__, or __init__ methods
+        return sig.replace(parameters=tuple(sig.parameters.values())[1:])
+
+    if isinstance(obj, types.BuiltinFunctionType):
+        # Raise a nicer error message for builtins
+        msg = 'no signature found for builtin function {0!r}'.format(obj)
+        raise ValueError(msg)
+
+    raise ValueError('callable {0!r} is not supported by signature'.format(obj))
+
+
+class _void(object):
+    '''A private marker - used in Parameter & Signature'''
+
+
+class _empty(object):
+    pass
+
+
+class _ParameterKind(int):
+    def __new__(self, *args, **kwargs):
+        obj = int.__new__(self, *args)
+        obj._name = kwargs['name']
+        return obj
+
+    def __str__(self):
+        return self._name
+
+    def __repr__(self):
+        return '<_ParameterKind: {0!r}>'.format(self._name)
+
+
+_POSITIONAL_ONLY        = _ParameterKind(0, name='POSITIONAL_ONLY')
+_POSITIONAL_OR_KEYWORD  = _ParameterKind(1, name='POSITIONAL_OR_KEYWORD')
+_VAR_POSITIONAL         = _ParameterKind(2, name='VAR_POSITIONAL')
+_KEYWORD_ONLY           = _ParameterKind(3, name='KEYWORD_ONLY')
+_VAR_KEYWORD            = _ParameterKind(4, name='VAR_KEYWORD')
+
+
+class Parameter(object):
+    '''Represents a parameter in a function signature.
+
+    Has the following public attributes:
+
+    * name : str
+        The name of the parameter as a string.
+    * default : object
+        The default value for the parameter if specified.  If the
+        parameter has no default value, this attribute is not set.
+    * annotation
+        The annotation for the parameter if specified.  If the
+        parameter has no annotation, this attribute is not set.
+    * kind : str
+        Describes how argument values are bound to the parameter.
+        Possible values: `Parameter.POSITIONAL_ONLY`,
+        `Parameter.POSITIONAL_OR_KEYWORD`, `Parameter.VAR_POSITIONAL`,
+        `Parameter.KEYWORD_ONLY`, `Parameter.VAR_KEYWORD`.
+    '''
+
+    __slots__ = ('_name', '_kind', '_default', '_annotation', '_partial_kwarg')
+
+    POSITIONAL_ONLY         = _POSITIONAL_ONLY
+    POSITIONAL_OR_KEYWORD   = _POSITIONAL_OR_KEYWORD
+    VAR_POSITIONAL          = _VAR_POSITIONAL
+    KEYWORD_ONLY            = _KEYWORD_ONLY
+    VAR_KEYWORD             = _VAR_KEYWORD
+
+    empty = _empty
+
+    def __init__(self, name, kind, default=_empty, annotation=_empty,
+                 _partial_kwarg=False):
+
+        if kind not in (_POSITIONAL_ONLY, _POSITIONAL_OR_KEYWORD,
+                        _VAR_POSITIONAL, _KEYWORD_ONLY, _VAR_KEYWORD):
+            raise ValueError("invalid value for 'Parameter.kind' attribute")
+        self._kind = kind
+
+        if default is not _empty:
+            if kind in (_VAR_POSITIONAL, _VAR_KEYWORD):
+                msg = '{0} parameters cannot have default values'.format(kind)
+                raise ValueError(msg)
+        self._default = default
+        self._annotation = annotation
+
+        if name is None:
+            if kind != _POSITIONAL_ONLY:
+                raise ValueError("None is not a valid name for a "
+                                 "non-positional-only parameter")
+            self._name = name
+        else:
+            name = str(name)
+            if kind != _POSITIONAL_ONLY and not re.match(r'[a-z_]\w*$', name, re.I):
+                msg = '{0!r} is not a valid parameter name'.format(name)
+                raise ValueError(msg)
+            self._name = name
+
+        self._partial_kwarg = _partial_kwarg
+
+    @property
+    def name(self):
+        return self._name
+
+    @property
+    def default(self):
+        return self._default
+
+    @property
+    def annotation(self):
+        return self._annotation
+
+    @property
+    def kind(self):
+        return self._kind
+
+    def replace(self, name=_void, kind=_void, annotation=_void,
+                default=_void, _partial_kwarg=_void):
+        '''Creates a customized copy of the Parameter.'''
+
+        if name is _void:
+            name = self._name
+
+        if kind is _void:
+            kind = self._kind
+
+        if annotation is _void:
+            annotation = self._annotation
+
+        if default is _void:
+            default = self._default
+
+        if _partial_kwarg is _void:
+            _partial_kwarg = self._partial_kwarg
+
+        return type(self)(name, kind, default=default, annotation=annotation,
+                          _partial_kwarg=_partial_kwarg)
+
+    def __str__(self):
+        kind = self.kind
+
+        formatted = self._name
+        if kind == _POSITIONAL_ONLY:
+            if formatted is None:
+                formatted = ''
+            formatted = '<{0}>'.format(formatted)
+
+        # Add annotation and default value
+        if self._annotation is not _empty:
+            formatted = '{0}:{1}'.format(formatted,
+                                       formatannotation(self._annotation))
+
+        if self._default is not _empty:
+            formatted = '{0}={1}'.format(formatted, repr(self._default))
+
+        if kind == _VAR_POSITIONAL:
+            formatted = '*' + formatted
+        elif kind == _VAR_KEYWORD:
+            formatted = '**' + formatted
+
+        return formatted
+
+    def __repr__(self):
+        return '<{0} at {1:#x} {2!r}>'.format(self.__class__.__name__,
+                                           id(self), self.name)
+
+    def __hash__(self):
+        msg = "unhashable type: '{0}'".format(self.__class__.__name__)
+        raise TypeError(msg)
+
+    def __eq__(self, other):
+        return (issubclass(other.__class__, Parameter) and
+                self._name == other._name and
+                self._kind == other._kind and
+                self._default == other._default and
+                self._annotation == other._annotation)
+
+    def __ne__(self, other):
+        return not self.__eq__(other)
+
+
+class BoundArguments(object):
+    '''Result of `Signature.bind` call.  Holds the mapping of arguments
+    to the function's parameters.
+
+    Has the following public attributes:
+
+    * arguments : OrderedDict
+        An ordered mutable mapping of parameters' names to arguments' values.
+        Does not contain arguments' default values.
+    * signature : Signature
+        The Signature object that created this instance.
+    * args : tuple
+        Tuple of positional arguments values.
+    * kwargs : dict
+        Dict of keyword arguments values.
+    '''
+
+    def __init__(self, signature, arguments):
+        self.arguments = arguments
+        self._signature = signature
+
+    @property
+    def signature(self):
+        return self._signature
+
+    @property
+    def args(self):
+        args = []
+        for param_name, param in self._signature.parameters.items():
+            if (param.kind in (_VAR_KEYWORD, _KEYWORD_ONLY) or
+                                                    param._partial_kwarg):
+                # Keyword arguments mapped by 'functools.partial'
+                # (Parameter._partial_kwarg is True) are mapped
+                # in 'BoundArguments.kwargs', along with VAR_KEYWORD &
+                # KEYWORD_ONLY
+                break
+
+            try:
+                arg = self.arguments[param_name]
+            except KeyError:
+                # We're done here. Other arguments
+                # will be mapped in 'BoundArguments.kwargs'
+                break
+            else:
+                if param.kind == _VAR_POSITIONAL:
+                    # *args
+                    args.extend(arg)
+                else:
+                    # plain argument
+                    args.append(arg)
+
+        return tuple(args)
+
+    @property
+    def kwargs(self):
+        kwargs = {}
+        kwargs_started = False
+        for param_name, param in self._signature.parameters.items():
+            if not kwargs_started:
+                if (param.kind in (_VAR_KEYWORD, _KEYWORD_ONLY) or
+                                                param._partial_kwarg):
+                    kwargs_started = True
+                else:
+                    if param_name not in self.arguments:
+                        kwargs_started = True
+                        continue
+
+            if not kwargs_started:
+                continue
+
+            try:
+                arg = self.arguments[param_name]
+            except KeyError:
+                pass
+            else:
+                if param.kind == _VAR_KEYWORD:
+                    # **kwargs
+                    kwargs.update(arg)
+                else:
+                    # plain keyword argument
+                    kwargs[param_name] = arg
+
+        return kwargs
+
+    def __hash__(self):
+        msg = "unhashable type: '{0}'".format(self.__class__.__name__)
+        raise TypeError(msg)
+
+    def __eq__(self, other):
+        return (issubclass(other.__class__, BoundArguments) and
+                self.signature == other.signature and
+                self.arguments == other.arguments)
+
+    def __ne__(self, other):
+        return not self.__eq__(other)
+
+
+class Signature(object):
+    '''A Signature object represents the overall signature of a function.
+    It stores a Parameter object for each parameter accepted by the
+    function, as well as information specific to the function itself.
+
+    A Signature object has the following public attributes and methods:
+
+    * parameters : OrderedDict
+        An ordered mapping of parameters' names to the corresponding
+        Parameter objects (keyword-only arguments are in the same order
+        as listed in `code.co_varnames`).
+    * return_annotation : object
+        The annotation for the return type of the function if specified.
+        If the function has no annotation for its return type, this
+        attribute is not set.
+    * bind(*args, **kwargs) -> BoundArguments
+        Creates a mapping from positional and keyword arguments to
+        parameters.
+    * bind_partial(*args, **kwargs) -> BoundArguments
+        Creates a partial mapping from positional and keyword arguments
+        to parameters (simulating 'functools.partial' behavior.)
+    '''
+
+    __slots__ = ('_return_annotation', '_parameters')
+
+    _parameter_cls = Parameter
+    _bound_arguments_cls = BoundArguments
+
+    empty = _empty
+
+    def __init__(self, parameters=None, return_annotation=_empty,
+                 __validate_parameters__=True):
+        '''Constructs Signature from the given list of Parameter
+        objects and 'return_annotation'.  All arguments are optional.
+        '''
+
+        if parameters is None:
+            params = OrderedDict()
+        else:
+            if __validate_parameters__:
+                params = OrderedDict()
+                top_kind = _POSITIONAL_ONLY
+
+                for idx, param in enumerate(parameters):
+                    kind = param.kind
+                    if kind < top_kind:
+                        msg = 'wrong parameter order: {0} before {1}'
+                        msg = msg.format(top_kind, param.kind)
+                        raise ValueError(msg)
+                    else:
+                        top_kind = kind
+
+                    name = param.name
+                    if name is None:
+                        name = str(idx)
+                        param = param.replace(name=name)
+
+                    if name in params:
+                        msg = 'duplicate parameter name: {0!r}'.format(name)
+                        raise ValueError(msg)
+                    params[name] = param
+            else:
+                params = OrderedDict(((param.name, param)
+                                                for param in parameters))
+
+        self._parameters = params
+        self._return_annotation = return_annotation
+
+    @classmethod
+    def from_function(cls, func):
+        '''Constructs Signature for the given python function'''
+
+        if not isinstance(func, types.FunctionType):
+            raise TypeError('{0!r} is not a Python function'.format(func))
+
+        Parameter = cls._parameter_cls
+
+        # Parameter information.
+        func_code = func.__code__
+        pos_count = func_code.co_argcount
+        arg_names = func_code.co_varnames
+        positional = tuple(arg_names[:pos_count])
+        keyword_only_count = getattr(func_code, 'co_kwonlyargcount', 0)
+        keyword_only = arg_names[pos_count:(pos_count + keyword_only_count)]
+        annotations = getattr(func, '__annotations__', {})
+        defaults = func.__defaults__
+        kwdefaults = getattr(func, '__kwdefaults__', None)
+
+        if defaults:
+            pos_default_count = len(defaults)
+        else:
+            pos_default_count = 0
+
+        parameters = []
+
+        # Non-keyword-only parameters w/o defaults.
+        non_default_count = pos_count - pos_default_count
+        for name in positional[:non_default_count]:
+            annotation = annotations.get(name, _empty)
+            parameters.append(Parameter(name, annotation=annotation,
+                                        kind=_POSITIONAL_OR_KEYWORD))
+
+        # ... w/ defaults.
+        for offset, name in enumerate(positional[non_default_count:]):
+            annotation = annotations.get(name, _empty)
+            parameters.append(Parameter(name, annotation=annotation,
+                                        kind=_POSITIONAL_OR_KEYWORD,
+                                        default=defaults[offset]))
+
+        # *args
+        if func_code.co_flags & 0x04:
+            name = arg_names[pos_count + keyword_only_count]
+            annotation = annotations.get(name, _empty)
+            parameters.append(Parameter(name, annotation=annotation,
+                                        kind=_VAR_POSITIONAL))
+
+        # Keyword-only parameters.
+        for name in keyword_only:
+            default = _empty
+            if kwdefaults is not None:
+                default = kwdefaults.get(name, _empty)
+
+            annotation = annotations.get(name, _empty)
+            parameters.append(Parameter(name, annotation=annotation,
+                                        kind=_KEYWORD_ONLY,
+                                        default=default))
+        # **kwargs
+        if func_code.co_flags & 0x08:
+            index = pos_count + keyword_only_count
+            if func_code.co_flags & 0x04:
+                index += 1
+
+            name = arg_names[index]
+            annotation = annotations.get(name, _empty)
+            parameters.append(Parameter(name, annotation=annotation,
+                                        kind=_VAR_KEYWORD))
+
+        return cls(parameters,
+                   return_annotation=annotations.get('return', _empty),
+                   __validate_parameters__=False)
+
+    @property
+    def parameters(self):
+        try:
+            return types.MappingProxyType(self._parameters)
+        except AttributeError:
+            return OrderedDict(self._parameters.items())
+
+    @property
+    def return_annotation(self):
+        return self._return_annotation
+
+    def replace(self, parameters=_void, return_annotation=_void):
+        '''Creates a customized copy of the Signature.
+        Pass 'parameters' and/or 'return_annotation' arguments
+        to override them in the new copy.
+        '''
+
+        if parameters is _void:
+            parameters = self.parameters.values()
+
+        if return_annotation is _void:
+            return_annotation = self._return_annotation
+
+        return type(self)(parameters,
+                          return_annotation=return_annotation)
+
+    def __hash__(self):
+        msg = "unhashable type: '{0}'".format(self.__class__.__name__)
+        raise TypeError(msg)
+
+    def __eq__(self, other):
+        if (not issubclass(type(other), Signature) or
+                    self.return_annotation != other.return_annotation or
+                    len(self.parameters) != len(other.parameters)):
+            return False
+
+        other_positions = dict((param, idx)
+                           for idx, param in enumerate(other.parameters.keys()))
+
+        for idx, (param_name, param) in enumerate(self.parameters.items()):
+            if param.kind == _KEYWORD_ONLY:
+                try:
+                    other_param = other.parameters[param_name]
+                except KeyError:
+                    return False
+                else:
+                    if param != other_param:
+                        return False
+            else:
+                try:
+                    other_idx = other_positions[param_name]
+                except KeyError:
+                    return False
+                else:
+                    if (idx != other_idx or
+                                    param != other.parameters[param_name]):
+                        return False
+
+        return True
+
+    def __ne__(self, other):
+        return not self.__eq__(other)
+
+    def _bind(self, args, kwargs, partial=False):
+        '''Private method.  Don't use directly.'''
+
+        arguments = OrderedDict()
+
+        parameters = iter(self.parameters.values())
+        parameters_ex = ()
+        arg_vals = iter(args)
+
+        if partial:
+            # Support for binding arguments to 'functools.partial' objects.
+            # See 'functools.partial' case in 'signature()' implementation
+            # for details.
+            for param_name, param in self.parameters.items():
+                if (param._partial_kwarg and param_name not in kwargs):
+                    # Simulating 'functools.partial' behavior
+                    kwargs[param_name] = param.default
+
+        while True:
+            # Let's iterate through the positional arguments and corresponding
+            # parameters
+            try:
+                arg_val = next(arg_vals)
+            except StopIteration:
+                # No more positional arguments
+                try:
+                    param = next(parameters)
+                except StopIteration:
+                    # No more parameters. That's it. Just need to check that
+                    # we have no `kwargs` after this while loop
+                    break
+                else:
+                    if param.kind == _VAR_POSITIONAL:
+                        # That's OK, just empty *args.  Let's start parsing
+                        # kwargs
+                        break
+                    elif param.name in kwargs:
+                        if param.kind == _POSITIONAL_ONLY:
+                            msg = '{arg!r} parameter is positional only, ' \
+                                  'but was passed as a keyword'
+                            msg = msg.format(arg=param.name)
+                            raise TypeError(msg)
+                        parameters_ex = (param,)
+                        break
+                    elif (param.kind == _VAR_KEYWORD or
+                                                param.default is not _empty):
+                        # That's fine too - we have a default value for this
+                        # parameter.  So, lets start parsing `kwargs`, starting
+                        # with the current parameter
+                        parameters_ex = (param,)
+                        break
+                    else:
+                        if partial:
+                            parameters_ex = (param,)
+                            break
+                        else:
+                            msg = '{arg!r} parameter lacking default value'
+                            msg = msg.format(arg=param.name)
+                            raise TypeError(msg)
+            else:
+                # We have a positional argument to process
+                try:
+                    param = next(parameters)
+                except StopIteration:
+                    raise TypeError('too many positional arguments')
+                else:
+                    if param.kind in (_VAR_KEYWORD, _KEYWORD_ONLY):
+                        # Looks like we have no parameter for this positional
+                        # argument
+                        raise TypeError('too many positional arguments')
+
+                    if param.kind == _VAR_POSITIONAL:
+                        # We have an '*args'-like argument, let's fill it with
+                        # all positional arguments we have left and move on to
+                        # the next phase
+                        values = [arg_val]
+                        values.extend(arg_vals)
+                        arguments[param.name] = tuple(values)
+                        break
+
+                    if param.name in kwargs:
+                        raise TypeError('multiple values for argument '
+                                        '{arg!r}'.format(arg=param.name))
+
+                    arguments[param.name] = arg_val
+
+        # Now, we iterate through the remaining parameters to process
+        # keyword arguments
+        kwargs_param = None
+        for param in itertools.chain(parameters_ex, parameters):
+            if param.kind == _POSITIONAL_ONLY:
+                # This should never happen in case of a properly built
+                # Signature object (but let's have this check here
+                # to ensure correct behaviour just in case)
+                raise TypeError('{arg!r} parameter is positional only, '
+                                'but was passed as a keyword'. \
+                                format(arg=param.name))
+
+            if param.kind == _VAR_KEYWORD:
+                # Memorize that we have a '**kwargs'-like parameter
+                kwargs_param = param
+                continue
+
+            param_name = param.name
+            try:
+                arg_val = kwargs.pop(param_name)
+            except KeyError:
+                # We have no value for this parameter.  It's fine though,
+                # if it has a default value, or it is an '*args'-like
+                # parameter, left alone by the processing of positional
+                # arguments.
+                if (not partial and param.kind != _VAR_POSITIONAL and
+                                                    param.default is _empty):
+                    raise TypeError('{arg!r} parameter lacking default value'. \
+                                    format(arg=param_name))
+
+            else:
+                arguments[param_name] = arg_val
+
+        if kwargs:
+            if kwargs_param is not None:
+                # Process our '**kwargs'-like parameter
+                arguments[kwargs_param.name] = kwargs
+            else:
+                raise TypeError('too many keyword arguments %r' % kwargs)
+
+        return self._bound_arguments_cls(self, arguments)
+
+    def bind(*args, **kwargs):
+        '''Get a BoundArguments object, that maps the passed `args`
+        and `kwargs` to the function's signature.  Raises `TypeError`
+        if the passed arguments can not be bound.
+        '''
+        return args[0]._bind(args[1:], kwargs)
+
+    def bind_partial(self, *args, **kwargs):
+        '''Get a BoundArguments object, that partially maps the
+        passed `args` and `kwargs` to the function's signature.
+        Raises `TypeError` if the passed arguments can not be bound.
+        '''
+        return self._bind(args, kwargs, partial=True)
+
+    def __str__(self):
+        result = []
+        render_kw_only_separator = True
+        for idx, param in enumerate(self.parameters.values()):
+            formatted = str(param)
+
+            kind = param.kind
+            if kind == _VAR_POSITIONAL:
+                # OK, we have an '*args'-like parameter, so we won't need
+                # a '*' to separate keyword-only arguments
+                render_kw_only_separator = False
+            elif kind == _KEYWORD_ONLY and render_kw_only_separator:
+                # We have a keyword-only parameter to render and we haven't
+                # rendered an '*args'-like parameter before, so add a '*'
+                # separator to the parameters list ("foo(arg1, *, arg2)" case)
+                result.append('*')
+                # This condition should be only triggered once, so
+                # reset the flag
+                render_kw_only_separator = False
+
+            result.append(formatted)
+
+        rendered = '({0})'.format(', '.join(result))
+
+        if self.return_annotation is not _empty:
+            anno = formatannotation(self.return_annotation)
+            rendered += ' -> {0}'.format(anno)
+
+        return rendered
new file mode 100644
--- /dev/null
+++ b/third_party/python/funcsigs/funcsigs/version.py
@@ -0,0 +1,1 @@
+__version__ = "1.0.2"
new file mode 100644
--- /dev/null
+++ b/third_party/python/funcsigs/setup.cfg
@@ -0,0 +1,8 @@
+[wheel]
+universal = 1
+
+[egg_info]
+tag_build = 
+tag_date = 0
+tag_svn_revision = 0
+
new file mode 100644
--- /dev/null
+++ b/third_party/python/funcsigs/setup.py
@@ -0,0 +1,52 @@
+#!/usr/bin/env python
+from setuptools import setup
+import re
+import sys
+
+def load_version(filename='funcsigs/version.py'):
+    "Parse a __version__ number from a source file"
+    with open(filename) as source:
+        text = source.read()
+        match = re.search(r"^__version__ = ['\"]([^'\"]*)['\"]", text)
+        if not match:
+            msg = "Unable to find version number in {}".format(filename)
+            raise RuntimeError(msg)
+        version = match.group(1)
+        return version
+
+
+setup(
+    name="funcsigs",
+    version=load_version(),
+    packages=['funcsigs'],
+    zip_safe=False,
+    author="Testing Cabal",
+    author_email="testing-in-python@lists.idyll.org",
+    url="http://funcsigs.readthedocs.org",
+    description="Python function signatures from PEP362 for Python 2.6, 2.7 and 3.2+",
+    long_description=open('README.rst').read(),
+    license="ASL",
+    extras_require = {
+        ':python_version<"2.7"': ['ordereddict'],
+    },
+    setup_requires = ["setuptools>=17.1"],
+    classifiers = [
+        'Development Status :: 4 - Beta',
+        'Intended Audience :: Developers',
+        'License :: OSI Approved :: Apache Software License',
+        'Operating System :: OS Independent',
+        'Programming Language :: Python',
+        'Programming Language :: Python :: 2',
+        'Programming Language :: Python :: 2.6',
+        'Programming Language :: Python :: 2.7',
+        'Programming Language :: Python :: 3',
+        'Programming Language :: Python :: 3.3',
+        'Programming Language :: Python :: 3.4',
+        'Programming Language :: Python :: 3.5',
+        'Programming Language :: Python :: Implementation :: CPython',
+        'Programming Language :: Python :: Implementation :: PyPy',
+        'Topic :: Software Development :: Libraries :: Python Modules'
+    ],
+    tests_require = ['unittest2'],
+    test_suite = 'unittest2.collector',
+)
new file mode 100644
new file mode 100644
--- /dev/null
+++ b/third_party/python/funcsigs/tests/test_formatannotation.py
@@ -0,0 +1,17 @@
+import funcsigs
+
+import unittest2 as unittest
+
+class TestFormatAnnotation(unittest.TestCase):
+    def test_string (self):
+        self.assertEqual(funcsigs.formatannotation("annotation"),
+                         "'annotation'")
+
+    def test_builtin_type (self):
+        self.assertEqual(funcsigs.formatannotation(int),
+                         "int")
+
+    def test_user_type (self):
+        class dummy (object): pass
+        self.assertEqual(funcsigs.formatannotation(dummy),
+                         "tests.test_formatannotation.dummy")
new file mode 100644
--- /dev/null
+++ b/third_party/python/funcsigs/tests/test_funcsigs.py
@@ -0,0 +1,91 @@
+import unittest2 as unittest
+
+import doctest
+import sys
+
+import funcsigs as inspect
+
+
+class TestFunctionSignatures(unittest.TestCase):
+
+    @staticmethod
+    def signature(func):
+        sig = inspect.signature(func)
+        return (tuple((param.name,
+                       (Ellipsis if param.default is param.empty else param.default),
+                       (Ellipsis if param.annotation is param.empty
+                                                        else param.annotation),
+                       str(param.kind).lower())
+                                    for param in sig.parameters.values()),
+                (Ellipsis if sig.return_annotation is sig.empty
+                                            else sig.return_annotation))
+
+    def test_zero_arguments(self):
+        def test():
+            pass
+        self.assertEqual(self.signature(test),
+                ((), Ellipsis))
+
+    def test_single_positional_argument(self):
+        def test(a):
+            pass
+        self.assertEqual(self.signature(test),
+                (((('a', Ellipsis, Ellipsis, "positional_or_keyword")),), Ellipsis))
+
+    def test_single_keyword_argument(self):
+        def test(a=None):
+            pass
+        self.assertEqual(self.signature(test),
+                (((('a', None, Ellipsis, "positional_or_keyword")),), Ellipsis))
+
+    def test_var_args(self):
+        def test(*args):
+            pass
+        self.assertEqual(self.signature(test),
+                (((('args', Ellipsis, Ellipsis, "var_positional")),), Ellipsis))
+
+    def test_keywords_args(self):
+        def test(**kwargs):
+            pass
+        self.assertEqual(self.signature(test),
+                (((('kwargs', Ellipsis, Ellipsis, "var_keyword")),), Ellipsis))
+
+    def test_multiple_arguments(self):
+        def test(a, b=None, *args, **kwargs):
+            pass
+        self.assertEqual(self.signature(test), ((
+            ('a', Ellipsis, Ellipsis, "positional_or_keyword"),
+            ('b', None, Ellipsis, "positional_or_keyword"),
+            ('args', Ellipsis, Ellipsis, "var_positional"),
+            ('kwargs', Ellipsis, Ellipsis, "var_keyword"),
+            ), Ellipsis))
+
+    def test_has_version(self):
+        self.assertTrue(inspect.__version__)
+
+    def test_readme(self):
+        # XXX: This fails but doesn't fail the build.
+	# (and the syntax isn't valid on all pythons so that seems a little
+	# hard to get right.
+        doctest.testfile('../README.rst')
+
+    def test_unbound_method(self):
+        self_kind = "positional_or_keyword"
+        class Test(object):
+            def method(self):
+                pass
+            def method_with_args(self, a):
+                pass
+            def method_with_varargs(*args):
+                pass
+        self.assertEqual(
+            self.signature(Test.method),
+            (((('self', Ellipsis, Ellipsis, self_kind)),), Ellipsis))
+        self.assertEqual(
+            self.signature(Test.method_with_args),
+            ((('self', Ellipsis, Ellipsis, self_kind),
+              ('a', Ellipsis, Ellipsis, "positional_or_keyword"),
+                ), Ellipsis))
+        self.assertEqual(
+            self.signature(Test.method_with_varargs),
+            ((('args', Ellipsis, Ellipsis, "var_positional"),), Ellipsis))
new file mode 100644
--- /dev/null
+++ b/third_party/python/funcsigs/tests/test_inspect.py
@@ -0,0 +1,1002 @@
+# Copyright 2001-2013 Python Software Foundation; All Rights Reserved
+from __future__ import absolute_import, division, print_function
+import collections
+import functools
+import sys
+
+import unittest2 as unittest
+
+import funcsigs as inspect
+
+
+class TestSignatureObject(unittest.TestCase):
+    @staticmethod
+    def signature(func):
+        sig = inspect.signature(func)
+        return (tuple((param.name,
+                       (Ellipsis if param.default is param.empty else param.default),
+                       (Ellipsis if param.annotation is param.empty
+                                                        else param.annotation),
+                       str(param.kind).lower())
+                                    for param in sig.parameters.values()),
+                (Ellipsis if sig.return_annotation is sig.empty
+                                            else sig.return_annotation))
+
+    if sys.version_info[0] > 2:
+        exec("""
+def test_signature_object(self):
+    S = inspect.Signature
+    P = inspect.Parameter
+
+    self.assertEqual(str(S()), '()')
+
+    def test(po, pk, *args, ko, **kwargs):
+        pass
+    sig = inspect.signature(test)
+    po = sig.parameters['po'].replace(kind=P.POSITIONAL_ONLY)
+    pk = sig.parameters['pk']
+    args = sig.parameters['args']
+    ko = sig.parameters['ko']
+    kwargs = sig.parameters['kwargs']
+
+    S((po, pk, args, ko, kwargs))
+
+    with self.assertRaisesRegex(ValueError, 'wrong parameter order'):
+        S((pk, po, args, ko, kwargs))
+
+    with self.assertRaisesRegex(ValueError, 'wrong parameter order'):
+        S((po, args, pk, ko, kwargs))
+
+    with self.assertRaisesRegex(ValueError, 'wrong parameter order'):
+        S((args, po, pk, ko, kwargs))
+
+    with self.assertRaisesRegex(ValueError, 'wrong parameter order'):
+        S((po, pk, args, kwargs, ko))
+
+    kwargs2 = kwargs.replace(name='args')
+    with self.assertRaisesRegex(ValueError, 'duplicate parameter name'):
+        S((po, pk, args, kwargs2, ko))
+""")
+
+    def test_signature_immutability(self):
+        def test(a):
+            pass
+        sig = inspect.signature(test)
+
+        with self.assertRaises(AttributeError):
+            sig.foo = 'bar'
+
+        # Python2 does not have MappingProxyType class
+        if sys.version_info[:2] < (3, 3):
+            return
+
+        with self.assertRaises(TypeError):
+            sig.parameters['a'] = None
+
+    def test_signature_on_noarg(self):
+        def test():
+            pass
+        self.assertEqual(self.signature(test), ((), Ellipsis))
+
+    if sys.version_info[0] > 2:
+        exec("""
+def test_signature_on_wargs(self):
+    def test(a, b:'foo') -> 123:
+        pass
+    self.assertEqual(self.signature(test),
+                     ((('a', Ellipsis, Ellipsis, "positional_or_keyword"),
+                       ('b', Ellipsis, 'foo', "positional_or_keyword")),
+                      123))
+""")
+
+    if sys.version_info[0] > 2:
+        exec("""
+def test_signature_on_wkwonly(self):
+    def test(*, a:float, b:str) -> int:
+        pass
+    self.assertEqual(self.signature(test),
+                     ((('a', Ellipsis, float, "keyword_only"),
+                       ('b', Ellipsis, str, "keyword_only")),
+                       int))
+""")
+
+    if sys.version_info[0] > 2:
+        exec("""
+def test_signature_on_complex_args(self):
+    def test(a, b:'foo'=10, *args:'bar', spam:'baz', ham=123, **kwargs:int):
+        pass
+    self.assertEqual(self.signature(test),
+                     ((('a', Ellipsis, Ellipsis, "positional_or_keyword"),
+                       ('b', 10, 'foo', "positional_or_keyword"),
+                       ('args', Ellipsis, 'bar', "var_positional"),
+                       ('spam', Ellipsis, 'baz', "keyword_only"),
+                       ('ham', 123, Ellipsis, "keyword_only"),
+                       ('kwargs', Ellipsis, int, "var_keyword")),
+                      Ellipsis))
+""")
+
+    def test_signature_on_builtin_function(self):
+        with self.assertRaisesRegex(ValueError, 'not supported by signature'):
+            inspect.signature(type)
+        with self.assertRaisesRegex(ValueError, 'not supported by signature'):
+            # support for 'wrapper_descriptor'
+            inspect.signature(type.__call__)
+            if hasattr(sys, 'pypy_version_info'):
+                raise ValueError('not supported by signature')
+        with self.assertRaisesRegex(ValueError, 'not supported by signature'):
+            # support for 'method-wrapper'
+            inspect.signature(min.__call__)
+            if hasattr(sys, 'pypy_version_info'):
+                raise ValueError('not supported by signature')
+        with self.assertRaisesRegex(ValueError,
+                                     'no signature found for builtin function'):
+            # support for 'method-wrapper'
+            inspect.signature(min)
+
+    def test_signature_on_non_function(self):
+        with self.assertRaisesRegex(TypeError, 'is not a callable object'):
+            inspect.signature(42)
+
+        with self.assertRaisesRegex(TypeError, 'is not a Python function'):
+            inspect.Signature.from_function(42)
+
+    if sys.version_info[0] > 2:
+        exec("""
+def test_signature_on_method(self):
+    class Test:
+        def foo(self, arg1, arg2=1) -> int:
+            pass
+
+    meth = Test().foo
+
+    self.assertEqual(self.signature(meth),
+                     ((('arg1', Ellipsis, Ellipsis, "positional_or_keyword"),
+                       ('arg2', 1, Ellipsis, "positional_or_keyword")),
+                      int))
+""")
+
+    if sys.version_info[0] > 2:
+        exec("""
+def test_signature_on_classmethod(self):
+    class Test:
+        @classmethod
+        def foo(cls, arg1, *, arg2=1):
+            pass
+
+    meth = Test().foo
+    self.assertEqual(self.signature(meth),
+                     ((('arg1', Ellipsis, Ellipsis, "positional_or_keyword"),
+                       ('arg2', 1, Ellipsis, "keyword_only")),
+                      Ellipsis))
+
+    meth = Test.foo
+    self.assertEqual(self.signature(meth),
+                     ((('arg1', Ellipsis, Ellipsis, "positional_or_keyword"),
+                       ('arg2', 1, Ellipsis, "keyword_only")),
+                      Ellipsis))
+""")
+
+    if sys.version_info[0] > 2:
+        exec("""
+def test_signature_on_staticmethod(self):
+    class Test:
+        @staticmethod
+        def foo(cls, *, arg):
+            pass
+
+    meth = Test().foo
+    self.assertEqual(self.signature(meth),
+                     ((('cls', Ellipsis, Ellipsis, "positional_or_keyword"),
+                       ('arg', Ellipsis, Ellipsis, "keyword_only")),
+                      Ellipsis))
+
+    meth = Test.foo
+    self.assertEqual(self.signature(meth),
+                     ((('cls', Ellipsis, Ellipsis, "positional_or_keyword"),
+                       ('arg', Ellipsis, Ellipsis, "keyword_only")),
+                      Ellipsis))
+""")
+
+    if sys.version_info[0] > 2:
+        exec("""
+def test_signature_on_partial(self):
+    from functools import partial
+
+    def test():
+        pass
+
+    self.assertEqual(self.signature(partial(test)), ((), Ellipsis))
+
+    with self.assertRaisesRegex(ValueError, "has incorrect arguments"):
+        inspect.signature(partial(test, 1))
+
+    with self.assertRaisesRegex(ValueError, "has incorrect arguments"):
+        inspect.signature(partial(test, a=1))
+
+    def test(a, b, *, c, d):
+        pass
+
+    self.assertEqual(self.signature(partial(test)),
+                     ((('a', Ellipsis, Ellipsis, "positional_or_keyword"),
+                       ('b', Ellipsis, Ellipsis, "positional_or_keyword"),
+                       ('c', Ellipsis, Ellipsis, "keyword_only"),
+                       ('d', Ellipsis, Ellipsis, "keyword_only")),
+                      Ellipsis))
+
+    self.assertEqual(self.signature(partial(test, 1)),
+                     ((('b', Ellipsis, Ellipsis, "positional_or_keyword"),
+                       ('c', Ellipsis, Ellipsis, "keyword_only"),
+                       ('d', Ellipsis, Ellipsis, "keyword_only")),
+                      Ellipsis))
+
+    self.assertEqual(self.signature(partial(test, 1, c=2)),
+                     ((('b', Ellipsis, Ellipsis, "positional_or_keyword"),
+                       ('c', 2, Ellipsis, "keyword_only"),
+                       ('d', Ellipsis, Ellipsis, "keyword_only")),
+                      Ellipsis))
+
+    self.assertEqual(self.signature(partial(test, b=1, c=2)),
+                     ((('a', Ellipsis, Ellipsis, "positional_or_keyword"),
+                       ('b', 1, Ellipsis, "positional_or_keyword"),
+                       ('c', 2, Ellipsis, "keyword_only"),
+                       ('d', Ellipsis, Ellipsis, "keyword_only")),
+                      Ellipsis))
+
+    self.assertEqual(self.signature(partial(test, 0, b=1, c=2)),
+                     ((('b', 1, Ellipsis, "positional_or_keyword"),
+                       ('c', 2, Ellipsis, "keyword_only"),
+                       ('d', Ellipsis, Ellipsis, "keyword_only"),),
+                      Ellipsis))
+
+    def test(a, *args, b, **kwargs):
+        pass
+
+    self.assertEqual(self.signature(partial(test, 1)),
+                     ((('args', Ellipsis, Ellipsis, "var_positional"),
+                       ('b', Ellipsis, Ellipsis, "keyword_only"),
+                       ('kwargs', Ellipsis, Ellipsis, "var_keyword")),
+                      Ellipsis))
+
+    self.assertEqual(self.signature(partial(test, 1, 2, 3)),
+                     ((('args', Ellipsis, Ellipsis, "var_positional"),
+                       ('b', Ellipsis, Ellipsis, "keyword_only"),
+                       ('kwargs', Ellipsis, Ellipsis, "var_keyword")),
+                      Ellipsis))
+
+
+    self.assertEqual(self.signature(partial(test, 1, 2, 3, test=True)),
+                     ((('args', Ellipsis, Ellipsis, "var_positional"),
+                       ('b', Ellipsis, Ellipsis, "keyword_only"),
+                       ('kwargs', Ellipsis, Ellipsis, "var_keyword")),
+                      Ellipsis))
+
+    self.assertEqual(self.signature(partial(test, 1, 2, 3, test=1, b=0)),
+                     ((('args', Ellipsis, Ellipsis, "var_positional"),
+                       ('b', 0, Ellipsis, "keyword_only"),
+                       ('kwargs', Ellipsis, Ellipsis, "var_keyword")),
+                      Ellipsis))
+
+    self.assertEqual(self.signature(partial(test, b=0)),
+                     ((('a', Ellipsis, Ellipsis, "positional_or_keyword"),
+                       ('args', Ellipsis, Ellipsis, "var_positional"),
+                       ('b', 0, Ellipsis, "keyword_only"),
+                       ('kwargs', Ellipsis, Ellipsis, "var_keyword")),
+                      Ellipsis))
+
+    self.assertEqual(self.signature(partial(test, b=0, test=1)),
+                     ((('a', Ellipsis, Ellipsis, "positional_or_keyword"),
+                       ('args', Ellipsis, Ellipsis, "var_positional"),
+                       ('b', 0, Ellipsis, "keyword_only"),
+                       ('kwargs', Ellipsis, Ellipsis, "var_keyword")),
+                      Ellipsis))
+
+    def test(a, b, c:int) -> 42:
+        pass
+
+    sig = test.__signature__ = inspect.signature(test)
+
+    self.assertEqual(self.signature(partial(partial(test, 1))),
+                     ((('b', Ellipsis, Ellipsis, "positional_or_keyword"),
+                       ('c', Ellipsis, int, "positional_or_keyword")),
+                      42))
+
+    self.assertEqual(self.signature(partial(partial(test, 1), 2)),
+                     ((('c', Ellipsis, int, "positional_or_keyword"),),
+                      42))
+
+    psig = inspect.signature(partial(partial(test, 1), 2))
+
+    def foo(a):
+        return a
+    _foo = partial(partial(foo, a=10), a=20)
+    self.assertEqual(self.signature(_foo),
+                     ((('a', 20, Ellipsis, "positional_or_keyword"),),
+                      Ellipsis))
+    # check that we don't have any side-effects in signature(),
+    # and the partial object is still functioning
+    self.assertEqual(_foo(), 20)
+
+    def foo(a, b, c):
+        return a, b, c
+    _foo = partial(partial(foo, 1, b=20), b=30)
+    self.assertEqual(self.signature(_foo),
+                     ((('b', 30, Ellipsis, "positional_or_keyword"),
+                       ('c', Ellipsis, Ellipsis, "positional_or_keyword")),
+                      Ellipsis))
+    self.assertEqual(_foo(c=10), (1, 30, 10))
+    _foo = partial(_foo, 2) # now 'b' has two values -
+                            # positional and keyword
+    with self.assertRaisesRegex(ValueError, "has incorrect arguments"):
+        inspect.signature(_foo)
+
+    def foo(a, b, c, *, d):
+        return a, b, c, d
+    _foo = partial(partial(foo, d=20, c=20), b=10, d=30)
+    self.assertEqual(self.signature(_foo),
+                     ((('a', Ellipsis, Ellipsis, "positional_or_keyword"),
+                       ('b', 10, Ellipsis, "positional_or_keyword"),
+                       ('c', 20, Ellipsis, "positional_or_keyword"),
+                       ('d', 30, Ellipsis, "keyword_only")),
+                      Ellipsis))
+    ba = inspect.signature(_foo).bind(a=200, b=11)
+    self.assertEqual(_foo(*ba.args, **ba.kwargs), (200, 11, 20, 30))
+
+    def foo(a=1, b=2, c=3):
+        return a, b, c
+    _foo = partial(foo, a=10, c=13)
+    ba = inspect.signature(_foo).bind(11)
+    self.assertEqual(_foo(*ba.args, **ba.kwargs), (11, 2, 13))
+    ba = inspect.signature(_foo).bind(11, 12)
+    self.assertEqual(_foo(*ba.args, **ba.kwargs), (11, 12, 13))
+    ba = inspect.signature(_foo).bind(11, b=12)
+    self.assertEqual(_foo(*ba.args, **ba.kwargs), (11, 12, 13))
+    ba = inspect.signature(_foo).bind(b=12)
+    self.assertEqual(_foo(*ba.args, **ba.kwargs), (10, 12, 13))
+    _foo = partial(_foo, b=10)
+    ba = inspect.signature(_foo).bind(12, 14)
+    self.assertEqual(_foo(*ba.args, **ba.kwargs), (12, 14, 13))
+""")
+
+    if sys.version_info[0] > 2:
+        exec("""
+def test_signature_on_decorated(self):
+    import functools
+
+    def decorator(func):
+        @functools.wraps(func)
+        def wrapper(*args, **kwargs) -> int:
+            return func(*args, **kwargs)
+        return wrapper
+
+    class Foo:
+        @decorator
+        def bar(self, a, b):
+            pass
+
+    self.assertEqual(self.signature(Foo.bar),
+                     ((('self', Ellipsis, Ellipsis, "positional_or_keyword"),
+                       ('a', Ellipsis, Ellipsis, "positional_or_keyword"),
+                       ('b', Ellipsis, Ellipsis, "positional_or_keyword")),
+                      Ellipsis))
+
+    self.assertEqual(self.signature(Foo().bar),
+                     ((('a', Ellipsis, Ellipsis, "positional_or_keyword"),
+                       ('b', Ellipsis, Ellipsis, "positional_or_keyword")),
+                      Ellipsis))
+
+    # Test that we handle method wrappers correctly
+    def decorator(func):
+        @functools.wraps(func)
+        def wrapper(*args, **kwargs) -> int:
+            return func(42, *args, **kwargs)
+        sig = inspect.signature(func)
+        new_params = tuple(sig.parameters.values())[1:]
+        wrapper.__signature__ = sig.replace(parameters=new_params)
+        return wrapper
+
+    class Foo:
+        @decorator
+        def __call__(self, a, b):
+            pass
+
+    self.assertEqual(self.signature(Foo.__call__),
+                     ((('a', Ellipsis, Ellipsis, "positional_or_keyword"),
+                       ('b', Ellipsis, Ellipsis, "positional_or_keyword")),
+                      Ellipsis))
+
+    self.assertEqual(self.signature(Foo().__call__),
+                     ((('b', Ellipsis, Ellipsis, "positional_or_keyword"),),
+                      Ellipsis))
+""")
+
+    if sys.version_info[0] > 2:
+        exec("""
+def test_signature_on_class(self):
+    class C:
+        def __init__(self, a):
+            pass
+
+    self.assertEqual(self.signature(C),
+                     ((('a', Ellipsis, Ellipsis, "positional_or_keyword"),),
+                      Ellipsis))
+
+    class CM(type):
+        def __call__(cls, a):
+            pass
+    class C(metaclass=CM):
+        def __init__(self, b):
+            pass
+
+    self.assertEqual(self.signature(C),
+                     ((('a', Ellipsis, Ellipsis, "positional_or_keyword"),),
+                      Ellipsis))
+
+    class CM(type):
+        def __new__(mcls, name, bases, dct, *, foo=1):
+            return super().__new__(mcls, name, bases, dct)
+    class C(metaclass=CM):
+        def __init__(self, b):
+            pass
+
+    self.assertEqual(self.signature(C),
+                     ((('b', Ellipsis, Ellipsis, "positional_or_keyword"),),
+                      Ellipsis))
+
+    self.assertEqual(self.signature(CM),
+                     ((('name', Ellipsis, Ellipsis, "positional_or_keyword"),
+                       ('bases', Ellipsis, Ellipsis, "positional_or_keyword"),
+                       ('dct', Ellipsis, Ellipsis, "positional_or_keyword"),
+                       ('foo', 1, Ellipsis, "keyword_only")),
+                      Ellipsis))
+
+    class CMM(type):
+        def __new__(mcls, name, bases, dct, *, foo=1):
+            return super().__new__(mcls, name, bases, dct)
+        def __call__(cls, nm, bs, dt):
+            return type(nm, bs, dt)
+    class CM(type, metaclass=CMM):
+        def __new__(mcls, name, bases, dct, *, bar=2):
+            return super().__new__(mcls, name, bases, dct)
+    class C(metaclass=CM):
+        def __init__(self, b):
+            pass
+
+    self.assertEqual(self.signature(CMM),
+                     ((('name', Ellipsis, Ellipsis, "positional_or_keyword"),
+                       ('bases', Ellipsis, Ellipsis, "positional_or_keyword"),
+                       ('dct', Ellipsis, Ellipsis, "positional_or_keyword"),
+                       ('foo', 1, Ellipsis, "keyword_only")),
+                      Ellipsis))
+
+    self.assertEqual(self.signature(CM),
+                     ((('nm', Ellipsis, Ellipsis, "positional_or_keyword"),
+                       ('bs', Ellipsis, Ellipsis, "positional_or_keyword"),
+                       ('dt', Ellipsis, Ellipsis, "positional_or_keyword")),
+                      Ellipsis))
+
+    self.assertEqual(self.signature(C),
+                     ((('b', Ellipsis, Ellipsis, "positional_or_keyword"),),
+                      Ellipsis))
+
+    class CM(type):
+        def __init__(cls, name, bases, dct, *, bar=2):
+            return super().__init__(name, bases, dct)
+    class C(metaclass=CM):
+        def __init__(self, b):
+            pass
+
+    self.assertEqual(self.signature(CM),
+                     ((('name', Ellipsis, Ellipsis, "positional_or_keyword"),
+                       ('bases', Ellipsis, Ellipsis, "positional_or_keyword"),
+                       ('dct', Ellipsis, Ellipsis, "positional_or_keyword"),
+                       ('bar', 2, Ellipsis, "keyword_only")),
+                      Ellipsis))
+""")
+
+    def test_signature_on_callable_objects(self):
+        class Foo(object):
+            def __call__(self, a):
+                pass
+
+        self.assertEqual(self.signature(Foo()),
+                         ((('a', Ellipsis, Ellipsis, "positional_or_keyword"),),
+                          Ellipsis))
+
+        class Spam(object):
+            pass
+        with self.assertRaisesRegex(TypeError, "is not a callable object"):
+            inspect.signature(Spam())
+
+        class Bar(Spam, Foo):
+            pass
+
+        self.assertEqual(self.signature(Bar()),
+                         ((('a', Ellipsis, Ellipsis, "positional_or_keyword"),),
+                          Ellipsis))
+
+        class ToFail(object):
+            __call__ = type
+        with self.assertRaisesRegex(ValueError, "not supported by signature"):
+            inspect.signature(ToFail())
+
+        if sys.version_info[0] < 3:
+            return
+
+        class Wrapped(object):
+            pass
+        Wrapped.__wrapped__ = lambda a: None
+        self.assertEqual(self.signature(Wrapped),
+                         ((('a', Ellipsis, Ellipsis, "positional_or_keyword"),),
+                          Ellipsis))
+
+    def test_signature_on_lambdas(self):
+        self.assertEqual(self.signature((lambda a=10: a)),
+                         ((('a', 10, Ellipsis, "positional_or_keyword"),),
+                          Ellipsis))
+
+    if sys.version_info[0] > 2:
+        exec("""
+def test_signature_equality(self):
+    def foo(a, *, b:int) -> float: pass
+    self.assertNotEqual(inspect.signature(foo), 42)
+
+    def bar(a, *, b:int) -> float: pass
+    self.assertEqual(inspect.signature(foo), inspect.signature(bar))
+
+    def bar(a, *, b:int) -> int: pass
+    self.assertNotEqual(inspect.signature(foo), inspect.signature(bar))
+
+    def bar(a, *, b:int): pass
+    self.assertNotEqual(inspect.signature(foo), inspect.signature(bar))
+
+    def bar(a, *, b:int=42) -> float: pass
+    self.assertNotEqual(inspect.signature(foo), inspect.signature(bar))
+
+    def bar(a, *, c) -> float: pass
+    self.assertNotEqual(inspect.signature(foo), inspect.signature(bar))
+
+    def bar(a, b:int) -> float: pass
+    self.assertNotEqual(inspect.signature(foo), inspect.signature(bar))
+    def spam(b:int, a) -> float: pass
+    self.assertNotEqual(inspect.signature(spam), inspect.signature(bar))
+
+    def foo(*, a, b, c): pass
+    def bar(*, c, b, a): pass
+    self.assertEqual(inspect.signature(foo), inspect.signature(bar))
+
+    def foo(*, a=1, b, c): pass
+    def bar(*, c, b, a=1): pass
+    self.assertEqual(inspect.signature(foo), inspect.signature(bar))
+
+    def foo(pos, *, a=1, b, c): pass
+    def bar(pos, *, c, b, a=1): pass
+    self.assertEqual(inspect.signature(foo), inspect.signature(bar))
+
+    def foo(pos, *, a, b, c): pass
+    def bar(pos, *, c, b, a=1): pass
+    self.assertNotEqual(inspect.signature(foo), inspect.signature(bar))
+
+    def foo(pos, *args, a=42, b, c, **kwargs:int): pass
+    def bar(pos, *args, c, b, a=42, **kwargs:int): pass
+    self.assertEqual(inspect.signature(foo), inspect.signature(bar))
+""")
+
+    def test_signature_unhashable(self):
+        def foo(a): pass
+        sig = inspect.signature(foo)
+        with self.assertRaisesRegex(TypeError, 'unhashable type'):
+            hash(sig)
+
+
+    if sys.version_info[0] > 2:
+        exec("""
+def test_signature_str(self):
+    def foo(a:int=1, *, b, c=None, **kwargs) -> 42:
+        pass
+    self.assertEqual(str(inspect.signature(foo)),
+                     '(a:int=1, *, b, c=None, **kwargs) -> 42')
+
+    def foo(a:int=1, *args, b, c=None, **kwargs) -> 42:
+        pass
+    self.assertEqual(str(inspect.signature(foo)),
+                     '(a:int=1, *args, b, c=None, **kwargs) -> 42')
+
+    def foo():
+        pass
+    self.assertEqual(str(inspect.signature(foo)), '()')
+""")
+
+    if sys.version_info[0] > 2:
+        exec("""
+def test_signature_str_positional_only(self):
+    P = inspect.Parameter
+
+    def test(a_po, *, b, **kwargs):
+        return a_po, kwargs
+
+    sig = inspect.signature(test)
+    new_params = list(sig.parameters.values())
+    new_params[0] = new_params[0].replace(kind=P.POSITIONAL_ONLY)
+    test.__signature__ = sig.replace(parameters=new_params)
+
+    self.assertEqual(str(inspect.signature(test)),
+                     '(<a_po>, *, b, **kwargs)')
+
+    sig = inspect.signature(test)
+    new_params = list(sig.parameters.values())
+    new_params[0] = new_params[0].replace(name=None)
+    test.__signature__ = sig.replace(parameters=new_params)
+    self.assertEqual(str(inspect.signature(test)),
+                     '(<0>, *, b, **kwargs)')
+""")
+
+    if sys.version_info[0] > 2:
+        exec("""
+def test_signature_replace_anno(self):
+    def test() -> 42:
+        pass
+
+    sig = inspect.signature(test)
+    sig = sig.replace(return_annotation=None)
+    self.assertIs(sig.return_annotation, None)
+    sig = sig.replace(return_annotation=sig.empty)
+    self.assertIs(sig.return_annotation, sig.empty)
+    sig = sig.replace(return_annotation=42)
+    self.assertEqual(sig.return_annotation, 42)
+    self.assertEqual(sig, inspect.signature(test))
+""")
+
+
+class TestParameterObject(unittest.TestCase):
+
+    def test_signature_parameter_kinds(self):
+        P = inspect.Parameter
+        self.assertTrue(P.POSITIONAL_ONLY < P.POSITIONAL_OR_KEYWORD < \
+                        P.VAR_POSITIONAL < P.KEYWORD_ONLY < P.VAR_KEYWORD)
+
+        self.assertEqual(str(P.POSITIONAL_ONLY), 'POSITIONAL_ONLY')
+        self.assertTrue('POSITIONAL_ONLY' in repr(P.POSITIONAL_ONLY))
+
+    def test_signature_parameter_object(self):
+        p = inspect.Parameter('foo', default=10,
+                              kind=inspect.Parameter.POSITIONAL_ONLY)
+        self.assertEqual(p.name, 'foo')
+        self.assertEqual(p.default, 10)
+        self.assertIs(p.annotation, p.empty)
+        self.assertEqual(p.kind, inspect.Parameter.POSITIONAL_ONLY)
+
+        with self.assertRaisesRegex(ValueError, 'invalid value'):
+            inspect.Parameter('foo', default=10, kind='123')
+
+        with self.assertRaisesRegex(ValueError, 'not a valid parameter name'):
+            inspect.Parameter('1', kind=inspect.Parameter.VAR_KEYWORD)
+
+        with self.assertRaisesRegex(ValueError,
+                                     'non-positional-only parameter'):
+            inspect.Parameter(None, kind=inspect.Parameter.VAR_KEYWORD)
+
+        with self.assertRaisesRegex(ValueError, 'cannot have default values'):
+            inspect.Parameter('a', default=42,
+                              kind=inspect.Parameter.VAR_KEYWORD)
+
+        with self.assertRaisesRegex(ValueError, 'cannot have default values'):
+            inspect.Parameter('a', default=42,
+                              kind=inspect.Parameter.VAR_POSITIONAL)
+
+        p = inspect.Parameter('a', default=42,
+                              kind=inspect.Parameter.POSITIONAL_OR_KEYWORD)
+        with self.assertRaisesRegex(ValueError, 'cannot have default values'):
+            p.replace(kind=inspect.Parameter.VAR_POSITIONAL)
+
+        self.assertTrue(repr(p).startswith('<Parameter'))
+
+    def test_signature_parameter_equality(self):
+        P = inspect.Parameter
+        p = P('foo', default=42, kind=inspect.Parameter.KEYWORD_ONLY)
+
+        self.assertEqual(p, p)
+        self.assertNotEqual(p, 42)
+
+        self.assertEqual(p, P('foo', default=42,
+                              kind=inspect.Parameter.KEYWORD_ONLY))
+
+    def test_signature_parameter_unhashable(self):
+        p = inspect.Parameter('foo', default=42,
+                              kind=inspect.Parameter.KEYWORD_ONLY)
+
+        with self.assertRaisesRegex(TypeError, 'unhashable type'):
+            hash(p)
+
+    def test_signature_parameter_replace(self):
+        p = inspect.Parameter('foo', default=42,
+                              kind=inspect.Parameter.KEYWORD_ONLY)
+
+        self.assertIsNot(p, p.replace())
+        self.assertEqual(p, p.replace())
+
+        p2 = p.replace(annotation=1)
+        self.assertEqual(p2.annotation, 1)
+        p2 = p2.replace(annotation=p2.empty)
+        self.assertEqual(p, p2)
+
+        p2 = p2.replace(name='bar')
+        self.assertEqual(p2.name, 'bar')
+        self.assertNotEqual(p2, p)
+
+        with self.assertRaisesRegex(ValueError, 'not a valid parameter name'):
+            p2 = p2.replace(name=p2.empty)
+
+        p2 = p2.replace(name='foo', default=None)
+        self.assertIs(p2.default, None)
+        self.assertNotEqual(p2, p)
+
+        p2 = p2.replace(name='foo', default=p2.empty)
+        self.assertIs(p2.default, p2.empty)
+
+
+        p2 = p2.replace(default=42, kind=p2.POSITIONAL_OR_KEYWORD)
+        self.assertEqual(p2.kind, p2.POSITIONAL_OR_KEYWORD)
+        self.assertNotEqual(p2, p)
+
+        with self.assertRaisesRegex(ValueError, 'invalid value for'):
+            p2 = p2.replace(kind=p2.empty)
+
+        p2 = p2.replace(kind=p2.KEYWORD_ONLY)
+        self.assertEqual(p2, p)
+
+    def test_signature_parameter_positional_only(self):
+        p = inspect.Parameter(None, kind=inspect.Parameter.POSITIONAL_ONLY)
+        self.assertEqual(str(p), '<>')
+
+        p = p.replace(name='1')
+        self.assertEqual(str(p), '<1>')
+
+    def test_signature_parameter_immutability(self):
+        p = inspect.Parameter(None, kind=inspect.Parameter.POSITIONAL_ONLY)
+
+        with self.assertRaises(AttributeError):
+            p.foo = 'bar'
+
+        with self.assertRaises(AttributeError):
+            p.kind = 123
+
+
+class TestSignatureBind(unittest.TestCase):
+    @staticmethod
+    def call(func, *args, **kwargs):
+        sig = inspect.signature(func)
+        ba = sig.bind(*args, **kwargs)
+        return func(*ba.args, **ba.kwargs)
+
+    def test_signature_bind_empty(self):
+        def test():
+            return 42
+
+        self.assertEqual(self.call(test), 42)
+        with self.assertRaisesRegex(TypeError, 'too many positional arguments'):
+            self.call(test, 1)
+        with self.assertRaisesRegex(TypeError, 'too many positional arguments'):
+            self.call(test, 1, spam=10)
+        with self.assertRaisesRegex(TypeError, 'too many keyword arguments'):
+            self.call(test, spam=1)
+
+    def test_signature_bind_var(self):
+        def test(*args, **kwargs):
+            return args, kwargs
+
+        self.assertEqual(self.call(test), ((), {}))
+        self.assertEqual(self.call(test, 1), ((1,), {}))
+        self.assertEqual(self.call(test, 1, 2), ((1, 2), {}))
+        self.assertEqual(self.call(test, foo='bar'), ((), {'foo': 'bar'}))
+        self.assertEqual(self.call(test, 1, foo='bar'), ((1,), {'foo': 'bar'}))
+        self.assertEqual(self.call(test, args=10), ((), {'args': 10}))
+        self.assertEqual(self.call(test, 1, 2, foo='bar'),
+                         ((1, 2), {'foo': 'bar'}))
+
+    def test_signature_bind_just_args(self):
+        def test(a, b, c):
+            return a, b, c
+
+        self.assertEqual(self.call(test, 1, 2, 3), (1, 2, 3))
+
+        with self.assertRaisesRegex(TypeError, 'too many positional arguments'):
+            self.call(test, 1, 2, 3, 4)
+
+        with self.assertRaisesRegex(TypeError, "'b' parameter lacking default"):
+            self.call(test, 1)
+
+        with self.assertRaisesRegex(TypeError, "'a' parameter lacking default"):
+            self.call(test)
+
+        def test(a, b, c=10):
+            return a, b, c
+        self.assertEqual(self.call(test, 1, 2, 3), (1, 2, 3))
+        self.assertEqual(self.call(test, 1, 2), (1, 2, 10))
+
+        def test(a=1, b=2, c=3):
+            return a, b, c
+        self.assertEqual(self.call(test, a=10, c=13), (10, 2, 13))
+        self.assertEqual(self.call(test, a=10), (10, 2, 3))
+        self.assertEqual(self.call(test, b=10), (1, 10, 3))
+
+    def test_signature_bind_varargs_order(self):
+        def test(*args):
+            return args
+
+        self.assertEqual(self.call(test), ())
+        self.assertEqual(self.call(test, 1, 2, 3), (1, 2, 3))
+
+    def test_signature_bind_args_and_varargs(self):
+        def test(a, b, c=3, *args):
+            return a, b, c, args
+
+        self.assertEqual(self.call(test, 1, 2, 3, 4, 5), (1, 2, 3, (4, 5)))
+        self.assertEqual(self.call(test, 1, 2), (1, 2, 3, ()))
+        self.assertEqual(self.call(test, b=1, a=2), (2, 1, 3, ()))
+        self.assertEqual(self.call(test, 1, b=2), (1, 2, 3, ()))
+
+        with self.assertRaisesRegex(TypeError,
+                                     "multiple values for argument 'c'"):
+            self.call(test, 1, 2, 3, c=4)
+
+    def test_signature_bind_just_kwargs(self):
+        def test(**kwargs):
+            return kwargs
+
+        self.assertEqual(self.call(test), {})
+        self.assertEqual(self.call(test, foo='bar', spam='ham'),
+                         {'foo': 'bar', 'spam': 'ham'})
+
+    def test_signature_bind_args_and_kwargs(self):
+        def test(a, b, c=3, **kwargs):
+            return a, b, c, kwargs
+
+        self.assertEqual(self.call(test, 1, 2), (1, 2, 3, {}))
+        self.assertEqual(self.call(test, 1, 2, foo='bar', spam='ham'),
+                         (1, 2, 3, {'foo': 'bar', 'spam': 'ham'}))
+        self.assertEqual(self.call(test, b=2, a=1, foo='bar', spam='ham'),
+                         (1, 2, 3, {'foo': 'bar', 'spam': 'ham'}))
+        self.assertEqual(self.call(test, a=1, b=2, foo='bar', spam='ham'),
+                         (1, 2, 3, {'foo': 'bar', 'spam': 'ham'}))
+        self.assertEqual(self.call(test, 1, b=2, foo='bar', spam='ham'),
+                         (1, 2, 3, {'foo': 'bar', 'spam': 'ham'}))
+        self.assertEqual(self.call(test, 1, b=2, c=4, foo='bar', spam='ham'),
+                         (1, 2, 4, {'foo': 'bar', 'spam': 'ham'}))
+        self.assertEqual(self.call(test, 1, 2, 4, foo='bar'),
+                         (1, 2, 4, {'foo': 'bar'}))
+        self.assertEqual(self.call(test, c=5, a=4, b=3),
+                         (4, 3, 5, {}))
+
+    if sys.version_info[0] > 2:
+        exec("""
+def test_signature_bind_kwonly(self):
+    def test(*, foo):
+        return foo
+    with self.assertRaisesRegex(TypeError,
+                                 'too many positional arguments'):
+        self.call(test, 1)
+    self.assertEqual(self.call(test, foo=1), 1)
+
+    def test(a, *, foo=1, bar):
+        return foo
+    with self.assertRaisesRegex(TypeError,
+                                 "'bar' parameter lacking default value"):
+        self.call(test, 1)
+
+    def test(foo, *, bar):
+        return foo, bar
+    self.assertEqual(self.call(test, 1, bar=2), (1, 2))
+    self.assertEqual(self.call(test, bar=2, foo=1), (1, 2))
+
+    with self.assertRaisesRegex(TypeError,
+                                 'too many keyword arguments'):
+        self.call(test, bar=2, foo=1, spam=10)
+
+    with self.assertRaisesRegex(TypeError,
+                                 'too many positional arguments'):
+        self.call(test, 1, 2)
+
+    with self.assertRaisesRegex(TypeError,
+                                 'too many positional arguments'):
+        self.call(test, 1, 2, bar=2)
+
+    with self.assertRaisesRegex(TypeError,
+                                 'too many keyword arguments'):
+        self.call(test, 1, bar=2, spam='ham')
+
+    with self.assertRaisesRegex(TypeError,
+                                 "'bar' parameter lacking default value"):
+        self.call(test, 1)
+
+    def test(foo, *, bar, **bin):
+        return foo, bar, bin
+    self.assertEqual(self.call(test, 1, bar=2), (1, 2, {}))
+    self.assertEqual(self.call(test, foo=1, bar=2), (1, 2, {}))
+    self.assertEqual(self.call(test, 1, bar=2, spam='ham'),
+                     (1, 2, {'spam': 'ham'}))
+    self.assertEqual(self.call(test, spam='ham', foo=1, bar=2),
+                     (1, 2, {'spam': 'ham'}))
+    with self.assertRaisesRegex(TypeError,
+                                 "'foo' parameter lacking default value"):
+        self.call(test, spam='ham', bar=2)
+    self.assertEqual(self.call(test, 1, bar=2, bin=1, spam=10),
+                     (1, 2, {'bin': 1, 'spam': 10}))
+""")
+#
+    if sys.version_info[0] > 2:
+        exec("""
+def test_signature_bind_arguments(self):
+    def test(a, *args, b, z=100, **kwargs):
+        pass
+    sig = inspect.signature(test)
+    ba = sig.bind(10, 20, b=30, c=40, args=50, kwargs=60)
+    # we won't have 'z' argument in the bound arguments object, as we didn't
+    # pass it to the 'bind'
+    self.assertEqual(tuple(ba.arguments.items()),
+                     (('a', 10), ('args', (20,)), ('b', 30),
+                      ('kwargs', {'c': 40, 'args': 50, 'kwargs': 60})))
+    self.assertEqual(ba.kwargs,
+                     {'b': 30, 'c': 40, 'args': 50, 'kwargs': 60})
+    self.assertEqual(ba.args, (10, 20))
+""")
+#
+    if sys.version_info[0] > 2:
+        exec("""
+def test_signature_bind_positional_only(self):
+    P = inspect.Parameter
+
+    def test(a_po, b_po, c_po=3, foo=42, *, bar=50, **kwargs):
+        return a_po, b_po, c_po, foo, bar, kwargs
+
+    sig = inspect.signature(test)
+    new_params = collections.OrderedDict(tuple(sig.parameters.items()))
+    for name in ('a_po', 'b_po', 'c_po'):
+        new_params[name] = new_params[name].replace(kind=P.POSITIONAL_ONLY)
+    new_sig = sig.replace(parameters=new_params.values())
+    test.__signature__ = new_sig
+
+    self.assertEqual(self.call(test, 1, 2, 4, 5, bar=6),
+                     (1, 2, 4, 5, 6, {}))
+
+    with self.assertRaisesRegex(TypeError, "parameter is positional only"):
+        self.call(test, 1, 2, c_po=4)
+
+    with self.assertRaisesRegex(TypeError, "parameter is positional only"):
+        self.call(test, a_po=1, b_po=2)
+""")
+
+    def test_bind_self(self):
+        class F:
+            def f(a, self):
+                return a, self
+        an_f = F()
+        partial_f = functools.partial(F.f, an_f)
+        ba = inspect.signature(partial_f).bind(self=10)
+        self.assertEqual((an_f, 10), partial_f(*ba.args, **ba.kwargs))
+
+
+class TestBoundArguments(unittest.TestCase):
+
+    def test_signature_bound_arguments_unhashable(self):
+        def foo(a): pass
+        ba = inspect.signature(foo).bind(1)
+
+        with self.assertRaisesRegex(TypeError, 'unhashable type'):
+            hash(ba)
+
+    def test_signature_bound_arguments_equality(self):
+        def foo(a): pass
+        ba = inspect.signature(foo).bind(1)
+        self.assertEqual(ba, ba)
+
+        ba2 = inspect.signature(foo).bind(1)
+        self.assertEqual(ba, ba2)
+
+        ba3 = inspect.signature(foo).bind(2)
+        self.assertNotEqual(ba, ba3)
+        ba3.arguments['a'] = 1
+        self.assertEqual(ba, ba3)
+
+        def bar(b): pass
+        ba4 = inspect.signature(bar).bind(1)
+        self.assertNotEqual(ba, ba4)
new file mode 100644
--- /dev/null
+++ b/third_party/python/more-itertools/LICENSE
@@ -0,0 +1,19 @@
+Copyright (c) 2012 Erik Rose
+
+Permission is hereby granted, free of charge, to any person obtaining a copy of
+this software and associated documentation files (the "Software"), to deal in
+the Software without restriction, including without limitation the rights to
+use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
+of the Software, and to permit persons to whom the Software is furnished to do
+so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in all
+copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+SOFTWARE.
new file mode 100644
--- /dev/null
+++ b/third_party/python/more-itertools/MANIFEST.in
@@ -0,0 +1,8 @@
+include README.rst
+include LICENSE
+include docs/*.rst
+include docs/Makefile
+include docs/make.bat
+include docs/conf.py
+include fabfile.py
+include tox.ini
new file mode 100644
--- /dev/null
+++ b/third_party/python/more-itertools/PKG-INFO
@@ -0,0 +1,321 @@
+Metadata-Version: 1.1
+Name: more-itertools
+Version: 4.2.0
+Summary: More routines for operating on iterables, beyond itertools
+Home-page: https://github.com/erikrose/more-itertools
+Author: Erik Rose
+Author-email: erikrose@grinchcentral.com
+License: MIT
+Description: ==============
+        More Itertools
+        ==============
+        
+        .. image:: https://coveralls.io/repos/github/erikrose/more-itertools/badge.svg?branch=master
+          :target: https://coveralls.io/github/erikrose/more-itertools?branch=master
+        
+        Python's ``itertools`` library is a gem - you can compose elegant solutions
+        for a variety of problems with the functions it provides. In ``more-itertools``
+        we collect additional building blocks, recipes, and routines for working with
+        Python iterables.
+        
+        Getting started
+        ===============
+        
+        To get started, install the library with `pip <https://pip.pypa.io/en/stable/>`_:
+        
+        .. code-block:: shell
+        
+            pip install more-itertools
+        
+        The recipes from the `itertools docs <https://docs.python.org/3/library/itertools.html#itertools-recipes>`_
+        are included in the top-level package:
+        
+        .. code-block:: python
+        
+            >>> from more_itertools import flatten
+            >>> iterable = [(0, 1), (2, 3)]
+            >>> list(flatten(iterable))
+            [0, 1, 2, 3]
+        
+        Several new recipes are available as well:
+        
+        .. code-block:: python
+        
+            >>> from more_itertools import chunked
+            >>> iterable = [0, 1, 2, 3, 4, 5, 6, 7, 8]
+            >>> list(chunked(iterable, 3))
+            [[0, 1, 2], [3, 4, 5], [6, 7, 8]]
+        
+            >>> from more_itertools import spy
+            >>> iterable = (x * x for x in range(1, 6))
+            >>> head, iterable = spy(iterable, n=3)
+            >>> list(head)
+            [1, 4, 9]
+            >>> list(iterable)
+            [1, 4, 9, 16, 25]
+        
+        
+        
+        For the full listing of functions, see the `API documentation <https://more-itertools.readthedocs.io/en/latest/api.html>`_.
+        
+        Development
+        ===========
+        
+        ``more-itertools`` is maintained by `@erikrose <https://github.com/erikrose>`_
+        and `@bbayles <https://github.com/bbayles>`_, with help from `many others <https://github.com/erikrose/more-itertools/graphs/contributors>`_.
+        If you have a problem or suggestion, please file a bug or pull request in this
+        repository. Thanks for contributing!
+        
+        
+        Version History
+        ===============
+        
+        
+        
+        4.2.0
+        -----
+        
+        * New itertools:
+            * map_reduce (thanks to pylang)
+            * prepend (from the `Python 3.7 docs <https://docs.python.org/3.7/library/itertools.html#itertools-recipes>`_)
+        
+        * Improvements to existing itertools:
+            * bucket now complies with PEP 479 (thanks to irmen)
+        
+        * Other changes:
+           * Python 3.7 is now supported (thanks to irmen)
+           * Python 3.3 is no longer supported
+           * The test suite no longer requires third-party modules to run
+           * The API docs now include links to source code
+        
+        4.1.0
+        -----
+        
+        * New itertools:
+            * split_at (thanks to michael-celani)
+            * circular_shifts (thanks to hiqua)
+            * make_decorator - see the blog post `Yo, I heard you like decorators <https://sites.google.com/site/bbayles/index/decorator_factory>`_
+              for a tour (thanks to pylang)
+            * always_reversible (thanks to michael-celani)
+            * nth_combination (from the `Python 3.7 docs <https://docs.python.org/3.7/library/itertools.html#itertools-recipes>`_)
+        
+        * Improvements to existing itertools:
+            * seekable now has an ``elements`` method to return cached items.
+            * The performance tradeoffs between roundrobin and
+              interleave_longest are now documented (thanks michael-celani,
+              pylang, and MSeifert04)
+        
+        4.0.1
+        -----
+        
+        * No code changes - this release fixes how the docs display on PyPI.
+        
+        4.0.0
+        -----
+        
+        * New itertools:
+            * consecutive_groups (Based on the example in the `Python 2.4 docs <https://docs.python.org/release/2.4.4/lib/itertools-example.html>`_)
+            * seekable (If you're looking for how to "reset" an iterator,
+              you're in luck!)
+            * exactly_n (thanks to michael-celani)
+            * run_length.encode and run_length.decode
+            * difference
+        
+        * Improvements to existing itertools:
+            * The number of items between filler elements in intersperse can
+              now be specified (thanks to pylang)
+            * distinct_permutations and peekable got some minor
+              adjustments (thanks to MSeifert04)
+            * always_iterable now returns an iterator object. It also now
+              allows different types to be considered iterable (thanks to jaraco)
+            * bucket can now limit the keys it stores in memory
+            * one now allows for custom exceptions (thanks to kalekundert)
+        
+        * Other changes:
+            * A few typos were fixed (thanks to EdwardBetts)
+            * All tests can now be run with ``python setup.py test``
+        
+        The major version update is due to the change in the return value of always_iterable.
+        It now always returns iterator objects:
+        
+        .. code-block:: python
+        
+            >>> from more_itertools import always_iterable
+            # Non-iterable objects are wrapped with iter(tuple(obj))
+            >>> always_iterable(12345)
+            <tuple_iterator object at 0x7fb24c9488d0>
+            >>> list(always_iterable(12345))
+            [12345]
+            # Iterable objects are wrapped with iter()
+            >>> always_iterable([1, 2, 3, 4, 5])
+            <list_iterator object at 0x7fb24c948c50>
+        
+        3.2.0
+        -----
+        
+        * New itertools:
+            * lstrip, rstrip, and strip
+              (thanks to MSeifert04 and pylang)
+            * islice_extended
+        * Improvements to existing itertools:
+            * Some bugs with slicing peekable-wrapped iterables were fixed
+        
+        3.1.0
+        -----
+        
+        * New itertools:
+            * numeric_range (Thanks to BebeSparkelSparkel and MSeifert04)
+            * count_cycle (Thanks to BebeSparkelSparkel)
+            * locate (Thanks to pylang and MSeifert04)
+        * Improvements to existing itertools:
+            * A few itertools are now slightly faster due to some function
+              optimizations. (Thanks to MSeifert04)
+        * The docs have been substantially revised with installation notes,
+          categories for library functions, links, and more. (Thanks to pylang)
+        
+        
+        3.0.0
+        -----
+        
+        * Removed itertools:
+            * ``context`` has been removed due to a design flaw - see below for
+              replacement options. (thanks to NeilGirdhar)
+        * Improvements to existing itertools:
+            * ``side_effect`` now supports ``before`` and ``after`` keyword
+              arguments. (Thanks to yardsale8)
+        * PyPy and PyPy3 are now supported.
+        
+        The major version change is due to the removal of the ``context`` function.
+        Replace it with standard ``with`` statement context management:
+        
+        .. code-block:: python
+        
+            # Don't use context() anymore
+            file_obj = StringIO()
+            consume(print(x, file=f) for f in context(file_obj) for x in u'123')
+        
+            # Use a with statement instead
+            file_obj = StringIO()
+            with file_obj as f:
+                consume(print(x, file=f) for x in u'123')
+        
+        2.6.0
+        -----
+        
+        * New itertools:
+            * ``adjacent`` and ``groupby_transform`` (Thanks to diazona)
+            * ``always_iterable`` (Thanks to jaraco)
+            * (Removed in 3.0.0) ``context`` (Thanks to yardsale8)
+            * ``divide`` (Thanks to mozbhearsum)
+        * Improvements to existing itertools:
+            * ``ilen`` is now slightly faster. (Thanks to wbolster)
+            * ``peekable`` can now prepend items to an iterable. (Thanks to diazona)
+        
+        2.5.0
+        -----
+        
+        * New itertools:
+            * ``distribute`` (Thanks to mozbhearsum and coady)
+            * ``sort_together`` (Thanks to clintval)
+            * ``stagger`` and ``zip_offset`` (Thanks to joshbode)
+            * ``padded``
+        * Improvements to existing itertools:
+            * ``peekable`` now handles negative indexes and slices with negative
+              components properly.
+            * ``intersperse`` is now slightly faster. (Thanks to pylang)
+            * ``windowed`` now accepts a ``step`` keyword argument.
+              (Thanks to pylang)
+        * Python 3.6 is now supported.
+        
+        2.4.1
+        -----
+        
+        * Move docs 100% to readthedocs.io.
+        
+        2.4
+        -----
+        
+        * New itertools:
+            * ``accumulate``, ``all_equal``, ``first_true``, ``partition``, and
+              ``tail`` from the itertools documentation.
+            * ``bucket`` (Thanks to Rosuav and cvrebert)
+            * ``collapse`` (Thanks to abarnet)
+            * ``interleave`` and ``interleave_longest`` (Thanks to abarnet)
+            * ``side_effect`` (Thanks to nvie)
+            * ``sliced`` (Thanks to j4mie and coady)
+            * ``split_before`` and ``split_after`` (Thanks to astronouth7303)
+            * ``spy`` (Thanks to themiurgo and mathieulongtin)
+        * Improvements to existing itertools:
+            * ``chunked`` is now simpler and more friendly to garbage collection.
+              (Contributed by coady, with thanks to piskvorky)
+            * ``collate`` now delegates to ``heapq.merge`` when possible.
+              (Thanks to kmike and julianpistorius)
+            * ``peekable``-wrapped iterables are now indexable and sliceable.
+              Iterating through ``peekable``-wrapped iterables is also faster.
+            * ``one`` and ``unique_to_each`` have been simplified.
+              (Thanks to coady)
+        
+        
+        2.3
+        -----
+        
+        * Added ``one`` from ``jaraco.util.itertools``. (Thanks, jaraco!)
+        * Added ``distinct_permutations`` and ``unique_to_each``. (Contributed by
+          bbayles)
+        * Added ``windowed``. (Contributed by bbayles, with thanks to buchanae,
+          jaraco, and abarnert)
+        * Simplified the implementation of ``chunked``. (Thanks, nvie!)
+        * Python 3.5 is now supported. Python 2.6 is no longer supported.
+        * Python 3 is now supported directly; there is no 2to3 step.
+        
+        2.2
+        -----
+        
+        * Added ``iterate`` and ``with_iter``. (Thanks, abarnert!)
+        
+        2.1
+        -----
+        
+        * Added (tested!) implementations of the recipes from the itertools
+          documentation. (Thanks, Chris Lonnen!)
+        * Added ``ilen``. (Thanks for the inspiration, Matt Basta!)
+        
+        2.0
+        -----
+        
+        * ``chunked`` now returns lists rather than tuples. After all, they're
+          homogeneous. This slightly backward-incompatible change is the reason for
+          the major version bump.
+        * Added ``@consumer``.
+        * Improved test machinery.
+        
+        1.1
+        -----
+        
+        * Added ``first`` function.
+        * Added Python 3 support.
+        * Added a default arg to ``peekable.peek()``.
+        * Noted how to easily test whether a peekable iterator is exhausted.
+        * Rewrote documentation.
+        
+        1.0
+        -----
+        
+        * Initial release, with ``collate``, ``peekable``, and ``chunked``. Could
+          really use better docs.
+Keywords: itertools,iterator,iteration,filter,peek,peekable,collate,chunk,chunked
+Platform: UNKNOWN
+Classifier: Development Status :: 5 - Production/Stable
+Classifier: Intended Audience :: Developers
+Classifier: Natural Language :: English
+Classifier: License :: OSI Approved :: MIT License
+Classifier: Programming Language :: Python :: 2
+Classifier: Programming Language :: Python :: 2.7
+Classifier: Programming Language :: Python :: 3
+Classifier: Programming Language :: Python :: 3.2
+Classifier: Programming Language :: Python :: 3.3
+Classifier: Programming Language :: Python :: 3.4
+Classifier: Programming Language :: Python :: 3.5
+Classifier: Programming Language :: Python :: 3.6
+Classifier: Programming Language :: Python :: 3.7
+Classifier: Topic :: Software Development :: Libraries
new file mode 100644
--- /dev/null
+++ b/third_party/python/more-itertools/README.rst
@@ -0,0 +1,59 @@
+==============
+More Itertools
+==============
+
+.. image:: https://coveralls.io/repos/github/erikrose/more-itertools/badge.svg?branch=master
+  :target: https://coveralls.io/github/erikrose/more-itertools?branch=master
+
+Python's ``itertools`` library is a gem - you can compose elegant solutions
+for a variety of problems with the functions it provides. In ``more-itertools``
+we collect additional building blocks, recipes, and routines for working with
+Python iterables.
+
+Getting started
+===============
+
+To get started, install the library with `pip <https://pip.pypa.io/en/stable/>`_:
+
+.. code-block:: shell
+
+    pip install more-itertools
+
+The recipes from the `itertools docs <https://docs.python.org/3/library/itertools.html#itertools-recipes>`_
+are included in the top-level package:
+
+.. code-block:: python
+
+    >>> from more_itertools import flatten
+    >>> iterable = [(0, 1), (2, 3)]
+    >>> list(flatten(iterable))
+    [0, 1, 2, 3]
+
+Several new recipes are available as well:
+
+.. code-block:: python
+
+    >>> from more_itertools import chunked
+    >>> iterable = [0, 1, 2, 3, 4, 5, 6, 7, 8]
+    >>> list(chunked(iterable, 3))
+    [[0, 1, 2], [3, 4, 5], [6, 7, 8]]
+
+    >>> from more_itertools import spy
+    >>> iterable = (x * x for x in range(1, 6))
+    >>> head, iterable = spy(iterable, n=3)
+    >>> list(head)
+    [1, 4, 9]
+    >>> list(iterable)
+    [1, 4, 9, 16, 25]
+
+
+
+For the full listing of functions, see the `API documentation <https://more-itertools.readthedocs.io/en/latest/api.html>`_.
+
+Development
+===========
+
+``more-itertools`` is maintained by `@erikrose <https://github.com/erikrose>`_
+and `@bbayles <https://github.com/bbayles>`_, with help from `many others <https://github.com/erikrose/more-itertools/graphs/contributors>`_.
+If you have a problem or suggestion, please file a bug or pull request in this
+repository. Thanks for contributing!
new file mode 100644
--- /dev/null
+++ b/third_party/python/more-itertools/docs/Makefile
@@ -0,0 +1,153 @@
+# Makefile for Sphinx documentation
+#
+
+# You can set these variables from the command line.
+SPHINXOPTS    =
+SPHINXBUILD   = sphinx-build
+PAPER         =
+BUILDDIR      = _build
+
+# Internal variables.
+PAPEROPT_a4     = -D latex_paper_size=a4
+PAPEROPT_letter = -D latex_paper_size=letter
+ALLSPHINXOPTS   = -d $(BUILDDIR)/doctrees $(PAPEROPT_$(PAPER)) $(SPHINXOPTS) .
+# the i18n builder cannot share the environment and doctrees with the others
+I18NSPHINXOPTS  = $(PAPEROPT_$(PAPER)) $(SPHINXOPTS) .
+
+.PHONY: help clean html dirhtml singlehtml pickle json htmlhelp qthelp devhelp epub latex latexpdf text man changes linkcheck doctest gettext
+
+help:
+	@echo "Please use \`make <target>' where <target> is one of"
+	@echo "  html       to make standalone HTML files"
+	@echo "  dirhtml    to make HTML files named index.html in directories"
+	@echo "  singlehtml to make a single large HTML file"
+	@echo "  pickle     to make pickle files"
+	@echo "  json       to make JSON files"
+	@echo "  htmlhelp   to make HTML files and a HTML help project"
+	@echo "  qthelp     to make HTML files and a qthelp project"
+	@echo "  devhelp    to make HTML files and a Devhelp project"
+	@echo "  epub       to make an epub"
+	@echo "  latex      to make LaTeX files, you can set PAPER=a4 or PAPER=letter"
+	@echo "  latexpdf   to make LaTeX files and run them through pdflatex"
+	@echo "  text       to make text files"
+	@echo "  man        to make manual pages"
+	@echo "  texinfo    to make Texinfo files"
+	@echo "  info       to make Texinfo files and run them through makeinfo"
+	@echo "  gettext    to make PO message catalogs"
+	@echo "  changes    to make an overview of all changed/added/deprecated items"
+	@echo "  linkcheck  to check all external links for integrity"
+	@echo "  doctest    to run all doctests embedded in the documentation (if enabled)"
+
+clean:
+	-rm -rf $(BUILDDIR)/*
+
+html:
+	$(SPHINXBUILD) -b html $(ALLSPHINXOPTS) $(BUILDDIR)/html
+	@echo
+	@echo "Build finished. The HTML pages are in $(BUILDDIR)/html."
+
+dirhtml:
+	$(SPHINXBUILD) -b dirhtml $(ALLSPHINXOPTS) $(BUILDDIR)/dirhtml
+	@echo
+	@echo "Build finished. The HTML pages are in $(BUILDDIR)/dirhtml."
+
+singlehtml:
+	$(SPHINXBUILD) -b singlehtml $(ALLSPHINXOPTS) $(BUILDDIR)/singlehtml
+	@echo
+	@echo "Build finished. The HTML page is in $(BUILDDIR)/singlehtml."
+
+pickle:
+	$(SPHINXBUILD) -b pickle $(ALLSPHINXOPTS) $(BUILDDIR)/pickle
+	@echo
+	@echo "Build finished; now you can process the pickle files."
+
+json:
+	$(SPHINXBUILD) -b json $(ALLSPHINXOPTS) $(BUILDDIR)/json
+	@echo
+	@echo "Build finished; now you can process the JSON files."
+
+htmlhelp:
+	$(SPHINXBUILD) -b htmlhelp $(ALLSPHINXOPTS) $(BUILDDIR)/htmlhelp
+	@echo
+	@echo "Build finished; now you can run HTML Help Workshop with the" \
+	      ".hhp project file in $(BUILDDIR)/htmlhelp."
+
+qthelp:
+	$(SPHINXBUILD) -b qthelp $(ALLSPHINXOPTS) $(BUILDDIR)/qthelp
+	@echo
+	@echo "Build finished; now you can run "qcollectiongenerator" with the" \
+	      ".qhcp project file in $(BUILDDIR)/qthelp, like this:"
+	@echo "# qcollectiongenerator $(BUILDDIR)/qthelp/more-itertools.qhcp"
+	@echo "To view the help file:"
+	@echo "# assistant -collectionFile $(BUILDDIR)/qthelp/more-itertools.qhc"
+
+devhelp:
+	$(SPHINXBUILD) -b devhelp $(ALLSPHINXOPTS) $(BUILDDIR)/devhelp
+	@echo
+	@echo "Build finished."
+	@echo "To view the help file:"
+	@echo "# mkdir -p $$HOME/.local/share/devhelp/more-itertools"
+	@echo "# ln -s $(BUILDDIR)/devhelp $$HOME/.local/share/devhelp/more-itertools"
+	@echo "# devhelp"
+
+epub:
+	$(SPHINXBUILD) -b epub $(ALLSPHINXOPTS) $(BUILDDIR)/epub
+	@echo
+	@echo "Build finished. The epub file is in $(BUILDDIR)/epub."
+
+latex:
+	$(SPHINXBUILD) -b latex $(ALLSPHINXOPTS) $(BUILDDIR)/latex
+	@echo
+	@echo "Build finished; the LaTeX files are in $(BUILDDIR)/latex."
+	@echo "Run \`make' in that directory to run these through (pdf)latex" \
+	      "(use \`make latexpdf' here to do that automatically)."
+
+latexpdf:
+	$(SPHINXBUILD) -b latex $(ALLSPHINXOPTS) $(BUILDDIR)/latex
+	@echo "Running LaTeX files through pdflatex..."
+	$(MAKE) -C $(BUILDDIR)/latex all-pdf
+	@echo "pdflatex finished; the PDF files are in $(BUILDDIR)/latex."
+
+text:
+	$(SPHINXBUILD) -b text $(ALLSPHINXOPTS) $(BUILDDIR)/text
+	@echo
+	@echo "Build finished. The text files are in $(BUILDDIR)/text."
+
+man:
+	$(SPHINXBUILD) -b man $(ALLSPHINXOPTS) $(BUILDDIR)/man
+	@echo
+	@echo "Build finished. The manual pages are in $(BUILDDIR)/man."
+
+texinfo:
+	$(SPHINXBUILD) -b texinfo $(ALLSPHINXOPTS) $(BUILDDIR)/texinfo
+	@echo
+	@echo "Build finished. The Texinfo files are in $(BUILDDIR)/texinfo."
+	@echo "Run \`make' in that directory to run these through makeinfo" \
+	      "(use \`make info' here to do that automatically)."
+
+info:
+	$(SPHINXBUILD) -b texinfo $(ALLSPHINXOPTS) $(BUILDDIR)/texinfo
+	@echo "Running Texinfo files through makeinfo..."
+	make -C $(BUILDDIR)/texinfo info
+	@echo "makeinfo finished; the Info files are in $(BUILDDIR)/texinfo."
+
+gettext:
+	$(SPHINXBUILD) -b gettext $(I18NSPHINXOPTS) $(BUILDDIR)/locale
+	@echo
+	@echo "Build finished. The message catalogs are in $(BUILDDIR)/locale."
+
+changes:
+	$(SPHINXBUILD) -b changes $(ALLSPHINXOPTS) $(BUILDDIR)/changes
+	@echo
+	@echo "The overview file is in $(BUILDDIR)/changes."
+
+linkcheck:
+	$(SPHINXBUILD) -b linkcheck $(ALLSPHINXOPTS) $(BUILDDIR)/linkcheck
+	@echo
+	@echo "Link check complete; look for any errors in the above output " \
+	      "or in $(BUILDDIR)/linkcheck/output.txt."
+
+doctest:
+	$(SPHINXBUILD) -b doctest $(ALLSPHINXOPTS) $(BUILDDIR)/doctest
+	@echo "Testing of doctests in the sources finished, look at the " \
+	      "results in $(BUILDDIR)/doctest/output.txt."
new file mode 100644
--- /dev/null
+++ b/third_party/python/more-itertools/docs/api.rst
@@ -0,0 +1,234 @@
+=============
+API Reference
+=============
+
+.. automodule:: more_itertools
+
+Grouping
+========
+
+These tools yield groups of items from a source iterable.
+
+----
+
+**New itertools**
+
+.. autofunction:: chunked
+.. autofunction:: sliced
+.. autofunction:: distribute
+.. autofunction:: divide
+.. autofunction:: split_at
+.. autofunction:: split_before
+.. autofunction:: split_after
+.. autofunction:: bucket
+
+----
+
+**Itertools recipes**
+
+.. autofunction:: grouper
+.. autofunction:: partition
+
+
+Lookahead and lookback
+======================
+
+These tools peek at an iterable's values without advancing it.
+
+----
+
+**New itertools**
+
+
+.. autofunction:: spy
+.. autoclass:: peekable
+.. autoclass:: seekable
+
+
+Windowing
+=========
+
+These tools yield windows of items from an iterable.
+
+----
+
+**New itertools**
+
+.. autofunction:: windowed
+.. autofunction:: stagger
+
+----
+
+**Itertools recipes**
+
+.. autofunction:: pairwise
+
+
+Augmenting
+==========
+
+These tools yield items from an iterable, plus additional data.
+
+----
+
+**New itertools**
+
+.. autofunction:: count_cycle
+.. autofunction:: intersperse
+.. autofunction:: padded
+.. autofunction:: adjacent
+.. autofunction:: groupby_transform
+
+----
+
+**Itertools recipes**
+
+.. autofunction:: padnone
+.. autofunction:: ncycles
+
+
+Combining
+=========
+
+These tools combine multiple iterables.
+
+----
+
+**New itertools**
+
+.. autofunction:: collapse
+.. autofunction:: sort_together
+.. autofunction:: interleave
+.. autofunction:: interleave_longest
+.. autofunction:: collate(*iterables, key=lambda a: a, reverse=False)
+.. autofunction:: zip_offset(*iterables, offsets, longest=False, fillvalue=None)
+
+----
+
+**Itertools recipes**
+
+.. autofunction:: dotproduct
+.. autofunction:: flatten
+.. autofunction:: roundrobin
+.. autofunction:: prepend
+
+
+Summarizing
+===========
+
+These tools return summarized or aggregated data from an iterable.
+
+----
+
+**New itertools**
+
+.. autofunction:: ilen
+.. autofunction:: first(iterable[, default])
+.. autofunction:: one
+.. autofunction:: unique_to_each
+.. autofunction:: locate(iterable, pred=bool)
+.. autofunction:: consecutive_groups(iterable, ordering=lambda x: x)
+.. autofunction:: exactly_n(iterable, n, predicate=bool)
+.. autoclass:: run_length
+.. autofunction:: map_reduce
+
+----
+
+**Itertools recipes**
+
+.. autofunction:: all_equal
+.. autofunction:: first_true
+.. autofunction:: nth
+.. autofunction:: quantify(iterable, pred=bool)
+
+
+Selecting
+=========
+
+These tools yield certain items from an iterable.
+
+----
+
+**New itertools**
+
+.. autofunction:: islice_extended(start, stop, step)
+.. autofunction:: strip
+.. autofunction:: lstrip
+.. autofunction:: rstrip
+
+----
+
+**Itertools recipes**
+
+.. autofunction:: take
+.. autofunction:: tail
+.. autofunction:: unique_everseen
+.. autofunction:: unique_justseen
+
+
+Combinatorics
+=============
+
+These tools yield combinatorial arrangements of items from iterables.
+
+----
+
+**New itertools**
+
+.. autofunction:: distinct_permutations
+.. autofunction:: circular_shifts
+
+----
+
+**Itertools recipes**
+
+.. autofunction:: powerset
+.. autofunction:: random_product
+.. autofunction:: random_permutation
+.. autofunction:: random_combination
+.. autofunction:: random_combination_with_replacement
+.. autofunction:: nth_combination
+
+
+Wrapping
+========
+
+These tools provide wrappers to smooth working with objects that produce or
+consume iterables.
+
+----
+
+**New itertools**
+
+.. autofunction:: always_iterable
+.. autofunction:: consumer
+.. autofunction:: with_iter
+
+----
+
+**Itertools recipes**
+
+.. autofunction:: iter_except
+
+
+Others
+======
+
+**New itertools**
+
+.. autofunction:: numeric_range(start, stop, step)
+.. autofunction:: always_reversible
+.. autofunction:: side_effect
+.. autofunction:: iterate
+.. autofunction:: difference(iterable, func=operator.sub)
+.. autofunction:: make_decorator
+.. autoclass:: SequenceView
+
+----
+
+**Itertools recipes**
+
+.. autofunction:: consume
+.. autofunction:: accumulate(iterable, func=operator.add)
+.. autofunction:: tabulate
+.. autofunction:: repeatfunc
new file mode 100644
--- /dev/null
+++ b/third_party/python/more-itertools/docs/conf.py
@@ -0,0 +1,244 @@
+# -*- coding: utf-8 -*-
+#
+# more-itertools documentation build configuration file, created by
+# sphinx-quickstart on Mon Jun 25 20:42:39 2012.
+#
+# This file is execfile()d with the current directory set to its containing dir.
+#
+# Note that not all possible configuration values are present in this
+# autogenerated file.
+#
+# All configuration values have a default; values that are commented out
+# serve to show the default.
+
+import sys, os
+
+import sphinx_rtd_theme
+
+# If extensions (or modules to document with autodoc) are in another directory,
+# add these directories to sys.path here. If the directory is relative to the
+# documentation root, use os.path.abspath to make it absolute, like shown here.
+sys.path.insert(0, os.path.abspath('..'))
+
+# -- General configuration -----------------------------------------------------
+
+# If your documentation needs a minimal Sphinx version, state it here.
+#needs_sphinx = '1.0'
+
+# Add any Sphinx extension module names here, as strings. They can be extensions
+# coming with Sphinx (named 'sphinx.ext.*') or your custom ones.
+extensions = ['sphinx.ext.autodoc', 'sphinx.ext.viewcode']
+
+# Add any paths that contain templates here, relative to this directory.
+templates_path = ['_templates']
+
+# The suffix of source filenames.
+source_suffix = '.rst'
+
+# The encoding of source files.
+#source_encoding = 'utf-8-sig'
+
+# The master toctree document.
+master_doc = 'index'
+
+# General information about the project.
+project = u'more-itertools'
+copyright = u'2012, Erik Rose'
+
+# The version info for the project you're documenting, acts as replacement for
+# |version| and |release|, also used in various other places throughout the
+# built documents.
+#
+# The short X.Y version.
+version = '4.2.0'
+# The full version, including alpha/beta/rc tags.
+release = version
+
+# The language for content autogenerated by Sphinx. Refer to documentation
+# for a list of supported languages.
+#language = None
+
+# There are two options for replacing |today|: either, you set today to some
+# non-false value, then it is used:
+#today = ''
+# Else, today_fmt is used as the format for a strftime call.
+#today_fmt = '%B %d, %Y'
+
+# List of patterns, relative to source directory, that match files and
+# directories to ignore when looking for source files.
+exclude_patterns = ['_build']
+
+# The reST default role (used for this markup: `text`) to use for all documents.
+#default_role = None
+
+# If true, '()' will be appended to :func: etc. cross-reference text.
+#add_function_parentheses = True
+
+# If true, the current module name will be prepended to all description
+# unit titles (such as .. function::).
+#add_module_names = True
+
+# If true, sectionauthor and moduleauthor directives will be shown in the
+# output. They are ignored by default.
+#show_authors = False
+
+# The name of the Pygments (syntax highlighting) style to use.
+pygments_style = 'sphinx'
+
+# A list of ignored prefixes for module index sorting.
+#modindex_common_prefix = []
+
+
+# -- Options for HTML output ---------------------------------------------------
+
+# The theme to use for HTML and HTML Help pages.  See the documentation for
+# a list of builtin themes.
+html_theme = 'sphinx_rtd_theme'
+
+# Theme options are theme-specific and customize the look and feel of a theme
+# further.  For a list of options available for each theme, see the
+# documentation.
+#html_theme_options = {}
+
+# Add any paths that contain custom themes here, relative to this directory.
+html_theme_path = [sphinx_rtd_theme.get_html_theme_path()]
+
+# The name for this set of Sphinx documents.  If None, it defaults to
+# "<project> v<release> documentation".
+#html_title = None
+
+# A shorter title for the navigation bar.  Default is the same as html_title.
+#html_short_title = None
+
+# The name of an image file (relative to this directory) to place at the top
+# of the sidebar.
+#html_logo = None
+
+# The name of an image file (within the static path) to use as favicon of the
+# docs.  This file should be a Windows icon file (.ico) being 16x16 or 32x32
+# pixels large.
+#html_favicon = None
+
+# Add any paths that contain custom static files (such as style sheets) here,
+# relative to this directory. They are copied after the builtin static files,
+# so a file named "default.css" will overwrite the builtin "default.css".
+html_static_path = ['_static']
+
+# If not '', a 'Last updated on:' timestamp is inserted at every page bottom,
+# using the given strftime format.
+#html_last_updated_fmt = '%b %d, %Y'
+
+# If true, SmartyPants will be used to convert quotes and dashes to
+# typographically correct entities.
+#html_use_smartypants = True
+
+# Custom sidebar templates, maps document names to template names.
+#html_sidebars = {}
+
+# Additional templates that should be rendered to pages, maps page names to
+# template names.
+#html_additional_pages = {}
+
+# If false, no module index is generated.
+#html_domain_indices = True
+
+# If false, no index is generated.
+#html_use_index = True
+
+# If true, the index is split into individual pages for each letter.
+#html_split_index = False
+
+# If true, links to the reST sources are added to the pages.
+#html_show_sourcelink = True
+
+# If true, "Created using Sphinx" is shown in the HTML footer. Default is True.
+#html_show_sphinx = True
+
+# If true, "(C) Copyright ..." is shown in the HTML footer. Default is True.
+#html_show_copyright = True
+
+# If true, an OpenSearch description file will be output, and all pages will
+# contain a <link> tag referring to it.  The value of this option must be the
+# base URL from which the finished HTML is served.
+#html_use_opensearch = ''
+
+# This is the file name suffix for HTML files (e.g. ".xhtml").
+#html_file_suffix = None
+
+# Output file base name for HTML help builder.
+htmlhelp_basename = 'more-itertoolsdoc'
+
+
+# -- Options for LaTeX output --------------------------------------------------
+
+latex_elements = {
+# The paper size ('letterpaper' or 'a4paper').
+#'papersize': 'letterpaper',
+
+# The font size ('10pt', '11pt' or '12pt').
+#'pointsize': '10pt',
+
+# Additional stuff for the LaTeX preamble.
+#'preamble': '',
+}
+
+# Grouping the document tree into LaTeX files. List of tuples
+# (source start file, target name, title, author, documentclass [howto/manual]).
+latex_documents = [
+  ('index', 'more-itertools.tex', u'more-itertools Documentation',
+   u'Erik Rose', 'manual'),
+]
+
+# The name of an image file (relative to this directory) to place at the top of
+# the title page.
+#latex_logo = None
+
+# For "manual" documents, if this is true, then toplevel headings are parts,
+# not chapters.
+#latex_use_parts = False
+
+# If true, show page references after internal links.
+#latex_show_pagerefs = False
+
+# If true, show URL addresses after external links.
+#latex_show_urls = False
+
+# Documents to append as an appendix to all manuals.
+#latex_appendices = []
+
+# If false, no module index is generated.
+#latex_domain_indices = True
+
+
+# -- Options for manual page output --------------------------------------------
+
+# One entry per manual page. List of tuples
+# (source start file, name, description, authors, manual section).
+man_pages = [
+    ('index', 'more-itertools', u'more-itertools Documentation',
+     [u'Erik Rose'], 1)
+]
+
+# If true, show URL addresses after external links.
+#man_show_urls = False
+
+
+# -- Options for Texinfo output ------------------------------------------------
+
+# Grouping the document tree into Texinfo files. List of tuples
+# (source start file, target name, title, author,
+#  dir menu entry, description, category)
+texinfo_documents = [
+  ('index', 'more-itertools', u'more-itertools Documentation',
+   u'Erik Rose', 'more-itertools', 'One line description of project.',
+   'Miscellaneous'),
+]
+
+# Documents to append as an appendix to all manuals.
+#texinfo_appendices = []
+
+# If false, no module index is generated.
+#texinfo_domain_indices = True
+
+# How to display URL addresses: 'footnote', 'no', or 'inline'.
+#texinfo_show_urls = 'footnote'
new file mode 100644
--- /dev/null
+++ b/third_party/python/more-itertools/docs/index.rst
@@ -0,0 +1,16 @@
+.. include:: ../README.rst
+
+Contents
+========
+
+.. toctree::
+    :maxdepth: 2
+
+    api
+
+.. toctree::
+    :maxdepth: 1
+
+    license
+    testing
+    versions
new file mode 100644
--- /dev/null
+++ b/third_party/python/more-itertools/docs/license.rst
@@ -0,0 +1,16 @@
+=======
+License
+=======
+
+more-itertools is under the MIT License. See the LICENSE file.
+
+Conditions for Contributors
+===========================
+
+By contributing to this software project, you are agreeing to the following
+terms and conditions for your contributions: First, you agree your
+contributions are submitted under the MIT license. Second, you represent you
+are authorized to make the contributions and grant the license. If your
+employer has rights to intellectual property that includes your contributions,
+you represent that you have received permission to make contributions and grant
+the required license on behalf of that employer.
new file mode 100644
--- /dev/null
+++ b/third_party/python/more-itertools/docs/make.bat
@@ -0,0 +1,190 @@
+@ECHO OFF
+
+REM Command file for Sphinx documentation
+
+if "%SPHINXBUILD%" == "" (
+	set SPHINXBUILD=sphinx-build
+)
+set BUILDDIR=_build
+set ALLSPHINXOPTS=-d %BUILDDIR%/doctrees %SPHINXOPTS% .
+set I18NSPHINXOPTS=%SPHINXOPTS% .
+if NOT "%PAPER%" == "" (
+	set ALLSPHINXOPTS=-D latex_paper_size=%PAPER% %ALLSPHINXOPTS%
+	set I18NSPHINXOPTS=-D latex_paper_size=%PAPER% %I18NSPHINXOPTS%
+)
+
+if "%1" == "" goto help
+
+if "%1" == "help" (
+	:help
+	echo.Please use `make ^<target^>` where ^<target^> is one of
+	echo.  html       to make standalone HTML files
+	echo.  dirhtml    to make HTML files named index.html in directories
+	echo.  singlehtml to make a single large HTML file
+	echo.  pickle     to make pickle files
+	echo.  json       to make JSON files
+	echo.  htmlhelp   to make HTML files and a HTML help project
+	echo.  qthelp     to make HTML files and a qthelp project
+	echo.  devhelp    to make HTML files and a Devhelp project
+	echo.  epub       to make an epub
+	echo.  latex      to make LaTeX files, you can set PAPER=a4 or PAPER=letter
+	echo.  text       to make text files
+	echo.  man        to make manual pages
+	echo.  texinfo    to make Texinfo files
+	echo.  gettext    to make PO message catalogs
+	echo.  changes    to make an overview over all changed/added/deprecated items
+	echo.  linkcheck  to check all external links for integrity
+	echo.  doctest    to run all doctests embedded in the documentation if enabled
+	goto end
+)
+
+if "%1" == "clean" (
+	for /d %%i in (%BUILDDIR%\*) do rmdir /q /s %%i
+	del /q /s %BUILDDIR%\*
+	goto end
+)
+
+if "%1" == "html" (
+	%SPHINXBUILD% -b html %ALLSPHINXOPTS% %BUILDDIR%/html
+	if errorlevel 1 exit /b 1
+	echo.
+	echo.Build finished. The HTML pages are in %BUILDDIR%/html.
+	goto end
+)
+
+if "%1" == "dirhtml" (
+	%SPHINXBUILD% -b dirhtml %ALLSPHINXOPTS% %BUILDDIR%/dirhtml
+	if errorlevel 1 exit /b 1
+	echo.
+	echo.Build finished. The HTML pages are in %BUILDDIR%/dirhtml.
+	goto end
+)
+
+if "%1" == "singlehtml" (
+	%SPHINXBUILD% -b singlehtml %ALLSPHINXOPTS% %BUILDDIR%/singlehtml
+	if errorlevel 1 exit /b 1
+	echo.
+	echo.Build finished. The HTML pages are in %BUILDDIR%/singlehtml.
+	goto end
+)
+
+if "%1" == "pickle" (
+	%SPHINXBUILD% -b pickle %ALLSPHINXOPTS% %BUILDDIR%/pickle
+	if errorlevel 1 exit /b 1
+	echo.
+	echo.Build finished; now you can process the pickle files.
+	goto end
+)
+
+if "%1" == "json" (
+	%SPHINXBUILD% -b json %ALLSPHINXOPTS% %BUILDDIR%/json
+	if errorlevel 1 exit /b 1
+	echo.
+	echo.Build finished; now you can process the JSON files.
+	goto end
+)
+
+if "%1" == "htmlhelp" (
+	%SPHINXBUILD% -b htmlhelp %ALLSPHINXOPTS% %BUILDDIR%/htmlhelp
+	if errorlevel 1 exit /b 1
+	echo.
+	echo.Build finished; now you can run HTML Help Workshop with the ^
+.hhp project file in %BUILDDIR%/htmlhelp.
+	goto end
+)
+
+if "%1" == "qthelp" (
+	%SPHINXBUILD% -b qthelp %ALLSPHINXOPTS% %BUILDDIR%/qthelp
+	if errorlevel 1 exit /b 1
+	echo.
+	echo.Build finished; now you can run "qcollectiongenerator" with the ^
+.qhcp project file in %BUILDDIR%/qthelp, like this:
+	echo.^> qcollectiongenerator %BUILDDIR%\qthelp\more-itertools.qhcp
+	echo.To view the help file:
+	echo.^> assistant -collectionFile %BUILDDIR%\qthelp\more-itertools.ghc
+	goto end
+)
+
+if "%1" == "devhelp" (
+	%SPHINXBUILD% -b devhelp %ALLSPHINXOPTS% %BUILDDIR%/devhelp
+	if errorlevel 1 exit /b 1
+	echo.
+	echo.Build finished.
+	goto end
+)
+
+if "%1" == "epub" (
+	%SPHINXBUILD% -b epub %ALLSPHINXOPTS% %BUILDDIR%/epub
+	if errorlevel 1 exit /b 1
+	echo.
+	echo.Build finished. The epub file is in %BUILDDIR%/epub.
+	goto end
+)
+
+if "%1" == "latex" (
+	%SPHINXBUILD% -b latex %ALLSPHINXOPTS% %BUILDDIR%/latex
+	if errorlevel 1 exit /b 1
+	echo.
+	echo.Build finished; the LaTeX files are in %BUILDDIR%/latex.
+	goto end
+)
+
+if "%1" == "text" (
+	%SPHINXBUILD% -b text %ALLSPHINXOPTS% %BUILDDIR%/text
+	if errorlevel 1 exit /b 1
+	echo.
+	echo.Build finished. The text files are in %BUILDDIR%/text.
+	goto end
+)
+
+if "%1" == "man" (
+	%SPHINXBUILD% -b man %ALLSPHINXOPTS% %BUILDDIR%/man
+	if errorlevel 1 exit /b 1
+	echo.
+	echo.Build finished. The manual pages are in %BUILDDIR%/man.
+	goto end
+)
+
+if "%1" == "texinfo" (
+	%SPHINXBUILD% -b texinfo %ALLSPHINXOPTS% %BUILDDIR%/texinfo
+	if errorlevel 1 exit /b 1
+	echo.
+	echo.Build finished. The Texinfo files are in %BUILDDIR%/texinfo.
+	goto end
+)
+
+if "%1" == "gettext" (
+	%SPHINXBUILD% -b gettext %I18NSPHINXOPTS% %BUILDDIR%/locale
+	if errorlevel 1 exit /b 1
+	echo.
+	echo.Build finished. The message catalogs are in %BUILDDIR%/locale.
+	goto end
+)
+
+if "%1" == "changes" (
+	%SPHINXBUILD% -b changes %ALLSPHINXOPTS% %BUILDDIR%/changes
+	if errorlevel 1 exit /b 1
+	echo.
+	echo.The overview file is in %BUILDDIR%/changes.
+	goto end
+)
+
+if "%1" == "linkcheck" (
+	%SPHINXBUILD% -b linkcheck %ALLSPHINXOPTS% %BUILDDIR%/linkcheck
+	if errorlevel 1 exit /b 1
+	echo.
+	echo.Link check complete; look for any errors in the above output ^
+or in %BUILDDIR%/linkcheck/output.txt.
+	goto end
+)
+
+if "%1" == "doctest" (
+	%SPHINXBUILD% -b doctest %ALLSPHINXOPTS% %BUILDDIR%/doctest
+	if errorlevel 1 exit /b 1
+	echo.
+	echo.Testing of doctests in the sources finished, look at the ^
+results in %BUILDDIR%/doctest/output.txt.
+	goto end
+)
+
+:end
new file mode 100644
--- /dev/null
+++ b/third_party/python/more-itertools/docs/testing.rst
@@ -0,0 +1,19 @@
+=======
+Testing
+=======
+
+To run install dependencies and run tests, use this command::
+
+    python setup.py test
+
+Multiple Python Versions
+========================
+
+To run the tests on all the versions of Python more-itertools supports, install
+tox::
+
+    pip install tox
+
+Then, run the tests::
+
+    tox
new file mode 100644
--- /dev/null
+++ b/third_party/python/more-itertools/docs/versions.rst
@@ -0,0 +1,237 @@
+===============
+Version History
+===============
+
+.. automodule:: more_itertools
+
+4.2.0
+-----
+
+* New itertools:
+    * :func:`map_reduce` (thanks to pylang)
+    * :func:`prepend` (from the `Python 3.7 docs <https://docs.python.org/3.7/library/itertools.html#itertools-recipes>`_)
+
+* Improvements to existing itertools:
+    * :func:`bucket` now complies with PEP 479 (thanks to irmen)
+
+* Other changes:
+   * Python 3.7 is now supported (thanks to irmen)
+   * Python 3.3 is no longer supported
+   * The test suite no longer requires third-party modules to run
+   * The API docs now include links to source code
+
+4.1.0
+-----
+
+* New itertools:
+    * :func:`split_at` (thanks to michael-celani)
+    * :func:`circular_shifts` (thanks to hiqua)
+    * :func:`make_decorator` - see the blog post `Yo, I heard you like decorators <https://sites.google.com/site/bbayles/index/decorator_factory>`_
+      for a tour (thanks to pylang)
+    * :func:`always_reversible` (thanks to michael-celani)
+    * :func:`nth_combination` (from the `Python 3.7 docs <https://docs.python.org/3.7/library/itertools.html#itertools-recipes>`_)
+
+* Improvements to existing itertools:
+    * :func:`seekable` now has an ``elements`` method to return cached items.
+    * The performance tradeoffs between :func:`roundrobin` and
+      :func:`interleave_longest` are now documented (thanks michael-celani,
+      pylang, and MSeifert04)
+
+4.0.1
+-----
+
+* No code changes - this release fixes how the docs display on PyPI.
+
+4.0.0
+-----
+
+* New itertools:
+    * :func:`consecutive_groups` (Based on the example in the `Python 2.4 docs <https://docs.python.org/release/2.4.4/lib/itertools-example.html>`_)
+    * :func:`seekable` (If you're looking for how to "reset" an iterator,
+      you're in luck!)
+    * :func:`exactly_n` (thanks to michael-celani)
+    * :func:`run_length.encode` and :func:`run_length.decode`
+    * :func:`difference`
+
+* Improvements to existing itertools:
+    * The number of items between filler elements in :func:`intersperse` can
+      now be specified (thanks to pylang)
+    * :func:`distinct_permutations` and :func:`peekable` got some minor
+      adjustments (thanks to MSeifert04)
+    * :func:`always_iterable` now returns an iterator object. It also now
+      allows different types to be considered iterable (thanks to jaraco)
+    * :func:`bucket` can now limit the keys it stores in memory
+    * :func:`one` now allows for custom exceptions (thanks to kalekundert)
+
+* Other changes:
+    * A few typos were fixed (thanks to EdwardBetts)
+    * All tests can now be run with ``python setup.py test``
+
+The major version update is due to the change in the return value of :func:`always_iterable`.
+It now always returns iterator objects:
+
+.. code-block:: python
+
+    >>> from more_itertools import always_iterable
+    # Non-iterable objects are wrapped with iter(tuple(obj))
+    >>> always_iterable(12345)
+    <tuple_iterator object at 0x7fb24c9488d0>
+    >>> list(always_iterable(12345))
+    [12345]
+    # Iterable objects are wrapped with iter()
+    >>> always_iterable([1, 2, 3, 4, 5])
+    <list_iterator object at 0x7fb24c948c50>
+
+3.2.0
+-----
+
+* New itertools:
+    * :func:`lstrip`, :func:`rstrip`, and :func:`strip`
+      (thanks to MSeifert04 and pylang)
+    * :func:`islice_extended`
+* Improvements to existing itertools:
+    * Some bugs with slicing :func:`peekable`-wrapped iterables were fixed
+
+3.1.0
+-----
+
+* New itertools:
+    * :func:`numeric_range` (Thanks to BebeSparkelSparkel and MSeifert04)
+    * :func:`count_cycle` (Thanks to BebeSparkelSparkel)
+    * :func:`locate` (Thanks to pylang and MSeifert04)
+* Improvements to existing itertools:
+    * A few itertools are now slightly faster due to some function
+      optimizations. (Thanks to MSeifert04)
+* The docs have been substantially revised with installation notes,
+  categories for library functions, links, and more. (Thanks to pylang)
+
+
+3.0.0
+-----
+
+* Removed itertools:
+    * ``context`` has been removed due to a design flaw - see below for
+      replacement options. (thanks to NeilGirdhar)
+* Improvements to existing itertools:
+    * ``side_effect`` now supports ``before`` and ``after`` keyword
+      arguments. (Thanks to yardsale8)
+* PyPy and PyPy3 are now supported.
+
+The major version change is due to the removal of the ``context`` function.
+Replace it with standard ``with`` statement context management:
+
+.. code-block:: python
+
+    # Don't use context() anymore
+    file_obj = StringIO()
+    consume(print(x, file=f) for f in context(file_obj) for x in u'123')
+
+    # Use a with statement instead
+    file_obj = StringIO()
+    with file_obj as f:
+        consume(print(x, file=f) for x in u'123')
+
+2.6.0
+-----
+
+* New itertools:
+    * ``adjacent`` and ``groupby_transform`` (Thanks to diazona)
+    * ``always_iterable`` (Thanks to jaraco)
+    * (Removed in 3.0.0) ``context`` (Thanks to yardsale8)
+    * ``divide`` (Thanks to mozbhearsum)
+* Improvements to existing itertools:
+    * ``ilen`` is now slightly faster. (Thanks to wbolster)
+    * ``peekable`` can now prepend items to an iterable. (Thanks to diazona)
+
+2.5.0
+-----
+
+* New itertools:
+    * ``distribute`` (Thanks to mozbhearsum and coady)
+    * ``sort_together`` (Thanks to clintval)
+    * ``stagger`` and ``zip_offset`` (Thanks to joshbode)
+    * ``padded``
+* Improvements to existing itertools:
+    * ``peekable`` now handles negative indexes and slices with negative
+      components properly.
+    * ``intersperse`` is now slightly faster. (Thanks to pylang)
+    * ``windowed`` now accepts a ``step`` keyword argument.
+      (Thanks to pylang)
+* Python 3.6 is now supported.
+
+2.4.1
+-----
+
+* Move docs 100% to readthedocs.io.
+
+2.4
+-----
+
+* New itertools:
+    * ``accumulate``, ``all_equal``, ``first_true``, ``partition``, and
+      ``tail`` from the itertools documentation.
+    * ``bucket`` (Thanks to Rosuav and cvrebert)
+    * ``collapse`` (Thanks to abarnet)
+    * ``interleave`` and ``interleave_longest`` (Thanks to abarnet)
+    * ``side_effect`` (Thanks to nvie)
+    * ``sliced`` (Thanks to j4mie and coady)
+    * ``split_before`` and ``split_after`` (Thanks to astronouth7303)
+    * ``spy`` (Thanks to themiurgo and mathieulongtin)
+* Improvements to existing itertools:
+    * ``chunked`` is now simpler and more friendly to garbage collection.
+      (Contributed by coady, with thanks to piskvorky)
+    * ``collate`` now delegates to ``heapq.merge`` when possible.
+      (Thanks to kmike and julianpistorius)
+    * ``peekable``-wrapped iterables are now indexable and sliceable.
+      Iterating through ``peekable``-wrapped iterables is also faster.
+    * ``one`` and ``unique_to_each`` have been simplified.
+      (Thanks to coady)
+
+
+2.3
+-----
+
+* Added ``one`` from ``jaraco.util.itertools``. (Thanks, jaraco!)
+* Added ``distinct_permutations`` and ``unique_to_each``. (Contributed by
+  bbayles)
+* Added ``windowed``. (Contributed by bbayles, with thanks to buchanae,
+  jaraco, and abarnert)
+* Simplified the implementation of ``chunked``. (Thanks, nvie!)
+* Python 3.5 is now supported. Python 2.6 is no longer supported.
+* Python 3 is now supported directly; there is no 2to3 step.
+
+2.2
+-----
+
+* Added ``iterate`` and ``with_iter``. (Thanks, abarnert!)
+
+2.1
+-----
+
+* Added (tested!) implementations of the recipes from the itertools
+  documentation. (Thanks, Chris Lonnen!)
+* Added ``ilen``. (Thanks for the inspiration, Matt Basta!)
+
+2.0
+-----
+
+* ``chunked`` now returns lists rather than tuples. After all, they're
+  homogeneous. This slightly backward-incompatible change is the reason for
+  the major version bump.
+* Added ``@consumer``.
+* Improved test machinery.
+
+1.1
+-----
+
+* Added ``first`` function.
+* Added Python 3 support.
+* Added a default arg to ``peekable.peek()``.
+* Noted how to easily test whether a peekable iterator is exhausted.
+* Rewrote documentation.
+
+1.0
+-----
+
+* Initial release, with ``collate``, ``peekable``, and ``chunked``. Could
+  really use better docs.
new file mode 100644
--- /dev/null
+++ b/third_party/python/more-itertools/more_itertools/__init__.py
@@ -0,0 +1,2 @@
+from more_itertools.more import *  # noqa
+from more_itertools.recipes import *  # noqa
new file mode 100644
--- /dev/null
+++ b/third_party/python/more-itertools/more_itertools/more.py
@@ -0,0 +1,2068 @@
+from __future__ import print_function
+
+from collections import Counter, defaultdict, deque
+from functools import partial, wraps
+from heapq import merge
+from itertools import (
+    chain,
+    compress,
+    count,
+    cycle,
+    dropwhile,
+    groupby,
+    islice,
+    repeat,
+    takewhile,
+    tee
+)
+from operator import itemgetter, lt, gt, sub
+from sys import maxsize, version_info
+try:
+    from collections.abc import Sequence
+except ImportError:
+    from collections import Sequence
+
+from six import binary_type, string_types, text_type
+from six.moves import filter, map, range, zip, zip_longest
+
+from .recipes import consume, flatten, take
+
+__all__ = [
+    'adjacent',
+    'always_iterable',
+    'always_reversible',
+    'bucket',
+    'chunked',
+    'circular_shifts',
+    'collapse',
+    'collate',
+    'consecutive_groups',
+    'consumer',
+    'count_cycle',
+    'difference',
+    'distinct_permutations',
+    'distribute',
+    'divide',
+    'exactly_n',
+    'first',
+    'groupby_transform',
+    'ilen',
+    'interleave_longest',
+    'interleave',
+    'intersperse',
+    'islice_extended',
+    'iterate',
+    'locate',
+    'lstrip',
+    'make_decorator',
+    'map_reduce',
+    'numeric_range',
+    'one',
+    'padded',
+    'peekable',
+    'rstrip',
+    'run_length',
+    'seekable',
+    'SequenceView',
+    'side_effect',
+    'sliced',
+    'sort_together',
+    'split_at',
+    'split_after',
+    'split_before',
+    'spy',
+    'stagger',
+    'strip',
+    'unique_to_each',
+    'windowed',
+    'with_iter',
+    'zip_offset',
+]
+
+_marker = object()
+
+
+def chunked(iterable, n):
+    """Break *iterable* into lists of length *n*:
+
+        >>> list(chunked([1, 2, 3, 4, 5, 6], 3))
+        [[1, 2, 3], [4, 5, 6]]
+
+    If the length of *iterable* is not evenly divisible by *n*, the last
+    returned list will be shorter:
+
+        >>> list(chunked([1, 2, 3, 4, 5, 6, 7, 8], 3))
+        [[1, 2, 3], [4, 5, 6], [7, 8]]
+
+    To use a fill-in value instead, see the :func:`grouper` recipe.
+
+    :func:`chunked` is useful for splitting up a computation on a large number
+    of keys into batches, to be pickled and sent off to worker processes. One
+    example is operations on rows in MySQL, which does not implement
+    server-side cursors properly and would otherwise load the entire dataset
+    into RAM on the client.
+
+    """
+    return iter(partial(take, n, iter(iterable)), [])
+
+
+def first(iterable, default=_marker):
+    """Return the first item of *iterable*, or *default* if *iterable* is
+    empty.
+
+        >>> first([0, 1, 2, 3])
+        0
+        >>> first([], 'some default')
+        'some default'
+
+    If *default* is not provided and there are no items in the iterable,
+    raise ``ValueError``.
+
+    :func:`first` is useful when you have a generator of expensive-to-retrieve
+    values and want any arbitrary one. It is marginally shorter than
+    ``next(iter(iterable), default)``.
+
+    """
+    try:
+        return next(iter(iterable))
+    except StopIteration:
+        # I'm on the edge about raising ValueError instead of StopIteration. At
+        # the moment, ValueError wins, because the caller could conceivably
+        # want to do something different with flow control when I raise the
+        # exception, and it's weird to explicitly catch StopIteration.
+        if default is _marker:
+            raise ValueError('first() was called on an empty iterable, and no '
+                             'default value was provided.')
+        return default
+
+
+class peekable(object):
+    """Wrap an iterator to allow lookahead and prepending elements.
+
+    Call :meth:`peek` on the result to get the value that will be returned
+    by :func:`next`. This won't advance the iterator:
+
+        >>> p = peekable(['a', 'b'])
+        >>> p.peek()
+        'a'
+        >>> next(p)
+        'a'
+
+    Pass :meth:`peek` a default value to return that instead of raising
+    ``StopIteration`` when the iterator is exhausted.
+
+        >>> p = peekable([])
+        >>> p.peek('hi')
+        'hi'
+
+    peekables also offer a :meth:`prepend` method, which "inserts" items
+    at the head of the iterable:
+
+        >>> p = peekable([1, 2, 3])
+        >>> p.prepend(10, 11, 12)
+        >>> next(p)
+        10
+        >>> p.peek()
+        11
+        >>> list(p)
+        [11, 12, 1, 2, 3]
+
+    peekables can be indexed. Index 0 is the item that will be returned by
+    :func:`next`, index 1 is the item after that, and so on:
+    The values up to the given index will be cached.
+
+        >>> p = peekable(['a', 'b', 'c', 'd'])
+        >>> p[0]
+        'a'
+        >>> p[1]
+        'b'
+        >>> next(p)
+        'a'
+
+    Negative indexes are supported, but be aware that they will cache the
+    remaining items in the source iterator, which may require significant
+    storage.
+
+    To check whether a peekable is exhausted, check its truth value:
+
+        >>> p = peekable(['a', 'b'])
+        >>> if p:  # peekable has items
+        ...     list(p)
+        ['a', 'b']
+        >>> if not p:  # peekable is exhaused
+        ...     list(p)
+        []
+
+    """
+    def __init__(self, iterable):
+        self._it = iter(iterable)
+        self._cache = deque()
+
+    def __iter__(self):
+        return self
+
+    def __bool__(self):
+        try:
+            self.peek()
+        except StopIteration:
+            return False
+        return True
+
+    def __nonzero__(self):
+        # For Python 2 compatibility
+        return self.__bool__()
+
+    def peek(self, default=_marker):
+        """Return the item that will be next returned from ``next()``.
+
+        Return ``default`` if there are no items left. If ``default`` is not
+        provided, raise ``StopIteration``.
+
+        """
+        if not self._cache:
+            try:
+                self._cache.append(next(self._it))
+            except StopIteration:
+                if default is _marker:
+                    raise
+                return default
+        return self._cache[0]
+
+    def prepend(self, *items):
+        """Stack up items to be the next ones returned from ``next()`` or
+        ``self.peek()``. The items will be returned in
+        first in, first out order::
+
+            >>> p = peekable([1, 2, 3])
+            >>> p.prepend(10, 11, 12)
+            >>> next(p)
+            10
+            >>> list(p)
+            [11, 12, 1, 2, 3]
+
+        It is possible, by prepending items, to "resurrect" a peekable that
+        previously raised ``StopIteration``.
+
+            >>> p = peekable([])
+            >>> next(p)
+            Traceback (most recent call last):
+              ...
+            StopIteration
+            >>> p.prepend(1)
+            >>> next(p)
+            1
+            >>> next(p)
+            Traceback (most recent call last):
+              ...
+            StopIteration
+
+        """
+        self._cache.extendleft(reversed(items))
+
+    def __next__(self):
+        if self._cache:
+            return self._cache.popleft()
+
+        return next(self._it)
+
+    next = __next__  # For Python 2 compatibility
+
+    def _get_slice(self, index):
+        # Normalize the slice's arguments
+        step = 1 if (index.step is None) else index.step
+        if step > 0:
+            start = 0 if (index.start is None) else index.start
+            stop = maxsize if (index.stop is None) else index.stop
+        elif step < 0:
+            start = -1 if (index.start is None) else index.start
+            stop = (-maxsize - 1) if (index.stop is None) else index.stop
+        else:
+            raise ValueError('slice step cannot be zero')
+
+        # If either the start or stop index is negative, we'll need to cache
+        # the rest of the iterable in order to slice from the right side.
+        if (start < 0) or (stop < 0):
+            self._cache.extend(self._it)
+        # Otherwise we'll need to find the rightmost index and cache to that
+        # point.
+        else:
+            n = min(max(start, stop) + 1, maxsize)
+            cache_len = len(self._cache)
+            if n >= cache_len:
+                self._cache.extend(islice(self._it, n - cache_len))
+
+        return list(self._cache)[index]
+
+    def __getitem__(self, index):
+        if isinstance(index, slice):
+            return self._get_slice(index)
+
+        cache_len = len(self._cache)
+        if index < 0:
+            self._cache.extend(self._it)
+        elif index >= cache_len:
+            self._cache.extend(islice(self._it, index + 1 - cache_len))
+
+        return self._cache[index]
+
+
+def _collate(*iterables, **kwargs):
+    """Helper for ``collate()``, called when the user is using the ``reverse``
+    or ``key`` keyword arguments on Python versions below 3.5.
+
+    """
+    key = kwargs.pop('key', lambda a: a)
+    reverse = kwargs.pop('reverse', False)
+
+    min_or_max = partial(max if reverse else min, key=itemgetter(0))
+    peekables = [peekable(it) for it in iterables]
+    peekables = [p for p in peekables if p]  # Kill empties.
+    while peekables:
+        _, p = min_or_max((key(p.peek()), p) for p in peekables)
+        yield next(p)
+        peekables = [x for x in peekables if x]
+
+
+def collate(*iterables, **kwargs):
+    """Return a sorted merge of the items from each of several already-sorted
+    *iterables*.
+
+        >>> list(collate('ACDZ', 'AZ', 'JKL'))
+        ['A', 'A', 'C', 'D', 'J', 'K', 'L', 'Z', 'Z']
+
+    Works lazily, keeping only the next value from each iterable in memory. Use
+    :func:`collate` to, for example, perform a n-way mergesort of items that
+    don't fit in memory.
+
+    If a *key* function is specified, the iterables will be sorted according
+    to its result:
+
+        >>> key = lambda s: int(s)  # Sort by numeric value, not by string
+        >>> list(collate(['1', '10'], ['2', '11'], key=key))
+        ['1', '2', '10', '11']
+
+
+    If the *iterables* are sorted in descending order, set *reverse* to
+    ``True``:
+
+        >>> list(collate([5, 3, 1], [4, 2, 0], reverse=True))
+        [5, 4, 3, 2, 1, 0]
+
+    If the elements of the passed-in iterables are out of order, you might get
+    unexpected results.
+
+    On Python 2.7, this function delegates to :func:`heapq.merge` if neither
+    of the keyword arguments are specified. On Python 3.5+, this function
+    is an alias for :func:`heapq.merge`.
+
+    """
+    if not kwargs:
+        return merge(*iterables)
+
+    return _collate(*iterables, **kwargs)
+
+
+# If using Python version 3.5 or greater, heapq.merge() will be faster than
+# collate - use that instead.
+if version_info >= (3, 5, 0):
+    _collate_docstring = collate.__doc__
+    collate = partial(merge)
+    collate.__doc__ = _collate_docstring
+
+
+def consumer(func):
+    """Decorator that automatically advances a PEP-342-style "reverse iterator"
+    to its first yield point so you don't have to call ``next()`` on it
+    manually.
+
+        >>> @consumer
+        ... def tally():
+        ...     i = 0
+        ...     while True:
+        ...         print('Thing number %s is %s.' % (i, (yield)))
+        ...         i += 1
+        ...
+        >>> t = tally()
+        >>> t.send('red')
+        Thing number 0 is red.
+        >>> t.send('fish')
+        Thing number 1 is fish.
+
+    Without the decorator, you would have to call ``next(t)`` before
+    ``t.send()`` could be used.
+
+    """
+    @wraps(func)
+    def wrapper(*args, **kwargs):
+        gen = func(*args, **kwargs)
+        next(gen)
+        return gen
+    return wrapper
+
+
+def ilen(iterable):
+    """Return the number of items in *iterable*.
+
+        >>> ilen(x for x in range(1000000) if x % 3 == 0)
+        333334
+
+    This consumes the iterable, so handle with care.
+
+    """
+    # maxlen=1 only stores the last item in the deque
+    d = deque(enumerate(iterable, 1), maxlen=1)
+    # since we started enumerate at 1,
+    # the first item of the last pair will be the length of the iterable
+    # (assuming there were items)
+    return d[0][0] if d else 0
+
+
+def iterate(func, start):
+    """Return ``start``, ``func(start)``, ``func(func(start))``, ...
+
+        >>> from itertools import islice
+        >>> list(islice(iterate(lambda x: 2*x, 1), 10))
+        [1, 2, 4, 8, 16, 32, 64, 128, 256, 512]
+
+    """
+    while True:
+        yield start
+        start = func(start)
+
+
+def with_iter(context_manager):
+    """Wrap an iterable in a ``with`` statement, so it closes once exhausted.
+
+    For example, this will close the file when the iterator is exhausted::
+
+        upper_lines = (line.upper() for line in with_iter(open('foo')))
+
+    Any context manager which returns an iterable is a candidate for
+    ``with_iter``.
+
+    """
+    with context_manager as iterable:
+        for item in iterable:
+            yield item
+
+
+def one(iterable, too_short=None, too_long=None):
+    """Return the first item from *iterable*, which is expected to contain only
+    that item. Raise an exception if *iterable* is empty or has more than one
+    item.
+
+    :func:`one` is useful for ensuring that an iterable contains only one item.
+    For example, it can be used to retrieve the result of a database query
+    that is expected to return a single row.
+
+    If *iterable* is empty, ``ValueError`` will be raised. You may specify a
+    different exception with the *too_short* keyword:
+
+        >>> it = []
+        >>> one(it)  # doctest: +IGNORE_EXCEPTION_DETAIL
+        Traceback (most recent call last):
+        ...
+        ValueError: too many items in iterable (expected 1)'
+        >>> too_short = IndexError('too few items')
+        >>> one(it, too_short=too_short)  # doctest: +IGNORE_EXCEPTION_DETAIL
+        Traceback (most recent call last):
+        ...
+        IndexError: too few items
+
+    Similarly, if *iterable* contains more than one item, ``ValueError`` will
+    be raised. You may specify a different exception with the *too_long*
+    keyword:
+
+        >>> it = ['too', 'many']
+        >>> one(it)  # doctest: +IGNORE_EXCEPTION_DETAIL
+        Traceback (most recent call last):
+        ...
+        ValueError: too many items in iterable (expected 1)'
+        >>> too_long = RuntimeError
+        >>> one(it, too_long=too_long)  # doctest: +IGNORE_EXCEPTION_DETAIL
+        Traceback (most recent call last):
+        ...
+        RuntimeError
+
+    Note that :func:`one` attempts to advance *iterable* twice to ensure there
+    is only one item. If there is more than one, both items will be discarded.
+    See :func:`spy` or :func:`peekable` to check iterable contents less
+    destructively.
+
+    """
+    it = iter(iterable)
+
+    try:
+        value = next(it)
+    except StopIteration:
+        raise too_short or ValueError('too few items in iterable (expected 1)')
+
+    try:
+        next(it)
+    except StopIteration:
+        pass
+    else:
+        raise too_long or ValueError('too many items in iterable (expected 1)')
+
+    return value
+
+
+def distinct_permutations(iterable):
+    """Yield successive distinct permutations of the elements in *iterable*.
+
+        >>> sorted(distinct_permutations([1, 0, 1]))
+        [(0, 1, 1), (1, 0, 1), (1, 1, 0)]
+
+    Equivalent to ``set(permutations(iterable))``, except duplicates are not
+    generated and thrown away. For larger input sequences this is much more
+    efficient.
+
+    Duplicate permutations arise when there are duplicated elements in the
+    input iterable. The number of items returned is
+    `n! / (x_1! * x_2! * ... * x_n!)`, where `n` is the total number of
+    items input, and each `x_i` is the count of a distinct item in the input
+    sequence.
+
+    """
+    def perm_unique_helper(item_counts, perm, i):
+        """Internal helper function
+
+        :arg item_counts: Stores the unique items in ``iterable`` and how many
+            times they are repeated
+        :arg perm: The permutation that is being built for output
+        :arg i: The index of the permutation being modified
+
+        The output permutations are built up recursively; the distinct items
+        are placed until their repetitions are exhausted.
+        """
+        if i < 0:
+            yield tuple(perm)
+        else:
+            for item in item_counts:
+                if item_counts[item] <= 0:
+                    continue
+                perm[i] = item
+                item_counts[item] -= 1
+                for x in perm_unique_helper(item_counts, perm, i - 1):
+                    yield x
+                item_counts[item] += 1
+
+    item_counts = Counter(iterable)
+    length = sum(item_counts.values())
+
+    return perm_unique_helper(item_counts, [None] * length, length - 1)
+
+
+def intersperse(e, iterable, n=1):
+    """Intersperse filler element *e* among the items in *iterable*, leaving
+    *n* items between each filler element.
+
+        >>> list(intersperse('!', [1, 2, 3, 4, 5]))
+        [1, '!', 2, '!', 3, '!', 4, '!', 5]
+
+        >>> list(intersperse(None, [1, 2, 3, 4, 5], n=2))
+        [1, 2, None, 3, 4, None, 5]
+
+    """
+    if n == 0:
+        raise ValueError('n must be > 0')
+    elif n == 1:
+        # interleave(repeat(e), iterable) -> e, x_0, e, e, x_1, e, x_2...
+        # islice(..., 1, None) -> x_0, e, e, x_1, e, x_2...
+        return islice(interleave(repeat(e), iterable), 1, None)
+    else:
+        # interleave(filler, chunks) -> [e], [x_0, x_1], [e], [x_2, x_3]...
+        # islice(..., 1, None) -> [x_0, x_1], [e], [x_2, x_3]...
+        # flatten(...) -> x_0, x_1, e, x_2, x_3...
+        filler = repeat([e])
+        chunks = chunked(iterable, n)
+        return flatten(islice(interleave(filler, chunks), 1, None))
+
+
+def unique_to_each(*iterables):
+    """Return the elements from each of the input iterables that aren't in the
+    other input iterables.
+
+    For example, suppose you have a set of packages, each with a set of
+    dependencies::
+
+        {'pkg_1': {'A', 'B'}, 'pkg_2': {'B', 'C'}, 'pkg_3': {'B', 'D'}}
+
+    If you remove one package, which dependencies can also be removed?
+
+    If ``pkg_1`` is removed, then ``A`` is no longer necessary - it is not
+    associated with ``pkg_2`` or ``pkg_3``. Similarly, ``C`` is only needed for
+    ``pkg_2``, and ``D`` is only needed for ``pkg_3``::
+
+        >>> unique_to_each({'A', 'B'}, {'B', 'C'}, {'B', 'D'})
+        [['A'], ['C'], ['D']]
+
+    If there are duplicates in one input iterable that aren't in the others
+    they will be duplicated in the output. Input order is preserved::
+
+        >>> unique_to_each("mississippi", "missouri")
+        [['p', 'p'], ['o', 'u', 'r']]
+
+    It is assumed that the elements of each iterable are hashable.
+
+    """
+    pool = [list(it) for it in iterables]
+    counts = Counter(chain.from_iterable(map(set, pool)))
+    uniques = {element for element in counts if counts[element] == 1}
+    return [list(filter(uniques.__contains__, it)) for it in pool]
+
+
+def windowed(seq, n, fillvalue=None, step=1):
+    """Return a sliding window of width *n* over the given iterable.
+
+        >>> all_windows = windowed([1, 2, 3, 4, 5], 3)
+        >>> list(all_windows)
+        [(1, 2, 3), (2, 3, 4), (3, 4, 5)]
+
+    When the window is larger than the iterable, *fillvalue* is used in place
+    of missing values::
+
+        >>> list(windowed([1, 2, 3], 4))
+        [(1, 2, 3, None)]
+
+    Each window will advance in increments of *step*:
+
+        >>> list(windowed([1, 2, 3, 4, 5, 6], 3, fillvalue='!', step=2))
+        [(1, 2, 3), (3, 4, 5), (5, 6, '!')]
+
+    """
+    if n < 0:
+        raise ValueError('n must be >= 0')
+    if n == 0:
+        yield tuple()
+        return
+    if step < 1:
+        raise ValueError('step must be >= 1')
+
+    it = iter(seq)
+    window = deque([], n)
+    append = window.append
+
+    # Initial deque fill
+    for _ in range(n):
+        append(next(it, fillvalue))
+    yield tuple(window)
+
+    # Appending new items to the right causes old items to fall off the left
+    i = 0
+    for item in it:
+        append(item)
+        i = (i + 1) % step
+        if i % step == 0:
+            yield tuple(window)
+
+    # If there are items from the iterable in the window, pad with the given
+    # value and emit them.
+    if (i % step) and (step - i < n):
+        for _ in range(step - i):
+            append(fillvalue)
+        yield tuple(window)
+
+
+class bucket(object):
+    """Wrap *iterable* and return an object that buckets it iterable into
+    child iterables based on a *key* function.
+
+        >>> iterable = ['a1', 'b1', 'c1', 'a2', 'b2', 'c2', 'b3']
+        >>> s = bucket(iterable, key=lambda x: x[0])
+        >>> a_iterable = s['a']
+        >>> next(a_iterable)
+        'a1'
+        >>> next(a_iterable)
+        'a2'
+        >>> list(s['b'])
+        ['b1', 'b2', 'b3']
+
+    The original iterable will be advanced and its items will be cached until
+    they are used by the child iterables. This may require significant storage.
+
+    By default, attempting to select a bucket to which no items belong  will
+    exhaust the iterable and cache all values.
+    If you specify a *validator* function, selected buckets will instead be
+    checked against it.
+
+        >>> from itertools import count
+        >>> it = count(1, 2)  # Infinite sequence of odd numbers
+        >>> key = lambda x: x % 10  # Bucket by last digit
+        >>> validator = lambda x: x in {1, 3, 5, 7, 9}  # Odd digits only
+        >>> s = bucket(it, key=key, validator=validator)
+        >>> 2 in s
+        False
+        >>> list(s[2])
+        []
+
+    """
+    def __init__(self, iterable, key, validator=None):
+        self._it = iter(iterable)
+        self._key = key
+        self._cache = defaultdict(deque)
+        self._validator = validator or (lambda x: True)
+
+    def __contains__(self, value):
+        if not self._validator(value):
+            return False
+
+        try:
+            item = next(self[value])
+        except StopIteration:
+            return False
+        else:
+            self._cache[value].appendleft(item)
+
+        return True
+
+    def _get_values(self, value):
+        """
+        Helper to yield items from the parent iterator that match *value*.
+        Items that don't match are stored in the local cache as they
+        are encountered.
+        """
+        while True:
+            # If we've cached some items that match the target value, emit
+            # the first one and evict it from the cache.
+            if self._cache[value]:
+                yield self._cache[value].popleft()
+            # Otherwise we need to advance the parent iterator to search for
+            # a matching item, caching the rest.
+            else:
+                while True:
+                    try:
+                        item = next(self._it)
+                    except StopIteration:
+                        return
+                    item_value = self._key(item)
+                    if item_value == value:
+                        yield item
+                        break
+                    elif self._validator(item_value):
+                        self._cache[item_value].append(item)
+
+    def __getitem__(self, value):
+        if not self._validator(value):
+            return iter(())
+
+        return self._get_values(value)
+
+
+def spy(iterable, n=1):
+    """Return a 2-tuple with a list containing the first *n* elements of
+    *iterable*, and an iterator with the same items as *iterable*.
+    This allows you to "look ahead" at the items in the iterable without
+    advancing it.
+
+    There is one item in the list by default:
+
+        >>> iterable = 'abcdefg'
+        >>> head, iterable = spy(iterable)
+        >>> head
+        ['a']
+        >>> list(iterable)
+        ['a', 'b', 'c', 'd', 'e', 'f', 'g']
+
+    You may use unpacking to retrieve items instead of lists:
+
+        >>> (head,), iterable = spy('abcdefg')
+        >>> head
+        'a'
+        >>> (first, second), iterable = spy('abcdefg', 2)
+        >>> first
+        'a'
+        >>> second
+        'b'
+
+    The number of items requested can be larger than the number of items in
+    the iterable:
+
+        >>> iterable = [1, 2, 3, 4, 5]
+        >>> head, iterable = spy(iterable, 10)
+        >>> head
+        [1, 2, 3, 4, 5]
+        >>> list(iterable)
+        [1, 2, 3, 4, 5]
+
+    """
+    it = iter(iterable)
+    head = take(n, it)
+
+    return head, chain(head, it)
+
+
+def interleave(*iterables):
+    """Return a new iterable yielding from each iterable in turn,
+    until the shortest is exhausted.
+
+        >>> list(interleave([1, 2, 3], [4, 5], [6, 7, 8]))
+        [1, 4, 6, 2, 5, 7]
+
+    For a version that doesn't terminate after the shortest iterable is
+    exhausted, see :func:`interleave_longest`.
+
+    """
+    return chain.from_iterable(zip(*iterables))
+
+
+def interleave_longest(*iterables):
+    """Return a new iterable yielding from each iterable in turn,
+    skipping any that are exhausted.
+
+        >>> list(interleave_longest([1, 2, 3], [4, 5], [6, 7, 8]))
+        [1, 4, 6, 2, 5, 7, 3, 8]
+
+    This function produces the same output as :func:`roundrobin`, but may
+    perform better for some inputs (in particular when the number of iterables
+    is large).
+
+    """
+    i = chain.from_iterable(zip_longest(*iterables, fillvalue=_marker))
+    return (x for x in i if x is not _marker)
+
+
+def collapse(iterable, base_type=None, levels=None):
+    """Flatten an iterable with multiple levels of nesting (e.g., a list of
+    lists of tuples) into non-iterable types.
+
+        >>> iterable = [(1, 2), ([3, 4], [[5], [6]])]
+        >>> list(collapse(iterable))
+        [1, 2, 3, 4, 5, 6]
+
+    String types are not considered iterable and will not be collapsed.
+    To avoid collapsing other types, specify *base_type*:
+
+        >>> iterable = ['ab', ('cd', 'ef'), ['gh', 'ij']]
+        >>> list(collapse(iterable, base_type=tuple))
+        ['ab', ('cd', 'ef'), 'gh', 'ij']
+
+    Specify *levels* to stop flattening after a certain level:
+
+    >>> iterable = [('a', ['b']), ('c', ['d'])]
+    >>> list(collapse(iterable))  # Fully flattened
+    ['a', 'b', 'c', 'd']
+    >>> list(collapse(iterable, levels=1))  # Only one level flattened
+    ['a', ['b'], 'c', ['d']]
+
+    """
+    def walk(node, level):
+        if (
+            ((levels is not None) and (level > levels)) or
+            isinstance(node, string_types) or
+            ((base_type is not None) and isinstance(node, base_type))
+        ):
+            yield node
+            return
+
+        try:
+            tree = iter(node)
+        except TypeError:
+            yield node
+            return
+        else:
+            for child in tree:
+                for x in walk(child, level + 1):
+                    yield x
+
+    for x in walk(iterable, 0):
+        yield x
+
+
+def side_effect(func, iterable, chunk_size=None, before=None, after=None):
+    """Invoke *func* on each item in *iterable* (or on each *chunk_size* group
+    of items) before yielding the item.
+
+    `func` must be a function that takes a single argument. Its return value
+    will be discarded.
+
+    *before* and *after* are optional functions that take no arguments. They
+    will be executed before iteration starts and after it ends, respectively.
+
+    `side_effect` can be used for logging, updating progress bars, or anything
+    that is not functionally "pure."
+
+    Emitting a status message:
+
+        >>> from more_itertools import consume
+        >>> func = lambda item: print('Received {}'.format(item))
+        >>> consume(side_effect(func, range(2)))
+        Received 0
+        Received 1
+
+    Operating on chunks of items:
+
+        >>> pair_sums = []
+        >>> func = lambda chunk: pair_sums.append(sum(chunk))
+        >>> list(side_effect(func, [0, 1, 2, 3, 4, 5], 2))
+        [0, 1, 2, 3, 4, 5]
+        >>> list(pair_sums)
+        [1, 5, 9]
+
+    Writing to a file-like object:
+
+        >>> from io import StringIO
+        >>> from more_itertools import consume
+        >>> f = StringIO()
+        >>> func = lambda x: print(x, file=f)
+        >>> before = lambda: print(u'HEADER', file=f)
+        >>> after = f.close
+        >>> it = [u'a', u'b', u'c']
+        >>> consume(side_effect(func, it, before=before, after=after))
+        >>> f.closed
+        True
+
+    """
+    try:
+        if before is not None:
+            before()
+
+        if chunk_size is None:
+            for item in iterable:
+                func(item)
+                yield item
+        else:
+            for chunk in chunked(iterable, chunk_size):
+                func(chunk)
+                for item in chunk:
+                    yield item
+    finally:
+        if after is not None:
+            after()
+
+
+def sliced(seq, n):
+    """Yield slices of length *n* from the sequence *seq*.
+
+        >>> list(sliced((1, 2, 3, 4, 5, 6), 3))
+        [(1, 2, 3), (4, 5, 6)]
+
+    If the length of the sequence is not divisible by the requested slice
+    length, the last slice will be shorter.
+
+        >>> list(sliced((1, 2, 3, 4, 5, 6, 7, 8), 3))
+        [(1, 2, 3), (4, 5, 6), (7, 8)]
+
+    This function will only work for iterables that support slicing.
+    For non-sliceable iterables, see :func:`chunked`.
+
+    """
+    return takewhile(bool, (seq[i: i + n] for i in count(0, n)))
+
+
+def split_at(iterable, pred):
+    """Yield lists of items from *iterable*, where each list is delimited by
+    an item where callable *pred* returns ``True``. The lists do not include
+    the delimiting items.
+
+        >>> list(split_at('abcdcba', lambda x: x == 'b'))
+        [['a'], ['c', 'd', 'c'], ['a']]
+
+        >>> list(split_at(range(10), lambda n: n % 2 == 1))
+        [[0], [2], [4], [6], [8], []]
+    """
+    buf = []
+    for item in iterable:
+        if pred(item):
+            yield buf
+            buf = []
+        else:
+            buf.append(item)
+    yield buf
+
+
+def split_before(iterable, pred):
+    """Yield lists of items from *iterable*, where each list starts with an
+    item where callable *pred* returns ``True``:
+
+        >>> list(split_before('OneTwo', lambda s: s.isupper()))
+        [['O', 'n', 'e'], ['T', 'w', 'o']]
+
+        >>> list(split_before(range(10), lambda n: n % 3 == 0))
+        [[0, 1, 2], [3, 4, 5], [6, 7, 8], [9]]
+
+    """
+    buf = []
+    for item in iterable:
+        if pred(item) and buf:
+            yield buf
+            buf = []
+        buf.append(item)
+    yield buf
+
+
+def split_after(iterable, pred):
+    """Yield lists of items from *iterable*, where each list ends with an
+    item where callable *pred* returns ``True``:
+
+        >>> list(split_after('one1two2', lambda s: s.isdigit()))
+        [['o', 'n', 'e', '1'], ['t', 'w', 'o', '2']]
+
+        >>> list(split_after(range(10), lambda n: n % 3 == 0))
+        [[0], [1, 2, 3], [4, 5, 6], [7, 8, 9]]
+
+    """
+    buf = []
+    for item in iterable:
+        buf.append(item)
+        if pred(item) and buf:
+            yield buf
+            buf = []
+    if buf:
+        yield buf
+
+
+def padded(iterable, fillvalue=None, n=None, next_multiple=False):
+    """Yield the elements from *iterable*, followed by *fillvalue*, such that
+    at least *n* items are emitted.
+
+        >>> list(padded([1, 2, 3], '?', 5))
+        [1, 2, 3, '?', '?']
+
+    If *next_multiple* is ``True``, *fillvalue* will be emitted until the
+    number of items emitted is a multiple of *n*::
+
+        >>> list(padded([1, 2, 3, 4], n=3, next_multiple=True))
+        [1, 2, 3, 4, None, None]
+
+    If *n* is ``None``, *fillvalue* will be emitted indefinitely.
+
+    """
+    it = iter(iterable)
+    if n is None:
+        for item in chain(it, repeat(fillvalue)):
+            yield item
+    elif n < 1:
+        raise ValueError('n must be at least 1')
+    else:
+        item_count = 0
+        for item in it:
+            yield item
+            item_count += 1
+
+        remaining = (n - item_count) % n if next_multiple else n - item_count
+        for _ in range(remaining):
+            yield fillvalue
+
+
+def distribute(n, iterable):
+    """Distribute the items from *iterable* among *n* smaller iterables.
+
+        >>> group_1, group_2 = distribute(2, [1, 2, 3, 4, 5, 6])
+        >>> list(group_1)
+        [1, 3, 5]
+        >>> list(group_2)
+        [2, 4, 6]
+
+    If the length of *iterable* is not evenly divisible by *n*, then the
+    length of the returned iterables will not be identical:
+
+        >>> children = distribute(3, [1, 2, 3, 4, 5, 6, 7])
+        >>> [list(c) for c in children]
+        [[1, 4, 7], [2, 5], [3, 6]]
+
+    If the length of *iterable* is smaller than *n*, then the last returned
+    iterables will be empty:
+
+        >>> children = distribute(5, [1, 2, 3])
+        >>> [list(c) for c in children]
+        [[1], [2], [3], [], []]
+
+    This function uses :func:`itertools.tee` and may require significant
+    storage. If you need the order items in the smaller iterables to match the
+    original iterable, see :func:`divide`.
+
+    """
+    if n < 1:
+        raise ValueError('n must be at least 1')
+
+    children = tee(iterable, n)
+    return [islice(it, index, None, n) for index, it in enumerate(children)]
+
+
+def stagger(iterable, offsets=(-1, 0, 1), longest=False, fillvalue=None):
+    """Yield tuples whose elements are offset from *iterable*.
+    The amount by which the `i`-th item in each tuple is offset is given by
+    the `i`-th item in *offsets*.
+
+        >>> list(stagger([0, 1, 2, 3]))
+        [(None, 0, 1), (0, 1, 2), (1, 2, 3)]
+        >>> list(stagger(range(8), offsets=(0, 2, 4)))
+        [(0, 2, 4), (1, 3, 5), (2, 4, 6), (3, 5, 7)]
+
+    By default, the sequence will end when the final element of a tuple is the
+    last item in the iterable. To continue until the first element of a tuple
+    is the last item in the iterable, set *longest* to ``True``::
+
+        >>> list(stagger([0, 1, 2, 3], longest=True))
+        [(None, 0, 1), (0, 1, 2), (1, 2, 3), (2, 3, None), (3, None, None)]
+
+    By default, ``None`` will be used to replace offsets beyond the end of the
+    sequence. Specify *fillvalue* to use some other value.
+
+    """
+    children = tee(iterable, len(offsets))
+
+    return zip_offset(
+        *children, offsets=offsets, longest=longest, fillvalue=fillvalue
+    )
+
+
+def zip_offset(*iterables, **kwargs):
+    """``zip`` the input *iterables* together, but offset the `i`-th iterable
+    by the `i`-th item in *offsets*.
+
+        >>> list(zip_offset('0123', 'abcdef', offsets=(0, 1)))
+        [('0', 'b'), ('1', 'c'), ('2', 'd'), ('3', 'e')]
+
+    This can be used as a lightweight alternative to SciPy or pandas to analyze
+    data sets in which somes series have a lead or lag relationship.
+
+    By default, the sequence will end when the shortest iterable is exhausted.
+    To continue until the longest iterable is exhausted, set *longest* to
+    ``True``.
+
+        >>> list(zip_offset('0123', 'abcdef', offsets=(0, 1), longest=True))
+        [('0', 'b'), ('1', 'c'), ('2', 'd'), ('3', 'e'), (None, 'f')]
+
+    By default, ``None`` will be used to replace offsets beyond the end of the
+    sequence. Specify *fillvalue* to use some other value.
+
+    """
+    offsets = kwargs['offsets']
+    longest = kwargs.get('longest', False)
+    fillvalue = kwargs.get('fillvalue', None)
+
+    if len(iterables) != len(offsets):
+        raise ValueError("Number of iterables and offsets didn't match")
+
+    staggered = []
+    for it, n in zip(iterables, offsets):
+        if n < 0:
+            staggered.append(chain(repeat(fillvalue, -n), it))
+        elif n > 0:
+            staggered.append(islice(it, n, None))
+        else:
+            staggered.append(it)
+
+    if longest:
+        return zip_longest(*staggered, fillvalue=fillvalue)
+
+    return zip(*staggered)
+
+
+def sort_together(iterables, key_list=(0,), reverse=False):
+    """Return the input iterables sorted together, with *key_list* as the
+    priority for sorting. All iterables are trimmed to the length of the
+    shortest one.
+
+    This can be used like the sorting function in a spreadsheet. If each
+    iterable represents a column of data, the key list determines which
+    columns are used for sorting.
+
+    By default, all iterables are sorted using the ``0``-th iterable::
+
+        >>> iterables = [(4, 3, 2, 1), ('a', 'b', 'c', 'd')]
+        >>> sort_together(iterables)
+        [(1, 2, 3, 4), ('d', 'c', 'b', 'a')]
+
+    Set a different key list to sort according to another iterable.
+    Specifying mutliple keys dictates how ties are broken::
+
+        >>> iterables = [(3, 1, 2), (0, 1, 0), ('c', 'b', 'a')]
+        >>> sort_together(iterables, key_list=(1, 2))
+        [(2, 3, 1), (0, 0, 1), ('a', 'c', 'b')]
+
+    Set *reverse* to ``True`` to sort in descending order.
+
+        >>> sort_together([(1, 2, 3), ('c', 'b', 'a')], reverse=True)
+        [(3, 2, 1), ('a', 'b', 'c')]
+
+    """
+    return list(zip(*sorted(zip(*iterables),
+                            key=itemgetter(*key_list),
+                            reverse=reverse)))
+
+
+def divide(n, iterable):
+    """Divide the elements from *iterable* into *n* parts, maintaining
+    order.
+
+        >>> group_1, group_2 = divide(2, [1, 2, 3, 4, 5, 6])
+        >>> list(group_1)
+        [1, 2, 3]
+        >>> list(group_2)
+        [4, 5, 6]
+
+    If the length of *iterable* is not evenly divisible by *n*, then the
+    length of the returned iterables will not be identical:
+
+        >>> children = divide(3, [1, 2, 3, 4, 5, 6, 7])
+        >>> [list(c) for c in children]
+        [[1, 2, 3], [4, 5], [6, 7]]
+
+    If the length of the iterable is smaller than n, then the last returned
+    iterables will be empty:
+
+        >>> children = divide(5, [1, 2, 3])
+        >>> [list(c) for c in children]
+        [[1], [2], [3], [], []]
+
+    This function will exhaust the iterable before returning and may require
+    significant storage. If order is not important, see :func:`distribute`,
+    which does not first pull the iterable into memory.
+
+    """
+    if n < 1:
+        raise ValueError('n must be at least 1')
+
+    seq = tuple(iterable)
+    q, r = divmod(len(seq), n)
+
+    ret = []
+    for i in range(n):
+        start = (i * q) + (i if i < r else r)
+        stop = ((i + 1) * q) + (i + 1 if i + 1 < r else r)
+        ret.append(iter(seq[start:stop]))
+
+    return ret
+
+
+def always_iterable(obj, base_type=(text_type, binary_type)):
+    """If *obj* is iterable, return an iterator over its items::
+
+        >>> obj = (1, 2, 3)
+        >>> list(always_iterable(obj))
+        [1, 2, 3]
+
+    If *obj* is not iterable, return a one-item iterable containing *obj*::
+
+        >>> obj = 1
+        >>> list(always_iterable(obj))
+        [1]
+
+    If *obj* is ``None``, return an empty iterable:
+
+        >>> obj = None
+        >>> list(always_iterable(None))
+        []
+
+    By default, binary and text strings are not considered iterable::
+
+        >>> obj = 'foo'
+        >>> list(always_iterable(obj))
+        ['foo']
+
+    If *base_type* is set, objects for which ``isinstance(obj, base_type)``
+    returns ``True`` won't be considered iterable.
+
+        >>> obj = {'a': 1}
+        >>> list(always_iterable(obj))  # Iterate over the dict's keys
+        ['a']
+        >>> list(always_iterable(obj, base_type=dict))  # Treat dicts as a unit
+        [{'a': 1}]
+
+    Set *base_type* to ``None`` to avoid any special handling and treat objects
+    Python considers iterable as iterable:
+
+        >>> obj = 'foo'
+        >>> list(always_iterable(obj, base_type=None))
+        ['f', 'o', 'o']
+    """
+    if obj is None:
+        return iter(())
+
+    if (base_type is not None) and isinstance(obj, base_type):
+        return iter((obj,))
+
+    try:
+        return iter(obj)
+    except TypeError:
+        return iter((obj,))
+
+
+def adjacent(predicate, iterable, distance=1):
+    """Return an iterable over `(bool, item)` tuples where the `item` is
+    drawn from *iterable* and the `bool` indicates whether
+    that item satisfies the *predicate* or is adjacent to an item that does.
+
+    For example, to find whether items are adjacent to a ``3``::
+
+        >>> list(adjacent(lambda x: x == 3, range(6)))
+        [(False, 0), (False, 1), (True, 2), (True, 3), (True, 4), (False, 5)]
+
+    Set *distance* to change what counts as adjacent. For example, to find
+    whether items are two places away from a ``3``:
+
+        >>> list(adjacent(lambda x: x == 3, range(6), distance=2))
+        [(False, 0), (True, 1), (True, 2), (True, 3), (True, 4), (True, 5)]
+
+    This is useful for contextualizing the results of a search function.
+    For example, a code comparison tool might want to identify lines that
+    have changed, but also surrounding lines to give the viewer of the diff
+    context.
+
+    The predicate function will only be called once for each item in the
+    iterable.
+
+    See also :func:`groupby_transform`, which can be used with this function
+    to group ranges of items with the same `bool` value.
+
+    """
+    # Allow distance=0 mainly for testing that it reproduces results with map()
+    if distance < 0:
+        raise ValueError('distance must be at least 0')
+
+    i1, i2 = tee(iterable)
+    padding = [False] * distance
+    selected = chain(padding, map(predicate, i1), padding)
+    adjacent_to_selected = map(any, windowed(selected, 2 * distance + 1))
+    return zip(adjacent_to_selected, i2)
+
+
+def groupby_transform(iterable, keyfunc=None, valuefunc=None):
+    """An extension of :func:`itertools.groupby` that transforms the values of
+    *iterable* after grouping them.
+    *keyfunc* is a function used to compute a grouping key for each item.
+    *valuefunc* is a function for transforming the items after grouping.
+
+        >>> iterable = 'AaaABbBCcA'
+        >>> keyfunc = lambda x: x.upper()
+        >>> valuefunc = lambda x: x.lower()
+        >>> grouper = groupby_transform(iterable, keyfunc, valuefunc)
+        >>> [(k, ''.join(g)) for k, g in grouper]
+        [('A', 'aaaa'), ('B', 'bbb'), ('C', 'cc'), ('A', 'a')]
+
+    *keyfunc* and *valuefunc* default to identity functions if they are not
+    specified.
+
+    :func:`groupby_transform` is useful when grouping elements of an iterable
+    using a separate iterable as the key. To do this, :func:`zip` the iterables
+    and pass a *keyfunc* that extracts the first element and a *valuefunc*
+    that extracts the second element::
+
+        >>> from operator import itemgetter
+        >>> keys = [0, 0, 1, 1, 1, 2, 2, 2, 3]
+        >>> values = 'abcdefghi'
+        >>> iterable = zip(keys, values)
+        >>> grouper = groupby_transform(iterable, itemgetter(0), itemgetter(1))
+        >>> [(k, ''.join(g)) for k, g in grouper]
+        [(0, 'ab'), (1, 'cde'), (2, 'fgh'), (3, 'i')]
+
+    Note that the order of items in the iterable is significant.
+    Only adjacent items are grouped together, so if you don't want any
+    duplicate groups, you should sort the iterable by the key function.
+
+    """
+    valuefunc = (lambda x: x) if valuefunc is None else valuefunc
+    return ((k, map(valuefunc, g)) for k, g in groupby(iterable, keyfunc))
+
+
+def numeric_range(*args):
+    """An extension of the built-in ``range()`` function whose arguments can
+    be any orderable numeric type.
+
+    With only *stop* specified, *start* defaults to ``0`` and *step*
+    defaults to ``1``. The output items will match the type of *stop*:
+
+        >>> list(numeric_range(3.5))
+        [0.0, 1.0, 2.0, 3.0]
+
+    With only *start* and *stop* specified, *step* defaults to ``1``. The
+    output items will match the type of *start*:
+
+        >>> from decimal import Decimal
+        >>> start = Decimal('2.1')
+        >>> stop = Decimal('5.1')
+        >>> list(numeric_range(start, stop))
+        [Decimal('2.1'), Decimal('3.1'), Decimal('4.1')]
+
+    With *start*, *stop*, and *step*  specified the output items will match
+    the type of ``start + step``:
+
+        >>> from fractions import Fraction
+        >>> start = Fraction(1, 2)  # Start at 1/2
+        >>> stop = Fraction(5, 2)  # End at 5/2
+        >>> step = Fraction(1, 2)  # Count by 1/2
+        >>> list(numeric_range(start, stop, step))
+        [Fraction(1, 2), Fraction(1, 1), Fraction(3, 2), Fraction(2, 1)]
+
+    If *step* is zero, ``ValueError`` is raised. Negative steps are supported:
+
+        >>> list(numeric_range(3, -1, -1.0))
+        [3.0, 2.0, 1.0, 0.0]
+
+    Be aware of the limitations of floating point numbers; the representation
+    of the yielded numbers may be surprising.
+
+    """
+    argc = len(args)
+    if argc == 1:
+        stop, = args
+        start = type(stop)(0)
+        step = 1
+    elif argc == 2:
+        start, stop = args
+        step = 1
+    elif argc == 3:
+        start, stop, step = args
+    else:
+        err_msg = 'numeric_range takes at most 3 arguments, got {}'
+        raise TypeError(err_msg.format(argc))
+
+    values = (start + (step * n) for n in count())
+    if step > 0:
+        return takewhile(partial(gt, stop), values)
+    elif step < 0:
+        return takewhile(partial(lt, stop), values)
+    else:
+        raise ValueError('numeric_range arg 3 must not be zero')
+
+
+def count_cycle(iterable, n=None):
+    """Cycle through the items from *iterable* up to *n* times, yielding
+    the number of completed cycles along with each item. If *n* is omitted the
+    process repeats indefinitely.
+
+    >>> list(count_cycle('AB', 3))
+    [(0, 'A'), (0, 'B'), (1, 'A'), (1, 'B'), (2, 'A'), (2, 'B')]
+
+    """
+    iterable = tuple(iterable)
+    if not iterable:
+        return iter(())
+    counter = count() if n is None else range(n)
+    return ((i, item) for i in counter for item in iterable)
+
+
+def locate(iterable, pred=bool):
+    """Yield the index of each item in *iterable* for which *pred* returns
+    ``True``.
+
+    *pred* defaults to :func:`bool`, which will select truthy items:
+
+        >>> list(locate([0, 1, 1, 0, 1, 0, 0]))
+        [1, 2, 4]
+
+    Set *pred* to a custom function to, e.g., find the indexes for a particular
+    item:
+
+        >>> list(locate(['a', 'b', 'c', 'b'], lambda x: x == 'b'))
+        [1, 3]
+
+    Use with :func:`windowed` to find the indexes of a sub-sequence:
+
+        >>> from more_itertools import windowed
+        >>> iterable = [0, 1, 2, 3, 0, 1, 2, 3, 0, 1, 2, 3]
+        >>> sub = [1, 2, 3]
+        >>> pred = lambda w: w == tuple(sub)  # windowed() returns tuples
+        >>> list(locate(windowed(iterable, len(sub)), pred=pred))
+        [1, 5, 9]
+
+    Use with :func:`seekable` to find indexes and then retrieve the associated
+    items:
+
+        >>> from itertools import count
+        >>> from more_itertools import seekable
+        >>> source = (3 * n + 1 if (n % 2) else n // 2 for n in count())
+        >>> it = seekable(source)
+        >>> pred = lambda x: x > 100
+        >>> indexes = locate(it, pred=pred)
+        >>> i = next(indexes)
+        >>> it.seek(i)
+        >>> next(it)
+        106
+
+    """
+    return compress(count(), map(pred, iterable))
+
+
+def lstrip(iterable, pred):
+    """Yield the items from *iterable*, but strip any from the beginning
+    for which *pred* returns ``True``.
+
+    For example, to remove a set of items from the start of an iterable:
+
+        >>> iterable = (None, False, None, 1, 2, None, 3, False, None)
+        >>> pred = lambda x: x in {None, False, ''}
+        >>> list(lstrip(iterable, pred))
+        [1, 2, None, 3, False, None]
+
+    This function is analogous to to :func:`str.lstrip`, and is essentially
+    an wrapper for :func:`itertools.dropwhile`.
+
+    """
+    return dropwhile(pred, iterable)
+
+
+def rstrip(iterable, pred):
+    """Yield the items from *iterable*, but strip any from the end
+    for which *pred* returns ``True``.
+
+    For example, to remove a set of items from the end of an iterable:
+
+        >>> iterable = (None, False, None, 1, 2, None, 3, False, None)
+        >>> pred = lambda x: x in {None, False, ''}
+        >>> list(rstrip(iterable, pred))
+        [None, False, None, 1, 2, None, 3]
+
+    This function is analogous to :func:`str.rstrip`.
+
+    """
+    cache = []
+    cache_append = cache.append
+    for x in iterable:
+        if pred(x):
+            cache_append(x)
+        else:
+            for y in cache:
+                yield y
+            del cache[:]
+            yield x
+
+
+def strip(iterable, pred):
+    """Yield the items from *iterable*, but strip any from the
+    beginning and end for which *pred* returns ``True``.
+
+    For example, to remove a set of items from both ends of an iterable:
+
+        >>> iterable = (None, False, None, 1, 2, None, 3, False, None)
+        >>> pred = lambda x: x in {None, False, ''}
+        >>> list(strip(iterable, pred))
+        [1, 2, None, 3]
+
+    This function is analogous to :func:`str.strip`.
+
+    """
+    return rstrip(lstrip(iterable, pred), pred)
+
+
+def islice_extended(iterable, *args):
+    """An extension of :func:`itertools.islice` that supports negative values
+    for *stop*, *start*, and *step*.
+
+        >>> iterable = iter('abcdefgh')
+        >>> list(islice_extended(iterable, -4, -1))
+        ['e', 'f', 'g']
+
+    Slices with negative values require some caching of *iterable*, but this
+    function takes care to minimize the amount of memory required.
+
+    For example, you can use a negative step with an infinite iterator:
+
+        >>> from itertools import count
+        >>> list(islice_extended(count(), 110, 99, -2))
+        [110, 108, 106, 104, 102, 100]
+
+    """
+    s = slice(*args)
+    start = s.start
+    stop = s.stop
+    if s.step == 0:
+        raise ValueError('step argument must be a non-zero integer or None.')
+    step = s.step or 1
+
+    it = iter(iterable)
+
+    if step > 0:
+        start = 0 if (start is None) else start
+
+        if (start < 0):
+            # Consume all but the last -start items
+            cache = deque(enumerate(it, 1), maxlen=-start)
+            len_iter = cache[-1][0] if cache else 0
+
+            # Adjust start to be positive
+            i = max(len_iter + start, 0)
+
+            # Adjust stop to be positive
+            if stop is None:
+                j = len_iter
+            elif stop >= 0:
+                j = min(stop, len_iter)
+            else:
+                j = max(len_iter + stop, 0)
+
+            # Slice the cache
+            n = j - i
+            if n <= 0:
+                return
+
+            for index, item in islice(cache, 0, n, step):
+                yield item
+        elif (stop is not None) and (stop < 0):
+            # Advance to the start position
+            next(islice(it, start, start), None)
+
+            # When stop is negative, we have to carry -stop items while
+            # iterating
+            cache = deque(islice(it, -stop), maxlen=-stop)
+
+            for index, item in enumerate(it):
+                cached_item = cache.popleft()
+                if index % step == 0:
+                    yield cached_item
+                cache.append(item)
+        else:
+            # When both start and stop are positive we have the normal case
+            for item in islice(it, start, stop, step):
+                yield item
+    else:
+        start = -1 if (start is None) else start
+
+        if (stop is not None) and (stop < 0):
+            # Consume all but the last items
+            n = -stop - 1
+            cache = deque(enumerate(it, 1), maxlen=n)
+            len_iter = cache[-1][0] if cache else 0
+
+            # If start and stop are both negative they are comparable and
+            # we can just slice. Otherwise we can adjust start to be negative
+            # and then slice.
+            if start < 0:
+                i, j = start, stop
+            else:
+                i, j = min(start - len_iter, -1), None
+
+            for index, item in list(cache)[i:j:step]:
+                yield item
+        else:
+            # Advance to the stop position
+            if stop is not None:
+                m = stop + 1
+                next(islice(it, m, m), None)
+
+            # stop is positive, so if start is negative they are not comparable
+            # and we need the rest of the items.
+            if start < 0:
+                i = start
+                n = None
+            # stop is None and start is positive, so we just need items up to
+            # the start index.
+            elif stop is None:
+                i = None
+                n = start + 1
+            # Both stop and start are positive, so they are comparable.
+            else:
+                i = None
+                n = start - stop
+                if n <= 0:
+                    return
+
+            cache = list(islice(it, n))
+
+            for item in cache[i::step]:
+                yield item
+
+
+def always_reversible(iterable):
+    """An extension of :func:`reversed` that supports all iterables, not
+    just those which implement the ``Reversible`` or ``Sequence`` protocols.
+
+        >>> print(*always_reversible(x for x in range(3)))
+        2 1 0
+
+    If the iterable is already reversible, this function returns the
+    result of :func:`reversed()`. If the iterable is not reversible,
+    this function will cache the remaining items in the iterable and
+    yield them in reverse order, which may require significant storage.
+    """
+    try:
+        return reversed(iterable)
+    except TypeError:
+        return reversed(list(iterable))
+
+
+def consecutive_groups(iterable, ordering=lambda x: x):
+    """Yield groups of consecutive items using :func:`itertools.groupby`.
+    The *ordering* function determines whether two items are adjacent by
+    returning their position.
+
+    By default, the ordering function is the identity function. This is
+    suitable for finding runs of numbers:
+
+        >>> iterable = [1, 10, 11, 12, 20, 30, 31, 32, 33, 40]
+        >>> for group in consecutive_groups(iterable):
+        ...     print(list(group))
+        [1]
+        [10, 11, 12]
+        [20]
+        [30, 31, 32, 33]
+        [40]
+
+    For finding runs of adjacent letters, try using the :meth:`index` method
+    of a string of letters:
+
+        >>> from string import ascii_lowercase
+        >>> iterable = 'abcdfgilmnop'
+        >>> ordering = ascii_lowercase.index
+        >>> for group in consecutive_groups(iterable, ordering):
+        ...     print(list(group))
+        ['a', 'b', 'c', 'd']
+        ['f', 'g']
+        ['i']
+        ['l', 'm', 'n', 'o', 'p']
+
+    """
+    for k, g in groupby(
+        enumerate(iterable), key=lambda x: x[0] - ordering(x[1])
+    ):
+        yield map(itemgetter(1), g)
+
+
+def difference(iterable, func=sub):
+    """By default, compute the first difference of *iterable* using
+    :func:`operator.sub`.
+
+        >>> iterable = [0, 1, 3, 6, 10]
+        >>> list(difference(iterable))
+        [0, 1, 2, 3, 4]
+
+    This is the opposite of :func:`accumulate`'s default behavior:
+
+        >>> from more_itertools import accumulate
+        >>> iterable = [0, 1, 2, 3, 4]
+        >>> list(accumulate(iterable))
+        [0, 1, 3, 6, 10]
+        >>> list(difference(accumulate(iterable)))
+        [0, 1, 2, 3, 4]
+
+    By default *func* is :func:`operator.sub`, but other functions can be
+    specified. They will be applied as follows::
+
+        A, B, C, D, ... --> A, func(B, A), func(C, B), func(D, C), ...
+
+    For example, to do progressive division:
+
+        >>> iterable = [1, 2, 6, 24, 120]  # Factorial sequence
+        >>> func = lambda x, y: x // y
+        >>> list(difference(iterable, func))
+        [1, 2, 3, 4, 5]
+
+    """
+    a, b = tee(iterable)
+    try:
+        item = next(b)
+    except StopIteration:
+        return iter([])
+    return chain([item], map(lambda x: func(x[1], x[0]), zip(a, b)))
+
+
+class SequenceView(Sequence):
+    """Return a read-only view of the sequence object *target*.
+
+    :class:`SequenceView` objects are analagous to Python's built-in
+    "dictionary view" types. They provide a dynamic view of a sequence's items,
+    meaning that when the sequence updates, so does the view.
+
+        >>> seq = ['0', '1', '2']
+        >>> view = SequenceView(seq)
+        >>> view
+        SequenceView(['0', '1', '2'])
+        >>> seq.append('3')
+        >>> view
+        SequenceView(['0', '1', '2', '3'])
+
+    Sequence views support indexing, slicing, and length queries. They act
+    like the underlying sequence, except they don't allow assignment:
+
+        >>> view[1]
+        '1'
+        >>> view[1:-1]
+        ['1', '2']
+        >>> len(view)
+        4
+
+    Sequence views are useful as an alternative to copying, as they don't
+    require (much) extra storage.
+
+    """
+    def __init__(self, target):
+        if not isinstance(target, Sequence):
+            raise TypeError
+        self._target = target
+
+    def __getitem__(self, index):
+        return self._target[index]
+
+    def __len__(self):
+        return len(self._target)
+
+    def __repr__(self):
+        return '{}({})'.format(self.__class__.__name__, repr(self._target))
+
+
+class seekable(object):
+    """Wrap an iterator to allow for seeking backward and forward. This
+    progressively caches the items in the source iterable so they can be
+    re-visited.
+
+    Call :meth:`seek` with an index to seek to that position in the source
+    iterable.
+
+    To "reset" an iterator, seek to ``0``:
+
+        >>> from itertools import count
+        >>> it = seekable((str(n) for n in count()))
+        >>> next(it), next(it), next(it)
+        ('0', '1', '2')
+        >>> it.seek(0)
+        >>> next(it), next(it), next(it)
+        ('0', '1', '2')
+        >>> next(it)
+        '3'
+
+    You can also seek forward:
+
+        >>> it = seekable((str(n) for n in range(20)))
+        >>> it.seek(10)
+        >>> next(it)
+        '10'
+        >>> it.seek(20)  # Seeking past the end of the source isn't a problem
+        >>> list(it)
+        []
+        >>> it.seek(0)  # Resetting works even after hitting the end
+        >>> next(it), next(it), next(it)
+        ('0', '1', '2')
+
+    The cache grows as the source iterable progresses, so beware of wrapping
+    very large or infinite iterables.
+
+    You may view the contents of the cache with the :meth:`elements` method.
+    That returns a :class:`SequenceView`, a view that updates automatically:
+
+        >>> it = seekable((str(n) for n in range(10)))
+        >>> next(it), next(it), next(it)
+        ('0', '1', '2')
+        >>> elements = it.elements()
+        >>> elements
+        SequenceView(['0', '1', '2'])
+        >>> next(it)
+        '3'
+        >>> elements
+        SequenceView(['0', '1', '2', '3'])
+
+    """
+
+    def __init__(self, iterable):
+        self._source = iter(iterable)
+        self._cache = []
+        self._index = None
+
+    def __iter__(self):
+        return self
+
+    def __next__(self):
+        if self._index is not None:
+            try:
+                item = self._cache[self._index]
+            except IndexError:
+                self._index = None
+            else:
+                self._index += 1
+                return item
+
+        item = next(self._source)
+        self._cache.append(item)
+        return item
+
+    next = __next__
+
+    def elements(self):
+        return SequenceView(self._cache)
+
+    def seek(self, index):
+        self._index = index
+        remainder = index - len(self._cache)
+        if remainder > 0:
+            consume(self, remainder)
+
+
+class run_length(object):
+    """
+    :func:`run_length.encode` compresses an iterable with run-length encoding.
+    It yields groups of repeated items with the count of how many times they
+    were repeated:
+
+        >>> uncompressed = 'abbcccdddd'
+        >>> list(run_length.encode(uncompressed))
+        [('a', 1), ('b', 2), ('c', 3), ('d', 4)]
+
+    :func:`run_length.decode` decompresses an iterable that was previously
+    compressed with run-length encoding. It yields the items of the
+    decompressed iterable:
+
+        >>> compressed = [('a', 1), ('b', 2), ('c', 3), ('d', 4)]
+        >>> list(run_length.decode(compressed))
+        ['a', 'b', 'b', 'c', 'c', 'c', 'd', 'd', 'd', 'd']
+
+    """
+
+    @staticmethod
+    def encode(iterable):
+        return ((k, ilen(g)) for k, g in groupby(iterable))
+
+    @staticmethod
+    def decode(iterable):
+        return chain.from_iterable(repeat(k, n) for k, n in iterable)
+
+
+def exactly_n(iterable, n, predicate=bool):
+    """Return ``True`` if exactly ``n`` items in the iterable are ``True``
+    according to the *predicate* function.
+
+        >>> exactly_n([True, True, False], 2)
+        True
+        >>> exactly_n([True, True, False], 1)
+        False
+        >>> exactly_n([0, 1, 2, 3, 4, 5], 3, lambda x: x < 3)
+        True
+
+    The iterable will be advanced until ``n + 1`` truthy items are encountered,
+    so avoid calling it on infinite iterables.
+
+    """
+    return len(take(n + 1, filter(predicate, iterable))) == n
+
+
+def circular_shifts(iterable):
+    """Return a list of circular shifts of *iterable*.
+
+        >>> circular_shifts(range(4))
+        [(0, 1, 2, 3), (1, 2, 3, 0), (2, 3, 0, 1), (3, 0, 1, 2)]
+    """
+    lst = list(iterable)
+    return take(len(lst), windowed(cycle(lst), len(lst)))
+
+
+def make_decorator(wrapping_func, result_index=0):
+    """Return a decorator version of *wrapping_func*, which is a function that
+    modifies an iterable. *result_index* is the position in that function's
+    signature where the iterable goes.
+
+    This lets you use itertools on the "production end," i.e. at function
+    definition. This can augment what the function returns without changing the
+    function's code.
+
+    For example, to produce a decorator version of :func:`chunked`:
+
+        >>> from more_itertools import chunked
+        >>> chunker = make_decorator(chunked, result_index=0)
+        >>> @chunker(3)
+        ... def iter_range(n):
+        ...     return iter(range(n))
+        ...
+        >>> list(iter_range(9))
+        [[0, 1, 2], [3, 4, 5], [6, 7, 8]]
+
+    To only allow truthy items to be returned:
+
+        >>> truth_serum = make_decorator(filter, result_index=1)
+        >>> @truth_serum(bool)
+        ... def boolean_test():
+        ...     return [0, 1, '', ' ', False, True]
+        ...
+        >>> list(boolean_test())
+        [1, ' ', True]
+
+    The :func:`peekable` and :func:`seekable` wrappers make for practical
+    decorators:
+
+        >>> from more_itertools import peekable
+        >>> peekable_function = make_decorator(peekable)
+        >>> @peekable_function()
+        ... def str_range(*args):
+        ...     return (str(x) for x in range(*args))
+        ...
+        >>> it = str_range(1, 20, 2)
+        >>> next(it), next(it), next(it)
+        ('1', '3', '5')
+        >>> it.peek()
+        '7'
+        >>> next(it)
+        '7'
+
+    """
+    # See https://sites.google.com/site/bbayles/index/decorator_factory for
+    # notes on how this works.
+    def decorator(*wrapping_args, **wrapping_kwargs):
+        def outer_wrapper(f):
+            def inner_wrapper(*args, **kwargs):
+                result = f(*args, **kwargs)
+                wrapping_args_ = list(wrapping_args)
+                wrapping_args_.insert(result_index, result)
+                return wrapping_func(*wrapping_args_, **wrapping_kwargs)
+
+            return inner_wrapper
+
+        return outer_wrapper
+
+    return decorator
+
+
+def map_reduce(iterable, keyfunc, valuefunc=None, reducefunc=None):
+    """Return a dictionary that maps the items in *iterable* to categories
+    defined by *keyfunc*, transforms them with *valuefunc*, and
+    then summarizes them by category with *reducefunc*.
+
+    *valuefunc* defaults to the identity function if it is unspecified.
+    If *reducefunc* is unspecified, no summarization takes place:
+
+        >>> keyfunc = lambda x: x.upper()
+        >>> result = map_reduce('abbccc', keyfunc)
+        >>> sorted(result.items())
+        [('A', ['a']), ('B', ['b', 'b']), ('C', ['c', 'c', 'c'])]
+
+    Specifying *valuefunc* transforms the categorized items:
+
+        >>> keyfunc = lambda x: x.upper()
+        >>> valuefunc = lambda x: 1
+        >>> result = map_reduce('abbccc', keyfunc, valuefunc)
+        >>> sorted(result.items())
+        [('A', [1]), ('B', [1, 1]), ('C', [1, 1, 1])]
+
+    Specifying *reducefunc* summarizes the categorized items:
+
+        >>> keyfunc = lambda x: x.upper()
+        >>> valuefunc = lambda x: 1
+        >>> reducefunc = sum
+        >>> result = map_reduce('abbccc', keyfunc, valuefunc, reducefunc)
+        >>> sorted(result.items())
+        [('A', 1), ('B', 2), ('C', 3)]
+
+    You may want to filter the input iterable before applying the map/reduce
+    proecdure:
+
+        >>> all_items = range(30)
+        >>> items = [x for x in all_items if 10 <= x <= 20]  # Filter
+        >>> keyfunc = lambda x: x % 2  # Evens map to 0; odds to 1
+        >>> categories = map_reduce(items, keyfunc=keyfunc)
+        >>> sorted(categories.items())
+        [(0, [10, 12, 14, 16, 18, 20]), (1, [11, 13, 15, 17, 19])]
+        >>> summaries = map_reduce(items, keyfunc=keyfunc, reducefunc=sum)
+        >>> sorted(summaries.items())
+        [(0, 90), (1, 75)]
+
+    Note that all items in the iterable are gathered into a list before the
+    summarization step, which may require significant storage.
+
+    The returned object is a :obj:`collections.defaultdict` with the
+    ``default_factory`` set to ``None``, such that it behaves like a normal
+    dictionary.
+
+    """
+    valuefunc = (lambda x: x) if (valuefunc is None) else valuefunc
+
+    ret = defaultdict(list)
+    for item in iterable:
+        key = keyfunc(item)
+        value = valuefunc(item)
+        ret[key].append(value)
+
+    if reducefunc is not None:
+        for key, value_list in ret.items():
+            ret[key] = reducefunc(value_list)
+
+    ret.default_factory = None
+    return ret
new file mode 100644
--- /dev/null
+++ b/third_party/python/more-itertools/more_itertools/recipes.py
@@ -0,0 +1,565 @@
+"""Imported from the recipes section of the itertools documentation.
+
+All functions taken from the recipes section of the itertools library docs
+[1]_.
+Some backward-compatible usability improvements have been made.
+
+.. [1] http://docs.python.org/library/itertools.html#recipes
+
+"""
+from collections import deque
+from itertools import (
+    chain, combinations, count, cycle, groupby, islice, repeat, starmap, tee
+)
+import operator
+from random import randrange, sample, choice
+
+from six import PY2
+from six.moves import filter, filterfalse, map, range, zip, zip_longest
+
+__all__ = [
+    'accumulate',
+    'all_equal',
+    'consume',
+    'dotproduct',
+    'first_true',
+    'flatten',
+    'grouper',
+    'iter_except',
+    'ncycles',
+    'nth',
+    'nth_combination',
+    'padnone',
+    'pairwise',
+    'partition',
+    'powerset',
+    'prepend',
+    'quantify',
+    'random_combination_with_replacement',
+    'random_combination',
+    'random_permutation',
+    'random_product',
+    'repeatfunc',
+    'roundrobin',
+    'tabulate',
+    'tail',
+    'take',
+    'unique_everseen',
+    'unique_justseen',
+]
+
+
+def accumulate(iterable, func=operator.add):
+    """
+    Return an iterator whose items are the accumulated results of a function
+    (specified by the optional *func* argument) that takes two arguments.
+    By default, returns accumulated sums with :func:`operator.add`.
+
+        >>> list(accumulate([1, 2, 3, 4, 5]))  # Running sum
+        [1, 3, 6, 10, 15]
+        >>> list(accumulate([1, 2, 3], func=operator.mul))  # Running product
+        [1, 2, 6]
+        >>> list(accumulate([0, 1, -1, 2, 3, 2], func=max))  # Running maximum
+        [0, 1, 1, 2, 3, 3]
+
+    This function is available in the ``itertools`` module for Python 3.2 and
+    greater.
+
+    """
+    it = iter(iterable)
+    try:
+        total = next(it)
+    except StopIteration:
+        return
+    else:
+        yield total
+
+    for element in it:
+        total = func(total, element)
+        yield total
+
+
+def take(n, iterable):
+    """Return first *n* items of the iterable as a list.
+
+        >>> take(3, range(10))
+        [0, 1, 2]
+        >>> take(5, range(3))
+        [0, 1, 2]
+
+    Effectively a short replacement for ``next`` based iterator consumption
+    when you want more than one item, but less than the whole iterator.
+
+    """
+    return list(islice(iterable, n))
+
+
+def tabulate(function, start=0):
+    """Return an iterator over the results of ``func(start)``,
+    ``func(start + 1)``, ``func(start + 2)``...
+
+    *func* should be a function that accepts one integer argument.
+
+    If *start* is not specified it defaults to 0. It will be incremented each
+    time the iterator is advanced.
+
+        >>> square = lambda x: x ** 2
+        >>> iterator = tabulate(square, -3)
+        >>> take(4, iterator)
+        [9, 4, 1, 0]
+
+    """
+    return map(function, count(start))
+
+
+def tail(n, iterable):
+    """Return an iterator over the last *n* items of *iterable*.
+
+        >>> t = tail(3, 'ABCDEFG')
+        >>> list(t)
+        ['E', 'F', 'G']
+
+    """
+    return iter(deque(iterable, maxlen=n))
+
+
+def consume(iterator, n=None):
+    """Advance *iterable* by *n* steps. If *n* is ``None``, consume it
+    entirely.
+
+    Efficiently exhausts an iterator without returning values. Defaults to
+    consuming the whole iterator, but an optional second argument may be
+    provided to limit consumption.
+
+        >>> i = (x for x in range(10))
+        >>> next(i)
+        0
+        >>> consume(i, 3)
+        >>> next(i)
+        4
+        >>> consume(i)
+        >>> next(i)
+        Traceback (most recent call last):
+          File "<stdin>", line 1, in <module>
+        StopIteration
+
+    If the iterator has fewer items remaining than the provided limit, the
+    whole iterator will be consumed.
+
+        >>> i = (x for x in range(3))
+        >>> consume(i, 5)
+        >>> next(i)
+        Traceback (most recent call last):
+          File "<stdin>", line 1, in <module>
+        StopIteration
+
+    """
+    # Use functions that consume iterators at C speed.
+    if n is None:
+        # feed the entire iterator into a zero-length deque
+        deque(iterator, maxlen=0)
+    else:
+        # advance to the empty slice starting at position n
+        next(islice(iterator, n, n), None)
+
+
+def nth(iterable, n, default=None):
+    """Returns the nth item or a default value.
+
+        >>> l = range(10)
+        >>> nth(l, 3)
+        3
+        >>> nth(l, 20, "zebra")
+        'zebra'
+
+    """
+    return next(islice(iterable, n, None), default)
+
+
+def all_equal(iterable):
+    """
+    Returns ``True`` if all the elements are equal to each other.
+
+        >>> all_equal('aaaa')
+        True
+        >>> all_equal('aaab')
+        False
+
+    """
+    g = groupby(iterable)
+    return next(g, True) and not next(g, False)
+
+
+def quantify(iterable, pred=bool):
+    """Return the how many times the predicate is true.
+
+        >>> quantify([True, False, True])
+        2
+
+    """
+    return sum(map(pred, iterable))
+
+
+def padnone(iterable):
+    """Returns the sequence of elements and then returns ``None`` indefinitely.
+
+        >>> take(5, padnone(range(3)))
+        [0, 1, 2, None, None]
+
+    Useful for emulating the behavior of the built-in :func:`map` function.
+
+    See also :func:`padded`.
+
+    """
+    return chain(iterable, repeat(None))
+
+
+def ncycles(iterable, n):
+    """Returns the sequence elements *n* times
+
+        >>> list(ncycles(["a", "b"], 3))
+        ['a', 'b', 'a', 'b', 'a', 'b']
+
+    """
+    return chain.from_iterable(repeat(tuple(iterable), n))
+
+
+def dotproduct(vec1, vec2):
+    """Returns the dot product of the two iterables.
+
+        >>> dotproduct([10, 10], [20, 20])
+        400
+
+    """
+    return sum(map(operator.mul, vec1, vec2))
+
+
+def flatten(listOfLists):
+    """Return an iterator flattening one level of nesting in a list of lists.
+
+        >>> list(flatten([[0, 1], [2, 3]]))
+        [0, 1, 2, 3]
+
+    See also :func:`collapse`, which can flatten multiple levels of nesting.
+
+    """
+    return chain.from_iterable(listOfLists)
+
+
+def repeatfunc(func, times=None, *args):
+    """Call *func* with *args* repeatedly, returning an iterable over the
+    results.
+
+    If *times* is specified, the iterable will terminate after that many
+    repetitions:
+
+        >>> from operator import add
+        >>> times = 4
+        >>> args = 3, 5
+        >>> list(repeatfunc(add, times, *args))
+        [8, 8, 8, 8]
+
+    If *times* is ``None`` the iterable will not terminate:
+
+        >>> from random import randrange
+        >>> times = None
+        >>> args = 1, 11
+        >>> take(6, repeatfunc(randrange, times, *args))  # doctest:+SKIP
+        [2, 4, 8, 1, 8, 4]
+
+    """
+    if times is None:
+        return starmap(func, repeat(args))
+    return starmap(func, repeat(args, times))
+
+
+def pairwise(iterable):
+    """Returns an iterator of paired items, overlapping, from the original
+
+        >>> take(4, pairwise(count()))
+        [(0, 1), (1, 2), (2, 3), (3, 4)]
+
+    """
+    a, b = tee(iterable)
+    next(b, None)
+    return zip(a, b)
+
+
+def grouper(n, iterable, fillvalue=None):
+    """Collect data into fixed-length chunks or blocks.
+
+        >>> list(grouper(3, 'ABCDEFG', 'x'))
+        [('A', 'B', 'C'), ('D', 'E', 'F'), ('G', 'x', 'x')]
+
+    """
+    args = [iter(iterable)] * n
+    return zip_longest(fillvalue=fillvalue, *args)
+
+
+def roundrobin(*iterables):
+    """Yields an item from each iterable, alternating between them.
+
+        >>> list(roundrobin('ABC', 'D', 'EF'))
+        ['A', 'D', 'E', 'B', 'F', 'C']
+
+    This function produces the same output as :func:`interleave_longest`, but
+    may perform better for some inputs (in particular when the number of
+    iterables is small).
+
+    """
+    # Recipe credited to George Sakkis
+    pending = len(iterables)
+    if PY2:
+        nexts = cycle(iter(it).next for it in iterables)
+    else:
+        nexts = cycle(iter(it).__next__ for it in iterables)
+    while pending:
+        try:
+            for next in nexts:
+                yield next()
+        except StopIteration:
+            pending -= 1
+            nexts = cycle(islice(nexts, pending))
+
+
+def partition(pred, iterable):
+    """
+    Returns a 2-tuple of iterables derived from the input iterable.
+    The first yields the items that have ``pred(item) == False``.
+    The second yields the items that have ``pred(item) == True``.
+
+        >>> is_odd = lambda x: x % 2 != 0
+        >>> iterable = range(10)
+        >>> even_items, odd_items = partition(is_odd, iterable)
+        >>> list(even_items), list(odd_items)
+        ([0, 2, 4, 6, 8], [1, 3, 5, 7, 9])
+
+    """
+    # partition(is_odd, range(10)) --> 0 2 4 6 8   and  1 3 5 7 9
+    t1, t2 = tee(iterable)
+    return filterfalse(pred, t1), filter(pred, t2)
+
+
+def powerset(iterable):
+    """Yields all possible subsets of the iterable.
+
+        >>> list(powerset([1,2,3]))
+        [(), (1,), (2,), (3,), (1, 2), (1, 3), (2, 3), (1, 2, 3)]
+
+    """
+    s = list(iterable)
+    return chain.from_iterable(combinations(s, r) for r in range(len(s) + 1))
+
+
+def unique_everseen(iterable, key=None):
+    """
+    Yield unique elements, preserving order.
+
+        >>> list(unique_everseen('AAAABBBCCDAABBB'))
+        ['A', 'B', 'C', 'D']
+        >>> list(unique_everseen('ABBCcAD', str.lower))
+        ['A', 'B', 'C', 'D']
+
+    Sequences with a mix of hashable and unhashable items can be used.
+    The function will be slower (i.e., `O(n^2)`) for unhashable items.
+
+    """
+    seenset = set()
+    seenset_add = seenset.add
+    seenlist = []
+    seenlist_add = seenlist.append
+    if key is None:
+        for element in iterable:
+            try:
+                if element not in seenset:
+                    seenset_add(element)
+                    yield element
+            except TypeError:
+                if element not in seenlist:
+                    seenlist_add(element)
+                    yield element
+    else:
+        for element in iterable:
+            k = key(element)
+            try:
+                if k not in seenset:
+                    seenset_add(k)
+                    yield element
+            except TypeError:
+                if k not in seenlist:
+                    seenlist_add(k)
+                    yield element
+
+
+def unique_justseen(iterable, key=None):
+    """Yields elements in order, ignoring serial duplicates
+
+        >>> list(unique_justseen('AAAABBBCCDAABBB'))
+        ['A', 'B', 'C', 'D', 'A', 'B']
+        >>> list(unique_justseen('ABBCcAD', str.lower))
+        ['A', 'B', 'C', 'A', 'D']
+
+    """
+    return map(next, map(operator.itemgetter(1), groupby(iterable, key)))
+
+
+def iter_except(func, exception, first=None):
+    """Yields results from a function repeatedly until an exception is raised.
+
+    Converts a call-until-exception interface to an iterator interface.
+    Like ``iter(func, sentinel)``, but uses an exception instead of a sentinel
+    to end the loop.
+
+        >>> l = [0, 1, 2]
+        >>> list(iter_except(l.pop, IndexError))
+        [2, 1, 0]
+
+    """
+    try:
+        if first is not None:
+            yield first()
+        while 1:
+            yield func()
+    except exception:
+        pass
+
+
+def first_true(iterable, default=False, pred=None):
+    """
+    Returns the first true value in the iterable.
+
+    If no true value is found, returns *default*
+
+    If *pred* is not None, returns the first item for which
+    ``pred(item) == True`` .
+
+        >>> first_true(range(10))
+        1
+        >>> first_true(range(10), pred=lambda x: x > 5)
+        6
+        >>> first_true(range(10), default='missing', pred=lambda x: x > 9)
+        'missing'
+
+    """
+    return next(filter(pred, iterable), default)
+
+
+def random_product(*args, **kwds):
+    """Draw an item at random from each of the input iterables.
+
+        >>> random_product('abc', range(4), 'XYZ')  # doctest:+SKIP
+        ('c', 3, 'Z')
+
+    If *repeat* is provided as a keyword argument, that many items will be
+    drawn from each iterable.
+
+        >>> random_product('abcd', range(4), repeat=2)  # doctest:+SKIP
+        ('a', 2, 'd', 3)
+
+    This equivalent to taking a random selection from
+    ``itertools.product(*args, **kwarg)``.
+
+    """
+    pools = [tuple(pool) for pool in args] * kwds.get('repeat', 1)
+    return tuple(choice(pool) for pool in pools)
+
+
+def random_permutation(iterable, r=None):
+    """Return a random *r* length permutation of the elements in *iterable*.
+
+    If *r* is not specified or is ``None``, then *r* defaults to the length of
+    *iterable*.
+
+        >>> random_permutation(range(5))  # doctest:+SKIP
+        (3, 4, 0, 1, 2)
+
+    This equivalent to taking a random selection from
+    ``itertools.permutations(iterable, r)``.
+
+    """
+    pool = tuple(iterable)
+    r = len(pool) if r is None else r
+    return tuple(sample(pool, r))
+
+
+def random_combination(iterable, r):
+    """Return a random *r* length subsequence of the elements in *iterable*.
+
+        >>> random_combination(range(5), 3)  # doctest:+SKIP
+        (2, 3, 4)
+
+    This equivalent to taking a random selection from
+    ``itertools.combinations(iterable, r)``.
+
+    """
+    pool = tuple(iterable)
+    n = len(pool)
+    indices = sorted(sample(range(n), r))
+    return tuple(pool[i] for i in indices)
+
+
+def random_combination_with_replacement(iterable, r):
+    """Return a random *r* length subsequence of elements in *iterable*,
+    allowing individual elements to be repeated.
+
+        >>> random_combination_with_replacement(range(3), 5) # doctest:+SKIP
+        (0, 0, 1, 2, 2)
+
+    This equivalent to taking a random selection from
+    ``itertools.combinations_with_replacement(iterable, r)``.
+
+    """
+    pool = tuple(iterable)
+    n = len(pool)
+    indices = sorted(randrange(n) for i in range(r))
+    return tuple(pool[i] for i in indices)
+
+
+def nth_combination(iterable, r, index):
+    """Equivalent to ``list(combinations(iterable, r))[index]``.
+
+    The subsequences of *iterable* that are of length *r* can be ordered
+    lexicographically. :func:`nth_combination` computes the subsequence at
+    sort position *index* directly, without computing the previous
+    subsequences.
+
+    """
+    pool = tuple(iterable)
+    n = len(pool)
+    if (r < 0) or (r > n):
+        raise ValueError
+
+    c = 1
+    k = min(r, n - r)
+    for i in range(1, k + 1):
+        c = c * (n - k + i) // i
+
+    if index < 0:
+        index += c
+
+    if (index < 0) or (index >= c):
+        raise IndexError
+
+    result = []
+    while r:
+        c, n, r = c * r // n, n - 1, r - 1
+        while index >= c:
+            index -= c
+            c, n = c * (n - r) // n, n - 1
+        result.append(pool[-1 - n])
+
+    return tuple(result)
+
+
+def prepend(value, iterator):
+    """Yield *value*, followed by the elements in *iterator*.
+
+        >>> value = '0'
+        >>> iterator = ['1', '2', '3']
+        >>> list(prepend(value, iterator))
+        ['0', '1', '2', '3']
+
+    To prepend multiple values, see :func:`itertools.chain`.
+
+    """
+    return chain([value], iterator)
new file mode 100644
new file mode 100644
--- /dev/null
+++ b/third_party/python/more-itertools/more_itertools/tests/test_more.py
@@ -0,0 +1,1848 @@
+from __future__ import division, print_function, unicode_literals
+
+from decimal import Decimal
+from doctest import DocTestSuite
+from fractions import Fraction
+from functools import partial, reduce
+from heapq import merge
+from io import StringIO
+from itertools import (
+    chain,
+    count,
+    groupby,
+    islice,
+    permutations,
+    product,
+    repeat,
+)
+from operator import add, mul, itemgetter
+from unittest import TestCase
+
+from six.moves import filter, map, range, zip
+
+import more_itertools as mi
+
+
+def load_tests(loader, tests, ignore):
+    # Add the doctests
+    tests.addTests(DocTestSuite('more_itertools.more'))
+    return tests
+
+
+class CollateTests(TestCase):
+    """Unit tests for ``collate()``"""
+    # Also accidentally tests peekable, though that could use its own tests
+
+    def test_default(self):
+        """Test with the default `key` function."""
+        iterables = [range(4), range(7), range(3, 6)]
+        self.assertEqual(
+            sorted(reduce(list.__add__, [list(it) for it in iterables])),
+            list(mi.collate(*iterables))
+        )
+
+    def test_key(self):
+        """Test using a custom `key` function."""
+        iterables = [range(5, 0, -1), range(4, 0, -1)]
+        actual = sorted(
+            reduce(list.__add__, [list(it) for it in iterables]), reverse=True
+        )
+        expected = list(mi.collate(*iterables, key=lambda x: -x))
+        self.assertEqual(actual, expected)
+
+    def test_empty(self):
+        """Be nice if passed an empty list of iterables."""
+        self.assertEqual([], list(mi.collate()))
+
+    def test_one(self):
+        """Work when only 1 iterable is passed."""
+        self.assertEqual([0, 1], list(mi.collate(range(2))))
+
+    def test_reverse(self):
+        """Test the `reverse` kwarg."""
+        iterables = [range(4, 0, -1), range(7, 0, -1), range(3, 6, -1)]
+
+        actual = sorted(
+            reduce(list.__add__, [list(it) for it in iterables]), reverse=True
+        )
+        expected = list(mi.collate(*iterables, reverse=True))
+        self.assertEqual(actual, expected)
+
+    def test_alias(self):
+        self.assertNotEqual(merge.__doc__, mi.collate.__doc__)
+        self.assertNotEqual(partial.__doc__, mi.collate.__doc__)
+
+
+class ChunkedTests(TestCase):
+    """Tests for ``chunked()``"""
+
+    def test_even(self):
+        """Test when ``n`` divides evenly into the length of the iterable."""
+        self.assertEqual(
+            list(mi.chunked('ABCDEF', 3)), [['A', 'B', 'C'], ['D', 'E', 'F']]
+        )
+
+    def test_odd(self):
+        """Test when ``n`` does not divide evenly into the length of the
+        iterable.
+
+        """
+        self.assertEqual(
+            list(mi.chunked('ABCDE', 3)), [['A', 'B', 'C'], ['D', 'E']]
+        )
+
+
+class FirstTests(TestCase):
+    """Tests for ``first()``"""
+
+    def test_many(self):
+        """Test that it works on many-item iterables."""
+        # Also try it on a generator expression to make sure it works on
+        # whatever those return, across Python versions.
+        self.assertEqual(mi.first(x for x in range(4)), 0)
+
+    def test_one(self):
+        """Test that it doesn't raise StopIteration prematurely."""
+        self.assertEqual(mi.first([3]), 3)
+
+    def test_empty_stop_iteration(self):
+        """It should raise StopIteration for empty iterables."""
+        self.assertRaises(ValueError, lambda: mi.first([]))
+
+    def test_default(self):
+        """It should return the provided default arg for empty iterables."""
+        self.assertEqual(mi.first([], 'boo'), 'boo')
+
+
+class PeekableTests(TestCase):
+    """Tests for ``peekable()`` behavor not incidentally covered by testing
+    ``collate()``
+
+    """
+    def test_peek_default(self):
+        """Make sure passing a default into ``peek()`` works."""
+        p = mi.peekable([])
+        self.assertEqual(p.peek(7), 7)
+
+    def test_truthiness(self):
+        """Make sure a ``peekable`` tests true iff there are items remaining in
+        the iterable.
+
+        """
+        p = mi.peekable([])
+        self.assertFalse(p)
+
+        p = mi.peekable(range(3))
+        self.assertTrue(p)
+
+    def test_simple_peeking(self):
+        """Make sure ``next`` and ``peek`` advance and don't advance the
+        iterator, respectively.
+
+        """
+        p = mi.peekable(range(10))
+        self.assertEqual(next(p), 0)
+        self.assertEqual(p.peek(), 1)
+        self.assertEqual(next(p), 1)
+
+    def test_indexing(self):
+        """
+        Indexing into the peekable shouldn't advance the iterator.
+        """
+        p = mi.peekable('abcdefghijkl')
+
+        # The 0th index is what ``next()`` will return
+        self.assertEqual(p[0], 'a')
+        self.assertEqual(next(p), 'a')
+
+        # Indexing further into the peekable shouldn't advance the itertor
+        self.assertEqual(p[2], 'd')
+        self.assertEqual(next(p), 'b')
+
+        # The 0th index moves up with the iterator; the last index follows
+        self.assertEqual(p[0], 'c')
+        self.assertEqual(p[9], 'l')
+
+        self.assertEqual(next(p), 'c')
+        self.assertEqual(p[8], 'l')
+
+        # Negative indexing should work too
+        self.assertEqual(p[-2], 'k')
+        self.assertEqual(p[-9], 'd')
+        self.assertRaises(IndexError, lambda: p[-10])
+
+    def test_slicing(self):
+        """Slicing the peekable shouldn't advance the iterator."""
+        seq = list('abcdefghijkl')
+        p = mi.peekable(seq)
+
+        # Slicing the peekable should just be like slicing a re-iterable
+        self.assertEqual(p[1:4], seq[1:4])
+
+        # Advancing the iterator moves the slices up also
+        self.assertEqual(next(p), 'a')
+        self.assertEqual(p[1:4], seq[1:][1:4])
+
+        # Implicit starts and stop should work
+        self.assertEqual(p[:5], seq[1:][:5])
+        self.assertEqual(p[:], seq[1:][:])
+
+        # Indexing past the end should work
+        self.assertEqual(p[:100], seq[1:][:100])
+
+        # Steps should work, including negative
+        self.assertEqual(p[::2], seq[1:][::2])
+        self.assertEqual(p[::-1], seq[1:][::-1])
+
+    def test_slicing_reset(self):
+        """Test slicing on a fresh iterable each time"""
+        iterable = ['0', '1', '2', '3', '4', '5']
+        indexes = list(range(-4, len(iterable) + 4)) + [None]
+        steps = [1, 2, 3, 4, -1, -2, -3, 4]
+        for slice_args in product(indexes, indexes, steps):
+            it = iter(iterable)
+            p = mi.peekable(it)
+            next(p)
+            index = slice(*slice_args)
+            actual = p[index]
+            expected = iterable[1:][index]
+            self.assertEqual(actual, expected, slice_args)
+
+    def test_slicing_error(self):
+        iterable = '01234567'
+        p = mi.peekable(iter(iterable))
+
+        # Prime the cache
+        p.peek()
+        old_cache = list(p._cache)
+
+        # Illegal slice
+        with self.assertRaises(ValueError):
+            p[1:-1:0]
+
+        # Neither the cache nor the iteration should be affected
+        self.assertEqual(old_cache, list(p._cache))
+        self.assertEqual(list(p), list(iterable))
+
+    def test_passthrough(self):
+        """Iterating a peekable without using ``peek()`` or ``prepend()``
+        should just give the underlying iterable's elements (a trivial test but
+        useful to set a baseline in case something goes wrong)"""
+        expected = [1, 2, 3, 4, 5]
+        actual = list(mi.peekable(expected))
+        self.assertEqual(actual, expected)
+
+    # prepend() behavior tests
+
+    def test_prepend(self):
+        """Tests intersperesed ``prepend()`` and ``next()`` calls"""
+        it = mi.peekable(range(2))
+        actual = []
+
+        # Test prepend() before next()
+        it.prepend(10)
+        actual += [next(it), next(it)]
+
+        # Test prepend() between next()s
+        it.prepend(11)
+        actual += [next(it), next(it)]
+
+        # Test prepend() after source iterable is consumed
+        it.prepend(12)
+        actual += [next(it)]
+
+        expected = [10, 0, 11, 1, 12]
+        self.assertEqual(actual, expected)
+
+    def test_multi_prepend(self):
+        """Tests prepending multiple items and getting them in proper order"""
+        it = mi.peekable(range(5))
+        actual = [next(it), next(it)]
+        it.prepend(10, 11, 12)
+        it.prepend(20, 21)
+        actual += list(it)
+        expected = [0, 1, 20, 21, 10, 11, 12, 2, 3, 4]
+        self.assertEqual(actual, expected)
+
+    def test_empty(self):
+        """Tests prepending in front of an empty iterable"""
+        it = mi.peekable([])
+        it.prepend(10)
+        actual = list(it)
+        expected = [10]
+        self.assertEqual(actual, expected)
+
+    def test_prepend_truthiness(self):
+        """Tests that ``__bool__()`` or ``__nonzero__()`` works properly
+        with ``prepend()``"""
+        it = mi.peekable(range(5))
+        self.assertTrue(it)
+        actual = list(it)
+        self.assertFalse(it)
+        it.prepend(10)
+        self.assertTrue(it)
+        actual += [next(it)]
+        self.assertFalse(it)
+        expected = [0, 1, 2, 3, 4, 10]
+        self.assertEqual(actual, expected)
+
+    def test_multi_prepend_peek(self):
+        """Tests prepending multiple elements and getting them in reverse order
+        while peeking"""
+        it = mi.peekable(range(5))
+        actual = [next(it), next(it)]
+        self.assertEqual(it.peek(), 2)
+        it.prepend(10, 11, 12)
+        self.assertEqual(it.peek(), 10)
+        it.prepend(20, 21)
+        self.assertEqual(it.peek(), 20)
+        actual += list(it)
+        self.assertFalse(it)
+        expected = [0, 1, 20, 21, 10, 11, 12, 2, 3, 4]
+        self.assertEqual(actual, expected)
+
+    def test_prepend_after_stop(self):
+        """Test resuming iteration after a previous exhaustion"""
+        it = mi.peekable(range(3))
+        self.assertEqual(list(it), [0, 1, 2])
+        self.assertRaises(StopIteration, lambda: next(it))
+        it.prepend(10)
+        self.assertEqual(next(it), 10)
+        self.assertRaises(StopIteration, lambda: next(it))
+
+    def test_prepend_slicing(self):
+        """Tests interaction between prepending and slicing"""
+        seq = list(range(20))
+        p = mi.peekable(seq)
+
+        p.prepend(30, 40, 50)
+        pseq = [30, 40, 50] + seq  # pseq for prepended_seq
+
+        # adapt the specific tests from test_slicing
+        self.assertEqual(p[0], 30)
+        self.assertEqual(p[1:8], pseq[1:8])
+        self.assertEqual(p[1:], pseq[1:])
+        self.assertEqual(p[:5], pseq[:5])
+        self.assertEqual(p[:], pseq[:])
+        self.assertEqual(p[:100], pseq[:100])
+        self.assertEqual(p[::2], pseq[::2])
+        self.assertEqual(p[::-1], pseq[::-1])
+
+    def test_prepend_indexing(self):
+        """Tests interaction between prepending and indexing"""
+        seq = list(range(20))
+        p = mi.peekable(seq)
+
+        p.prepend(30, 40, 50)
+
+        self.assertEqual(p[0], 30)
+        self.assertEqual(next(p), 30)
+        self.assertEqual(p[2], 0)
+        self.assertEqual(next(p), 40)
+        self.assertEqual(p[0], 50)
+        self.assertEqual(p[9], 8)
+        self.assertEqual(next(p), 50)
+        self.assertEqual(p[8], 8)
+        self.assertEqual(p[-2], 18)
+        self.assertEqual(p[-9], 11)
+        self.assertRaises(IndexError, lambda: p[-21])
+
+    def test_prepend_iterable(self):
+        """Tests prepending from an iterable"""
+        it = mi.peekable(range(5))
+        # Don't directly use the range() object to avoid any range-specific
+        # optimizations
+        it.prepend(*(x for x in range(5)))
+        actual = list(it)
+        expected = list(chain(range(5), range(5)))
+        self.assertEqual(actual, expected)
+
+    def test_prepend_many(self):
+        """Tests that prepending a huge number of elements works"""
+        it = mi.peekable(range(5))
+        # Don't directly use the range() object to avoid any range-specific
+        # optimizations
+        it.prepend(*(x for x in range(20000)))
+        actual = list(it)
+        expected = list(chain(range(20000), range(5)))
+        self.assertEqual(actual, expected)
+
+    def test_prepend_reversed(self):
+        """Tests prepending from a reversed iterable"""
+        it = mi.peekable(range(3))
+        it.prepend(*reversed((10, 11, 12)))
+        actual = list(it)
+        expected = [12, 11, 10, 0, 1, 2]
+        self.assertEqual(actual, expected)
+
+
+class ConsumerTests(TestCase):
+    """Tests for ``consumer()``"""
+
+    def test_consumer(self):
+        @mi.consumer
+        def eater():
+            while True:
+                x = yield  # noqa
+
+        e = eater()
+        e.send('hi')  # without @consumer, would raise TypeError
+
+
+class DistinctPermutationsTests(TestCase):
+    def test_distinct_permutations(self):
+        """Make sure the output for ``distinct_permutations()`` is the same as
+        set(permutations(it)).
+
+        """
+        iterable = ['z', 'a', 'a', 'q', 'q', 'q', 'y']
+        test_output = sorted(mi.distinct_permutations(iterable))
+        ref_output = sorted(set(permutations(iterable)))
+        self.assertEqual(test_output, ref_output)
+
+    def test_other_iterables(self):
+        """Make sure ``distinct_permutations()`` accepts a different type of
+        iterables.
+
+        """
+        # a generator
+        iterable = (c for c in ['z', 'a', 'a', 'q', 'q', 'q', 'y'])
+        test_output = sorted(mi.distinct_permutations(iterable))
+        # "reload" it
+        iterable = (c for c in ['z', 'a', 'a', 'q', 'q', 'q', 'y'])
+        ref_output = sorted(set(permutations(iterable)))
+        self.assertEqual(test_output, ref_output)
+
+        # an iterator
+        iterable = iter(['z', 'a', 'a', 'q', 'q', 'q', 'y'])
+        test_output = sorted(mi.distinct_permutations(iterable))
+        # "reload" it
+        iterable = iter(['z', 'a', 'a', 'q', 'q', 'q', 'y'])
+        ref_output = sorted(set(permutations(iterable)))
+        self.assertEqual(test_output, ref_output)
+
+
+class IlenTests(TestCase):
+    def test_ilen(self):
+        """Sanity-checks for ``ilen()``."""
+        # Non-empty
+        self.assertEqual(
+            mi.ilen(filter(lambda x: x % 10 == 0, range(101))), 11
+        )
+
+        # Empty
+        self.assertEqual(mi.ilen((x for x in range(0))), 0)
+
+        # Iterable with __len__
+        self.assertEqual(mi.ilen(list(range(6))), 6)
+
+
+class WithIterTests(TestCase):
+    def test_with_iter(self):
+        s = StringIO('One fish\nTwo fish')
+        initial_words = [line.split()[0] for line in mi.with_iter(s)]
+
+        # Iterable's items should be faithfully represented
+        self.assertEqual(initial_words, ['One', 'Two'])
+        # The file object should be closed
+        self.assertEqual(s.closed, True)
+
+
+class OneTests(TestCase):
+    def test_basic(self):
+        it = iter(['item'])
+        self.assertEqual(mi.one(it), 'item')
+
+    def test_too_short(self):
+        it = iter([])
+        self.assertRaises(ValueError, lambda: mi.one(it))
+        self.assertRaises(IndexError, lambda: mi.one(it, too_short=IndexError))
+
+    def test_too_long(self):
+        it = count()
+        self.assertRaises(ValueError, lambda: mi.one(it))  # burn 0 and 1
+        self.assertEqual(next(it), 2)
+        self.assertRaises(
+            OverflowError, lambda: mi.one(it, too_long=OverflowError)
+        )
+
+
+class IntersperseTest(TestCase):
+    """ Tests for intersperse() """
+
+    def test_even(self):
+        iterable = (x for x in '01')
+        self.assertEqual(
+            list(mi.intersperse(None, iterable)), ['0', None, '1']
+        )
+
+    def test_odd(self):
+        iterable = (x for x in '012')
+        self.assertEqual(
+            list(mi.intersperse(None, iterable)), ['0', None, '1', None, '2']
+        )
+
+    def test_nested(self):
+        element = ('a', 'b')
+        iterable = (x for x in '012')
+        actual = list(mi.intersperse(element, iterable))
+        expected = ['0', ('a', 'b'), '1', ('a', 'b'), '2']
+        self.assertEqual(actual, expected)
+
+    def test_not_iterable(self):
+        self.assertRaises(TypeError, lambda: mi.intersperse('x', 1))
+
+    def test_n(self):
+        for n, element, expected in [
+            (1, '_', ['0', '_', '1', '_', '2', '_', '3', '_', '4', '_', '5']),
+            (2, '_', ['0', '1', '_', '2', '3', '_', '4', '5']),
+            (3, '_', ['0', '1', '2', '_', '3', '4', '5']),
+            (4, '_', ['0', '1', '2', '3', '_', '4', '5']),
+            (5, '_', ['0', '1', '2', '3', '4', '_', '5']),
+            (6, '_', ['0', '1', '2', '3', '4', '5']),
+            (7, '_', ['0', '1', '2', '3', '4', '5']),
+            (3, ['a', 'b'], ['0', '1', '2', ['a', 'b'], '3', '4', '5']),
+        ]:
+            iterable = (x for x in '012345')
+            actual = list(mi.intersperse(element, iterable, n=n))
+            self.assertEqual(actual, expected)
+
+    def test_n_zero(self):
+        self.assertRaises(
+            ValueError, lambda: list(mi.intersperse('x', '012', n=0))
+        )
+
+
+class UniqueToEachTests(TestCase):
+    """Tests for ``unique_to_each()``"""
+
+    def test_all_unique(self):
+        """When all the input iterables are unique the output should match
+        the input."""
+        iterables = [[1, 2], [3, 4, 5], [6, 7, 8]]
+        self.assertEqual(mi.unique_to_each(*iterables), iterables)
+
+    def test_duplicates(self):
+        """When there are duplicates in any of the input iterables that aren't
+        in the rest, those duplicates should be emitted."""
+        iterables = ["mississippi", "missouri"]
+        self.assertEqual(
+            mi.unique_to_each(*iterables), [['p', 'p'], ['o', 'u', 'r']]
+        )
+
+    def test_mixed(self):
+        """When the input iterables contain different types the function should
+        still behave properly"""
+        iterables = ['x', (i for i in range(3)), [1, 2, 3], tuple()]
+        self.assertEqual(mi.unique_to_each(*iterables), [['x'], [0], [3], []])
+
+
+class WindowedTests(TestCase):
+    """Tests for ``windowed()``"""
+
+    def test_basic(self):
+        actual = list(mi.windowed([1, 2, 3, 4, 5], 3))
+        expected = [(1, 2, 3), (2, 3, 4), (3, 4, 5)]
+        self.assertEqual(actual, expected)
+
+    def test_large_size(self):
+        """
+        When the window size is larger than the iterable, and no fill value is
+        given,``None`` should be filled in.
+        """
+        actual = list(mi.windowed([1, 2, 3, 4, 5], 6))
+        expected = [(1, 2, 3, 4, 5, None)]
+        self.assertEqual(actual, expected)
+
+    def test_fillvalue(self):
+        """
+        When sizes don't match evenly, the given fill value should be used.
+        """
+        iterable = [1, 2, 3, 4, 5]
+
+        for n, kwargs, expected in [
+            (6, {}, [(1, 2, 3, 4, 5, '!')]),  # n > len(iterable)
+            (3, {'step': 3}, [(1, 2, 3), (4, 5, '!')]),  # using ``step``
+        ]:
+            actual = list(mi.windowed(iterable, n, fillvalue='!', **kwargs))
+            self.assertEqual(actual, expected)
+
+    def test_zero(self):
+        """When the window size is zero, an empty tuple should be emitted."""
+        actual = list(mi.windowed([1, 2, 3, 4, 5], 0))
+        expected = [tuple()]
+        self.assertEqual(actual, expected)
+
+    def test_negative(self):
+        """When the window size is negative, ValueError should be raised."""
+        with self.assertRaises(ValueError):
+            list(mi.windowed([1, 2, 3, 4, 5], -1))
+
+    def test_step(self):
+        """The window should advance by the number of steps provided"""
+        iterable = [1, 2, 3, 4, 5, 6, 7]
+        for n, step, expected in [
+            (3, 2, [(1, 2, 3), (3, 4, 5), (5, 6, 7)]),  # n > step
+            (3, 3, [(1, 2, 3), (4, 5, 6), (7, None, None)]),  # n == step
+            (3, 4, [(1, 2, 3), (5, 6, 7)]),  # line up nicely
+            (3, 5, [(1, 2, 3), (6, 7, None)]),  # off by one
+            (3, 6, [(1, 2, 3), (7, None, None)]),  # off by two
+            (3, 7, [(1, 2, 3)]),  # step past the end
+            (7, 8, [(1, 2, 3, 4, 5, 6, 7)]),  # step > len(iterable)
+        ]:
+            actual = list(mi.windowed(iterable, n, step=step))
+            self.assertEqual(actual, expected)
+
+        # Step must be greater than or equal to 1
+        with self.assertRaises(ValueError):
+            list(mi.windowed(iterable, 3, step=0))
+
+
+class BucketTests(TestCase):
+    """Tests for ``bucket()``"""
+
+    def test_basic(self):
+        iterable = [10, 20, 30, 11, 21, 31, 12, 22, 23, 33]
+        D = mi.bucket(iterable, key=lambda x: 10 * (x // 10))
+
+        # In-order access
+        self.assertEqual(list(D[10]), [10, 11, 12])
+
+        # Out of order access
+        self.assertEqual(list(D[30]), [30, 31, 33])
+        self.assertEqual(list(D[20]), [20, 21, 22, 23])
+
+        self.assertEqual(list(D[40]), [])  # Nothing in here!
+
+    def test_in(self):
+        iterable = [10, 20, 30, 11, 21, 31, 12, 22, 23, 33]
+        D = mi.bucket(iterable, key=lambda x: 10 * (x // 10))
+
+        self.assertTrue(10 in D)
+        self.assertFalse(40 in D)
+        self.assertTrue(20 in D)
+        self.assertFalse(21 in D)
+
+        # Checking in-ness shouldn't advance the iterator
+        self.assertEqual(next(D[10]), 10)
+
+    def test_validator(self):
+        iterable = count(0)
+        key = lambda x: int(str(x)[0])  # First digit of each number
+        validator = lambda x: 0 < x < 10  # No leading zeros
+        D = mi.bucket(iterable, key, validator=validator)
+        self.assertEqual(mi.take(3, D[1]), [1, 10, 11])
+        self.assertNotIn(0, D)  # Non-valid entries don't return True
+        self.assertNotIn(0, D._cache)  # Don't store non-valid entries
+        self.assertEqual(list(D[0]), [])
+
+
+class SpyTests(TestCase):
+    """Tests for ``spy()``"""
+
+    def test_basic(self):
+        original_iterable = iter('abcdefg')
+        head, new_iterable = mi.spy(original_iterable)
+        self.assertEqual(head, ['a'])
+        self.assertEqual(
+            list(new_iterable), ['a', 'b', 'c', 'd', 'e', 'f', 'g']
+        )
+
+    def test_unpacking(self):
+        original_iterable = iter('abcdefg')
+        (first, second, third), new_iterable = mi.spy(original_iterable, 3)
+        self.assertEqual(first, 'a')
+        self.assertEqual(second, 'b')
+        self.assertEqual(third, 'c')
+        self.assertEqual(
+            list(new_iterable), ['a', 'b', 'c', 'd', 'e', 'f', 'g']
+        )
+
+    def test_too_many(self):
+        original_iterable = iter('abc')
+        head, new_iterable = mi.spy(original_iterable, 4)
+        self.assertEqual(head, ['a', 'b', 'c'])
+        self.assertEqual(list(new_iterable), ['a', 'b', 'c'])
+
+    def test_zero(self):
+        original_iterable = iter('abc')
+        head, new_iterable = mi.spy(original_iterable, 0)
+        self.assertEqual(head, [])
+        self.assertEqual(list(new_iterable), ['a', 'b', 'c'])
+
+
+class InterleaveTests(TestCase):
+    def test_even(self):
+        actual = list(mi.interleave([1, 4, 7], [2, 5, 8], [3, 6, 9]))
+        expected = [1, 2, 3, 4, 5, 6, 7, 8, 9]
+        self.assertEqual(actual, expected)
+
+    def test_short(self):
+        actual = list(mi.interleave([1, 4], [2, 5, 7], [3, 6, 8]))
+        expected = [1, 2, 3, 4, 5, 6]
+        self.assertEqual(actual, expected)
+
+    def test_mixed_types(self):
+        it_list = ['a', 'b', 'c', 'd']
+        it_str = '12345'
+        it_inf = count()
+        actual = list(mi.interleave(it_list, it_str, it_inf))
+        expected = ['a', '1', 0, 'b', '2', 1, 'c', '3', 2, 'd', '4', 3]
+        self.assertEqual(actual, expected)
+
+
+class InterleaveLongestTests(TestCase):
+    def test_even(self):
+        actual = list(mi.interleave_longest([1, 4, 7], [2, 5, 8], [3, 6, 9]))
+        expected = [1, 2, 3, 4, 5, 6, 7, 8, 9]
+        self.assertEqual(actual, expected)
+
+    def test_short(self):
+        actual = list(mi.interleave_longest([1, 4], [2, 5, 7], [3, 6, 8]))
+        expected = [1, 2, 3, 4, 5, 6, 7, 8]
+        self.assertEqual(actual, expected)
+
+    def test_mixed_types(self):
+        it_list = ['a', 'b', 'c', 'd']
+        it_str = '12345'
+        it_gen = (x for x in range(3))
+        actual = list(mi.interleave_longest(it_list, it_str, it_gen))
+        expected = ['a', '1', 0, 'b', '2', 1, 'c', '3', 2, 'd', '4', '5']
+        self.assertEqual(actual, expected)
+
+
+class TestCollapse(TestCase):
+    """Tests for ``collapse()``"""
+
+    def test_collapse(self):
+        l = [[1], 2, [[3], 4], [[[5]]]]
+        self.assertEqual(list(mi.collapse(l)), [1, 2, 3, 4, 5])
+
+    def test_collapse_to_string(self):
+        l = [["s1"], "s2", [["s3"], "s4"], [[["s5"]]]]
+        self.assertEqual(list(mi.collapse(l)), ["s1", "s2", "s3", "s4", "s5"])
+
+    def test_collapse_flatten(self):
+        l = [[1], [2], [[3], 4], [[[5]]]]
+        self.assertEqual(list(mi.collapse(l, levels=1)), list(mi.flatten(l)))
+
+    def test_collapse_to_level(self):
+        l = [[1], 2, [[3], 4], [[[5]]]]
+        self.assertEqual(list(mi.collapse(l, levels=2)), [1, 2, 3, 4, [5]])
+        self.assertEqual(
+            list(mi.collapse(mi.collapse(l, levels=1), levels=1)),
+            list(mi.collapse(l, levels=2))
+        )
+
+    def test_collapse_to_list(self):
+        l = (1, [2], (3, [4, (5,)], 'ab'))
+        actual = list(mi.collapse(l, base_type=list))
+        expected = [1, [2], 3, [4, (5,)], 'ab']
+        self.assertEqual(actual, expected)
+
+
+class SideEffectTests(TestCase):
+    """Tests for ``side_effect()``"""
+
+    def test_individual(self):
+        # The function increments the counter for each call
+        counter = [0]
+
+        def func(arg):
+            counter[0] += 1
+
+        result = list(mi.side_effect(func, range(10)))
+        self.assertEqual(result, list(range(10)))
+        self.assertEqual(counter[0], 10)
+
+    def test_chunked(self):
+        # The function increments the counter for each call
+        counter = [0]
+
+        def func(arg):
+            counter[0] += 1
+
+        result = list(mi.side_effect(func, range(10), 2))
+        self.assertEqual(result, list(range(10)))
+        self.assertEqual(counter[0], 5)
+
+    def test_before_after(self):
+        f = StringIO()
+        collector = []
+
+        def func(item):
+            print(item, file=f)
+            collector.append(f.getvalue())
+
+        def it():
+            yield u'a'
+            yield u'b'
+            raise RuntimeError('kaboom')
+
+        before = lambda: print('HEADER', file=f)
+        after = f.close
+
+        try:
+            mi.consume(mi.side_effect(func, it(), before=before, after=after))
+        except RuntimeError:
+            pass
+
+        # The iterable should have been written to the file
+        self.assertEqual(collector, [u'HEADER\na\n', u'HEADER\na\nb\n'])
+
+        # The file should be closed even though something bad happened
+        self.assertTrue(f.closed)
+
+    def test_before_fails(self):
+        f = StringIO()
+        func = lambda x: print(x, file=f)
+
+        def before():
+            raise RuntimeError('ouch')
+
+        try:
+            mi.consume(
+                mi.side_effect(func, u'abc', before=before, after=f.close)
+            )
+        except RuntimeError:
+            pass
+
+        # The file should be closed even though something bad happened in the
+        # before function
+        self.assertTrue(f.closed)
+
+
+class SlicedTests(TestCase):
+    """Tests for ``sliced()``"""
+
+    def test_even(self):
+        """Test when the length of the sequence is divisible by *n*"""
+        seq = 'ABCDEFGHI'
+        self.assertEqual(list(mi.sliced(seq, 3)), ['ABC', 'DEF', 'GHI'])
+
+    def test_odd(self):
+        """Test when the length of the sequence is not divisible by *n*"""
+        seq = 'ABCDEFGHI'
+        self.assertEqual(list(mi.sliced(seq, 4)), ['ABCD', 'EFGH', 'I'])
+
+    def test_not_sliceable(self):
+        seq = (x for x in 'ABCDEFGHI')
+
+        with self.assertRaises(TypeError):
+            list(mi.sliced(seq, 3))
+
+
+class SplitAtTests(TestCase):
+    """Tests for ``split()``"""
+
+    def comp_with_str_split(self, str_to_split, delim):
+        pred = lambda c: c == delim
+        actual = list(map(''.join, mi.split_at(str_to_split, pred)))
+        expected = str_to_split.split(delim)
+        self.assertEqual(actual, expected)
+
+    def test_seperators(self):
+        test_strs = ['', 'abcba', 'aaabbbcccddd', 'e']
+        for s, delim in product(test_strs, 'abcd'):
+            self.comp_with_str_split(s, delim)
+
+
+class SplitBeforeTest(TestCase):
+    """Tests for ``split_before()``"""
+
+    def test_starts_with_sep(self):
+        actual = list(mi.split_before('xooxoo', lambda c: c == 'x'))
+        expected = [['x', 'o', 'o'], ['x', 'o', 'o']]
+        self.assertEqual(actual, expected)
+
+    def test_ends_with_sep(self):
+        actual = list(mi.split_before('ooxoox', lambda c: c == 'x'))
+        expected = [['o', 'o'], ['x', 'o', 'o'], ['x']]
+        self.assertEqual(actual, expected)
+
+    def test_no_sep(self):
+        actual = list(mi.split_before('ooo', lambda c: c == 'x'))
+        expected = [['o', 'o', 'o']]
+        self.assertEqual(actual, expected)
+
+
+class SplitAfterTest(TestCase):
+    """Tests for ``split_after()``"""
+
+    def test_starts_with_sep(self):
+        actual = list(mi.split_after('xooxoo', lambda c: c == 'x'))
+        expected = [['x'], ['o', 'o', 'x'], ['o', 'o']]
+        self.assertEqual(actual, expected)
+
+    def test_ends_with_sep(self):
+        actual = list(mi.split_after('ooxoox', lambda c: c == 'x'))
+        expected = [['o', 'o', 'x'], ['o', 'o', 'x']]
+        self.assertEqual(actual, expected)
+
+    def test_no_sep(self):
+        actual = list(mi.split_after('ooo', lambda c: c == 'x'))
+        expected = [['o', 'o', 'o']]
+        self.assertEqual(actual, expected)
+
+
+class PaddedTest(TestCase):
+    """Tests for ``padded()``"""
+
+    def test_no_n(self):
+        seq = [1, 2, 3]
+
+        # No fillvalue
+        self.assertEqual(mi.take(5, mi.padded(seq)), [1, 2, 3, None, None])
+
+        # With fillvalue
+        self.assertEqual(
+            mi.take(5, mi.padded(seq, fillvalue='')), [1, 2, 3, '', '']
+        )
+
+    def test_invalid_n(self):
+        self.assertRaises(ValueError, lambda: list(mi.padded([1, 2, 3], n=-1)))
+        self.assertRaises(ValueError, lambda: list(mi.padded([1, 2, 3], n=0)))
+
+    def test_valid_n(self):
+        seq = [1, 2, 3, 4, 5]
+
+        # No need for padding: len(seq) <= n
+        self.assertEqual(list(mi.padded(seq, n=4)), [1, 2, 3, 4, 5])
+        self.assertEqual(list(mi.padded(seq, n=5)), [1, 2, 3, 4, 5])
+
+        # No fillvalue
+        self.assertEqual(
+            list(mi.padded(seq, n=7)), [1, 2, 3, 4, 5, None, None]
+        )
+
+        # With fillvalue
+        self.assertEqual(
+            list(mi.padded(seq, fillvalue='', n=7)), [1, 2, 3, 4, 5, '', '']
+        )
+
+    def test_next_multiple(self):
+        seq = [1, 2, 3, 4, 5, 6]
+
+        # No need for padding: len(seq) % n == 0
+        self.assertEqual(
+            list(mi.padded(seq, n=3, next_multiple=True)), [1, 2, 3, 4, 5, 6]
+        )
+
+        # Padding needed: len(seq) < n
+        self.assertEqual(
+            list(mi.padded(seq, n=8, next_multiple=True)),
+            [1, 2, 3, 4, 5, 6, None, None]
+        )
+
+        # No padding needed: len(seq) == n
+        self.assertEqual(
+            list(mi.padded(seq, n=6, next_multiple=True)), [1, 2, 3, 4, 5, 6]
+        )
+
+        # Padding needed: len(seq) > n
+        self.assertEqual(
+            list(mi.padded(seq, n=4, next_multiple=True)),
+            [1, 2, 3, 4, 5, 6, None, None]
+        )
+
+        # With fillvalue
+        self.assertEqual(
+            list(mi.padded(seq, fillvalue='', n=4, next_multiple=True)),
+            [1, 2, 3, 4, 5, 6, '', '']
+        )
+
+
+class DistributeTest(TestCase):
+    """Tests for distribute()"""
+
+    def test_invalid_n(self):
+        self.assertRaises(ValueError, lambda: mi.distribute(-1, [1, 2, 3]))
+        self.assertRaises(ValueError, lambda: mi.distribute(0, [1, 2, 3]))
+
+    def test_basic(self):
+        iterable = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]
+
+        for n, expected in [
+            (1, [iterable]),
+            (2, [[1, 3, 5, 7, 9], [2, 4, 6, 8, 10]]),
+            (3, [[1, 4, 7, 10], [2, 5, 8], [3, 6, 9]]),
+            (10, [[n] for n in range(1, 10 + 1)]),
+        ]:
+            self.assertEqual(
+                [list(x) for x in mi.distribute(n, iterable)], expected
+            )
+
+    def test_large_n(self):
+        iterable = [1, 2, 3, 4]
+        self.assertEqual(
+            [list(x) for x in mi.distribute(6, iterable)],
+            [[1], [2], [3], [4], [], []]
+        )
+
+
+class StaggerTest(TestCase):
+    """Tests for ``stagger()``"""
+
+    def test_default(self):
+        iterable = [0, 1, 2, 3]
+        actual = list(mi.stagger(iterable))
+        expected = [(None, 0, 1), (0, 1, 2), (1, 2, 3)]
+        self.assertEqual(actual, expected)
+
+    def test_offsets(self):
+        iterable = [0, 1, 2, 3]
+        for offsets, expected in [
+            ((-2, 0, 2), [('', 0, 2), ('', 1, 3)]),
+            ((-2, -1), [('', ''), ('', 0), (0, 1), (1, 2), (2, 3)]),
+            ((1, 2), [(1, 2), (2, 3)]),
+        ]:
+            all_groups = mi.stagger(iterable, offsets=offsets, fillvalue='')
+            self.assertEqual(list(all_groups), expected)
+
+    def test_longest(self):
+        iterable = [0, 1, 2, 3]
+        for offsets, expected in [
+            (
+                (-1, 0, 1),
+                [('', 0, 1), (0, 1, 2), (1, 2, 3), (2, 3, ''), (3, '', '')]
+            ),
+            ((-2, -1), [('', ''), ('', 0), (0, 1), (1, 2), (2, 3), (3, '')]),
+            ((1, 2), [(1, 2), (2, 3), (3, '')]),
+        ]:
+            all_groups = mi.stagger(
+                iterable, offsets=offsets, fillvalue='', longest=True
+            )
+            self.assertEqual(list(all_groups), expected)
+
+
+class ZipOffsetTest(TestCase):
+    """Tests for ``zip_offset()``"""
+
+    def test_shortest(self):
+        a_1 = [0, 1, 2, 3]
+        a_2 = [0, 1, 2, 3, 4, 5]
+        a_3 = [0, 1, 2, 3, 4, 5, 6, 7]
+        actual = list(
+            mi.zip_offset(a_1, a_2, a_3, offsets=(-1, 0, 1), fillvalue='')
+        )
+        expected = [('', 0, 1), (0, 1, 2), (1, 2, 3), (2, 3, 4), (3, 4, 5)]
+        self.assertEqual(actual, expected)
+
+    def test_longest(self):
+        a_1 = [0, 1, 2, 3]
+        a_2 = [0, 1, 2, 3, 4, 5]
+        a_3 = [0, 1, 2, 3, 4, 5, 6, 7]
+        actual = list(
+            mi.zip_offset(a_1, a_2, a_3, offsets=(-1, 0, 1), longest=True)
+        )
+        expected = [
+            (None, 0, 1),
+            (0, 1, 2),
+            (1, 2, 3),
+            (2, 3, 4),
+            (3, 4, 5),
+            (None, 5, 6),
+            (None, None, 7),
+        ]
+        self.assertEqual(actual, expected)
+
+    def test_mismatch(self):
+        iterables = [0, 1, 2], [2, 3, 4]
+        offsets = (-1, 0, 1)
+        self.assertRaises(
+            ValueError,
+            lambda: list(mi.zip_offset(*iterables, offsets=offsets))
+        )
+
+
+class SortTogetherTest(TestCase):
+    """Tests for sort_together()"""
+
+    def test_key_list(self):
+        """tests `key_list` including default, iterables include duplicates"""
+        iterables = [
+            ['GA', 'GA', 'GA', 'CT', 'CT', 'CT'],
+            ['May', 'Aug.', 'May', 'June', 'July', 'July'],
+            [97, 20, 100, 70, 100, 20]
+        ]
+
+        self.assertEqual(
+            mi.sort_together(iterables),
+            [
+                ('CT', 'CT', 'CT', 'GA', 'GA', 'GA'),
+                ('June', 'July', 'July', 'May', 'Aug.', 'May'),
+                (70, 100, 20, 97, 20, 100)
+            ]
+        )
+
+        self.assertEqual(
+            mi.sort_together(iterables, key_list=(0, 1)),
+            [
+                ('CT', 'CT', 'CT', 'GA', 'GA', 'GA'),
+                ('July', 'July', 'June', 'Aug.', 'May', 'May'),
+                (100, 20, 70, 20, 97, 100)
+            ]
+        )
+
+        self.assertEqual(
+            mi.sort_together(iterables, key_list=(0, 1, 2)),
+            [
+                ('CT', 'CT', 'CT', 'GA', 'GA', 'GA'),
+                ('July', 'July', 'June', 'Aug.', 'May', 'May'),
+                (20, 100, 70, 20, 97, 100)
+            ]
+        )
+
+        self.assertEqual(
+            mi.sort_together(iterables, key_list=(2,)),
+            [
+                ('GA', 'CT', 'CT', 'GA', 'GA', 'CT'),
+                ('Aug.', 'July', 'June', 'May', 'May', 'July'),
+                (20, 20, 70, 97, 100, 100)
+            ]
+        )
+
+    def test_invalid_key_list(self):
+        """tests `key_list` for indexes not available in `iterables`"""
+        iterables = [
+            ['GA', 'GA', 'GA', 'CT', 'CT', 'CT'],
+            ['May', 'Aug.', 'May', 'June', 'July', 'July'],
+            [97, 20, 100, 70, 100, 20]
+        ]
+
+        self.assertRaises(
+            IndexError, lambda: mi.sort_together(iterables, key_list=(5,))
+        )
+
+    def test_reverse(self):
+        """tests `reverse` to ensure a reverse sort for `key_list` iterables"""
+        iterables = [
+            ['GA', 'GA', 'GA', 'CT', 'CT', 'CT'],
+            ['May', 'Aug.', 'May', 'June', 'July', 'July'],
+            [97, 20, 100, 70, 100, 20]
+        ]
+
+        self.assertEqual(
+            mi.sort_together(iterables, key_list=(0, 1, 2), reverse=True),
+            [('GA', 'GA', 'GA', 'CT', 'CT', 'CT'),
+             ('May', 'May', 'Aug.', 'June', 'July', 'July'),
+             (100, 97, 20, 70, 100, 20)]
+        )
+
+    def test_uneven_iterables(self):
+        """tests trimming of iterables to the shortest length before sorting"""
+        iterables = [['GA', 'GA', 'GA', 'CT', 'CT', 'CT', 'MA'],
+                     ['May', 'Aug.', 'May', 'June', 'July', 'July'],
+                     [97, 20, 100, 70, 100, 20, 0]]
+
+        self.assertEqual(
+            mi.sort_together(iterables),
+            [
+                ('CT', 'CT', 'CT', 'GA', 'GA', 'GA'),
+                ('June', 'July', 'July', 'May', 'Aug.', 'May'),
+                (70, 100, 20, 97, 20, 100)
+            ]
+        )
+
+
+class DivideTest(TestCase):
+    """Tests for divide()"""
+
+    def test_invalid_n(self):
+        self.assertRaises(ValueError, lambda: mi.divide(-1, [1, 2, 3]))
+        self.assertRaises(ValueError, lambda: mi.divide(0, [1, 2, 3]))
+
+    def test_basic(self):
+        iterable = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]
+
+        for n, expected in [
+            (1, [iterable]),
+            (2, [[1, 2, 3, 4, 5], [6, 7, 8, 9, 10]]),
+            (3, [[1, 2, 3, 4], [5, 6, 7], [8, 9, 10]]),
+            (10, [[n] for n in range(1, 10 + 1)]),
+        ]:
+            self.assertEqual(
+                [list(x) for x in mi.divide(n, iterable)], expected
+            )
+
+    def test_large_n(self):
+        iterable = [1, 2, 3, 4]
+        self.assertEqual(
+            [list(x) for x in mi.divide(6, iterable)],
+            [[1], [2], [3], [4], [], []]
+        )
+
+
+class TestAlwaysIterable(TestCase):
+    """Tests for always_iterable()"""
+    def test_single(self):
+        self.assertEqual(list(mi.always_iterable(1)), [1])
+
+    def test_strings(self):
+        for obj in ['foo', b'bar', u'baz']:
+            actual = list(mi.always_iterable(obj))
+            expected = [obj]
+            self.assertEqual(actual, expected)
+
+    def test_base_type(self):
+        dict_obj = {'a': 1, 'b': 2}
+        str_obj = '123'
+
+        # Default: dicts are iterable like they normally are
+        default_actual = list(mi.always_iterable(dict_obj))
+        default_expected = list(dict_obj)
+        self.assertEqual(default_actual, default_expected)
+
+        # Unitary types set: dicts are not iterable
+        custom_actual = list(mi.always_iterable(dict_obj, base_type=dict))
+        custom_expected = [dict_obj]
+        self.assertEqual(custom_actual, custom_expected)
+
+        # With unitary types set, strings are iterable
+        str_actual = list(mi.always_iterable(str_obj, base_type=None))
+        str_expected = list(str_obj)
+        self.assertEqual(str_actual, str_expected)
+
+    def test_iterables(self):
+        self.assertEqual(list(mi.always_iterable([0, 1])), [0, 1])
+        self.assertEqual(
+            list(mi.always_iterable([0, 1], base_type=list)), [[0, 1]]
+        )
+        self.assertEqual(
+            list(mi.always_iterable(iter('foo'))), ['f', 'o', 'o']
+        )
+        self.assertEqual(list(mi.always_iterable([])), [])
+
+    def test_none(self):
+        self.assertEqual(list(mi.always_iterable(None)), [])
+
+    def test_generator(self):
+        def _gen():
+            yield 0
+            yield 1
+
+        self.assertEqual(list(mi.always_iterable(_gen())), [0, 1])
+
+
+class AdjacentTests(TestCase):
+    def test_typical(self):
+        actual = list(mi.adjacent(lambda x: x % 5 == 0, range(10)))
+        expected = [(True, 0), (True, 1), (False, 2), (False, 3), (True, 4),
+                    (True, 5), (True, 6), (False, 7), (False, 8), (False, 9)]
+        self.assertEqual(actual, expected)
+
+    def test_empty_iterable(self):
+        actual = list(mi.adjacent(lambda x: x % 5 == 0, []))
+        expected = []
+        self.assertEqual(actual, expected)
+
+    def test_length_one(self):
+        actual = list(mi.adjacent(lambda x: x % 5 == 0, [0]))
+        expected = [(True, 0)]
+        self.assertEqual(actual, expected)
+
+        actual = list(mi.adjacent(lambda x: x % 5 == 0, [1]))
+        expected = [(False, 1)]
+        self.assertEqual(actual, expected)
+
+    def test_consecutive_true(self):
+        """Test that when the predicate matches multiple consecutive elements
+        it doesn't repeat elements in the output"""
+        actual = list(mi.adjacent(lambda x: x % 5 < 2, range(10)))
+        expected = [(True, 0), (True, 1), (True, 2), (False, 3), (True, 4),
+                    (True, 5), (True, 6), (True, 7), (False, 8), (False, 9)]
+        self.assertEqual(actual, expected)
+
+    def test_distance(self):
+        actual = list(mi.adjacent(lambda x: x % 5 == 0, range(10), distance=2))
+        expected = [(True, 0), (True, 1), (True, 2), (True, 3), (True, 4),
+                    (True, 5), (True, 6), (True, 7), (False, 8), (False, 9)]
+        self.assertEqual(actual, expected)
+
+        actual = list(mi.adjacent(lambda x: x % 5 == 0, range(10), distance=3))
+        expected = [(True, 0), (True, 1), (True, 2), (True, 3), (True, 4),
+                    (True, 5), (True, 6), (True, 7), (True, 8), (False, 9)]
+        self.assertEqual(actual, expected)
+
+    def test_large_distance(self):
+        """Test distance larger than the length of the iterable"""
+        iterable = range(10)
+        actual = list(mi.adjacent(lambda x: x % 5 == 4, iterable, distance=20))
+        expected = list(zip(repeat(True), iterable))
+        self.assertEqual(actual, expected)
+
+        actual = list(mi.adjacent(lambda x: False, iterable, distance=20))
+        expected = list(zip(repeat(False), iterable))
+        self.assertEqual(actual, expected)
+
+    def test_zero_distance(self):
+        """Test that adjacent() reduces to zip+map when distance is 0"""
+        iterable = range(1000)
+        predicate = lambda x: x % 4 == 2
+        actual = mi.adjacent(predicate, iterable, 0)
+        expected = zip(map(predicate, iterable), iterable)
+        self.assertTrue(all(a == e for a, e in zip(actual, expected)))
+
+    def test_negative_distance(self):
+        """Test that adjacent() raises an error with negative distance"""
+        pred = lambda x: x
+        self.assertRaises(
+            ValueError, lambda: mi.adjacent(pred, range(1000), -1)
+        )
+        self.assertRaises(
+            ValueError, lambda: mi.adjacent(pred, range(10), -10)
+        )
+
+    def test_grouping(self):
+        """Test interaction of adjacent() with groupby_transform()"""
+        iterable = mi.adjacent(lambda x: x % 5 == 0, range(10))
+        grouper = mi.groupby_transform(iterable, itemgetter(0), itemgetter(1))
+        actual = [(k, list(g)) for k, g in grouper]
+        expected = [
+            (True, [0, 1]),
+            (False, [2, 3]),
+            (True, [4, 5, 6]),
+            (False, [7, 8, 9]),
+        ]
+        self.assertEqual(actual, expected)
+
+    def test_call_once(self):
+        """Test that the predicate is only called once per item."""
+        already_seen = set()
+        iterable = range(10)
+
+        def predicate(item):
+            self.assertNotIn(item, already_seen)
+            already_seen.add(item)
+            return True
+
+        actual = list(mi.adjacent(predicate, iterable))
+        expected = [(True, x) for x in iterable]
+        self.assertEqual(actual, expected)
+
+
+class GroupByTransformTests(TestCase):
+    def assertAllGroupsEqual(self, groupby1, groupby2):
+        """Compare two groupby objects for equality, both keys and groups."""
+        for a, b in zip(groupby1, groupby2):
+            key1, group1 = a
+            key2, group2 = b
+            self.assertEqual(key1, key2)
+            self.assertListEqual(list(group1), list(group2))
+        self.assertRaises(StopIteration, lambda: next(groupby1))
+        self.assertRaises(StopIteration, lambda: next(groupby2))
+
+    def test_default_funcs(self):
+        """Test that groupby_transform() with default args mimics groupby()"""
+        iterable = [(x // 5, x) for x in range(1000)]
+        actual = mi.groupby_transform(iterable)
+        expected = groupby(iterable)
+        self.assertAllGroupsEqual(actual, expected)
+
+    def test_valuefunc(self):
+        iterable = [(int(x / 5), int(x / 3), x) for x in range(10)]
+
+        # Test the standard usage of grouping one iterable using another's keys
+        grouper = mi.groupby_transform(
+            iterable, keyfunc=itemgetter(0), valuefunc=itemgetter(-1)
+        )
+        actual = [(k, list(g)) for k, g in grouper]
+        expected = [(0, [0, 1, 2, 3, 4]), (1, [5, 6, 7, 8, 9])]
+        self.assertEqual(actual, expected)
+
+        grouper = mi.groupby_transform(
+            iterable, keyfunc=itemgetter(1), valuefunc=itemgetter(-1)
+        )
+        actual = [(k, list(g)) for k, g in grouper]
+        expected = [(0, [0, 1, 2]), (1, [3, 4, 5]), (2, [6, 7, 8]), (3, [9])]
+        self.assertEqual(actual, expected)
+
+        # and now for something a little different
+        d = dict(zip(range(10), 'abcdefghij'))
+        grouper = mi.groupby_transform(
+            range(10), keyfunc=lambda x: x // 5, valuefunc=d.get
+        )
+        actual = [(k, ''.join(g)) for k, g in grouper]
+        expected = [(0, 'abcde'), (1, 'fghij')]
+        self.assertEqual(actual, expected)
+
+    def test_no_valuefunc(self):
+        iterable = range(1000)
+
+        def key(x):
+            return x // 5
+
+        actual = mi.groupby_transform(iterable, key, valuefunc=None)
+        expected = groupby(iterable, key)
+        self.assertAllGroupsEqual(actual, expected)
+
+        actual = mi.groupby_transform(iterable, key)  # default valuefunc
+        expected = groupby(iterable, key)
+        self.assertAllGroupsEqual(actual, expected)
+
+
+class NumericRangeTests(TestCase):
+    def test_basic(self):
+        for args, expected in [
+            ((4,), [0, 1, 2, 3]),
+            ((4.0,), [0.0, 1.0, 2.0, 3.0]),
+            ((1.0, 4), [1.0, 2.0, 3.0]),
+            ((1, 4.0), [1, 2, 3]),
+            ((1.0, 5), [1.0, 2.0, 3.0, 4.0]),
+            ((0, 20, 5), [0, 5, 10, 15]),
+            ((0, 20, 5.0), [0.0, 5.0, 10.0, 15.0]),
+            ((0, 10, 3), [0, 3, 6, 9]),
+            ((0, 10, 3.0), [0.0, 3.0, 6.0, 9.0]),
+            ((0, -5, -1), [0, -1, -2, -3, -4]),
+            ((0.0, -5, -1), [0.0, -1.0, -2.0, -3.0, -4.0]),
+            ((1, 2, Fraction(1, 2)), [Fraction(1, 1), Fraction(3, 2)]),
+            ((0,), []),
+            ((0.0,), []),
+            ((1, 0), []),
+            ((1.0, 0.0), []),
+            ((Fraction(2, 1),), [Fraction(0, 1), Fraction(1, 1)]),
+            ((Decimal('2.0'),), [Decimal('0.0'), Decimal('1.0')]),
+        ]:
+            actual = list(mi.numeric_range(*args))
+            self.assertEqual(actual, expected)
+            self.assertTrue(
+                all(type(a) == type(e) for a, e in zip(actual, expected))
+            )
+
+    def test_arg_count(self):
+        self.assertRaises(TypeError, lambda: list(mi.numeric_range()))
+        self.assertRaises(
+            TypeError, lambda: list(mi.numeric_range(0, 1, 2, 3))
+        )
+
+    def test_zero_step(self):
+        self.assertRaises(
+            ValueError, lambda: list(mi.numeric_range(1, 2, 0))
+        )
+
+
+class CountCycleTests(TestCase):
+    def test_basic(self):
+        expected = [
+            (0, 'a'), (0, 'b'), (0, 'c'),
+            (1, 'a'), (1, 'b'), (1, 'c'),
+            (2, 'a'), (2, 'b'), (2, 'c'),
+        ]
+        for actual in [
+            mi.take(9, mi.count_cycle('abc')),  # n=None
+            list(mi.count_cycle('abc', 3)),  # n=3
+        ]:
+            self.assertEqual(actual, expected)
+
+    def test_empty(self):
+        self.assertEqual(list(mi.count_cycle('')), [])
+        self.assertEqual(list(mi.count_cycle('', 2)), [])
+
+    def test_negative(self):
+        self.assertEqual(list(mi.count_cycle('abc', -3)), [])
+
+
+class LocateTests(TestCase):
+    def test_default_pred(self):
+        iterable = [0, 1, 1, 0, 1, 0, 0]
+        actual = list(mi.locate(iterable))
+        expected = [1, 2, 4]
+        self.assertEqual(actual, expected)
+
+    def test_no_matches(self):
+        iterable = [0, 0, 0]
+        actual = list(mi.locate(iterable))
+        expected = []
+        self.assertEqual(actual, expected)
+
+    def test_custom_pred(self):
+        iterable = ['0', 1, 1, '0', 1, '0', '0']
+        pred = lambda x: x == '0'
+        actual = list(mi.locate(iterable, pred))
+        expected = [0, 3, 5, 6]
+        self.assertEqual(actual, expected)
+
+
+class StripFunctionTests(TestCase):
+    def test_hashable(self):
+        iterable = list('www.example.com')
+        pred = lambda x: x in set('cmowz.')
+
+        self.assertEqual(list(mi.lstrip(iterable, pred)), list('example.com'))
+        self.assertEqual(list(mi.rstrip(iterable, pred)), list('www.example'))
+        self.assertEqual(list(mi.strip(iterable, pred)), list('example'))
+
+    def test_not_hashable(self):
+        iterable = [
+            list('http://'), list('www'), list('.example'), list('.com')
+        ]
+        pred = lambda x: x in [list('http://'), list('www'), list('.com')]
+
+        self.assertEqual(list(mi.lstrip(iterable, pred)), iterable[2:])
+        self.assertEqual(list(mi.rstrip(iterable, pred)), iterable[:3])
+        self.assertEqual(list(mi.strip(iterable, pred)), iterable[2: 3])
+
+    def test_math(self):
+        iterable = [0, 1, 2, 3, 0, 1, 2, 3, 0, 1, 2]
+        pred = lambda x: x <= 2
+
+        self.assertEqual(list(mi.lstrip(iterable, pred)), iterable[3:])
+        self.assertEqual(list(mi.rstrip(iterable, pred)), iterable[:-3])
+        self.assertEqual(list(mi.strip(iterable, pred)), iterable[3:-3])
+
+
+class IsliceExtendedTests(TestCase):
+    def test_all(self):
+        iterable = ['0', '1', '2', '3', '4', '5']
+        indexes = list(range(-4, len(iterable) + 4)) + [None]
+        steps = [1, 2, 3, 4, -1, -2, -3, 4]
+        for slice_args in product(indexes, indexes, steps):
+            try:
+                actual = list(mi.islice_extended(iterable, *slice_args))
+            except Exception as e:
+                self.fail((slice_args, e))
+
+            expected = iterable[slice(*slice_args)]
+            self.assertEqual(actual, expected, slice_args)
+
+    def test_zero_step(self):
+        with self.assertRaises(ValueError):
+            list(mi.islice_extended([1, 2, 3], 0, 1, 0))
+
+
+class ConsecutiveGroupsTest(TestCase):
+    def test_numbers(self):
+        iterable = [-10, -8, -7, -6, 1, 2, 4, 5, -1, 7]
+        actual = [list(g) for g in mi.consecutive_groups(iterable)]
+        expected = [[-10], [-8, -7, -6], [1, 2], [4, 5], [-1], [7]]
+        self.assertEqual(actual, expected)
+
+    def test_custom_ordering(self):
+        iterable = ['1', '10', '11', '20', '21', '22', '30', '31']
+        ordering = lambda x: int(x)
+        actual = [list(g) for g in mi.consecutive_groups(iterable, ordering)]
+        expected = [['1'], ['10', '11'], ['20', '21', '22'], ['30', '31']]
+        self.assertEqual(actual, expected)
+
+    def test_exotic_ordering(self):
+        iterable = [
+            ('a', 'b', 'c', 'd'),
+            ('a', 'c', 'b', 'd'),
+            ('a', 'c', 'd', 'b'),
+            ('a', 'd', 'b', 'c'),
+            ('d', 'b', 'c', 'a'),
+            ('d', 'c', 'a', 'b'),
+        ]
+        ordering = list(permutations('abcd')).index
+        actual = [list(g) for g in mi.consecutive_groups(iterable, ordering)]
+        expected = [
+            [('a', 'b', 'c', 'd')],
+            [('a', 'c', 'b', 'd'), ('a', 'c', 'd', 'b'), ('a', 'd', 'b', 'c')],
+            [('d', 'b', 'c', 'a'), ('d', 'c', 'a', 'b')],
+        ]
+        self.assertEqual(actual, expected)
+
+
+class DifferenceTest(TestCase):
+    def test_normal(self):
+        iterable = [10, 20, 30, 40, 50]
+        actual = list(mi.difference(iterable))
+        expected = [10, 10, 10, 10, 10]
+        self.assertEqual(actual, expected)
+
+    def test_custom(self):
+        iterable = [10, 20, 30, 40, 50]
+        actual = list(mi.difference(iterable, add))
+        expected = [10, 30, 50, 70, 90]
+        self.assertEqual(actual, expected)
+
+    def test_roundtrip(self):
+        original = list(range(100))
+        accumulated = mi.accumulate(original)
+        actual = list(mi.difference(accumulated))
+        self.assertEqual(actual, original)
+
+    def test_one(self):
+        self.assertEqual(list(mi.difference([0])), [0])
+
+    def test_empty(self):
+        self.assertEqual(list(mi.difference([])), [])
+
+
+class SeekableTest(TestCase):
+    def test_exhaustion_reset(self):
+        iterable = [str(n) for n in range(10)]
+
+        s = mi.seekable(iterable)
+        self.assertEqual(list(s), iterable)  # Normal iteration
+        self.assertEqual(list(s), [])  # Iterable is exhausted
+
+        s.seek(0)
+        self.assertEqual(list(s), iterable)  # Back in action
+
+    def test_partial_reset(self):
+        iterable = [str(n) for n in range(10)]
+
+        s = mi.seekable(iterable)
+        self.assertEqual(mi.take(5, s), iterable[:5])  # Normal iteration
+
+        s.seek(1)
+        self.assertEqual(list(s), iterable[1:])  # Get the rest of the iterable
+
+    def test_forward(self):
+        iterable = [str(n) for n in range(10)]
+
+        s = mi.seekable(iterable)
+        self.assertEqual(mi.take(1, s), iterable[:1])  # Normal iteration
+
+        s.seek(3)  # Skip over index 2
+        self.assertEqual(list(s), iterable[3:])  # Result is similar to slicing
+
+        s.seek(0)  # Back to 0
+        self.assertEqual(list(s), iterable)  # No difference in result
+
+    def test_past_end(self):
+        iterable = [str(n) for n in range(10)]
+
+        s = mi.seekable(iterable)
+        self.assertEqual(mi.take(1, s), iterable[:1])  # Normal iteration
+
+        s.seek(20)
+        self.assertEqual(list(s), [])  # Iterable is exhausted
+
+        s.seek(0)  # Back to 0
+        self.assertEqual(list(s), iterable)  # No difference in result
+
+    def test_elements(self):
+        iterable = map(str, count())
+
+        s = mi.seekable(iterable)
+        mi.take(10, s)
+
+        elements = s.elements()
+        self.assertEqual(
+            [elements[i] for i in range(10)], [str(n) for n in range(10)]
+        )
+        self.assertEqual(len(elements), 10)
+
+        mi.take(10, s)
+        self.assertEqual(list(elements), [str(n) for n in range(20)])
+
+
+class SequenceViewTests(TestCase):
+    def test_init(self):
+        view = mi.SequenceView((1, 2, 3))
+        self.assertEqual(repr(view), "SequenceView((1, 2, 3))")
+        self.assertRaises(TypeError, lambda: mi.SequenceView({}))
+
+    def test_update(self):
+        seq = [1, 2, 3]
+        view = mi.SequenceView(seq)
+        self.assertEqual(len(view), 3)
+        self.assertEqual(repr(view), "SequenceView([1, 2, 3])")
+
+        seq.pop()
+        self.assertEqual(len(view), 2)
+        self.assertEqual(repr(view), "SequenceView([1, 2])")
+
+    def test_indexing(self):
+        seq = ('a', 'b', 'c', 'd', 'e', 'f')
+        view = mi.SequenceView(seq)
+        for i in range(-len(seq), len(seq)):
+            self.assertEqual(view[i], seq[i])
+
+    def test_slicing(self):
+        seq = ('a', 'b', 'c', 'd', 'e', 'f')
+        view = mi.SequenceView(seq)
+        n = len(seq)
+        indexes = list(range(-n - 1, n + 1)) + [None]
+        steps = list(range(-n, n + 1))
+        steps.remove(0)
+        for slice_args in product(indexes, indexes, steps):
+            i = slice(*slice_args)
+            self.assertEqual(view[i], seq[i])
+
+    def test_abc_methods(self):
+        # collections.Sequence should provide all of this functionality
+        seq = ('a', 'b', 'c', 'd', 'e', 'f', 'f')
+        view = mi.SequenceView(seq)
+
+        # __contains__
+        self.assertIn('b', view)
+        self.assertNotIn('g', view)
+
+        # __iter__
+        self.assertEqual(list(iter(view)), list(seq))
+
+        # __reversed__
+        self.assertEqual(list(reversed(view)), list(reversed(seq)))
+
+        # index
+        self.assertEqual(view.index('b'), 1)
+
+        # count
+        self.assertEqual(seq.count('f'), 2)
+
+
+class RunLengthTest(TestCase):
+    def test_encode(self):
+        iterable = (int(str(n)[0]) for n in count(800))
+        actual = mi.take(4, mi.run_length.encode(iterable))
+        expected = [(8, 100), (9, 100), (1, 1000), (2, 1000)]
+        self.assertEqual(actual, expected)
+
+    def test_decode(self):
+        iterable = [('d', 4), ('c', 3), ('b', 2), ('a', 1)]
+        actual = ''.join(mi.run_length.decode(iterable))
+        expected = 'ddddcccbba'
+        self.assertEqual(actual, expected)
+
+
+class ExactlyNTests(TestCase):
+    """Tests for ``exactly_n()``"""
+
+    def test_true(self):
+        """Iterable has ``n`` ``True`` elements"""
+        self.assertTrue(mi.exactly_n([True, False, True], 2))
+        self.assertTrue(mi.exactly_n([1, 1, 1, 0], 3))
+        self.assertTrue(mi.exactly_n([False, False], 0))
+        self.assertTrue(mi.exactly_n(range(100), 10, lambda x: x < 10))
+
+    def test_false(self):
+        """Iterable does not have ``n`` ``True`` elements"""
+        self.assertFalse(mi.exactly_n([True, False, False], 2))
+        self.assertFalse(mi.exactly_n([True, True, False], 1))
+        self.assertFalse(mi.exactly_n([False], 1))
+        self.assertFalse(mi.exactly_n([True], -1))
+        self.assertFalse(mi.exactly_n(repeat(True), 100))
+
+    def test_empty(self):
+        """Return ``True`` if the iterable is empty and ``n`` is 0"""
+        self.assertTrue(mi.exactly_n([], 0))
+        self.assertFalse(mi.exactly_n([], 1))
+
+
+class AlwaysReversibleTests(TestCase):
+    """Tests for ``always_reversible()``"""
+
+    def test_regular_reversed(self):
+        self.assertEqual(list(reversed(range(10))),
+                         list(mi.always_reversible(range(10))))
+        self.assertEqual(list(reversed([1, 2, 3])),
+                         list(mi.always_reversible([1, 2, 3])))
+        self.assertEqual(reversed([1, 2, 3]).__class__,
+                         mi.always_reversible([1, 2, 3]).__class__)
+
+    def test_nonseq_reversed(self):
+        # Create a non-reversible generator from a sequence
+        with self.assertRaises(TypeError):
+            reversed(x for x in range(10))
+
+        self.assertEqual(list(reversed(range(10))),
+                         list(mi.always_reversible(x for x in range(10))))
+        self.assertEqual(list(reversed([1, 2, 3])),
+                         list(mi.always_reversible(x for x in [1, 2, 3])))
+        self.assertNotEqual(reversed((1, 2)).__class__,
+                            mi.always_reversible(x for x in (1, 2)).__class__)
+
+
+class CircularShiftsTests(TestCase):
+    def test_empty(self):
+        # empty iterable -> empty list
+        self.assertEqual(list(mi.circular_shifts([])), [])
+
+    def test_simple_circular_shifts(self):
+        # test the a simple iterator case
+        self.assertEqual(
+            mi.circular_shifts(range(4)),
+            [(0, 1, 2, 3), (1, 2, 3, 0), (2, 3, 0, 1), (3, 0, 1, 2)]
+        )
+
+    def test_duplicates(self):
+        # test non-distinct entries
+        self.assertEqual(
+            mi.circular_shifts([0, 1, 0, 1]),
+            [(0, 1, 0, 1), (1, 0, 1, 0), (0, 1, 0, 1), (1, 0, 1, 0)]
+        )
+
+
+class MakeDecoratorTests(TestCase):
+    def test_basic(self):
+        slicer = mi.make_decorator(islice)
+
+        @slicer(1, 10, 2)
+        def user_function(arg_1, arg_2, kwarg_1=None):
+            self.assertEqual(arg_1, 'arg_1')
+            self.assertEqual(arg_2, 'arg_2')
+            self.assertEqual(kwarg_1, 'kwarg_1')
+            return map(str, count())
+
+        it = user_function('arg_1', 'arg_2', kwarg_1='kwarg_1')
+        actual = list(it)
+        expected = ['1', '3', '5', '7', '9']
+        self.assertEqual(actual, expected)
+
+    def test_result_index(self):
+        def stringify(*args, **kwargs):
+            self.assertEqual(args[0], 'arg_0')
+            iterable = args[1]
+            self.assertEqual(args[2], 'arg_2')
+            self.assertEqual(kwargs['kwarg_1'], 'kwarg_1')
+            return map(str, iterable)
+
+        stringifier = mi.make_decorator(stringify, result_index=1)
+
+        @stringifier('arg_0', 'arg_2', kwarg_1='kwarg_1')
+        def user_function(n):
+            return count(n)
+
+        it = user_function(1)
+        actual = mi.take(5, it)
+        expected = ['1', '2', '3', '4', '5']
+        self.assertEqual(actual, expected)
+
+    def test_wrap_class(self):
+        seeker = mi.make_decorator(mi.seekable)
+
+        @seeker()
+        def user_function(n):
+            return map(str, range(n))
+
+        it = user_function(5)
+        self.assertEqual(list(it), ['0', '1', '2', '3', '4'])
+
+        it.seek(0)
+        self.assertEqual(list(it), ['0', '1', '2', '3', '4'])
+
+
+class MapReduceTests(TestCase):
+    def test_default(self):
+        iterable = (str(x) for x in range(5))
+        keyfunc = lambda x: int(x) // 2
+        actual = sorted(mi.map_reduce(iterable, keyfunc).items())
+        expected = [(0, ['0', '1']), (1, ['2', '3']), (2, ['4'])]
+        self.assertEqual(actual, expected)
+
+    def test_valuefunc(self):
+        iterable = (str(x) for x in range(5))
+        keyfunc = lambda x: int(x) // 2
+        valuefunc = int
+        actual = sorted(mi.map_reduce(iterable, keyfunc, valuefunc).items())
+        expected = [(0, [0, 1]), (1, [2, 3]), (2, [4])]
+        self.assertEqual(actual, expected)
+
+    def test_reducefunc(self):
+        iterable = (str(x) for x in range(5))
+        keyfunc = lambda x: int(x) // 2
+        valuefunc = int
+        reducefunc = lambda value_list: reduce(mul, value_list, 1)
+        actual = sorted(
+            mi.map_reduce(iterable, keyfunc, valuefunc, reducefunc).items()
+        )
+        expected = [(0, 0), (1, 6), (2, 4)]
+        self.assertEqual(actual, expected)
+
+    def test_ret(self):
+        d = mi.map_reduce([1, 0, 2, 0, 1, 0], bool)
+        self.assertEqual(d, {False: [0, 0, 0], True: [1, 2, 1]})
+        self.assertRaises(KeyError, lambda: d[None].append(1))
new file mode 100644
--- /dev/null
+++ b/third_party/python/more-itertools/more_itertools/tests/test_recipes.py
@@ -0,0 +1,607 @@
+from doctest import DocTestSuite
+from unittest import TestCase
+
+from itertools import combinations
+from six.moves import range
+
+import more_itertools as mi
+
+
+def load_tests(loader, tests, ignore):
+    # Add the doctests
+    tests.addTests(DocTestSuite('more_itertools.recipes'))
+    return tests
+
+
+class AccumulateTests(TestCase):
+    """Tests for ``accumulate()``"""
+
+    def test_empty(self):
+        """Test that an empty input returns an empty output"""
+        self.assertEqual(list(mi.accumulate([])), [])
+
+    def test_default(self):
+        """Test accumulate with the default function (addition)"""
+        self.assertEqual(list(mi.accumulate([1, 2, 3])), [1, 3, 6])
+
+    def test_bogus_function(self):
+        """Test accumulate with an invalid function"""
+        with self.assertRaises(TypeError):
+            list(mi.accumulate([1, 2, 3], func=lambda x: x))
+
+    def test_custom_function(self):
+        """Test accumulate with a custom function"""
+        self.assertEqual(
+            list(mi.accumulate((1, 2, 3, 2, 1), func=max)), [1, 2, 3, 3, 3]
+        )
+
+
+class TakeTests(TestCase):
+    """Tests for ``take()``"""
+
+    def test_simple_take(self):
+        """Test basic usage"""
+        t = mi.take(5, range(10))
+        self.assertEqual(t, [0, 1, 2, 3, 4])
+
+    def test_null_take(self):
+        """Check the null case"""
+        t = mi.take(0, range(10))
+        self.assertEqual(t, [])
+
+    def test_negative_take(self):
+        """Make sure taking negative items results in a ValueError"""
+        self.assertRaises(ValueError, lambda: mi.take(-3, range(10)))
+
+    def test_take_too_much(self):
+        """Taking more than an iterator has remaining should return what the
+        iterator has remaining.
+
+        """
+        t = mi.take(10, range(5))
+        self.assertEqual(t, [0, 1, 2, 3, 4])
+
+
+class TabulateTests(TestCase):
+    """Tests for ``tabulate()``"""
+
+    def test_simple_tabulate(self):
+        """Test the happy path"""
+        t = mi.tabulate(lambda x: x)
+        f = tuple([next(t) for _ in range(3)])
+        self.assertEqual(f, (0, 1, 2))
+
+    def test_count(self):
+        """Ensure tabulate accepts specific count"""
+        t = mi.tabulate(lambda x: 2 * x, -1)
+        f = (next(t), next(t), next(t))
+        self.assertEqual(f, (-2, 0, 2))
+
+
+class TailTests(TestCase):
+    """Tests for ``tail()``"""
+
+    def test_greater(self):
+        """Length of iterable is greather than requested tail"""
+        self.assertEqual(list(mi.tail(3, 'ABCDEFG')), ['E', 'F', 'G'])
+
+    def test_equal(self):
+        """Length of iterable is equal to the requested tail"""
+        self.assertEqual(
+            list(mi.tail(7, 'ABCDEFG')), ['A', 'B', 'C', 'D', 'E', 'F', 'G']
+        )
+
+    def test_less(self):
+        """Length of iterable is less than requested tail"""
+        self.assertEqual(
+            list(mi.tail(8, 'ABCDEFG')), ['A', 'B', 'C', 'D', 'E', 'F', 'G']
+        )
+
+
+class ConsumeTests(TestCase):
+    """Tests for ``consume()``"""
+
+    def test_sanity(self):
+        """Test basic functionality"""
+        r = (x for x in range(10))
+        mi.consume(r, 3)
+        self.assertEqual(3, next(r))
+
+    def test_null_consume(self):
+        """Check the null case"""
+        r = (x for x in range(10))
+        mi.consume(r, 0)
+        self.assertEqual(0, next(r))
+
+    def test_negative_consume(self):
+        """Check that negative consumsion throws an error"""
+        r = (x for x in range(10))
+        self.assertRaises(ValueError, lambda: mi.consume(r, -1))
+
+    def test_total_consume(self):
+        """Check that iterator is totally consumed by default"""
+        r = (x for x in range(10))
+        mi.consume(r)
+        self.assertRaises(StopIteration, lambda: next(r))
+
+
+class NthTests(TestCase):
+    """Tests for ``nth()``"""
+
+    def test_basic(self):
+        """Make sure the nth item is returned"""
+        l = range(10)
+        for i, v in enumerate(l):
+            self.assertEqual(mi.nth(l, i), v)
+
+    def test_default(self):
+        """Ensure a default value is returned when nth item not found"""
+        l = range(3)
+        self.assertEqual(mi.nth(l, 100, "zebra"), "zebra")
+
+    def test_negative_item_raises(self):
+        """Ensure asking for a negative item raises an exception"""
+        self.assertRaises(ValueError, lambda: mi.nth(range(10), -3))
+
+
+class AllEqualTests(TestCase):
+    """Tests for ``all_equal()``"""
+
+    def test_true(self):
+        """Everything is equal"""
+        self.assertTrue(mi.all_equal('aaaaaa'))
+        self.assertTrue(mi.all_equal([0, 0, 0, 0]))
+
+    def test_false(self):
+        """Not everything is equal"""
+        self.assertFalse(mi.all_equal('aaaaab'))
+        self.assertFalse(mi.all_equal([0, 0, 0, 1]))
+
+    def test_tricky(self):
+        """Not everything is identical, but everything is equal"""
+        items = [1, complex(1, 0), 1.0]
+        self.assertTrue(mi.all_equal(items))
+
+    def test_empty(self):
+        """Return True if the iterable is empty"""
+        self.assertTrue(mi.all_equal(''))
+        self.assertTrue(mi.all_equal([]))
+
+    def test_one(self):
+        """Return True if the iterable is singular"""
+        self.assertTrue(mi.all_equal('0'))
+        self.assertTrue(mi.all_equal([0]))
+
+
+class QuantifyTests(TestCase):
+    """Tests for ``quantify()``"""
+
+    def test_happy_path(self):
+        """Make sure True count is returned"""
+        q = [True, False, True]
+        self.assertEqual(mi.quantify(q), 2)
+
+    def test_custom_predicate(self):
+        """Ensure non-default predicates return as expected"""
+        q = range(10)
+        self.assertEqual(mi.quantify(q, lambda x: x % 2 == 0), 5)
+
+
+class PadnoneTests(TestCase):
+    """Tests for ``padnone()``"""
+
+    def test_happy_path(self):
+        """wrapper iterator should return None indefinitely"""
+        r = range(2)
+        p = mi.padnone(r)
+        self.assertEqual([0, 1, None, None], [next(p) for _ in range(4)])
+
+
+class NcyclesTests(TestCase):
+    """Tests for ``nyclces()``"""
+
+    def test_happy_path(self):
+        """cycle a sequence three times"""
+        r = ["a", "b", "c"]
+        n = mi.ncycles(r, 3)
+        self.assertEqual(
+            ["a", "b", "c", "a", "b", "c", "a", "b", "c"],
+            list(n)
+        )
+
+    def test_null_case(self):
+        """asking for 0 cycles should return an empty iterator"""
+        n = mi.ncycles(range(100), 0)
+        self.assertRaises(StopIteration, lambda: next(n))
+
+    def test_pathalogical_case(self):
+        """asking for negative cycles should return an empty iterator"""
+        n = mi.ncycles(range(100), -10)
+        self.assertRaises(StopIteration, lambda: next(n))
+
+
+class DotproductTests(TestCase):
+    """Tests for ``dotproduct()``'"""
+
+    def test_happy_path(self):
+        """simple dotproduct example"""
+        self.assertEqual(400, mi.dotproduct([10, 10], [20, 20]))
+
+
+class FlattenTests(TestCase):
+    """Tests for ``flatten()``"""
+
+    def test_basic_usage(self):
+        """ensure list of lists is flattened one level"""
+        f = [[0, 1, 2], [3, 4, 5]]
+        self.assertEqual(list(range(6)), list(mi.flatten(f)))
+
+    def test_single_level(self):
+        """ensure list of lists is flattened only one level"""
+        f = [[0, [1, 2]], [[3, 4], 5]]
+        self.assertEqual([0, [1, 2], [3, 4], 5], list(mi.flatten(f)))
+
+
+class RepeatfuncTests(TestCase):
+    """Tests for ``repeatfunc()``"""
+
+    def test_simple_repeat(self):
+        """test simple repeated functions"""
+        r = mi.repeatfunc(lambda: 5)
+        self.assertEqual([5, 5, 5, 5, 5], [next(r) for _ in range(5)])
+
+    def test_finite_repeat(self):
+        """ensure limited repeat when times is provided"""
+        r = mi.repeatfunc(lambda: 5, times=5)
+        self.assertEqual([5, 5, 5, 5, 5], list(r))
+
+    def test_added_arguments(self):
+        """ensure arguments are applied to the function"""
+        r = mi.repeatfunc(lambda x: x, 2, 3)
+        self.assertEqual([3, 3], list(r))
+
+    def test_null_times(self):
+        """repeat 0 should return an empty iterator"""
+        r = mi.repeatfunc(range, 0, 3)
+        self.assertRaises(StopIteration, lambda: next(r))
+
+
+class PairwiseTests(TestCase):
+    """Tests for ``pairwise()``"""
+
+    def test_base_case(self):
+        """ensure an iterable will return pairwise"""
+        p = mi.pairwise([1, 2, 3])
+        self.assertEqual([(1, 2), (2, 3)], list(p))
+
+    def test_short_case(self):
+        """ensure an empty iterator if there's not enough values to pair"""
+        p = mi.pairwise("a")
+        self.assertRaises(StopIteration, lambda: next(p))
+
+
+class GrouperTests(TestCase):
+    """Tests for ``grouper()``"""
+
+    def test_even(self):
+        """Test when group size divides evenly into the length of
+        the iterable.
+
+        """
+        self.assertEqual(
+            list(mi.grouper(3, 'ABCDEF')), [('A', 'B', 'C'), ('D', 'E', 'F')]
+        )
+
+    def test_odd(self):
+        """Test when group size does not divide evenly into the length of the
+        iterable.
+
+        """
+        self.assertEqual(
+            list(mi.grouper(3, 'ABCDE')), [('A', 'B', 'C'), ('D', 'E', None)]
+        )
+
+    def test_fill_value(self):
+        """Test that the fill value is used to pad the final group"""
+        self.assertEqual(
+            list(mi.grouper(3, 'ABCDE', 'x')),
+            [('A', 'B', 'C'), ('D', 'E', 'x')]
+        )
+
+
+class RoundrobinTests(TestCase):
+    """Tests for ``roundrobin()``"""
+
+    def test_even_groups(self):
+        """Ensure ordered output from evenly populated iterables"""
+        self.assertEqual(
+            list(mi.roundrobin('ABC', [1, 2, 3], range(3))),
+            ['A', 1, 0, 'B', 2, 1, 'C', 3, 2]
+        )
+
+    def test_uneven_groups(self):
+        """Ensure ordered output from unevenly populated iterables"""
+        self.assertEqual(
+            list(mi.roundrobin('ABCD', [1, 2], range(0))),
+            ['A', 1, 'B', 2, 'C', 'D']
+        )
+
+
+class PartitionTests(TestCase):
+    """Tests for ``partition()``"""
+
+    def test_bool(self):
+        """Test when pred() returns a boolean"""
+        lesser, greater = mi.partition(lambda x: x > 5, range(10))
+        self.assertEqual(list(lesser), [0, 1, 2, 3, 4, 5])
+        self.assertEqual(list(greater), [6, 7, 8, 9])
+
+    def test_arbitrary(self):
+        """Test when pred() returns an integer"""
+        divisibles, remainders = mi.partition(lambda x: x % 3, range(10))
+        self.assertEqual(list(divisibles), [0, 3, 6, 9])
+        self.assertEqual(list(remainders), [1, 2, 4, 5, 7, 8])
+
+
+class PowersetTests(TestCase):
+    """Tests for ``powerset()``"""
+
+    def test_combinatorics(self):
+        """Ensure a proper enumeration"""
+        p = mi.powerset([1, 2, 3])
+        self.assertEqual(
+            list(p),
+            [(), (1,), (2,), (3,), (1, 2), (1, 3), (2, 3), (1, 2, 3)]
+        )
+
+
+class UniqueEverseenTests(TestCase):
+    """Tests for ``unique_everseen()``"""
+
+    def test_everseen(self):
+        """ensure duplicate elements are ignored"""
+        u = mi.unique_everseen('AAAABBBBCCDAABBB')
+        self.assertEqual(
+            ['A', 'B', 'C', 'D'],
+            list(u)
+        )
+
+    def test_custom_key(self):
+        """ensure the custom key comparison works"""
+        u = mi.unique_everseen('aAbACCc', key=str.lower)
+        self.assertEqual(list('abC'), list(u))
+
+    def test_unhashable(self):
+        """ensure things work for unhashable items"""
+        iterable = ['a', [1, 2, 3], [1, 2, 3], 'a']
+        u = mi.unique_everseen(iterable)
+        self.assertEqual(list(u), ['a', [1, 2, 3]])
+
+    def test_unhashable_key(self):
+        """ensure things work for unhashable items with a custom key"""
+        iterable = ['a', [1, 2, 3], [1, 2, 3], 'a']
+        u = mi.unique_everseen(iterable, key=lambda x: x)
+        self.assertEqual(list(u), ['a', [1, 2, 3]])
+
+
+class UniqueJustseenTests(TestCase):
+    """Tests for ``unique_justseen()``"""
+
+    def test_justseen(self):
+        """ensure only last item is remembered"""
+        u = mi.unique_justseen('AAAABBBCCDABB')
+        self.assertEqual(list('ABCDAB'), list(u))
+
+    def test_custom_key(self):
+        """ensure the custom key comparison works"""
+        u = mi.unique_justseen('AABCcAD', str.lower)
+        self.assertEqual(list('ABCAD'), list(u))
+
+
+class IterExceptTests(TestCase):
+    """Tests for ``iter_except()``"""
+
+    def test_exact_exception(self):
+        """ensure the exact specified exception is caught"""
+        l = [1, 2, 3]
+        i = mi.iter_except(l.pop, IndexError)
+        self.assertEqual(list(i), [3, 2, 1])
+
+    def test_generic_exception(self):
+        """ensure the generic exception can be caught"""
+        l = [1, 2]
+        i = mi.iter_except(l.pop, Exception)
+        self.assertEqual(list(i), [2, 1])
+
+    def test_uncaught_exception_is_raised(self):
+        """ensure a non-specified exception is raised"""
+        l = [1, 2, 3]
+        i = mi.iter_except(l.pop, KeyError)
+        self.assertRaises(IndexError, lambda: list(i))
+
+    def test_first(self):
+        """ensure first is run before the function"""
+        l = [1, 2, 3]
+        f = lambda: 25
+        i = mi.iter_except(l.pop, IndexError, f)
+        self.assertEqual(list(i), [25, 3, 2, 1])
+
+
+class FirstTrueTests(TestCase):
+    """Tests for ``first_true()``"""
+
+    def test_something_true(self):
+        """Test with no keywords"""
+        self.assertEqual(mi.first_true(range(10)), 1)
+
+    def test_nothing_true(self):
+        """Test default return value."""
+        self.assertEqual(mi.first_true([0, 0, 0]), False)
+
+    def test_default(self):
+        """Test with a default keyword"""
+        self.assertEqual(mi.first_true([0, 0, 0], default='!'), '!')
+
+    def test_pred(self):
+        """Test with a custom predicate"""
+        self.assertEqual(
+            mi.first_true([2, 4, 6], pred=lambda x: x % 3 == 0), 6
+        )
+
+
+class RandomProductTests(TestCase):
+    """Tests for ``random_product()``
+
+    Since random.choice() has different results with the same seed across
+    python versions 2.x and 3.x, these tests use highly probably events to
+    create predictable outcomes across platforms.
+    """
+
+    def test_simple_lists(self):
+        """Ensure that one item is chosen from each list in each pair.
+        Also ensure that each item from each list eventually appears in
+        the chosen combinations.
+
+        Odds are roughly 1 in 7.1 * 10e16 that one item from either list will
+        not be chosen after 100 samplings of one item from each list. Just to
+        be safe, better use a known random seed, too.
+
+        """
+        nums = [1, 2, 3]
+        lets = ['a', 'b', 'c']
+        n, m = zip(*[mi.random_product(nums, lets) for _ in range(100)])
+        n, m = set(n), set(m)
+        self.assertEqual(n, set(nums))
+        self.assertEqual(m, set(lets))
+        self.assertEqual(len(n), len(nums))
+        self.assertEqual(len(m), len(lets))
+
+    def test_list_with_repeat(self):
+        """ensure multiple items are chosen, and that they appear to be chosen
+        from one list then the next, in proper order.
+
+        """
+        nums = [1, 2, 3]
+        lets = ['a', 'b', 'c']
+        r = list(mi.random_product(nums, lets, repeat=100))
+        self.assertEqual(2 * 100, len(r))
+        n, m = set(r[::2]), set(r[1::2])
+        self.assertEqual(n, set(nums))
+        self.assertEqual(m, set(lets))
+        self.assertEqual(len(n), len(nums))
+        self.assertEqual(len(m), len(lets))
+
+
+class RandomPermutationTests(TestCase):
+    """Tests for ``random_permutation()``"""
+
+    def test_full_permutation(self):
+        """ensure every item from the iterable is returned in a new ordering
+
+        15 elements have a 1 in 1.3 * 10e12 of appearing in sorted order, so
+        we fix a seed value just to be sure.
+
+        """
+        i = range(15)
+        r = mi.random_permutation(i)
+        self.assertEqual(set(i), set(r))
+        if i == r:
+            raise AssertionError("Values were not permuted")
+
+    def test_partial_permutation(self):
+        """ensure all returned items are from the iterable, that the returned
+        permutation is of the desired length, and that all items eventually
+        get returned.
+
+        Sampling 100 permutations of length 5 from a set of 15 leaves a
+        (2/3)^100 chance that an item will not be chosen. Multiplied by 15
+        items, there is a 1 in 2.6e16 chance that at least 1 item will not
+        show up in the resulting output. Using a random seed will fix that.
+
+        """
+        items = range(15)
+        item_set = set(items)
+        all_items = set()
+        for _ in range(100):
+            permutation = mi.random_permutation(items, 5)
+            self.assertEqual(len(permutation), 5)
+            permutation_set = set(permutation)
+            self.assertLessEqual(permutation_set, item_set)
+            all_items |= permutation_set
+        self.assertEqual(all_items, item_set)
+
+
+class RandomCombinationTests(TestCase):
+    """Tests for ``random_combination()``"""
+
+    def test_psuedorandomness(self):
+        """ensure different subsets of the iterable get returned over many
+        samplings of random combinations"""
+        items = range(15)
+        all_items = set()
+        for _ in range(50):
+            combination = mi.random_combination(items, 5)
+            all_items |= set(combination)
+        self.assertEqual(all_items, set(items))
+
+    def test_no_replacement(self):
+        """ensure that elements are sampled without replacement"""
+        items = range(15)
+        for _ in range(50):
+            combination = mi.random_combination(items, len(items))
+            self.assertEqual(len(combination), len(set(combination)))
+        self.assertRaises(
+            ValueError, lambda: mi.random_combination(items, len(items) + 1)
+        )
+
+
+class RandomCombinationWithReplacementTests(TestCase):
+    """Tests for ``random_combination_with_replacement()``"""
+
+    def test_replacement(self):
+        """ensure that elements are sampled with replacement"""
+        items = range(5)
+        combo = mi.random_combination_with_replacement(items, len(items) * 2)
+        self.assertEqual(2 * len(items), len(combo))
+        if len(set(combo)) == len(combo):
+            raise AssertionError("Combination contained no duplicates")
+
+    def test_pseudorandomness(self):
+        """ensure different subsets of the iterable get returned over many
+        samplings of random combinations"""
+        items = range(15)
+        all_items = set()
+        for _ in range(50):
+            combination = mi.random_combination_with_replacement(items, 5)
+            all_items |= set(combination)
+        self.assertEqual(all_items, set(items))
+
+
+class NthCombinationTests(TestCase):
+    def test_basic(self):
+        iterable = 'abcdefg'
+        r = 4
+        for index, expected in enumerate(combinations(iterable, r)):
+            actual = mi.nth_combination(iterable, r, index)
+            self.assertEqual(actual, expected)
+
+    def test_long(self):
+        actual = mi.nth_combination(range(180), 4, 2000000)
+        expected = (2, 12, 35, 126)
+        self.assertEqual(actual, expected)
+
+
+class PrependTests(TestCase):
+    def test_basic(self):
+        value = 'a'
+        iterator = iter('bcdefg')
+        actual = list(mi.prepend(value, iterator))
+        expected = list('abcdefg')
+        self.assertEqual(actual, expected)
+
+    def test_multiple(self):
+        value = 'ab'
+        iterator = iter('cdefg')
+        actual = tuple(mi.prepend(value, iterator))
+        expected = ('ab',) + tuple('cdefg')
+        self.assertEqual(actual, expected)
new file mode 100644
--- /dev/null
+++ b/third_party/python/more-itertools/setup.cfg
@@ -0,0 +1,8 @@
+[flake8]
+exclude = ./docs/conf.py, .eggs/
+ignore = E731, E741, F999
+
+[egg_info]
+tag_build = 
+tag_date = 0
+
new file mode 100644
--- /dev/null
+++ b/third_party/python/more-itertools/setup.py
@@ -0,0 +1,59 @@
+# Hack to prevent stupid error on exit of `python setup.py test`. (See
+# http://www.eby-sarna.com/pipermail/peak/2010-May/003357.html.)
+try:
+    import multiprocessing  # noqa
+except ImportError:
+    pass
+from re import sub
+
+from setuptools import setup, find_packages
+
+
+def get_long_description():
+    # Fix display issues on PyPI caused by RST markup
+    readme = open('README.rst').read()
+
+    version_lines = []
+    with open('docs/versions.rst') as infile:
+        next(infile)
+        for line in infile:
+            line = line.rstrip().replace('.. automodule:: more_itertools', '')
+            version_lines.append(line)
+    version_history = '\n'.join(version_lines)
+    version_history = sub(r':func:`([a-zA-Z0-9._]+)`', r'\1', version_history)
+
+    ret = readme + '\n\n' + version_history
+    return ret
+
+
+setup(
+    name='more-itertools',
+    version='4.2.0',
+    description='More routines for operating on iterables, beyond itertools',
+    long_description=get_long_description(),
+    author='Erik Rose',
+    author_email='erikrose@grinchcentral.com',
+    license='MIT',
+    packages=find_packages(exclude=['ez_setup']),
+    install_requires=['six>=1.0.0,<2.0.0'],
+    test_suite='more_itertools.tests',
+    url='https://github.com/erikrose/more-itertools',
+    include_package_data=True,
+    classifiers=[
+        'Development Status :: 5 - Production/Stable',
+        'Intended Audience :: Developers',
+        'Natural Language :: English',
+        'License :: OSI Approved :: MIT License',
+        'Programming Language :: Python :: 2',
+        'Programming Language :: Python :: 2.7',
+        'Programming Language :: Python :: 3',
+        'Programming Language :: Python :: 3.2',
+        'Programming Language :: Python :: 3.3',
+        'Programming Language :: Python :: 3.4',
+        'Programming Language :: Python :: 3.5',
+        'Programming Language :: Python :: 3.6',
+        'Programming Language :: Python :: 3.7',
+        'Topic :: Software Development :: Libraries'],
+    keywords=['itertools', 'iterator', 'iteration', 'filter', 'peek',
+              'peekable', 'collate', 'chunk', 'chunked'],
+)
new file mode 100644
--- /dev/null
+++ b/third_party/python/more-itertools/tox.ini
@@ -0,0 +1,5 @@
+[tox]
+envlist = py27, py34, py35, py36, py37
+
+[testenv]
+commands = {envbindir}/python -m unittest discover -v
rename from third_party/python/pytest/_pytest/vendored_packages/pluggy-0.4.0.dist-info/LICENSE.txt
rename to third_party/python/pluggy/LICENSE
new file mode 100644
--- /dev/null
+++ b/third_party/python/pluggy/MANIFEST.in
@@ -0,0 +1,7 @@
+include CHANGELOG
+include README.rst
+include setup.py
+include tox.ini
+include LICENSE
+graft testing
+recursive-exclude * *.pyc *.pyo
new file mode 100644
--- /dev/null
+++ b/third_party/python/pluggy/PKG-INFO
@@ -0,0 +1,112 @@
+Metadata-Version: 1.2
+Name: pluggy
+Version: 0.6.0
+Summary: plugin and hook calling mechanisms for python
+Home-page: https://github.com/pytest-dev/pluggy
+Author: Holger Krekel
+Author-email: holger@merlinux.eu
+License: MIT license
+Description-Content-Type: UNKNOWN
+Description: pluggy - A minimalist production ready plugin system
+        ====================================================
+        |pypi| |anaconda| |versions| |travis| |appveyor|
+        
+        
+        This is the core framework used by the `pytest`_, `tox`_, and `devpi`_ projects.
+        
+        Please `read the docs`_ to learn more!
+        
+        A definitive example
+        ********************
+        .. code-block:: python
+        
+            import pluggy
+        
+            hookspec = pluggy.HookspecMarker("myproject")
+            hookimpl = pluggy.HookimplMarker("myproject")
+        
+        
+            class MySpec(object):
+                """A hook specification namespace.
+                """
+                @hookspec
+                def myhook(self, arg1, arg2):
+                    """My special little hook that you can customize.
+                    """
+        
+        
+            class Plugin_1(object):
+                """A hook implementation namespace.
+                """
+                @hookimpl
+                def myhook(self, arg1, arg2):
+                    print("inside Plugin_1.myhook()")
+                    return arg1 + arg2
+        
+        
+            class Plugin_2(object):
+                """A 2nd hook implementation namespace.
+                """
+                @hookimpl
+                def myhook(self, arg1, arg2):
+                    print("inside Plugin_2.myhook()")
+                    return arg1 - arg2
+        
+        
+            # create a manager and add the spec
+            pm = pluggy.PluginManager("myproject")
+            pm.add_hookspecs(MySpec)
+        
+            # register plugins
+            pm.register(Plugin_1())
+            pm.register(Plugin_2())
+        
+            # call our `myhook` hook
+            results = pm.hook.myhook(arg1=1, arg2=2)
+            print(results)
+        
+        
+        .. badges
+        .. |pypi| image:: https://img.shields.io/pypi/v/pluggy.svg
+            :target: https://pypi.python.org/pypi/pluggy
+        .. |versions| image:: https://img.shields.io/pypi/pyversions/pluggy.svg
+            :target: https://pypi.python.org/pypi/pluggy
+        .. |travis| image:: https://img.shields.io/travis/pytest-dev/pluggy/master.svg
+            :target: https://travis-ci.org/pytest-dev/pluggy
+        .. |appveyor| image:: https://img.shields.io/appveyor/ci/pytestbot/pluggy/master.svg
+            :target: https://ci.appveyor.com/project/pytestbot/pluggy
+        .. |anaconda| image:: https://anaconda.org/conda-forge/pluggy/badges/version.svg
+            :target: https://anaconda.org/conda-forge/pluggy
+        
+        .. links
+        .. _pytest:
+            http://pytest.org
+        .. _tox:
+            https://tox.readthedocs.org
+        .. _devpi:
+            http://doc.devpi.net
+        .. _read the docs:
+           https://pluggy.readthedocs.io/en/latest/
+        
+Platform: unix
+Platform: linux
+Platform: osx
+Platform: win32
+Classifier: Development Status :: 4 - Beta
+Classifier: Intended Audience :: Developers
+Classifier: License :: OSI Approved :: MIT License
+Classifier: Operating System :: POSIX
+Classifier: Operating System :: Microsoft :: Windows
+Classifier: Operating System :: MacOS :: MacOS X
+Classifier: Topic :: Software Development :: Testing
+Classifier: Topic :: Software Development :: Libraries
+Classifier: Topic :: Utilities
+Classifier: Programming Language :: Python :: Implementation :: CPython
+Classifier: Programming Language :: Python :: Implementation :: PyPy
+Classifier: Programming Language :: Python :: 2
+Classifier: Programming Language :: Python :: 2.7
+Classifier: Programming Language :: Python :: 3
+Classifier: Programming Language :: Python :: 3.4
+Classifier: Programming Language :: Python :: 3.5
+Classifier: Programming Language :: Python :: 3.6
+Requires-Python: >=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*
new file mode 100644
--- /dev/null
+++ b/third_party/python/pluggy/README.rst
@@ -0,0 +1,80 @@
+pluggy - A minimalist production ready plugin system
+====================================================
+|pypi| |anaconda| |versions| |travis| |appveyor|
+
+
+This is the core framework used by the `pytest`_, `tox`_, and `devpi`_ projects.
+
+Please `read the docs`_ to learn more!
+
+A definitive example
+********************
+.. code-block:: python
+
+    import pluggy
+
+    hookspec = pluggy.HookspecMarker("myproject")
+    hookimpl = pluggy.HookimplMarker("myproject")
+
+
+    class MySpec(object):
+        """A hook specification namespace.
+        """
+        @hookspec
+        def myhook(self, arg1, arg2):
+            """My special little hook that you can customize.
+            """
+
+
+    class Plugin_1(object):
+        """A hook implementation namespace.
+        """
+        @hookimpl
+        def myhook(self, arg1, arg2):
+            print("inside Plugin_1.myhook()")
+            return arg1 + arg2
+
+
+    class Plugin_2(object):
+        """A 2nd hook implementation namespace.
+        """
+        @hookimpl
+        def myhook(self, arg1, arg2):
+            print("inside Plugin_2.myhook()")
+            return arg1 - arg2
+
+
+    # create a manager and add the spec
+    pm = pluggy.PluginManager("myproject")
+    pm.add_hookspecs(MySpec)
+
+    # register plugins
+    pm.register(Plugin_1())
+    pm.register(Plugin_2())
+
+    # call our `myhook` hook
+    results = pm.hook.myhook(arg1=1, arg2=2)
+    print(results)
+
+
+.. badges
+.. |pypi| image:: https://img.shields.io/pypi/v/pluggy.svg
+    :target: https://pypi.python.org/pypi/pluggy
+.. |versions| image:: https://img.shields.io/pypi/pyversions/pluggy.svg
+    :target: https://pypi.python.org/pypi/pluggy
+.. |travis| image:: https://img.shields.io/travis/pytest-dev/pluggy/master.svg
+    :target: https://travis-ci.org/pytest-dev/pluggy
+.. |appveyor| image:: https://img.shields.io/appveyor/ci/pytestbot/pluggy/master.svg
+    :target: https://ci.appveyor.com/project/pytestbot/pluggy
+.. |anaconda| image:: https://anaconda.org/conda-forge/pluggy/badges/version.svg
+    :target: https://anaconda.org/conda-forge/pluggy
+
+.. links
+.. _pytest:
+    http://pytest.org
+.. _tox:
+    https://tox.readthedocs.org
+.. _devpi:
+    http://doc.devpi.net
+.. _read the docs:
+   https://pluggy.readthedocs.io/en/latest/
new file mode 100644
--- /dev/null
+++ b/third_party/python/pluggy/pluggy/__init__.py
@@ -0,0 +1,684 @@
+import inspect
+import warnings
+from .callers import _multicall, HookCallError, _Result, _legacymulticall
+
+__version__ = '0.6.0'
+
+__all__ = ["PluginManager", "PluginValidationError", "HookCallError",
+           "HookspecMarker", "HookimplMarker"]
+
+
+class PluginValidationError(Exception):
+    """ plugin failed validation. """
+
+
+class HookspecMarker(object):
+    """ Decorator helper class for marking functions as hook specifications.
+
+    You can instantiate it with a project_name to get a decorator.
+    Calling PluginManager.add_hookspecs later will discover all marked functions
+    if the PluginManager uses the same project_name.
+    """
+
+    def __init__(self, project_name):
+        self.project_name = project_name
+
+    def __call__(self, function=None, firstresult=False, historic=False):
+        """ if passed a function, directly sets attributes on the function
+        which will make it discoverable to add_hookspecs().  If passed no
+        function, returns a decorator which can be applied to a function
+        later using the attributes supplied.
+
+        If firstresult is True the 1:N hook call (N being the number of registered
+        hook implementation functions) will stop at I<=N when the I'th function
+        returns a non-None result.
+
+        If historic is True calls to a hook will be memorized and replayed
+        on later registered plugins.
+
+        """
+        def setattr_hookspec_opts(func):
+            if historic and firstresult:
+                raise ValueError("cannot have a historic firstresult hook")
+            setattr(func, self.project_name + "_spec",
+                    dict(firstresult=firstresult, historic=historic))
+            return func
+
+        if function is not None:
+            return setattr_hookspec_opts(function)
+        else:
+            return setattr_hookspec_opts
+
+
+class HookimplMarker(object):
+    """ Decorator helper class for marking functions as hook implementations.
+
+    You can instantiate with a project_name to get a decorator.
+    Calling PluginManager.register later will discover all marked functions
+    if the PluginManager uses the same project_name.
+    """
+    def __init__(self, project_name):
+        self.project_name = project_name
+
+    def __call__(self, function=None, hookwrapper=False, optionalhook=False,
+                 tryfirst=False, trylast=False):
+
+        """ if passed a function, directly sets attributes on the function
+        which will make it discoverable to register().  If passed no function,
+        returns a decorator which can be applied to a function later using
+        the attributes supplied.
+
+        If optionalhook is True a missing matching hook specification will not result
+        in an error (by default it is an error if no matching spec is found).
+
+        If tryfirst is True this hook implementation will run as early as possible
+        in the chain of N hook implementations for a specfication.
+
+        If trylast is True this hook implementation will run as late as possible
+        in the chain of N hook implementations.
+
+        If hookwrapper is True the hook implementations needs to execute exactly
+        one "yield".  The code before the yield is run early before any non-hookwrapper
+        function is run.  The code after the yield is run after all non-hookwrapper
+        function have run.  The yield receives a ``_Result`` object representing
+        the exception or result outcome of the inner calls (including other hookwrapper
+        calls).
+
+        """
+        def setattr_hookimpl_opts(func):
+            setattr(func, self.project_name + "_impl",
+                    dict(hookwrapper=hookwrapper, optionalhook=optionalhook,
+                         tryfirst=tryfirst, trylast=trylast))
+            return func
+
+        if function is None:
+            return setattr_hookimpl_opts
+        else:
+            return setattr_hookimpl_opts(function)
+
+
+def normalize_hookimpl_opts(opts):
+    opts.setdefault("tryfirst", False)
+    opts.setdefault("trylast", False)
+    opts.setdefault("hookwrapper", False)
+    opts.setdefault("optionalhook", False)
+
+
+class _TagTracer(object):
+    def __init__(self):
+        self._tag2proc = {}
+        self.writer = None
+        self.indent = 0
+
+    def get(self, name):
+        return _TagTracerSub(self, (name,))
+
+    def format_message(self, tags, args):
+        if isinstance(args[-1], dict):
+            extra = args[-1]
+            args = args[:-1]
+        else:
+            extra = {}
+
+        content = " ".join(map(str, args))
+        indent = "  " * self.indent
+
+        lines = [
+            "%s%s [%s]\n" % (indent, content, ":".join(tags))
+        ]
+
+        for name, value in extra.items():
+            lines.append("%s    %s: %s\n" % (indent, name, value))
+        return lines
+
+    def processmessage(self, tags, args):
+        if self.writer is not None and args:
+            lines = self.format_message(tags, args)
+            self.writer(''.join(lines))
+        try:
+            self._tag2proc[tags](tags, args)
+        except KeyError:
+            pass
+
+    def setwriter(self, writer):
+        self.writer = writer
+
+    def setprocessor(self, tags, processor):
+        if isinstance(tags, str):
+            tags = tuple(tags.split(":"))
+        else:
+            assert isinstance(tags, tuple)
+        self._tag2proc[tags] = processor
+
+
+class _TagTracerSub(object):
+    def __init__(self, root, tags):
+        self.root = root
+        self.tags = tags
+
+    def __call__(self, *args):
+        self.root.processmessage(self.tags, args)
+
+    def setmyprocessor(self, processor):
+        self.root.setprocessor(self.tags, processor)
+
+    def get(self, name):
+        return self.__class__(self.root, self.tags + (name,))
+
+
+class _TracedHookExecution(object):
+    def __init__(self, pluginmanager, before, after):
+        self.pluginmanager = pluginmanager
+        self.before = before
+        self.after = after
+        self.oldcall = pluginmanager._inner_hookexec
+        assert not isinstance(self.oldcall, _TracedHookExecution)
+        self.pluginmanager._inner_hookexec = self
+
+    def __call__(self, hook, hook_impls, kwargs):
+        self.before(hook.name, hook_impls, kwargs)
+        outcome = _Result.from_call(lambda: self.oldcall(hook, hook_impls, kwargs))
+        self.after(outcome, hook.name, hook_impls, kwargs)
+        return outcome.get_result()
+
+    def undo(self):
+        self.pluginmanager._inner_hookexec = self.oldcall
+
+
+class PluginManager(object):
+    """ Core Pluginmanager class which manages registration
+    of plugin objects and 1:N hook calling.
+
+    You can register new hooks by calling ``add_hookspec(module_or_class)``.
+    You can register plugin objects (which contain hooks) by calling
+    ``register(plugin)``.  The Pluginmanager is initialized with a
+    prefix that is searched for in the names of the dict of registered
+    plugin objects.  An optional excludefunc allows to blacklist names which
+    are not considered as hooks despite a matching prefix.
+
+    For debugging purposes you can call ``enable_tracing()``
+    which will subsequently send debug information to the trace helper.
+    """
+
+    def __init__(self, project_name, implprefix=None):
+        """ if implprefix is given implementation functions
+        will be recognized if their name matches the implprefix. """
+        self.project_name = project_name
+        self._name2plugin = {}
+        self._plugin2hookcallers = {}
+        self._plugin_distinfo = []
+        self.trace = _TagTracer().get("pluginmanage")
+        self.hook = _HookRelay(self.trace.root.get("hook"))
+        self._implprefix = implprefix
+        self._inner_hookexec = lambda hook, methods, kwargs: \
+            hook.multicall(
+                methods, kwargs,
+                firstresult=hook.spec_opts.get('firstresult'),
+            )
+
+    def _hookexec(self, hook, methods, kwargs):
+        # called from all hookcaller instances.
+        # enable_tracing will set its own wrapping function at self._inner_hookexec
+        return self._inner_hookexec(hook, methods, kwargs)
+
+    def register(self, plugin, name=None):
+        """ Register a plugin and return its canonical name or None if the name
+        is blocked from registering.  Raise a ValueError if the plugin is already
+        registered. """
+        plugin_name = name or self.get_canonical_name(plugin)
+
+        if plugin_name in self._name2plugin or plugin in self._plugin2hookcallers:
+            if self._name2plugin.get(plugin_name, -1) is None:
+                return  # blocked plugin, return None to indicate no registration
+            raise ValueError("Plugin already registered: %s=%s\n%s" %
+                             (plugin_name, plugin, self._name2plugin))
+
+        # XXX if an error happens we should make sure no state has been
+        # changed at point of return
+        self._name2plugin[plugin_name] = plugin
+
+        # register matching hook implementations of the plugin
+        self._plugin2hookcallers[plugin] = hookcallers = []
+        for name in dir(plugin):
+            hookimpl_opts = self.parse_hookimpl_opts(plugin, name)
+            if hookimpl_opts is not None:
+                normalize_hookimpl_opts(hookimpl_opts)
+                method = getattr(plugin, name)
+                hookimpl = HookImpl(plugin, plugin_name, method, hookimpl_opts)
+                hook = getattr(self.hook, name, None)
+                if hook is None:
+                    hook = _HookCaller(name, self._hookexec)
+                    setattr(self.hook, name, hook)
+                elif hook.has_spec():
+                    self._verify_hook(hook, hookimpl)
+                    hook._maybe_apply_history(hookimpl)
+                hook._add_hookimpl(hookimpl)
+                hookcallers.append(hook)
+        return plugin_name
+
+    def parse_hookimpl_opts(self, plugin, name):
+        method = getattr(plugin, name)
+        if not inspect.isroutine(method):
+            return
+        try:
+            res = getattr(method, self.project_name + "_impl", None)
+        except Exception:
+            res = {}
+        if res is not None and not isinstance(res, dict):
+            # false positive
+            res = None
+        elif res is None and self._implprefix and name.startswith(self._implprefix):
+            res = {}
+        return res
+
+    def unregister(self, plugin=None, name=None):
+        """ unregister a plugin object and all its contained hook implementations
+        from internal data structures. """
+        if name is None:
+            assert plugin is not None, "one of name or plugin needs to be specified"
+            name = self.get_name(plugin)
+
+        if plugin is None:
+            plugin = self.get_plugin(name)
+
+        # if self._name2plugin[name] == None registration was blocked: ignore
+        if self._name2plugin.get(name):
+            del self._name2plugin[name]
+
+        for hookcaller in self._plugin2hookcallers.pop(plugin, []):
+            hookcaller._remove_plugin(plugin)
+
+        return plugin
+
+    def set_blocked(self, name):
+        """ block registrations of the given name, unregister if already registered. """
+        self.unregister(name=name)
+        self._name2plugin[name] = None
+
+    def is_blocked(self, name):
+        """ return True if the name blogs registering plugins of that name. """
+        return name in self._name2plugin and self._name2plugin[name] is None
+
+    def add_hookspecs(self, module_or_class):
+        """ add new hook specifications defined in the given module_or_class.
+        Functions are recognized if they have been decorated accordingly. """
+        names = []
+        for name in dir(module_or_class):
+            spec_opts = self.parse_hookspec_opts(module_or_class, name)
+            if spec_opts is not None:
+                hc = getattr(self.hook, name, None)
+                if hc is None:
+                    hc = _HookCaller(name, self._hookexec, module_or_class, spec_opts)
+                    setattr(self.hook, name, hc)
+                else:
+                    # plugins registered this hook without knowing the spec
+                    hc.set_specification(module_or_class, spec_opts)
+                    for hookfunction in (hc._wrappers + hc._nonwrappers):
+                        self._verify_hook(hc, hookfunction)
+                names.append(name)
+
+        if not names:
+            raise ValueError("did not find any %r hooks in %r" %
+                             (self.project_name, module_or_class))
+
+    def parse_hookspec_opts(self, module_or_class, name):
+        method = getattr(module_or_class, name)
+        return getattr(method, self.project_name + "_spec", None)
+
+    def get_plugins(self):
+        """ return the set of registered plugins. """
+        return set(self._plugin2hookcallers)
+
+    def is_registered(self, plugin):
+        """ Return True if the plugin is already registered. """
+        return plugin in self._plugin2hookcallers
+
+    def get_canonical_name(self, plugin):
+        """ Return canonical name for a plugin object. Note that a plugin
+        may be registered under a different name which was specified
+        by the caller of register(plugin, name). To obtain the name
+        of an registered plugin use ``get_name(plugin)`` instead."""
+        return getattr(plugin, "__name__", None) or str(id(plugin))
+
+    def get_plugin(self, name):
+        """ Return a plugin or None for the given name. """
+        return self._name2plugin.get(name)
+
+    def has_plugin(self, name):
+        """ Return True if a plugin with the given name is registered. """
+        return self.get_plugin(name) is not None
+
+    def get_name(self, plugin):
+        """ Return name for registered plugin or None if not registered. """
+        for name, val in self._name2plugin.items():
+            if plugin == val:
+                return name
+
+    def _verify_hook(self, hook, hookimpl):
+        if hook.is_historic() and hookimpl.hookwrapper:
+            raise PluginValidationError(
+                "Plugin %r\nhook %r\nhistoric incompatible to hookwrapper" %
+                (hookimpl.plugin_name, hook.name))
+
+        # positional arg checking
+        notinspec = set(hookimpl.argnames) - set(hook.argnames)
+        if notinspec:
+            raise PluginValidationError(
+                "Plugin %r for hook %r\nhookimpl definition: %s\n"
+                "Argument(s) %s are declared in the hookimpl but "
+                "can not be found in the hookspec" %
+                (hookimpl.plugin_name, hook.name,
+                 _formatdef(hookimpl.function), notinspec)
+            )
+
+    def check_pending(self):
+        """ Verify that all hooks which have not been verified against
+        a hook specification are optional, otherwise raise PluginValidationError"""
+        for name in self.hook.__dict__:
+            if name[0] != "_":
+                hook = getattr(self.hook, name)
+                if not hook.has_spec():
+                    for hookimpl in (hook._wrappers + hook._nonwrappers):
+                        if not hookimpl.optionalhook:
+                            raise PluginValidationError(
+                                "unknown hook %r in plugin %r" %
+                                (name, hookimpl.plugin))
+
+    def load_setuptools_entrypoints(self, entrypoint_name):
+        """ Load modules from querying the specified setuptools entrypoint name.
+        Return the number of loaded plugins. """
+        from pkg_resources import (iter_entry_points, DistributionNotFound,
+                                   VersionConflict)
+        for ep in iter_entry_points(entrypoint_name):
+            # is the plugin registered or blocked?
+            if self.get_plugin(ep.name) or self.is_blocked(ep.name):
+                continue
+            try:
+                plugin = ep.load()
+            except DistributionNotFound:
+                continue
+            except VersionConflict as e:
+                raise PluginValidationError(
+                    "Plugin %r could not be loaded: %s!" % (ep.name, e))
+            self.register(plugin, name=ep.name)
+            self._plugin_distinfo.append((plugin, ep.dist))
+        return len(self._plugin_distinfo)
+
+    def list_plugin_distinfo(self):
+        """ return list of distinfo/plugin tuples for all setuptools registered
+        plugins. """
+        return list(self._plugin_distinfo)
+
+    def list_name_plugin(self):
+        """ return list of name/plugin pairs. """
+        return list(self._name2plugin.items())
+
+    def get_hookcallers(self, plugin):
+        """ get all hook callers for the specified plugin. """
+        return self._plugin2hookcallers.get(plugin)
+
+    def add_hookcall_monitoring(self, before, after):
+        """ add before/after tracing functions for all hooks
+        and return an undo function which, when called,
+        will remove the added tracers.
+
+        ``before(hook_name, hook_impls, kwargs)`` will be called ahead
+        of all hook calls and receive a hookcaller instance, a list
+        of HookImpl instances and the keyword arguments for the hook call.
+
+        ``after(outcome, hook_name, hook_impls, kwargs)`` receives the
+        same arguments as ``before`` but also a :py:class:`_Result`` object
+        which represents the result of the overall hook call.
+        """
+        return _TracedHookExecution(self, before, after).undo
+
+    def enable_tracing(self):
+        """ enable tracing of hook calls and return an undo function. """
+        hooktrace = self.hook._trace
+
+        def before(hook_name, methods, kwargs):
+            hooktrace.root.indent += 1
+            hooktrace(hook_name, kwargs)
+
+        def after(outcome, hook_name, methods, kwargs):
+            if outcome.excinfo is None:
+                hooktrace("finish", hook_name, "-->", outcome.get_result())
+            hooktrace.root.indent -= 1
+
+        return self.add_hookcall_monitoring(before, after)
+
+    def subset_hook_caller(self, name, remove_plugins):
+        """ Return a new _HookCaller instance for the named method
+        which manages calls to all registered plugins except the
+        ones from remove_plugins. """
+        orig = getattr(self.hook, name)
+        plugins_to_remove = [plug for plug in remove_plugins if hasattr(plug, name)]
+        if plugins_to_remove:
+            hc = _HookCaller(orig.name, orig._hookexec, orig._specmodule_or_class,
+                             orig.spec_opts)
+            for hookimpl in (orig._wrappers + orig._nonwrappers):
+                plugin = hookimpl.plugin
+                if plugin not in plugins_to_remove:
+                    hc._add_hookimpl(hookimpl)
+                    # we also keep track of this hook caller so it
+                    # gets properly removed on plugin unregistration
+                    self._plugin2hookcallers.setdefault(plugin, []).append(hc)
+            return hc
+        return orig
+
+
+def varnames(func):
+    """Return tuple of positional and keywrord argument names for a function,
+    method, class or callable.
+
+    In case of a class, its ``__init__`` method is considered.
+    For methods the ``self`` parameter is not included.
+    """
+    cache = getattr(func, "__dict__", {})
+    try:
+        return cache["_varnames"]
+    except KeyError:
+        pass
+
+    if inspect.isclass(func):
+        try:
+            func = func.__init__
+        except AttributeError:
+            return (), ()
+    elif not inspect.isroutine(func):  # callable object?
+        try:
+            func = getattr(func, '__call__', func)
+        except Exception:
+            return ()
+
+    try:  # func MUST be a function or method here or we won't parse any args
+        spec = _getargspec(func)
+    except TypeError:
+        return (), ()
+
+    args, defaults = tuple(spec.args), spec.defaults
+    if defaults:
+        index = -len(defaults)
+        args, defaults = args[:index], tuple(args[index:])
+    else:
+        defaults = ()
+
+    # strip any implicit instance arg
+    if args:
+        if inspect.ismethod(func) or (
+            '.' in getattr(func, '__qualname__', ()) and args[0] == 'self'
+        ):
+            args = args[1:]
+
+    assert "self" not in args  # best naming practises check?
+    try:
+        cache["_varnames"] = args, defaults
+    except TypeError:
+        pass
+    return args, defaults
+
+
+class _HookRelay(object):
+    """ hook holder object for performing 1:N hook calls where N is the number
+    of registered plugins.
+
+    """
+
+    def __init__(self, trace):
+        self._trace = trace
+
+
+class _HookCaller(object):
+    def __init__(self, name, hook_execute, specmodule_or_class=None,
+                 spec_opts=None):
+        self.name = name
+        self._wrappers = []
+        self._nonwrappers = []
+        self._hookexec = hook_execute
+        self._specmodule_or_class = None
+        self.argnames = None
+        self.kwargnames = None
+        self.multicall = _multicall
+        self.spec_opts = spec_opts or {}
+        if specmodule_or_class is not None:
+            self.set_specification(specmodule_or_class, spec_opts)
+
+    def has_spec(self):
+        return self._specmodule_or_class is not None
+
+    def set_specification(self, specmodule_or_class, spec_opts):
+        assert not self.has_spec()
+        self._specmodule_or_class = specmodule_or_class
+        specfunc = getattr(specmodule_or_class, self.name)
+        # get spec arg signature
+        argnames, self.kwargnames = varnames(specfunc)
+        self.argnames = ["__multicall__"] + list(argnames)
+        self.spec_opts.update(spec_opts)
+        if spec_opts.get("historic"):
+            self._call_history = []
+
+    def is_historic(self):
+        return hasattr(self, "_call_history")
+
+    def _remove_plugin(self, plugin):
+        def remove(wrappers):
+            for i, method in enumerate(wrappers):
+                if method.plugin == plugin:
+                    del wrappers[i]
+                    return True
+        if remove(self._wrappers) is None:
+            if remove(self._nonwrappers) is None:
+                raise ValueError("plugin %r not found" % (plugin,))
+
+    def _add_hookimpl(self, hookimpl):
+        """A an implementation to the callback chain.
+        """
+        if hookimpl.hookwrapper:
+            methods = self._wrappers
+        else:
+            methods = self._nonwrappers
+
+        if hookimpl.trylast:
+            methods.insert(0, hookimpl)
+        elif hookimpl.tryfirst:
+            methods.append(hookimpl)
+        else:
+            # find last non-tryfirst method
+            i = len(methods) - 1
+            while i >= 0 and methods[i].tryfirst:
+                i -= 1
+            methods.insert(i + 1, hookimpl)
+
+        if '__multicall__' in hookimpl.argnames:
+            warnings.warn(
+                "Support for __multicall__ is now deprecated and will be"
+                "removed in an upcoming release.",
+                DeprecationWarning
+            )
+            self.multicall = _legacymulticall
+
+    def __repr__(self):
+        return "<_HookCaller %r>" % (self.name,)
+
+    def __call__(self, *args, **kwargs):
+        if args:
+            raise TypeError("hook calling supports only keyword arguments")
+        assert not self.is_historic()
+        if self.argnames:
+            notincall = set(self.argnames) - set(['__multicall__']) - set(
+                kwargs.keys())
+            if notincall:
+                warnings.warn(
+                    "Argument(s) {} which are declared in the hookspec "
+                    "can not be found in this hook call"
+                    .format(tuple(notincall)),
+                    stacklevel=2,
+                )
+        return self._hookexec(self, self._nonwrappers + self._wrappers, kwargs)
+
+    def call_historic(self, proc=None, kwargs=None):
+        """ call the hook with given ``kwargs`` for all registered plugins and
+        for all plugins which will be registered afterwards.
+
+        If ``proc`` is not None it will be called for for each non-None result
+        obtained from a hook implementation.
+        """
+        self._call_history.append((kwargs or {}, proc))
+        # historizing hooks don't return results
+        res = self._hookexec(self, self._nonwrappers + self._wrappers, kwargs)
+        for x in res or []:
+            proc(x)
+
+    def call_extra(self, methods, kwargs):
+        """ Call the hook with some additional temporarily participating
+        methods using the specified kwargs as call parameters. """
+        old = list(self._nonwrappers), list(self._wrappers)
+        for method in methods:
+            opts = dict(hookwrapper=False, trylast=False, tryfirst=False)
+            hookimpl = HookImpl(None, "<temp>", method, opts)
+            self._add_hookimpl(hookimpl)
+        try:
+            return self(**kwargs)
+        finally:
+            self._nonwrappers, self._wrappers = old
+
+    def _maybe_apply_history(self, method):
+        """Apply call history to a new hookimpl if it is marked as historic.
+        """
+        if self.is_historic():
+            for kwargs, proc in self._call_history:
+                res = self._hookexec(self, [method], kwargs)
+                if res and proc is not None:
+                    proc(res[0])
+
+
+class HookImpl(object):
+    def __init__(self, plugin, plugin_name, function, hook_impl_opts):
+        self.function = function
+        self.argnames, self.kwargnames = varnames(self.function)
+        self.plugin = plugin
+        self.opts = hook_impl_opts
+        self.plugin_name = plugin_name
+        self.__dict__.update(hook_impl_opts)
+
+
+if hasattr(inspect, 'getfullargspec'):
+    def _getargspec(func):
+        return inspect.getfullargspec(func)
+else:
+    def _getargspec(func):
+        return inspect.getargspec(func)
+
+
+if hasattr(inspect, 'signature'):
+    def _formatdef(func):
+        return "%s%s" % (
+            func.__name__,
+            str(inspect.signature(func))
+        )
+else:
+    def _formatdef(func):
+        return "%s%s" % (
+            func.__name__,
+            inspect.formatargspec(*inspect.getargspec(func))
+        )
new file mode 100644
--- /dev/null
+++ b/third_party/python/pluggy/pluggy/callers.py
@@ -0,0 +1,201 @@
+'''
+Call loop machinery
+'''
+import sys
+import warnings
+
+_py3 = sys.version_info > (3, 0)
+
+
+if not _py3:
+    exec("""
+def _reraise(cls, val, tb):
+    raise cls, val, tb
+""")
+
+
+def _raise_wrapfail(wrap_controller, msg):
+    co = wrap_controller.gi_code
+    raise RuntimeError("wrap_controller at %r %s:%d %s" %
+                       (co.co_name, co.co_filename, co.co_firstlineno, msg))
+
+
+class HookCallError(Exception):
+    """ Hook was called wrongly. """
+
+
+class _Result(object):
+    def __init__(self, result, excinfo):
+        self._result = result
+        self._excinfo = excinfo
+
+    @property
+    def excinfo(self):
+        return self._excinfo
+
+    @property
+    def result(self):
+        """Get the result(s) for this hook call (DEPRECATED in favor of ``get_result()``)."""
+        msg = 'Use get_result() which forces correct exception handling'
+        warnings.warn(DeprecationWarning(msg), stacklevel=2)
+        return self._result
+
+    @classmethod
+    def from_call(cls, func):
+        __tracebackhide__ = True
+        result = excinfo = None
+        try:
+            result = func()
+        except BaseException:
+            excinfo = sys.exc_info()
+
+        return cls(result, excinfo)
+
+    def force_result(self, result):
+        """Force the result(s) to ``result``.
+
+        If the hook was marked as a ``firstresult`` a single value should
+        be set otherwise set a (modified) list of results. Any exceptions
+        found during invocation will be deleted.
+        """
+        self._result = result
+        self._excinfo = None
+
+    def get_result(self):
+        """Get the result(s) for this hook call.
+
+        If the hook was marked as a ``firstresult`` only a single value
+        will be returned otherwise a list of results.
+        """
+        __tracebackhide__ = True
+        if self._excinfo is None:
+            return self._result
+        else:
+            ex = self._excinfo
+            if _py3:
+                raise ex[1].with_traceback(ex[2])
+            _reraise(*ex)  # noqa
+
+
+def _wrapped_call(wrap_controller, func):
+    """ Wrap calling to a function with a generator which needs to yield
+    exactly once.  The yield point will trigger calling the wrapped function
+    and return its ``_Result`` to the yield point.  The generator then needs
+    to finish (raise StopIteration) in order for the wrapped call to complete.
+    """
+    try:
+        next(wrap_controller)   # first yield
+    except StopIteration:
+        _raise_wrapfail(wrap_controller, "did not yield")
+    call_outcome = _Result.from_call(func)
+    try:
+        wrap_controller.send(call_outcome)
+        _raise_wrapfail(wrap_controller, "has second yield")
+    except StopIteration:
+        pass
+    return call_outcome.get_result()
+
+
+class _LegacyMultiCall(object):
+    """ execute a call into multiple python functions/methods. """
+
+    # XXX note that the __multicall__ argument is supported only
+    # for pytest compatibility reasons.  It was never officially
+    # supported there and is explicitely deprecated since 2.8
+    # so we can remove it soon, allowing to avoid the below recursion
+    # in execute() and simplify/speed up the execute loop.
+
+    def __init__(self, hook_impls, kwargs, firstresult=False):
+        self.hook_impls = hook_impls
+        self.caller_kwargs = kwargs  # come from _HookCaller.__call__()
+        self.caller_kwargs["__multicall__"] = self
+        self.firstresult = firstresult
+
+    def execute(self):
+        caller_kwargs = self.caller_kwargs
+        self.results = results = []
+        firstresult = self.firstresult
+
+        while self.hook_impls:
+            hook_impl = self.hook_impls.pop()
+            try:
+                args = [caller_kwargs[argname] for argname in hook_impl.argnames]
+            except KeyError:
+                for argname in hook_impl.argnames:
+                    if argname not in caller_kwargs:
+                        raise HookCallError(
+                            "hook call must provide argument %r" % (argname,))
+            if hook_impl.hookwrapper:
+                return _wrapped_call(hook_impl.function(*args), self.execute)
+            res = hook_impl.function(*args)
+            if res is not None:
+                if firstresult:
+                    return res
+                results.append(res)
+
+        if not firstresult:
+            return results
+
+    def __repr__(self):
+        status = "%d meths" % (len(self.hook_impls),)
+        if hasattr(self, "results"):
+            status = ("%d results, " % len(self.results)) + status
+        return "<_MultiCall %s, kwargs=%r>" % (status, self.caller_kwargs)
+
+
+def _legacymulticall(hook_impls, caller_kwargs, firstresult=False):
+    return _LegacyMultiCall(
+        hook_impls, caller_kwargs, firstresult=firstresult).execute()
+
+
+def _multicall(hook_impls, caller_kwargs, firstresult=False):
+    """Execute a call into multiple python functions/methods and return the
+    result(s).
+
+    ``caller_kwargs`` comes from _HookCaller.__call__().
+    """
+    __tracebackhide__ = True
+    results = []
+    excinfo = None
+    try:  # run impl and wrapper setup functions in a loop
+        teardowns = []
+        try:
+            for hook_impl in reversed(hook_impls):
+                try:
+                    args = [caller_kwargs[argname] for argname in hook_impl.argnames]
+                except KeyError:
+                    for argname in hook_impl.argnames:
+                        if argname not in caller_kwargs:
+                            raise HookCallError(
+                                "hook call must provide argument %r" % (argname,))
+
+                if hook_impl.hookwrapper:
+                    try:
+                        gen = hook_impl.function(*args)
+                        next(gen)   # first yield
+                        teardowns.append(gen)
+                    except StopIteration:
+                        _raise_wrapfail(gen, "did not yield")
+                else:
+                    res = hook_impl.function(*args)
+                    if res is not None:
+                        results.append(res)
+                        if firstresult:  # halt further impl calls
+                            break
+        except BaseException:
+            excinfo = sys.exc_info()
+    finally:
+        if firstresult:  # first result hooks return a single value
+            outcome = _Result(results[0] if results else None, excinfo)
+        else:
+            outcome = _Result(results, excinfo)
+
+        # run all wrapper post-yield blocks
+        for gen in reversed(teardowns):
+            try:
+                gen.send(outcome)
+                _raise_wrapfail(gen, "has second yield")
+            except StopIteration:
+                pass
+
+        return outcome.get_result()
new file mode 100644
--- /dev/null
+++ b/third_party/python/pluggy/setup.cfg
@@ -0,0 +1,13 @@
+[bdist_wheel]
+universal = 1
+
+[metadata]
+license_file = LICENSE
+
+[devpi:upload]
+formats = sdist.tgz,bdist_wheel
+
+[egg_info]
+tag_build = 
+tag_date = 0
+
new file mode 100644
--- /dev/null
+++ b/third_party/python/pluggy/setup.py
@@ -0,0 +1,51 @@
+import os
+from setuptools import setup
+
+classifiers = [
+    'Development Status :: 4 - Beta',
+    'Intended Audience :: Developers',
+    'License :: OSI Approved :: MIT License',
+    'Operating System :: POSIX',
+    'Operating System :: Microsoft :: Windows',
+    'Operating System :: MacOS :: MacOS X',
+    'Topic :: Software Development :: Testing',
+    'Topic :: Software Development :: Libraries',
+    'Topic :: Utilities',
+    'Programming Language :: Python :: Implementation :: CPython',
+    'Programming Language :: Python :: Implementation :: PyPy'] + [
+    ('Programming Language :: Python :: %s' % x) for x in
+    '2 2.7 3 3.4 3.5 3.6'.split()]
+
+with open('README.rst') as fd:
+    long_description = fd.read()
+
+
+def get_version():
+    p = os.path.join(os.path.dirname(
+                     os.path.abspath(__file__)), "pluggy/__init__.py")
+    with open(p) as f:
+        for line in f.readlines():
+            if "__version__" in line:
+                return line.strip().split("=")[-1].strip(" '")
+    raise ValueError("could not read version")
+
+
+def main():
+    setup(
+        name='pluggy',
+        description='plugin and hook calling mechanisms for python',
+        long_description=long_description,
+        version=get_version(),
+        license='MIT license',
+        platforms=['unix', 'linux', 'osx', 'win32'],
+        author='Holger Krekel',
+        author_email='holger@merlinux.eu',
+        url='https://github.com/pytest-dev/pluggy',
+        python_requires='>=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*',
+        classifiers=classifiers,
+        packages=['pluggy'],
+    )
+
+
+if __name__ == '__main__':
+    main()
new file mode 100644
--- /dev/null
+++ b/third_party/python/pluggy/testing/benchmark.py
@@ -0,0 +1,59 @@
+"""
+Benchmarking and performance tests.
+"""
+import pytest
+from pluggy import (_multicall, _legacymulticall, HookImpl, HookspecMarker,
+                    HookimplMarker)
+
+hookspec = HookspecMarker("example")
+hookimpl = HookimplMarker("example")
+
+
+def MC(methods, kwargs, callertype, firstresult=False):
+    hookfuncs = []
+    for method in methods:
+        f = HookImpl(None, "<temp>", method, method.example_impl)
+        hookfuncs.append(f)
+    return callertype(hookfuncs, kwargs, {"firstresult": firstresult})
+
+
+@hookimpl
+def hook(arg1, arg2, arg3):
+    return arg1, arg2, arg3
+
+
+@hookimpl(hookwrapper=True)
+def wrapper(arg1, arg2, arg3):
+    yield
+
+
+@pytest.fixture(
+    params=[10, 100],
+    ids="hooks={}".format,
+)
+def hooks(request):
+    return [hook for i in range(request.param)]
+
+
+@pytest.fixture(
+    params=[10, 100],
+    ids="wrappers={}".format,
+)
+def wrappers(request):
+    return [wrapper for i in range(request.param)]
+
+
+@pytest.fixture(
+    params=[_multicall, _legacymulticall],
+    ids=lambda item: item.__name__
+)
+def callertype(request):
+    return request.param
+
+
+def inner_exec(methods, callertype):
+    return MC(methods, {'arg1': 1, 'arg2': 2, 'arg3': 3}, callertype)
+
+
+def test_hook_and_wrappers_speed(benchmark, hooks, wrappers, callertype):
+    benchmark(inner_exec, hooks + wrappers, callertype)
new file mode 100644
--- /dev/null
+++ b/third_party/python/pluggy/testing/conftest.py
@@ -0,0 +1,30 @@
+import pytest
+
+
+@pytest.fixture(
+    params=[
+        lambda spec: spec,
+        lambda spec: spec()
+    ],
+    ids=[
+        "spec-is-class",
+        "spec-is-instance"
+    ],
+)
+def he_pm(request, pm):
+    from pluggy import HookspecMarker
+    hookspec = HookspecMarker("example")
+
+    class Hooks(object):
+        @hookspec
+        def he_method1(self, arg):
+            return arg + 1
+
+    pm.add_hookspecs(request.param(Hooks))
+    return pm
+
+
+@pytest.fixture
+def pm():
+    from pluggy import PluginManager
+    return PluginManager("example")
new file mode 100644
--- /dev/null
+++ b/third_party/python/pluggy/testing/test_details.py
@@ -0,0 +1,103 @@
+import warnings
+
+import pytest
+
+from pluggy import PluginManager, HookimplMarker, HookspecMarker, _Result
+
+hookspec = HookspecMarker("example")
+hookimpl = HookimplMarker("example")
+
+
+def test_parse_hookimpl_override():
+    class MyPluginManager(PluginManager):
+        def parse_hookimpl_opts(self, module_or_class, name):
+            opts = PluginManager.parse_hookimpl_opts(
+                self, module_or_class, name)
+            if opts is None:
+                if name.startswith("x1"):
+                    opts = {}
+            return opts
+
+    class Plugin(object):
+        def x1meth(self):
+            pass
+
+        @hookimpl(hookwrapper=True, tryfirst=True)
+        def x1meth2(self):
+            pass
+
+    class Spec(object):
+        @hookspec
+        def x1meth(self):
+            pass
+
+        @hookspec
+        def x1meth2(self):
+            pass
+
+    pm = MyPluginManager(hookspec.project_name)
+    pm.register(Plugin())
+    pm.add_hookspecs(Spec)
+    assert not pm.hook.x1meth._nonwrappers[0].hookwrapper
+    assert not pm.hook.x1meth._nonwrappers[0].tryfirst
+    assert not pm.hook.x1meth._nonwrappers[0].trylast
+    assert not pm.hook.x1meth._nonwrappers[0].optionalhook
+
+    assert pm.hook.x1meth2._wrappers[0].tryfirst
+    assert pm.hook.x1meth2._wrappers[0].hookwrapper
+
+
+def test_plugin_getattr_raises_errors():
+    """Pluggy must be able to handle plugins which raise weird exceptions
+    when getattr() gets called (#11).
+    """
+    class DontTouchMe(object):
+        def __getattr__(self, x):
+            raise Exception('cant touch me')
+
+    class Module(object):
+        pass
+
+    module = Module()
+    module.x = DontTouchMe()
+
+    pm = PluginManager(hookspec.project_name)
+    # register() would raise an error
+    pm.register(module, 'donttouch')
+    assert pm.get_plugin('donttouch') is module
+
+
+def test_warning_on_call_vs_hookspec_arg_mismatch():
+    """Verify that is a hook is called with less arguments then defined in the
+    spec that a warning is emitted.
+    """
+    class Spec:
+        @hookspec
+        def myhook(self, arg1, arg2):
+            pass
+
+    class Plugin:
+        @hookimpl
+        def myhook(self, arg1):
+            pass
+
+    pm = PluginManager(hookspec.project_name)
+    pm.register(Plugin())
+    pm.add_hookspecs(Spec())
+
+    with warnings.catch_warnings(record=True) as warns:
+        warnings.simplefilter('always')
+
+        # calling should trigger a warning
+        pm.hook.myhook(arg1=1)
+
+        assert len(warns) == 1
+        warning = warns[-1]
+        assert issubclass(warning.category, Warning)
+        assert "Argument(s) ('arg2',)" in str(warning.message)
+
+
+def test_result_deprecated():
+    r = _Result(10, None)
+    with pytest.deprecated_call():
+        assert r.result == 10
new file mode 100644
--- /dev/null
+++ b/third_party/python/pluggy/testing/test_helpers.py
@@ -0,0 +1,68 @@
+from pluggy import _formatdef, varnames
+
+
+def test_varnames():
+    def f(x):
+        i = 3  # noqa
+
+    class A(object):
+        def f(self, y):
+            pass
+
+    class B(object):
+        def __call__(self, z):
+            pass
+
+    assert varnames(f) == (("x",), ())
+    assert varnames(A().f) == (('y',), ())
+    assert varnames(B()) == (('z',), ())
+
+
+def test_varnames_default():
+    def f(x, y=3):
+        pass
+
+    assert varnames(f) == (("x",), ("y",))
+
+
+def test_varnames_class():
+    class C(object):
+        def __init__(self, x):
+            pass
+
+    class D(object):
+        pass
+
+    class E(object):
+        def __init__(self, x):
+            pass
+
+    class F(object):
+        pass
+
+    assert varnames(C) == (("x",), ())
+    assert varnames(D) == ((), ())
+    assert varnames(E) == (("x",), ())
+    assert varnames(F) == ((), ())
+
+
+def test_formatdef():
+    def function1():
+        pass
+
+    assert _formatdef(function1) == 'function1()'
+
+    def function2(arg1):
+        pass
+
+    assert _formatdef(function2) == "function2(arg1)"
+
+    def function3(arg1, arg2="qwe"):
+        pass
+
+    assert _formatdef(function3) == "function3(arg1, arg2='qwe')"
+
+    def function4(arg1, *args, **kwargs):
+        pass
+
+    assert _formatdef(function4) == "function4(arg1, *args, **kwargs)"
new file mode 100644
--- /dev/null
+++ b/third_party/python/pluggy/testing/test_hookrelay.py
@@ -0,0 +1,210 @@
+import pytest
+from pluggy import PluginValidationError, HookimplMarker, HookspecMarker
+
+
+hookspec = HookspecMarker("example")
+hookimpl = HookimplMarker("example")
+
+
+def test_happypath(pm):
+    class Api(object):
+        @hookspec
+        def hello(self, arg):
+            "api hook 1"
+
+    pm.add_hookspecs(Api)
+    hook = pm.hook
+    assert hasattr(hook, 'hello')
+    assert repr(hook.hello).find("hello") != -1
+
+    class Plugin(object):
+        @hookimpl
+        def hello(self, arg):
+            return arg + 1
+
+    plugin = Plugin()
+    pm.register(plugin)
+    out = hook.hello(arg=3)
+    assert out == [4]
+    assert not hasattr(hook, 'world')
+    pm.unregister(plugin)
+    assert hook.hello(arg=3) == []
+
+
+def test_argmismatch(pm):
+    class Api(object):
+        @hookspec
+        def hello(self, arg):
+            "api hook 1"
+
+    pm.add_hookspecs(Api)
+
+    class Plugin(object):
+        @hookimpl
+        def hello(self, argwrong):
+            pass
+
+    with pytest.raises(PluginValidationError) as exc:
+        pm.register(Plugin())
+
+    assert "argwrong" in str(exc.value)
+
+
+def test_only_kwargs(pm):
+    class Api(object):
+        @hookspec
+        def hello(self, arg):
+            "api hook 1"
+
+    pm.add_hookspecs(Api)
+    with pytest.raises(TypeError) as exc:
+        pm.hook.hello(3)
+
+    comprehensible = "hook calling supports only keyword arguments"
+    assert comprehensible in str(exc.value)
+
+
+def test_call_order(pm):
+    class Api(object):
+        @hookspec
+        def hello(self, arg):
+            "api hook 1"
+
+    pm.add_hookspecs(Api)
+
+    class Plugin1(object):
+        @hookimpl
+        def hello(self, arg):
+            return 1
+
+    class Plugin2(object):
+        @hookimpl
+        def hello(self, arg):
+            return 2
+
+    class Plugin3(object):
+        @hookimpl
+        def hello(self, arg):
+            return 3
+
+    class Plugin4(object):
+        @hookimpl(hookwrapper=True)
+        def hello(self, arg):
+            assert arg == 0
+            outcome = yield
+            assert outcome.get_result() == [3, 2, 1]
+
+    pm.register(Plugin1())
+    pm.register(Plugin2())
+    pm.register(Plugin3())
+    pm.register(Plugin4())  # hookwrapper should get same list result
+    res = pm.hook.hello(arg=0)
+    assert res == [3, 2, 1]
+
+
+def test_firstresult_definition(pm):
+    class Api(object):
+        @hookspec(firstresult=True)
+        def hello(self, arg):
+            "api hook 1"
+
+    pm.add_hookspecs(Api)
+
+    class Plugin1(object):
+        @hookimpl
+        def hello(self, arg):
+            return arg + 1
+
+    class Plugin2(object):
+        @hookimpl
+        def hello(self, arg):
+            return arg - 1
+
+    class Plugin3(object):
+        @hookimpl
+        def hello(self, arg):
+            return None
+
+    class Plugin4(object):
+        @hookimpl(hookwrapper=True)
+        def hello(self, arg):
+            assert arg == 3
+            outcome = yield
+            assert outcome.get_result() == 2
+
+    pm.register(Plugin1())  # discarded - not the last registered plugin
+    pm.register(Plugin2())  # used as result
+    pm.register(Plugin3())  # None result is ignored
+    pm.register(Plugin4())  # hookwrapper should get same non-list result
+    res = pm.hook.hello(arg=3)
+    assert res == 2
+
+
+def test_firstresult_force_result(pm):
+    """Verify forcing a result in a wrapper.
+    """
+    class Api(object):
+        @hookspec(firstresult=True)
+        def hello(self, arg):
+            "api hook 1"
+
+    pm.add_hookspecs(Api)
+
+    class Plugin1(object):
+        @hookimpl
+        def hello(self, arg):
+            return arg + 1
+
+    class Plugin2(object):
+        @hookimpl(hookwrapper=True)
+        def hello(self, arg):
+            assert arg == 3
+            outcome = yield
+            assert outcome.get_result() == 4
+            outcome.force_result(0)
+
+    class Plugin3(object):
+        @hookimpl
+        def hello(self, arg):
+            return None
+
+    pm.register(Plugin1())
+    pm.register(Plugin2())  # wrapper
+    pm.register(Plugin3())  # ignored since returns None
+    res = pm.hook.hello(arg=3)
+    assert res == 0  # this result is forced and not a list
+
+
+def test_firstresult_returns_none(pm):
+    """If None results are returned by underlying implementations ensure
+    the multi-call loop returns a None value.
+    """
+    class Api(object):
+        @hookspec(firstresult=True)
+        def hello(self, arg):
+            "api hook 1"
+
+    pm.add_hookspecs(Api)
+
+    class Plugin1(object):
+        @hookimpl
+        def hello(self, arg):
+            return None
+
+    pm.register(Plugin1())
+    res = pm.hook.hello(arg=3)
+    assert res is None
+
+
+def test_firstresult_no_plugin(pm):
+    """If no implementations/plugins have been registered for a firstresult
+    hook the multi-call loop should return a None value.
+    """
+    class Api(object):
+        @hookspec(firstresult=True)
+        def hello(self, arg):
+            "api hook 1"
+
+    pm.add_hookspecs(Api)
+    res = pm.hook.hello(arg=3)
+    assert res is None
new file mode 100644
--- /dev/null
+++ b/third_party/python/pluggy/testing/test_method_ordering.py
@@ -0,0 +1,322 @@
+import pytest
+
+
+import sys
+import types
+
+from pluggy import PluginManager, HookImpl, HookimplMarker, HookspecMarker
+
+hookspec = HookspecMarker("example")
+hookimpl = HookimplMarker("example")
+
+
+@pytest.fixture
+def hc(pm):
+    class Hooks(object):
+        @hookspec
+        def he_method1(self, arg):
+            pass
+    pm.add_hookspecs(Hooks)
+    return pm.hook.he_method1
+
+
+@pytest.fixture
+def addmeth(hc):
+    def addmeth(tryfirst=False, trylast=False, hookwrapper=False):
+        def wrap(func):
+            hookimpl(tryfirst=tryfirst, trylast=trylast,
+                     hookwrapper=hookwrapper)(func)
+            hc._add_hookimpl(HookImpl(None, "<temp>", func, func.example_impl))
+            return func
+        return wrap
+    return addmeth
+
+
+def funcs(hookmethods):
+    return [hookmethod.function for hookmethod in hookmethods]
+
+
+def test_adding_nonwrappers(hc, addmeth):
+    @addmeth()
+    def he_method1():
+        pass
+
+    @addmeth()
+    def he_method2():
+        pass
+
+    @addmeth()
+    def he_method3():
+        pass
+    assert funcs(hc._nonwrappers) == [he_method1, he_method2, he_method3]
+
+
+def test_adding_nonwrappers_trylast(hc, addmeth):
+    @addmeth()
+    def he_method1_middle():
+        pass
+
+    @addmeth(trylast=True)
+    def he_method1():
+        pass
+
+    @addmeth()
+    def he_method1_b():
+        pass
+    assert funcs(hc._nonwrappers) == [he_method1, he_method1_middle, he_method1_b]
+
+
+def test_adding_nonwrappers_trylast3(hc, addmeth):
+    @addmeth()
+    def he_method1_a():
+        pass
+
+    @addmeth(trylast=True)
+    def he_method1_b():
+        pass
+
+    @addmeth()
+    def he_method1_c():
+        pass
+
+    @addmeth(trylast=True)
+    def he_method1_d():
+        pass
+    assert funcs(hc._nonwrappers) == \
+        [he_method1_d, he_method1_b, he_method1_a, he_method1_c]
+
+
+def test_adding_nonwrappers_trylast2(hc, addmeth):
+    @addmeth()
+    def he_method1_middle():
+        pass
+
+    @addmeth()
+    def he_method1_b():
+        pass
+
+    @addmeth(trylast=True)
+    def he_method1():
+        pass
+    assert funcs(hc._nonwrappers) == \
+        [he_method1, he_method1_middle, he_method1_b]
+
+
+def test_adding_nonwrappers_tryfirst(hc, addmeth):
+    @addmeth(tryfirst=True)
+    def he_method1():
+        pass
+
+    @addmeth()
+    def he_method1_middle():
+        pass
+
+    @addmeth()
+    def he_method1_b():
+        pass
+    assert funcs(hc._nonwrappers) == [
+        he_method1_middle, he_method1_b, he_method1]
+
+
+def test_adding_wrappers_ordering(hc, addmeth):
+    @addmeth(hookwrapper=True)
+    def he_method1():
+        pass
+
+    @addmeth()
+    def he_method1_middle():
+        pass
+
+    @addmeth(hookwrapper=True)
+    def he_method3():
+        pass
+
+    assert funcs(hc._nonwrappers) == [he_method1_middle]
+    assert funcs(hc._wrappers) == [he_method1, he_method3]
+
+
+def test_adding_wrappers_ordering_tryfirst(hc, addmeth):
+    @addmeth(hookwrapper=True, tryfirst=True)
+    def he_method1():
+        pass
+
+    @addmeth(hookwrapper=True)
+    def he_method2():
+        pass
+
+    assert hc._nonwrappers == []
+    assert funcs(hc._wrappers) == [he_method2, he_method1]
+
+
+def test_hookspec(pm):
+    class HookSpec(object):
+        @hookspec()
+        def he_myhook1(arg1):
+            pass
+
+        @hookspec(firstresult=True)
+        def he_myhook2(arg1):
+            pass
+
+        @hookspec(firstresult=False)
+        def he_myhook3(arg1):
+            pass
+
+    pm.add_hookspecs(HookSpec)
+    assert not pm.hook.he_myhook1.spec_opts["firstresult"]
+    assert pm.hook.he_myhook2.spec_opts["firstresult"]
+    assert not pm.hook.he_myhook3.spec_opts["firstresult"]
+
+
+@pytest.mark.parametrize('name', ["hookwrapper", "optionalhook", "tryfirst", "trylast"])
+@pytest.mark.parametrize('val', [True, False])
+def test_hookimpl(name, val):
+    @hookimpl(**{name: val})
+    def he_myhook1(arg1):
+        pass
+    if val:
+        assert he_myhook1.example_impl.get(name)
+    else:
+        assert not hasattr(he_myhook1, name)
+
+
+def test_load_setuptools_instantiation(monkeypatch, pm):
+    pkg_resources = pytest.importorskip("pkg_resources")
+
+    def my_iter(name):
+        assert name == "hello"
+
+        class EntryPoint(object):
+            name = "myname"
+            dist = None
+
+            def load(self):
+                class PseudoPlugin(object):
+                    x = 42
+                return PseudoPlugin()
+
+        return iter([EntryPoint()])
+
+    monkeypatch.setattr(pkg_resources, 'iter_entry_points', my_iter)
+    num = pm.load_setuptools_entrypoints("hello")
+    assert num == 1
+    plugin = pm.get_plugin("myname")
+    assert plugin.x == 42
+    assert pm.list_plugin_distinfo() == [(plugin, None)]
+
+
+def test_load_setuptools_not_installed(monkeypatch, pm):
+    monkeypatch.setitem(
+        sys.modules, 'pkg_resources',
+        types.ModuleType("pkg_resources"))
+
+    with pytest.raises(ImportError):
+        pm.load_setuptools_entrypoints("qwe")
+
+
+def test_add_tracefuncs(he_pm):
+    out = []
+
+    class api1(object):
+        @hookimpl
+        def he_method1(self):
+            out.append("he_method1-api1")
+
+    class api2(object):
+        @hookimpl
+        def he_method1(self):
+            out.append("he_method1-api2")
+
+    he_pm.register(api1())
+    he_pm.register(api2())
+
+    def before(hook_name, hook_impls, kwargs):
+        out.append((hook_name, list(hook_impls), kwargs))
+
+    def after(outcome, hook_name, hook_impls, kwargs):
+        out.append((outcome, hook_name, list(hook_impls), kwargs))
+
+    undo = he_pm.add_hookcall_monitoring(before, after)
+
+    he_pm.hook.he_method1(arg=1)
+    assert len(out) == 4
+    assert out[0][0] == "he_method1"
+    assert len(out[0][1]) == 2
+    assert isinstance(out[0][2], dict)
+    assert out[1] == "he_method1-api2"
+    assert out[2] == "he_method1-api1"
+    assert len(out[3]) == 4
+    assert out[3][1] == out[0][0]
+
+    undo()
+    he_pm.hook.he_method1(arg=1)
+    assert len(out) == 4 + 2
+
+
+def test_hook_tracing(he_pm):
+    saveindent = []
+
+    class api1(object):
+        @hookimpl
+        def he_method1(self):
+            saveindent.append(he_pm.trace.root.indent)
+
+    class api2(object):
+        @hookimpl
+        def he_method1(self):
+            saveindent.append(he_pm.trace.root.indent)
+            raise ValueError()
+
+    he_pm.register(api1())
+    out = []
+    he_pm.trace.root.setwriter(out.append)
+    undo = he_pm.enable_tracing()
+    try:
+        indent = he_pm.trace.root.indent
+        he_pm.hook.he_method1(arg=1)
+        assert indent == he_pm.trace.root.indent
+        assert len(out) == 2
+        assert 'he_method1' in out[0]
+        assert 'finish' in out[1]
+
+        out[:] = []
+        he_pm.register(api2())
+
+        with pytest.raises(ValueError):
+            he_pm.hook.he_method1(arg=1)
+        assert he_pm.trace.root.indent == indent
+        assert saveindent[0] > indent
+    finally:
+        undo()
+
+
+@pytest.mark.parametrize('include_hookspec', [True, False])
+def test_prefix_hookimpl(include_hookspec):
+    pm = PluginManager(hookspec.project_name, "hello_")
+
+    if include_hookspec:
+        class HookSpec(object):
+            @hookspec
+            def hello_myhook(self, arg1):
+                """ add to arg1 """
+
+        pm.add_hookspecs(HookSpec)
+
+    class Plugin(object):
+        def hello_myhook(self, arg1):
+            return arg1 + 1
+
+    pm.register(Plugin())
+    pm.register(Plugin())
+    results = pm.hook.hello_myhook(arg1=17)
+    assert results == [18, 18]
+
+
+def test_prefix_hookimpl_dontmatch_module():
+    pm = PluginManager(hookspec.project_name, "hello_")
+
+    class BadPlugin(object):
+        hello_module = __import__('email')
+
+    pm.register(BadPlugin())
+    pm.check_pending()
new file mode 100644
--- /dev/null
+++ b/third_party/python/pluggy/testing/test_multicall.py
@@ -0,0 +1,194 @@
+import pytest
+
+from pluggy import _multicall, _legacymulticall, HookImpl, HookCallError
+from pluggy.callers import _LegacyMultiCall
+from pluggy import HookspecMarker, HookimplMarker
+
+
+hookspec = HookspecMarker("example")
+hookimpl = HookimplMarker("example")
+
+
+def test_uses_copy_of_methods():
+    out = [lambda: 42]
+    mc = _LegacyMultiCall(out, {})
+    repr(mc)
+    out[:] = []
+    res = mc.execute()
+    return res == 42
+
+
+def MC(methods, kwargs, firstresult=False):
+    caller = _multicall
+    hookfuncs = []
+    for method in methods:
+        f = HookImpl(None, "<temp>", method, method.example_impl)
+        hookfuncs.append(f)
+        if '__multicall__' in f.argnames:
+            caller = _legacymulticall
+    return caller(hookfuncs, kwargs, firstresult=firstresult)
+
+
+def test_call_passing():
+    class P1(object):
+        @hookimpl
+        def m(self, __multicall__, x):
+            assert len(__multicall__.results) == 1
+            assert not __multicall__.hook_impls
+            return 17
+
+    class P2(object):
+        @hookimpl
+        def m(self, __multicall__, x):
+            assert __multicall__.results == []
+            assert __multicall__.hook_impls
+            return 23
+
+    p1 = P1()
+    p2 = P2()
+    reslist = MC([p1.m, p2.m], {"x": 23})
+    assert len(reslist) == 2
+    # ensure reversed order
+    assert reslist == [23, 17]
+
+
+def test_keyword_args():
+    @hookimpl
+    def f(x):
+        return x + 1
+
+    class A(object):
+        @hookimpl
+        def f(self, x, y):
+            return x + y
+
+    reslist = MC([f, A().f], dict(x=23, y=24))
+    assert reslist == [24 + 23, 24]
+
+
+def test_keyword_args_with_defaultargs():
+    @hookimpl
+    def f(x, z=1):
+        return x + z
+    reslist = MC([f], dict(x=23, y=24))
+    assert reslist == [24]
+
+
+def test_tags_call_error():
+    @hookimpl
+    def f(x):
+        return x
+    with pytest.raises(HookCallError):
+        MC([f], {})
+
+
+def test_call_subexecute():
+    @hookimpl
+    def m(__multicall__):
+        subresult = __multicall__.execute()
+        return subresult + 1
+
+    @hookimpl
+    def n():
+        return 1
+
+    res = MC([n, m], {}, firstresult=True)
+    assert res == 2
+
+
+def test_call_none_is_no_result():
+    @hookimpl
+    def m1():
+        return 1
+
+    @hookimpl
+    def m2():
+        return None
+
+    res = MC([m1, m2], {}, firstresult=True)
+    assert res == 1
+    res = MC([m1, m2], {}, {})
+    assert res == [1]
+
+
+def test_hookwrapper():
+    out = []
+
+    @hookimpl(hookwrapper=True)
+    def m1():
+        out.append("m1 init")
+        yield None
+        out.append("m1 finish")
+
+    @hookimpl
+    def m2():
+        out.append("m2")
+        return 2
+
+    res = MC([m2, m1], {})
+    assert res == [2]
+    assert out == ["m1 init", "m2", "m1 finish"]
+    out[:] = []
+    res = MC([m2, m1], {}, firstresult=True)
+    assert res == 2
+    assert out == ["m1 init", "m2", "m1 finish"]
+
+
+def test_hookwrapper_order():
+    out = []
+
+    @hookimpl(hookwrapper=True)
+    def m1():
+        out.append("m1 init")
+        yield 1
+        out.append("m1 finish")
+
+    @hookimpl(hookwrapper=True)
+    def m2():
+        out.append("m2 init")
+        yield 2
+        out.append("m2 finish")
+
+    res = MC([m2, m1], {})
+    assert res == []
+    assert out == ["m1 init", "m2 init", "m2 finish", "m1 finish"]
+
+
+def test_hookwrapper_not_yield():
+    @hookimpl(hookwrapper=True)
+    def m1():
+        pass
+
+    with pytest.raises(TypeError):
+        MC([m1], {})
+
+
+def test_hookwrapper_too_many_yield():
+    @hookimpl(hookwrapper=True)
+    def m1():
+        yield 1
+        yield 2
+
+    with pytest.raises(RuntimeError) as ex:
+        MC([m1], {})
+    assert "m1" in str(ex.value)
+    assert (__file__ + ':') in str(ex.value)
+
+
+@pytest.mark.parametrize("exc", [ValueError, SystemExit])
+def test_hookwrapper_exception(exc):
+    out = []
+
+    @hookimpl(hookwrapper=True)
+    def m1():
+        out.append("m1 init")
+        yield None
+        out.append("m1 finish")
+
+    @hookimpl
+    def m2():
+        raise exc
+
+    with pytest.raises(exc):
+        MC([m2, m1], {})
+    assert out == ["m1 init", "m1 finish"]
new file mode 100644
--- /dev/null
+++ b/third_party/python/pluggy/testing/test_pluginmanager.py
@@ -0,0 +1,374 @@
+import pytest
+import types
+
+from pluggy import (PluginValidationError,
+                    HookCallError, HookimplMarker, HookspecMarker)
+
+
+hookspec = HookspecMarker("example")
+hookimpl = HookimplMarker("example")
+
+
+def test_plugin_double_register(pm):
+    pm.register(42, name="abc")
+    with pytest.raises(ValueError):
+        pm.register(42, name="abc")
+    with pytest.raises(ValueError):
+        pm.register(42, name="def")
+
+
+def test_pm(pm):
+    class A(object):
+        pass
+
+    a1, a2 = A(), A()
+    pm.register(a1)
+    assert pm.is_registered(a1)
+    pm.register(a2, "hello")
+    assert pm.is_registered(a2)
+    out = pm.get_plugins()
+    assert a1 in out
+    assert a2 in out
+    assert pm.get_plugin('hello') == a2
+    assert pm.unregister(a1) == a1
+    assert not pm.is_registered(a1)
+
+    out = pm.list_name_plugin()
+    assert len(out) == 1
+    assert out == [("hello", a2)]
+
+
+def test_has_plugin(pm):
+    class A(object):
+        pass
+
+    a1 = A()
+    pm.register(a1, 'hello')
+    assert pm.is_registered(a1)
+    assert pm.has_plugin('hello')
+
+
+def test_register_dynamic_attr(he_pm):
+    class A(object):
+        def __getattr__(self, name):
+            if name[0] != "_":
+                return 42
+            raise AttributeError()
+
+    a = A()
+    he_pm.register(a)
+    assert not he_pm.get_hookcallers(a)
+
+
+def test_pm_name(pm):
+    class A(object):
+        pass
+
+    a1 = A()
+    name = pm.register(a1, name="hello")
+    assert name == "hello"
+    pm.unregister(a1)
+    assert pm.get_plugin(a1) is None
+    assert not pm.is_registered(a1)
+    assert not pm.get_plugins()
+    name2 = pm.register(a1, name="hello")
+    assert name2 == name
+    pm.unregister(name="hello")
+    assert pm.get_plugin(a1) is None
+    assert not pm.is_registered(a1)
+    assert not pm.get_plugins()
+
+
+def test_set_blocked(pm):
+    class A(object):
+        pass
+
+    a1 = A()
+    name = pm.register(a1)
+    assert pm.is_registered(a1)
+    assert not pm.is_blocked(name)
+    pm.set_blocked(name)
+    assert pm.is_blocked(name)
+    assert not pm.is_registered(a1)
+
+    pm.set_blocked("somename")
+    assert pm.is_blocked("somename")
+    assert not pm.register(A(), "somename")
+    pm.unregister(name="somename")
+    assert pm.is_blocked("somename")
+
+
+def test_register_mismatch_method(he_pm):
+    class hello(object):
+        @hookimpl
+        def he_method_notexists(self):
+            pass
+
+    he_pm.register(hello())
+    with pytest.raises(PluginValidationError):
+        he_pm.check_pending()
+
+
+def test_register_mismatch_arg(he_pm):
+    class hello(object):
+        @hookimpl
+        def he_method1(self, qlwkje):
+            pass
+
+    with pytest.raises(PluginValidationError):
+        he_pm.register(hello())
+
+
+def test_register(pm):
+    class MyPlugin(object):
+        pass
+    my = MyPlugin()
+    pm.register(my)
+    assert my in pm.get_plugins()
+    my2 = MyPlugin()
+    pm.register(my2)
+    assert set([my, my2]).issubset(pm.get_plugins())
+
+    assert pm.is_registered(my)
+    assert pm.is_registered(my2)
+    pm.unregister(my)
+    assert not pm.is_registered(my)
+    assert my not in pm.get_plugins()
+
+
+def test_register_unknown_hooks(pm):
+    class Plugin1(object):
+        @hookimpl
+        def he_method1(self, arg):
+            return arg + 1
+
+    pname = pm.register(Plugin1())
+
+    class Hooks(object):
+        @hookspec
+        def he_method1(self, arg):
+            pass
+
+    pm.add_hookspecs(Hooks)
+    # assert not pm._unverified_hooks
+    assert pm.hook.he_method1(arg=1) == [2]
+    assert len(pm.get_hookcallers(pm.get_plugin(pname))) == 1
+
+
+def test_register_historic(pm):
+    class Hooks(object):
+        @hookspec(historic=True)
+        def he_method1(self, arg):
+            pass
+    pm.add_hookspecs(Hooks)
+
+    pm.hook.he_method1.call_historic(kwargs=dict(arg=1))
+    out = []
+
+    class Plugin(object):
+        @hookimpl
+        def he_method1(self, arg):
+            out.append(arg)
+
+    pm.register(Plugin())
+    assert out == [1]
+
+    class Plugin2(object):
+        @hookimpl
+        def he_method1(self, arg):
+            out.append(arg * 10)
+
+    pm.register(Plugin2())
+    assert out == [1, 10]
+    pm.hook.he_method1.call_historic(kwargs=dict(arg=12))
+    assert out == [1, 10, 120, 12]
+
+
+def test_with_result_memorized(pm):
+    class Hooks(object):
+        @hookspec(historic=True)
+        def he_method1(self, arg):
+            pass
+    pm.add_hookspecs(Hooks)
+
+    he_method1 = pm.hook.he_method1
+    he_method1.call_historic(lambda res: out.append(res), dict(arg=1))
+    out = []
+
+    class Plugin(object):
+        @hookimpl
+        def he_method1(self, arg):
+            return arg * 10
+
+    pm.register(Plugin())
+    assert out == [10]
+
+
+def test_with_callbacks_immediately_executed(pm):
+    class Hooks(object):
+        @hookspec(historic=True)
+        def he_method1(self, arg):
+            pass
+    pm.add_hookspecs(Hooks)
+
+    class Plugin1(object):
+        @hookimpl
+        def he_method1(self, arg):
+            return arg * 10
+
+    class Plugin2(object):
+        @hookimpl
+        def he_method1(self, arg):
+            return arg * 20
+
+    class Plugin3(object):
+        @hookimpl
+        def he_method1(self, arg):
+            return arg * 30
+
+    out = []
+    pm.register(Plugin1())
+    pm.register(Plugin2())
+
+    he_method1 = pm.hook.he_method1
+    he_method1.call_historic(lambda res: out.append(res), dict(arg=1))
+    assert out == [20, 10]
+    pm.register(Plugin3())
+    assert out == [20, 10, 30]
+
+
+def test_register_historic_incompat_hookwrapper(pm):
+    class Hooks(object):
+        @hookspec(historic=True)
+        def he_method1(self, arg):
+            pass
+
+    pm.add_hookspecs(Hooks)
+
+    out = []
+
+    class Plugin(object):
+        @hookimpl(hookwrapper=True)
+        def he_method1(self, arg):
+            out.append(arg)
+
+    with pytest.raises(PluginValidationError):
+        pm.register(Plugin())
+
+
+def test_call_extra(pm):
+    class Hooks(object):
+        @hookspec
+        def he_method1(self, arg):
+            pass
+
+    pm.add_hookspecs(Hooks)
+
+    def he_method1(arg):
+        return arg * 10
+
+    out = pm.hook.he_method1.call_extra([he_method1], dict(arg=1))
+    assert out == [10]
+
+
+def test_call_with_too_few_args(pm):
+    class Hooks(object):
+        @hookspec
+        def he_method1(self, arg):
+            pass
+
+    pm.add_hookspecs(Hooks)
+
+    class Plugin1(object):
+        @hookimpl
+        def he_method1(self, arg):
+            0 / 0
+    pm.register(Plugin1())
+    with pytest.raises(HookCallError):
+        with pytest.warns(UserWarning):
+            pm.hook.he_method1()
+
+
+def test_subset_hook_caller(pm):
+    class Hooks(object):
+        @hookspec
+        def he_method1(self, arg):
+            pass
+
+    pm.add_hookspecs(Hooks)
+
+    out = []
+
+    class Plugin1(object):
+        @hookimpl
+        def he_method1(self, arg):
+            out.append(arg)
+
+    class Plugin2(object):
+        @hookimpl
+        def he_method1(self, arg):
+            out.append(arg * 10)
+
+    class PluginNo(object):
+        pass
+
+    plugin1, plugin2, plugin3 = Plugin1(), Plugin2(), PluginNo()
+    pm.register(plugin1)
+    pm.register(plugin2)
+    pm.register(plugin3)
+    pm.hook.he_method1(arg=1)
+    assert out == [10, 1]
+    out[:] = []
+
+    hc = pm.subset_hook_caller("he_method1", [plugin1])
+    hc(arg=2)
+    assert out == [20]
+    out[:] = []
+
+    hc = pm.subset_hook_caller("he_method1", [plugin2])
+    hc(arg=2)
+    assert out == [2]
+    out[:] = []
+
+    pm.unregister(plugin1)
+    hc(arg=2)
+    assert out == []
+    out[:] = []
+
+    pm.hook.he_method1(arg=1)
+    assert out == [10]
+
+
+def test_multicall_deprecated(pm):
+    class P1(object):
+        @hookimpl
+        def m(self, __multicall__, x):
+            pass
+
+    pytest.deprecated_call(pm.register, P1())
+
+
+def test_add_hookspecs_nohooks(pm):
+    with pytest.raises(ValueError):
+        pm.add_hookspecs(10)
+
+
+def test_reject_prefixed_module(pm):
+    """Verify that a module type attribute that contains the project
+    prefix in its name (in this case `'example_*'` isn't collected
+    when registering a module which imports it.
+    """
+    pm._implprefix = 'example'
+    conftest = types.ModuleType("conftest")
+    src = ("""
+def example_hook():
+    pass
+""")
+    exec(src, conftest.__dict__)
+    conftest.example_blah = types.ModuleType("example_blah")
+    name = pm.register(conftest)
+    assert name == 'conftest'
+    assert getattr(pm.hook, 'example_blah', None) is None
+    assert getattr(pm.hook, 'example_hook', None)  # conftest.example_hook should be collected
+    assert pm.parse_hookimpl_opts(conftest, 'example_blah') is None
+    assert pm.parse_hookimpl_opts(conftest, 'example_hook') == {}
new file mode 100644
--- /dev/null
+++ b/third_party/python/pluggy/testing/test_tracer.py
@@ -0,0 +1,89 @@
+
+from pluggy import _TagTracer
+
+
+def test_simple():
+    rootlogger = _TagTracer()
+    log = rootlogger.get("pytest")
+    log("hello")
+    out = []
+    rootlogger.setwriter(out.append)
+    log("world")
+    assert len(out) == 1
+    assert out[0] == "world [pytest]\n"
+    sublog = log.get("collection")
+    sublog("hello")
+    assert out[1] == "hello [pytest:collection]\n"
+
+
+def test_indent():
+    rootlogger = _TagTracer()
+    log = rootlogger.get("1")
+    out = []
+    log.root.setwriter(lambda arg: out.append(arg))
+    log("hello")
+    log.root.indent += 1
+    log("line1")
+    log("line2")
+    log.root.indent += 1
+    log("line3")
+    log("line4")
+    log.root.indent -= 1
+    log("line5")
+    log.root.indent -= 1
+    log("last")
+    assert len(out) == 7
+    names = [x[:x.rfind(' [')] for x in out]
+    assert names == [
+        'hello', '  line1', '  line2',
+        '    line3', '    line4', '  line5', 'last']
+
+
+def test_readable_output_dictargs():
+    rootlogger = _TagTracer()
+
+    out = rootlogger.format_message(['test'], [1])
+    assert out == ['1 [test]\n']
+
+    out2 = rootlogger.format_message(['test'], ['test', {'a': 1}])
+    assert out2 == [
+        'test [test]\n',
+        '    a: 1\n'
+    ]
+
+
+def test_setprocessor():
+    rootlogger = _TagTracer()
+    log = rootlogger.get("1")
+    log2 = log.get("2")
+    assert log2.tags == tuple("12")
+    out = []
+    rootlogger.setprocessor(tuple("12"), lambda *args: out.append(args))
+    log("not seen")
+    log2("seen")
+    assert len(out) == 1
+    tags, args = out[0]
+    assert "1" in tags
+    assert "2" in tags
+    assert args == ("seen",)
+    l2 = []
+    rootlogger.setprocessor("1:2", lambda *args: l2.append(args))
+    log2("seen")
+    tags, args = l2[0]
+    assert args == ("seen",)
+
+
+def test_setmyprocessor():
+    rootlogger = _TagTracer()
+    log = rootlogger.get("1")
+    log2 = log.get("2")
+    out = []
+    log2.setmyprocessor(lambda *args: out.append(args))
+    log("not seen")
+    assert not out
+    log2(42)
+    assert len(out) == 1
+    tags, args = out[0]
+    assert "1" in tags
+    assert "2" in tags
+    assert args == (42,)
new file mode 100644
--- /dev/null
+++ b/third_party/python/pluggy/tox.ini
@@ -0,0 +1,44 @@
+[tox]
+envlist=check,docs,py{27,34,35,36,py}-pytestrelease,py{27,36}-pytest{master,features}
+
+[testenv]
+commands=py.test {posargs:testing/}
+setenv=
+  _PYTEST_SETUP_SKIP_PLUGGY_DEP=1
+deps=
+  pytestrelease: pytest
+  pytestmaster: git+https://github.com/pytest-dev/pytest.git@master
+  pytestfeatures: git+https://github.com/pytest-dev/pytest.git@features
+
+[testenv:benchmark]
+commands=py.test {posargs:testing/benchmark.py}
+deps=
+  pytest
+  pytest-benchmark
+
+[testenv:check]
+deps =
+  flake8
+  restructuredtext_lint
+  pygments
+commands =
+  flake8 pluggy.py setup.py testing
+  rst-lint CHANGELOG.rst README.rst
+
+[testenv:docs]
+deps =
+  sphinx
+  pygments
+commands =
+  sphinx-build -b html {toxinidir}/docs {toxinidir}/build/html-docs
+
+[pytest]
+minversion=2.0
+#--pyargs --doctest-modules --ignore=.tox
+addopts=-rxsX
+norecursedirs=.tox ja .hg .env*
+filterwarnings =
+  error
+
+[flake8]
+max-line-length=99
--- a/third_party/python/py/.gitignore
+++ b/third_party/python/py/.gitignore
@@ -5,8 +5,10 @@
 
 *.pyc
 *.pyo
 
 *.egg-info
 .eggs/
 
 dist/*
+/py/_version.py
+.pytest_cache/
deleted file mode 100644
--- a/third_party/python/py/.hgignore
+++ /dev/null
@@ -1,29 +0,0 @@
-
-# Automatically generated by `hgimportsvn`
-syntax:glob
-.svn
-.hgsvn
-
-# These lines are suggested according to the svn:ignore property
-# Feel free to enable them by uncommenting them
-syntax:glob
-*.pyc
-*.pyo
-*.swp
-*.html
-*.class
-*.orig
-*~
-
-doc/_build
-build/
-dist/
-*.egg-info
-issue/
-env/
-3rdparty/
-.tox
-lib/
-bin/
-include/
-src/
deleted file mode 100644
--- a/third_party/python/py/.hgtags
+++ /dev/null
@@ -1,68 +0,0 @@
-52c6d9e78777a5a34e813123997dfc614a1a4767 1.0.0b3
-1c7aaa8c61f3b0945921a9acc7beb184201aed4b 1.0.0b4
-1c7aaa8c61f3b0945921a9acc7beb184201aed4b 1.0.0b4
-0000000000000000000000000000000000000000 1.0.0b4
-0000000000000000000000000000000000000000 1.0.0b4
-8cd6eb91eba313b012d6e568f37d844dc0751f2e 1.0.0b4
-8cd6eb91eba313b012d6e568f37d844dc0751f2e 1.0.0b4
-0000000000000000000000000000000000000000 1.0.0b4
-2cc0507f117ffe721dff7ee026648cfce00ec92f 1.0.0b6
-86f1e1b6e49bf5882a809f11edd1dbb08162cdad 1.0.0b8
-86f1e1b6e49bf5882a809f11edd1dbb08162cdad 1.0.0b8
-c63f35c266cbb26dad6b87b5e115d65685adf448 1.0.0b8
-c63f35c266cbb26dad6b87b5e115d65685adf448 1.0.0b8
-0eaa0fdf2ba0163cf534dc2eff4ba2e5fc66c261 1.0.0b8
-e2a60653cb490aeed81bbbd83c070b99401c211c 1.0.0b9
-5ea0cdf7854c3d4278d36eda94a2b68483a0e211 1.0.0
-5ea0cdf7854c3d4278d36eda94a2b68483a0e211 1.0.0
-7acde360d94b6a2690ce3d03ff39301da84c0a2b 1.0.0
-6bd221981ac99103002c1cb94fede400d23a96a1 1.0.1
-4816e8b80602a3fd3a0a120333ad85fbe7d8bab4 1.0.2
-60c44bdbf093285dc69d5462d4dbb4acad325ca6 1.1.0
-319187fcda66714c5eb1353492babeec3d3c826f 1.1.1
-4fc5212f7626a56b9eb6437b5c673f56dd7eb942 1.2.0
-c143a8c8840a1c68570890c8ac6165bbf92fd3c6 1.2.1
-eafd3c256e8732dfb0a4d49d051b5b4339858926 1.3.0
-d5eacf390af74553227122b85e20345d47b2f9e6 1.3.1
-d5eacf390af74553227122b85e20345d47b2f9e6 1.3.1
-8b8e7c25a13cf863f01b2dd955978285ae9daf6a 1.3.1
-3bff44b188a7ec1af328d977b9d39b6757bb38df 1.3.2
-c59d3fa8681a5b5966b8375b16fccd64a3a8dbeb 1.3.3
-79ef6377705184c55633d456832eea318fedcf61 1.3.4
-79ef6377705184c55633d456832eea318fedcf61 1.3.4
-90fffd35373e9f125af233f78b19416f0938d841 1.3.4
-5346ab41b059c95a48cbe1e8a7bae96ce6e0da27 1.4.0
-1f3125cba7976538952be268f107c1d0c36c5ce8 1.4.1
-04ab22db4ff737cf31e91d75a0f5d7077f324167 1.4.2
-9950bf9d684a984d511795013421c89c5cf88bef 1.4.3
-d9951e3bdbc765e73835ae13012f6a074d13d8bf 1.4.4
-b827dd156a36753e32c7f3f15ce82d6fe9e356c8 1.4.6
-f15726f9e5a67cc6221c499affa4840e9d591763 1.4.7
-abfabd07a1d328f13c730e8a50d80d2e470afd3b 1.4.9
-7f37ee0aff9be4b839d6759cfee336f60e8393a4 1.4.10
-fe4593263efa10ea7ba014db6e3379e0b82368a2 1.4.11
-f07af25a26786e4825b5170e17ad693245cb3426 1.4.12
-d3730d84ba7eda92fd3469a3f63fd6d8cb22c975 1.4.13
-12c1ae8e7c5345721e9ec9f8e27b1e36c07f74dc 1.4.14
-12c1ae8e7c5345721e9ec9f8e27b1e36c07f74dc 1.4.14
-0000000000000000000000000000000000000000 1.4.14
-0000000000000000000000000000000000000000 1.4.14
-1497e2efd0f8c73a0e3d529debf0c489e4cd6cab 1.4.14
-e065014c1ce8ad110a381e9baaaa5d647ba7ac6b 1.4.15
-e9e5b38f53dc35b35aa1f9ee9a9be9bbd2d2c3b1 1.4.16
-c603503945f52b78522d96a423605cbc953236d3 1.4.17
-c59201105a29801cc858eb9160b7a19791b91a35 1.4.18
-284cc172e294d48edc840012e1451c32c3963d92 1.4.19
-a3e0626aa0c5aecf271367dc77e476ab216ea3c8 1.4.20
-5e48016c4a3af8e7358a1267d33d021e71765bed 1.4.21
-01ae2cfcc61c4fcb3aa5031349adb5b467c31018 1.4.23
-5ffd982f4dff60b588f309cd9bdc61036547282a 1.4.24
-dc9ffbcaf1f7d72e96be3f68c11deebb7e7193c5 1.4.25
-6de1a44bf75de7af4fcae947c235e9072bbdbb9a 1.4.26
-7d650ba2657890a2253c8c4a83f170febebd90fa 1.4.27
-7d650ba2657890a2253c8c4a83f170febebd90fa 1.4.27
-1810003dec63dd1b506a23849861fffa5bc3ba13 1.4.27
-ba08706f08ddea1b77a426f00dfe2bdc244345e8 1.4.28
-4e8054ada63f3327bcf759ae7cd36c7c8652bc9b 1.4.29
-366ab346610c6de8aaa7617e24011794b40236c6 1.4.30
-657380e439f9b7e04918cb162cb2e46388244b42 1.4.31
--- a/third_party/python/py/.travis.yml
+++ b/third_party/python/py/.travis.yml
@@ -12,16 +12,33 @@ env:
 #- DEPS="pytest~=3.1.0"
 
 matrix:
 
   include:
   - python: '2.7'
     # using a different option due to pytest-addopts pytester issues
     env: PYTEST_XADDOPTS="-n 3 --runslowtests" DEPS="pytest~=3.0.0 pytest-xdist"
+    
+  - stage: deploy
+    python: '3.6'
+    env:
+    install: pip install -U setuptools setuptools_scm
+    script: skip
+    deploy:
+      provider: pypi
+      user: nicoddemus
+      distributions: sdist bdist_wheel
+      skip_upload_docs: true
+      password:
+        secure: VNYW/sZoD+9DzKCe6vANNXXJR7jP7rwySafQ33N1jAnCrdylQjEN/p6tSfUe8jDi3wDpLPL9h8pwfxuUT7CRxglHov3Qe7zSeywixvHan5aFahQiQ8+gucYIM7wITHH3oQs7jN35pnhdnF+QlW2+eDCL6qOLU5XwuRhsDKXjQ/hUWR5hlX5EniD1gzyKEf6j1YCpST87tKpeLwVEYEmsucdkUZuXhxDtyaWQHWiPsLWwh/slQtUJEHeLF26r8UxFy0RiGne9jR+CzRfH5ktcA9/pArvp4VuwOii+1TDxVSYP7+I8Z+eUKN9JBg12QLaHwoIN/8J+MvHCkuf+OGSLM3sEyNRJGDev372xg3K7ylIkeeK4WXirKEp2ojgN8tniloDjnwdu/gPWBnrXuooA60tNoByHFa8KbMZAr2B2sQeMxD4VZGr1N8l0rX4gRTrwvdk3i3ulLKVSwkXaGn+GrfZTTboa7dEnpuma8tv1niNCSpStYIy7atS8129+5ijV3OC8DzOMh/rVbO9WsDb/RPG3yjFiDvEJPIPeE0l/m5u42QBqtdZSS2ia7UWTJBiEY09uFMTRmH5hhE/1aiYBbvAztf5CReUbeKdSQz3L8TTSZqewtFZmXTkX97/xQnrEpsnGezIM2DNuMEuQG3MxGkNCxwbQKpx/bkHdrD75yMk=
+      on:
+        tags: true
+        repo: pytest-dev/py
+        
   allow_failures:
   - python: 'pypy-5.4'
 install:
 - pip install -U setuptools setuptools_scm
 - pip install $DEPS
 - pip install -U . --force-reinstall
 script:
 - py.test --lsof $PYTEST_XADDOPTS
--- a/third_party/python/py/CHANGELOG
+++ b/third_party/python/py/CHANGELOG
@@ -1,11 +1,17 @@
-1.5.3 (unreleased)
+1.5.4 (2018-06-27)
 ==================
 
+- fix pytest-dev/pytest#3451: don't make assumptions about fs case sensitivity
+  in ``make_numbered_dir``.
+
+1.5.3
+=====
+
 - fix #179: ensure we can support 'from py.error import ...'
 
 1.5.2
 =====
 
 - fix #169, #170: error importing py.log on Windows: no module named ``syslog``.
 
 1.5.1
new file mode 100644
--- /dev/null
+++ b/third_party/python/py/HOWTORELEASE.rst
@@ -0,0 +1,17 @@
+Release Procedure
+-----------------
+
+#. Create a branch ``release-X.Y.Z`` from the latest ``master``.
+
+#. Manually update the ``CHANGELOG`` and commit.
+
+#. Open a PR for this branch targeting ``master``.
+
+#. After all tests pass and the PR has been approved by at least another maintainer, publish to PyPI by creating and pushing a tag::
+
+     git tag X.Y.Z
+     git push git@github.com:pytest-dev/py X.Y.Z
+
+   Wait for the deploy to complete, then make sure it is `available on PyPI <https://pypi.org/project/py>`_.
+
+#. Merge your PR to ``master``.
--- a/third_party/python/py/PKG-INFO
+++ b/third_party/python/py/PKG-INFO
@@ -1,11 +1,11 @@
 Metadata-Version: 1.2
 Name: py
-Version: 1.5.3
+Version: 1.5.4
 Summary: library with cross-python path, ini-parsing, io, code, log facilities
 Home-page: http://py.readthedocs.io/
 Author: holger krekel, Ronny Pfannschmidt, Benjamin Peterson and others
 Author-email: pytest-dev@python.org
 License: MIT license
 Description: .. image:: https://img.shields.io/pypi/v/py.svg
             :target: https://pypi.org/project/py
         
@@ -22,20 +22,20 @@ Description: .. image:: https://img.shie
            :target: https://ci.appveyor.com/project/pytestbot/py
         
         
         **NOTE**: this library is in **maintenance mode** and should not be used in new code.
         
         The py lib is a Python development support library featuring
         the following tools and modules:
         
-        * ``py.path``:  uniform local and svn path objects
-        * ``py.apipkg``:  explicit API control and lazy-importing
-        * ``py.iniconfig``:  easy parsing of .ini files
-        * ``py.code``: dynamic code generation and introspection (deprecated, moved to ``pytest``).
+        * ``py.path``:  uniform local and svn path objects  -> please use pathlib/pathlib2 instead
+        * ``py.apipkg``:  explicit API control and lazy-importing -> please use the standalone package instead
+        * ``py.iniconfig``:  easy parsing of .ini files -> please use the standalone package instead
+        * ``py.code``: dynamic code generation and introspection (deprecated, moved to ``pytest`` as a implementation detail).
         
         **NOTE**: prior to the 1.4 release this distribution used to
         contain py.test which is now its own package, see http://pytest.org
         
         For questions and more information please visit http://py.readthedocs.org
         
         Bugs and issues: https://github.com/pytest-dev/py
         
--- a/third_party/python/py/README.rst
+++ b/third_party/python/py/README.rst
@@ -14,20 +14,20 @@
    :target: https://ci.appveyor.com/project/pytestbot/py
 
 
 **NOTE**: this library is in **maintenance mode** and should not be used in new code.
 
 The py lib is a Python development support library featuring
 the following tools and modules:
 
-* ``py.path``:  uniform local and svn path objects
-* ``py.apipkg``:  explicit API control and lazy-importing
-* ``py.iniconfig``:  easy parsing of .ini files
-* ``py.code``: dynamic code generation and introspection (deprecated, moved to ``pytest``).
+* ``py.path``:  uniform local and svn path objects  -> please use pathlib/pathlib2 instead
+* ``py.apipkg``:  explicit API control and lazy-importing -> please use the standalone package instead
+* ``py.iniconfig``:  easy parsing of .ini files -> please use the standalone package instead
+* ``py.code``: dynamic code generation and introspection (deprecated, moved to ``pytest`` as a implementation detail).
 
 **NOTE**: prior to the 1.4 release this distribution used to
 contain py.test which is now its own package, see http://pytest.org
 
 For questions and more information please visit http://py.readthedocs.org
 
 Bugs and issues: https://github.com/pytest-dev/py
 
new file mode 100644
--- /dev/null
+++ b/third_party/python/py/appveyor.yml
@@ -0,0 +1,26 @@
+environment:
+  matrix:
+  # note: please use "tox --listenvs" to populate the build matrix below
+  - TOXENV: "py27-pytest29"
+  - TOXENV: "py27-pytest30"
+  - TOXENV: "py27-pytest31"
+  - TOXENV: "py34-pytest29"
+  - TOXENV: "py34-pytest30"
+  - TOXENV: "py34-pytest31"
+  - TOXENV: "py35-pytest29"
+  - TOXENV: "py35-pytest30"
+  - TOXENV: "py35-pytest31"
+  - TOXENV: "py36-pytest29"
+  - TOXENV: "py36-pytest30"
+  - TOXENV: "py36-pytest31"
+
+install:
+  - echo Installed Pythons
+  - dir c:\Python*
+
+  - C:\Python36\python -m pip install --upgrade --pre tox
+
+build: false  # Not a C# project, build stuff at the test step instead.
+
+test_script:
+  - C:\Python36\python -m tox
--- a/third_party/python/py/doc/path.txt
+++ b/third_party/python/py/doc/path.txt
@@ -1,12 +1,18 @@
 =======
 py.path
 =======
 
+    **Note**: The 'py' library is in "maintenance mode" and so is not
+    recommended for new projects. Please check out
+    `pathlib <https://docs.python.org/3/library/pathlib.html>`_ or
+    `pathlib2 <https://pypi.python.org/pypi/pathlib2/>`_ for path
+    operations.
+
 The 'py' lib provides a uniform high-level api to deal with filesystems
 and filesystem-like interfaces: ``py.path``.  It aims to offer a central
 object to fs-like object trees (reading from and writing to files, adding
 files/directories, examining the types and structure, etc.), and out-of-the-box
 provides a number of implementations of this API.
 
 py.path.local - local file system path
 ===============================================
--- a/third_party/python/py/py/__init__.py
+++ b/third_party/python/py/py/__init__.py
@@ -13,17 +13,22 @@ from py._error import error
 try:
     from py._vendored_packages import apipkg
     lib_not_mangled_by_packagers = True
     vendor_prefix = '._vendored_packages.'
 except ImportError:
     import apipkg
     lib_not_mangled_by_packagers = False
     vendor_prefix = ''
-__version__ = '1.5.3'
+
+try:
+    from ._version import version as __version__
+except ImportError:
+    # broken installation, we don't even try
+    __version__ = "unknown"
 
 
 apipkg.initpkg(__name__, attr={'_apipkg': apipkg, 'error': error}, exportdefs={
     # access to all standard lib modules
     'std': '._std:std',
 
     '_pydir' : '.__metainfo:pydir',
     'version': 'py:__version__', # backward compatibility
--- a/third_party/python/py/py/_path/local.py
+++ b/third_party/python/py/py/_path/local.py
@@ -1,21 +1,21 @@
 """
 local path implementation.
 """
 from __future__ import with_statement
 
 from contextlib import contextmanager
-import sys, os, re, atexit, io, uuid
+import sys, os, atexit, io, uuid
 import py
 from py._path import common
 from py._path.common import iswin32, fspath
 from stat import S_ISLNK, S_ISDIR, S_ISREG
 
-from os.path import abspath, normcase, normpath, isabs, exists, isdir, isfile, islink, dirname
+from os.path import abspath, normpath, isabs, exists, isdir, isfile, islink, dirname
 
 if sys.version_info > (3,0):
     def map_as_list(func, iter):
         return list(map(func, iter))
 else:
     map_as_list = map
 
 class Stat(object):
@@ -795,30 +795,30 @@ class LocalPath(FSBase):
             (which we created ourself).
         """
         import tempfile
         if rootdir is None:
             rootdir = cls.get_temproot()
         return cls(py.error.checked_call(tempfile.mkdtemp, dir=str(rootdir)))
 
     def make_numbered_dir(cls, prefix='session-', rootdir=None, keep=3,
-                          lock_timeout = 172800):   # two days
+                          lock_timeout=172800):   # two days
         """ return unique directory with a number greater than the current
             maximum one.  The number is assumed to start directly after prefix.
             if keep is true directories with a number less than (maxnum-keep)
             will be removed. If .lock files are used (lock_timeout non-zero),
             algorithm is multi-process safe.
         """
         if rootdir is None:
             rootdir = cls.get_temproot()
 
-        nprefix = normcase(prefix)
+        nprefix = prefix.lower()
         def parse_num(path):
             """ parse the number out of a path (if it matches the prefix) """
-            nbasename = normcase(path.basename)
+            nbasename = path.basename.lower()
             if nbasename.startswith(nprefix):
                 try:
                     return int(nbasename[len(nprefix):])
                 except ValueError:
                     pass
 
         def create_lockfile(path):
             """ exclusively create lockfile. Throws when failed """
new file mode 100644
--- /dev/null
+++ b/third_party/python/py/py/_version.py
@@ -0,0 +1,4 @@
+# coding: utf-8
+# file generated by setuptools_scm
+# don't change, don't track in version control
+version = '1.5.4'
--- a/third_party/python/py/setup.py
+++ b/third_party/python/py/setup.py
@@ -1,30 +1,18 @@
-import os
-import sys
-
 from setuptools import setup, find_packages
 
 
-def get_version():
-    p = os.path.join(os.path.dirname(
-                     os.path.abspath(__file__)), "py", "__init__.py")
-    with open(p) as f:
-        for line in f.readlines():
-            if "__version__" in line:
-                return line.strip().split("=")[-1].strip(" '")
-    raise ValueError("could not read version")
-
-
 def main():
     setup(
         name='py',
         description='library with cross-python path, ini-parsing, io, code, log facilities',
         long_description=open('README.rst').read(),
-        version=get_version(),
+        use_scm_version={"write_to": "py/_version.py"},
+        setup_requires=["setuptools-scm"],
         url='http://py.readthedocs.io/',
         license='MIT license',
         platforms=['unix', 'linux', 'osx', 'cygwin', 'win32'],
         python_requires='>=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*',
         author='holger krekel, Ronny Pfannschmidt, Benjamin Peterson and others',
         author_email='pytest-dev@python.org',
         classifiers=['Development Status :: 6 - Mature',
                      'Intended Audience :: Developers',
--- a/third_party/python/py/testing/path/test_local.py
+++ b/third_party/python/py/testing/path/test_local.py
@@ -420,34 +420,33 @@ class TestExecution:
             assert numdir.basename == 'base.%d' % i
             if i >= 1:
                 assert numdir.new(ext=str(i-1)).check()
             if i >= 2:
                 assert numdir.new(ext=str(i-2)).check()
             if i >= 3:
                 assert not numdir.new(ext=str(i-3)).check()
 
-    def test_make_numbered_dir_case_insensitive(self, tmpdir, monkeypatch):
-        # https://github.com/pytest-dev/pytest/issues/708
-        monkeypatch.setattr(py._path.local, 'normcase',
-                            lambda path: path.lower())
-        monkeypatch.setattr(tmpdir, 'listdir',
-                            lambda: [tmpdir._fastjoin('case.0')])
-        numdir = local.make_numbered_dir(prefix='CAse.', rootdir=tmpdir,
-                                         keep=2, lock_timeout=0)
-        assert numdir.basename.endswith('.1')
+    def test_make_numbered_dir_case(self, tmpdir):
+        """make_numbered_dir does not make assumptions on the underlying
+        filesystem based on the platform and will assume it _could_ be case
+        insensitive.
 
-    def test_make_numbered_dir_case_sensitive(self, tmpdir, monkeypatch):
-        # https://github.com/pytest-dev/pytest/issues/708
-        monkeypatch.setattr(py._path.local, 'normcase', lambda path: path)
-        monkeypatch.setattr(tmpdir, 'listdir',
-                            lambda: [tmpdir._fastjoin('case.0')])
-        numdir = local.make_numbered_dir(prefix='CAse.', rootdir=tmpdir,
-                                         keep=2, lock_timeout=0)
-        assert numdir.basename.endswith('.0')
+        See issues:
+        - https://github.com/pytest-dev/pytest/issues/708
+        - https://github.com/pytest-dev/pytest/issues/3451
+        """
+        d1 = local.make_numbered_dir(
+            prefix='CAse.', rootdir=tmpdir, keep=2, lock_timeout=0,
+        )
+        d2 = local.make_numbered_dir(
+            prefix='caSE.', rootdir=tmpdir, keep=2, lock_timeout=0,
+        )
+        assert str(d1).lower() != str(d2).lower()
+        assert str(d2).endswith('.1')
 
     def test_make_numbered_dir_NotImplemented_Error(self, tmpdir, monkeypatch):
         def notimpl(x, y):
             raise NotImplementedError(42)
         monkeypatch.setattr(os, 'symlink', notimpl)
         x = tmpdir.make_numbered_dir(rootdir=tmpdir, lock_timeout=0)
         assert x.relto(tmpdir)
         assert x.check()
--- a/third_party/python/pytest/.coveragerc
+++ b/third_party/python/pytest/.coveragerc
@@ -1,7 +1,4 @@
 [run]
-omit = 
+omit =
     # standlonetemplate is read dynamically and tested by test_genscript
     *standalonetemplate.py
-    # oldinterpret could be removed, as it is no longer used in py26+
-    *oldinterpret.py
-    vendored_packages
--- a/third_party/python/pytest/.github/PULL_REQUEST_TEMPLATE.md
+++ b/third_party/python/pytest/.github/PULL_REQUEST_TEMPLATE.md
@@ -1,15 +1,14 @@
 Thanks for submitting a PR, your contribution is really appreciated!
 
-Here's a quick checklist that should be present in PRs:
+Here's a quick checklist that should be present in PRs (you can delete this text from the final description, this is
+just a guideline):
 
-- [ ] Add a new news fragment into the changelog folder
-  * name it `$issue_id.$type` for example (588.bug)
-  * if you don't have an issue_id change it to the pr id after creating the pr
-  * ensure type is one of `removal`, `feature`, `bugfix`, `vendor`, `doc` or `trivial`
-  * Make sure to use full sentences with correct case and punctuation, for example: "Fix issue with non-ascii contents in doctest text files."
-- [ ] Target: for `bugfix`, `vendor`, `doc` or `trivial` fixes, target `master`; for removals or features target `features`;
-- [ ] Make sure to include reasonable tests for your change if necessary
+- [ ] Create a new changelog file in the `changelog` folder, with a name like `<ISSUE NUMBER>.<TYPE>.rst`. See [changelog/README.rst](/changelog/README.rst) for details.
+- [ ] Target the `master` branch for bug fixes, documentation updates and trivial changes.
+- [ ] Target the `features` branch for new features and removals/deprecations.
+- [ ] Include documentation when adding new features.
+- [ ] Include new tests or update existing tests when applicable.
 
-Unless your change is a trivial or a documentation fix (e.g.,  a typo or reword of a small section) please:
+Unless your change is trivial or a small documentation fix (e.g.,  a typo or reword of a small section) please:
 
-- [ ] Add yourself to `AUTHORS`, in alphabetical order;
+- [ ] Add yourself to `AUTHORS` in alphabetical order;
--- a/third_party/python/pytest/.gitignore
+++ b/third_party/python/pytest/.gitignore
@@ -14,26 +14,27 @@ include/
 *.pyo
 *.swp
 *.class
 *.orig
 *~
 .hypothesis/
 
 # autogenerated
-_pytest/_version.py
+src/_pytest/_version.py
 # setuptools
 .eggs/
 
 doc/*/_build
 build/
 dist/
 *.egg-info
 issue/
 env/
 .env/
 3rdparty/
 .tox
 .cache
+.pytest_cache
 .coverage
 .ropeproject
 .idea
 .hypothesis
new file mode 100644
--- /dev/null
+++ b/third_party/python/pytest/.pre-commit-config.yaml
@@ -0,0 +1,36 @@
+exclude: doc/en/example/py2py3/test_py2.py
+repos:
+-   repo: https://github.com/ambv/black
+    rev: 18.4a4
+    hooks:
+    -   id: black
+        args: [--safe, --quiet]
+        language_version: python3.6
+-   repo: https://github.com/asottile/blacken-docs
+    rev: v0.1.1
+    hooks:
+    -   id: blacken-docs
+        additional_dependencies: [black==18.5b1]
+        language_version: python3.6
+-   repo: https://github.com/pre-commit/pre-commit-hooks
+    rev: v1.2.3
+    hooks:
+    -   id: trailing-whitespace
+    -   id: end-of-file-fixer
+    -   id: check-yaml
+    -   id: debug-statements
+        exclude: _pytest/debugging.py
+    -   id: flake8
+-   repo: https://github.com/asottile/pyupgrade
+    rev: v1.2.0
+    hooks:
+    - id: pyupgrade
+-   repo: local
+    hooks:
+    -   id: rst
+        name: rst
+        entry: rst-lint --encoding utf-8
+        files: ^(CHANGELOG.rst|HOWTORELEASE.rst|README.rst|changelog/.*)$
+        language: python
+        additional_dependencies: [pygments, restructuredtext_lint]
+        python_version: python3.6
--- a/third_party/python/pytest/.travis.yml
+++ b/third_party/python/pytest/.travis.yml
@@ -1,58 +1,83 @@
 sudo: false
 language: python
+stages:
+- linting
+- test
+- deploy
 python:
   - '3.6'
-# command to install dependencies
 install:
   - pip install --upgrade --pre tox
-# # command to run tests
 env:
   matrix:
     # coveralls is not listed in tox's envlist, but should run in travis
     - TOXENV=coveralls
     # note: please use "tox --listenvs" to populate the build matrix below
-    - TOXENV=linting
+    # please remove the linting env in all cases
     - TOXENV=py27
     - TOXENV=py34
     - TOXENV=py36
     - TOXENV=py27-pexpect
     - TOXENV=py27-xdist
     - TOXENV=py27-trial
     - TOXENV=py27-numpy
+    - TOXENV=py27-pluggymaster
     - TOXENV=py36-pexpect
     - TOXENV=py36-xdist
     - TOXENV=py36-trial
     - TOXENV=py36-numpy
+    - TOXENV=py36-pluggymaster
     - TOXENV=py27-nobyte
     - TOXENV=doctesting
     - TOXENV=docs
 
-matrix:
+jobs:
   include:
-    - env: TOXENV=py26
-      python: '2.6'
-    - env: TOXENV=py33
-      python: '3.3'
     - env: TOXENV=pypy
       python: 'pypy-5.4'
     - env: TOXENV=py35
       python: '3.5'
     - env: TOXENV=py35-freeze
       python: '3.5'
     - env: TOXENV=py37
       python: 'nightly'
-  allow_failures:
-    - env: TOXENV=py37
-      python: 'nightly'
+
+    - stage: deploy
+      python: '3.6'
+      env:
+      install: pip install -U setuptools setuptools_scm
+      script: skip
+      deploy:
+        provider: pypi
+        user: nicoddemus
+        distributions: sdist bdist_wheel
+        skip_upload_docs: true
+        password:
+          secure: xanTgTUu6XDQVqB/0bwJQXoDMnU5tkwZc5koz6mBkkqZhKdNOi2CLoC1XhiSZ+ah24l4V1E0GAqY5kBBcy9d7NVe4WNg4tD095LsHw+CRU6/HCVIFfyk2IZ+FPAlguesCcUiJSXOrlBF+Wj68wEvLoK7EoRFbJeiZ/f91Ww1sbtDlqXABWGHrmhPJL5Wva7o7+wG7JwJowqdZg1pbQExsCc7b53w4v2RBu3D6TJaTAzHiVsW+nUSI67vKI/uf+cR/OixsTfy37wlHgSwihYmrYLFls3V0bSpahCim3bCgMaFZx8S8xrdgJ++PzBCof2HeflFKvW+VCkoYzGEG4NrTWJoNz6ni4red9GdvfjGH3YCjAKS56h9x58zp2E5rpsb/kVq5/45xzV+dq6JRuhQ1nJWjBC6fSKAc/bfwnuFK3EBxNLkvBssLHvsNjj5XG++cB8DdS9wVGUqjpoK4puaXUWFqy4q3S9F86HEsKNgExtieA9qNx+pCIZVs6JCXZNjr0I5eVNzqJIyggNgJG6RyravsU35t9Zd9doL5g4Y7UKmAGTn1Sz24HQ4sMQgXdm2SyD8gEK5je4tlhUvfGtDvMSlstq71kIn9nRpFnqB6MFlbYSEAZmo8dGbCquoUc++6Rum208wcVbrzzVtGlXB/Ow9AbFMYeAGA0+N/K1e59c=
+        on:
+          tags: true
+          repo: pytest-dev/pytest
+    - stage: linting
+      python: '3.6'
+      env:
+      install:
+      - pip install pre-commit
+      - pre-commit install-hooks
+      script:
+      - pre-commit run --all-files
 
 script: tox --recreate
 
 notifications:
   irc:
     channels:
       - "chat.freenode.net#pytest"
     on_success: change
     on_failure: change
     skip_join: true
   email:
     - pytest-commit@python.org
+cache:
+    directories:
+        - $HOME/.cache/pip
+        - $HOME/.cache/pre-commit
--- a/third_party/python/pytest/AUTHORS
+++ b/third_party/python/pytest/AUTHORS
@@ -1,47 +1,57 @@
 Holger Krekel, holger at merlinux eu
 merlinux GmbH, Germany, office at merlinux eu
 
 Contributors include::
 
+Aaron Coleman
 Abdeali JK
 Abhijeet Kasurde
 Ahn Ki-Wook
+Alan Velasco
 Alexander Johnson
 Alexei Kozlenok
 Anatoly Bubenkoff
+Anders Hovmöller
 Andras Tim
 Andreas Zeidler
 Andrzej Ostrowski
 Andy Freeland
 Anthon van der Neut
+Anthony Shaw
 Anthony Sottile
 Antony Lee
 Armin Rigo
+Aron Coyle
 Aron Curzon
+Aviral Verma
 Aviv Palivoda
 Barney Gale
 Ben Webb
 Benjamin Peterson
 Bernard Pratz
 Bob Ippolito
 Brian Dorsey
+Brian Maissy
 Brian Okken
 Brianna Laugher
 Bruno Oliveira
 Cal Leeming
 Carl Friedrich Bolz
+Carlos Jenkins
+Ceridwen
 Charles Cloud
 Charnjit SiNGH (CCSJ)
 Chris Lamb
 Christian Boelsen
 Christian Theunert
 Christian Tismer
 Christopher Gilling
+Cyrus Maden
 Daniel Grana
 Daniel Hahler
 Daniel Nuri
 Daniel Wandschneider
 Danielle Jenkins
 Dave Hunt
 David Díaz-Barquero
 David Mohr
@@ -60,44 +70,54 @@ Elizaveta Shashkova
 Endre Galaczi
 Eric Hunsberger
 Eric Siegerman
 Erik M. Bray
 Feng Ma
 Florian Bruhin
 Floris Bruynooghe
 Gabriel Reis
+George Kussumoto
 Georgy Dyuldin
 Graham Horler
 Greg Price
 Grig Gheorghiu
 Grigorii Eremeev (budulianin)
 Guido Wesdorp
+Guoqiang Zhang
 Harald Armin Massa
+Henk-Jaap Wagenaar
+Hugo van Kemenade
 Hui Wang (coldnight)
 Ian Bicking
+Ian Lesperance
 Jaap Broekhuizen
 Jan Balster
 Janne Vanhala
 Jason R. Coombs
 Javier Domingo Cansino
 Javier Romero
+Jeff Rackauckas
 Jeff Widman
+John Eddie Ayson
 John Towler
 Jon Sonesen
 Jonas Obrist
 Jordan Guymon
 Jordan Moldow
+Jordan Speicher
 Joshua Bronson
 Jurko Gospodnetić
 Justyna Janczyszyn
 Kale Kundert
 Katarzyna Jachim
+Katerina Koukiou
 Kevin Cox
 Kodi B. Arfer
+Kostis Anagnostopoulos
 Lawrence Mitchell
 Lee Kamentsky
 Lev Maximov
 Llandy Riveron Del Risco
 Loic Esteve
 Lukas Bednar
 Luke Murphy
 Maciek Fijalkowski
@@ -113,68 +133,81 @@ Martijn Faassen
 Martin Altmayer
 Martin K. Scherer
 Martin Prusse
 Mathieu Clabaut
 Matt Bachmann
 Matt Duck
 Matt Williams
 Matthias Hafner
+Maxim Filipenko
 mbyt
 Michael Aquilina
 Michael Birtwell
 Michael Droettboom
 Michael Seifert
 Michal Wajszczuk
 Mihai Capotă
 Mike Lundy
+Miro Hrončok
 Nathaniel Waisbrot
 Ned Batchelder
 Neven Mundar
 Nicolas Delaby
 Oleg Pidsadnyi
+Oleg Sushchenko
 Oliver Bestwalter
 Omar Kohl
 Omer Hadari
 Patrick Hayes
 Paweł Adamczak
+Pedro Algarvio
 Pieter Mulder
 Piotr Banaszkiewicz
 Punyashloka Biswal
 Quentin Pradet
 Ralf Schmitt
 Ran Benita
+Raphael Castaneda
 Raphael Pierzina
 Raquel Alegre
 Ravi Chandra
 Roberto Polli
 Romain Dorgueil
 Roman Bolshakov
 Ronny Pfannschmidt
 Ross Lawley
 Russel Winder
 Ryan Wooden
+Samuel Dion-Girardeau
 Samuele Pedroni
 Segev Finer
 Simon Gomizelj
 Skylar Downes
 Srinivas Reddy Thatiparthy
 Stefan Farmbauer
 Stefan Zimmermann
 Stefano Taschini
 Steffen Allner
 Stephan Obermann
+Tarcisio Fischer
 Tareq Alayan
 Ted Xiao
 Thomas Grainger
+Thomas Hisch
+Tim Strazny
 Tom Dalton
 Tom Viner
 Trevor Bekolay
 Tyler Goodlet
+Tzu-ping Chung
 Vasily Kuznetsov
 Victor Uriarte
 Vidar T. Fauske
 Vitaly Lashmanov
 Vlad Dragos
+William Lee
 Wouter van Ackooy
 Xuan Luong
 Xuecong Liao
 Zoltán Máté
+Roland Puntaier
+Allan Feldman
--- a/third_party/python/pytest/CHANGELOG.rst
+++ b/third_party/python/pytest/CHANGELOG.rst
@@ -1,18 +1,884 @@
-.. 
+..
     You should *NOT* be adding new change log entries to this file, this
     file is managed by towncrier. You *may* edit previous change logs to
     fix problems like typo corrections or such.
     To add a new change log entry, please see
     https://pip.pypa.io/en/latest/development/#adding-a-news-entry
     we named the news folder changelog
 
 .. towncrier release notes start
 
+Pytest 3.6.2 (2018-06-20)
+=========================
+
+Bug Fixes
+---------
+
+- Fix regression in ``Node.add_marker`` by extracting the mark object of a
+  ``MarkDecorator``. (`#3555
+  <https://github.com/pytest-dev/pytest/issues/3555>`_)
+
+- Warnings without ``location`` were reported as ``None``. This is corrected to
+  now report ``<undetermined location>``. (`#3563
+  <https://github.com/pytest-dev/pytest/issues/3563>`_)
+
+- Continue to call finalizers in the stack when a finalizer in a former scope
+  raises an exception. (`#3569
+  <https://github.com/pytest-dev/pytest/issues/3569>`_)
+
+- Fix encoding error with `print` statements in doctests (`#3583
+  <https://github.com/pytest-dev/pytest/issues/3583>`_)
+
+
+Improved Documentation
+----------------------
+
+- Add documentation for the ``--strict`` flag. (`#3549
+  <https://github.com/pytest-dev/pytest/issues/3549>`_)
+
+
+Trivial/Internal Changes
+------------------------
+
+- Update old quotation style to parens in fixture.rst documentation. (`#3525
+  <https://github.com/pytest-dev/pytest/issues/3525>`_)
+
+- Improve display of hint about ``--fulltrace`` with ``KeyboardInterrupt``.
+  (`#3545 <https://github.com/pytest-dev/pytest/issues/3545>`_)
+
+- pytest's testsuite is no longer runnable through ``python setup.py test`` --
+  instead invoke ``pytest`` or ``tox`` directly. (`#3552
+  <https://github.com/pytest-dev/pytest/issues/3552>`_)
+
+- Fix typo in documentation (`#3567
+  <https://github.com/pytest-dev/pytest/issues/3567>`_)
+
+
+Pytest 3.6.1 (2018-06-05)
+=========================
+
+Bug Fixes
+---------
+
+- Fixed a bug where stdout and stderr were logged twice by junitxml when a test
+  was marked xfail. (`#3491
+  <https://github.com/pytest-dev/pytest/issues/3491>`_)
+
+- Fix ``usefixtures`` mark applyed to unittest tests by correctly instantiating
+  ``FixtureInfo``. (`#3498
+  <https://github.com/pytest-dev/pytest/issues/3498>`_)
+
+- Fix assertion rewriter compatibility with libraries that monkey patch
+  ``file`` objects. (`#3503
+  <https://github.com/pytest-dev/pytest/issues/3503>`_)
+
+
+Improved Documentation
+----------------------
+
+- Added a section on how to use fixtures as factories to the fixture
+  documentation. (`#3461 <https://github.com/pytest-dev/pytest/issues/3461>`_)
+
+
+Trivial/Internal Changes
+------------------------
+
+- Enable caching for pip/pre-commit in order to reduce build time on
+  travis/appveyor. (`#3502
+  <https://github.com/pytest-dev/pytest/issues/3502>`_)
+
+- Switch pytest to the src/ layout as we already suggested it for good practice
+  - now we implement it as well. (`#3513
+  <https://github.com/pytest-dev/pytest/issues/3513>`_)
+
+- Fix if in tests to support 3.7.0b5, where a docstring handling in AST got
+  reverted. (`#3530 <https://github.com/pytest-dev/pytest/issues/3530>`_)
+
+- Remove some python2.5 compatibility code. (`#3529
+  <https://github.com/pytest-dev/pytest/issues/3529>`_)
+
+
+Pytest 3.6.0 (2018-05-23)
+=========================
+
+Features
+--------
+
+- Revamp the internals of the ``pytest.mark`` implementation with correct per
+  node handling which fixes a number of long standing bugs caused by the old
+  design. This introduces new ``Node.iter_markers(name)`` and
+  ``Node.get_closest_mark(name)`` APIs. Users are **strongly encouraged** to
+  read the `reasons for the revamp in the docs
+  <https://docs.pytest.org/en/latest/mark.html#marker-revamp-and-iteration>`_,
+  or jump over to details about `updating existing code to use the new APIs
+  <https://docs.pytest.org/en/latest/mark.html#updating-code>`_. (`#3317
+  <https://github.com/pytest-dev/pytest/issues/3317>`_)
+
+- Now when ``@pytest.fixture`` is applied more than once to the same function a
+  ``ValueError`` is raised. This buggy behavior would cause surprising problems
+  and if was working for a test suite it was mostly by accident. (`#2334
+  <https://github.com/pytest-dev/pytest/issues/2334>`_)
+
+- Support for Python 3.7's builtin ``breakpoint()`` method, see `Using the
+  builtin breakpoint function
+  <https://docs.pytest.org/en/latest/usage.html#breakpoint-builtin>`_ for
+  details. (`#3180 <https://github.com/pytest-dev/pytest/issues/3180>`_)
+
+- ``monkeypatch`` now supports a ``context()`` function which acts as a context
+  manager which undoes all patching done within the ``with`` block. (`#3290
+  <https://github.com/pytest-dev/pytest/issues/3290>`_)
+
+- The ``--pdb`` option now causes KeyboardInterrupt to enter the debugger,
+  instead of stopping the test session. On python 2.7, hitting CTRL+C again
+  exits the debugger. On python 3.2 and higher, use CTRL+D. (`#3299
+  <https://github.com/pytest-dev/pytest/issues/3299>`_)
+
+- pytest not longer changes the log level of the root logger when the
+  ``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
+  in user code. (`#3307 <https://github.com/pytest-dev/pytest/issues/3307>`_)
+
+
+Bug Fixes
+---------
+
+- A rare race-condition which might result in corrupted ``.pyc`` files on
+  Windows has been hopefully solved. (`#3008
+  <https://github.com/pytest-dev/pytest/issues/3008>`_)
+
+- Also use iter_marker for discovering the marks applying for marker
+  expressions from the cli to avoid the bad data from the legacy mark storage.
+  (`#3441 <https://github.com/pytest-dev/pytest/issues/3441>`_)
+
+- When showing diffs of failed assertions where the contents contain only
+  whitespace, escape them using ``repr()`` first to make it easy to spot the
+  differences. (`#3443 <https://github.com/pytest-dev/pytest/issues/3443>`_)
+
+
+Improved Documentation
+----------------------
+
+- Change documentation copyright year to a range which auto-updates itself each
+  time it is published. (`#3303
+  <https://github.com/pytest-dev/pytest/issues/3303>`_)
+
+
+Trivial/Internal Changes
+------------------------
+
+- ``pytest`` now depends on the `python-atomicwrites
+  <https://github.com/untitaker/python-atomicwrites>`_ library. (`#3008
+  <https://github.com/pytest-dev/pytest/issues/3008>`_)
+
+- Update all pypi.python.org URLs to pypi.org. (`#3431
+  <https://github.com/pytest-dev/pytest/issues/3431>`_)
+
+- Detect `pytest_` prefixed hooks using the internal plugin manager since
+  ``pluggy`` is deprecating the ``implprefix`` argument to ``PluginManager``.
+  (`#3487 <https://github.com/pytest-dev/pytest/issues/3487>`_)
+
+- Import ``Mapping`` and ``Sequence`` from ``_pytest.compat`` instead of
+  directly from ``collections`` in ``python_api.py::approx``. Add ``Mapping``
+  to ``_pytest.compat``, import it from ``collections`` on python 2, but from
+  ``collections.abc`` on Python 3 to avoid a ``DeprecationWarning`` on Python
+  3.7 or newer. (`#3497 <https://github.com/pytest-dev/pytest/issues/3497>`_)
+
+
+Pytest 3.5.1 (2018-04-23)
+=========================
+
+
+Bug Fixes
+---------
+
+- Reset ``sys.last_type``, ``sys.last_value`` and ``sys.last_traceback`` before
+  each test executes. Those attributes are added by pytest during the test run
+  to aid debugging, but were never reset so they would create a leaking
+  reference to the last failing test's frame which in turn could never be
+  reclaimed by the garbage collector. (`#2798
+  <https://github.com/pytest-dev/pytest/issues/2798>`_)
+
+- ``pytest.raises`` now raises ``TypeError`` when receiving an unknown keyword
+  argument. (`#3348 <https://github.com/pytest-dev/pytest/issues/3348>`_)
+
+- ``pytest.raises`` now works with exception classes that look like iterables.
+  (`#3372 <https://github.com/pytest-dev/pytest/issues/3372>`_)
+
+
+Improved Documentation
+----------------------
+
+- Fix typo in ``caplog`` fixture documentation, which incorrectly identified
+  certain attributes as methods. (`#3406
+  <https://github.com/pytest-dev/pytest/issues/3406>`_)
+
+
+Trivial/Internal Changes
+------------------------
+
+- Added a more indicative error message when parametrizing a function whose
+  argument takes a default value. (`#3221
+  <https://github.com/pytest-dev/pytest/issues/3221>`_)
+
+- Remove internal ``_pytest.terminal.flatten`` function in favor of
+  ``more_itertools.collapse``. (`#3330
+  <https://github.com/pytest-dev/pytest/issues/3330>`_)
+
+- Import some modules from ``collections.abc`` instead of ``collections`` as
+  the former modules trigger ``DeprecationWarning`` in Python 3.7. (`#3339
+  <https://github.com/pytest-dev/pytest/issues/3339>`_)
+
+- record_property is no longer experimental, removing the warnings was
+  forgotten. (`#3360 <https://github.com/pytest-dev/pytest/issues/3360>`_)
+
+- Mention in documentation and CLI help that fixtures with leading ``_`` are
+  printed by ``pytest --fixtures`` only if the ``-v`` option is added. (`#3398
+  <https://github.com/pytest-dev/pytest/issues/3398>`_)
+
+
+Pytest 3.5.0 (2018-03-21)
+=========================
+
+Deprecations and Removals
+-------------------------
+
+- ``record_xml_property`` fixture is now deprecated in favor of the more
+  generic ``record_property``. (`#2770
+  <https://github.com/pytest-dev/pytest/issues/2770>`_)
+
+- Defining ``pytest_plugins`` is now deprecated in non-top-level conftest.py
+  files, because they "leak" to the entire directory tree. (`#3084
+  <https://github.com/pytest-dev/pytest/issues/3084>`_)
+
+
+Features
+--------
+
+- New ``--show-capture`` command-line option that allows to specify how to
+  display captured output when tests fail: ``no``, ``stdout``, ``stderr``,
+  ``log`` or ``all`` (the default). (`#1478
+  <https://github.com/pytest-dev/pytest/issues/1478>`_)
+
+- New ``--rootdir`` command-line option to override the rules for discovering
+  the root directory. See `customize
+  <https://docs.pytest.org/en/latest/customize.html>`_ in the documentation for
+  details. (`#1642 <https://github.com/pytest-dev/pytest/issues/1642>`_)
+
+- Fixtures are now instantiated based on their scopes, with higher-scoped
+  fixtures (such as ``session``) being instantiated first than lower-scoped
+  fixtures (such as ``function``). The relative order of fixtures of the same
+  scope is kept unchanged, based in their declaration order and their
+  dependencies. (`#2405 <https://github.com/pytest-dev/pytest/issues/2405>`_)
+
+- ``record_xml_property`` renamed to ``record_property`` and is now compatible
+  with xdist, markers and any reporter. ``record_xml_property`` name is now
+  deprecated. (`#2770 <https://github.com/pytest-dev/pytest/issues/2770>`_)
+
+- New ``--nf``, ``--new-first`` options: run new tests first followed by the
+  rest of the tests, in both cases tests are also sorted by the file modified
+  time, with more recent files coming first. (`#3034
+  <https://github.com/pytest-dev/pytest/issues/3034>`_)
+
+- New ``--last-failed-no-failures`` command-line option that allows to specify
+  the behavior of the cache plugin's ```--last-failed`` feature when no tests
+  failed in the last run (or no cache was found): ``none`` or ``all`` (the
+  default). (`#3139 <https://github.com/pytest-dev/pytest/issues/3139>`_)
+
+- New ``--doctest-continue-on-failure`` command-line option to enable doctests
+  to show multiple failures for each snippet, instead of stopping at the first
+  failure. (`#3149 <https://github.com/pytest-dev/pytest/issues/3149>`_)
+
+- Captured log messages are added to the ``<system-out>`` tag in the generated
+  junit xml file if the ``junit_logging`` ini option is set to ``system-out``.
+  If the value of this ini option is ``system-err``, the logs are written to
+  ``<system-err>``. The default value for ``junit_logging`` is ``no``, meaning
+  captured logs are not written to the output file. (`#3156
+  <https://github.com/pytest-dev/pytest/issues/3156>`_)
+
+- Allow the logging plugin to handle ``pytest_runtest_logstart`` and
+  ``pytest_runtest_logfinish`` hooks when live logs are enabled. (`#3189
+  <https://github.com/pytest-dev/pytest/issues/3189>`_)
+
+- Passing `--log-cli-level` in the command-line now automatically activates
+  live logging. (`#3190 <https://github.com/pytest-dev/pytest/issues/3190>`_)
+
+- Add command line option ``--deselect`` to allow deselection of individual
+  tests at collection time. (`#3198
+  <https://github.com/pytest-dev/pytest/issues/3198>`_)
+
+- Captured logs are printed before entering pdb. (`#3204
+  <https://github.com/pytest-dev/pytest/issues/3204>`_)
+
+- Deselected item count is now shown before tests are run, e.g. ``collected X
+  items / Y deselected``. (`#3213
+  <https://github.com/pytest-dev/pytest/issues/3213>`_)
+
+- The builtin module ``platform`` is now available for use in expressions in
+  ``pytest.mark``. (`#3236
+  <https://github.com/pytest-dev/pytest/issues/3236>`_)
+
+- The *short test summary info* section now is displayed after tracebacks and
+  warnings in the terminal. (`#3255
+  <https://github.com/pytest-dev/pytest/issues/3255>`_)
+
+- New ``--verbosity`` flag to set verbosity level explicitly. (`#3296
+  <https://github.com/pytest-dev/pytest/issues/3296>`_)
+
+- ``pytest.approx`` now accepts comparing a numpy array with a scalar. (`#3312
+  <https://github.com/pytest-dev/pytest/issues/3312>`_)
+
+
+Bug Fixes
+---------
+
+- Suppress ``IOError`` when closing the temporary file used for capturing
+  streams in Python 2.7. (`#2370
+  <https://github.com/pytest-dev/pytest/issues/2370>`_)
+
+- Fixed ``clear()`` method on ``caplog`` fixture which cleared ``records``, but
+  not the ``text`` property. (`#3297
+  <https://github.com/pytest-dev/pytest/issues/3297>`_)
+
+- During test collection, when stdin is not allowed to be read, the
+  ``DontReadFromStdin`` object still allow itself to be iterable and resolved
+  to an iterator without crashing. (`#3314
+  <https://github.com/pytest-dev/pytest/issues/3314>`_)
+
+
+Improved Documentation
+----------------------
+
+- Added a `reference <https://docs.pytest.org/en/latest/reference.html>`_ page
+  to the docs. (`#1713 <https://github.com/pytest-dev/pytest/issues/1713>`_)
+
+
+Trivial/Internal Changes
+------------------------
+
+- Change minimum requirement of ``attrs`` to ``17.4.0``. (`#3228
+  <https://github.com/pytest-dev/pytest/issues/3228>`_)
+
+- Renamed example directories so all tests pass when ran from the base
+  directory. (`#3245 <https://github.com/pytest-dev/pytest/issues/3245>`_)
+
+- Internal ``mark.py`` module has been turned into a package. (`#3250
+  <https://github.com/pytest-dev/pytest/issues/3250>`_)
+
+- ``pytest`` now depends on the `more-itertools
+  <https://github.com/erikrose/more-itertools>`_ package. (`#3265
+  <https://github.com/pytest-dev/pytest/issues/3265>`_)
+
+- Added warning when ``[pytest]`` section is used in a ``.cfg`` file passed
+  with ``-c`` (`#3268 <https://github.com/pytest-dev/pytest/issues/3268>`_)
+
+- ``nodeids`` can now be passed explicitly to ``FSCollector`` and ``Node``
+  constructors. (`#3291 <https://github.com/pytest-dev/pytest/issues/3291>`_)
+
+- Internal refactoring of ``FormattedExcinfo`` to use ``attrs`` facilities and
+  remove old support code for legacy Python versions. (`#3292
+  <https://github.com/pytest-dev/pytest/issues/3292>`_)
+
+- Refactoring to unify how verbosity is handled internally. (`#3296
+  <https://github.com/pytest-dev/pytest/issues/3296>`_)
+
+- Internal refactoring to better integrate with argparse. (`#3304
+  <https://github.com/pytest-dev/pytest/issues/3304>`_)
+
+- Fix a python example when calling a fixture in doc/en/usage.rst (`#3308
+  <https://github.com/pytest-dev/pytest/issues/3308>`_)
+
+
+Pytest 3.4.2 (2018-03-04)
+=========================
+
+Bug Fixes
+---------
+
+- Removed progress information when capture option is ``no``. (`#3203
+  <https://github.com/pytest-dev/pytest/issues/3203>`_)
+
+- Refactor check of bindir from ``exists`` to ``isdir``. (`#3241
+  <https://github.com/pytest-dev/pytest/issues/3241>`_)
+
+- Fix ``TypeError`` issue when using ``approx`` with a ``Decimal`` value.
+  (`#3247 <https://github.com/pytest-dev/pytest/issues/3247>`_)
+
+- Fix reference cycle generated when using the ``request`` fixture. (`#3249
+  <https://github.com/pytest-dev/pytest/issues/3249>`_)
+
+- ``[tool:pytest]`` sections in ``*.cfg`` files passed by the ``-c`` option are
+  now properly recognized. (`#3260
+  <https://github.com/pytest-dev/pytest/issues/3260>`_)
+
+
+Improved Documentation
+----------------------
+
+- Add logging plugin to plugins list. (`#3209
+  <https://github.com/pytest-dev/pytest/issues/3209>`_)
+
+
+Trivial/Internal Changes
+------------------------
+
+- Fix minor typo in fixture.rst (`#3259
+  <https://github.com/pytest-dev/pytest/issues/3259>`_)
+
+
+Pytest 3.4.1 (2018-02-20)
+=========================
+
+Bug Fixes
+---------
+
+- Move import of ``doctest.UnexpectedException`` to top-level to avoid possible
+  errors when using ``--pdb``. (`#1810
+  <https://github.com/pytest-dev/pytest/issues/1810>`_)
+
+- Added printing of captured stdout/stderr before entering pdb, and improved a
+  test which was giving false negatives about output capturing. (`#3052
+  <https://github.com/pytest-dev/pytest/issues/3052>`_)
+
+- Fix ordering of tests using parametrized fixtures which can lead to fixtures
+  being created more than necessary. (`#3161
+  <https://github.com/pytest-dev/pytest/issues/3161>`_)
+
+- Fix bug where logging happening at hooks outside of "test run" hooks would
+  cause an internal error. (`#3184
+  <https://github.com/pytest-dev/pytest/issues/3184>`_)
+
+- Detect arguments injected by ``unittest.mock.patch`` decorator correctly when
+  pypi ``mock.patch`` is installed and imported. (`#3206
+  <https://github.com/pytest-dev/pytest/issues/3206>`_)
+
+- Errors shown when a ``pytest.raises()`` with ``match=`` fails are now cleaner
+  on what happened: When no exception was raised, the "matching '...'" part got
+  removed as it falsely implies that an exception was raised but it didn't
+  match. When a wrong exception was raised, it's now thrown (like
+  ``pytest.raised()`` without ``match=`` would) instead of complaining about
+  the unmatched text. (`#3222
+  <https://github.com/pytest-dev/pytest/issues/3222>`_)
+
+- Fixed output capture handling in doctests on macOS. (`#985
+  <https://github.com/pytest-dev/pytest/issues/985>`_)
+
+
+Improved Documentation
+----------------------
+
+- Add Sphinx parameter docs for ``match`` and ``message`` args to
+  ``pytest.raises``. (`#3202
+  <https://github.com/pytest-dev/pytest/issues/3202>`_)
+
+
+Trivial/Internal Changes
+------------------------
+
+- pytest has changed the publication procedure and is now being published to
+  PyPI directly from Travis. (`#3060
+  <https://github.com/pytest-dev/pytest/issues/3060>`_)
+
+- Rename ``ParameterSet._for_parameterize()`` to ``_for_parametrize()`` in
+  order to comply with the naming convention. (`#3166
+  <https://github.com/pytest-dev/pytest/issues/3166>`_)
+
+- Skip failing pdb/doctest test on mac. (`#985
+  <https://github.com/pytest-dev/pytest/issues/985>`_)
+
+
+Pytest 3.4.0 (2018-01-30)
+=========================
+
+Deprecations and Removals
+-------------------------
+
+- All pytest classes now subclass ``object`` for better Python 2/3 compatibility.
+  This should not affect user code except in very rare edge cases. (`#2147
+  <https://github.com/pytest-dev/pytest/issues/2147>`_)
+
+
+Features
+--------
+
+- Introduce ``empty_parameter_set_mark`` ini option to select which mark to
+  apply when ``@pytest.mark.parametrize`` is given an empty set of parameters.
+  Valid options are ``skip`` (default) and ``xfail``. Note that it is planned
+  to change the default to ``xfail`` in future releases as this is considered
+  less error prone. (`#2527
+  <https://github.com/pytest-dev/pytest/issues/2527>`_)
+
+- **Incompatible change**: after community feedback the `logging
+  <https://docs.pytest.org/en/latest/logging.html>`_ functionality has
+  undergone some changes. Please consult the `logging documentation
+  <https://docs.pytest.org/en/latest/logging.html#incompatible-changes-in-pytest-3-4>`_
+  for details. (`#3013 <https://github.com/pytest-dev/pytest/issues/3013>`_)
+
+- Console output falls back to "classic" mode when capturing is disabled (``-s``),
+  otherwise the output gets garbled to the point of being useless. (`#3038
+  <https://github.com/pytest-dev/pytest/issues/3038>`_)
+
+- New `pytest_runtest_logfinish
+  <https://docs.pytest.org/en/latest/writing_plugins.html#_pytest.hookspec.pytest_runtest_logfinish>`_
+  hook which is called when a test item has finished executing, analogous to
+  `pytest_runtest_logstart
+  <https://docs.pytest.org/en/latest/writing_plugins.html#_pytest.hookspec.pytest_runtest_start>`_.
+  (`#3101 <https://github.com/pytest-dev/pytest/issues/3101>`_)
+
+- Improve performance when collecting tests using many fixtures. (`#3107
+  <https://github.com/pytest-dev/pytest/issues/3107>`_)
+
+- New ``caplog.get_records(when)`` method which provides access to the captured
+  records for the ``"setup"``, ``"call"`` and ``"teardown"``
+  testing stages. (`#3117 <https://github.com/pytest-dev/pytest/issues/3117>`_)
+
+- New fixture ``record_xml_attribute`` that allows modifying and inserting
+  attributes on the ``<testcase>`` xml node in JUnit reports. (`#3130
+  <https://github.com/pytest-dev/pytest/issues/3130>`_)
+
+- The default cache directory has been renamed from ``.cache`` to
+  ``.pytest_cache`` after community feedback that the name ``.cache`` did not
+  make it clear that it was used by pytest. (`#3138
+  <https://github.com/pytest-dev/pytest/issues/3138>`_)
+
+- Colorize the levelname column in the live-log output. (`#3142
+  <https://github.com/pytest-dev/pytest/issues/3142>`_)
+
+
+Bug Fixes
+---------
+
+- Fix hanging pexpect test on MacOS by using flush() instead of wait().
+  (`#2022 <https://github.com/pytest-dev/pytest/issues/2022>`_)
+
+- Fix restoring Python state after in-process pytest runs with the
+  ``pytester`` plugin; this may break tests using multiple inprocess
+  pytest runs if later ones depend on earlier ones leaking global interpreter
+  changes. (`#3016 <https://github.com/pytest-dev/pytest/issues/3016>`_)
+
+- Fix skipping plugin reporting hook when test aborted before plugin setup
+  hook. (`#3074 <https://github.com/pytest-dev/pytest/issues/3074>`_)
+
+- Fix progress percentage reported when tests fail during teardown. (`#3088
+  <https://github.com/pytest-dev/pytest/issues/3088>`_)
+
+- **Incompatible change**: ``-o/--override`` option no longer eats all the
+  remaining options, which can lead to surprising behavior: for example,
+  ``pytest -o foo=1 /path/to/test.py`` would fail because ``/path/to/test.py``
+  would be considered as part of the ``-o`` command-line argument. One
+  consequence of this is that now multiple configuration overrides need
+  multiple ``-o`` flags: ``pytest -o foo=1 -o bar=2``. (`#3103
+  <https://github.com/pytest-dev/pytest/issues/3103>`_)
+
+
+Improved Documentation
+----------------------
+
+- Document hooks (defined with ``historic=True``) which cannot be used with
+  ``hookwrapper=True``. (`#2423
+  <https://github.com/pytest-dev/pytest/issues/2423>`_)
+
+- Clarify that warning capturing doesn't change the warning filter by default.
+  (`#2457 <https://github.com/pytest-dev/pytest/issues/2457>`_)
+
+- Clarify a possible confusion when using pytest_fixture_setup with fixture
+  functions that return None. (`#2698
+  <https://github.com/pytest-dev/pytest/issues/2698>`_)
+
+- Fix the wording of a sentence on doctest flags used in pytest. (`#3076
+  <https://github.com/pytest-dev/pytest/issues/3076>`_)
+
+- Prefer ``https://*.readthedocs.io`` over ``http://*.rtfd.org`` for links in
+  the documentation. (`#3092
+  <https://github.com/pytest-dev/pytest/issues/3092>`_)
+
+- Improve readability (wording, grammar) of Getting Started guide (`#3131
+  <https://github.com/pytest-dev/pytest/issues/3131>`_)
+
+- Added note that calling pytest.main multiple times from the same process is
+  not recommended because of import caching. (`#3143
+  <https://github.com/pytest-dev/pytest/issues/3143>`_)
+
+
+Trivial/Internal Changes
+------------------------
+
+- Show a simple and easy error when keyword expressions trigger a syntax error
+  (for example, ``"-k foo and import"`` will show an error that you can not use
+  the ``import`` keyword in expressions). (`#2953
+  <https://github.com/pytest-dev/pytest/issues/2953>`_)
+
+- Change parametrized automatic test id generation to use the ``__name__``
+  attribute of functions instead of the fallback argument name plus counter.
+  (`#2976 <https://github.com/pytest-dev/pytest/issues/2976>`_)
+
+- Replace py.std with stdlib imports. (`#3067
+  <https://github.com/pytest-dev/pytest/issues/3067>`_)
+
+- Corrected 'you' to 'your' in logging docs. (`#3129
+  <https://github.com/pytest-dev/pytest/issues/3129>`_)
+
+
+Pytest 3.3.2 (2017-12-25)
+=========================
+
+Bug Fixes
+---------
+
+- pytester: ignore files used to obtain current user metadata in the fd leak
+  detector. (`#2784 <https://github.com/pytest-dev/pytest/issues/2784>`_)
+
+- Fix **memory leak** where objects returned by fixtures were never destructed
+  by the garbage collector. (`#2981
+  <https://github.com/pytest-dev/pytest/issues/2981>`_)
+
+- Fix conversion of pyargs to filename to not convert symlinks on Python 2. (`#2985
+  <https://github.com/pytest-dev/pytest/issues/2985>`_)
+
+- ``PYTEST_DONT_REWRITE`` is now checked for plugins too rather than only for
+  test modules. (`#2995 <https://github.com/pytest-dev/pytest/issues/2995>`_)
+
+
+Improved Documentation
+----------------------
+
+- Add clarifying note about behavior of multiple parametrized arguments (`#3001
+  <https://github.com/pytest-dev/pytest/issues/3001>`_)
+
+
+Trivial/Internal Changes
+------------------------
+
+- Code cleanup. (`#3015 <https://github.com/pytest-dev/pytest/issues/3015>`_,
+  `#3021 <https://github.com/pytest-dev/pytest/issues/3021>`_)
+
+- Clean up code by replacing imports and references of `_ast` to `ast`. (`#3018
+  <https://github.com/pytest-dev/pytest/issues/3018>`_)
+
+
+Pytest 3.3.1 (2017-12-05)
+=========================
+
+Bug Fixes
+---------
+
+- Fix issue about ``-p no:<plugin>`` having no effect. (`#2920
+  <https://github.com/pytest-dev/pytest/issues/2920>`_)
+
+- Fix regression with warnings that contained non-strings in their arguments in
+  Python 2. (`#2956 <https://github.com/pytest-dev/pytest/issues/2956>`_)
+
+- Always escape null bytes when setting ``PYTEST_CURRENT_TEST``. (`#2957
+  <https://github.com/pytest-dev/pytest/issues/2957>`_)
+
+- Fix ``ZeroDivisionError`` when using the ``testmon`` plugin when no tests
+  were actually collected. (`#2971
+  <https://github.com/pytest-dev/pytest/issues/2971>`_)
+
+- Bring back ``TerminalReporter.writer`` as an alias to
+  ``TerminalReporter._tw``. This alias was removed by accident in the ``3.3.0``
+  release. (`#2984 <https://github.com/pytest-dev/pytest/issues/2984>`_)
+
+- The ``pytest-capturelog`` plugin is now also blacklisted, avoiding errors when
+  running pytest with it still installed. (`#3004
+  <https://github.com/pytest-dev/pytest/issues/3004>`_)
+
+
+Improved Documentation
+----------------------
+
+- Fix broken link to plugin ``pytest-localserver``. (`#2963
+  <https://github.com/pytest-dev/pytest/issues/2963>`_)
+
+
+Trivial/Internal Changes
+------------------------
+
+- Update github "bugs" link in ``CONTRIBUTING.rst`` (`#2949
+  <https://github.com/pytest-dev/pytest/issues/2949>`_)
+
+
+Pytest 3.3.0 (2017-11-23)
+=========================
+
+Deprecations and Removals
+-------------------------
+
+- Pytest no longer supports Python **2.6** and **3.3**. Those Python versions
+  are EOL for some time now and incur maintenance and compatibility costs on
+  the pytest core team, and following up with the rest of the community we
+  decided that they will no longer be supported starting on this version. Users
+  which still require those versions should pin pytest to ``<3.3``. (`#2812
+  <https://github.com/pytest-dev/pytest/issues/2812>`_)
+
+- Remove internal ``_preloadplugins()`` function. This removal is part of the
+  ``pytest_namespace()`` hook deprecation. (`#2636
+  <https://github.com/pytest-dev/pytest/issues/2636>`_)
+
+- Internally change ``CallSpec2`` to have a list of marks instead of a broken
+  mapping of keywords. This removes the keywords attribute of the internal
+  ``CallSpec2`` class. (`#2672
+  <https://github.com/pytest-dev/pytest/issues/2672>`_)
+
+- Remove ParameterSet.deprecated_arg_dict - its not a public api and the lack
+  of the underscore was a naming error. (`#2675
+  <https://github.com/pytest-dev/pytest/issues/2675>`_)
+
+- Remove the internal multi-typed attribute ``Node._evalskip`` and replace it
+  with the boolean ``Node._skipped_by_mark``. (`#2767
+  <https://github.com/pytest-dev/pytest/issues/2767>`_)
+
+- The ``params`` list passed to ``pytest.fixture`` is now for
+  all effects considered immutable and frozen at the moment of the ``pytest.fixture``
+  call. Previously the list could be changed before the first invocation of the fixture
+  allowing for a form of dynamic parametrization (for example, updated from command-line options),
+  but this was an unwanted implementation detail which complicated the internals and prevented
+  some internal cleanup. See issue `#2959 <https://github.com/pytest-dev/pytest/issues/2959>`_
+  for details and a recommended workaround.
+
+Features
+--------
+
+- ``pytest_fixture_post_finalizer`` hook can now receive a ``request``
+  argument. (`#2124 <https://github.com/pytest-dev/pytest/issues/2124>`_)
+
+- Replace the old introspection code in compat.py that determines the available
+  arguments of fixtures with inspect.signature on Python 3 and
+  funcsigs.signature on Python 2. This should respect ``__signature__``
+  declarations on functions. (`#2267
+  <https://github.com/pytest-dev/pytest/issues/2267>`_)
+
+- Report tests with global ``pytestmark`` variable only once. (`#2549
+  <https://github.com/pytest-dev/pytest/issues/2549>`_)
+
+- Now pytest displays the total progress percentage while running tests. The
+  previous output style can be set by configuring the ``console_output_style``
+  setting to ``classic``. (`#2657 <https://github.com/pytest-dev/pytest/issues/2657>`_)
+
+- Match ``warns`` signature to ``raises`` by adding ``match`` keyword. (`#2708
+  <https://github.com/pytest-dev/pytest/issues/2708>`_)
+
+- Pytest now captures and displays output from the standard ``logging`` module.
+  The user can control the logging level to be captured by specifying options
+  in ``pytest.ini``, the command line and also during individual tests using
+  markers. Also, a ``caplog`` fixture is available that enables users to test
+  the captured log during specific tests (similar to ``capsys`` for example).
+  For more information, please see the `logging docs
+  <https://docs.pytest.org/en/latest/logging.html>`_. This feature was
+  introduced by merging the popular `pytest-catchlog
+  <https://pypi.org/project/pytest-catchlog/>`_ plugin, thanks to `Thomas Hisch
+  <https://github.com/thisch>`_. Be advised that during the merging the
+  backward compatibility interface with the defunct ``pytest-capturelog`` has
+  been dropped. (`#2794 <https://github.com/pytest-dev/pytest/issues/2794>`_)
+
+- Add ``allow_module_level`` kwarg to ``pytest.skip()``, enabling to skip the
+  whole module. (`#2808 <https://github.com/pytest-dev/pytest/issues/2808>`_)
+
+- Allow setting ``file_or_dir``, ``-c``, and ``-o`` in PYTEST_ADDOPTS. (`#2824
+  <https://github.com/pytest-dev/pytest/issues/2824>`_)
+
+- Return stdout/stderr capture results as a ``namedtuple``, so ``out`` and
+  ``err`` can be accessed by attribute. (`#2879
+  <https://github.com/pytest-dev/pytest/issues/2879>`_)
+
+- Add ``capfdbinary``, a version of ``capfd`` which returns bytes from
+  ``readouterr()``. (`#2923
+  <https://github.com/pytest-dev/pytest/issues/2923>`_)
+
+- Add ``capsysbinary`` a version of ``capsys`` which returns bytes from
+  ``readouterr()``. (`#2934
+  <https://github.com/pytest-dev/pytest/issues/2934>`_)
+
+- Implement feature to skip ``setup.py`` files when run with
+  ``--doctest-modules``. (`#502
+  <https://github.com/pytest-dev/pytest/issues/502>`_)
+
+
+Bug Fixes
+---------
+
+- Resume output capturing after ``capsys/capfd.disabled()`` context manager.
+  (`#1993 <https://github.com/pytest-dev/pytest/issues/1993>`_)
+
+- ``pytest_fixture_setup`` and ``pytest_fixture_post_finalizer`` hooks are now
+  called for all ``conftest.py`` files. (`#2124
+  <https://github.com/pytest-dev/pytest/issues/2124>`_)
+
+- If an exception happens while loading a plugin, pytest no longer hides the
+  original traceback. In Python 2 it will show the original traceback with a new
+  message that explains in which plugin. In Python 3 it will show 2 canonized
+  exceptions, the original exception while loading the plugin in addition to an
+  exception that pytest throws about loading a plugin. (`#2491
+  <https://github.com/pytest-dev/pytest/issues/2491>`_)
+
+- ``capsys`` and ``capfd`` can now be used by other fixtures. (`#2709
+  <https://github.com/pytest-dev/pytest/issues/2709>`_)
+
+- Internal ``pytester`` plugin properly encodes ``bytes`` arguments to
+  ``utf-8``. (`#2738 <https://github.com/pytest-dev/pytest/issues/2738>`_)
+
+- ``testdir`` now uses use the same method used by ``tmpdir`` to create its
+  temporary directory. This changes the final structure of the ``testdir``
+  directory slightly, but should not affect usage in normal scenarios and
+  avoids a number of potential problems. (`#2751
+  <https://github.com/pytest-dev/pytest/issues/2751>`_)
+
+- Pytest no longer complains about warnings with unicode messages being
+  non-ascii compatible even for ascii-compatible messages. As a result of this,
+  warnings with unicode messages are converted first to an ascii representation
+  for safety. (`#2809 <https://github.com/pytest-dev/pytest/issues/2809>`_)
+
+- Change return value of pytest command when ``--maxfail`` is reached from
+  ``2`` (interrupted) to ``1`` (failed). (`#2845
+  <https://github.com/pytest-dev/pytest/issues/2845>`_)
+
+- Fix issue in assertion rewriting which could lead it to rewrite modules which
+  should not be rewritten. (`#2939
+  <https://github.com/pytest-dev/pytest/issues/2939>`_)
+
+- Handle marks without description in ``pytest.ini``. (`#2942
+  <https://github.com/pytest-dev/pytest/issues/2942>`_)
+
+
+Trivial/Internal Changes
+------------------------
+
+- pytest now depends on `attrs <https://pypi.org/project/attrs/>`_ for internal
+  structures to ease code maintainability. (`#2641
+  <https://github.com/pytest-dev/pytest/issues/2641>`_)
+
+- Refactored internal Python 2/3 compatibility code to use ``six``. (`#2642
+  <https://github.com/pytest-dev/pytest/issues/2642>`_)
+
+- Stop vendoring ``pluggy`` - we're missing out on its latest changes for not
+  much benefit (`#2719 <https://github.com/pytest-dev/pytest/issues/2719>`_)
+
+- Internal refactor: simplify ascii string escaping by using the
+  backslashreplace error handler in newer Python 3 versions. (`#2734
+  <https://github.com/pytest-dev/pytest/issues/2734>`_)
+
+- Remove unnecessary mark evaluator in unittest plugin (`#2767
+  <https://github.com/pytest-dev/pytest/issues/2767>`_)
+
+- Calls to ``Metafunc.addcall`` now emit a deprecation warning. This function
+  is scheduled to be removed in ``pytest-4.0``. (`#2876
+  <https://github.com/pytest-dev/pytest/issues/2876>`_)
+
+- Internal move of the parameterset extraction to a more maintainable place.
+  (`#2877 <https://github.com/pytest-dev/pytest/issues/2877>`_)
+
+- Internal refactoring to simplify scope node lookup. (`#2910
+  <https://github.com/pytest-dev/pytest/issues/2910>`_)
+
+- Configure ``pytest`` to prevent pip from installing pytest in unsupported
+  Python versions. (`#2922
+  <https://github.com/pytest-dev/pytest/issues/2922>`_)
+
+
 Pytest 3.2.5 (2017-11-15)
 =========================
 
 Bug Fixes
 ---------
 
 - Remove ``py<1.5`` restriction from ``pytest`` as this can cause version
   conflicts in some installations. (`#2926
@@ -187,17 +1053,17 @@ Improved Documentation
 
 Pytest 3.2.0 (2017-07-30)
 =========================
 
 Deprecations and Removals
 -------------------------
 
 - ``pytest.approx`` no longer supports ``>``, ``>=``, ``<`` and ``<=``
-  operators to avoid surprising/inconsistent behavior. See `the docs
+  operators to avoid surprising/inconsistent behavior. See `the approx docs
   <https://docs.pytest.org/en/latest/builtin.html#pytest.approx>`_ for more
   information. (`#2003 <https://github.com/pytest-dev/pytest/issues/2003>`_)
 
 - All old-style specific behavior in current classes in the pytest's API is
   considered deprecated at this point and will be removed in a future release.
   This affects Python 2 users only and in rare situations. (`#2147
   <https://github.com/pytest-dev/pytest/issues/2147>`_)
 
@@ -511,29 +1377,29 @@ Changes
 * Change junitxml.py to produce reports that comply with Junitxml schema.
   If the same test fails with failure in call and then errors in teardown
   we split testcase element into two, one containing the error and the other
   the failure. (`#2228`_) Thanks to `@kkoukiou`_ for the PR.
 
 * Testcase reports with a ``url`` attribute will now properly write this to junitxml.
   Thanks `@fushi`_ for the PR (`#1874`_).
 
-* Remove common items from dict comparision output when verbosity=1. Also update
+* Remove common items from dict comparison output when verbosity=1. Also update
   the truncation message to make it clearer that pytest truncates all
   assertion messages if verbosity < 2 (`#1512`_).
   Thanks `@mattduck`_ for the PR
 
 * ``--pdbcls`` no longer implies ``--pdb``. This makes it possible to use
   ``addopts=--pdbcls=module.SomeClass`` on ``pytest.ini``. Thanks `@davidszotten`_ for
   the PR (`#1952`_).
 
 * fix `#2013`_: turn RecordedWarning into ``namedtuple``,
   to give it a comprehensible repr while preventing unwarranted modification.
 
-* fix `#2208`_: ensure a iteration limit for _pytest.compat.get_real_func.
+* fix `#2208`_: ensure an iteration limit for _pytest.compat.get_real_func.
   Thanks `@RonnyPfannschmidt`_ for the report and PR.
 
 * Hooks are now verified after collection is complete, rather than right after loading installed plugins. This
   makes it easy to write hooks for plugins which will be loaded during collection, for example using the
   ``pytest_plugins`` special variable (`#1821`_).
   Thanks `@nicoddemus`_ for the PR.
 
 * Modify ``pytest_make_parametrize_id()`` hook to accept ``argname`` as an
@@ -627,17 +1493,17 @@ 3.0.7 (2017-03-14)
 ==================
 
 
 * Fix issue in assertion rewriting breaking due to modules silently discarding
   other modules when importing fails
   Notably, importing the ``anydbm`` module is fixed. (`#2248`_).
   Thanks `@pfhayes`_ for the PR.
 
-* junitxml: Fix problematic case where system-out tag occured twice per testcase
+* junitxml: Fix problematic case where system-out tag occurred twice per testcase
   element in the XML report. Thanks `@kkoukiou`_ for the PR.
 
 * Fix regression, pytest now skips unittest correctly if run with ``--pdb``
   (`#2137`_). Thanks to `@gst`_ for the report and `@mbyt`_ for the PR.
 
 * Ignore exceptions raised from descriptors (e.g. properties) during Python test collection (`#2234`_).
   Thanks to `@bluetech`_.
 
@@ -2074,17 +2940,17 @@ 2.7.0 (2015-03-26)
 
 - fix issue650: new option ``--docttest-ignore-import-errors`` which
   will turn import errors in doctests into skips.  Thanks Charles Cloud
   for the complete PR.
 
 - fix issue655: work around different ways that cause python2/3
   to leak sys.exc_info into fixtures/tests causing failures in 3rd party code
 
-- fix issue615: assertion re-writing did not correctly escape % signs
+- fix issue615: assertion rewriting did not correctly escape % signs
   when formatting boolean operations, which tripped over mixing
   booleans with modulo operators.  Thanks to Tom Viner for the report,
   triaging and fix.
 
 - implement issue351: add ability to specify parametrize ids as a callable
   to generate custom test ids.  Thanks Brianna Laugher for the idea and
   implementation.
 
@@ -2223,17 +3089,17 @@ 2.6.1 (2014-08-07)
 
 - fix integration of pytest with unittest.mock.patch decorator when
   it uses the "new" argument.  Thanks Nicolas Delaby for test and PR.
 
 - fix issue with detecting conftest files if the arguments contain
   "::" node id specifications (copy pasted from "-v" output)
 
 - fix issue544 by only removing "@NUM" at the end of "::" separated parts
-  and if the part has an ".py" extension
+  and if the part has a ".py" extension
 
 - don't use py.std import helper, rather import things directly.
   Thanks Bruno Oliveira.
 
 2.6
 ===
 
 - Cache exceptions from fixtures according to their scope (issue 467).
@@ -2494,17 +3360,17 @@ 2.5.0 (2013-12-12)
 
 - avoid one surprising case of marker malfunction/confusion::
 
       @pytest.mark.some(lambda arg: ...)
       def test_function():
 
   would not work correctly because pytest assumes @pytest.mark.some
   gets a function to be decorated already.  We now at least detect if this
-  arg is an lambda and thus the example will work.  Thanks Alex Gaynor
+  arg is a lambda and thus the example will work.  Thanks Alex Gaynor
   for bringing it up.
 
 - xfail a test on pypy that checks wrong encoding/ascii (pypy does
   not error out). fixes issue385.
 
 - internally make varnames() deal with classes's __init__,
   although it's not needed by pytest itself atm.  Also
   fix caching.  Fixes issue376.
@@ -2807,17 +3673,17 @@ 2.3.5 (2013-04-30)
 2.3.4 (2012-11-20)
 ==================
 
 - yielded test functions will now have autouse-fixtures active but
   cannot accept fixtures as funcargs - it's anyway recommended to
   rather use the post-2.0 parametrize features instead of yield, see:
   http://pytest.org/latest/example/parametrize.html
 - fix autouse-issue where autouse-fixtures would not be discovered
-  if defined in a a/conftest.py file and tests in a/tests/test_some.py
+  if defined in an a/conftest.py file and tests in a/tests/test_some.py
 - fix issue226 - LIFO ordering for fixture teardowns
 - fix issue224 - invocations with >256 char arguments now work
 - fix issue91 - add/discuss package/directory level setups in example
 - allow to dynamically define markers via
   item.keywords[...]=assignment integrating with "-m" option
 - make "-k" accept an expressions the same as with "-m" so that one
   can write: -k "name1 or name2" etc.  This is a slight incompatibility
   if you used special syntax like "TestClass.test_method" which you now
@@ -3377,17 +4243,17 @@ 1.3.2 (2010-07-08)
 - fix terminal writing on win32/python2.4
 - py.process.cmdexec() now tries harder to return properly encoded unicode objects
   on all python versions
 - install plain py.test/py.which scripts also for Jython, this helps to
   get canonical script paths in virtualenv situations
 - make path.bestrelpath(path) return ".", note that when calling
   X.bestrelpath the assumption is that X is a directory.
 - make initial conftest discovery ignore "--" prefixed arguments
-- fix resultlog plugin when used in an multicpu/multihost xdist situation
+- fix resultlog plugin when used in a multicpu/multihost xdist situation
   (thanks Jakub Gustak)
 - perform distributed testing related reporting in the xdist-plugin
   rather than having dist-related code in the generic py.test
   distribution
 - fix homedir detection on Windows
 - ship distribute_setup.py version 0.6.13
 
 1.3.1 (2010-05-25)
--- a/third_party/python/pytest/CONTRIBUTING.rst
+++ b/third_party/python/pytest/CONTRIBUTING.rst
@@ -43,30 +43,28 @@ If you can write a demonstration test th
 fix the bug itself.
 
 
 .. _fixbugs:
 
 Fix bugs
 --------
 
-Look through the GitHub issues for bugs.  Here is a filter you can use:
-https://github.com/pytest-dev/pytest/labels/bug
+Look through the `GitHub issues for bugs <https://github.com/pytest-dev/pytest/labels/type:%20bug>`_.
 
 :ref:`Talk <contact>` to developers to find out how you can fix specific bugs.
 
 Don't forget to check the issue trackers of your favourite plugins, too!
 
 .. _writeplugins:
 
 Implement features
 ------------------
 
-Look through the GitHub issues for enhancements.  Here is a filter you can use:
-https://github.com/pytest-dev/pytest/labels/enhancement
+Look through the `GitHub issues for enhancements <https://github.com/pytest-dev/pytest/labels/type:%20enhancement>`_.
 
 :ref:`Talk <contact>` to developers to find out how you can implement specific
 features.
 
 Write documentation
 -------------------
 
 Pytest could always use more documentation.  What exactly is needed?
@@ -136,17 +134,17 @@ If no contributor strongly objects and t
 transferred to the ``pytest-dev`` organisation.
 
 Here's a rundown of how a repository transfer usually proceeds
 (using a repository named ``joedoe/pytest-xyz`` as example):
 
 * ``joedoe`` transfers repository ownership to ``pytest-dev`` administrator ``calvin``.
 * ``calvin`` creates ``pytest-xyz-admin`` and ``pytest-xyz-developers`` teams, inviting ``joedoe`` to both as **maintainer**.
 * ``calvin`` transfers repository to ``pytest-dev`` and configures team access:
-  
+
   - ``pytest-xyz-admin`` **admin** access;
   - ``pytest-xyz-developers`` **write** access;
 
 The ``pytest-dev/Contributors`` team has write access to all projects, and
 every project administrator is in it. We recommend that each plugin has at least three
 people who have the right to release to PyPI.
 
 Repository owners can rest assured that no ``pytest-dev`` administrator will ever make
@@ -159,31 +157,32 @@ As stated, the objective is to share mai
 .. _pull-requests:
 
 Preparing Pull Requests
 -----------------------
 
 Short version
 ~~~~~~~~~~~~~
 
-#. Fork the repository;
-#. Target ``master`` for bugfixes and doc changes;
+#. Fork the repository.
+#. Enable and install `pre-commit <https://pre-commit.com>`_ to ensure style-guides and code checks are followed.
+#. Target ``master`` for bugfixes and doc changes.
 #. Target ``features`` for new features or functionality changes.
-#. Follow **PEP-8**. There's a ``tox`` command to help fixing it: ``tox -e fix-lint``.
+#. Follow **PEP-8** for naming and `black <https://github.com/ambv/black>`_ for formatting.
 #. Tests are run using ``tox``::
 
     tox -e linting,py27,py36
 
    The test environments above are usually enough to cover most cases locally.
 
 #. Write a ``changelog`` entry: ``changelog/2574.bugfix``, use issue id number
    and one of ``bugfix``, ``removal``, ``feature``, ``vendor``, ``doc`` or
    ``trivial`` for the issue type.
 #. Unless your change is a trivial or a documentation fix (e.g., a typo or reword of a small section) please
-   add yourself to the ``AUTHORS`` file, in alphabetical order;
+   add yourself to the ``AUTHORS`` file, in alphabetical order.
 
 
 Long version
 ~~~~~~~~~~~~
 
 What is a "pull request"?  It informs the project's core developers about the
 changes you want to review and merge.  Pull requests are stored on
 `GitHub servers <https://github.com/pytest-dev/pytest/pulls>`_.
@@ -199,30 +198,40 @@ Here is a simple overview, with pytest-s
    fine to use ``pytest`` as your fork repository name because it will live
    under your user.
 
 #. Clone your fork locally using `git <https://git-scm.com/>`_ and create a branch::
 
     $ git clone git@github.com:YOUR_GITHUB_USERNAME/pytest.git
     $ cd pytest
     # now, to fix a bug create your own branch off "master":
-    
+
         $ git checkout -b your-bugfix-branch-name master
 
     # or to instead add a feature create your own branch off "features":
-    
+
         $ git checkout -b your-feature-branch-name features
 
-   Given we have "major.minor.micro" version numbers, bugfixes will usually 
-   be released in micro releases whereas features will be released in 
+   Given we have "major.minor.micro" version numbers, bugfixes will usually
+   be released in micro releases whereas features will be released in
    minor releases and incompatible changes in major releases.
 
    If you need some help with Git, follow this quick start
    guide: https://git.wiki.kernel.org/index.php/QuickStart
 
+#. Install `pre-commit <https://pre-commit.com>`_ and its hook on the pytest repo::
+
+     $ pip install --user pre-commit
+     $ pre-commit install
+
+   Afterwards ``pre-commit`` will run whenever you commit.
+
+   https://pre-commit.com/ is a framework for managing and maintaining multi-language pre-commit hooks
+   to ensure code-style and code formatting is consistent.
+
 #. Install tox
 
    Tox is used to run all the tests and will automatically setup virtualenvs
    to run the tests in.
    (will implicitly use http://www.virtualenv.org/en/latest/)::
 
     $ pip install tox
 
@@ -231,35 +240,30 @@ Here is a simple overview, with pytest-s
    You need to have Python 2.7 and 3.6 available in your system.  Now
    running tests is as simple as issuing this command::
 
     $ tox -e linting,py27,py36
 
    This command will run tests via the "tox" tool against Python 2.7 and 3.6
    and also perform "lint" coding-style checks.
 
-#. You can now edit your local working copy. Please follow PEP-8.
-
-   You can now make the changes you want and run the tests again as necessary.
-
-   If you have too much linting errors, try running::
-
-    $ tox -e fix-lint
-
-   To fix pep8 related errors.
+#. You can now edit your local working copy and run the tests again as necessary. Please follow PEP-8 for naming.
 
    You can pass different options to ``tox``. For example, to run tests on Python 2.7 and pass options to pytest
    (e.g. enter pdb on failure) to pytest you can do::
 
     $ tox -e py27 -- --pdb
 
    Or to only run tests in a particular test module on Python 3.6::
 
     $ tox -e py36 -- testing/test_config.py
 
+
+   When committing, ``pre-commit`` will re-format the files if necessary.
+
 #. Commit and push once your tests pass and you are happy with your change(s)::
 
     $ git commit -a -m "<commit message>"
     $ git push -u
 
 #. Create a new changelog entry in ``changelog``. The file should be named ``<issueid>.<type>``,
    where *issueid* is the number of the issue related to the change and *type* is one of
    ``bugfix``, ``removal``, ``feature``, ``vendor``, ``doc`` or ``trivial``.
@@ -271,8 +275,20 @@ Here is a simple overview, with pytest-s
     head-fork: YOUR_GITHUB_USERNAME/pytest
     compare: your-branch-name
 
     base-fork: pytest-dev/pytest
     base: master          # if it's a bugfix
     base: features        # if it's a feature
 
 
+Joining the Development Team
+----------------------------
+
+Anyone who has successfully seen through a pull request which did not
+require any extra work from the development team to merge will
+themselves gain commit access if they so wish (if we forget to ask please send a friendly
+reminder).  This does not mean your workflow to contribute changes,
+everyone goes through the same pull-request-and-review process and
+no-one merges their own pull requests unless already approved.  It does however mean you can
+participate in the development process more fully since you can merge
+pull requests from other contributors yourself after having reviewed
+them.
--- a/third_party/python/pytest/HOWTORELEASE.rst
+++ b/third_party/python/pytest/HOWTORELEASE.rst
@@ -7,59 +7,43 @@ taking a lot of time to make a new one.
 
 .. important::
 
     pytest releases must be prepared on **Linux** because the docs and examples expect
     to be executed in that platform.
 
 #. Install development dependencies in a virtual environment with::
 
-    pip3 install -r tasks/requirements.txt
+    pip3 install -U -r tasks/requirements.txt
 
 #. Create a branch ``release-X.Y.Z`` with the version for the release.
 
    * **patch releases**: from the latest ``master``;
 
    * **minor releases**: from the latest ``features``; then merge with the latest ``master``;
 
    Ensure your are in a clean work tree.
 
-#. Generate docs, changelog, announcements and upload a package to
-   your ``devpi`` staging server::
+#. Generate docs, changelog, announcements and a **local** tag::
 
-     invoke generate.pre-release <VERSION> <DEVPI USER> --password <DEVPI PASSWORD>
-
-   If ``--password`` is not given, it is assumed the user is already logged in ``devpi``.
-   If you don't have an account, please ask for one.
+     invoke generate.pre-release <VERSION>
 
 #. Open a PR for this branch targeting ``master``.
 
-#. Test the package
+#. After all tests pass and the PR has been approved, publish to PyPI by pushing the tag::
 
-   * **Manual method**
-
-     Run from multiple machines::
+     git push git@github.com:pytest-dev/pytest.git <VERSION>
 
-       devpi use https://devpi.net/USER/dev
-       devpi test pytest==VERSION
+   Wait for the deploy to complete, then make sure it is `available on PyPI <https://pypi.org/project/pytest>`_.
 
-     Check that tests pass for relevant combinations with::
-
-       devpi list pytest
+#. Send an email announcement with the contents from::
 
-   * **CI servers**
+     doc/en/announce/release-<VERSION>.rst
 
-     Configure a repository as per-instructions on
-     devpi-cloud-test_ to test the package on Travis_ and AppVeyor_.
-     All test environments should pass.
+   To the following mailing lists:
 
-#. Publish to PyPI::
+   * pytest-dev@python.org (all releases)
+   * python-announce-list@python.org (all releases)
+   * testing-in-python@lists.idyll.org (only major/minor releases)
 
-      invoke generate.publish-release <VERSION> <DEVPI USER> <PYPI_NAME>
-
-   where PYPI_NAME is the name of pypi.python.org as configured in your ``~/.pypirc``
-   file `for devpi <http://doc.devpi.net/latest/quickstart-releaseprocess.html?highlight=pypirc#devpi-push-releasing-to-an-external-index>`_.
+   And announce it on `Twitter <https://twitter.com/>`_ with the ``#pytest`` hashtag.
 
 #. After a minor/major release, merge ``release-X.Y.Z`` into ``master`` and push (or open a PR).
-
-.. _devpi-cloud-test: https://github.com/obestwalter/devpi-cloud-test
-.. _AppVeyor: https://www.appveyor.com/
-.. _Travis: https://travis-ci.org
--- a/third_party/python/pytest/PKG-INFO
+++ b/third_party/python/pytest/PKG-INFO
@@ -1,52 +1,60 @@
-Metadata-Version: 1.1
+Metadata-Version: 1.2
 Name: pytest
-Version: 3.2.5
+Version: 3.6.2
 Summary: pytest: simple powerful testing with Python
 Home-page: http://pytest.org
 Author: Holger Krekel, Bruno Oliveira, Ronny Pfannschmidt, Floris Bruynooghe, Brianna Laugher, Florian Bruhin and others
-Author-email: UNKNOWN
 License: MIT license
+Project-URL: Source, https://github.com/pytest-dev/pytest
+Project-URL: Tracker, https://github.com/pytest-dev/pytest/issues
 Description: .. image:: http://docs.pytest.org/en/latest/_static/pytest1.png
            :target: http://docs.pytest.org
            :align: center
            :alt: pytest
         
         ------
         
         .. image:: https://img.shields.io/pypi/v/pytest.svg
-            :target: https://pypi.python.org/pypi/pytest
+            :target: https://pypi.org/project/pytest/
         
-        .. image:: https://anaconda.org/conda-forge/pytest/badges/version.svg
+        .. image:: https://img.shields.io/conda/vn/conda-forge/pytest.svg
             :target: https://anaconda.org/conda-forge/pytest
         
         .. image:: https://img.shields.io/pypi/pyversions/pytest.svg
-            :target: https://pypi.python.org/pypi/pytest
+            :target: https://pypi.org/project/pytest/
         
         .. image:: https://img.shields.io/coveralls/pytest-dev/pytest/master.svg
             :target: https://coveralls.io/r/pytest-dev/pytest
         
         .. image:: https://travis-ci.org/pytest-dev/pytest.svg?branch=master
             :target: https://travis-ci.org/pytest-dev/pytest
         
         .. image:: https://ci.appveyor.com/api/projects/status/mrgbjaua7t33pg6b?svg=true
             :target: https://ci.appveyor.com/project/pytestbot/pytest
         
+        .. image:: https://img.shields.io/badge/code%20style-black-000000.svg
+          :target: https://github.com/ambv/black
+        
+        .. image:: https://www.codetriage.com/pytest-dev/pytest/badges/users.svg
+            :target: https://www.codetriage.com/pytest-dev/pytest
+        
         The ``pytest`` framework makes it easy to write small tests, yet
         scales to support complex functional testing for applications and libraries.
         
         An example of a simple test:
         
         .. code-block:: python
         
             # content of test_sample.py
             def inc(x):
                 return x + 1
         
+        
             def test_answer():
                 assert inc(3) == 5
         
         
         To execute it::
         
             $ pytest
             ============================= test session starts =============================
@@ -79,17 +87,17 @@ Description: .. image:: http://docs.pyte
           of test modules and functions;
         
         - `Modular fixtures <http://docs.pytest.org/en/latest/fixture.html>`_ for
           managing small or parametrized long-lived test resources;
         
         - Can run `unittest <http://docs.pytest.org/en/latest/unittest.html>`_ (or trial),
           `nose <http://docs.pytest.org/en/latest/nose.html>`_ test suites out of the box;
         
-        - Python2.6+, Python3.3+, PyPy-2.3, Jython-2.5 (untested);
+        - Python 2.7, Python 3.4+, PyPy 2.3, Jython 2.5 (untested);
         
         - Rich plugin architecture, with over 315+ `external plugins <http://plugincompat.herokuapp.com>`_ and thriving community;
         
         
         Documentation
         -------------
         
         For full documentation, including installation, tutorials and PDF documents, please see http://docs.pytest.org.
@@ -127,15 +135,15 @@ Classifier: Intended Audience :: Develop
 Classifier: License :: OSI Approved :: MIT License
 Classifier: Operating System :: POSIX
 Classifier: Operating System :: Microsoft :: Windows
 Classifier: Operating System :: MacOS :: MacOS X
 Classifier: Topic :: Software Development :: Testing
 Classifier: Topic :: Software Development :: Libraries
 Classifier: Topic :: Utilities
 Classifier: Programming Language :: Python :: 2
-Classifier: Programming Language :: Python :: 2.6
 Classifier: Programming Language :: Python :: 2.7
 Classifier: Programming Language :: Python :: 3
-Classifier: Programming Language :: Python :: 3.3
 Classifier: Programming Language :: Python :: 3.4
 Classifier: Programming Language :: Python :: 3.5
 Classifier: Programming Language :: Python :: 3.6
+Classifier: Programming Language :: Python :: 3.7
+Requires-Python: >=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*
--- a/third_party/python/pytest/README.rst
+++ b/third_party/python/pytest/README.rst
@@ -1,44 +1,51 @@
 .. image:: http://docs.pytest.org/en/latest/_static/pytest1.png
    :target: http://docs.pytest.org
    :align: center
    :alt: pytest
 
 ------
 
 .. image:: https://img.shields.io/pypi/v/pytest.svg
-    :target: https://pypi.python.org/pypi/pytest
+    :target: https://pypi.org/project/pytest/
 
-.. image:: https://anaconda.org/conda-forge/pytest/badges/version.svg
+.. image:: https://img.shields.io/conda/vn/conda-forge/pytest.svg
     :target: https://anaconda.org/conda-forge/pytest
 
 .. image:: https://img.shields.io/pypi/pyversions/pytest.svg
-    :target: https://pypi.python.org/pypi/pytest
+    :target: https://pypi.org/project/pytest/
 
 .. image:: https://img.shields.io/coveralls/pytest-dev/pytest/master.svg
     :target: https://coveralls.io/r/pytest-dev/pytest
 
 .. image:: https://travis-ci.org/pytest-dev/pytest.svg?branch=master
     :target: https://travis-ci.org/pytest-dev/pytest
 
 .. image:: https://ci.appveyor.com/api/projects/status/mrgbjaua7t33pg6b?svg=true
     :target: https://ci.appveyor.com/project/pytestbot/pytest
 
+.. image:: https://img.shields.io/badge/code%20style-black-000000.svg
+  :target: https://github.com/ambv/black
+
+.. image:: https://www.codetriage.com/pytest-dev/pytest/badges/users.svg
+    :target: https://www.codetriage.com/pytest-dev/pytest
+
 The ``pytest`` framework makes it easy to write small tests, yet
 scales to support complex functional testing for applications and libraries.
 
 An example of a simple test:
 
 .. code-block:: python
 
     # content of test_sample.py
     def inc(x):
         return x + 1
 
+
     def test_answer():
         assert inc(3) == 5
 
 
 To execute it::
 
     $ pytest
     ============================= test session starts =============================
@@ -71,17 +78,17 @@ Features
   of test modules and functions;
 
 - `Modular fixtures <http://docs.pytest.org/en/latest/fixture.html>`_ for
   managing small or parametrized long-lived test resources;
 
 - Can run `unittest <http://docs.pytest.org/en/latest/unittest.html>`_ (or trial),
   `nose <http://docs.pytest.org/en/latest/nose.html>`_ test suites out of the box;
 
-- Python2.6+, Python3.3+, PyPy-2.3, Jython-2.5 (untested);
+- Python 2.7, Python 3.4+, PyPy 2.3, Jython 2.5 (untested);
 
 - Rich plugin architecture, with over 315+ `external plugins <http://plugincompat.herokuapp.com>`_ and thriving community;
 
 
 Documentation
 -------------
 
 For full documentation, including installation, tutorials and PDF documents, please see http://docs.pytest.org.
deleted file mode 100644
--- a/third_party/python/pytest/_pytest/__init__.py
+++ /dev/null
@@ -1,8 +0,0 @@
-__all__ = ['__version__']
-
-try:
-    from ._version import version as __version__
-except ImportError:
-    # broken installation, we don't even try
-    # unknown only works because we do poor mans version compare
-    __version__ = 'unknown'
deleted file mode 100644
--- a/third_party/python/pytest/_pytest/_argcomplete.py
+++ /dev/null
@@ -1,106 +0,0 @@
-
-"""allow bash-completion for argparse with argcomplete if installed
-needs argcomplete>=0.5.6 for python 3.2/3.3 (older versions fail
-to find the magic string, so _ARGCOMPLETE env. var is never set, and
-this does not need special code.
-
-argcomplete does not support python 2.5 (although the changes for that
-are minor).
-
-Function try_argcomplete(parser) should be called directly before
-the call to ArgumentParser.parse_args().
-
-The filescompleter is what you normally would use on the positional
-arguments specification, in order to get "dirname/" after "dirn<TAB>"
-instead of the default "dirname ":
-
-   optparser.add_argument(Config._file_or_dir, nargs='*'
-                               ).completer=filescompleter
-
-Other, application specific, completers should go in the file
-doing the add_argument calls as they need to be specified as .completer
-attributes as well. (If argcomplete is not installed, the function the
-attribute points to will not be used).
-
-SPEEDUP
-=======
-The generic argcomplete script for bash-completion
-(/etc/bash_completion.d/python-argcomplete.sh )
-uses a python program to determine startup script generated by pip.
-You can speed up completion somewhat by changing this script to include
-  # PYTHON_ARGCOMPLETE_OK
-so the the python-argcomplete-check-easy-install-script does not
-need to be called to find the entry point of the code and see if that is
-marked  with PYTHON_ARGCOMPLETE_OK
-
-INSTALL/DEBUGGING
-=================
-To include this support in another application that has setup.py generated
-scripts:
-- add the line:
-    # PYTHON_ARGCOMPLETE_OK
-  near the top of the main python entry point
-- include in the file calling parse_args():
-    from _argcomplete import try_argcomplete, filescompleter
-   , call try_argcomplete just before parse_args(), and optionally add
-   filescompleter to the positional arguments' add_argument()
-If things do not work right away:
-- switch on argcomplete debugging with (also helpful when doing custom
-  completers):
-    export _ARC_DEBUG=1
-- run:
-    python-argcomplete-check-easy-install-script $(which appname)
-    echo $?
-  will echo 0 if the magic line has been found, 1 if not
-- sometimes it helps to find early on errors using:
-    _ARGCOMPLETE=1 _ARC_DEBUG=1 appname
-  which should throw a KeyError: 'COMPLINE' (which is properly set by the
-  global argcomplete script).
-"""
-from __future__ import absolute_import, division, print_function
-import sys
-import os
-from glob import glob
-
-
-class FastFilesCompleter:
-    'Fast file completer class'
-
-    def __init__(self, directories=True):
-        self.directories = directories
-
-    def __call__(self, prefix, **kwargs):
-        """only called on non option completions"""
-        if os.path.sep in prefix[1:]:
-            prefix_dir = len(os.path.dirname(prefix) + os.path.sep)
-        else:
-            prefix_dir = 0
-        completion = []
-        globbed = []
-        if '*' not in prefix and '?' not in prefix:
-            # we are on unix, otherwise no bash
-            if not prefix or prefix[-1] == os.path.sep:
-                globbed.extend(glob(prefix + '.*'))
-            prefix += '*'
-        globbed.extend(glob(prefix))
-        for x in sorted(globbed):
-            if os.path.isdir(x):
-                x += '/'
-            # append stripping the prefix (like bash, not like compgen)
-            completion.append(x[prefix_dir:])
-        return completion
-
-
-if os.environ.get('_ARGCOMPLETE'):
-    try:
-        import argcomplete.completers
-    except ImportError:
-        sys.exit(-1)
-    filescompleter = FastFilesCompleter()
-
-    def try_argcomplete(parser):
-        argcomplete.autocomplete(parser, always_complete_options=False)
-else:
-    def try_argcomplete(parser):
-        pass
-    filescompleter = None
deleted file mode 100644
--- a/third_party/python/pytest/_pytest/_code/_py2traceback.py
+++ /dev/null
@@ -1,85 +0,0 @@
-# copied from python-2.7.3's traceback.py
-# CHANGES:
-# - some_str is replaced, trying to create unicode strings
-#
-from __future__ import absolute_import, division, print_function
-import types
-
-
-def format_exception_only(etype, value):
-    """Format the exception part of a traceback.
-
-    The arguments are the exception type and value such as given by
-    sys.last_type and sys.last_value. The return value is a list of
-    strings, each ending in a newline.
-
-    Normally, the list contains a single string; however, for
-    SyntaxError exceptions, it contains several lines that (when
-    printed) display detailed information about where the syntax
-    error occurred.
-
-    The message indicating which exception occurred is always the last
-    string in the list.
-
-    """
-
-    # An instance should not have a meaningful value parameter, but
-    # sometimes does, particularly for string exceptions, such as
-    # >>> raise string1, string2  # deprecated
-    #
-    # Clear these out first because issubtype(string1, SyntaxError)
-    # would throw another exception and mask the original problem.
-    if (isinstance(etype, BaseException) or
-        isinstance(etype, types.InstanceType) or
-            etype is None or type(etype) is str):
-        return [_format_final_exc_line(etype, value)]
-
-    stype = etype.__name__
-
-    if not issubclass(etype, SyntaxError):
-        return [_format_final_exc_line(stype, value)]
-
-    # It was a syntax error; show exactly where the problem was found.
-    lines = []
-    try:
-        msg, (filename, lineno, offset, badline) = value.args
-    except Exception:
-        pass
-    else:
-        filename = filename or "<string>"
-        lines.append('  File "%s", line %d\n' % (filename, lineno))
-        if badline is not None:
-            if isinstance(badline, bytes):  # python 2 only
-                badline = badline.decode('utf-8', 'replace')
-            lines.append(u'    %s\n' % badline.strip())
-            if offset is not None:
-                caretspace = badline.rstrip('\n')[:offset].lstrip()
-                # non-space whitespace (likes tabs) must be kept for alignment
-                caretspace = ((c.isspace() and c or ' ') for c in caretspace)
-                # only three spaces to account for offset1 == pos 0
-                lines.append('   %s^\n' % ''.join(caretspace))
-        value = msg
-
-    lines.append(_format_final_exc_line(stype, value))
-    return lines
-
-
-def _format_final_exc_line(etype, value):
-    """Return a list of a single line -- normal case for format_exception_only"""
-    valuestr = _some_str(value)
-    if value is None or not valuestr:
-        line = "%s\n" % etype
-    else:
-        line = "%s: %s\n" % (etype, valuestr)
-    return line
-
-
-def _some_str(value):
-    try:
-        return unicode(value)
-    except Exception:
-        try:
-            return str(value)
-        except Exception:
-            pass
-    return '<unprintable %s object>' % type(value).__name__
deleted file mode 100644
--- a/third_party/python/pytest/_pytest/_code/code.py
+++ /dev/null
@@ -1,908 +0,0 @@
-from __future__ import absolute_import, division, print_function
-import sys
-from inspect import CO_VARARGS, CO_VARKEYWORDS
-import re
-from weakref import ref
-from _pytest.compat import _PY2, _PY3, PY35, safe_str
-
-import py
-builtin_repr = repr
-
-reprlib = py.builtin._tryimport('repr', 'reprlib')
-
-if _PY3:
-    from traceback import format_exception_only
-else:
-    from ._py2traceback import format_exception_only
-
-
-class Code(object):
-    """ wrapper around Python code objects """
-
-    def __init__(self, rawcode):
-        if not hasattr(rawcode, "co_filename"):
-            rawcode = getrawcode(rawcode)
-        try:
-            self.filename = rawcode.co_filename
-            self.firstlineno = rawcode.co_firstlineno - 1
-            self.name = rawcode.co_name
-        except AttributeError:
-            raise TypeError("not a code object: %r" % (rawcode,))
-        self.raw = rawcode
-
-    def __eq__(self, other):
-        return self.raw == other.raw
-
-    __hash__ = None
-
-    def __ne__(self, other):
-        return not self == other
-
-    @property
-    def path(self):
-        """ return a path object pointing to source code (note that it
-        might not point to an actually existing file). """
-        try:
-            p = py.path.local(self.raw.co_filename)
-            # maybe don't try this checking
-            if not p.check():
-                raise OSError("py.path check failed.")
-        except OSError:
-            # XXX maybe try harder like the weird logic
-            # in the standard lib [linecache.updatecache] does?
-            p = self.raw.co_filename
-
-        return p
-
-    @property
-    def fullsource(self):
-        """ return a _pytest._code.Source object for the full source file of the code
-        """
-        from _pytest._code import source
-        full, _ = source.findsource(self.raw)
-        return full
-
-    def source(self):
-        """ return a _pytest._code.Source object for the code object's source only
-        """
-        # return source only for that part of code
-        import _pytest._code
-        return _pytest._code.Source(self.raw)
-
-    def getargs(self, var=False):
-        """ return a tuple with the argument names for the code object
-
-            if 'var' is set True also return the names of the variable and
-            keyword arguments when present
-        """
-        # handfull shortcut for getting args
-        raw = self.raw
-        argcount = raw.co_argcount
-        if var:
-            argcount += raw.co_flags & CO_VARARGS
-            argcount += raw.co_flags & CO_VARKEYWORDS
-        return raw.co_varnames[:argcount]
-
-
-class Frame(object):
-    """Wrapper around a Python frame holding f_locals and f_globals
-    in which expressions can be evaluated."""
-
-    def __init__(self, frame):
-        self.lineno = frame.f_lineno - 1
-        self.f_globals = frame.f_globals
-        self.f_locals = frame.f_locals
-        self.raw = frame
-        self.code = Code(frame.f_code)
-
-    @property
-    def statement(self):
-        """ statement this frame is at """
-        import _pytest._code
-        if self.code.fullsource is None:
-            return _pytest._code.Source("")
-        return self.code.fullsource.getstatement(self.lineno)
-
-    def eval(self, code, **vars):
-        """ evaluate 'code' in the frame
-
-            'vars' are optional additional local variables
-
-            returns the result of the evaluation
-        """
-        f_locals = self.f_locals.copy()
-        f_locals.update(vars)
-        return eval(code, self.f_globals, f_locals)
-
-    def exec_(self, code, **vars):
-        """ exec 'code' in the frame
-
-            'vars' are optiona; additional local variables
-        """
-        f_locals = self.f_locals.copy()
-        f_locals.update(vars)
-        py.builtin.exec_(code, self.f_globals, f_locals)
-
-    def repr(self, object):
-        """ return a 'safe' (non-recursive, one-line) string repr for 'object'
-        """
-        return py.io.saferepr(object)
-
-    def is_true(self, object):
-        return object
-
-    def getargs(self, var=False):
-        """ return a list of tuples (name, value) for all arguments
-
-            if 'var' is set True also include the variable and keyword
-            arguments when present
-        """
-        retval = []
-        for arg in self.code.getargs(var):
-            try:
-                retval.append((arg, self.f_locals[arg]))
-            except KeyError:
-                pass     # this can occur when using Psyco
-        return retval
-
-
-class TracebackEntry(object):
-    """ a single entry in a traceback """
-
-    _repr_style = None
-    exprinfo = None
-
-    def __init__(self, rawentry, excinfo=None):
-        self._excinfo = excinfo
-        self._rawentry = rawentry
-        self.lineno = rawentry.tb_lineno - 1
-
-    def set_repr_style(self, mode):
-        assert mode in ("short", "long")
-        self._repr_style = mode
-
-    @property
-    def frame(self):
-        import _pytest._code
-        return _pytest._code.Frame(self._rawentry.tb_frame)
-
-    @property
-    def relline(self):
-        return self.lineno - self.frame.code.firstlineno
-
-    def __repr__(self):
-        return "<TracebackEntry %s:%d>" % (self.frame.code.path, self.lineno + 1)
-
-    @property
-    def statement(self):
-        """ _pytest._code.Source object for the current statement """
-        source = self.frame.code.fullsource
-        return source.getstatement(self.lineno)
-
-    @property
-    def path(self):
-        """ path to the source code """
-        return self.frame.code.path
-
-    def getlocals(self):
-        return self.frame.f_locals
-    locals = property(getlocals, None, None, "locals of underlaying frame")
-
-    def getfirstlinesource(self):
-        # on Jython this firstlineno can be -1 apparently
-        return max(self.frame.code.firstlineno, 0)
-
-    def getsource(self, astcache=None):
-        """ return failing source code. """
-        # we use the passed in astcache to not reparse asttrees
-        # within exception info printing
-        from _pytest._code.source import getstatementrange_ast
-        source = self.frame.code.fullsource
-        if source is None:
-            return None
-        key = astnode = None
-        if astcache is not None:
-            key = self.frame.code.path
-            if key is not None:
-                astnode = astcache.get(key, None)
-        start = self.getfirstlinesource()
-        try:
-            astnode, _, end = getstatementrange_ast(self.lineno, source,
-                                                    astnode=astnode)
-        except SyntaxError:
-            end = self.lineno + 1
-        else:
-            if key is not None:
-                astcache[key] = astnode
-        return source[start:end]
-
-    source = property(getsource)
-
-    def ishidden(self):
-        """ return True if the current frame has a var __tracebackhide__
-            resolving to True
-
-            If __tracebackhide__ is a callable, it gets called with the
-            ExceptionInfo instance and can decide whether to hide the traceback.
-
-            mostly for internal use
-        """
-        try:
-            tbh = self.frame.f_locals['__tracebackhide__']
-        except KeyError:
-            try:
-                tbh = self.frame.f_globals['__tracebackhide__']
-            except KeyError:
-                return False
-
-        if py.builtin.callable(tbh):
-            return tbh(None if self._excinfo is None else self._excinfo())
-        else:
-            return tbh
-
-    def __str__(self):
-        try:
-            fn = str(self.path)
-        except py.error.Error:
-            fn = '???'
-        name = self.frame.code.name
-        try:
-            line = str(self.statement).lstrip()
-        except KeyboardInterrupt:
-            raise
-        except:  # noqa
-            line = "???"
-        return "  File %r:%d in %s\n  %s\n" % (fn, self.lineno + 1, name, line)
-
-    def name(self):
-        return self.frame.code.raw.co_name
-    name = property(name, None, None, "co_name of underlaying code")
-
-
-class Traceback(list):
-    """ Traceback objects encapsulate and offer higher level
-        access to Traceback entries.
-    """
-    Entry = TracebackEntry
-
-    def __init__(self, tb, excinfo=None):
-        """ initialize from given python traceback object and ExceptionInfo """
-        self._excinfo = excinfo
-        if hasattr(tb, 'tb_next'):
-            def f(cur):
-                while cur is not None:
-                    yield self.Entry(cur, excinfo=excinfo)
-                    cur = cur.tb_next
-            list.__init__(self, f(tb))
-        else:
-            list.__init__(self, tb)
-
-    def cut(self, path=None, lineno=None, firstlineno=None, excludepath=None):
-        """ return a Traceback instance wrapping part of this Traceback
-
-            by provding any combination of path, lineno and firstlineno, the
-            first frame to start the to-be-returned traceback is determined
-
-            this allows cutting the first part of a Traceback instance e.g.
-            for formatting reasons (removing some uninteresting bits that deal
-            with handling of the exception/traceback)
-        """
-        for x in self:
-            code = x.frame.code
-            codepath = code.path
-            if ((path is None or codepath == path) and
-                (excludepath is None or not hasattr(codepath, 'relto') or
-                 not codepath.relto(excludepath)) and
-                (lineno is None or x.lineno == lineno) and
-                    (firstlineno is None or x.frame.code.firstlineno == firstlineno)):
-                return Traceback(x._rawentry, self._excinfo)
-        return self
-
-    def __getitem__(self, key):
-        val = super(Traceback, self).__getitem__(key)
-        if isinstance(key, type(slice(0))):
-            val = self.__class__(val)
-        return val
-
-    def filter(self, fn=lambda x: not x.ishidden()):
-        """ return a Traceback instance with certain items removed
-
-            fn is a function that gets a single argument, a TracebackEntry
-            instance, and should return True when the item should be added
-            to the Traceback, False when not
-
-            by default this removes all the TracebackEntries which are hidden
-            (see ishidden() above)
-        """
-        return Traceback(filter(fn, self), self._excinfo)
-
-    def getcrashentry(self):
-        """ return last non-hidden traceback entry that lead
-        to the exception of a traceback.
-        """
-        for i in range(-1, -len(self) - 1, -1):
-            entry = self[i]
-            if not entry.ishidden():
-                return entry
-        return self[-1]
-
-    def recursionindex(self):
-        """ return the index of the frame/TracebackEntry where recursion
-            originates if appropriate, None if no recursion occurred
-        """
-        cache = {}
-        for i, entry in enumerate(self):
-            # id for the code.raw is needed to work around
-            # the strange metaprogramming in the decorator lib from pypi
-            # which generates code objects that have hash/value equality
-            # XXX needs a test
-            key = entry.frame.code.path, id(entry.frame.code.raw), entry.lineno
-            # print "checking for recursion at", key
-            values = cache.setdefault(key, [])
-            if values:
-                f = entry.frame
-                loc = f.f_locals
-                for otherloc in values:
-                    if f.is_true(f.eval(co_equal,
-                                        __recursioncache_locals_1=loc,
-                                        __recursioncache_locals_2=otherloc)):
-                        return i
-            values.append(entry.frame.f_locals)
-        return None
-
-
-co_equal = compile('__recursioncache_locals_1 == __recursioncache_locals_2',
-                   '?', 'eval')
-
-
-class ExceptionInfo(object):
-    """ wraps sys.exc_info() objects and offers
-        help for navigating the traceback.
-    """
-    _striptext = ''
-    _assert_start_repr = "AssertionError(u\'assert " if _PY2 else "AssertionError(\'assert "
-
-    def __init__(self, tup=None, exprinfo=None):
-        import _pytest._code
-        if tup is None:
-            tup = sys.exc_info()
-            if exprinfo is None and isinstance(tup[1], AssertionError):
-                exprinfo = getattr(tup[1], 'msg', None)
-                if exprinfo is None:
-                    exprinfo = py.io.saferepr(tup[1])
-                if exprinfo and exprinfo.startswith(self._assert_start_repr):
-                    self._striptext = 'AssertionError: '
-        self._excinfo = tup
-        #: the exception class
-        self.type = tup[0]
-        #: the exception instance
-        self.value = tup[1]
-        #: the exception raw traceback
-        self.tb = tup[2]
-        #: the exception type name
-        self.typename = self.type.__name__
-        #: the exception traceback (_pytest._code.Traceback instance)
-        self.traceback = _pytest._code.Traceback(self.tb, excinfo=ref(self))
-
-    def __repr__(self):
-        return "<ExceptionInfo %s tblen=%d>" % (self.typename, len(self.traceback))
-
-    def exconly(self, tryshort=False):
-        """ return the exception as a string
-
-            when 'tryshort' resolves to True, and the exception is a
-            _pytest._code._AssertionError, only the actual exception part of
-            the exception representation is returned (so 'AssertionError: ' is
-            removed from the beginning)
-        """
-        lines = format_exception_only(self.type, self.value)
-        text = ''.join(lines)
-        text = text.rstrip()
-        if tryshort:
-            if text.startswith(self._striptext):
-                text = text[len(self._striptext):]
-        return text
-
-    def errisinstance(self, exc):
-        """ return True if the exception is an instance of exc """
-        return isinstance(self.value, exc)
-
-    def _getreprcrash(self):
-        exconly = self.exconly(tryshort=True)
-        entry = self.traceback.getcrashentry()
-        path, lineno = entry.frame.code.raw.co_filename, entry.lineno
-        return ReprFileLocation(path, lineno + 1, exconly)
-
-    def getrepr(self, showlocals=False, style="long",
-                abspath=False, tbfilter=True, funcargs=False):
-        """ return str()able representation of this exception info.
-            showlocals: show locals per traceback entry
-            style: long|short|no|native traceback style
-            tbfilter: hide entries (where __tracebackhide__ is true)
-
-            in case of style==native, tbfilter and showlocals is ignored.
-        """
-        if style == 'native':
-            return ReprExceptionInfo(ReprTracebackNative(
-                py.std.traceback.format_exception(
-                    self.type,
-                    self.value,
-                    self.traceback[0]._rawentry,
-                )), self._getreprcrash())
-
-        fmt = FormattedExcinfo(showlocals=showlocals, style=style,
-                               abspath=abspath, tbfilter=tbfilter, funcargs=funcargs)
-        return fmt.repr_excinfo(self)
-
-    def __str__(self):
-        entry = self.traceback[-1]
-        loc = ReprFileLocation(entry.path, entry.lineno + 1, self.exconly())
-        return str(loc)
-
-    def __unicode__(self):
-        entry = self.traceback[-1]
-        loc = ReprFileLocation(entry.path, entry.lineno + 1, self.exconly())
-        return unicode(loc)
-
-    def match(self, regexp):
-        """
-        Match the regular expression 'regexp' on the string representation of
-        the exception. If it matches then True is returned (so that it is
-        possible to write 'assert excinfo.match()'). If it doesn't match an
-        AssertionError is raised.
-        """
-        __tracebackhide__ = True
-        if not re.search(regexp, str(self.value)):
-            assert 0, "Pattern '{0!s}' not found in '{1!s}'".format(
-                regexp, self.value)
-        return True
-
-
-class FormattedExcinfo(object):
-    """ presenting information about failing Functions and Generators. """
-    # for traceback entries
-    flow_marker = ">"
-    fail_marker = "E"
-
-    def __init__(self, showlocals=False, style="long", abspath=True, tbfilter=True, funcargs=False):
-        self.showlocals = showlocals
-        self.style = style
-        self.tbfilter = tbfilter
-        self.funcargs = funcargs
-        self.abspath = abspath
-        self.astcache = {}
-
-    def _getindent(self, source):
-        # figure out indent for given source
-        try:
-            s = str(source.getstatement(len(source) - 1))
-        except KeyboardInterrupt:
-            raise
-        except:  # noqa
-            try:
-                s = str(source[-1])
-            except KeyboardInterrupt:
-                raise
-            except:  # noqa
-                return 0
-        return 4 + (len(s) - len(s.lstrip()))
-
-    def _getentrysource(self, entry):
-        source = entry.getsource(self.astcache)
-        if source is not None:
-            source = source.deindent()
-        return source
-
-    def _saferepr(self, obj):
-        return py.io.saferepr(obj)
-
-    def repr_args(self, entry):
-        if self.funcargs:
-            args = []
-            for argname, argvalue in entry.frame.getargs(var=True):
-                args.append((argname, self._saferepr(argvalue)))
-            return ReprFuncArgs(args)
-
-    def get_source(self, source, line_index=-1, excinfo=None, short=False):
-        """ return formatted and marked up source lines. """
-        import _pytest._code
-        lines = []
-        if source is None or line_index >= len(source.lines):
-            source = _pytest._code.Source("???")
-            line_index = 0
-        if line_index < 0:
-            line_index += len(source)
-        space_prefix = "    "
-        if short:
-            lines.append(space_prefix + source.lines[line_index].strip())
-        else:
-            for line in source.lines[:line_index]:
-                lines.append(space_prefix + line)
-            lines.append(self.flow_marker + "   " + source.lines[line_index])
-            for line in source.lines[line_index + 1:]:
-                lines.append(space_prefix + line)
-        if excinfo is not None:
-            indent = 4 if short else self._getindent(source)
-            lines.extend(self.get_exconly(excinfo, indent=indent, markall=True))
-        return lines
-
-    def get_exconly(self, excinfo, indent=4, markall=False):
-        lines = []
-        indent = " " * indent
-        # get the real exception information out
-        exlines = excinfo.exconly(tryshort=True).split('\n')
-        failindent = self.fail_marker + indent[1:]
-        for line in exlines:
-            lines.append(failindent + line)
-            if not markall:
-                failindent = indent
-        return lines
-
-    def repr_locals(self, locals):
-        if self.showlocals:
-            lines = []
-            keys = [loc for loc in locals if loc[0] != "@"]
-            keys.sort()
-            for name in keys:
-                value = locals[name]
-                if name == '__builtins__':
-                    lines.append("__builtins__ = <builtins>")
-                else:
-                    # This formatting could all be handled by the
-                    # _repr() function, which is only reprlib.Repr in
-                    # disguise, so is very configurable.
-                    str_repr = self._saferepr(value)
-                    # if len(str_repr) < 70 or not isinstance(value,
-                    #                            (list, tuple, dict)):
-                    lines.append("%-10s = %s" % (name, str_repr))
-                    # else:
-                    #    self._line("%-10s =\\" % (name,))
-                    #    # XXX
-                    #    py.std.pprint.pprint(value, stream=self.excinfowriter)
-            return ReprLocals(lines)
-
-    def repr_traceback_entry(self, entry, excinfo=None):
-        import _pytest._code
-        source = self._getentrysource(entry)
-        if source is None:
-            source = _pytest._code.Source("???")
-            line_index = 0
-        else:
-            # entry.getfirstlinesource() can be -1, should be 0 on jython
-            line_index = entry.lineno - max(entry.getfirstlinesource(), 0)
-
-        lines = []
-        style = entry._repr_style
-        if style is None:
-            style = self.style
-        if style in ("short", "long"):
-            short = style == "short"
-            reprargs = self.repr_args(entry) if not short else None
-            s = self.get_source(source, line_index, excinfo, short=short)
-            lines.extend(s)
-            if short:
-                message = "in %s" % (entry.name)
-            else:
-                message = excinfo and excinfo.typename or ""
-            path = self._makepath(entry.path)
-            filelocrepr = ReprFileLocation(path, entry.lineno + 1, message)
-            localsrepr = None
-            if not short:
-                localsrepr = self.repr_locals(entry.locals)
-            return ReprEntry(lines, reprargs, localsrepr, filelocrepr, style)
-        if excinfo:
-            lines.extend(self.get_exconly(excinfo, indent=4))
-        return ReprEntry(lines, None, None, None, style)
-
-    def _makepath(self, path):
-        if not self.abspath:
-            try:
-                np = py.path.local().bestrelpath(path)
-            except OSError:
-                return path
-            if len(np) < len(str(path)):
-                path = np
-        return path
-
-    def repr_traceback(self, excinfo):
-        traceback = excinfo.traceback
-        if self.tbfilter:
-            traceback = traceback.filter()
-
-        if is_recursion_error(excinfo):
-            traceback, extraline = self._truncate_recursive_traceback(traceback)
-        else:
-            extraline = None
-
-        last = traceback[-1]
-        entries = []
-        for index, entry in enumerate(traceback):
-            einfo = (last == entry) and excinfo or None
-            reprentry = self.repr_traceback_entry(entry, einfo)
-            entries.append(reprentry)
-        return ReprTraceback(entries, extraline, style=self.style)
-
-    def _truncate_recursive_traceback(self, traceback):
-        """
-        Truncate the given recursive traceback trying to find the starting point
-        of the recursion.
-
-        The detection is done by going through each traceback entry and finding the
-        point in which the locals of the frame are equal to the locals of a previous frame (see ``recursionindex()``.
-
-        Handle the situation where the recursion process might raise an exception (for example
-        comparing numpy arrays using equality raises a TypeError), in which case we do our best to
-        warn the user of the error and show a limited traceback.
-        """
-        try:
-            recursionindex = traceback.recursionindex()
-        except Exception as e:
-            max_frames = 10
-            extraline = (
-                '!!! Recursion error detected, but an error occurred locating the origin of recursion.\n'
-                '  The following exception happened when comparing locals in the stack frame:\n'
-                '    {exc_type}: {exc_msg}\n'
-                '  Displaying first and last {max_frames} stack frames out of {total}.'
-            ).format(exc_type=type(e).__name__, exc_msg=safe_str(e), max_frames=max_frames, total=len(traceback))
-            traceback = traceback[:max_frames] + traceback[-max_frames:]
-        else:
-            if recursionindex is not None:
-                extraline = "!!! Recursion detected (same locals & position)"
-                traceback = traceback[:recursionindex + 1]
-            else:
-                extraline = None
-
-        return traceback, extraline
-
-    def repr_excinfo(self, excinfo):
-        if _PY2:
-            reprtraceback = self.repr_traceback(excinfo)
-            reprcrash = excinfo._getreprcrash()
-
-            return ReprExceptionInfo(reprtraceback, reprcrash)
-        else:
-            repr_chain = []
-            e = excinfo.value
-            descr = None
-            while e is not None:
-                if excinfo:
-                    reprtraceback = self.repr_traceback(excinfo)
-                    reprcrash = excinfo._getreprcrash()
-                else:
-                    # fallback to native repr if the exception doesn't have a traceback:
-                    # ExceptionInfo objects require a full traceback to work
-                    reprtraceback = ReprTracebackNative(py.std.traceback.format_exception(type(e), e, None))
-                    reprcrash = None
-
-                repr_chain += [(reprtraceback, reprcrash, descr)]
-                if e.__cause__ is not None:
-                    e = e.__cause__
-                    excinfo = ExceptionInfo((type(e), e, e.__traceback__)) if e.__traceback__ else None
-                    descr = 'The above exception was the direct cause of the following exception:'
-                elif (e.__context__ is not None and not e.__suppress_context__):
-                    e = e.__context__
-                    excinfo = ExceptionInfo((type(e), e, e.__traceback__)) if e.__traceback__ else None
-                    descr = 'During handling of the above exception, another exception occurred:'
-                else:
-                    e = None
-            repr_chain.reverse()
-            return ExceptionChainRepr(repr_chain)
-
-
-class TerminalRepr(object):
-    def __str__(self):
-        s = self.__unicode__()
-        if _PY2:
-            s = s.encode('utf-8')
-        return s
-
-    def __unicode__(self):
-        # FYI this is called from pytest-xdist's serialization of exception
-        # information.
-        io = py.io.TextIO()
-        tw = py.io.TerminalWriter(file=io)
-        self.toterminal(tw)
-        return io.getvalue().strip()
-
-    def __repr__(self):
-        return "<%s instance at %0x>" % (self.__class__, id(self))
-
-
-class ExceptionRepr(TerminalRepr):
-    def __init__(self):
-        self.sections = []
-
-    def addsection(self, name, content, sep="-"):
-        self.sections.append((name, content, sep))
-
-    def toterminal(self, tw):
-        for name, content, sep in self.sections:
-            tw.sep(sep, name)
-            tw.line(content)
-
-
-class ExceptionChainRepr(ExceptionRepr):
-    def __init__(self, chain):
-        super(ExceptionChainRepr, self).__init__()
-        self.chain = chain
-        # reprcrash and reprtraceback of the outermost (the newest) exception
-        # in the chain
-        self.reprtraceback = chain[-1][0]
-        self.reprcrash = chain[-1][1]
-
-    def toterminal(self, tw):
-        for element in self.chain:
-            element[0].toterminal(tw)
-            if element[2] is not None:
-                tw.line("")
-                tw.line(element[2], yellow=True)
-        super(ExceptionChainRepr, self).toterminal(tw)
-
-
-class ReprExceptionInfo(ExceptionRepr):
-    def __init__(self, reprtraceback, reprcrash):
-        super(ReprExceptionInfo, self).__init__()
-        self.reprtraceback = reprtraceback
-        self.reprcrash = reprcrash
-
-    def toterminal(self, tw):
-        self.reprtraceback.toterminal(tw)
-        super(ReprExceptionInfo, self).toterminal(tw)
-
-
-class ReprTraceback(TerminalRepr):
-    entrysep = "_ "
-
-    def __init__(self, reprentries, extraline, style):
-        self.reprentries = reprentries
-        self.extraline = extraline
-        self.style = style
-
-    def toterminal(self, tw):
-        # the entries might have different styles
-        for i, entry in enumerate(self.reprentries):
-            if entry.style == "long":
-                tw.line("")
-            entry.toterminal(tw)
-            if i < len(self.reprentries) - 1:
-                next_entry = self.reprentries[i + 1]
-                if entry.style == "long" or \
-                   entry.style == "short" and next_entry.style == "long":
-                    tw.sep(self.entrysep)
-
-        if self.extraline:
-            tw.line(self.extraline)
-
-
-class ReprTracebackNative(ReprTraceback):
-    def __init__(self, tblines):
-        self.style = "native"
-        self.reprentries = [ReprEntryNative(tblines)]
-        self.extraline = None
-
-
-class ReprEntryNative(TerminalRepr):
-    style = "native"
-
-    def __init__(self, tblines):
-        self.lines = tblines
-
-    def toterminal(self, tw):
-        tw.write("".join(self.lines))
-
-
-class ReprEntry(TerminalRepr):
-    localssep = "_ "
-
-    def __init__(self, lines, reprfuncargs, reprlocals, filelocrepr, style):
-        self.lines = lines
-        self.reprfuncargs = reprfuncargs
-        self.reprlocals = reprlocals
-        self.reprfileloc = filelocrepr
-        self.style = style
-
-    def toterminal(self, tw):
-        if self.style == "short":
-            self.reprfileloc.toterminal(tw)
-            for line in self.lines:
-                red = line.startswith("E   ")
-                tw.line(line, bold=True, red=red)
-            # tw.line("")
-            return
-        if self.reprfuncargs:
-            self.reprfuncargs.toterminal(tw)
-        for line in self.lines:
-            red = line.startswith("E   ")
-            tw.line(line, bold=True, red=red)
-        if self.reprlocals:
-            # tw.sep(self.localssep, "Locals")
-            tw.line("")
-            self.reprlocals.toterminal(tw)
-        if self.reprfileloc:
-            if self.lines:
-                tw.line("")
-            self.reprfileloc.toterminal(tw)
-
-    def __str__(self):
-        return "%s\n%s\n%s" % ("\n".join(self.lines),
-                               self.reprlocals,
-                               self.reprfileloc)
-
-
-class ReprFileLocation(TerminalRepr):
-    def __init__(self, path, lineno, message):
-        self.path = str(path)
-        self.lineno = lineno
-        self.message = message
-
-    def toterminal(self, tw):
-        # filename and lineno output for each entry,
-        # using an output format that most editors unterstand
-        msg = self.message
-        i = msg.find("\n")
-        if i != -1:
-            msg = msg[:i]
-        tw.write(self.path, bold=True, red=True)
-        tw.line(":%s: %s" % (self.lineno, msg))
-
-
-class ReprLocals(TerminalRepr):
-    def __init__(self, lines):
-        self.lines = lines
-
-    def toterminal(self, tw):
-        for line in self.lines:
-            tw.line(line)
-
-
-class ReprFuncArgs(TerminalRepr):
-    def __init__(self, args):
-        self.args = args
-
-    def toterminal(self, tw):
-        if self.args:
-            linesofar = ""
-            for name, value in self.args:
-                ns = "%s = %s" % (safe_str(name), safe_str(value))
-                if len(ns) + len(linesofar) + 2 > tw.fullwidth:
-                    if linesofar:
-                        tw.line(linesofar)
-                    linesofar = ns
-                else:
-                    if linesofar:
-                        linesofar += ", " + ns
-                    else:
-                        linesofar = ns
-            if linesofar:
-                tw.line(linesofar)
-            tw.line("")
-
-
-def getrawcode(obj, trycall=True):
-    """ return code object for given function. """
-    try:
-        return obj.__code__
-    except AttributeError:
-        obj = getattr(obj, 'im_func', obj)
-        obj = getattr(obj, 'func_code', obj)
-        obj = getattr(obj, 'f_code', obj)
-        obj = getattr(obj, '__code__', obj)
-        if trycall and not hasattr(obj, 'co_firstlineno'):
-            if hasattr(obj, '__call__') and not py.std.inspect.isclass(obj):
-                x = getrawcode(obj.__call__, trycall=False)
-                if hasattr(x, 'co_firstlineno'):
-                    return x
-        return obj
-
-
-if PY35:  # RecursionError introduced in 3.5
-    def is_recursion_error(excinfo):
-        return excinfo.errisinstance(RecursionError)  # noqa
-else:
-    def is_recursion_error(excinfo):
-        if not excinfo.errisinstance(RuntimeError):
-            return False
-        try:
-            return "maximum recursion depth exceeded" in str(excinfo.value)
-        except UnicodeError:
-            return False
deleted file mode 100644
--- a/third_party/python/pytest/_pytest/_code/source.py
+++ /dev/null
@@ -1,416 +0,0 @@
-from __future__ import absolute_import, division, generators, print_function
-
-from bisect import bisect_right
-import sys
-import inspect
-import tokenize
-import py
-cpy_compile = compile
-
-try:
-    import _ast
-    from _ast import PyCF_ONLY_AST as _AST_FLAG
-except ImportError:
-    _AST_FLAG = 0
-    _ast = None
-
-
-class Source(object):
-    """ a immutable object holding a source code fragment,
-        possibly deindenting it.
-    """
-    _compilecounter = 0
-
-    def __init__(self, *parts, **kwargs):
-        self.lines = lines = []
-        de = kwargs.get('deindent', True)
-        rstrip = kwargs.get('rstrip', True)
-        for part in parts:
-            if not part:
-                partlines = []
-            if isinstance(part, Source):
-                partlines = part.lines
-            elif isinstance(part, (tuple, list)):
-                partlines = [x.rstrip("\n") for x in part]
-            elif isinstance(part, py.builtin._basestring):
-                partlines = part.split('\n')
-                if rstrip:
-                    while partlines:
-                        if partlines[-1].strip():
-                            break
-                        partlines.pop()
-            else:
-                partlines = getsource(part, deindent=de).lines
-            if de:
-                partlines = deindent(partlines)
-            lines.extend(partlines)
-
-    def __eq__(self, other):
-        try:
-            return self.lines == other.lines
-        except AttributeError:
-            if isinstance(other, str):
-                return str(self) == other
-            return False
-
-    __hash__ = None
-
-    def __getitem__(self, key):
-        if isinstance(key, int):
-            return self.lines[key]
-        else:
-            if key.step not in (None, 1):
-                raise IndexError("cannot slice a Source with a step")
-            newsource = Source()
-            newsource.lines = self.lines[key.start:key.stop]
-            return newsource
-
-    def __len__(self):
-        return len(self.lines)
-
-    def strip(self):
-        """ return new source object with trailing
-            and leading blank lines removed.
-        """
-        start, end = 0, len(self)
-        while start < end and not self.lines[start].strip():
-            start += 1
-        while end > start and not self.lines[end - 1].strip():
-            end -= 1
-        source = Source()
-        source.lines[:] = self.lines[start:end]
-        return source
-
-    def putaround(self, before='', after='', indent=' ' * 4):
-        """ return a copy of the source object with
-            'before' and 'after' wrapped around it.
-        """
-        before = Source(before)
-        after = Source(after)
-        newsource = Source()
-        lines = [(indent + line) for line in self.lines]
-        newsource.lines = before.lines + lines + after.lines
-        return newsource
-
-    def indent(self, indent=' ' * 4):
-        """ return a copy of the source object with
-            all lines indented by the given indent-string.
-        """
-        newsource = Source()
-        newsource.lines = [(indent + line) for line in self.lines]
-        return newsource
-
-    def getstatement(self, lineno, assertion=False):
-        """ return Source statement which contains the
-            given linenumber (counted from 0).
-        """
-        start, end = self.getstatementrange(lineno, assertion)
-        return self[start:end]
-
-    def getstatementrange(self, lineno, assertion=False):
-        """ return (start, end) tuple which spans the minimal
-            statement region which containing the given lineno.
-        """
-        if not (0 <= lineno < len(self)):
-            raise IndexError("lineno out of range")
-        ast, start, end = getstatementrange_ast(lineno, self)
-        return start, end
-
-    def deindent(self, offset=None):
-        """ return a new source object deindented by offset.
-            If offset is None then guess an indentation offset from
-            the first non-blank line.  Subsequent lines which have a
-            lower indentation offset will be copied verbatim as
-            they are assumed to be part of multilines.
-        """
-        # XXX maybe use the tokenizer to properly handle multiline
-        #     strings etc.pp?
-        newsource = Source()
-        newsource.lines[:] = deindent(self.lines, offset)
-        return newsource
-
-    def isparseable(self, deindent=True):
-        """ return True if source is parseable, heuristically
-            deindenting it by default.
-        """
-        try:
-            import parser
-        except ImportError:
-            def syntax_checker(x):
-                return compile(x, 'asd', 'exec')
-        else:
-            syntax_checker = parser.suite
-
-        if deindent:
-            source = str(self.deindent())
-        else:
-            source = str(self)
-        try:
-            # compile(source+'\n', "x", "exec")
-            syntax_checker(source + '\n')
-        except KeyboardInterrupt:
-            raise
-        except Exception:
-            return False
-        else:
-            return True
-
-    def __str__(self):
-        return "\n".join(self.lines)
-
-    def compile(self, filename=None, mode='exec',
-                flag=generators.compiler_flag,
-                dont_inherit=0, _genframe=None):
-        """ return compiled code object. if filename is None
-            invent an artificial filename which displays
-            the source/line position of the caller frame.
-        """
-        if not filename or py.path.local(filename).check(file=0):
-            if _genframe is None:
-                _genframe = sys._getframe(1)  # the caller
-            fn, lineno = _genframe.f_code.co_filename, _genframe.f_lineno
-            base = "<%d-codegen " % self._compilecounter
-            self.__class__._compilecounter += 1
-            if not filename:
-                filename = base + '%s:%d>' % (fn, lineno)
-            else:
-                filename = base + '%r %s:%d>' % (filename, fn, lineno)
-        source = "\n".join(self.lines) + '\n'
-        try:
-            co = cpy_compile(source, filename, mode, flag)
-        except SyntaxError:
-            ex = sys.exc_info()[1]
-            # re-represent syntax errors from parsing python strings
-            msglines = self.lines[:ex.lineno]
-            if ex.offset:
-                msglines.append(" " * ex.offset + '^')
-            msglines.append("(code was compiled probably from here: %s)" % filename)
-            newex = SyntaxError('\n'.join(msglines))
-            newex.offset = ex.offset
-            newex.lineno = ex.lineno
-            newex.text = ex.text
-            raise newex
-        else:
-            if flag & _AST_FLAG:
-                return co
-            lines = [(x + "\n") for x in self.lines]
-            py.std.linecache.cache[filename] = (1, None, lines, filename)
-            return co
-
-#
-# public API shortcut functions
-#
-
-
-def compile_(source, filename=None, mode='exec', flags=generators.compiler_flag, dont_inherit=0):
-    """ compile the given source to a raw code object,
-        and maintain an internal cache which allows later
-        retrieval of the source code for the code object
-        and any recursively created code objects.
-    """
-    if _ast is not None and isinstance(source, _ast.AST):
-        # XXX should Source support having AST?
-        return cpy_compile(source, filename, mode, flags, dont_inherit)
-    _genframe = sys._getframe(1)  # the caller
-    s = Source(source)
-    co = s.compile(filename, mode, flags, _genframe=_genframe)
-    return co
-
-
-def getfslineno(obj):
-    """ Return source location (path, lineno) for the given object.
-    If the source cannot be determined return ("", -1)
-    """
-    import _pytest._code
-    try:
-        code = _pytest._code.Code(obj)
-    except TypeError:
-        try:
-            fn = (py.std.inspect.getsourcefile(obj) or
-                  py.std.inspect.getfile(obj))
-        except TypeError:
-            return "", -1
-
-        fspath = fn and py.path.local(fn) or None
-        lineno = -1
-        if fspath:
-            try:
-                _, lineno = findsource(obj)
-            except IOError:
-                pass
-    else:
-        fspath = code.path
-        lineno = code.firstlineno
-    assert isinstance(lineno, int)
-    return fspath, lineno
-
-#
-# helper functions
-#
-
-
-def findsource(obj):
-    try:
-        sourcelines, lineno = py.std.inspect.findsource(obj)
-    except py.builtin._sysex:
-        raise
-    except:  # noqa
-        return None, -1
-    source = Source()
-    source.lines = [line.rstrip() for line in sourcelines]
-    return source, lineno
-
-
-def getsource(obj, **kwargs):
-    import _pytest._code
-    obj = _pytest._code.getrawcode(obj)
-    try:
-        strsrc = inspect.getsource(obj)
-    except IndentationError:
-        strsrc = "\"Buggy python version consider upgrading, cannot get source\""
-    assert isinstance(strsrc, str)
-    return Source(strsrc, **kwargs)
-
-
-def deindent(lines, offset=None):
-    if offset is None:
-        for line in lines:
-            line = line.expandtabs()
-            s = line.lstrip()
-            if s:
-                offset = len(line) - len(s)
-                break
-        else:
-            offset = 0
-    if offset == 0:
-        return list(lines)
-    newlines = []
-
-    def readline_generator(lines):
-        for line in lines:
-            yield line + '\n'
-        while True:
-            yield ''
-
-    it = readline_generator(lines)
-
-    try:
-        for _, _, (sline, _), (eline, _), _ in tokenize.generate_tokens(lambda: next(it)):
-            if sline > len(lines):
-                break  # End of input reached
-            if sline > len(newlines):
-                line = lines[sline - 1].expandtabs()
-                if line.lstrip() and line[:offset].isspace():
-                    line = line[offset:]  # Deindent
-                newlines.append(line)
-
-            for i in range(sline, eline):
-                # Don't deindent continuing lines of
-                # multiline tokens (i.e. multiline strings)
-                newlines.append(lines[i])
-    except (IndentationError, tokenize.TokenError):
-        pass
-    # Add any lines we didn't see. E.g. if an exception was raised.
-    newlines.extend(lines[len(newlines):])
-    return newlines
-
-
-def get_statement_startend2(lineno, node):
-    import ast
-    # flatten all statements and except handlers into one lineno-list
-    # AST's line numbers start indexing at 1
-    values = []
-    for x in ast.walk(node):
-        if isinstance(x, _ast.stmt) or isinstance(x, _ast.ExceptHandler):
-            values.append(x.lineno - 1)
-            for name in "finalbody", "orelse":
-                val = getattr(x, name, None)
-                if val:
-                    # treat the finally/orelse part as its own statement
-                    values.append(val[0].lineno - 1 - 1)
-    values.sort()
-    insert_index = bisect_right(values, lineno)
-    start = values[insert_index - 1]
-    if insert_index >= len(values):
-        end = None
-    else:
-        end = values[insert_index]
-    return start, end
-
-
-def getstatementrange_ast(lineno, source, assertion=False, astnode=None):
-    if astnode is None:
-        content = str(source)
-        if sys.version_info < (2, 7):
-            content += "\n"
-        try:
-            astnode = compile(content, "source", "exec", 1024)  # 1024 for AST
-        except ValueError:
-            start, end = getstatementrange_old(lineno, source, assertion)
-            return None, start, end
-    start, end = get_statement_startend2(lineno, astnode)
-    # we need to correct the end:
-    # - ast-parsing strips comments
-    # - there might be empty lines
-    # - we might have lesser indented code blocks at the end
-    if end is None:
-        end = len(source.lines)
-
-    if end > start + 1:
-        # make sure we don't span differently indented code blocks
-        # by using the BlockFinder helper used which inspect.getsource() uses itself
-        block_finder = inspect.BlockFinder()
-        # if we start with an indented line, put blockfinder to "started" mode
-        block_finder.started = source.lines[start][0].isspace()
-        it = ((x + "\n") for x in source.lines[start:end])
-        try:
-            for tok in tokenize.generate_tokens(lambda: next(it)):
-                block_finder.tokeneater(*tok)
-        except (inspect.EndOfBlock, IndentationError):
-            end = block_finder.last + start
-        except Exception:
-            pass
-
-    # the end might still point to a comment or empty line, correct it
-    while end:
-        line = source.lines[end - 1].lstrip()
-        if line.startswith("#") or not line:
-            end -= 1
-        else:
-            break
-    return astnode, start, end
-
-
-def getstatementrange_old(lineno, source, assertion=False):
-    """ return (start, end) tuple which spans the minimal
-        statement region which containing the given lineno.
-        raise an IndexError if no such statementrange can be found.
-    """
-    # XXX this logic is only used on python2.4 and below
-    # 1. find the start of the statement
-    from codeop import compile_command
-    for start in range(lineno, -1, -1):
-        if assertion:
-            line = source.lines[start]
-            # the following lines are not fully tested, change with care
-            if 'super' in line and 'self' in line and '__init__' in line:
-                raise IndexError("likely a subclass")
-            if "assert" not in line and "raise" not in line:
-                continue
-        trylines = source.lines[start:lineno + 1]
-        # quick hack to prepare parsing an indented line with
-        # compile_command() (which errors on "return" outside defs)
-        trylines.insert(0, 'def xxx():')
-        trysource = '\n '.join(trylines)
-        #              ^ space here
-        try:
-            compile_command(trysource)
-        except (SyntaxError, OverflowError, ValueError):
-            continue
-
-        # 2. find the end of the statement
-        for end in range(lineno + 1, len(source) + 1):
-            trysource = source[start:end]
-            if trysource.isparseable():
-                return start, end
-    raise SyntaxError("no valid source range around line %d " % (lineno,))
deleted file mode 100644
--- a/third_party/python/pytest/_pytest/_pluggy.py
+++ /dev/null
@@ -1,11 +0,0 @@
-"""
-imports symbols from vendored "pluggy" if available, otherwise
-falls back to importing "pluggy" from the default namespace.
-"""
-from __future__ import absolute_import, division, print_function
-try:
-    from _pytest.vendored_packages.pluggy import *  # noqa
-    from _pytest.vendored_packages.pluggy import __version__  # noqa
-except ImportError:
-    from pluggy import *  # noqa
-    from pluggy import __version__  # noqa
deleted file mode 100644
--- a/third_party/python/pytest/_pytest/_version.py
+++ /dev/null
@@ -1,4 +0,0 @@
-# coding: utf-8
-# file generated by setuptools_scm
-# don't change, don't track in version control
-version = '3.2.5'
deleted file mode 100644
--- a/third_party/python/pytest/_pytest/assertion/__init__.py
+++ /dev/null
@@ -1,148 +0,0 @@
-"""
-support for presenting detailed information in failing assertions.
-"""
-from __future__ import absolute_import, division, print_function
-import py
-import sys
-
-from _pytest.assertion import util
-from _pytest.assertion import rewrite
-from _pytest.assertion import truncate
-
-
-def pytest_addoption(parser):
-    group = parser.getgroup("debugconfig")
-    group.addoption('--assert',
-                    action="store",
-                    dest="assertmode",
-                    choices=("rewrite", "plain",),
-                    default="rewrite",
-                    metavar="MODE",
-                    help="""Control assertion debugging tools.  'plain'
-                            performs no assertion debugging.  'rewrite'
-                            (the default) rewrites assert statements in
-                            test modules on import to provide assert
-                            expression information.""")
-
-
-def register_assert_rewrite(*names):
-    """Register one or more module names to be rewritten on import.
-
-    This function will make sure that this module or all modules inside
-    the package will get their assert statements rewritten.
-    Thus you should make sure to call this before the module is
-    actually imported, usually in your __init__.py if you are a plugin
-    using a package.
-
-    :raise TypeError: if the given module names are not strings.
-    """
-    for name in names:
-        if not isinstance(name, str):
-            msg = 'expected module names as *args, got {0} instead'
-            raise TypeError(msg.format(repr(names)))
-    for hook in sys.meta_path:
-        if isinstance(hook, rewrite.AssertionRewritingHook):
-            importhook = hook
-            break
-    else:
-        importhook = DummyRewriteHook()
-    importhook.mark_rewrite(*names)
-
-
-class DummyRewriteHook(object):
-    """A no-op import hook for when rewriting is disabled."""
-
-    def mark_rewrite(self, *names):
-        pass
-
-
-class AssertionState:
-    """State for the assertion plugin."""
-
-    def __init__(self, config, mode):
-        self.mode = mode
-        self.trace = config.trace.root.get("assertion")
-        self.hook = None
-
-
-def install_importhook(config):
-    """Try to install the rewrite hook, raise SystemError if it fails."""
-    # Both Jython and CPython 2.6.0 have AST bugs that make the
-    # assertion rewriting hook malfunction.
-    if (sys.platform.startswith('java') or
-            sys.version_info[:3] == (2, 6, 0)):
-        raise SystemError('rewrite not supported')
-
-    config._assertstate = AssertionState(config, 'rewrite')
-    config._assertstate.hook = hook = rewrite.AssertionRewritingHook(config)
-    sys.meta_path.insert(0, hook)
-    config._assertstate.trace('installed rewrite import hook')
-
-    def undo():
-        hook = config._assertstate.hook
-        if hook is not None and hook in sys.meta_path:
-            sys.meta_path.remove(hook)
-
-    config.add_cleanup(undo)
-    return hook
-
-
-def pytest_collection(session):
-    # this hook is only called when test modules are collected
-    # so for example not in the master process of pytest-xdist
-    # (which does not collect test modules)
-    assertstate = getattr(session.config, '_assertstate', None)
-    if assertstate:
-        if assertstate.hook is not None:
-            assertstate.hook.set_session(session)
-
-
-def pytest_runtest_setup(item):
-    """Setup the pytest_assertrepr_compare hook
-
-    The newinterpret and rewrite modules will use util._reprcompare if
-    it exists to use custom reporting via the
-    pytest_assertrepr_compare hook.  This sets up this custom
-    comparison for the test.
-    """
-    def callbinrepr(op, left, right):
-        """Call the pytest_assertrepr_compare hook and prepare the result
-
-        This uses the first result from the hook and then ensures the
-        following:
-        * Overly verbose explanations are truncated unless configured otherwise
-          (eg. if running in verbose mode).
-        * Embedded newlines are escaped to help util.format_explanation()
-          later.
-        * If the rewrite mode is used embedded %-characters are replaced
-          to protect later % formatting.
-
-        The result can be formatted by util.format_explanation() for
-        pretty printing.
-        """
-        hook_result = item.ihook.pytest_assertrepr_compare(
-            config=item.config, op=op, left=left, right=right)
-        for new_expl in hook_result:
-            if new_expl:
-                new_expl = truncate.truncate_if_required(new_expl, item)
-                new_expl = [line.replace("\n", "\\n") for line in new_expl]
-                res = py.builtin._totext("\n~").join(new_expl)
-                if item.config.getvalue("assertmode") == "rewrite":
-                    res = res.replace("%", "%%")
-                return res
-    util._reprcompare = callbinrepr
-
-
-def pytest_runtest_teardown(item):
-    util._reprcompare = None
-
-
-def pytest_sessionfinish(session):
-    assertstate = getattr(session.config, '_assertstate', None)
-    if assertstate:
-        if assertstate.hook is not None:
-            assertstate.hook.set_session(None)
-
-
-# Expose this plugin's implementation for the pytest_assertrepr_compare hook
-pytest_assertrepr_compare = util.assertrepr_compare
deleted file mode 100644
--- a/third_party/python/pytest/_pytest/assertion/rewrite.py
+++ /dev/null
@@ -1,952 +0,0 @@
-"""Rewrite assertion AST to produce nice error messages"""
-from __future__ import absolute_import, division, print_function
-import ast
-import _ast
-import errno
-import itertools
-import imp
-import marshal
-import os
-import re
-import struct
-import sys
-import types
-
-import py
-from _pytest.assertion import util
-
-
-# pytest caches rewritten pycs in __pycache__.
-if hasattr(imp, "get_tag"):
-    PYTEST_TAG = imp.get_tag() + "-PYTEST"
-else:
-    if hasattr(sys, "pypy_version_info"):
-        impl = "pypy"
-    elif sys.platform == "java":
-        impl = "jython"
-    else:
-        impl = "cpython"
-    ver = sys.version_info
-    PYTEST_TAG = "%s-%s%s-PYTEST" % (impl, ver[0], ver[1])
-    del ver, impl
-
-PYC_EXT = ".py" + (__debug__ and "c" or "o")
-PYC_TAIL = "." + PYTEST_TAG + PYC_EXT
-
-REWRITE_NEWLINES = sys.version_info[:2] != (2, 7) and sys.version_info < (3, 2)
-ASCII_IS_DEFAULT_ENCODING = sys.version_info[0] < 3
-
-if sys.version_info >= (3, 5):
-    ast_Call = ast.Call
-else:
-    def ast_Call(a, b, c):
-        return ast.Call(a, b, c, None, None)
-
-
-class AssertionRewritingHook(object):
-    """PEP302 Import hook which rewrites asserts."""
-
-    def __init__(self, config):
-        self.config = config
-        self.fnpats = config.getini("python_files")
-        self.session = None
-        self.modules = {}
-        self._rewritten_names = set()
-        self._register_with_pkg_resources()
-        self._must_rewrite = set()
-
-    def set_session(self, session):
-        self.session = session
-
-    def find_module(self, name, path=None):
-        state = self.config._assertstate
-        state.trace("find_module called for: %s" % name)
-        names = name.rsplit(".", 1)
-        lastname = names[-1]
-        pth = None
-        if path is not None:
-            # Starting with Python 3.3, path is a _NamespacePath(), which
-            # causes problems if not converted to list.
-            path = list(path)
-            if len(path) == 1:
-                pth = path[0]
-        if pth is None:
-            try:
-                fd, fn, desc = imp.find_module(lastname, path)
-            except ImportError:
-                return None
-            if fd is not None:
-                fd.close()
-            tp = desc[2]
-            if tp == imp.PY_COMPILED:
-                if hasattr(imp, "source_from_cache"):
-                    try:
-                        fn = imp.source_from_cache(fn)
-                    except ValueError:
-                        # Python 3 doesn't like orphaned but still-importable
-                        # .pyc files.
-                        fn = fn[:-1]
-                else:
-                    fn = fn[:-1]
-            elif tp != imp.PY_SOURCE:
-                # Don't know what this is.
-                return None
-        else:
-            fn = os.path.join(pth, name.rpartition(".")[2] + ".py")
-
-        fn_pypath = py.path.local(fn)
-        if not self._should_rewrite(name, fn_pypath, state):
-            return None
-
-        self._rewritten_names.add(name)
-
-        # The requested module looks like a test file, so rewrite it. This is
-        # the most magical part of the process: load the source, rewrite the
-        # asserts, and load the rewritten source. We also cache the rewritten
-        # module code in a special pyc. We must be aware of the possibility of
-        # concurrent pytest processes rewriting and loading pycs. To avoid
-        # tricky race conditions, we maintain the following invariant: The
-        # cached pyc is always a complete, valid pyc. Operations on it must be
-        # atomic. POSIX's atomic rename comes in handy.
-        write = not sys.dont_write_bytecode
-        cache_dir = os.path.join(fn_pypath.dirname, "__pycache__")
-        if write:
-            try:
-                os.mkdir(cache_dir)
-            except OSError:
-                e = sys.exc_info()[1].errno
-                if e == errno.EEXIST:
-                    # Either the __pycache__ directory already exists (the
-                    # common case) or it's blocked by a non-dir node. In the
-                    # latter case, we'll ignore it in _write_pyc.
-                    pass
-                elif e in [errno.ENOENT, errno.ENOTDIR]:
-                    # One of the path components was not a directory, likely
-                    # because we're in a zip file.
-                    write = False
-                elif e in [errno.EACCES, errno.EROFS, errno.EPERM]:
-                    state.trace("read only directory: %r" % fn_pypath.dirname)
-                    write = False
-                else:
-                    raise
-        cache_name = fn_pypath.basename[:-3] + PYC_TAIL
-        pyc = os.path.join(cache_dir, cache_name)
-        # Notice that even if we're in a read-only directory, I'm going
-        # to check for a cached pyc. This may not be optimal...
-        co = _read_pyc(fn_pypath, pyc, state.trace)
-        if co is None:
-            state.trace("rewriting %r" % (fn,))
-            source_stat, co = _rewrite_test(self.config, fn_pypath)
-            if co is None:
-                # Probably a SyntaxError in the test.
-                return None
-            if write:
-                _make_rewritten_pyc(state, source_stat, pyc, co)
-        else:
-            state.trace("found cached rewritten pyc for %r" % (fn,))
-        self.modules[name] = co, pyc
-        return self
-
-    def _should_rewrite(self, name, fn_pypath, state):
-        # always rewrite conftest files
-        fn = str(fn_pypath)
-        if fn_pypath.basename == 'conftest.py':
-            state.trace("rewriting conftest file: %r" % (fn,))
-            return True
-
-        if self.session is not None:
-            if self.session.isinitpath(fn):
-                state.trace("matched test file (was specified on cmdline): %r" %
-                            (fn,))
-                return True
-
-        # modules not passed explicitly on the command line are only
-        # rewritten if they match the naming convention for test files
-        for pat in self.fnpats:
-            if fn_pypath.fnmatch(pat):
-                state.trace("matched test file %r" % (fn,))
-                return True
-
-        for marked in self._must_rewrite:
-            if name.startswith(marked):
-                state.trace("matched marked file %r (from %r)" % (name, marked))
-                return True
-
-        return False
-
-    def mark_rewrite(self, *names):
-        """Mark import names as needing to be re-written.
-
-        The named module or package as well as any nested modules will
-        be re-written on import.
-        """
-        already_imported = set(names).intersection(set(sys.modules))
-        if already_imported:
-            for name in already_imported:
-                if name not in self._rewritten_names:
-                    self._warn_already_imported(name)
-        self._must_rewrite.update(names)
-
-    def _warn_already_imported(self, name):
-        self.config.warn(
-            'P1',
-            'Module already imported so can not be re-written: %s' % name)
-
-    def load_module(self, name):
-        # If there is an existing module object named 'fullname' in
-        # sys.modules, the loader must use that existing module. (Otherwise,
-        # the reload() builtin will not work correctly.)
-        if name in sys.modules:
-            return sys.modules[name]
-
-        co, pyc = self.modules.pop(name)
-        # I wish I could just call imp.load_compiled here, but __file__ has to
-        # be set properly. In Python 3.2+, this all would be handled correctly
-        # by load_compiled.
-        mod = sys.modules[name] = imp.new_module(name)
-        try:
-            mod.__file__ = co.co_filename
-            # Normally, this attribute is 3.2+.
-            mod.__cached__ = pyc
-            mod.__loader__ = self
-            py.builtin.exec_(co, mod.__dict__)
-        except:  # noqa
-            if name in sys.modules:
-                del sys.modules[name]
-            raise
-        return sys.modules[name]
-
-    def is_package(self, name):
-        try:
-            fd, fn, desc = imp.find_module(name)
-        except ImportError:
-            return False
-        if fd is not None:
-            fd.close()
-        tp = desc[2]
-        return tp == imp.PKG_DIRECTORY
-
-    @classmethod
-    def _register_with_pkg_resources(cls):
-        """
-        Ensure package resources can be loaded from this loader. May be called
-        multiple times, as the operation is idempotent.
-        """
-        try:
-            import pkg_resources
-            # access an attribute in case a deferred importer is present
-            pkg_resources.__name__
-        except ImportError:
-            return
-
-        # Since pytest tests are always located in the file system, the
-        #  DefaultProvider is appropriate.
-        pkg_resources.register_loader_type(cls, pkg_resources.DefaultProvider)
-
-    def get_data(self, pathname):
-        """Optional PEP302 get_data API.
-        """
-        with open(pathname, 'rb') as f:
-            return f.read()
-
-
-def _write_pyc(state, co, source_stat, pyc):
-    # Technically, we don't have to have the same pyc format as
-    # (C)Python, since these "pycs" should never be seen by builtin
-    # import. However, there's little reason deviate, and I hope
-    # sometime to be able to use imp.load_compiled to load them. (See
-    # the comment in load_module above.)
-    try:
-        fp = open(pyc, "wb")
-    except IOError:
-        err = sys.exc_info()[1].errno
-        state.trace("error writing pyc file at %s: errno=%s" % (pyc, err))
-        # we ignore any failure to write the cache file
-        # there are many reasons, permission-denied, __pycache__ being a
-        # file etc.
-        return False
-    try:
-        fp.write(imp.get_magic())
-        mtime = int(source_stat.mtime)
-        size = source_stat.size & 0xFFFFFFFF
-        fp.write(struct.pack("<ll", mtime, size))
-        marshal.dump(co, fp)
-    finally:
-        fp.close()
-    return True
-
-
-RN = "\r\n".encode("utf-8")
-N = "\n".encode("utf-8")
-
-cookie_re = re.compile(r"^[ \t\f]*#.*coding[:=][ \t]*[-\w.]+")
-BOM_UTF8 = '\xef\xbb\xbf'
-
-
-def _rewrite_test(config, fn):
-    """Try to read and rewrite *fn* and return the code object."""
-    state = config._assertstate
-    try:
-        stat = fn.stat()
-        source = fn.read("rb")
-    except EnvironmentError:
-        return None, None
-    if ASCII_IS_DEFAULT_ENCODING:
-        # ASCII is the default encoding in Python 2. Without a coding
-        # declaration, Python 2 will complain about any bytes in the file
-        # outside the ASCII range. Sadly, this behavior does not extend to
-        # compile() or ast.parse(), which prefer to interpret the bytes as
-        # latin-1. (At least they properly handle explicit coding cookies.) To
-        # preserve this error behavior, we could force ast.parse() to use ASCII
-        # as the encoding by inserting a coding cookie. Unfortunately, that
-        # messes up line numbers. Thus, we have to check ourselves if anything
-        # is outside the ASCII range in the case no encoding is explicitly
-        # declared. For more context, see issue #269. Yay for Python 3 which
-        # gets this right.
-        end1 = source.find("\n")
-        end2 = source.find("\n", end1 + 1)
-        if (not source.startswith(BOM_UTF8) and
-            cookie_re.match(source[0:end1]) is None and
-                cookie_re.match(source[end1 + 1:end2]) is None):
-            if hasattr(state, "_indecode"):
-                # encodings imported us again, so don't rewrite.
-                return None, None
-            state._indecode = True
-            try:
-                try:
-                    source.decode("ascii")
-                except UnicodeDecodeError:
-                    # Let it fail in real import.
-                    return None, None
-            finally:
-                del state._indecode
-    # On Python versions which are not 2.7 and less than or equal to 3.1, the
-    # parser expects *nix newlines.
-    if REWRITE_NEWLINES:
-        source = source.replace(RN, N) + N
-    try:
-        tree = ast.parse(source)
-    except SyntaxError:
-        # Let this pop up again in the real import.
-        state.trace("failed to parse: %r" % (fn,))
-        return None, None
-    rewrite_asserts(tree, fn, config)
-    try:
-        co = compile(tree, fn.strpath, "exec", dont_inherit=True)
-    except SyntaxError:
-        # It's possible that this error is from some bug in the
-        # assertion rewriting, but I don't know of a fast way to tell.
-        state.trace("failed to compile: %r" % (fn,))
-        return None, None
-    return stat, co
-
-
-def _make_rewritten_pyc(state, source_stat, pyc, co):
-    """Try to dump rewritten code to *pyc*."""
-    if sys.platform.startswith("win"):
-        # Windows grants exclusive access to open files and doesn't have atomic
-        # rename, so just write into the final file.
-        _write_pyc(state, co, source_stat, pyc)
-    else:
-        # When not on windows, assume rename is atomic. Dump the code object
-        # into a file specific to this process and atomically replace it.
-        proc_pyc = pyc + "." + str(os.getpid())
-        if _write_pyc(state, co, source_stat, proc_pyc):
-            os.rename(proc_pyc, pyc)
-
-
-def _read_pyc(source, pyc, trace=lambda x: None):
-    """Possibly read a pytest pyc containing rewritten code.
-
-    Return rewritten code if successful or None if not.
-    """
-    try:
-        fp = open(pyc, "rb")
-    except IOError:
-        return None
-    with fp:
-        try:
-            mtime = int(source.mtime())
-            size = source.size()
-            data = fp.read(12)
-        except EnvironmentError as e:
-            trace('_read_pyc(%s): EnvironmentError %s' % (source, e))
-            return None
-        # Check for invalid or out of date pyc file.
-        if (len(data) != 12 or data[:4] != imp.get_magic() or
-                struct.unpack("<ll", data[4:]) != (mtime, size)):
-            trace('_read_pyc(%s): invalid or out of date pyc' % source)
-            return None
-        try:
-            co = marshal.load(fp)
-        except Exception as e:
-            trace('_read_pyc(%s): marshal.load error %s' % (source, e))
-            return None
-        if not isinstance(co, types.CodeType):
-            trace('_read_pyc(%s): not a code object' % source)
-            return None
-        return co
-
-
-def rewrite_asserts(mod, module_path=None, config=None):
-    """Rewrite the assert statements in mod."""
-    AssertionRewriter(module_path, config).run(mod)
-
-
-def _saferepr(obj):
-    """Get a safe repr of an object for assertion error messages.
-
-    The assertion formatting (util.format_explanation()) requires
-    newlines to be escaped since they are a special character for it.
-    Normally assertion.util.format_explanation() does this but for a
-    custom repr it is possible to contain one of the special escape
-    sequences, especially '\n{' and '\n}' are likely to be present in
-    JSON reprs.
-
-    """
-    repr = py.io.saferepr(obj)
-    if py.builtin._istext(repr):
-        t = py.builtin.text
-    else:
-        t = py.builtin.bytes
-    return repr.replace(t("\n"), t("\\n"))
-
-
-from _pytest.assertion.util import format_explanation as _format_explanation  # noqa
-
-
-def _format_assertmsg(obj):
-    """Format the custom assertion message given.
-
-    For strings this simply replaces newlines with '\n~' so that
-    util.format_explanation() will preserve them instead of escaping
-    newlines.  For other objects py.io.saferepr() is used first.
-
-    """
-    # reprlib appears to have a bug which means that if a string
-    # contains a newline it gets escaped, however if an object has a
-    # .__repr__() which contains newlines it does not get escaped.
-    # However in either case we want to preserve the newline.
-    if py.builtin._istext(obj) or py.builtin._isbytes(obj):
-        s = obj
-        is_repr = False
-    else:
-        s = py.io.saferepr(obj)
-        is_repr = True
-    if py.builtin._istext(s):
-        t = py.builtin.text
-    else:
-        t = py.builtin.bytes
-    s = s.replace(t("\n"), t("\n~")).replace(t("%"), t("%%"))
-    if is_repr:
-        s = s.replace(t("\\n"), t("\n~"))
-    return s
-
-
-def _should_repr_global_name(obj):
-    return not hasattr(obj, "__name__") and not py.builtin.callable(obj)
-
-
-def _format_boolop(explanations, is_or):
-    explanation = "(" + (is_or and " or " or " and ").join(explanations) + ")"
-    if py.builtin._istext(explanation):
-        t = py.builtin.text
-    else:
-        t = py.builtin.bytes
-    return explanation.replace(t('%'), t('%%'))
-
-
-def _call_reprcompare(ops, results, expls, each_obj):
-    for i, res, expl in zip(range(len(ops)), results, expls):
-        try:
-            done = not res
-        except Exception:
-            done = True
-        if done:
-            break
-    if util._reprcompare is not None:
-        custom = util._reprcompare(ops[i], each_obj[i], each_obj[i + 1])
-        if custom is not None:
-            return custom
-    return expl
-
-
-unary_map = {
-    ast.Not: "not %s",
-    ast.Invert: "~%s",
-    ast.USub: "-%s",
-    ast.UAdd: "+%s"
-}
-
-binop_map = {
-    ast.BitOr: "|",
-    ast.BitXor: "^",
-    ast.BitAnd: "&",
-    ast.LShift: "<<",
-    ast.RShift: ">>",
-    ast.Add: "+",
-    ast.Sub: "-",
-    ast.Mult: "*",
-    ast.Div: "/",
-    ast.FloorDiv: "//",
-    ast.Mod: "%%",  # escaped for string formatting
-    ast.Eq: "==",
-    ast.NotEq: "!=",
-    ast.Lt: "<",
-    ast.LtE: "<=",
-    ast.Gt: ">",
-    ast.GtE: ">=",
-    ast.Pow: "**",
-    ast.Is: "is",
-    ast.IsNot: "is not",
-    ast.In: "in",
-    ast.NotIn: "not in"
-}
-# Python 3.5+ compatibility
-try:
-    binop_map[ast.MatMult] = "@"
-except AttributeError:
-    pass
-
-# Python 3.4+ compatibility
-if hasattr(ast, "NameConstant"):
-    _NameConstant = ast.NameConstant
-else:
-    def _NameConstant(c):
-        return ast.Name(str(c), ast.Load())
-
-
-def set_location(node, lineno, col_offset):
-    """Set node location information recursively."""
-    def _fix(node, lineno, col_offset):
-        if "lineno" in node._attributes:
-            node.lineno = lineno
-        if "col_offset" in node._attributes:
-            node.col_offset = col_offset
-        for child in ast.iter_child_nodes(node):
-            _fix(child, lineno, col_offset)
-    _fix(node, lineno, col_offset)
-    return node
-
-
-class AssertionRewriter(ast.NodeVisitor):
-    """Assertion rewriting implementation.
-
-    The main entrypoint is to call .run() with an ast.Module instance,
-    this will then find all the assert statements and re-write them to
-    provide intermediate values and a detailed assertion error.  See
-    http://pybites.blogspot.be/2011/07/behind-scenes-of-pytests-new-assertion.html
-    for an overview of how this works.
-
-    The entry point here is .run() which will iterate over all the
-    statements in an ast.Module and for each ast.Assert statement it
-    finds call .visit() with it.  Then .visit_Assert() takes over and
-    is responsible for creating new ast statements to replace the
-    original assert statement: it re-writes the test of an assertion
-    to provide intermediate values and replace it with an if statement
-    which raises an assertion error with a detailed explanation in
-    case the expression is false.
-
-    For this .visit_Assert() uses the visitor pattern to visit all the
-    AST nodes of the ast.Assert.test field, each visit call returning
-    an AST node and the corresponding explanation string.  During this
-    state is kept in several instance attributes:
-
-    :statements: All the AST statements which will replace the assert
-       statement.
-
-    :variables: This is populated by .variable() with each variable
-       used by the statements so that they can all be set to None at
-       the end of the statements.
-
-    :variable_counter: Counter to create new unique variables needed
-       by statements.  Variables are created using .variable() and
-       have the form of "@py_assert0".
-
-    :on_failure: The AST statements which will be executed if the
-       assertion test fails.  This is the code which will construct
-       the failure message and raises the AssertionError.
-
-    :explanation_specifiers: A dict filled by .explanation_param()
-       with %-formatting placeholders and their corresponding
-       expressions to use in the building of an assertion message.
-       This is used by .pop_format_context() to build a message.
-
-    :stack: A stack of the explanation_specifiers dicts maintained by
-       .push_format_context() and .pop_format_context() which allows
-       to build another %-formatted string while already building one.
-
-    This state is reset on every new assert statement visited and used
-    by the other visitors.
-
-    """
-
-    def __init__(self, module_path, config):
-        super(AssertionRewriter, self).__init__()
-        self.module_path = module_path
-        self.config = config
-
-    def run(self, mod):
-        """Find all assert statements in *mod* and rewrite them."""
-        if not mod.body:
-            # Nothing to do.
-            return
-        # Insert some special imports at the top of the module but after any
-        # docstrings and __future__ imports.
-        aliases = [ast.alias(py.builtin.builtins.__name__, "@py_builtins"),
-                   ast.alias("_pytest.assertion.rewrite", "@pytest_ar")]
-        doc = getattr(mod, "docstring", None)
-        expect_docstring = doc is None
-        if doc is not None and self.is_rewrite_disabled(doc):
-            return
-        pos = 0
-        lineno = 1
-        for item in mod.body:
-            if (expect_docstring and isinstance(item, ast.Expr) and
-                    isinstance(item.value, ast.Str)):
-                doc = item.value.s
-                if self.is_rewrite_disabled(doc):
-                    return
-                expect_docstring = False
-            elif (not isinstance(item, ast.ImportFrom) or item.level > 0 or
-                  item.module != "__future__"):
-                lineno = item.lineno
-                break
-            pos += 1
-        else:
-            lineno = item.lineno
-        imports = [ast.Import([alias], lineno=lineno, col_offset=0)
-                   for alias in aliases]
-        mod.body[pos:pos] = imports
-        # Collect asserts.
-        nodes = [mod]
-        while nodes:
-            node = nodes.pop()
-            for name, field in ast.iter_fields(node):
-                if isinstance(field, list):
-                    new = []
-                    for i, child in enumerate(field):
-                        if isinstance(child, ast.Assert):
-                            # Transform assert.
-                            new.extend(self.visit(child))
-                        else:
-                            new.append(child)
-                            if isinstance(child, ast.AST):
-                                nodes.append(child)
-                    setattr(node, name, new)
-                elif (isinstance(field, ast.AST) and
-                      # Don't recurse into expressions as they can't contain
-                      # asserts.
-                      not isinstance(field, ast.expr)):
-                    nodes.append(field)
-
-    def is_rewrite_disabled(self, docstring):
-        return "PYTEST_DONT_REWRITE" in docstring
-
-    def variable(self):
-        """Get a new variable."""
-        # Use a character invalid in python identifiers to avoid clashing.
-        name = "@py_assert" + str(next(self.variable_counter))
-        self.variables.append(name)
-        return name
-
-    def assign(self, expr):
-        """Give *expr* a name."""
-        name = self.variable()
-        self.statements.append(ast.Assign([ast.Name(name, ast.Store())], expr))
-        return ast.Name(name, ast.Load())
-
-    def display(self, expr):
-        """Call py.io.saferepr on the expression."""
-        return self.helper("saferepr", expr)
-
-    def helper(self, name, *args):
-        """Call a helper in this module."""
-        py_name = ast.Name("@pytest_ar", ast.Load())
-        attr = ast.Attribute(py_name, "_" + name, ast.Load())
-        return ast_Call(attr, list(args), [])
-
-    def builtin(self, name):
-        """Return the builtin called *name*."""
-        builtin_name = ast.Name("@py_builtins", ast.Load())
-        return ast.Attribute(builtin_name, name, ast.Load())
-
-    def explanation_param(self, expr):
-        """Return a new named %-formatting placeholder for expr.
-
-        This creates a %-formatting placeholder for expr in the
-        current formatting context, e.g. ``%(py0)s``.  The placeholder
-        and expr are placed in the current format context so that it
-        can be used on the next call to .pop_format_context().
-
-        """
-        specifier = "py" + str(next(self.variable_counter))
-        self.explanation_specifiers[specifier] = expr
-        return "%(" + specifier + ")s"
-
-    def push_format_context(self):
-        """Create a new formatting context.
-
-        The format context is used for when an explanation wants to
-        have a variable value formatted in the assertion message.  In
-        this case the value required can be added using
-        .explanation_param().  Finally .pop_format_context() is used
-        to format a string of %-formatted values as added by
-        .explanation_param().
-
-        """
-        self.explanation_specifiers = {}
-        self.stack.append(self.explanation_specifiers)
-
-    def pop_format_context(self, expl_expr):
-        """Format the %-formatted string with current format context.
-
-        The expl_expr should be an ast.Str instance constructed from
-        the %-placeholders created by .explanation_param().  This will
-        add the required code to format said string to .on_failure and
-        return the ast.Name instance of the formatted string.
-
-        """
-        current = self.stack.pop()
-        if self.stack:
-            self.explanation_specifiers = self.stack[-1]
-        keys = [ast.Str(key) for key in current.keys()]
-        format_dict = ast.Dict(keys, list(current.values()))
-        form = ast.BinOp(expl_expr, ast.Mod(), format_dict)
-        name = "@py_format" + str(next(self.variable_counter))
-        self.on_failure.append(ast.Assign([ast.Name(name, ast.Store())], form))
-        return ast.Name(name, ast.Load())
-
-    def generic_visit(self, node):
-        """Handle expressions we don't have custom code for."""
-        assert isinstance(node, ast.expr)
-        res = self.assign(node)
-        return res, self.explanation_param(self.display(res))
-
-    def visit_Assert(self, assert_):
-        """Return the AST statements to replace the ast.Assert instance.
-
-        This re-writes the test of an assertion to provide
-        intermediate values and replace it with an if statement which
-        raises an assertion error with a detailed explanation in case
-        the expression is false.
-
-        """
-        if isinstance(assert_.test, ast.Tuple) and self.config is not None:
-            fslocation = (self.module_path, assert_.lineno)
-            self.config.warn('R1', 'assertion is always true, perhaps '
-                             'remove parentheses?', fslocation=fslocation)
-        self.statements = []
-        self.variables = []
-        self.variable_counter = itertools.count()
-        self.stack = []
-        self.on_failure = []
-        self.push_format_context()
-        # Rewrite assert into a bunch of statements.
-        top_condition, explanation = self.visit(assert_.test)
-        # Create failure message.
-        body = self.on_failure
-        negation = ast.UnaryOp(ast.Not(), top_condition)
-        self.statements.append(ast.If(negation, body, []))
-        if assert_.msg:
-            assertmsg = self.helper('format_assertmsg', assert_.msg)
-            explanation = "\n>assert " + explanation
-        else:
-            assertmsg = ast.Str("")
-            explanation = "assert " + explanation
-        template = ast.BinOp(assertmsg, ast.Add(), ast.Str(explanation))
-        msg = self.pop_format_context(template)
-        fmt = self.helper("format_explanation", msg)
-        err_name = ast.Name("AssertionError", ast.Load())
-        exc = ast_Call(err_name, [fmt], [])
-        if sys.version_info[0] >= 3:
-            raise_ = ast.Raise(exc, None)
-        else:
-            raise_ = ast.Raise(exc, None, None)
-        body.append(raise_)
-        # Clear temporary variables by setting them to None.
-        if self.variables:
-            variables = [ast.Name(name, ast.Store())
-                         for name in self.variables]
-            clear = ast.Assign(variables, _NameConstant(None))
-            self.statements.append(clear)
-        # Fix line numbers.
-        for stmt in self.statements:
-            set_location(stmt, assert_.lineno, assert_.col_offset)
-        return self.statements
-
-    def visit_Name(self, name):
-        # Display the repr of the name if it's a local variable or
-        # _should_repr_global_name() thinks it's acceptable.
-        locs = ast_Call(self.builtin("locals"), [], [])
-        inlocs = ast.Compare(ast.Str(name.id), [ast.In()], [locs])
-        dorepr = self.helper("should_repr_global_name", name)
-        test = ast.BoolOp(ast.Or(), [inlocs, dorepr])
-        expr = ast.IfExp(test, self.display(name), ast.Str(name.id))
-        return name, self.explanation_param(expr)
-
-    def visit_BoolOp(self, boolop):
-        res_var = self.variable()
-        expl_list = self.assign(ast.List([], ast.Load()))
-        app = ast.Attribute(expl_list, "append", ast.Load())
-        is_or = int(isinstance(boolop.op, ast.Or))
-        body = save = self.statements
-        fail_save = self.on_failure
-        levels = len(boolop.values) - 1
-        self.push_format_context()
-        # Process each operand, short-circuting if needed.
-        for i, v in enumerate(boolop.values):
-            if i:
-                fail_inner = []
-                # cond is set in a prior loop iteration below
-                self.on_failure.append(ast.If(cond, fail_inner, []))  # noqa
-                self.on_failure = fail_inner
-            self.push_format_context()
-            res, expl = self.visit(v)
-            body.append(ast.Assign([ast.Name(res_var, ast.Store())], res))
-            expl_format = self.pop_format_context(ast.Str(expl))
-            call = ast_Call(app, [expl_format], [])
-            self.on_failure.append(ast.Expr(call))
-            if i < levels:
-                cond = res
-                if is_or:
-                    cond = ast.UnaryOp(ast.Not(), cond)
-                inner = []
-                self.statements.append(ast.If(cond, inner, []))
-                self.statements = body = inner
-        self.statements = save
-        self.on_failure = fail_save
-        expl_template = self.helper("format_boolop", expl_list, ast.Num(is_or))
-        expl = self.pop_format_context(expl_template)
-        return ast.Name(res_var, ast.Load()), self.explanation_param(expl)
-
-    def visit_UnaryOp(self, unary):
-        pattern = unary_map[unary.op.__class__]
-        operand_res, operand_expl = self.visit(unary.operand)
-        res = self.assign(ast.UnaryOp(unary.op, operand_res))
-        return res, pattern % (operand_expl,)
-
-    def visit_BinOp(self, binop):
-        symbol = binop_map[binop.op.__class__]
-        left_expr, left_expl = self.visit(binop.left)
-        right_expr, right_expl = self.visit(binop.right)
-        explanation = "(%s %s %s)" % (left_expl, symbol, right_expl)
-        res = self.assign(ast.BinOp(left_expr, binop.op, right_expr))
-        return res, explanation
-
-    def visit_Call_35(self, call):
-        """
-        visit `ast.Call` nodes on Python3.5 and after
-        """
-        new_func, func_expl = self.visit(call.func)
-        arg_expls = []
-        new_args = []
-        new_kwargs = []
-        for arg in call.args:
-            res, expl = self.visit(arg)
-            arg_expls.append(expl)
-            new_args.append(res)
-        for keyword in call.keywords:
-            res, expl = self.visit(keyword.value)
-            new_kwargs.append(ast.keyword(keyword.arg, res))
-            if keyword.arg:
-                arg_expls.append(keyword.arg + "=" + expl)
-            else:  # **args have `arg` keywords with an .arg of None
-                arg_expls.append("**" + expl)
-
-        expl = "%s(%s)" % (func_expl, ', '.join(arg_expls))
-        new_call = ast.Call(new_func, new_args, new_kwargs)
-        res = self.assign(new_call)
-        res_expl = self.explanation_param(self.display(res))
-        outer_expl = "%s\n{%s = %s\n}" % (res_expl, res_expl, expl)
-        return res, outer_expl
-
-    def visit_Starred(self, starred):
-        # From Python 3.5, a Starred node can appear in a function call
-        res, expl = self.visit(starred.value)
-        return starred, '*' + expl
-
-    def visit_Call_legacy(self, call):
-        """
-        visit `ast.Call nodes on 3.4 and below`
-        """
-        new_func, func_expl = self.visit(call.func)
-        arg_expls = []
-        new_args = []
-        new_kwargs = []
-        new_star = new_kwarg = None
-        for arg in call.args:
-            res, expl = self.visit(arg)
-            new_args.append(res)
-            arg_expls.append(expl)
-        for keyword in call.keywords:
-            res, expl = self.visit(keyword.value)
-            new_kwargs.append(ast.keyword(keyword.arg, res))
-            arg_expls.append(keyword.arg + "=" + expl)
-        if call.starargs:
-            new_star, expl = self.visit(call.starargs)
-            arg_expls.append("*" + expl)
-        if call.kwargs:
-            new_kwarg, expl = self.visit(call.kwargs)
-            arg_expls.append("**" + expl)
-        expl = "%s(%s)" % (func_expl, ', '.join(arg_expls))
-        new_call = ast.Call(new_func, new_args, new_kwargs,
-                            new_star, new_kwarg)
-        res = self.assign(new_call)
-        res_expl = self.explanation_param(self.display(res))
-        outer_expl = "%s\n{%s = %s\n}" % (res_expl, res_expl, expl)
-        return res, outer_expl
-
-    # ast.Call signature changed on 3.5,
-    # conditionally change  which methods is named
-    # visit_Call depending on Python version
-    if sys.version_info >= (3, 5):
-        visit_Call = visit_Call_35
-    else:
-        visit_Call = visit_Call_legacy
-
-    def visit_Attribute(self, attr):
-        if not isinstance(attr.ctx, ast.Load):
-            return self.generic_visit(attr)
-        value, value_expl = self.visit(attr.value)
-        res = self.assign(ast.Attribute(value, attr.attr, ast.Load()))
-        res_expl = self.explanation_param(self.display(res))
-        pat = "%s\n{%s = %s.%s\n}"
-        expl = pat % (res_expl, res_expl, value_expl, attr.attr)
-        return res, expl
-
-    def visit_Compare(self, comp):
-        self.push_format_context()
-        left_res, left_expl = self.visit(comp.left)
-        if isinstance(comp.left, (_ast.Compare, _ast.BoolOp)):
-            left_expl = "({0})".format(left_expl)
-        res_variables = [self.variable() for i in range(len(comp.ops))]
-        load_names = [ast.Name(v, ast.Load()) for v in res_variables]
-        store_names = [ast.Name(v, ast.Store()) for v in res_variables]
-        it = zip(range(len(comp.ops)), comp.ops, comp.comparators)
-        expls = []
-        syms = []
-        results = [left_res]
-        for i, op, next_operand in it:
-            next_res, next_expl = self.visit(next_operand)
-            if isinstance(next_operand, (_ast.Compare, _ast.BoolOp)):
-                next_expl = "({0})".format(next_expl)
-            results.append(next_res)
-            sym = binop_map[op.__class__]
-            syms.append(ast.Str(sym))
-            expl = "%s %s %s" % (left_expl, sym, next_expl)
-            expls.append(ast.Str(expl))
-            res_expr = ast.Compare(left_res, [op], [next_res])
-            self.statements.append(ast.Assign([store_names[i]], res_expr))
-            left_res, left_expl = next_res, next_expl
-        # Use pytest.assertion.util._reprcompare if that's available.
-        expl_call = self.helper("call_reprcompare",
-                                ast.Tuple(syms, ast.Load()),
-                                ast.Tuple(load_names, ast.Load()),
-                                ast.Tuple(expls, ast.Load()),
-                                ast.Tuple(results, ast.Load()))
-        if len(comp.ops) > 1:
-            res = ast.BoolOp(ast.And(), load_names)
-        else:
-            res = load_names[0]
-        return res, self.explanation_param(self.pop_format_context(expl_call))
deleted file mode 100644
--- a/third_party/python/pytest/_pytest/assertion/truncate.py
+++ /dev/null
@@ -1,102 +0,0 @@
-"""
-Utilities for truncating assertion output.
-
-Current default behaviour is to truncate assertion explanations at
-~8 terminal lines, unless running in "-vv" mode or running on CI.
-"""
-from __future__ import absolute_import, division, print_function
-import os
-
-import py
-
-
-DEFAULT_MAX_LINES = 8
-DEFAULT_MAX_CHARS = 8 * 80
-USAGE_MSG = "use '-vv' to show"
-
-
-def truncate_if_required(explanation, item, max_length=None):
-    """
-    Truncate this assertion explanation if the given test item is eligible.
-    """
-    if _should_truncate_item(item):
-        return _truncate_explanation(explanation)
-    return explanation
-
-
-def _should_truncate_item(item):
-    """
-    Whether or not this test item is eligible for truncation.
-    """
-    verbose = item.config.option.verbose
-    return verbose < 2 and not _running_on_ci()
-
-
-def _running_on_ci():
-    """Check if we're currently running on a CI system."""
-    env_vars = ['CI', 'BUILD_NUMBER']
-    return any(var in os.environ for var in env_vars)
-
-
-def _truncate_explanation(input_lines, max_lines=None, max_chars=None):
-    """
-    Truncate given list of strings that makes up the assertion explanation.
-
-    Truncates to either 8 lines, or 640 characters - whichever the input reaches
-    first. The remaining lines will be replaced by a usage message.
-    """
-
-    if max_lines is None:
-        max_lines = DEFAULT_MAX_LINES
-    if max_chars is None:
-        max_chars = DEFAULT_MAX_CHARS
-
-    # Check if truncation required
-    input_char_count = len("".join(input_lines))
-    if len(input_lines) <= max_lines and input_char_count <= max_chars:
-        return input_lines
-
-    # Truncate first to max_lines, and then truncate to max_chars if max_chars
-    # is exceeded.
-    truncated_explanation = input_lines[:max_lines]
-    truncated_explanation = _truncate_by_char_count(truncated_explanation, max_chars)
-
-    # Add ellipsis to final line
-    truncated_explanation[-1] = truncated_explanation[-1] + "..."
-
-    # Append useful message to explanation
-    truncated_line_count = len(input_lines) - len(truncated_explanation)
-    truncated_line_count += 1  # Account for the part-truncated final line
-    msg = '...Full output truncated'
-    if truncated_line_count == 1:
-        msg += ' ({0} line hidden)'.format(truncated_line_count)
-    else:
-        msg += ' ({0} lines hidden)'.format(truncated_line_count)
-    msg += ", {0}" .format(USAGE_MSG)
-    truncated_explanation.extend([
-        py.builtin._totext(""),
-        py.builtin._totext(msg),
-    ])
-    return truncated_explanation
-
-
-def _truncate_by_char_count(input_lines, max_chars):
-    # Check if truncation required
-    if len("".join(input_lines)) <= max_chars:
-        return input_lines
-
-    # Find point at which input length exceeds total allowed length
-    iterated_char_count = 0
-    for iterated_index, input_line in enumerate(input_lines):
-        if iterated_char_count + len(input_line) > max_chars:
-            break
-        iterated_char_count += len(input_line)
-
-    # Create truncated explanation with modified final line
-    truncated_result = input_lines[:iterated_index]
-    final_line = input_lines[iterated_index]
-    if final_line:
-        final_line_truncate_point = max_chars - iterated_char_count
-        final_line = final_line[:final_line_truncate_point]
-    truncated_result.append(final_line)
-    return truncated_result
deleted file mode 100644
--- a/third_party/python/pytest/_pytest/assertion/util.py
+++ /dev/null
@@ -1,307 +0,0 @@
-"""Utilities for assertion debugging"""
-from __future__ import absolute_import, division, print_function
-import pprint
-
-import _pytest._code
-import py
-try:
-    from collections import Sequence
-except ImportError:
-    Sequence = list
-
-
-u = py.builtin._totext
-
-# The _reprcompare attribute on the util module is used by the new assertion
-# interpretation code and assertion rewriter to detect this plugin was
-# loaded and in turn call the hooks defined here as part of the
-# DebugInterpreter.
-_reprcompare = None
-
-
-# the re-encoding is needed for python2 repr
-# with non-ascii characters (see issue 877 and 1379)
-def ecu(s):
-    try:
-        return u(s, 'utf-8', 'replace')
-    except TypeError:
-        return s
-
-
-def format_explanation(explanation):
-    """This formats an explanation
-
-    Normally all embedded newlines are escaped, however there are
-    three exceptions: \n{, \n} and \n~.  The first two are intended
-    cover nested explanations, see function and attribute explanations
-    for examples (.visit_Call(), visit_Attribute()).  The last one is
-    for when one explanation needs to span multiple lines, e.g. when
-    displaying diffs.
-    """
-    explanation = ecu(explanation)
-    lines = _split_explanation(explanation)
-    result = _format_lines(lines)
-    return u('\n').join(result)
-
-
-def _split_explanation(explanation):
-    """Return a list of individual lines in the explanation
-
-    This will return a list of lines split on '\n{', '\n}' and '\n~'.
-    Any other newlines will be escaped and appear in the line as the
-    literal '\n' characters.
-    """
-    raw_lines = (explanation or u('')).split('\n')
-    lines = [raw_lines[0]]
-    for values in raw_lines[1:]:
-        if values and values[0] in ['{', '}', '~', '>']:
-            lines.append(values)
-        else:
-            lines[-1] += '\\n' + values
-    return lines
-
-
-def _format_lines(lines):
-    """Format the individual lines
-
-    This will replace the '{', '}' and '~' characters of our mini
-    formatting language with the proper 'where ...', 'and ...' and ' +
-    ...' text, taking care of indentation along the way.
-
-    Return a list of formatted lines.
-    """
-    result = lines[:1]
-    stack = [0]
-    stackcnt = [0]
-    for line in lines[1:]:
-        if line.startswith('{'):
-            if stackcnt[-1]:
-                s = u('and   ')
-            else:
-                s = u('where ')
-            stack.append(len(result))
-            stackcnt[-1] += 1
-            stackcnt.append(0)
-            result.append(u(' +') + u('  ') * (len(stack) - 1) + s + line[1:])
-        elif line.startswith('}'):
-            stack.pop()
-            stackcnt.pop()
-            result[stack[-1]] += line[1:]
-        else:
-            assert line[0] in ['~', '>']
-            stack[-1] += 1
-            indent = len(stack) if line.startswith('~') else len(stack) - 1
-            result.append(u('  ') * indent + line[1:])
-    assert len(stack) == 1
-    return result
-
-
-# Provide basestring in python3
-try:
-    basestring = basestring
-except NameError:
-    basestring = str
-
-
-def assertrepr_compare(config, op, left, right):
-    """Return specialised explanations for some operators/operands"""
-    width = 80 - 15 - len(op) - 2  # 15 chars indentation, 1 space around op
-    left_repr = py.io.saferepr(left, maxsize=int(width // 2))
-    right_repr = py.io.saferepr(right, maxsize=width - len(left_repr))
-
-    summary = u('%s %s %s') % (ecu(left_repr), op, ecu(right_repr))
-
-    def issequence(x):
-        return (isinstance(x, (list, tuple, Sequence)) and not isinstance(x, basestring))
-
-    def istext(x):
-        return isinstance(x, basestring)
-
-    def isdict(x):
-        return isinstance(x, dict)
-
-    def isset(x):
-        return isinstance(x, (set, frozenset))
-
-    def isiterable(obj):
-        try:
-            iter(obj)
-            return not istext(obj)
-        except TypeError:
-            return False
-
-    verbose = config.getoption('verbose')
-    explanation = None
-    try:
-        if op == '==':
-            if istext(left) and istext(right):
-                explanation = _diff_text(left, right, verbose)
-            else:
-                if issequence(left) and issequence(right):
-                    explanation = _compare_eq_sequence(left, right, verbose)
-                elif isset(left) and isset(right):
-                    explanation = _compare_eq_set(left, right, verbose)
-                elif isdict(left) and isdict(right):
-                    explanation = _compare_eq_dict(left, right, verbose)
-                if isiterable(left) and isiterable(right):
-                    expl = _compare_eq_iterable(left, right, verbose)
-                    if explanation is not None:
-                        explanation.extend(expl)
-                    else:
-                        explanation = expl
-        elif op == 'not in':
-            if istext(left) and istext(right):
-                explanation = _notin_text(left, right, verbose)
-    except Exception:
-        explanation = [
-            u('(pytest_assertion plugin: representation of details failed.  '
-              'Probably an object has a faulty __repr__.)'),
-            u(_pytest._code.ExceptionInfo())]
-
-    if not explanation:
-        return None
-
-    return [summary] + explanation
-
-
-def _diff_text(left, right, verbose=False):
-    """Return the explanation for the diff between text or bytes
-
-    Unless --verbose is used this will skip leading and trailing
-    characters which are identical to keep the diff minimal.
-
-    If the input are bytes they will be safely converted to text.
-    """
-    from difflib import ndiff
-    explanation = []
-    if isinstance(left, py.builtin.bytes):
-        left = u(repr(left)[1:-1]).replace(r'\n', '\n')
-    if isinstance(right, py.builtin.bytes):
-        right = u(repr(right)[1:-1]).replace(r'\n', '\n')
-    if not verbose:
-        i = 0  # just in case left or right has zero length
-        for i in range(min(len(left), len(right))):
-            if left[i] != right[i]:
-                break
-        if i > 42:
-            i -= 10                 # Provide some context
-            explanation = [u('Skipping %s identical leading '
-                             'characters in diff, use -v to show') % i]
-            left = left[i:]
-            right = right[i:]
-        if len(left) == len(right):
-            for i in range(len(left)):
-                if left[-i] != right[-i]:
-                    break
-            if i > 42:
-                i -= 10     # Provide some context
-                explanation += [u('Skipping %s identical trailing '
-                                  'characters in diff, use -v to show') % i]
-                left = left[:-i]
-                right = right[:-i]
-    keepends = True
-    explanation += [line.strip('\n')
-                    for line in ndiff(left.splitlines(keepends),
-                                      right.splitlines(keepends))]
-    return explanation
-
-
-def _compare_eq_iterable(left, right, verbose=False):
-    if not verbose:
-        return [u('Use -v to get the full diff')]
-    # dynamic import to speedup pytest
-    import difflib
-
-    try:
-        left_formatting = pprint.pformat(left).splitlines()
-        right_formatting = pprint.pformat(right).splitlines()
-        explanation = [u('Full diff:')]
-    except Exception:
-        # hack: PrettyPrinter.pformat() in python 2 fails when formatting items that can't be sorted(), ie, calling
-        # sorted() on a list would raise. See issue #718.
-        # As a workaround, the full diff is generated by using the repr() string of each item of each container.
-        left_formatting = sorted(repr(x) for x in left)
-        right_formatting = sorted(repr(x) for x in right)
-        explanation = [u('Full diff (fallback to calling repr on each item):')]
-    explanation.extend(line.strip() for line in difflib.ndiff(left_formatting, right_formatting))
-    return explanation
-
-
-def _compare_eq_sequence(left, right, verbose=False):
-    explanation = []
-    for i in range(min(len(left), len(right))):
-        if left[i] != right[i]:
-            explanation += [u('At index %s diff: %r != %r')
-                            % (i, left[i], right[i])]
-            break
-    if len(left) > len(right):
-        explanation += [u('Left contains more items, first extra item: %s')
-                        % py.io.saferepr(left[len(right)],)]
-    elif len(left) < len(right):
-        explanation += [
-            u('Right contains more items, first extra item: %s') %
-            py.io.saferepr(right[len(left)],)]
-    return explanation
-
-
-def _compare_eq_set(left, right, verbose=False):
-    explanation = []
-    diff_left = left - right
-    diff_right = right - left
-    if diff_left:
-        explanation.append(u('Extra items in the left set:'))
-        for item in diff_left:
-            explanation.append(py.io.saferepr(item))
-    if diff_right:
-        explanation.append(u('Extra items in the right set:'))
-        for item in diff_right:
-            explanation.append(py.io.saferepr(item))
-    return explanation
-
-
-def _compare_eq_dict(left, right, verbose=False):
-    explanation = []
-    common = set(left).intersection(set(right))
-    same = dict((k, left[k]) for k in common if left[k] == right[k])
-    if same and verbose < 2:
-        explanation += [u('Omitting %s identical items, use -vv to show') %
-                        len(same)]
-    elif same:
-        explanation += [u('Common items:')]
-        explanation += pprint.pformat(same).splitlines()
-    diff = set(k for k in common if left[k] != right[k])
-    if diff:
-        explanation += [u('Differing items:')]
-        for k in diff:
-            explanation += [py.io.saferepr({k: left[k]}) + ' != ' +
-                            py.io.saferepr({k: right[k]})]
-    extra_left = set(left) - set(right)
-    if extra_left:
-        explanation.append(u('Left contains more items:'))
-        explanation.extend(pprint.pformat(
-            dict((k, left[k]) for k in extra_left)).splitlines())
-    extra_right = set(right) - set(left)
-    if extra_right:
-        explanation.append(u('Right contains more items:'))
-        explanation.extend(pprint.pformat(
-            dict((k, right[k]) for k in extra_right)).splitlines())
-    return explanation
-
-
-def _notin_text(term, text, verbose=False):
-    index = text.find(term)
-    head = text[:index]
-    tail = text[index + len(term):]
-    correct_text = head + tail
-    diff = _diff_text(correct_text, text, verbose)
-    newdiff = [u('%s is contained here:') % py.io.saferepr(term, maxsize=42)]
-    for line in diff:
-        if line.startswith(u('Skipping')):
-            continue
-        if line.startswith(u('- ')):
-            continue
-        if line.startswith(u('+ ')):
-            newdiff.append(u('  ') + line[2:])
-        else:
-            newdiff.append(line)
-    return newdiff
deleted file mode 100755
--- a/third_party/python/pytest/_pytest/cacheprovider.py
+++ /dev/null
@@ -1,260 +0,0 @@
-"""
-merged implementation of the cache provider
-
-the name cache was not chosen to ensure pluggy automatically
-ignores the external pytest-cache
-"""
-from __future__ import absolute_import, division, print_function
-import py
-import pytest
-import json
-import os
-from os.path import sep as _sep, altsep as _altsep
-
-
-class Cache(object):
-    def __init__(self, config):
-        self.config = config
-        self._cachedir = Cache.cache_dir_from_config(config)
-        self.trace = config.trace.root.get("cache")
-        if config.getvalue("cacheclear"):
-            self.trace("clearing cachedir")
-            if self._cachedir.check():
-                self._cachedir.remove()
-            self._cachedir.mkdir()
-
-    @staticmethod
-    def cache_dir_from_config(config):
-        cache_dir = config.getini("cache_dir")
-        cache_dir = os.path.expanduser(cache_dir)
-        cache_dir = os.path.expandvars(cache_dir)
-        if os.path.isabs(cache_dir):
-            return py.path.local(cache_dir)
-        else:
-            return config.rootdir.join(cache_dir)
-
-    def makedir(self, name):
-        """ return a directory path object with the given name.  If the
-        directory does not yet exist, it will be created.  You can use it
-        to manage files likes e. g. store/retrieve database
-        dumps across test sessions.
-
-        :param name: must be a string not containing a ``/`` separator.
-             Make sure the name contains your plugin or application
-             identifiers to prevent clashes with other cache users.
-        """
-        if _sep in name or _altsep is not None and _altsep in name:
-            raise ValueError("name is not allowed to contain path separators")
-        return self._cachedir.ensure_dir("d", name)
-
-    def _getvaluepath(self, key):
-        return self._cachedir.join('v', *key.split('/'))
-
-    def get(self, key, default):
-        """ return cached value for the given key.  If no value
-        was yet cached or the value cannot be read, the specified
-        default is returned.
-
-        :param key: must be a ``/`` separated value. Usually the first
-             name is the name of your plugin or your application.
-        :param default: must be provided in case of a cache-miss or
-             invalid cache values.
-
-        """
-        path = self._getvaluepath(key)
-        if path.check():
-            try:
-                with path.open("r") as f:
-                    return json.load(f)
-            except ValueError:
-                self.trace("cache-invalid at %s" % (path,))
-        return default
-
-    def set(self, key, value):
-        """ save value for the given key.
-
-        :param key: must be a ``/`` separated value. Usually the first
-             name is the name of your plugin or your application.
-        :param value: must be of any combination of basic
-               python types, including nested types
-               like e. g. lists of dictionaries.
-        """
-        path = self._getvaluepath(key)
-        try:
-            path.dirpath().ensure_dir()
-        except (py.error.EEXIST, py.error.EACCES):
-            self.config.warn(
-                code='I9', message='could not create cache path %s' % (path,)
-            )
-            return
-        try:
-            f = path.open('w')
-        except py.error.ENOTDIR:
-            self.config.warn(
-                code='I9', message='cache could not write path %s' % (path,))
-        else:
-            with f:
-                self.trace("cache-write %s: %r" % (key, value,))
-                json.dump(value, f, indent=2, sort_keys=True)
-
-
-class LFPlugin:
-    """ Plugin which implements the --lf (run last-failing) option """
-
-    def __init__(self, config):
-        self.config = config
-        active_keys = 'lf', 'failedfirst'
-        self.active = any(config.getvalue(key) for key in active_keys)
-        self.lastfailed = config.cache.get("cache/lastfailed", {})
-        self._previously_failed_count = None
-
-    def pytest_report_collectionfinish(self):
-        if self.active:
-            if not self._previously_failed_count:
-                mode = "run all (no recorded failures)"
-            else:
-                noun = 'failure' if self._previously_failed_count == 1 else 'failures'
-                suffix = " first" if self.config.getvalue("failedfirst") else ""
-                mode = "rerun previous {count} {noun}{suffix}".format(
-                    count=self._previously_failed_count, suffix=suffix, noun=noun
-                )
-            return "run-last-failure: %s" % mode
-
-    def pytest_runtest_logreport(self, report):
-        if (report.when == 'call' and report.passed) or report.skipped:
-            self.lastfailed.pop(report.nodeid, None)
-        elif report.failed:
-            self.lastfailed[report.nodeid] = True
-
-    def pytest_collectreport(self, report):
-        passed = report.outcome in ('passed', 'skipped')
-        if passed:
-            if report.nodeid in self.lastfailed:
-                self.lastfailed.pop(report.nodeid)
-                self.lastfailed.update(
-                    (item.nodeid, True)
-                    for item in report.result)
-        else:
-            self.lastfailed[report.nodeid] = True
-
-    def pytest_collection_modifyitems(self, session, config, items):
-        if self.active and self.lastfailed:
-            previously_failed = []
-            previously_passed = []
-            for item in items:
-                if item.nodeid in self.lastfailed:
-                    previously_failed.append(item)
-                else:
-                    previously_passed.append(item)
-            self._previously_failed_count = len(previously_failed)
-            if not previously_failed:
-                # running a subset of all tests with recorded failures outside
-                # of the set of tests currently executing
-                return
-            if self.config.getvalue("lf"):
-                items[:] = previously_failed
-                config.hook.pytest_deselected(items=previously_passed)
-            else:
-                items[:] = previously_failed + previously_passed
-
-    def pytest_sessionfinish(self, session):
-        config = self.config
-        if config.getvalue("cacheshow") or hasattr(config, "slaveinput"):
-            return
-
-        saved_lastfailed = config.cache.get("cache/lastfailed", {})
-        if saved_lastfailed != self.lastfailed:
-            config.cache.set("cache/lastfailed", self.lastfailed)
-
-
-def pytest_addoption(parser):
-    group = parser.getgroup("general")
-    group.addoption(
-        '--lf', '--last-failed', action='store_true', dest="lf",
-        help="rerun only the tests that failed "
-             "at the last run (or all if none failed)")
-    group.addoption(
-        '--ff', '--failed-first', action='store_true', dest="failedfirst",
-        help="run all tests but run the last failures first.  "
-             "This may re-order tests and thus lead to "
-             "repeated fixture setup/teardown")
-    group.addoption(
-        '--cache-show', action='store_true', dest="cacheshow",
-        help="show cache contents, don't perform collection or tests")
-    group.addoption(
-        '--cache-clear', action='store_true', dest="cacheclear",
-        help="remove all cache contents at start of test run.")
-    parser.addini(
-        "cache_dir", default='.cache',
-        help="cache directory path.")
-
-
-def pytest_cmdline_main(config):
-    if config.option.cacheshow:
-        from _pytest.main import wrap_session
-        return wrap_session(config, cacheshow)
-
-
-@pytest.hookimpl(tryfirst=True)
-def pytest_configure(config):
-    config.cache = Cache(config)
-    config.pluginmanager.register(LFPlugin(config), "lfplugin")
-
-
-@pytest.fixture
-def cache(request):
-    """
-    Return a cache object that can persist state between testing sessions.
-
-    cache.get(key, default)
-    cache.set(key, value)
-
-    Keys must be a ``/`` separated value, where the first part is usually the
-    name of your plugin or application to avoid clashes with other cache users.
-
-    Values can be any object handled by the json stdlib module.
-    """
-    return request.config.cache
-
-
-def pytest_report_header(config):
-    if config.option.verbose:
-        relpath = py.path.local().bestrelpath(config.cache._cachedir)
-        return "cachedir: %s" % relpath
-
-
-def cacheshow(config, session):
-    from pprint import pprint
-    tw = py.io.TerminalWriter()
-    tw.line("cachedir: " + str(config.cache._cachedir))
-    if not config.cache._cachedir.check():
-        tw.line("cache is empty")
-        return 0
-    dummy = object()
-    basedir = config.cache._cachedir
-    vdir = basedir.join("v")
-    tw.sep("-", "cache values")
-    for valpath in sorted(vdir.visit(lambda x: x.isfile())):
-        key = valpath.relto(vdir).replace(valpath.sep, "/")
-        val = config.cache.get(key, dummy)
-        if val is dummy:
-            tw.line("%s contains unreadable content, "
-                    "will be ignored" % key)
-        else:
-            tw.line("%s contains:" % key)
-            stream = py.io.TextIO()
-            pprint(val, stream=stream)
-            for line in stream.getvalue().splitlines():
-                tw.line("  " + line)
-
-    ddir = basedir.join("d")
-    if ddir.isdir() and ddir.listdir():
-        tw.sep("-", "cache directories")
-        for p in sorted(basedir.join("d").visit()):
-            # if p.check(dir=1):
-            #    print("%s/" % p.relto(basedir))
-            if p.isfile():
-                key = p.relto(basedir)
-                tw.line("%s is a file of length %d" % (
-                        key, p.size()))
-    return 0
deleted file mode 100644
--- a/third_party/python/pytest/_pytest/capture.py
+++ /dev/null
@@ -1,577 +0,0 @@
-"""
-per-test stdout/stderr capturing mechanism.
-
-"""
-from __future__ import absolute_import, division, print_function
-
-import contextlib
-import sys
-import os
-import io
-from io import UnsupportedOperation
-from tempfile import TemporaryFile
-
-import py
-import pytest
-from _pytest.compat import CaptureIO
-
-unicode = py.builtin.text
-
-patchsysdict = {0: 'stdin', 1: 'stdout', 2: 'stderr'}
-
-
-def pytest_addoption(parser):
-    group = parser.getgroup("general")
-    group._addoption(
-        '--capture', action="store",
-        default="fd" if hasattr(os, "dup") else "sys",
-        metavar="method", choices=['fd', 'sys', 'no'],
-        help="per-test capturing method: one of fd|sys|no.")
-    group._addoption(
-        '-s', action="store_const", const="no", dest="capture",
-        help="shortcut for --capture=no.")
-
-
-@pytest.hookimpl(hookwrapper=True)
-def pytest_load_initial_conftests(early_config, parser, args):
-    ns = early_config.known_args_namespace
-    if ns.capture == "fd":
-        _py36_windowsconsoleio_workaround(sys.stdout)
-    _colorama_workaround()
-    _readline_workaround()
-    pluginmanager = early_config.pluginmanager
-    capman = CaptureManager(ns.capture)
-    pluginmanager.register(capman, "capturemanager")
-
-    # make sure that capturemanager is properly reset at final shutdown
-    early_config.add_cleanup(capman.reset_capturings)
-
-    # make sure logging does not raise exceptions at the end
-    def silence_logging_at_shutdown():
-        if "logging" in sys.modules:
-            sys.modules["logging"].raiseExceptions = False
-    early_config.add_cleanup(silence_logging_at_shutdown)
-
-    # finally trigger conftest loading but while capturing (issue93)
-    capman.init_capturings()
-    outcome = yield
-    out, err = capman.suspendcapture()
-    if outcome.excinfo is not None:
-        sys.stdout.write(out)
-        sys.stderr.write(err)
-
-
-class CaptureManager:
-    def __init__(self, method):
-        self._method = method
-
-    def _getcapture(self, method):
-        if method == "fd":
-            return MultiCapture(out=True, err=True, Capture=FDCapture)
-        elif method == "sys":
-            return MultiCapture(out=True, err=True, Capture=SysCapture)
-        elif method == "no":
-            return MultiCapture(out=False, err=False, in_=False)
-        else:
-            raise ValueError("unknown capturing method: %r" % method)
-
-    def init_capturings(self):
-        assert not hasattr(self, "_capturing")
-        self._capturing = self._getcapture(self._method)
-        self._capturing.start_capturing()
-
-    def reset_capturings(self):
-        cap = self.__dict__.pop("_capturing", None)
-        if cap is not None:
-            cap.pop_outerr_to_orig()
-            cap.stop_capturing()
-
-    def resumecapture(self):
-        self._capturing.resume_capturing()
-
-    def suspendcapture(self, in_=False):
-        self.deactivate_funcargs()
-        cap = getattr(self, "_capturing", None)
-        if cap is not None:
-            try:
-                outerr = cap.readouterr()
-            finally:
-                cap.suspend_capturing(in_=in_)
-            return outerr
-
-    def activate_funcargs(self, pyfuncitem):
-        capfuncarg = pyfuncitem.__dict__.pop("_capfuncarg", None)
-        if capfuncarg is not None:
-            capfuncarg._start()
-            self._capfuncarg = capfuncarg
-
-    def deactivate_funcargs(self):
-        capfuncarg = self.__dict__.pop("_capfuncarg", None)
-        if capfuncarg is not None:
-            capfuncarg.close()
-
-    @pytest.hookimpl(hookwrapper=True)
-    def pytest_make_collect_report(self, collector):
-        if isinstance(collector, pytest.File):
-            self.resumecapture()
-            outcome = yield
-            out, err = self.suspendcapture()
-            rep = outcome.get_result()
-            if out:
-                rep.sections.append(("Captured stdout", out))
-            if err:
-                rep.sections.append(("Captured stderr", err))
-        else:
-            yield
-
-    @pytest.hookimpl(hookwrapper=True)
-    def pytest_runtest_setup(self, item):
-        self.resumecapture()
-        yield
-        self.suspendcapture_item(item, "setup")
-
-    @pytest.hookimpl(hookwrapper=True)
-    def pytest_runtest_call(self, item):
-        self.resumecapture()
-        self.activate_funcargs(item)
-        yield
-        # self.deactivate_funcargs() called from suspendcapture()
-        self.suspendcapture_item(item, "call")
-
-    @pytest.hookimpl(hookwrapper=True)
-    def pytest_runtest_teardown(self, item):
-        self.resumecapture()
-        yield
-        self.suspendcapture_item(item, "teardown")
-
-    @pytest.hookimpl(tryfirst=True)
-    def pytest_keyboard_interrupt(self, excinfo):
-        self.reset_capturings()
-
-    @pytest.hookimpl(tryfirst=True)
-    def pytest_internalerror(self, excinfo):
-        self.reset_capturings()
-
-    def suspendcapture_item(self, item, when, in_=False):
-        out, err = self.suspendcapture(in_=in_)
-        item.add_report_section(when, "stdout", out)
-        item.add_report_section(when, "stderr", err)
-
-
-error_capsysfderror = "cannot use capsys and capfd at the same time"
-
-
-@pytest.fixture
-def capsys(request):
-    """Enable capturing of writes to sys.stdout/sys.stderr and make
-    captured output available via ``capsys.readouterr()`` method calls
-    which return a ``(out, err)`` tuple.
-    """
-    if "capfd" in request.fixturenames:
-        raise request.raiseerror(error_capsysfderror)
-    request.node._capfuncarg = c = CaptureFixture(SysCapture, request)
-    return c
-
-
-@pytest.fixture
-def capfd(request):
-    """Enable capturing of writes to file descriptors 1 and 2 and make
-    captured output available via ``capfd.readouterr()`` method calls
-    which return a ``(out, err)`` tuple.
-    """
-    if "capsys" in request.fixturenames:
-        request.raiseerror(error_capsysfderror)
-    if not hasattr(os, 'dup'):
-        pytest.skip("capfd funcarg needs os.dup")
-    request.node._capfuncarg = c = CaptureFixture(FDCapture, request)
-    return c
-
-
-class CaptureFixture:
-    def __init__(self, captureclass, request):
-        self.captureclass = captureclass
-        self.request = request
-
-    def _start(self):
-        self._capture = MultiCapture(out=True, err=True, in_=False,
-                                     Capture=self.captureclass)
-        self._capture.start_capturing()
-
-    def close(self):
-        cap = self.__dict__.pop("_capture", None)
-        if cap is not None:
-            self._outerr = cap.pop_outerr_to_orig()
-            cap.stop_capturing()
-
-    def readouterr(self):
-        try:
-            return self._capture.readouterr()
-        except AttributeError:
-            return self._outerr
-
-    @contextlib.contextmanager
-    def disabled(self):
-        capmanager = self.request.config.pluginmanager.getplugin('capturemanager')
-        capmanager.suspendcapture_item(self.request.node, "call", in_=True)
-        try:
-            yield
-        finally:
-            capmanager.resumecapture()
-
-
-def safe_text_dupfile(f, mode, default_encoding="UTF8"):
-    """ return a open text file object that's a duplicate of f on the
-        FD-level if possible.
-    """
-    encoding = getattr(f, "encoding", None)
-    try:
-        fd = f.fileno()
-    except Exception:
-        if "b" not in getattr(f, "mode", "") and hasattr(f, "encoding"):
-            # we seem to have a text stream, let's just use it
-            return f
-    else:
-        newfd = os.dup(fd)
-        if "b" not in mode:
-            mode += "b"
-        f = os.fdopen(newfd, mode, 0)  # no buffering
-    return EncodedFile(f, encoding or default_encoding)
-
-
-class EncodedFile(object):
-    errors = "strict"  # possibly needed by py3 code (issue555)
-
-    def __init__(self, buffer, encoding):
-        self.buffer = buffer
-        self.encoding = encoding
-
-    def write(self, obj):
-        if isinstance(obj, unicode):
-            obj = obj.encode(self.encoding, "replace")
-        self.buffer.write(obj)
-
-    def writelines(self, linelist):
-        data = ''.join(linelist)
-        self.write(data)
-
-    @property
-    def name(self):
-        """Ensure that file.name is a string."""
-        return repr(self.buffer)
-
-    def __getattr__(self, name):
-        return getattr(object.__getattribute__(self, "buffer"), name)
-
-
-class MultiCapture(object):
-    out = err = in_ = None
-
-    def __init__(self, out=True, err=True, in_=True, Capture=None):
-        if in_:
-            self.in_ = Capture(0)
-        if out:
-            self.out = Capture(1)
-        if err:
-            self.err = Capture(2)
-
-    def start_capturing(self):
-        if self.in_:
-            self.in_.start()
-        if self.out:
-            self.out.start()
-        if self.err:
-            self.err.start()
-
-    def pop_outerr_to_orig(self):
-        """ pop current snapshot out/err capture and flush to orig streams. """
-        out, err = self.readouterr()
-        if out:
-            self.out.writeorg(out)
-        if err:
-            self.err.writeorg(err)
-        return out, err
-
-    def suspend_capturing(self, in_=False):
-        if self.out:
-            self.out.suspend()
-        if self.err:
-            self.err.suspend()
-        if in_ and self.in_:
-            self.in_.suspend()
-            self._in_suspended = True
-
-    def resume_capturing(self):
-        if self.out:
-            self.out.resume()
-        if self.err:
-            self.err.resume()
-        if hasattr(self, "_in_suspended"):
-            self.in_.resume()
-            del self._in_suspended
-
-    def stop_capturing(self):
-        """ stop capturing and reset capturing streams """
-        if hasattr(self, '_reset'):
-            raise ValueError("was already stopped")
-        self._reset = True
-        if self.out:
-            self.out.done()
-        if self.err:
-            self.err.done()
-        if self.in_:
-            self.in_.done()
-
-    def readouterr(self):
-        """ return snapshot unicode value of stdout/stderr capturings. """
-        return (self.out.snap() if self.out is not None else "",
-                self.err.snap() if self.err is not None else "")
-
-
-class NoCapture:
-    __init__ = start = done = suspend = resume = lambda *args: None
-
-
-class FDCapture:
-    """ Capture IO to/from a given os-level filedescriptor. """
-
-    def __init__(self, targetfd, tmpfile=None):
-        self.targetfd = targetfd
-        try:
-            self.targetfd_save = os.dup(self.targetfd)
-        except OSError:
-            self.start = lambda: None
-            self.done = lambda: None
-        else:
-            if targetfd == 0:
-                assert not tmpfile, "cannot set tmpfile with stdin"
-                tmpfile = open(os.devnull, "r")
-                self.syscapture = SysCapture(targetfd)
-            else:
-                if tmpfile is None:
-                    f = TemporaryFile()
-                    with f:
-                        tmpfile = safe_text_dupfile(f, mode="wb+")
-                if targetfd in patchsysdict:
-                    self.syscapture = SysCapture(targetfd, tmpfile)
-                else:
-                    self.syscapture = NoCapture()
-            self.tmpfile = tmpfile
-            self.tmpfile_fd = tmpfile.fileno()
-
-    def __repr__(self):
-        return "<FDCapture %s oldfd=%s>" % (self.targetfd, self.targetfd_save)
-
-    def start(self):
-        """ Start capturing on targetfd using memorized tmpfile. """
-        try:
-            os.fstat(self.targetfd_save)
-        except (AttributeError, OSError):
-            raise ValueError("saved filedescriptor not valid anymore")
-        os.dup2(self.tmpfile_fd, self.targetfd)
-        self.syscapture.start()
-
-    def snap(self):
-        f = self.tmpfile
-        f.seek(0)
-        res = f.read()
-        if res:
-            enc = getattr(f, "encoding", None)
-            if enc and isinstance(res, bytes):
-                res = py.builtin._totext(res, enc, "replace")
-            f.truncate(0)
-            f.seek(0)
-            return res
-        return ''
-
-    def done(self):
-        """ stop capturing, restore streams, return original capture file,
-        seeked to position zero. """
-        targetfd_save = self.__dict__.pop("targetfd_save")
-        os.dup2(targetfd_save, self.targetfd)
-        os.close(targetfd_save)
-        self.syscapture.done()
-        self.tmpfile.close()
-
-    def suspend(self):
-        self.syscapture.suspend()
-        os.dup2(self.targetfd_save, self.targetfd)
-
-    def resume(self):
-        self.syscapture.resume()
-        os.dup2(self.tmpfile_fd, self.targetfd)
-
-    def writeorg(self, data):
-        """ write to original file descriptor. """
-        if py.builtin._istext(data):
-            data = data.encode("utf8")  # XXX use encoding of original stream
-        os.write(self.targetfd_save, data)
-
-
-class SysCapture:
-    def __init__(self, fd, tmpfile=None):
-        name = patchsysdict[fd]
-        self._old = getattr(sys, name)
-        self.name = name
-        if tmpfile is None:
-            if name == "stdin":
-                tmpfile = DontReadFromInput()
-            else:
-                tmpfile = CaptureIO()
-        self.tmpfile = tmpfile
-
-    def start(self):
-        setattr(sys, self.name, self.tmpfile)
-
-    def snap(self):
-        f = self.tmpfile
-        res = f.getvalue()
-        f.truncate(0)
-        f.seek(0)
-        return res
-
-    def done(self):
-        setattr(sys, self.name, self._old)
-        del self._old
-        self.tmpfile.close()
-
-    def suspend(self):
-        setattr(sys, self.name, self._old)
-
-    def resume(self):
-        setattr(sys, self.name, self.tmpfile)
-
-    def writeorg(self, data):
-        self._old.write(data)
-        self._old.flush()
-
-
-class DontReadFromInput:
-    """Temporary stub class.  Ideally when stdin is accessed, the
-    capturing should be turned off, with possibly all data captured
-    so far sent to the screen.  This should be configurable, though,
-    because in automated test runs it is better to crash than
-    hang indefinitely.
-    """
-
-    encoding = None
-
-    def read(self, *args):
-        raise IOError("reading from stdin while output is captured")
-    readline = read
-    readlines = read
-    __iter__ = read
-
-    def fileno(self):
-        raise UnsupportedOperation("redirected stdin is pseudofile, "
-                                   "has no fileno()")
-
-    def isatty(self):
-        return False
-
-    def close(self):
-        pass
-
-    @property
-    def buffer(self):
-        if sys.version_info >= (3, 0):
-            return self
-        else:
-            raise AttributeError('redirected stdin has no attribute buffer')
-
-
-def _colorama_workaround():
-    """
-    Ensure colorama is imported so that it attaches to the correct stdio
-    handles on Windows.
-
-    colorama uses the terminal on import time. So if something does the
-    first import of colorama while I/O capture is active, colorama will
-    fail in various ways.
-    """
-
-    if not sys.platform.startswith('win32'):
-        return
-    try:
-        import colorama  # noqa
-    except ImportError:
-        pass
-
-
-def _readline_workaround():
-    """
-    Ensure readline is imported so that it attaches to the correct stdio
-    handles on Windows.
-
-    Pdb uses readline support where available--when not running from the Python
-    prompt, the readline module is not imported until running the pdb REPL.  If
-    running pytest with the --pdb option this means the readline module is not
-    imported until after I/O capture has been started.
-
-    This is a problem for pyreadline, which is often used to implement readline
-    support on Windows, as it does not attach to the correct handles for stdout
-    and/or stdin if they have been redirected by the FDCapture mechanism.  This
-    workaround ensures that readline is imported before I/O capture is setup so
-    that it can attach to the actual stdin/out for the console.
-
-    See https://github.com/pytest-dev/pytest/pull/1281
-    """
-
-    if not sys.platform.startswith('win32'):
-        return
-    try:
-        import readline  # noqa
-    except ImportError:
-        pass
-
-
-def _py36_windowsconsoleio_workaround(stream):
-    """
-    Python 3.6 implemented unicode console handling for Windows. This works
-    by reading/writing to the raw console handle using
-    ``{Read,Write}ConsoleW``.
-
-    The problem is that we are going to ``dup2`` over the stdio file
-    descriptors when doing ``FDCapture`` and this will ``CloseHandle`` the
-    handles used by Python to write to the console. Though there is still some
-    weirdness and the console handle seems to only be closed randomly and not
-    on the first call to ``CloseHandle``, or maybe it gets reopened with the
-    same handle value when we suspend capturing.
-
-    The workaround in this case will reopen stdio with a different fd which
-    also means a different handle by replicating the logic in
-    "Py_lifecycle.c:initstdio/create_stdio".
-
-    :param stream: in practice ``sys.stdout`` or ``sys.stderr``, but given
-        here as parameter for unittesting purposes.
-
-    See https://github.com/pytest-dev/py/issues/103
-    """
-    if not sys.platform.startswith('win32') or sys.version_info[:2] < (3, 6):
-        return
-
-    # bail out if ``stream`` doesn't seem like a proper ``io`` stream (#2666)
-    if not hasattr(stream, 'buffer'):
-        return
-
-    buffered = hasattr(stream.buffer, 'raw')
-    raw_stdout = stream.buffer.raw if buffered else stream.buffer
-
-    if not isinstance(raw_stdout, io._WindowsConsoleIO):
-        return
-
-    def _reopen_stdio(f, mode):
-        if not buffered and mode[0] == 'w':
-            buffering = 0
-        else:
-            buffering = -1
-
-        return io.TextIOWrapper(
-            open(os.dup(f.fileno()), mode, buffering),
-            f.encoding,
-            f.errors,
-            f.newlines,
-            f.line_buffering)
-
-    sys.__stdin__ = sys.stdin = _reopen_stdio(sys.stdin, 'rb')
-    sys.__stdout__ = sys.stdout = _reopen_stdio(sys.stdout, 'wb')
-    sys.__stderr__ = sys.stderr = _reopen_stdio(sys.stderr, 'wb')
deleted file mode 100644
--- a/third_party/python/pytest/_pytest/compat.py
+++ /dev/null
@@ -1,326 +0,0 @@
-"""
-python version compatibility code
-"""
-from __future__ import absolute_import, division, print_function
-import sys
-import inspect
-import types
-import re
-import functools
-
-import py
-
-import _pytest
-from _pytest.outcomes import TEST_OUTCOME
-
-
-try:
-    import enum
-except ImportError:  # pragma: no cover
-    # Only available in Python 3.4+ or as a backport
-    enum = None
-
-
-_PY3 = sys.version_info > (3, 0)
-_PY2 = not _PY3
-
-
-NoneType = type(None)
-NOTSET = object()
-
-PY35 = sys.version_info[:2] >= (3, 5)
-PY36 = sys.version_info[:2] >= (3, 6)
-MODULE_NOT_FOUND_ERROR = 'ModuleNotFoundError' if PY36 else 'ImportError'
-
-if hasattr(inspect, 'signature'):
-    def _format_args(func):
-        return str(inspect.signature(func))
-else:
-    def _format_args(func):
-        return inspect.formatargspec(*inspect.getargspec(func))
-
-isfunction = inspect.isfunction
-isclass = inspect.isclass
-# used to work around a python2 exception info leak
-exc_clear = getattr(sys, 'exc_clear', lambda: None)
-# The type of re.compile objects is not exposed in Python.
-REGEX_TYPE = type(re.compile(''))
-
-
-def is_generator(func):
-    genfunc = inspect.isgeneratorfunction(func)
-    return genfunc and not iscoroutinefunction(func)
-
-
-def iscoroutinefunction(func):
-    """Return True if func is a decorated coroutine function.
-
-    Note: copied and modified from Python 3.5's builtin couroutines.py to avoid import asyncio directly,
-    which in turns also initializes the "logging" module as side-effect (see issue #8).
-    """
-    return (getattr(func, '_is_coroutine', False) or
-            (hasattr(inspect, 'iscoroutinefunction') and inspect.iscoroutinefunction(func)))
-
-
-def getlocation(function, curdir):
-    import inspect
-    fn = py.path.local(inspect.getfile(function))
-    lineno = py.builtin._getcode(function).co_firstlineno
-    if fn.relto(curdir):
-        fn = fn.relto(curdir)
-    return "%s:%d" % (fn, lineno + 1)
-
-
-def num_mock_patch_args(function):
-    """ return number of arguments used up by mock arguments (if any) """
-    patchings = getattr(function, "patchings", None)
-    if not patchings:
-        return 0
-    mock = sys.modules.get("mock", sys.modules.get("unittest.mock", None))
-    if mock is not None:
-        return len([p for p in patchings
-                    if not p.attribute_name and p.new is mock.DEFAULT])
-    return len(patchings)
-
-
-def getfuncargnames(function, startindex=None, cls=None):
-    """
-    @RonnyPfannschmidt: This function should be refactored when we revisit fixtures. The
-    fixture mechanism should ask the node for the fixture names, and not try to obtain
-    directly from the function object well after collection has occurred.
-    """
-    if startindex is None and cls is not None:
-        is_staticmethod = isinstance(cls.__dict__.get(function.__name__, None), staticmethod)
-        startindex = 0 if is_staticmethod else 1
-    # XXX merge with main.py's varnames
-    # assert not isclass(function)
-    realfunction = function
-    while hasattr(realfunction, "__wrapped__"):
-        realfunction = realfunction.__wrapped__
-    if startindex is None:
-        startindex = inspect.ismethod(function) and 1 or 0
-    if realfunction != function:
-        startindex += num_mock_patch_args(function)
-        function = realfunction
-    if isinstance(function, functools.partial):
-        argnames = inspect.getargs(_pytest._code.getrawcode(function.func))[0]
-        partial = function
-        argnames = argnames[len(partial.args):]
-        if partial.keywords:
-            for kw in partial.keywords:
-                argnames.remove(kw)
-    else:
-        argnames = inspect.getargs(_pytest._code.getrawcode(function))[0]
-    defaults = getattr(function, 'func_defaults',
-                       getattr(function, '__defaults__', None)) or ()
-    numdefaults = len(defaults)
-    if numdefaults:
-        return tuple(argnames[startindex:-numdefaults])
-    return tuple(argnames[startindex:])
-
-
-if sys.version_info[:2] == (2, 6):
-    def isclass(object):
-        """ Return true if the object is a class. Overrides inspect.isclass for
-        python 2.6 because it will return True for objects which always return
-        something on __getattr__ calls (see #1035).
-        Backport of https://hg.python.org/cpython/rev/35bf8f7a8edc
-        """
-        return isinstance(object, (type, types.ClassType))
-
-
-if _PY3:
-    import codecs
-    imap = map
-    izip = zip
-    STRING_TYPES = bytes, str
-    UNICODE_TYPES = str,
-
-    def _ascii_escaped(val):
-        """If val is pure ascii, returns it as a str().  Otherwise, escapes
-        bytes objects into a sequence of escaped bytes:
-
-        b'\xc3\xb4\xc5\xd6' -> u'\\xc3\\xb4\\xc5\\xd6'
-
-        and escapes unicode objects into a sequence of escaped unicode
-        ids, e.g.:
-
-        '4\\nV\\U00043efa\\x0eMXWB\\x1e\\u3028\\u15fd\\xcd\\U0007d944'
-
-        note:
-           the obvious "v.decode('unicode-escape')" will return
-           valid utf-8 unicode if it finds them in bytes, but we
-           want to return escaped bytes for any byte, even if they match
-           a utf-8 string.
-
-        """
-        if isinstance(val, bytes):
-            if val:
-                # source: http://goo.gl/bGsnwC
-                encoded_bytes, _ = codecs.escape_encode(val)
-                return encoded_bytes.decode('ascii')
-            else:
-                # empty bytes crashes codecs.escape_encode (#1087)
-                return ''
-        else:
-            return val.encode('unicode_escape').decode('ascii')
-else:
-    STRING_TYPES = bytes, str, unicode
-    UNICODE_TYPES = unicode,
-
-    from itertools import imap, izip  # NOQA
-
-    def _ascii_escaped(val):
-        """In py2 bytes and str are the same type, so return if it's a bytes
-        object, return it unchanged if it is a full ascii string,
-        otherwise escape it into its binary form.
-
-        If it's a unicode string, change the unicode characters into
-        unicode escapes.
-
-        """
-        if isinstance(val, bytes):
-            try:
-                return val.encode('ascii')
-            except UnicodeDecodeError:
-                return val.encode('string-escape')
-        else:
-            return val.encode('unicode-escape')
-
-
-def get_real_func(obj):
-    """ gets the real function object of the (possibly) wrapped object by
-    functools.wraps or functools.partial.
-    """
-    start_obj = obj
-    for i in range(100):
-        new_obj = getattr(obj, '__wrapped__', None)
-        if new_obj is None:
-            break
-        obj = new_obj
-    else:
-        raise ValueError(
-            ("could not find real function of {start}"
-             "\nstopped at {current}").format(
-                start=py.io.saferepr(start_obj),
-                current=py.io.saferepr(obj)))
-    if isinstance(obj, functools.partial):
-        obj = obj.func
-    return obj
-
-
-def getfslineno(obj):
-    # xxx let decorators etc specify a sane ordering
-    obj = get_real_func(obj)
-    if hasattr(obj, 'place_as'):
-        obj = obj.place_as
-    fslineno = _pytest._code.getfslineno(obj)
-    assert isinstance(fslineno[1], int), obj
-    return fslineno
-
-
-def getimfunc(func):
-    try:
-        return func.__func__
-    except AttributeError:
-        try:
-            return func.im_func
-        except AttributeError:
-            return func
-
-
-def safe_getattr(object, name, default):
-    """ Like getattr but return default upon any Exception or any OutcomeException.
-
-    Attribute access can potentially fail for 'evil' Python objects.
-    See issue #214.
-    It catches OutcomeException because of #2490 (issue #580), new outcomes are derived from BaseException
-    instead of Exception (for more details check #2707)
-    """
-    try:
-        return getattr(object, name, default)
-    except TEST_OUTCOME:
-        return default
-
-
-def _is_unittest_unexpected_success_a_failure():
-    """Return if the test suite should fail if a @expectedFailure unittest test PASSES.
-
-    From https://docs.python.org/3/library/unittest.html?highlight=unittest#unittest.TestResult.wasSuccessful:
-        Changed in version 3.4: Returns False if there were any
-        unexpectedSuccesses from tests marked with the expectedFailure() decorator.
-    """
-    return sys.version_info >= (3, 4)
-
-
-if _PY3:
-    def safe_str(v):
-        """returns v as string"""
-        return str(v)
-else:
-    def safe_str(v):
-        """returns v as string, converting to ascii if necessary"""
-        try:
-            return str(v)
-        except UnicodeError:
-            if not isinstance(v, unicode):
-                v = unicode(v)
-            errors = 'replace'
-            return v.encode('utf-8', errors)
-
-
-COLLECT_FAKEMODULE_ATTRIBUTES = (
-    'Collector',
-    'Module',
-    'Generator',
-    'Function',
-    'Instance',
-    'Session',
-    'Item',
-    'Class',
-    'File',
-    '_fillfuncargs',
-)
-
-
-def _setup_collect_fakemodule():
-    from types import ModuleType
-    import pytest
-    pytest.collect = ModuleType('pytest.collect')
-    pytest.collect.__all__ = []  # used for setns
-    for attr in COLLECT_FAKEMODULE_ATTRIBUTES:
-        setattr(pytest.collect, attr, getattr(pytest, attr))
-
-
-if _PY2:
-    # Without this the test_dupfile_on_textio will fail, otherwise CaptureIO could directly inherit from StringIO.
-    from py.io import TextIO
-
-    class CaptureIO(TextIO):
-
-        @property
-        def encoding(self):
-            return getattr(self, '_encoding', 'UTF-8')
-
-else:
-    import io
-
-    class CaptureIO(io.TextIOWrapper):
-        def __init__(self):
-            super(CaptureIO, self).__init__(
-                io.BytesIO(),
-                encoding='UTF-8', newline='', write_through=True,
-            )
-
-        def getvalue(self):
-            return self.buffer.getvalue().decode('UTF-8')
-
-
-class FuncargnamesCompatAttr(object):
-    """ helper class so that Metafunc, Function and FixtureRequest
-    don't need to each define the "funcargnames" compatibility attribute.
-    """
-    @property
-    def funcargnames(self):
-        """ alias attribute for ``fixturenames`` for pre-2.3 compatibility"""
-        return self.fixturenames
deleted file mode 100644
--- a/third_party/python/pytest/_pytest/config.py
+++ /dev/null
@@ -1,1414 +0,0 @@
-""" command line options, ini-file and conftest.py processing. """
-from __future__ import absolute_import, division, print_function
-import argparse
-import shlex
-import traceback
-import types
-import warnings
-
-import py
-# DON't import pytest here because it causes import cycle troubles
-import sys
-import os
-import _pytest._code
-import _pytest.hookspec  # the extension point definitions
-import _pytest.assertion
-from _pytest._pluggy import PluginManager, HookimplMarker, HookspecMarker
-from _pytest.compat import safe_str
-
-hookimpl = HookimplMarker("pytest")
-hookspec = HookspecMarker("pytest")
-
-# pytest startup
-#
-
-
-class ConftestImportFailure(Exception):
-    def __init__(self, path, excinfo):
-        Exception.__init__(self, path, excinfo)
-        self.path = path
-        self.excinfo = excinfo
-
-    def __str__(self):
-        etype, evalue, etb = self.excinfo
-        formatted = traceback.format_tb(etb)
-        # The level of the tracebacks we want to print is hand crafted :(
-        return repr(evalue) + '\n' + ''.join(formatted[2:])
-
-
-def main(args=None, plugins=None):
-    """ return exit code, after performing an in-process test run.
-
-    :arg args: list of command line arguments.
-
-    :arg plugins: list of plugin objects to be auto-registered during
-                  initialization.
-    """
-    try:
-        try:
-            config = _prepareconfig(args, plugins)
-        except ConftestImportFailure as e:
-            tw = py.io.TerminalWriter(sys.stderr)
-            for line in traceback.format_exception(*e.excinfo):
-                tw.line(line.rstrip(), red=True)
-            tw.line("ERROR: could not load %s\n" % (e.path), red=True)
-            return 4
-        else:
-            try:
-                return config.hook.pytest_cmdline_main(config=config)
-            finally:
-                config._ensure_unconfigure()
-    except UsageError as e:
-        for msg in e.args:
-            sys.stderr.write("ERROR: %s\n" % (msg,))
-        return 4
-
-
-class cmdline:  # compatibility namespace
-    main = staticmethod(main)
-
-
-class UsageError(Exception):
-    """ error in pytest usage or invocation"""
-
-
-class PrintHelp(Exception):
-    """Raised when pytest should print it's help to skip the rest of the
-    argument parsing and validation."""
-    pass
-
-
-def filename_arg(path, optname):
-    """ Argparse type validator for filename arguments.
-
-    :path: path of filename
-    :optname: name of the option
-    """
-    if os.path.isdir(path):
-        raise UsageError("{0} must be a filename, given: {1}".format(optname, path))
-    return path
-
-
-def directory_arg(path, optname):
-    """Argparse type validator for directory arguments.
-
-    :path: path of directory
-    :optname: name of the option
-    """
-    if not os.path.isdir(path):
-        raise UsageError("{0} must be a directory, given: {1}".format(optname, path))
-    return path
-
-
-_preinit = []
-
-default_plugins = (
-    "mark main terminal runner python fixtures debugging unittest capture skipping "
-    "tmpdir monkeypatch recwarn pastebin helpconfig nose assertion "
-    "junitxml resultlog doctest cacheprovider freeze_support "
-    "setuponly setupplan warnings").split()
-
-
-builtin_plugins = set(default_plugins)
-builtin_plugins.add("pytester")
-
-
-def _preloadplugins():
-    assert not _preinit
-    _preinit.append(get_config())
-
-
-def get_config():
-    if _preinit:
-        return _preinit.pop(0)
-    # subsequent calls to main will create a fresh instance
-    pluginmanager = PytestPluginManager()
-    config = Config(pluginmanager)
-    for spec in default_plugins:
-        pluginmanager.import_plugin(spec)
-    return config
-
-
-def get_plugin_manager():
-    """
-    Obtain a new instance of the
-    :py:class:`_pytest.config.PytestPluginManager`, with default plugins
-    already loaded.
-
-    This function can be used by integration with other tools, like hooking
-    into pytest to run tests into an IDE.
-    """
-    return get_config().pluginmanager
-
-
-def _prepareconfig(args=None, plugins=None):
-    warning = None
-    if args is None:
-        args = sys.argv[1:]
-    elif isinstance(args, py.path.local):
-        args = [str(args)]
-    elif not isinstance(args, (tuple, list)):
-        if not isinstance(args, str):
-            raise ValueError("not a string or argument list: %r" % (args,))
-        args = shlex.split(args, posix=sys.platform != "win32")
-        from _pytest import deprecated
-        warning = deprecated.MAIN_STR_ARGS
-    config = get_config()
-    pluginmanager = config.pluginmanager
-    try:
-        if plugins:
-            for plugin in plugins:
-                if isinstance(plugin, py.builtin._basestring):
-                    pluginmanager.consider_pluginarg(plugin)
-                else:
-                    pluginmanager.register(plugin)
-        if warning:
-            config.warn('C1', warning)
-        return pluginmanager.hook.pytest_cmdline_parse(
-            pluginmanager=pluginmanager, args=args)
-    except BaseException:
-        config._ensure_unconfigure()
-        raise
-
-
-class PytestPluginManager(PluginManager):
-    """
-    Overwrites :py:class:`pluggy.PluginManager <_pytest.vendored_packages.pluggy.PluginManager>` to add pytest-specific
-    functionality:
-
-    * loading plugins from the command line, ``PYTEST_PLUGIN`` env variable and
-      ``pytest_plugins`` global variables found in plugins being loaded;
-    * ``conftest.py`` loading during start-up;
-    """
-
-    def __init__(self):
-        super(PytestPluginManager, self).__init__("pytest", implprefix="pytest_")
-        self._conftest_plugins = set()
-
-        # state related to local conftest plugins
-        self._path2confmods = {}
-        self._conftestpath2mod = {}
-        self._confcutdir = None
-        self._noconftest = False
-        self._duplicatepaths = set()
-
-        self.add_hookspecs(_pytest.hookspec)
-        self.register(self)
-        if os.environ.get('PYTEST_DEBUG'):
-            err = sys.stderr
-            encoding = getattr(err, 'encoding', 'utf8')
-            try:
-                err = py.io.dupfile(err, encoding=encoding)
-            except Exception:
-                pass
-            self.trace.root.setwriter(err.write)
-            self.enable_tracing()
-
-        # Config._consider_importhook will set a real object if required.
-        self.rewrite_hook = _pytest.assertion.DummyRewriteHook()
-
-    def addhooks(self, module_or_class):
-        """
-        .. deprecated:: 2.8
-
-        Use :py:meth:`pluggy.PluginManager.add_hookspecs <_pytest.vendored_packages.pluggy.PluginManager.add_hookspecs>`
-        instead.
-        """
-        warning = dict(code="I2",
-                       fslocation=_pytest._code.getfslineno(sys._getframe(1)),
-                       nodeid=None,
-                       message="use pluginmanager.add_hookspecs instead of "
-                               "deprecated addhooks() method.")
-        self._warn(warning)
-        return self.add_hookspecs(module_or_class)
-
-    def parse_hookimpl_opts(self, plugin, name):
-        # pytest hooks are always prefixed with pytest_
-        # so we avoid accessing possibly non-readable attributes
-        # (see issue #1073)
-        if not name.startswith("pytest_"):
-            return
-        # ignore some historic special names which can not be hooks anyway
-        if name == "pytest_plugins" or name.startswith("pytest_funcarg__"):
-            return
-
-        method = getattr(plugin, name)
-        opts = super(PytestPluginManager, self).parse_hookimpl_opts(plugin, name)
-        if opts is not None:
-            for name in ("tryfirst", "trylast", "optionalhook", "hookwrapper"):
-                opts.setdefault(name, hasattr(method, name))
-        return opts
-
-    def parse_hookspec_opts(self, module_or_class, name):
-        opts = super(PytestPluginManager, self).parse_hookspec_opts(
-            module_or_class, name)
-        if opts is None:
-            method = getattr(module_or_class, name)
-            if name.startswith("pytest_"):
-                opts = {"firstresult": hasattr(method, "firstresult"),
-                        "historic": hasattr(method, "historic")}
-        return opts
-
-    def _verify_hook(self, hook, hookmethod):
-        super(PytestPluginManager, self)._verify_hook(hook, hookmethod)
-        if "__multicall__" in hookmethod.argnames:
-            fslineno = _pytest._code.getfslineno(hookmethod.function)
-            warning = dict(code="I1",
-                           fslocation=fslineno,
-                           nodeid=None,
-                           message="%r hook uses deprecated __multicall__ "
-                                   "argument" % (hook.name))
-            self._warn(warning)
-
-    def register(self, plugin, name=None):
-        ret = super(PytestPluginManager, self).register(plugin, name)
-        if ret:
-            self.hook.pytest_plugin_registered.call_historic(
-                kwargs=dict(plugin=plugin, manager=self))
-
-            if isinstance(plugin, types.ModuleType):
-                self.consider_module(plugin)
-        return ret
-
-    def getplugin(self, name):
-        # support deprecated naming because plugins (xdist e.g.) use it
-        return self.get_plugin(name)
-
-    def hasplugin(self, name):
-        """Return True if the plugin with the given name is registered."""
-        return bool(self.get_plugin(name))
-
-    def pytest_configure(self, config):
-        # XXX now that the pluginmanager exposes hookimpl(tryfirst...)
-        # we should remove tryfirst/trylast as markers
-        config.addinivalue_line("markers",
-                                "tryfirst: mark a hook implementation function such that the "
-                                "plugin machinery will try to call it first/as early as possible.")
-        config.addinivalue_line("markers",
-                                "trylast: mark a hook implementation function such that the "
-                                "plugin machinery will try to call it last/as late as possible.")
-
-    def _warn(self, message):
-        kwargs = message if isinstance(message, dict) else {
-            'code': 'I1',
-            'message': message,
-            'fslocation': None,
-            'nodeid': None,
-        }
-        self.hook.pytest_logwarning.call_historic(kwargs=kwargs)
-
-    #
-    # internal API for local conftest plugin handling
-    #
-    def _set_initial_conftests(self, namespace):
-        """ load initial conftest files given a preparsed "namespace".
-            As conftest files may add their own command line options
-            which have arguments ('--my-opt somepath') we might get some
-            false positives.  All builtin and 3rd party plugins will have
-            been loaded, however, so common options will not confuse our logic
-            here.
-        """
-        current = py.path.local()
-        self._confcutdir = current.join(namespace.confcutdir, abs=True) \
-            if namespace.confcutdir else None
-        self._noconftest = namespace.noconftest
-        testpaths = namespace.file_or_dir
-        foundanchor = False
-        for path in testpaths:
-            path = str(path)
-            # remove node-id syntax
-            i = path.find("::")
-            if i != -1:
-                path = path[:i]
-            anchor = current.join(path, abs=1)
-            if exists(anchor):  # we found some file object
-                self._try_load_conftest(anchor)
-                foundanchor = True
-        if not foundanchor:
-            self._try_load_conftest(current)
-
-    def _try_load_conftest(self, anchor):
-        self._getconftestmodules(anchor)
-        # let's also consider test* subdirs
-        if anchor.check(dir=1):
-            for x in anchor.listdir("test*"):
-                if x.check(dir=1):
-                    self._getconftestmodules(x)
-
-    def _getconftestmodules(self, path):
-        if self._noconftest:
-            return []
-        try:
-            return self._path2confmods[path]
-        except KeyError:
-            if path.isfile():
-                clist = self._getconftestmodules(path.dirpath())
-            else:
-                # XXX these days we may rather want to use config.rootdir
-                # and allow users to opt into looking into the rootdir parent
-                # directories instead of requiring to specify confcutdir
-                clist = []
-                for parent in path.parts():
-                    if self._confcutdir and self._confcutdir.relto(parent):
-                        continue
-                    conftestpath = parent.join("conftest.py")
-                    if conftestpath.isfile():
-                        mod = self._importconftest(conftestpath)
-                        clist.append(mod)
-
-            self._path2confmods[path] = clist
-            return clist
-
-    def _rget_with_confmod(self, name, path):
-        modules = self._getconftestmodules(path)
-        for mod in reversed(modules):
-            try:
-                return mod, getattr(mod, name)
-            except AttributeError:
-                continue
-        raise KeyError(name)
-
-    def _importconftest(self, conftestpath):
-        try:
-            return self._conftestpath2mod[conftestpath]
-        except KeyError:
-            pkgpath = conftestpath.pypkgpath()
-            if pkgpath is None:
-                _ensure_removed_sysmodule(conftestpath.purebasename)
-            try:
-                mod = conftestpath.pyimport()
-            except Exception:
-                raise ConftestImportFailure(conftestpath, sys.exc_info())
-
-            self._conftest_plugins.add(mod)
-            self._conftestpath2mod[conftestpath] = mod
-            dirpath = conftestpath.dirpath()
-            if dirpath in self._path2confmods:
-                for path, mods in self._path2confmods.items():
-                    if path and path.relto(dirpath) or path == dirpath:
-                        assert mod not in mods
-                        mods.append(mod)
-            self.trace("loaded conftestmodule %r" % (mod))
-            self.consider_conftest(mod)
-            return mod
-
-    #
-    # API for bootstrapping plugin loading
-    #
-    #
-
-    def consider_preparse(self, args):
-        for opt1, opt2 in zip(args, args[1:]):
-            if opt1 == "-p":
-                self.consider_pluginarg(opt2)
-
-    def consider_pluginarg(self, arg):
-        if arg.startswith("no:"):
-            name = arg[3:]
-            self.set_blocked(name)
-            if not name.startswith("pytest_"):
-                self.set_blocked("pytest_" + name)
-        else:
-            self.import_plugin(arg)
-
-    def consider_conftest(self, conftestmodule):
-        self.register(conftestmodule, name=conftestmodule.__file__)
-
-    def consider_env(self):
-        self._import_plugin_specs(os.environ.get("PYTEST_PLUGINS"))
-
-    def consider_module(self, mod):
-        self._import_plugin_specs(getattr(mod, 'pytest_plugins', []))
-
-    def _import_plugin_specs(self, spec):
-        plugins = _get_plugin_specs_as_list(spec)
-        for import_spec in plugins:
-            self.import_plugin(import_spec)
-
-    def import_plugin(self, modname):
-        # most often modname refers to builtin modules, e.g. "pytester",
-        # "terminal" or "capture".  Those plugins are registered under their
-        # basename for historic purposes but must be imported with the
-        # _pytest prefix.
-        assert isinstance(modname, (py.builtin.text, str)), "module name as text required, got %r" % modname
-        modname = str(modname)
-        if self.get_plugin(modname) is not None:
-            return
-        if modname in builtin_plugins:
-            importspec = "_pytest." + modname
-        else:
-            importspec = modname
-        self.rewrite_hook.mark_rewrite(importspec)
-        try:
-            __import__(importspec)
-        except ImportError as e:
-            new_exc = ImportError('Error importing plugin "%s": %s' % (modname, safe_str(e.args[0])))
-            # copy over name and path attributes
-            for attr in ('name', 'path'):
-                if hasattr(e, attr):
-                    setattr(new_exc, attr, getattr(e, attr))
-            raise new_exc
-        except Exception as e:
-            import pytest
-            if not hasattr(pytest, 'skip') or not isinstance(e, pytest.skip.Exception):
-                raise
-            self._warn("skipped plugin %r: %s" % ((modname, e.msg)))
-        else:
-            mod = sys.modules[importspec]
-            self.register(mod, modname)
-
-
-def _get_plugin_specs_as_list(specs):
-    """
-    Parses a list of "plugin specs" and returns a list of plugin names.
-
-    Plugin specs can be given as a list of strings separated by "," or already as a list/tuple in
-    which case it is returned as a list. Specs can also be `None` in which case an
-    empty list is returned.
-    """
-    if specs is not None:
-        if isinstance(specs, str):
-            specs = specs.split(',') if specs else []
-        if not isinstance(specs, (list, tuple)):
-            raise UsageError("Plugin specs must be a ','-separated string or a "
-                             "list/tuple of strings for plugin names. Given: %r" % specs)
-        return list(specs)
-    return []
-
-
-class Parser:
-    """ Parser for command line arguments and ini-file values.
-
-    :ivar extra_info: dict of generic param -> value to display in case
-        there's an error processing the command line arguments.
-    """
-
-    def __init__(self, usage=None, processopt=None):
-        self._anonymous = OptionGroup("custom options", parser=self)
-        self._groups = []
-        self._processopt = processopt
-        self._usage = usage
-        self._inidict = {}
-        self._ininames = []
-        self.extra_info = {}
-
-    def processoption(self, option):
-        if self._processopt:
-            if option.dest:
-                self._processopt(option)
-
-    def getgroup(self, name, description="", after=None):
-        """ get (or create) a named option Group.
-
-        :name: name of the option group.
-        :description: long description for --help output.
-        :after: name of other group, used for ordering --help output.
-
-        The returned group object has an ``addoption`` method with the same
-        signature as :py:func:`parser.addoption
-        <_pytest.config.Parser.addoption>` but will be shown in the
-        respective group in the output of ``pytest. --help``.
-        """
-        for group in self._groups:
-            if group.name == name:
-                return group
-        group = OptionGroup(name, description, parser=self)
-        i = 0
-        for i, grp in enumerate(self._groups):
-            if grp.name == after:
-                break
-        self._groups.insert(i + 1, group)
-        return group
-
-    def addoption(self, *opts, **attrs):
-        """ register a command line option.
-
-        :opts: option names, can be short or long options.
-        :attrs: same attributes which the ``add_option()`` function of the
-           `argparse library
-           <http://docs.python.org/2/library/argparse.html>`_
-           accepts.
-
-        After command line parsing options are available on the pytest config
-        object via ``config.option.NAME`` where ``NAME`` is usually set
-        by passing a ``dest`` attribute, for example
-        ``addoption("--long", dest="NAME", ...)``.
-        """
-        self._anonymous.addoption(*opts, **attrs)
-
-    def parse(self, args, namespace=None):
-        from _pytest._argcomplete import try_argcomplete
-        self.optparser = self._getparser()
-        try_argcomplete(self.optparser)
-        return self.optparser.parse_args([str(x) for x in args], namespace=namespace)
-
-    def _getparser(self):
-        from _pytest._argcomplete import filescompleter
-        optparser = MyOptionParser(self, self.extra_info)
-        groups = self._groups + [self._anonymous]
-        for group in groups:
-            if group.options:
-                desc = group.description or group.name
-                arggroup = optparser.add_argument_group(desc)
-                for option in group.options:
-                    n = option.names()
-                    a = option.attrs()
-                    arggroup.add_argument(*n, **a)
-        # bash like autocompletion for dirs (appending '/')
-        optparser.add_argument(FILE_OR_DIR, nargs='*').completer = filescompleter
-        return optparser
-
-    def parse_setoption(self, args, option, namespace=None):
-        parsedoption = self.parse(args, namespace=namespace)
-        for name, value in parsedoption.__dict__.items():
-            setattr(option, name, value)
-        return getattr(parsedoption, FILE_OR_DIR)
-
-    def parse_known_args(self, args, namespace=None):
-        """parses and returns a namespace object with known arguments at this
-        point.
-        """
-        return self.parse_known_and_unknown_args(args, namespace=namespace)[0]
-
-    def parse_known_and_unknown_args(self, args, namespace=None):
-        """parses and returns a namespace object with known arguments, and
-        the remaining arguments unknown at this point.
-        """
-        optparser = self._getparser()
-        args = [str(x) for x in args]
-        return optparser.parse_known_args(args, namespace=namespace)
-
-    def addini(self, name, help, type=None, default=None):
-        """ register an ini-file option.
-
-        :name: name of the ini-variable
-        :type: type of the variable, can be ``pathlist``, ``args``, ``linelist``
-               or ``bool``.
-        :default: default value if no ini-file option exists but is queried.
-
-        The value of ini-variables can be retrieved via a call to
-        :py:func:`config.getini(name) <_pytest.config.Config.getini>`.
-        """
-        assert type in (None, "pathlist", "args", "linelist", "bool")
-        self._inidict[name] = (help, type, default)
-        self._ininames.append(name)
-
-
-class ArgumentError(Exception):
-    """
-    Raised if an Argument instance is created with invalid or
-    inconsistent arguments.
-    """
-
-    def __init__(self, msg, option):
-        self.msg = msg
-        self.option_id = str(option)
-
-    def __str__(self):
-        if self.option_id:
-            return "option %s: %s" % (self.option_id, self.msg)
-        else:
-            return self.msg
-
-
-class Argument:
-    """class that mimics the necessary behaviour of optparse.Option
-
-    its currently a least effort implementation
-    and ignoring choices and integer prefixes
-    https://docs.python.org/3/library/optparse.html#optparse-standard-option-types
-    """
-    _typ_map = {
-        'int': int,
-        'string': str,
-        'float': float,
-        'complex': complex,
-    }
-
-    def __init__(self, *names, **attrs):
-        """store parms in private vars for use in add_argument"""
-        self._attrs = attrs
-        self._short_opts = []
-        self._long_opts = []
-        self.dest = attrs.get('dest')
-        if '%default' in (attrs.get('help') or ''):
-            warnings.warn(
-                'pytest now uses argparse. "%default" should be'
-                ' changed to "%(default)s" ',
-                DeprecationWarning,
-                stacklevel=3)
-        try:
-            typ = attrs['type']
-        except KeyError:
-            pass
-        else:
-            # this might raise a keyerror as well, don't want to catch that
-            if isinstance(typ, py.builtin._basestring):
-                if typ == 'choice':
-                    warnings.warn(
-                        'type argument to addoption() is a string %r.'
-                        ' For parsearg this is optional and when supplied'
-                        ' should be a type.'
-                        ' (options: %s)' % (typ, names),
-                        DeprecationWarning,
-                        stacklevel=3)
-                    # argparse expects a type here take it from
-                    # the type of the first element
-                    attrs['type'] = type(attrs['choices'][0])
-                else:
-                    warnings.warn(
-                        'type argument to addoption() is a string %r.'
-                        ' For parsearg this should be a type.'
-                        ' (options: %s)' % (typ, names),
-                        DeprecationWarning,
-                        stacklevel=3)
-                    attrs['type'] = Argument._typ_map[typ]
-                # used in test_parseopt -> test_parse_defaultgetter
-                self.type = attrs['type']
-            else:
-                self.type = typ
-        try:
-            # attribute existence is tested in Config._processopt
-            self.default = attrs['default']
-        except KeyError:
-            pass
-        self._set_opt_strings(names)
-        if not self.dest:
-            if self._long_opts:
-                self.dest = self._long_opts[0][2:].replace('-', '_')
-            else:
-                try:
-                    self.dest = self._short_opts[0][1:]
-                except IndexError:
-                    raise ArgumentError(
-                        'need a long or short option', self)
-
-    def names(self):
-        return self._short_opts + self._long_opts
-
-    def attrs(self):
-        # update any attributes set by processopt
-        attrs = 'default dest help'.split()
-        if self.dest:
-            attrs.append(self.dest)
-        for attr in attrs:
-            try:
-                self._attrs[attr] = getattr(self, attr)
-            except AttributeError:
-                pass
-        if self._attrs.get('help'):
-            a = self._attrs['help']
-            a = a.replace('%default', '%(default)s')
-            # a = a.replace('%prog', '%(prog)s')
-            self._attrs['help'] = a
-        return self._attrs
-
-    def _set_opt_strings(self, opts):
-        """directly from optparse
-
-        might not be necessary as this is passed to argparse later on"""
-        for opt in opts:
-            if len(opt) < 2:
-                raise ArgumentError(
-                    "invalid option string %r: "
-                    "must be at least two characters long" % opt, self)
-            elif len(opt) == 2:
-                if not (opt[0] == "-" and opt[1] != "-"):
-                    raise ArgumentError(
-                        "invalid short option string %r: "
-                        "must be of the form -x, (x any non-dash char)" % opt,
-                        self)
-                self._short_opts.append(opt)
-            else:
-                if not (opt[0:2] == "--" and opt[2] != "-"):
-                    raise ArgumentError(
-                        "invalid long option string %r: "
-                        "must start with --, followed by non-dash" % opt,
-                        self)
-                self._long_opts.append(opt)
-
-    def __repr__(self):
-        args = []
-        if self._short_opts:
-            args += ['_short_opts: ' + repr(self._short_opts)]
-        if self._long_opts:
-            args += ['_long_opts: ' + repr(self._long_opts)]
-        args += ['dest: ' + repr(self.dest)]
-        if hasattr(self, 'type'):
-            args += ['type: ' + repr(self.type)]
-        if hasattr(self, 'default'):
-            args += ['default: ' + repr(self.default)]
-        return 'Argument({0})'.format(', '.join(args))
-
-
-class OptionGroup:
-    def __init__(self, name, description="", parser=None):
-        self.name = name
-        self.description = description
-        self.options = []
-        self.parser = parser
-
-    def addoption(self, *optnames, **attrs):
-        """ add an option to this group.
-
-        if a shortened version of a long option is specified it will
-        be suppressed in the help. addoption('--twowords', '--two-words')
-        results in help showing '--two-words' only, but --twowords gets
-        accepted **and** the automatic destination is in args.twowords
-        """
-        conflict = set(optnames).intersection(
-            name for opt in self.options for name in opt.names())
-        if conflict:
-            raise ValueError("option names %s already added" % conflict)
-        option = Argument(*optnames, **attrs)
-        self._addoption_instance(option, shortupper=False)
-
-    def _addoption(self, *optnames, **attrs):
-        option = Argument(*optnames, **attrs)
-        self._addoption_instance(option, shortupper=True)
-
-    def _addoption_instance(self, option, shortupper=False):
-        if not shortupper:
-            for opt in option._short_opts:
-                if opt[0] == '-' and opt[1].islower():
-                    raise ValueError("lowercase shortoptions reserved")
-        if self.parser:
-            self.parser.processoption(option)
-        self.options.append(option)
-
-
-class MyOptionParser(argparse.ArgumentParser):
-    def __init__(self, parser, extra_info=None):
-        if not extra_info:
-            extra_info = {}
-        self._parser = parser
-        argparse.ArgumentParser.__init__(self, usage=parser._usage,
-                                         add_help=False, formatter_class=DropShorterLongHelpFormatter)
-        # extra_info is a dict of (param -> value) to display if there's
-        # an usage error to provide more contextual information to the user
-        self.extra_info = extra_info
-
-    def parse_args(self, args=None, namespace=None):
-        """allow splitting of positional arguments"""
-        args, argv = self.parse_known_args(args, namespace)
-        if argv:
-            for arg in argv:
-                if arg and arg[0] == '-':
-                    lines = ['unrecognized arguments: %s' % (' '.join(argv))]
-                    for k, v in sorted(self.extra_info.items()):
-                        lines.append('  %s: %s' % (k, v))
-                    self.error('\n'.join(lines))
-            getattr(args, FILE_OR_DIR).extend(argv)
-        return args
-
-
-class DropShorterLongHelpFormatter(argparse.HelpFormatter):
-    """shorten help for long options that differ only in extra hyphens
-
-    - collapse **long** options that are the same except for extra hyphens
-    - special action attribute map_long_option allows surpressing additional
-      long options
-    - shortcut if there are only two options and one of them is a short one
-    - cache result on action object as this is called at least 2 times
-    """
-
-    def _format_action_invocation(self, action):
-        orgstr = argparse.HelpFormatter._format_action_invocation(self, action)
-        if orgstr and orgstr[0] != '-':  # only optional arguments
-            return orgstr
-        res = getattr(action, '_formatted_action_invocation', None)
-        if res:
-            return res
-        options = orgstr.split(', ')
-        if len(options) == 2 and (len(options[0]) == 2 or len(options[1]) == 2):
-            # a shortcut for '-h, --help' or '--abc', '-a'
-            action._formatted_action_invocation = orgstr
-            return orgstr
-        return_list = []
-        option_map = getattr(action, 'map_long_option', {})
-        if option_map is None:
-            option_map = {}
-        short_long = {}
-        for option in options:
-            if len(option) == 2 or option[2] == ' ':
-                continue
-            if not option.startswith('--'):
-                raise ArgumentError('long optional argument without "--": [%s]'
-                                    % (option), self)
-            xxoption = option[2:]
-            if xxoption.split()[0] not in option_map:
-                shortened = xxoption.replace('-', '')
-                if shortened not in short_long or \
-                   len(short_long[shortened]) < len(xxoption):
-                    short_long[shortened] = xxoption
-        # now short_long has been filled out to the longest with dashes
-        # **and** we keep the right option ordering from add_argument
-        for option in options:
-            if len(option) == 2 or option[2] == ' ':
-                return_list.append(option)
-            if option[2:] == short_long.get(option.replace('-', '')):
-                return_list.append(option.replace(' ', '=', 1))
-        action._formatted_action_invocation = ', '.join(return_list)
-        return action._formatted_action_invocation
-
-
-def _ensure_removed_sysmodule(modname):
-    try:
-        del sys.modules[modname]
-    except KeyError:
-        pass
-
-
-class CmdOptions(object):
-    """ holds cmdline options as attributes."""
-
-    def __init__(self, values=()):
-        self.__dict__.update(values)
-
-    def __repr__(self):
-        return "<CmdOptions %r>" % (self.__dict__,)
-
-    def copy(self):
-        return CmdOptions(self.__dict__)
-
-
-class Notset:
-    def __repr__(self):
-        return "<NOTSET>"
-
-
-notset = Notset()
-FILE_OR_DIR = 'file_or_dir'
-
-
-def _iter_rewritable_modules(package_files):
-    for fn in package_files:
-        is_simple_module = '/' not in fn and fn.endswith('.py')
-        is_package = fn.count('/') == 1 and fn.endswith('__init__.py')
-        if is_simple_module:
-            module_name, _ = os.path.splitext(fn)
-            yield module_name
-        elif is_package:
-            package_name = os.path.dirname(fn)
-            yield package_name
-
-
-class Config(object):
-    """ access to configuration values, pluginmanager and plugin hooks.  """
-
-    def __init__(self, pluginmanager):
-        #: access to command line option as attributes.
-        #: (deprecated), use :py:func:`getoption() <_pytest.config.Config.getoption>` instead
-        self.option = CmdOptions()
-        _a = FILE_OR_DIR
-        self._parser = Parser(
-            usage="%%(prog)s [options] [%s] [%s] [...]" % (_a, _a),
-            processopt=self._processopt,
-        )
-        #: a pluginmanager instance
-        self.pluginmanager = pluginmanager
-        self.trace = self.pluginmanager.trace.root.get("config")
-        self.hook = self.pluginmanager.hook
-        self._inicache = {}
-        self._override_ini = ()
-        self._opt2dest = {}
-        self._cleanup = []
-        self._warn = self.pluginmanager._warn
-        self.pluginmanager.register(self, "pytestconfig")
-        self._configured = False
-
-        def do_setns(dic):
-            import pytest
-            setns(pytest, dic)
-
-        self.hook.pytest_namespace.call_historic(do_setns, {})
-        self.hook.pytest_addoption.call_historic(kwargs=dict(parser=self._parser))
-
-    def add_cleanup(self, func):
-        """ Add a function to be called when the config object gets out of
-        use (usually coninciding with pytest_unconfigure)."""
-        self._cleanup.append(func)
-
-    def _do_configure(self):
-        assert not self._configured
-        self._configured = True
-        self.hook.pytest_configure.call_historic(kwargs=dict(config=self))
-
-    def _ensure_unconfigure(self):
-        if self._configured:
-            self._configured = False
-            self.hook.pytest_unconfigure(config=self)
-            self.hook.pytest_configure._call_history = []
-        while self._cleanup:
-            fin = self._cleanup.pop()
-            fin()
-
-    def warn(self, code, message, fslocation=None, nodeid=None):
-        """ generate a warning for this test session. """
-        self.hook.pytest_logwarning.call_historic(kwargs=dict(
-            code=code, message=message,
-            fslocation=fslocation, nodeid=nodeid))
-
-    def get_terminal_writer(self):
-        return self.pluginmanager.get_plugin("terminalreporter")._tw
-
-    def pytest_cmdline_parse(self, pluginmanager, args):
-        # REF1 assert self == pluginmanager.config, (self, pluginmanager.config)
-        self.parse(args)
-        return self
-
-    def notify_exception(self, excinfo, option=None):
-        if option and option.fulltrace:
-            style = "long"
-        else:
-            style = "native"
-        excrepr = excinfo.getrepr(funcargs=True,
-                                  showlocals=getattr(option, 'showlocals', False),
-                                  style=style,
-                                  )
-        res = self.hook.pytest_internalerror(excrepr=excrepr,
-                                             excinfo=excinfo)
-        if not py.builtin.any(res):
-            for line in str(excrepr).split("\n"):
-                sys.stderr.write("INTERNALERROR> %s\n" % line)
-                sys.stderr.flush()
-
-    def cwd_relative_nodeid(self, nodeid):
-        # nodeid's are relative to the rootpath, compute relative to cwd
-        if self.invocation_dir != self.rootdir:
-            fullpath = self.rootdir.join(nodeid)
-            nodeid = self.invocation_dir.bestrelpath(fullpath)
-        return nodeid
-
-    @classmethod
-    def fromdictargs(cls, option_dict, args):
-        """ constructor useable for subprocesses. """
-        config = get_config()
-        config.option.__dict__.update(option_dict)
-        config.parse(args, addopts=False)
-        for x in config.option.plugins:
-            config.pluginmanager.consider_pluginarg(x)
-        return config
-
-    def _processopt(self, opt):
-        for name in opt._short_opts + opt._long_opts:
-            self._opt2dest[name] = opt.dest
-
-        if hasattr(opt, 'default') and opt.dest:
-            if not hasattr(self.option, opt.dest):
-                setattr(self.option, opt.dest, opt.default)
-
-    @hookimpl(trylast=True)
-    def pytest_load_initial_conftests(self, early_config):
-        self.pluginmanager._set_initial_conftests(early_config.known_args_namespace)
-
-    def _initini(self, args):
-        ns, unknown_args = self._parser.parse_known_and_unknown_args(args, namespace=self.option.copy())
-        r = determine_setup(ns.inifilename, ns.file_or_dir + unknown_args, warnfunc=self.warn)
-        self.rootdir, self.inifile, self.inicfg = r
-        self._parser.extra_info['rootdir'] = self.rootdir
-        self._parser.extra_info['inifile'] = self.inifile
-        self.invocation_dir = py.path.local()
-        self._parser.addini('addopts', 'extra command line options', 'args')
-        self._parser.addini('minversion', 'minimally required pytest version')
-        self._override_ini = ns.override_ini or ()
-
-    def _consider_importhook(self, args):
-        """Install the PEP 302 import hook if using assertion re-writing.
-
-        Needs to parse the --assert=<mode> option from the commandline
-        and find all the installed plugins to mark them for re-writing
-        by the importhook.
-        """
-        ns, unknown_args = self._parser.parse_known_and_unknown_args(args)
-        mode = ns.assertmode
-        if mode == 'rewrite':
-            try:
-                hook = _pytest.assertion.install_importhook(self)
-            except SystemError:
-                mode = 'plain'
-            else:
-                self._mark_plugins_for_rewrite(hook)
-        self._warn_about_missing_assertion(mode)
-
-    def _mark_plugins_for_rewrite(self, hook):
-        """
-        Given an importhook, mark for rewrite any top-level
-        modules or packages in the distribution package for
-        all pytest plugins.
-        """
-        import pkg_resources
-        self.pluginmanager.rewrite_hook = hook
-
-        # 'RECORD' available for plugins installed normally (pip install)
-        # 'SOURCES.txt' available for plugins installed in dev mode (pip install -e)
-        # for installed plugins 'SOURCES.txt' returns an empty list, and vice-versa
-        # so it shouldn't be an issue
-        metadata_files = 'RECORD', 'SOURCES.txt'
-
-        package_files = (
-            entry.split(',')[0]
-            for entrypoint in pkg_resources.iter_entry_points('pytest11')
-            for metadata in metadata_files
-            for entry in entrypoint.dist._get_metadata(metadata)
-        )
-
-        for name in _iter_rewritable_modules(package_files):
-            hook.mark_rewrite(name)
-
-    def _warn_about_missing_assertion(self, mode):
-        try:
-            assert False
-        except AssertionError:
-            pass
-        else:
-            if mode == 'plain':
-                sys.stderr.write("WARNING: ASSERTIONS ARE NOT EXECUTED"
-                                 " and FAILING TESTS WILL PASS.  Are you"
-                                 " using python -O?")
-            else:
-                sys.stderr.write("WARNING: assertions not in test modules or"
-                                 " plugins will be ignored"
-                                 " because assert statements are not executed "
-                                 "by the underlying Python interpreter "
-                                 "(are you using python -O?)\n")
-
-    def _preparse(self, args, addopts=True):
-        self._initini(args)
-        if addopts:
-            args[:] = shlex.split(os.environ.get('PYTEST_ADDOPTS', '')) + args
-            args[:] = self.getini("addopts") + args
-        self._checkversion()
-        self._consider_importhook(args)
-        self.pluginmanager.consider_preparse(args)
-        self.pluginmanager.load_setuptools_entrypoints('pytest11')
-        self.pluginmanager.consider_env()
-        self.known_args_namespace = ns = self._parser.parse_known_args(args, namespace=self.option.copy())
-        if self.known_args_namespace.confcutdir is None and self.inifile:
-            confcutdir = py.path.local(self.inifile).dirname
-            self.known_args_namespace.confcutdir = confcutdir
-        try:
-            self.hook.pytest_load_initial_conftests(early_config=self,
-                                                    args=args, parser=self._parser)
-        except ConftestImportFailure:
-            e = sys.exc_info()[1]
-            if ns.help or ns.version:
-                # we don't want to prevent --help/--version to work
-                # so just let is pass and print a warning at the end
-                self._warn("could not load initial conftests (%s)\n" % e.path)
-            else:
-                raise
-
-    def _checkversion(self):
-        import pytest
-        minver = self.inicfg.get('minversion', None)
-        if minver:
-            ver = minver.split(".")
-            myver = pytest.__version__.split(".")
-            if myver < ver:
-                raise pytest.UsageError(
-                    "%s:%d: requires pytest-%s, actual pytest-%s'" % (
-                        self.inicfg.config.path, self.inicfg.lineof('minversion'),
-                        minver, pytest.__version__))
-
-    def parse(self, args, addopts=True):
-        # parse given cmdline arguments into this config object.
-        assert not hasattr(self, 'args'), (
-            "can only parse cmdline args at most once per Config object")
-        self._origargs = args
-        self.hook.pytest_addhooks.call_historic(
-            kwargs=dict(pluginmanager=self.pluginmanager))
-        self._preparse(args, addopts=addopts)
-        # XXX deprecated hook:
-        self.hook.pytest_cmdline_preparse(config=self, args=args)
-        self._parser.after_preparse = True
-        try:
-            args = self._parser.parse_setoption(args, self.option, namespace=self.option)
-            if not args:
-                cwd = os.getcwd()
-                if cwd == self.rootdir:
-                    args = self.getini('testpaths')
-                if not args:
-                    args = [cwd]
-            self.args = args
-        except PrintHelp:
-            pass
-
-    def addinivalue_line(self, name, line):
-        """ add a line to an ini-file option. The option must have been
-        declared but might not yet be set in which case the line becomes the
-        the first line in its value. """
-        x = self.getini(name)
-        assert isinstance(x, list)
-        x.append(line)  # modifies the cached list inline
-
-    def getini(self, name):
-        """ return configuration value from an :ref:`ini file <inifiles>`. If the
-        specified name hasn't been registered through a prior
-        :py:func:`parser.addini <_pytest.config.Parser.addini>`
-        call (usually from a plugin), a ValueError is raised. """
-        try:
-            return self._inicache[name]
-        except KeyError:
-            self._inicache[name] = val = self._getini(name)
-            return val
-
-    def _getini(self, name):
-        try:
-            description, type, default = self._parser._inidict[name]
-        except KeyError:
-            raise ValueError("unknown configuration value: %r" % (name,))
-        value = self._get_override_ini_value(name)
-        if value is None:
-            try:
-                value = self.inicfg[name]
-            except KeyError:
-                if default is not None:
-                    return default
-                if type is None:
-                    return ''
-                return []
-        if type == "pathlist":
-            dp = py.path.local(self.inicfg.config.path).dirpath()
-            values = []
-            for relpath in shlex.split(value):
-                values.append(dp.join(relpath, abs=True))
-            return values
-        elif type == "args":
-            return shlex.split(value)
-        elif type == "linelist":
-            return [t for t in map(lambda x: x.strip(), value.split("\n")) if t]
-        elif type == "bool":
-            return bool(_strtobool(value.strip()))
-        else:
-            assert type is None
-            return value
-
-    def _getconftest_pathlist(self, name, path):
-        try:
-            mod, relroots = self.pluginmanager._rget_with_confmod(name, path)
-        except KeyError:
-            return None
-        modpath = py.path.local(mod.__file__).dirpath()
-        values = []
-        for relroot in relroots:
-            if not isinstance(relroot, py.path.local):
-                relroot = relroot.replace("/", py.path.local.sep)
-                relroot = modpath.join(relroot, abs=True)
-            values.append(relroot)
-        return values
-
-    def _get_override_ini_value(self, name):
-        value = None
-        # override_ini is a list of list, to support both -o foo1=bar1 foo2=bar2 and
-        # and -o foo1=bar1 -o foo2=bar2 options
-        # always use the last item if multiple value set for same ini-name,
-        # e.g. -o foo=bar1 -o foo=bar2 will set foo to bar2
-        for ini_config_list in self._override_ini:
-            for ini_config in ini_config_list:
-                try:
-                    (key, user_ini_value) = ini_config.split("=", 1)
-                except ValueError:
-                    raise UsageError("-o/--override-ini expects option=value style.")
-                if key == name:
-                    value = user_ini_value
-        return value
-
-    def getoption(self, name, default=notset, skip=False):
-        """ return command line option value.
-
-        :arg name: name of the option.  You may also specify
-            the literal ``--OPT`` option instead of the "dest" option name.
-        :arg default: default value if no option of that name exists.
-        :arg skip: if True raise pytest.skip if option does not exists
-            or has a None value.
-        """
-        name = self._opt2dest.get(name, name)
-        try:
-            val = getattr(self.option, name)
-            if val is None and skip:
-                raise AttributeError(name)
-            return val
-        except AttributeError:
-            if default is not notset:
-                return default
-            if skip:
-                import pytest
-                pytest.skip("no %r option found" % (name,))
-            raise ValueError("no option named %r" % (name,))
-
-    def getvalue(self, name, path=None):
-        """ (deprecated, use getoption()) """
-        return self.getoption(name)
-
-    def getvalueorskip(self, name, path=None):
-        """ (deprecated, use getoption(skip=True)) """
-        return self.getoption(name, skip=True)
-
-
-def exists(path, ignore=EnvironmentError):
-    try:
-        return path.check()
-    except ignore:
-        return False
-
-
-def getcfg(args, warnfunc=None):
-    """
-    Search the list of arguments for a valid ini-file for pytest,
-    and return a tuple of (rootdir, inifile, cfg-dict).
-
-    note: warnfunc is an optional function used to warn
-        about ini-files that use deprecated features.
-        This parameter should be removed when pytest
-        adopts standard deprecation warnings (#1804).
-    """
-    from _pytest.deprecated import SETUP_CFG_PYTEST
-    inibasenames = ["pytest.ini", "tox.ini", "setup.cfg"]
-    args = [x for x in args if not str(x).startswith("-")]
-    if not args:
-        args = [py.path.local()]
-    for arg in args:
-        arg = py.path.local(arg)
-        for base in arg.parts(reverse=True):
-            for inibasename in inibasenames:
-                p = base.join(inibasename)
-                if exists(p):
-                    iniconfig = py.iniconfig.IniConfig(p)
-                    if 'pytest' in iniconfig.sections:
-                        if inibasename == 'setup.cfg' and warnfunc:
-                            warnfunc('C1', SETUP_CFG_PYTEST)
-                        return base, p, iniconfig['pytest']
-                    if inibasename == 'setup.cfg' and 'tool:pytest' in iniconfig.sections:
-                        return base, p, iniconfig['tool:pytest']
-                    elif inibasename == "pytest.ini":
-                        # allowed to be empty
-                        return base, p, {}
-    return None, None, None
-
-
-def get_common_ancestor(paths):
-    common_ancestor = None
-    for path in paths:
-        if not path.exists():
-            continue
-        if common_ancestor is None:
-            common_ancestor = path
-        else:
-            if path.relto(common_ancestor) or path == common_ancestor:
-                continue
-            elif common_ancestor.relto(path):
-                common_ancestor = path
-            else:
-                shared = path.common(common_ancestor)
-                if shared is not None:
-                    common_ancestor = shared
-    if common_ancestor is None:
-        common_ancestor = py.path.local()
-    elif common_ancestor.isfile():
-        common_ancestor = common_ancestor.dirpath()
-    return common_ancestor
-
-
-def get_dirs_from_args(args):
-    def is_option(x):
-        return str(x).startswith('-')
-
-    def get_file_part_from_node_id(x):
-        return str(x).split('::')[0]
-
-    def get_dir_from_path(path):
-        if path.isdir():
-            return path
-        return py.path.local(path.dirname)
-
-    # These look like paths but may not exist
-    possible_paths = (
-        py.path.local(get_file_part_from_node_id(arg))
-        for arg in args
-        if not is_option(arg)
-    )
-
-    return [
-        get_dir_from_path(path)
-        for path in possible_paths
-        if path.exists()
-    ]
-
-
-def determine_setup(inifile, args, warnfunc=None):
-    dirs = get_dirs_from_args(args)
-    if inifile:
-        iniconfig = py.iniconfig.IniConfig(inifile)
-        try:
-            inicfg = iniconfig["pytest"]
-        except KeyError:
-            inicfg = None
-        rootdir = get_common_ancestor(dirs)
-    else:
-        ancestor = get_common_ancestor(dirs)
-        rootdir, inifile, inicfg = getcfg([ancestor], warnfunc=warnfunc)
-        if rootdir is None:
-            for rootdir in ancestor.parts(reverse=True):
-                if rootdir.join("setup.py").exists():
-                    break
-            else:
-                rootdir, inifile, inicfg = getcfg(dirs, warnfunc=warnfunc)
-                if rootdir is None:
-                    rootdir = get_common_ancestor([py.path.local(), ancestor])
-                    is_fs_root = os.path.splitdrive(str(rootdir))[1] == '/'
-                    if is_fs_root:
-                        rootdir = ancestor
-    return rootdir, inifile, inicfg or {}
-
-
-def setns(obj, dic):
-    import pytest
-    for name, value in dic.items():
-        if isinstance(value, dict):
-            mod = getattr(obj, name, None)
-            if mod is None:
-                modname = "pytest.%s" % name
-                mod = types.ModuleType(modname)
-                sys.modules[modname] = mod
-                mod.__all__ = []
-                setattr(obj, name, mod)
-            obj.__all__.append(name)
-            setns(mod, value)
-        else:
-            setattr(obj, name, value)
-            obj.__all__.append(name)
-            # if obj != pytest:
-            #    pytest.__all__.append(name)
-            setattr(pytest, name, value)
-
-
-def create_terminal_writer(config, *args, **kwargs):
-    """Create a TerminalWriter instance configured according to the options
-    in the config object. Every code which requires a TerminalWriter object
-    and has access to a config object should use this function.
-    """
-    tw = py.io.TerminalWriter(*args, **kwargs)
-    if config.option.color == 'yes':
-        tw.hasmarkup = True
-    if config.option.color == 'no':
-        tw.hasmarkup = False
-    return tw
-
-
-def _strtobool(val):
-    """Convert a string representation of truth to true (1) or false (0).
-
-    True values are 'y', 'yes', 't', 'true', 'on', and '1'; false values
-    are 'n', 'no', 'f', 'false', 'off', and '0'.  Raises ValueError if
-    'val' is anything else.
-
-    .. note:: copied from distutils.util
-    """
-    val = val.lower()
-    if val in ('y', 'yes', 't', 'true', 'on', '1'):
-        return 1
-    elif val in ('n', 'no', 'f', 'false', 'off', '0'):
-        return 0
-    else:
-        raise ValueError("invalid truth value %r" % (val,))
deleted file mode 100644
--- a/third_party/python/pytest/_pytest/debugging.py
+++ /dev/null
@@ -1,123 +0,0 @@
-""" interactive debugging with PDB, the Python Debugger. """
-from __future__ import absolute_import, division, print_function
-import pdb
-import sys
-
-
-def pytest_addoption(parser):
-    group = parser.getgroup("general")
-    group._addoption(
-        '--pdb', dest="usepdb", action="store_true",
-        help="start the interactive Python debugger on errors.")
-    group._addoption(
-        '--pdbcls', dest="usepdb_cls", metavar="modulename:classname",
-        help="start a custom interactive Python debugger on errors. "
-             "For example: --pdbcls=IPython.terminal.debugger:TerminalPdb")
-
-
-def pytest_configure(config):
-    if config.getvalue("usepdb_cls"):
-        modname, classname = config.getvalue("usepdb_cls").split(":")
-        __import__(modname)
-        pdb_cls = getattr(sys.modules[modname], classname)
-    else:
-        pdb_cls = pdb.Pdb
-
-    if config.getvalue("usepdb"):
-        config.pluginmanager.register(PdbInvoke(), 'pdbinvoke')
-
-    old = (pdb.set_trace, pytestPDB._pluginmanager)
-
-    def fin():
-        pdb.set_trace, pytestPDB._pluginmanager = old
-        pytestPDB._config = None
-        pytestPDB._pdb_cls = pdb.Pdb
-
-    pdb.set_trace = pytestPDB.set_trace
-    pytestPDB._pluginmanager = config.pluginmanager
-    pytestPDB._config = config
-    pytestPDB._pdb_cls = pdb_cls
-    config._cleanup.append(fin)
-
-
-class pytestPDB:
-    """ Pseudo PDB that defers to the real pdb. """
-    _pluginmanager = None
-    _config = None
-    _pdb_cls = pdb.Pdb
-
-    @classmethod
-    def set_trace(cls):
-        """ invoke PDB set_trace debugging, dropping any IO capturing. """
-        import _pytest.config
-        frame = sys._getframe().f_back
-        if cls._pluginmanager is not None:
-            capman = cls._pluginmanager.getplugin("capturemanager")
-            if capman:
-                capman.suspendcapture(in_=True)
-            tw = _pytest.config.create_terminal_writer(cls._config)
-            tw.line()
-            tw.sep(">", "PDB set_trace (IO-capturing turned off)")
-            cls._pluginmanager.hook.pytest_enter_pdb(config=cls._config)
-        cls._pdb_cls().set_trace(frame)
-
-
-class PdbInvoke:
-    def pytest_exception_interact(self, node, call, report):
-        capman = node.config.pluginmanager.getplugin("capturemanager")
-        if capman:
-            out, err = capman.suspendcapture(in_=True)
-            sys.stdout.write(out)
-            sys.stdout.write(err)
-        _enter_pdb(node, call.excinfo, report)
-
-    def pytest_internalerror(self, excrepr, excinfo):
-        for line in str(excrepr).split("\n"):
-            sys.stderr.write("INTERNALERROR> %s\n" % line)
-            sys.stderr.flush()
-        tb = _postmortem_traceback(excinfo)
-        post_mortem(tb)
-
-
-def _enter_pdb(node, excinfo, rep):
-    # XXX we re-use the TerminalReporter's terminalwriter
-    # because this seems to avoid some encoding related troubles
-    # for not completely clear reasons.
-    tw = node.config.pluginmanager.getplugin("terminalreporter")._tw
-    tw.line()
-    tw.sep(">", "traceback")
-    rep.toterminal(tw)
-    tw.sep(">", "entering PDB")
-    tb = _postmortem_traceback(excinfo)
-    post_mortem(tb)
-    rep._pdbshown = True
-    return rep
-
-
-def _postmortem_traceback(excinfo):
-    # A doctest.UnexpectedException is not useful for post_mortem.
-    # Use the underlying exception instead:
-    from doctest import UnexpectedException
-    if isinstance(excinfo.value, UnexpectedException):
-        return excinfo.value.exc_info[2]
-    else:
-        return excinfo._excinfo[2]
-
-
-def _find_last_non_hidden_frame(stack):
-    i = max(0, len(stack) - 1)
-    while i and stack[i][0].f_locals.get("__tracebackhide__", False):
-        i -= 1
-    return i
-
-
-def post_mortem(t):
-    class Pdb(pytestPDB._pdb_cls):
-        def get_stack(self, f, t):
-            stack, i = pdb.Pdb.get_stack(self, f, t)
-            if f is None:
-                i = _find_last_non_hidden_frame(stack)
-            return stack, i
-    p = Pdb()
-    p.reset()
-    p.interaction(None, t)
deleted file mode 100644
--- a/third_party/python/pytest/_pytest/deprecated.py
+++ /dev/null
@@ -1,42 +0,0 @@
-"""
-This module contains deprecation messages and bits of code used elsewhere in the codebase
-that is planned to be removed in the next pytest release.
-
-Keeping it in a central location makes it easy to track what is deprecated and should
-be removed when the time comes.
-"""
-from __future__ import absolute_import, division, print_function
-
-
-class RemovedInPytest4Warning(DeprecationWarning):
-    """warning class for features removed in pytest 4.0"""
-
-
-MAIN_STR_ARGS = 'passing a string to pytest.main() is deprecated, ' \
-    'pass a list of arguments instead.'
-
-YIELD_TESTS = 'yield tests are deprecated, and scheduled to be removed in pytest 4.0'
-
-FUNCARG_PREFIX = (
-    '{name}: declaring fixtures using "pytest_funcarg__" prefix is deprecated '
-    'and scheduled to be removed in pytest 4.0.  '
-    'Please remove the prefix and use the @pytest.fixture decorator instead.')
-
-SETUP_CFG_PYTEST = '[pytest] section in setup.cfg files is deprecated, use [tool:pytest] instead.'
-
-GETFUNCARGVALUE = "use of getfuncargvalue is deprecated, use getfixturevalue"
-
-RESULT_LOG = (
-    '--result-log is deprecated and scheduled for removal in pytest 4.0.\n'
-    'See https://docs.pytest.org/en/latest/usage.html#creating-resultlog-format-files for more information.'
-)
-
-MARK_INFO_ATTRIBUTE = RemovedInPytest4Warning(
-    "MarkInfo objects are deprecated as they contain the merged marks"
-)
-
-MARK_PARAMETERSET_UNPACKING = RemovedInPytest4Warning(
-    "Applying marks directly to parameters is deprecated,"
-    " please use pytest.param(..., marks=...) instead.\n"
-    "For more details, see: https://docs.pytest.org/en/latest/parametrize.html"
-)
deleted file mode 100644
--- a/third_party/python/pytest/_pytest/doctest.py
+++ /dev/null
@@ -1,362 +0,0 @@
-""" discover and run doctests in modules and test files."""
-from __future__ import absolute_import, division, print_function
-
-import traceback
-
-import pytest
-from _pytest._code.code import ExceptionInfo, ReprFileLocation, TerminalRepr
-from _pytest.fixtures import FixtureRequest
-
-
-DOCTEST_REPORT_CHOICE_NONE = 'none'
-DOCTEST_REPORT_CHOICE_CDIFF = 'cdiff'
-DOCTEST_REPORT_CHOICE_NDIFF = 'ndiff'
-DOCTEST_REPORT_CHOICE_UDIFF = 'udiff'
-DOCTEST_REPORT_CHOICE_ONLY_FIRST_FAILURE = 'only_first_failure'
-
-DOCTEST_REPORT_CHOICES = (
-    DOCTEST_REPORT_CHOICE_NONE,
-    DOCTEST_REPORT_CHOICE_CDIFF,
-    DOCTEST_REPORT_CHOICE_NDIFF,
-    DOCTEST_REPORT_CHOICE_UDIFF,
-    DOCTEST_REPORT_CHOICE_ONLY_FIRST_FAILURE,
-)
-
-
-def pytest_addoption(parser):
-    parser.addini('doctest_optionflags', 'option flags for doctests',
-                  type="args", default=["ELLIPSIS"])
-    parser.addini("doctest_encoding", 'encoding used for doctest files', default="utf-8")
-    group = parser.getgroup("collect")
-    group.addoption("--doctest-modules",
-                    action="store_true", default=False,
-                    help="run doctests in all .py modules",
-                    dest="doctestmodules")
-    group.addoption("--doctest-report",
-                    type=str.lower, default="udiff",
-                    help="choose another output format for diffs on doctest failure",
-                    choices=DOCTEST_REPORT_CHOICES,
-                    dest="doctestreport")
-    group.addoption("--doctest-glob",
-                    action="append", default=[], metavar="pat",
-                    help="doctests file matching pattern, default: test*.txt",
-                    dest="doctestglob")
-    group.addoption("--doctest-ignore-import-errors",
-                    action="store_true", default=False,
-                    help="ignore doctest ImportErrors",
-                    dest="doctest_ignore_import_errors")
-
-
-def pytest_collect_file(path, parent):
-    config = parent.config
-    if path.ext == ".py":
-        if config.option.doctestmodules:
-            return DoctestModule(path, parent)
-    elif _is_doctest(config, path, parent):
-        return DoctestTextfile(path, parent)
-
-
-def _is_doctest(config, path, parent):
-    if path.ext in ('.txt', '.rst') and parent.session.isinitpath(path):
-        return True
-    globs = config.getoption("doctestglob") or ['test*.txt']
-    for glob in globs:
-        if path.check(fnmatch=glob):
-            return True
-    return False
-
-
-class ReprFailDoctest(TerminalRepr):
-
-    def __init__(self, reprlocation, lines):
-        self.reprlocation = reprlocation
-        self.lines = lines
-
-    def toterminal(self, tw):
-        for line in self.lines:
-            tw.line(line)
-        self.reprlocation.toterminal(tw)
-
-
-class DoctestItem(pytest.Item):
-    def __init__(self, name, parent, runner=None, dtest=None):
-        super(DoctestItem, self).__init__(name, parent)
-        self.runner = runner
-        self.dtest = dtest
-        self.obj = None
-        self.fixture_request = None
-
-    def setup(self):
-        if self.dtest is not None:
-            self.fixture_request = _setup_fixtures(self)
-            globs = dict(getfixture=self.fixture_request.getfixturevalue)
-            for name, value in self.fixture_request.getfixturevalue('doctest_namespace').items():
-                globs[name] = value
-            self.dtest.globs.update(globs)
-
-    def runtest(self):
-        _check_all_skipped(self.dtest)
-        self.runner.run(self.dtest)
-
-    def repr_failure(self, excinfo):
-        import doctest
-        if excinfo.errisinstance((doctest.DocTestFailure,
-                                  doctest.UnexpectedException)):
-            doctestfailure = excinfo.value
-            example = doctestfailure.example
-            test = doctestfailure.test
-            filename = test.filename
-            if test.lineno is None:
-                lineno = None
-            else:
-                lineno = test.lineno + example.lineno + 1
-            message = excinfo.type.__name__
-            reprlocation = ReprFileLocation(filename, lineno, message)
-            checker = _get_checker()
-            report_choice = _get_report_choice(self.config.getoption("doctestreport"))
-            if lineno is not None:
-                lines = doctestfailure.test.docstring.splitlines(False)
-                # add line numbers to the left of the error message
-                lines = ["%03d %s" % (i + test.lineno + 1, x)
-                         for (i, x) in enumerate(lines)]
-                # trim docstring error lines to 10
-                lines = lines[max(example.lineno - 9, 0):example.lineno + 1]
-            else:
-                lines = ['EXAMPLE LOCATION UNKNOWN, not showing all tests of that example']
-                indent = '>>>'
-                for line in example.source.splitlines():
-                    lines.append('??? %s %s' % (indent, line))
-                    indent = '...'
-            if excinfo.errisinstance(doctest.DocTestFailure):
-                lines += checker.output_difference(example,
-                                                   doctestfailure.got, report_choice).split("\n")
-            else:
-                inner_excinfo = ExceptionInfo(excinfo.value.exc_info)
-                lines += ["UNEXPECTED EXCEPTION: %s" %
-                          repr(inner_excinfo.value)]
-                lines += traceback.format_exception(*excinfo.value.exc_info)
-            return ReprFailDoctest(reprlocation, lines)
-        else:
-            return super(DoctestItem, self).repr_failure(excinfo)
-
-    def reportinfo(self):
-        return self.fspath, self.dtest.lineno, "[doctest] %s" % self.name
-
-
-def _get_flag_lookup():
-    import doctest
-    return dict(DONT_ACCEPT_TRUE_FOR_1=doctest.DONT_ACCEPT_TRUE_FOR_1,
-                DONT_ACCEPT_BLANKLINE=doctest.DONT_ACCEPT_BLANKLINE,
-                NORMALIZE_WHITESPACE=doctest.NORMALIZE_WHITESPACE,
-                ELLIPSIS=doctest.ELLIPSIS,
-                IGNORE_EXCEPTION_DETAIL=doctest.IGNORE_EXCEPTION_DETAIL,
-                COMPARISON_FLAGS=doctest.COMPARISON_FLAGS,
-                ALLOW_UNICODE=_get_allow_unicode_flag(),
-                ALLOW_BYTES=_get_allow_bytes_flag(),
-                )
-
-
-def get_optionflags(parent):
-    optionflags_str = parent.config.getini("doctest_optionflags")
-    flag_lookup_table = _get_flag_lookup()
-    flag_acc = 0
-    for flag in optionflags_str:
-        flag_acc |= flag_lookup_table[flag]
-    return flag_acc
-
-
-class DoctestTextfile(pytest.Module):
-    obj = None
-
-    def collect(self):
-        import doctest
-
-        # inspired by doctest.testfile; ideally we would use it directly,
-        # but it doesn't support passing a custom checker
-        encoding = self.config.getini("doctest_encoding")
-        text = self.fspath.read_text(encoding)
-        filename = str(self.fspath)
-        name = self.fspath.basename
-        globs = {'__name__': '__main__'}
-
-        optionflags = get_optionflags(self)
-        runner = doctest.DebugRunner(verbose=0, optionflags=optionflags,
-                                     checker=_get_checker())
-        _fix_spoof_python2(runner, encoding)
-
-        parser = doctest.DocTestParser()
-        test = parser.get_doctest(text, globs, name, filename, 0)
-        if test.examples:
-            yield DoctestItem(test.name, self, runner, test)
-
-
-def _check_all_skipped(test):
-    """raises pytest.skip() if all examples in the given DocTest have the SKIP
-    option set.
-    """
-    import doctest
-    all_skipped = all(x.options.get(doctest.SKIP, False) for x in test.examples)
-    if all_skipped:
-        pytest.skip('all tests skipped by +SKIP option')
-
-
-class DoctestModule(pytest.Module):
-    def collect(self):
-        import doctest
-        if self.fspath.basename == "conftest.py":
-            module = self.config.pluginmanager._importconftest(self.fspath)
-        else:
-            try:
-                module = self.fspath.pyimport()
-            except ImportError:
-                if self.config.getvalue('doctest_ignore_import_errors'):
-                    pytest.skip('unable to import module %r' % self.fspath)
-                else:
-                    raise
-        # uses internal doctest module parsing mechanism
-        finder = doctest.DocTestFinder()
-        optionflags = get_optionflags(self)
-        runner = doctest.DebugRunner(verbose=0, optionflags=optionflags,
-                                     checker=_get_checker())
-
-        for test in finder.find(module, module.__name__):
-            if test.examples:  # skip empty doctests
-                yield DoctestItem(test.name, self, runner, test)
-
-
-def _setup_fixtures(doctest_item):
-    """
-    Used by DoctestTextfile and DoctestItem to setup fixture information.
-    """
-    def func():
-        pass
-
-    doctest_item.funcargs = {}
-    fm = doctest_item.session._fixturemanager
-    doctest_item._fixtureinfo = fm.getfixtureinfo(node=doctest_item, func=func,
-                                                  cls=None, funcargs=False)
-    fixture_request = FixtureRequest(doctest_item)
-    fixture_request._fillfixtures()
-    return fixture_request
-
-
-def _get_checker():
-    """
-    Returns a doctest.OutputChecker subclass that takes in account the
-    ALLOW_UNICODE option to ignore u'' prefixes in strings and ALLOW_BYTES
-    to strip b'' prefixes.
-    Useful when the same doctest should run in Python 2 and Python 3.
-
-    An inner class is used to avoid importing "doctest" at the module
-    level.
-    """
-    if hasattr(_get_checker, 'LiteralsOutputChecker'):
-        return _get_checker.LiteralsOutputChecker()
-
-    import doctest
-    import re
-
-    class LiteralsOutputChecker(doctest.OutputChecker):
-        """
-        Copied from doctest_nose_plugin.py from the nltk project:
-            https://github.com/nltk/nltk
-
-        Further extended to also support byte literals.
-        """
-
-        _unicode_literal_re = re.compile(r"(\W|^)[uU]([rR]?[\'\"])", re.UNICODE)
-        _bytes_literal_re = re.compile(r"(\W|^)[bB]([rR]?[\'\"])", re.UNICODE)
-
-        def check_output(self, want, got, optionflags):
-            res = doctest.OutputChecker.check_output(self, want, got,
-                                                     optionflags)
-            if res:
-                return True
-
-            allow_unicode = optionflags & _get_allow_unicode_flag()
-            allow_bytes = optionflags & _get_allow_bytes_flag()
-            if not allow_unicode and not allow_bytes:
-                return False
-
-            else:  # pragma: no cover
-                def remove_prefixes(regex, txt):
-                    return re.sub(regex, r'\1\2', txt)
-
-                if allow_unicode:
-                    want = remove_prefixes(self._unicode_literal_re, want)
-                    got = remove_prefixes(self._unicode_literal_re, got)
-                if allow_bytes:
-                    want = remove_prefixes(self._bytes_literal_re, want)
-                    got = remove_prefixes(self._bytes_literal_re, got)
-                res = doctest.OutputChecker.check_output(self, want, got,
-                                                         optionflags)
-                return res
-
-    _get_checker.LiteralsOutputChecker = LiteralsOutputChecker
-    return _get_checker.LiteralsOutputChecker()
-
-
-def _get_allow_unicode_flag():
-    """
-    Registers and returns the ALLOW_UNICODE flag.
-    """
-    import doctest
-    return doctest.register_optionflag('ALLOW_UNICODE')
-
-
-def _get_allow_bytes_flag():
-    """
-    Registers and returns the ALLOW_BYTES flag.
-    """
-    import doctest
-    return doctest.register_optionflag('ALLOW_BYTES')
-
-
-def _get_report_choice(key):
-    """
-    This function returns the actual `doctest` module flag value, we want to do it as late as possible to avoid
-    importing `doctest` and all its dependencies when parsing options, as it adds overhead and breaks tests.
-    """
-    import doctest
-
-    return {
-        DOCTEST_REPORT_CHOICE_UDIFF: doctest.REPORT_UDIFF,
-        DOCTEST_REPORT_CHOICE_CDIFF: doctest.REPORT_CDIFF,
-        DOCTEST_REPORT_CHOICE_NDIFF: doctest.REPORT_NDIFF,
-        DOCTEST_REPORT_CHOICE_ONLY_FIRST_FAILURE: doctest.REPORT_ONLY_FIRST_FAILURE,
-        DOCTEST_REPORT_CHOICE_NONE: 0,
-    }[key]
-
-
-def _fix_spoof_python2(runner, encoding):
-    """
-    Installs a "SpoofOut" into the given DebugRunner so it properly deals with unicode output. This
-    should patch only doctests for text files because they don't have a way to declare their
-    encoding. Doctests in docstrings from Python modules don't have the same problem given that
-    Python already decoded the strings.
-
-    This fixes the problem related in issue #2434.
-    """
-    from _pytest.compat import _PY2
-    if not _PY2:
-        return
-
-    from doctest import _SpoofOut
-
-    class UnicodeSpoof(_SpoofOut):
-
-        def getvalue(self):
-            result = _SpoofOut.getvalue(self)
-            if encoding:
-                result = result.decode(encoding)
-            return result
-
-    runner._fakeout = UnicodeSpoof()
-
-
-@pytest.fixture(scope='session')
-def doctest_namespace():
-    """
-    Inject names into the doctest namespace.
-    """
-    return dict()
deleted file mode 100644
--- a/third_party/python/pytest/_pytest/fixtures.py
+++ /dev/null
@@ -1,1140 +0,0 @@
-from __future__ import absolute_import, division, print_function
-
-import inspect
-import sys
-import warnings
-
-import py
-from py._code.code import FormattedExcinfo
-
-import _pytest
-from _pytest import nodes
-from _pytest._code.code import TerminalRepr
-from _pytest.compat import (
-    NOTSET, exc_clear, _format_args,
-    getfslineno, get_real_func,
-    is_generator, isclass, getimfunc,
-    getlocation, getfuncargnames,
-    safe_getattr,
-    FuncargnamesCompatAttr,
-)
-from _pytest.outcomes import fail, TEST_OUTCOME
-
-
-if sys.version_info[:2] == (2, 6):
-    from ordereddict import OrderedDict
-else:
-    from collections import OrderedDict
-
-
-def pytest_sessionstart(session):
-    import _pytest.python
-    scopename2class.update({
-        'class': _pytest.python.Class,
-        'module': _pytest.python.Module,
-        'function': _pytest.main.Item,
-    })
-    session._fixturemanager = FixtureManager(session)
-
-
-scopename2class = {}
-
-
-scope2props = dict(session=())
-scope2props["module"] = ("fspath", "module")
-scope2props["class"] = scope2props["module"] + ("cls",)
-scope2props["instance"] = scope2props["class"] + ("instance", )
-scope2props["function"] = scope2props["instance"] + ("function", "keywords")
-
-
-def scopeproperty(name=None, doc=None):
-    def decoratescope(func):
-        scopename = name or func.__name__
-
-        def provide(self):
-            if func.__name__ in scope2props[self.scope]:
-                return func(self)
-            raise AttributeError("%s not available in %s-scoped context" % (
-                scopename, self.scope))
-
-        return property(provide, None, None, func.__doc__)
-    return decoratescope
-
-
-def get_scope_node(node, scope):
-    cls = scopename2class.get(scope)
-    if cls is None:
-        if scope == "session":
-            return node.session
-        raise ValueError("unknown scope")
-    return node.getparent(cls)
-
-
-def add_funcarg_pseudo_fixture_def(collector, metafunc, fixturemanager):
-    # this function will transform all collected calls to a functions
-    # if they use direct funcargs (i.e. direct parametrization)
-    # because we want later test execution to be able to rely on
-    # an existing FixtureDef structure for all arguments.
-    # XXX we can probably avoid this algorithm  if we modify CallSpec2
-    # to directly care for creating the fixturedefs within its methods.
-    if not metafunc._calls[0].funcargs:
-        return  # this function call does not have direct parametrization
-    # collect funcargs of all callspecs into a list of values
-    arg2params = {}
-    arg2scope = {}
-    for callspec in metafunc._calls:
-        for argname, argvalue in callspec.funcargs.items():
-            assert argname not in callspec.params
-            callspec.params[argname] = argvalue
-            arg2params_list = arg2params.setdefault(argname, [])
-            callspec.indices[argname] = len(arg2params_list)
-            arg2params_list.append(argvalue)
-            if argname not in arg2scope:
-                scopenum = callspec._arg2scopenum.get(argname,
-                                                      scopenum_function)
-                arg2scope[argname] = scopes[scopenum]
-        callspec.funcargs.clear()
-
-    # register artificial FixtureDef's so that later at test execution
-    # time we can rely on a proper FixtureDef to exist for fixture setup.
-    arg2fixturedefs = metafunc._arg2fixturedefs
-    for argname, valuelist in arg2params.items():
-        # if we have a scope that is higher than function we need
-        # to make sure we only ever create an according fixturedef on
-        # a per-scope basis. We thus store and cache the fixturedef on the
-        # node related to the scope.
-        scope = arg2scope[argname]
-        node = None
-        if scope != "function":
-            node = get_scope_node(collector, scope)
-            if node is None:
-                assert scope == "class" and isinstance(collector, _pytest.python.Module)
-                # use module-level collector for class-scope (for now)
-                node = collector
-        if node and argname in node._name2pseudofixturedef:
-            arg2fixturedefs[argname] = [node._name2pseudofixturedef[argname]]
-        else:
-            fixturedef = FixtureDef(fixturemanager, '', argname,
-                                    get_direct_param_fixture_func,
-                                    arg2scope[argname],
-                                    valuelist, False, False)
-            arg2fixturedefs[argname] = [fixturedef]
-            if node is not None:
-                node._name2pseudofixturedef[argname] = fixturedef
-
-
-def getfixturemarker(obj):
-    """ return fixturemarker or None if it doesn't exist or raised
-    exceptions."""
-    try:
-        return getattr(obj, "_pytestfixturefunction", None)
-    except TEST_OUTCOME:
-        # some objects raise errors like request (from flask import request)
-        # we don't expect them to be fixture functions
-        return None
-
-
-def get_parametrized_fixture_keys(item, scopenum):
-    """ return list of keys for all parametrized arguments which match
-    the specified scope. """
-    assert scopenum < scopenum_function  # function
-    try:
-        cs = item.callspec
-    except AttributeError:
-        pass
-    else:
-        # cs.indices.items() is random order of argnames.  Need to
-        # sort this so that different calls to
-        # get_parametrized_fixture_keys will be deterministic.
-        for argname, param_index in sorted(cs.indices.items()):
-            if cs._arg2scopenum[argname] != scopenum:
-                continue
-            if scopenum == 0:    # session
-                key = (argname, param_index)
-            elif scopenum == 1:  # module
-                key = (argname, param_index, item.fspath)
-            elif scopenum == 2:  # class
-                key = (argname, param_index, item.fspath, item.cls)
-            yield key
-
-
-# algorithm for sorting on a per-parametrized resource setup basis
-# it is called for scopenum==0 (session) first and performs sorting
-# down to the lower scopes such as to minimize number of "high scope"
-# setups and teardowns
-
-def reorder_items(items):
-    argkeys_cache = {}
-    for scopenum in range(0, scopenum_function):
-        argkeys_cache[scopenum] = d = {}
-        for item in items:
-            keys = OrderedDict.fromkeys(get_parametrized_fixture_keys(item, scopenum))
-            if keys:
-                d[item] = keys
-    return reorder_items_atscope(items, set(), argkeys_cache, 0)
-
-
-def reorder_items_atscope(items, ignore, argkeys_cache, scopenum):
-    if scopenum >= scopenum_function or len(items) < 3:
-        return items
-    items_done = []
-    while 1:
-        items_before, items_same, items_other, newignore = \
-            slice_items(items, ignore, argkeys_cache[scopenum])
-        items_before = reorder_items_atscope(
-            items_before, ignore, argkeys_cache, scopenum + 1)
-        if items_same is None:
-            # nothing to reorder in this scope
-            assert items_other is None
-            return items_done + items_before
-        items_done.extend(items_before)
-        items = items_same + items_other
-        ignore = newignore
-
-
-def slice_items(items, ignore, scoped_argkeys_cache):
-    # we pick the first item which uses a fixture instance in the
-    # requested scope and which we haven't seen yet.  We slice the input
-    # items list into a list of items_nomatch, items_same and
-    # items_other
-    if scoped_argkeys_cache:  # do we need to do work at all?
-        it = iter(items)
-        # first find a slicing key
-        for i, item in enumerate(it):
-            argkeys = scoped_argkeys_cache.get(item)
-            if argkeys is not None:
-                newargkeys = OrderedDict.fromkeys(k for k in argkeys if k not in ignore)
-                if newargkeys:  # found a slicing key
-                    slicing_argkey, _ = newargkeys.popitem()
-                    items_before = items[:i]
-                    items_same = [item]
-                    items_other = []
-                    # now slice the remainder of the list
-                    for item in it:
-                        argkeys = scoped_argkeys_cache.get(item)
-                        if argkeys and slicing_argkey in argkeys and \
-                                slicing_argkey not in ignore:
-                            items_same.append(item)
-                        else:
-                            items_other.append(item)
-                    newignore = ignore.copy()
-                    newignore.add(slicing_argkey)
-                    return (items_before, items_same, items_other, newignore)
-    return items, None, None, None
-
-
-def fillfixtures(function):
-    """ fill missing funcargs for a test function. """
-    try:
-        request = function._request
-    except AttributeError:
-        # XXX this special code path is only expected to execute
-        # with the oejskit plugin.  It uses classes with funcargs
-        # and we thus have to work a bit to allow this.
-        fm = function.session._fixturemanager
-        fi = fm.getfixtureinfo(function.parent, function.obj, None)
-        function._fixtureinfo = fi
-        request = function._request = FixtureRequest(function)
-        request._fillfixtures()
-        # prune out funcargs for jstests
-        newfuncargs = {}
-        for name in fi.argnames:
-            newfuncargs[name] = function.funcargs[name]
-        function.funcargs = newfuncargs
-    else:
-        request._fillfixtures()
-
-
-def get_direct_param_fixture_func(request):
-    return request.param
-
-
-class FuncFixtureInfo:
-    def __init__(self, argnames, names_closure, name2fixturedefs):
-        self.argnames = argnames
-        self.names_closure = names_closure
-        self.name2fixturedefs = name2fixturedefs
-
-
-class FixtureRequest(FuncargnamesCompatAttr):
-    """ A request for a fixture from a test or fixture function.
-
-    A request object gives access to the requesting test context
-    and has an optional ``param`` attribute in case
-    the fixture is parametrized indirectly.
-    """
-
-    def __init__(self, pyfuncitem):
-        self._pyfuncitem = pyfuncitem
-        #: fixture for which this request is being performed
-        self.fixturename = None
-        #: Scope string, one of "function", "class", "module", "session"
-        self.scope = "function"
-        self._fixture_values = {}  # argname -> fixture value
-        self._fixture_defs = {}  # argname -> FixtureDef
-        fixtureinfo = pyfuncitem._fixtureinfo
-        self._arg2fixturedefs = fixtureinfo.name2fixturedefs.copy()
-        self._arg2index = {}
-        self._fixturemanager = pyfuncitem.session._fixturemanager
-
-    @property
-    def fixturenames(self):
-        # backward incompatible note: now a readonly property
-        return list(self._pyfuncitem._fixtureinfo.names_closure)
-
-    @property
-    def node(self):
-        """ underlying collection node (depends on current request scope)"""
-        return self._getscopeitem(self.scope)
-
-    def _getnextfixturedef(self, argname):
-        fixturedefs = self._arg2fixturedefs.get(argname, None)
-        if fixturedefs is None:
-            # we arrive here because of a  a dynamic call to
-            # getfixturevalue(argname) usage which was naturally
-            # not known at parsing/collection time
-            parentid = self._pyfuncitem.parent.nodeid
-            fixturedefs = self._fixturemanager.getfixturedefs(argname, parentid)
-            self._arg2fixturedefs[argname] = fixturedefs
-        # fixturedefs list is immutable so we maintain a decreasing index
-        index = self._arg2index.get(argname, 0) - 1
-        if fixturedefs is None or (-index > len(fixturedefs)):
-            raise FixtureLookupError(argname, self)
-        self._arg2index[argname] = index
-        return fixturedefs[index]
-
-    @property
-    def config(self):
-        """ the pytest config object associated with this request. """
-        return self._pyfuncitem.config
-
-    @scopeproperty()
-    def function(self):
-        """ test function object if the request has a per-function scope. """
-        return self._pyfuncitem.obj
-
-    @scopeproperty("class")
-    def cls(self):
-        """ class (can be None) where the test function was collected. """
-        clscol = self._pyfuncitem.getparent(_pytest.python.Class)
-        if clscol:
-            return clscol.obj
-
-    @property
-    def instance(self):
-        """ instance (can be None) on which test function was collected. """
-        # unittest support hack, see _pytest.unittest.TestCaseFunction
-        try:
-            return self._pyfuncitem._testcase
-        except AttributeError:
-            function = getattr(self, "function", None)
-            if function is not None:
-                return py.builtin._getimself(function)
-
-    @scopeproperty()
-    def module(self):
-        """ python module object where the test function was collected. """
-        return self._pyfuncitem.getparent(_pytest.python.Module).obj
-
-    @scopeproperty()
-    def fspath(self):
-        """ the file system path of the test module which collected this test. """
-        return self._pyfuncitem.fspath
-
-    @property
-    def keywords(self):
-        """ keywords/markers dictionary for the underlying node. """
-        return self.node.keywords
-
-    @property
-    def session(self):
-        """ pytest session object. """
-        return self._pyfuncitem.session
-
-    def addfinalizer(self, finalizer):
-        """ add finalizer/teardown function to be called after the
-        last test within the requesting test context finished
-        execution. """
-        # XXX usually this method is shadowed by fixturedef specific ones
-        self._addfinalizer(finalizer, scope=self.scope)
-
-    def _addfinalizer(self, finalizer, scope):
-        colitem = self._getscopeitem(scope)
-        self._pyfuncitem.session._setupstate.addfinalizer(
-            finalizer=finalizer, colitem=colitem)
-
-    def applymarker(self, marker):
-        """ Apply a marker to a single test function invocation.
-        This method is useful if you don't want to have a keyword/marker
-        on all function invocations.
-
-        :arg marker: a :py:class:`_pytest.mark.MarkDecorator` object
-            created by a call to ``pytest.mark.NAME(...)``.
-        """
-        try:
-            self.node.keywords[marker.markname] = marker
-        except AttributeError:
-            raise ValueError(marker)
-
-    def raiseerror(self, msg):
-        """ raise a FixtureLookupError with the given message. """
-        raise self._fixturemanager.FixtureLookupError(None, self, msg)
-
-    def _fillfixtures(self):
-        item = self._pyfuncitem
-        fixturenames = getattr(item, "fixturenames", self.fixturenames)
-        for argname in fixturenames:
-            if argname not in item.funcargs:
-                item.funcargs[argname] = self.getfixturevalue(argname)
-
-    def cached_setup(self, setup, teardown=None, scope="module", extrakey=None):
-        """ (deprecated) Return a testing resource managed by ``setup`` &
-        ``teardown`` calls.  ``scope`` and ``extrakey`` determine when the
-        ``teardown`` function will be called so that subsequent calls to
-        ``setup`` would recreate the resource.  With pytest-2.3 you often
-        do not need ``cached_setup()`` as you can directly declare a scope
-        on a fixture function and register a finalizer through
-        ``request.addfinalizer()``.
-
-        :arg teardown: function receiving a previously setup resource.
-        :arg setup: a no-argument function creating a resource.
-        :arg scope: a string value out of ``function``, ``class``, ``module``
-            or ``session`` indicating the caching lifecycle of the resource.
-        :arg extrakey: added to internal caching key of (funcargname, scope).
-        """
-        if not hasattr(self.config, '_setupcache'):
-            self.config._setupcache = {}  # XXX weakref?
-        cachekey = (self.fixturename, self._getscopeitem(scope), extrakey)
-        cache = self.config._setupcache
-        try:
-            val = cache[cachekey]
-        except KeyError:
-            self._check_scope(self.fixturename, self.scope, scope)
-            val = setup()
-            cache[cachekey] = val
-            if teardown is not None:
-                def finalizer():
-                    del cache[cachekey]
-                    teardown(val)
-                self._addfinalizer(finalizer, scope=scope)
-        return val
-
-    def getfixturevalue(self, argname):
-        """ Dynamically run a named fixture function.
-
-        Declaring fixtures via function argument is recommended where possible.
-        But if you can only decide whether to use another fixture at test
-        setup time, you may use this function to retrieve it inside a fixture
-        or test function body.
-        """
-        return self._get_active_fixturedef(argname).cached_result[0]
-
-    def getfuncargvalue(self, argname):
-        """ Deprecated, use getfixturevalue. """
-        from _pytest import deprecated
-        warnings.warn(
-            deprecated.GETFUNCARGVALUE,
-            DeprecationWarning,
-            stacklevel=2)
-        return self.getfixturevalue(argname)
-
-    def _get_active_fixturedef(self, argname):
-        try:
-            return self._fixture_defs[argname]
-        except KeyError:
-            try:
-                fixturedef = self._getnextfixturedef(argname)
-            except FixtureLookupError:
-                if argname == "request":
-                    class PseudoFixtureDef:
-                        cached_result = (self, [0], None)
-                        scope = "function"
-                    return PseudoFixtureDef
-                raise
-        # remove indent to prevent the python3 exception
-        # from leaking into the call
-        result = self._getfixturevalue(fixturedef)
-        self._fixture_values[argname] = result
-        self._fixture_defs[argname] = fixturedef
-        return fixturedef
-
-    def _get_fixturestack(self):
-        current = self
-        values = []
-        while 1:
-            fixturedef = getattr(current, "_fixturedef", None)
-            if fixturedef is None:
-                values.reverse()
-                return values
-            values.append(fixturedef)
-            current = current._parent_request
-
-    def _getfixturevalue(self, fixturedef):
-        # prepare a subrequest object before calling fixture function
-        # (latter managed by fixturedef)
-        argname = fixturedef.argname
-        funcitem = self._pyfuncitem
-        scope = fixturedef.scope
-        try:
-            param = funcitem.callspec.getparam(argname)
-        except (AttributeError, ValueError):
-            param = NOTSET
-            param_index = 0
-            if fixturedef.params is not None:
-                frame = inspect.stack()[3]
-                frameinfo = inspect.getframeinfo(frame[0])
-                source_path = frameinfo.filename
-                source_lineno = frameinfo.lineno
-                source_path = py.path.local(source_path)
-                if source_path.relto(funcitem.config.rootdir):
-                    source_path = source_path.relto(funcitem.config.rootdir)
-                msg = (
-                    "The requested fixture has no parameter defined for the "
-                    "current test.\n\nRequested fixture '{0}' defined in:\n{1}"
-                    "\n\nRequested here:\n{2}:{3}".format(
-                        fixturedef.argname,
-                        getlocation(fixturedef.func, funcitem.config.rootdir),
-                        source_path,
-                        source_lineno,
-                    )
-                )
-                fail(msg)
-        else:
-            # indices might not be set if old-style metafunc.addcall() was used
-            param_index = funcitem.callspec.indices.get(argname, 0)
-            # if a parametrize invocation set a scope it will override
-            # the static scope defined with the fixture function
-            paramscopenum = funcitem.callspec._arg2scopenum.get(argname)
-            if paramscopenum is not None:
-                scope = scopes[paramscopenum]
-
-        subrequest = SubRequest(self, scope, param, param_index, fixturedef)
-
-        # check if a higher-level scoped fixture accesses a lower level one
-        subrequest._check_scope(argname, self.scope, scope)
-
-        # clear sys.exc_info before invoking the fixture (python bug?)
-        # if its not explicitly cleared it will leak into the call
-        exc_clear()
-        try:
-            # call the fixture function
-            val = fixturedef.execute(request=subrequest)
-        finally:
-            # if fixture function failed it might have registered finalizers
-            self.session._setupstate.addfinalizer(fixturedef.finish,
-                                                  subrequest.node)
-        return val
-
-    def _check_scope(self, argname, invoking_scope, requested_scope):
-        if argname == "request":
-            return
-        if scopemismatch(invoking_scope, requested_scope):
-            # try to report something helpful
-            lines = self._factorytraceback()
-            fail("ScopeMismatch: You tried to access the %r scoped "
-                 "fixture %r with a %r scoped request object, "
-                 "involved factories\n%s" % (
-                     (requested_scope, argname, invoking_scope, "\n".join(lines))),
-                 pytrace=False)
-
-    def _factorytraceback(self):
-        lines = []
-        for fixturedef in self._get_fixturestack():
-            factory = fixturedef.func
-            fs, lineno = getfslineno(factory)
-            p = self._pyfuncitem.session.fspath.bestrelpath(fs)
-            args = _format_args(factory)
-            lines.append("%s:%d:  def %s%s" % (
-                p, lineno, factory.__name__, args))
-        return lines
-
-    def _getscopeitem(self, scope):
-        if scope == "function":
-            # this might also be a non-function Item despite its attribute name
-            return self._pyfuncitem
-        node = get_scope_node(self._pyfuncitem, scope)
-        if node is None and scope == "class":
-            # fallback to function item itself
-            node = self._pyfuncitem
-        assert node
-        return node
-
-    def __repr__(self):
-        return "<FixtureRequest for %r>" % (self.node)
-
-
-class SubRequest(FixtureRequest):
-    """ a sub request for handling getting a fixture from a
-    test function/fixture. """
-
-    def __init__(self, request, scope, param, param_index, fixturedef):
-        self._parent_request = request
-        self.fixturename = fixturedef.argname
-        if param is not NOTSET:
-            self.param = param
-        self.param_index = param_index
-        self.scope = scope
-        self._fixturedef = fixturedef
-        self._pyfuncitem = request._pyfuncitem
-        self._fixture_values = request._fixture_values
-        self._fixture_defs = request._fixture_defs
-        self._arg2fixturedefs = request._arg2fixturedefs
-        self._arg2index = request._arg2index
-        self._fixturemanager = request._fixturemanager
-
-    def __repr__(self):
-        return "<SubRequest %r for %r>" % (self.fixturename, self._pyfuncitem)
-
-    def addfinalizer(self, finalizer):
-        self._fixturedef.addfinalizer(finalizer)
-
-
-class ScopeMismatchError(Exception):
-    """ A fixture function tries to use a different fixture function which
-    which has a lower scope (e.g. a Session one calls a function one)
-    """
-
-
-scopes = "session module class function".split()
-scopenum_function = scopes.index("function")
-
-
-def scopemismatch(currentscope, newscope):
-    return scopes.index(newscope) > scopes.index(currentscope)
-
-
-def scope2index(scope, descr, where=None):
-    """Look up the index of ``scope`` and raise a descriptive value error
-    if not defined.
-    """
-    try:
-        return scopes.index(scope)
-    except ValueError:
-        raise ValueError(
-            "{0} {1}has an unsupported scope value '{2}'".format(
-                descr, 'from {0} '.format(where) if where else '',
-                scope)
-        )
-
-
-class FixtureLookupError(LookupError):
-    """ could not return a requested Fixture (missing or invalid). """
-
-    def __init__(self, argname, request, msg=None):
-        self.argname = argname
-        self.request = request
-        self.fixturestack = request._get_fixturestack()
-        self.msg = msg
-
-    def formatrepr(self):
-        tblines = []
-        addline = tblines.append
-        stack = [self.request._pyfuncitem.obj]
-        stack.extend(map(lambda x: x.func, self.fixturestack))
-        msg = self.msg
-        if msg is not None:
-            # the last fixture raise an error, let's present
-            # it at the requesting side
-            stack = stack[:-1]
-        for function in stack:
-            fspath, lineno = getfslineno(function)
-            try:
-                lines, _ = inspect.getsourcelines(get_real_func(function))
-            except (IOError, IndexError, TypeError):
-                error_msg = "file %s, line %s: source code not available"
-                addline(error_msg % (fspath, lineno + 1))
-            else:
-                addline("file %s, line %s" % (fspath, lineno + 1))
-                for i, line in enumerate(lines):
-                    line = line.rstrip()
-                    addline("  " + line)
-                    if line.lstrip().startswith('def'):
-                        break
-
-        if msg is None:
-            fm = self.request._fixturemanager
-            available = []
-            parentid = self.request._pyfuncitem.parent.nodeid
-            for name, fixturedefs in fm._arg2fixturedefs.items():
-                faclist = list(fm._matchfactories(fixturedefs, parentid))
-                if faclist and name not in available:
-                    available.append(name)
-            msg = "fixture %r not found" % (self.argname,)
-            msg += "\n available fixtures: %s" % (", ".join(sorted(available)),)
-            msg += "\n use 'pytest --fixtures [testpath]' for help on them."
-
-        return FixtureLookupErrorRepr(fspath, lineno, tblines, msg, self.argname)
-
-
-class FixtureLookupErrorRepr(TerminalRepr):
-    def __init__(self, filename, firstlineno, tblines, errorstring, argname):
-        self.tblines = tblines
-        self.errorstring = errorstring
-        self.filename = filename
-        self.firstlineno = firstlineno
-        self.argname = argname
-
-    def toterminal(self, tw):
-        # tw.line("FixtureLookupError: %s" %(self.argname), red=True)
-        for tbline in self.tblines:
-            tw.line(tbline.rstrip())
-        lines = self.errorstring.split("\n")
-        if lines:
-            tw.line('{0}       {1}'.format(FormattedExcinfo.fail_marker,
-                                           lines[0].strip()), red=True)
-            for line in lines[1:]:
-                tw.line('{0}       {1}'.format(FormattedExcinfo.flow_marker,
-                                               line.strip()), red=True)
-        tw.line()
-        tw.line("%s:%d" % (self.filename, self.firstlineno + 1))
-
-
-def fail_fixturefunc(fixturefunc, msg):
-    fs, lineno = getfslineno(fixturefunc)
-    location = "%s:%s" % (fs, lineno + 1)
-    source = _pytest._code.Source(fixturefunc)
-    fail(msg + ":\n\n" + str(source.indent()) + "\n" + location,
-         pytrace=False)
-
-
-def call_fixture_func(fixturefunc, request, kwargs):
-    yieldctx = is_generator(fixturefunc)
-    if yieldctx:
-        it = fixturefunc(**kwargs)
-        res = next(it)
-
-        def teardown():
-            try:
-                next(it)
-            except StopIteration:
-                pass
-            else:
-                fail_fixturefunc(fixturefunc,
-                                 "yield_fixture function has more than one 'yield'")
-
-        request.addfinalizer(teardown)
-    else:
-        res = fixturefunc(**kwargs)
-    return res
-
-
-class FixtureDef:
-    """ A container for a factory definition. """
-
-    def __init__(self, fixturemanager, baseid, argname, func, scope, params,
-                 unittest=False, ids=None):
-        self._fixturemanager = fixturemanager
-        self.baseid = baseid or ''
-        self.has_location = baseid is not None
-        self.func = func
-        self.argname = argname
-        self.scope = scope
-        self.scopenum = scope2index(
-            scope or "function",
-            descr='fixture {0}'.format(func.__name__),
-            where=baseid
-        )
-        self.params = params
-        startindex = unittest and 1 or None
-        self.argnames = getfuncargnames(func, startindex=startindex)
-        self.unittest = unittest
-        self.ids = ids
-        self._finalizer = []
-
-    def addfinalizer(self, finalizer):
-        self._finalizer.append(finalizer)
-
-    def finish(self):
-        exceptions = []
-        try:
-            while self._finalizer:
-                try:
-                    func = self._finalizer.pop()
-                    func()
-                except:  # noqa
-                    exceptions.append(sys.exc_info())
-            if exceptions:
-                e = exceptions[0]
-                del exceptions  # ensure we don't keep all frames alive because of the traceback
-                py.builtin._reraise(*e)
-
-        finally:
-            ihook = self._fixturemanager.session.ihook
-            ihook.pytest_fixture_post_finalizer(fixturedef=self)
-            # even if finalization fails, we invalidate
-            # the cached fixture value
-            if hasattr(self, "cached_result"):
-                del self.cached_result
-
-    def execute(self, request):
-        # get required arguments and register our own finish()
-        # with their finalization
-        for argname in self.argnames:
-            fixturedef = request._get_active_fixturedef(argname)
-            if argname != "request":
-                fixturedef.addfinalizer(self.finish)
-
-        my_cache_key = request.param_index
-        cached_result = getattr(self, "cached_result", None)
-        if cached_result is not None:
-            result, cache_key, err = cached_result
-            if my_cache_key == cache_key:
-                if err is not None:
-                    py.builtin._reraise(*err)
-                else:
-                    return result
-            # we have a previous but differently parametrized fixture instance
-            # so we need to tear it down before creating a new one
-            self.finish()
-            assert not hasattr(self, "cached_result")
-
-        ihook = self._fixturemanager.session.ihook
-        return ihook.pytest_fixture_setup(fixturedef=self, request=request)
-
-    def __repr__(self):
-        return ("<FixtureDef name=%r scope=%r baseid=%r >" %
-                (self.argname, self.scope, self.baseid))
-
-
-def pytest_fixture_setup(fixturedef, request):
-    """ Execution of fixture setup. """
-    kwargs = {}
-    for argname in fixturedef.argnames:
-        fixdef = request._get_active_fixturedef(argname)
-        result, arg_cache_key, exc = fixdef.cached_result
-        request._check_scope(argname, request.scope, fixdef.scope)
-        kwargs[argname] = result
-
-    fixturefunc = fixturedef.func
-    if fixturedef.unittest:
-        if request.instance is not None:
-            # bind the unbound method to the TestCase instance
-            fixturefunc = fixturedef.func.__get__(request.instance)
-    else:
-        # the fixture function needs to be bound to the actual
-        # request.instance so that code working with "fixturedef" behaves
-        # as expected.
-        if request.instance is not None:
-            fixturefunc = getimfunc(fixturedef.func)
-            if fixturefunc != fixturedef.func:
-                fixturefunc = fixturefunc.__get__(request.instance)
-    my_cache_key = request.param_index
-    try:
-        result = call_fixture_func(fixturefunc, request, kwargs)
-    except TEST_OUTCOME:
-        fixturedef.cached_result = (None, my_cache_key, sys.exc_info())
-        raise
-    fixturedef.cached_result = (result, my_cache_key, None)
-    return result
-
-
-class FixtureFunctionMarker:
-    def __init__(self, scope, params, autouse=False, ids=None, name=None):
-        self.scope = scope
-        self.params = params
-        self.autouse = autouse
-        self.ids = ids
-        self.name = name
-
-    def __call__(self, function):
-        if isclass(function):
-            raise ValueError(
-                "class fixtures not supported (may be in the future)")
-        function._pytestfixturefunction = self
-        return function
-
-
-def fixture(scope="function", params=None, autouse=False, ids=None, name=None):
-    """ (return a) decorator to mark a fixture factory function.
-
-    This decorator can be used (with or without parameters) to define a
-    fixture function.  The name of the fixture function can later be
-    referenced to cause its invocation ahead of running tests: test
-    modules or classes can use the pytest.mark.usefixtures(fixturename)
-    marker.  Test functions can directly use fixture names as input
-    arguments in which case the fixture instance returned from the fixture
-    function will be injected.
-
-    :arg scope: the scope for which this fixture is shared, one of
-                "function" (default), "class", "module" or "session".
-
-    :arg params: an optional list of parameters which will cause multiple
-                invocations of the fixture function and all of the tests
-                using it.
-
-    :arg autouse: if True, the fixture func is activated for all tests that
-                can see it.  If False (the default) then an explicit
-                reference is needed to activate the fixture.
-
-    :arg ids: list of string ids each corresponding to the params
-                so that they are part of the test id. If no ids are provided
-                they will be generated automatically from the params.
-
-    :arg name: the name of the fixture. This defaults to the name of the
-                decorated function. If a fixture is used in the same module in
-                which it is defined, the function name of the fixture will be
-                shadowed by the function arg that requests the fixture; one way
-                to resolve this is to name the decorated function
-                ``fixture_<fixturename>`` and then use
-                ``@pytest.fixture(name='<fixturename>')``.
-
-    Fixtures can optionally provide their values to test functions using a ``yield`` statement,
-    instead of ``return``. In this case, the code block after the ``yield`` statement is executed
-    as teardown code regardless of the test outcome. A fixture function must yield exactly once.
-    """
-    if callable(scope) and params is None and autouse is False:
-        # direct decoration
-        return FixtureFunctionMarker(
-            "function", params, autouse, name=name)(scope)
-    if params is not None and not isinstance(params, (list, tuple)):
-        params = list(params)
-    return FixtureFunctionMarker(scope, params, autouse, ids=ids, name=name)
-
-
-def yield_fixture(scope="function", params=None, autouse=False, ids=None, name=None):
-    """ (return a) decorator to mark a yield-fixture factory function.
-
-    .. deprecated:: 3.0
-        Use :py:func:`pytest.fixture` directly instead.
-    """
-    if callable(scope) and params is None and not autouse:
-        # direct decoration
-        return FixtureFunctionMarker(
-            "function", params, autouse, ids=ids, name=name)(scope)
-    else:
-        return FixtureFunctionMarker(scope, params, autouse, ids=ids, name=name)
-
-
-defaultfuncargprefixmarker = fixture()
-
-
-@fixture(scope="session")
-def pytestconfig(request):
-    """ the pytest config object with access to command line opts."""
-    return request.config
-
-
-class FixtureManager:
-    """
-    pytest fixtures definitions and information is stored and managed
-    from this class.
-
-    During collection fm.parsefactories() is called multiple times to parse
-    fixture function definitions into FixtureDef objects and internal
-    data structures.
-
-    During collection of test functions, metafunc-mechanics instantiate
-    a FuncFixtureInfo object which is cached per node/func-name.
-    This FuncFixtureInfo object is later retrieved by Function nodes
-    which themselves offer a fixturenames attribute.
-
-    The FuncFixtureInfo object holds information about fixtures and FixtureDefs
-    relevant for a particular function.  An initial list of fixtures is
-    assembled like this:
-
-    - ini-defined usefixtures
-    - autouse-marked fixtures along the collection chain up from the function
-    - usefixtures markers at module/class/function level
-    - test function funcargs
-
-    Subsequently the funcfixtureinfo.fixturenames attribute is computed
-    as the closure of the fixtures needed to setup the initial fixtures,
-    i. e. fixtures needed by fixture functions themselves are appended
-    to the fixturenames list.
-
-    Upon the test-setup phases all fixturenames are instantiated, retrieved
-    by a lookup of their FuncFixtureInfo.
-    """
-
-    _argprefix = "pytest_funcarg__"
-    FixtureLookupError = FixtureLookupError
-    FixtureLookupErrorRepr = FixtureLookupErrorRepr
-
-    def __init__(self, session):
-        self.session = session
-        self.config = session.config
-        self._arg2fixturedefs = {}
-        self._holderobjseen = set()
-        self._arg2finish = {}
-        self._nodeid_and_autousenames = [("", self.config.getini("usefixtures"))]
-        session.config.pluginmanager.register(self, "funcmanage")
-
-    def getfixtureinfo(self, node, func, cls, funcargs=True):
-        if funcargs and not hasattr(node, "nofuncargs"):
-            argnames = getfuncargnames(func, cls=cls)
-        else:
-            argnames = ()
-        usefixtures = getattr(func, "usefixtures", None)
-        initialnames = argnames
-        if usefixtures is not None:
-            initialnames = usefixtures.args + initialnames
-        fm = node.session._fixturemanager
-        names_closure, arg2fixturedefs = fm.getfixtureclosure(initialnames,
-                                                              node)
-        return FuncFixtureInfo(argnames, names_closure, arg2fixturedefs)
-
-    def pytest_plugin_registered(self, plugin):
-        nodeid = None
-        try:
-            p = py.path.local(plugin.__file__)
-        except AttributeError:
-            pass
-        else:
-            # construct the base nodeid which is later used to check
-            # what fixtures are visible for particular tests (as denoted
-            # by their test id)
-            if p.basename.startswith("conftest.py"):
-                nodeid = p.dirpath().relto(self.config.rootdir)
-                if p.sep != nodes.SEP:
-                    nodeid = nodeid.replace(p.sep, nodes.SEP)
-        self.parsefactories(plugin, nodeid)
-
-    def _getautousenames(self, nodeid):
-        """ return a tuple of fixture names to be used. """
-        autousenames = []
-        for baseid, basenames in self._nodeid_and_autousenames:
-            if nodeid.startswith(baseid):
-                if baseid:
-                    i = len(baseid)
-                    nextchar = nodeid[i:i + 1]
-                    if nextchar and nextchar not in ":/":
-                        continue
-                autousenames.extend(basenames)
-        # make sure autousenames are sorted by scope, scopenum 0 is session
-        autousenames.sort(
-            key=lambda x: self._arg2fixturedefs[x][-1].scopenum)
-        return autousenames
-
-    def getfixtureclosure(self, fixturenames, parentnode):
-        # collect the closure of all fixtures , starting with the given
-        # fixturenames as the initial set.  As we have to visit all
-        # factory definitions anyway, we also return a arg2fixturedefs
-        # mapping so that the caller can reuse it and does not have
-        # to re-discover fixturedefs again for each fixturename
-        # (discovering matching fixtures for a given name/node is expensive)
-
-        parentid = parentnode.nodeid
-        fixturenames_closure = self._getautousenames(parentid)
-
-        def merge(otherlist):
-            for arg in otherlist:
-                if arg not in fixturenames_closure:
-                    fixturenames_closure.append(arg)
-
-        merge(fixturenames)
-        arg2fixturedefs = {}
-        lastlen = -1
-        while lastlen != len(fixturenames_closure):
-            lastlen = len(fixturenames_closure)
-            for argname in fixturenames_closure:
-                if argname in arg2fixturedefs:
-                    continue
-                fixturedefs = self.getfixturedefs(argname, parentid)
-                if fixturedefs:
-                    arg2fixturedefs[argname] = fixturedefs
-                    merge(fixturedefs[-1].argnames)
-        return fixturenames_closure, arg2fixturedefs
-
-    def pytest_generate_tests(self, metafunc):
-        for argname in metafunc.fixturenames:
-            faclist = metafunc._arg2fixturedefs.get(argname)
-            if faclist:
-                fixturedef = faclist[-1]
-                if fixturedef.params is not None:
-                    parametrize_func = getattr(metafunc.function, 'parametrize', None)
-                    func_params = getattr(parametrize_func, 'args', [[None]])
-                    func_kwargs = getattr(parametrize_func, 'kwargs', {})
-                    # skip directly parametrized arguments
-                    if "argnames" in func_kwargs:
-                        argnames = parametrize_func.kwargs["argnames"]
-                    else:
-                        argnames = func_params[0]
-                    if not isinstance(argnames, (tuple, list)):
-                        argnames = [x.strip() for x in argnames.split(",") if x.strip()]
-                    if argname not in func_params and argname not in argnames:
-                        metafunc.parametrize(argname, fixturedef.params,
-                                             indirect=True, scope=fixturedef.scope,
-                                             ids=fixturedef.ids)
-            else:
-                continue  # will raise FixtureLookupError at setup time
-
-    def pytest_collection_modifyitems(self, items):
-        # separate parametrized setups
-        items[:] = reorder_items(items)
-
-    def parsefactories(self, node_or_obj, nodeid=NOTSET, unittest=False):
-        if nodeid is not NOTSET:
-            holderobj = node_or_obj
-        else:
-            holderobj = node_or_obj.obj
-            nodeid = node_or_obj.nodeid
-        if holderobj in self._holderobjseen:
-            return
-        self._holderobjseen.add(holderobj)
-        autousenames = []
-        for name in dir(holderobj):
-            # The attribute can be an arbitrary descriptor, so the attribute
-            # access below can raise. safe_getatt() ignores such exceptions.
-            obj = safe_getattr(holderobj, name, None)
-            # fixture functions have a pytest_funcarg__ prefix (pre-2.3 style)
-            # or are "@pytest.fixture" marked
-            marker = getfixturemarker(obj)
-            if marker is None:
-                if not name.startswith(self._argprefix):
-                    continue
-                if not callable(obj):
-                    continue
-                marker = defaultfuncargprefixmarker
-                from _pytest import deprecated
-                self.config.warn('C1', deprecated.FUNCARG_PREFIX.format(name=name), nodeid=nodeid)
-                name = name[len(self._argprefix):]
-            elif not isinstance(marker, FixtureFunctionMarker):
-                # magic globals  with __getattr__ might have got us a wrong
-                # fixture attribute
-                continue
-            else:
-                if marker.name:
-                    name = marker.name
-                msg = 'fixtures cannot have "pytest_funcarg__" prefix ' \
-                      'and be decorated with @pytest.fixture:\n%s' % name
-                assert not name.startswith(self._argprefix), msg
-
-            fixture_def = FixtureDef(self, nodeid, name, obj,
-                                     marker.scope, marker.params,
-                                     unittest=unittest, ids=marker.ids)
-
-            faclist = self._arg2fixturedefs.setdefault(name, [])
-            if fixture_def.has_location:
-                faclist.append(fixture_def)
-            else:
-                # fixturedefs with no location are at the front
-                # so this inserts the current fixturedef after the
-                # existing fixturedefs from external plugins but
-                # before the fixturedefs provided in conftests.
-                i = len([f for f in faclist if not f.has_location])
-                faclist.insert(i, fixture_def)
-            if marker.autouse:
-                autousenames.append(name)
-
-        if autousenames:
-            self._nodeid_and_autousenames.append((nodeid or '', autousenames))
-
-    def getfixturedefs(self, argname, nodeid):
-        """
-        Gets a list of fixtures which are applicable to the given node id.
-
-        :param str argname: name of the fixture to search for
-        :param str nodeid: full node id of the requesting test.
-        :return: list[FixtureDef]
-        """
-        try:
-            fixturedefs = self._arg2fixturedefs[argname]
-        except KeyError:
-            return None
-        else:
-            return tuple(self._matchfactories(fixturedefs, nodeid))
-
-    def _matchfactories(self, fixturedefs, nodeid):
-        for fixturedef in fixturedefs:
-            if nodes.ischildnode(fixturedef.baseid, nodeid):
-                yield fixturedef
deleted file mode 100644
--- a/third_party/python/pytest/_pytest/freeze_support.py
+++ /dev/null
@@ -1,43 +0,0 @@
-"""
-Provides a function to report all internal modules for using freezing tools
-pytest
-"""
-from __future__ import absolute_import, division, print_function
-
-
-def freeze_includes():
-    """
-    Returns a list of module names used by py.test that should be
-    included by cx_freeze.
-    """
-    import py
-    import _pytest
-    result = list(_iter_all_modules(py))
-    result += list(_iter_all_modules(_pytest))
-    return result
-
-
-def _iter_all_modules(package, prefix=''):
-    """
-    Iterates over the names of all modules that can be found in the given
-    package, recursively.
-    Example:
-        _iter_all_modules(_pytest) ->
-            ['_pytest.assertion.newinterpret',
-             '_pytest.capture',
-             '_pytest.core',
-             ...
-            ]
-    """
-    import os
-    import pkgutil
-    if type(package) is not str:
-        path, prefix = package.__path__[0], package.__name__ + '.'
-    else:
-        path = package
-    for _, name, is_package in pkgutil.iter_modules([path]):
-        if is_package:
-            for m in _iter_all_modules(os.path.join(path, name), prefix=name + '.'):
-                yield prefix + m
-        else:
-            yield prefix + name
deleted file mode 100644
--- a/third_party/python/pytest/_pytest/helpconfig.py
+++ /dev/null
@@ -1,184 +0,0 @@
-""" version info, help messages, tracing configuration.  """
-from __future__ import absolute_import, division, print_function
-
-import py
-import pytest
-from _pytest.config import PrintHelp
-import os
-import sys
-from argparse import Action
-
-
-class HelpAction(Action):
-    """This is an argparse Action that will raise an exception in
-    order to skip the rest of the argument parsing when --help is passed.
-    This prevents argparse from quitting due to missing required arguments
-    when any are defined, for example by ``pytest_addoption``.
-    This is similar to the way that the builtin argparse --help option is
-    implemented by raising SystemExit.
-    """
-
-    def __init__(self,
-                 option_strings,
-                 dest=None,
-                 default=False,
-                 help=None):
-        super(HelpAction, self).__init__(
-            option_strings=option_strings,
-            dest=dest,
-            const=True,
-            default=default,
-            nargs=0,
-            help=help)
-
-    def __call__(self, parser, namespace, values, option_string=None):
-        setattr(namespace, self.dest, self.const)
-
-        # We should only skip the rest of the parsing after preparse is done
-        if getattr(parser._parser, 'after_preparse', False):
-            raise PrintHelp
-
-
-def pytest_addoption(parser):
-    group = parser.getgroup('debugconfig')
-    group.addoption('--version', action="store_true",
-                    help="display pytest lib version and import information.")
-    group._addoption("-h", "--help", action=HelpAction, dest="help",
-                     help="show help message and configuration info")
-    group._addoption('-p', action="append", dest="plugins", default=[],
-                     metavar="name",
-                     help="early-load given plugin (multi-allowed). "
-                     "To avoid loading of plugins, use the `no:` prefix, e.g. "
-                     "`no:doctest`.")
-    group.addoption('--traceconfig', '--trace-config',
-                    action="store_true", default=False,
-                    help="trace considerations of conftest.py files."),
-    group.addoption('--debug',
-                    action="store_true", dest="debug", default=False,
-                    help="store internal tracing debug information in 'pytestdebug.log'.")
-    group._addoption(
-        '-o', '--override-ini', nargs='*', dest="override_ini",
-        action="append",
-        help="override config option with option=value style, e.g. `-o xfail_strict=True`.")
-
-
-@pytest.hookimpl(hookwrapper=True)
-def pytest_cmdline_parse():
-    outcome = yield
-    config = outcome.get_result()
-    if config.option.debug:
-        path = os.path.abspath("pytestdebug.log")
-        debugfile = open(path, 'w')
-        debugfile.write("versions pytest-%s, py-%s, "
-                        "python-%s\ncwd=%s\nargs=%s\n\n" % (
-                            pytest.__version__, py.__version__,
-                            ".".join(map(str, sys.version_info)),
-                            os.getcwd(), config._origargs))
-        config.trace.root.setwriter(debugfile.write)
-        undo_tracing = config.pluginmanager.enable_tracing()
-        sys.stderr.write("writing pytestdebug information to %s\n" % path)
-
-        def unset_tracing():
-            debugfile.close()
-            sys.stderr.write("wrote pytestdebug information to %s\n" %
-                             debugfile.name)
-            config.trace.root.setwriter(None)
-            undo_tracing()
-
-        config.add_cleanup(unset_tracing)
-
-
-def pytest_cmdline_main(config):
-    if config.option.version:
-        p = py.path.local(pytest.__file__)
-        sys.stderr.write("This is pytest version %s, imported from %s\n" %
-                         (pytest.__version__, p))
-        plugininfo = getpluginversioninfo(config)
-        if plugininfo:
-            for line in plugininfo:
-                sys.stderr.write(line + "\n")
-        return 0
-    elif config.option.help:
-        config._do_configure()
-        showhelp(config)
-        config._ensure_unconfigure()
-        return 0
-
-
-def showhelp(config):
-    reporter = config.pluginmanager.get_plugin('terminalreporter')
-    tw = reporter._tw
-    tw.write(config._parser.optparser.format_help())
-    tw.line()
-    tw.line()
-    tw.line("[pytest] ini-options in the first "
-            "pytest.ini|tox.ini|setup.cfg file found:")
-    tw.line()
-
-    for name in config._parser._ininames:
-        help, type, default = config._parser._inidict[name]
-        if type is None:
-            type = "string"
-        spec = "%s (%s)" % (name, type)
-        line = "  %-24s %s" % (spec, help)
-        tw.line(line[:tw.fullwidth])
-
-    tw.line()
-    tw.line("environment variables:")
-    vars = [
-        ("PYTEST_ADDOPTS", "extra command line options"),
-        ("PYTEST_PLUGINS", "comma-separated plugins to load during startup"),
-        ("PYTEST_DEBUG", "set to enable debug tracing of pytest's internals")
-    ]
-    for name, help in vars:
-        tw.line("  %-24s %s" % (name, help))
-    tw.line()
-    tw.line()
-
-    tw.line("to see available markers type: pytest --markers")
-    tw.line("to see available fixtures type: pytest --fixtures")
-    tw.line("(shown according to specified file_or_dir or current dir "
-            "if not specified)")
-
-    for warningreport in reporter.stats.get('warnings', []):
-        tw.line("warning : " + warningreport.message, red=True)
-    return
-
-
-conftest_options = [
-    ('pytest_plugins', 'list of plugin names to load'),
-]
-
-
-def getpluginversioninfo(config):
-    lines = []
-    plugininfo = config.pluginmanager.list_plugin_distinfo()
-    if plugininfo:
-        lines.append("setuptools registered plugins:")
-        for plugin, dist in plugininfo:
-            loc = getattr(plugin, '__file__', repr(plugin))
-            content = "%s-%s at %s" % (dist.project_name, dist.version, loc)
-            lines.append("  " + content)
-    return lines
-
-
-def pytest_report_header(config):
-    lines = []
-    if config.option.debug or config.option.traceconfig:
-        lines.append("using: pytest-%s pylib-%s" %
-                     (pytest.__version__, py.__version__))
-
-        verinfo = getpluginversioninfo(config)
-        if verinfo:
-            lines.extend(verinfo)
-
-    if config.option.traceconfig:
-        lines.append("active plugins:")
-        items = config.pluginmanager.list_name_plugin()
-        for name, plugin in items:
-            if hasattr(plugin, '__file__'):
-                r = plugin.__file__
-            else:
-                r = repr(plugin)
-            lines.append("    %-20s: %s" % (name, r))
-    return lines
deleted file mode 100644
--- a/third_party/python/pytest/_pytest/hookspec.py
+++ /dev/null
@@ -1,423 +0,0 @@
-""" hook specifications for pytest plugins, invoked from main.py and builtin plugins.  """
-
-from _pytest._pluggy import HookspecMarker
-
-hookspec = HookspecMarker("pytest")
-
-# -------------------------------------------------------------------------
-# Initialization hooks called for every plugin
-# -------------------------------------------------------------------------
-
-
-@hookspec(historic=True)
-def pytest_addhooks(pluginmanager):
-    """called at plugin registration time to allow adding new hooks via a call to
-    pluginmanager.add_hookspecs(module_or_class, prefix)."""
-
-
-@hookspec(historic=True)
-def pytest_namespace():
-    """
-    DEPRECATED: this hook causes direct monkeypatching on pytest, its use is strongly discouraged
-    return dict of name->object to be made globally available in
-    the pytest namespace.  This hook is called at plugin registration
-    time.
-    """
-
-
-@hookspec(historic=True)
-def pytest_plugin_registered(plugin, manager):
-    """ a new pytest plugin got registered. """
-
-
-@hookspec(historic=True)
-def pytest_addoption(parser):
-    """register argparse-style options and ini-style config values,
-    called once at the beginning of a test run.
-
-    .. note::
-
-        This function should be implemented only in plugins or ``conftest.py``
-        files situated at the tests root directory due to how pytest
-        :ref:`discovers plugins during startup <pluginorder>`.
-
-    :arg parser: To add command line options, call
-        :py:func:`parser.addoption(...) <_pytest.config.Parser.addoption>`.
-        To add ini-file values call :py:func:`parser.addini(...)
-        <_pytest.config.Parser.addini>`.
-
-    Options can later be accessed through the
-    :py:class:`config <_pytest.config.Config>` object, respectively:
-
-    - :py:func:`config.getoption(name) <_pytest.config.Config.getoption>` to
-      retrieve the value of a command line option.
-
-    - :py:func:`config.getini(name) <_pytest.config.Config.getini>` to retrieve
-      a value read from an ini-style file.
-
-    The config object is passed around on many internal objects via the ``.config``
-    attribute or can be retrieved as the ``pytestconfig`` fixture or accessed
-    via (deprecated) ``pytest.config``.
-    """
-
-
-@hookspec(historic=True)
-def pytest_configure(config):
-    """
-    Allows plugins and conftest files to perform initial configuration.
-
-    This hook is called for every plugin and initial conftest file
-    after command line options have been parsed.
-
-    After that, the hook is called for other conftest files as they are
-    imported.
-
-    :arg config: pytest config object
-    :type config: _pytest.config.Config
-    """
-
-# -------------------------------------------------------------------------
-# Bootstrapping hooks called for plugins registered early enough:
-# internal and 3rd party plugins as well as directly
-# discoverable conftest.py local plugins.
-# -------------------------------------------------------------------------
-
-
-@hookspec(firstresult=True)
-def pytest_cmdline_parse(pluginmanager, args):
-    """return initialized config object, parsing the specified args.
-
-    Stops at first non-None result, see :ref:`firstresult` """
-
-
-def pytest_cmdline_preparse(config, args):
-    """(deprecated) modify command line arguments before option parsing. """
-
-
-@hookspec(firstresult=True)
-def pytest_cmdline_main(config):
-    """ called for performing the main command line action. The default
-    implementation will invoke the configure hooks and runtest_mainloop.
-
-    Stops at first non-None result, see :ref:`firstresult` """
-
-
-def pytest_load_initial_conftests(early_config, parser, args):
-    """ implements the loading of initial conftest files ahead
-    of command line option parsing. """
-
-
-# -------------------------------------------------------------------------
-# collection hooks
-# -------------------------------------------------------------------------
-
-@hookspec(firstresult=True)
-def pytest_collection(session):
-    """ perform the collection protocol for the given session.
-
-    Stops at first non-None result, see :ref:`firstresult` """
-
-
-def pytest_collection_modifyitems(session, config, items):
-    """ called after collection has been performed, may filter or re-order
-    the items in-place."""
-
-
-def pytest_collection_finish(session):
-    """ called after collection has been performed and modified. """
-
-
-@hookspec(firstresult=True)
-def pytest_ignore_collect(path, config):
-    """ return True to prevent considering this path for collection.
-    This hook is consulted for all files and directories prior to calling
-    more specific hooks.
-
-    Stops at first non-None result, see :ref:`firstresult`
-    """
-
-
-@hookspec(firstresult=True)
-def pytest_collect_directory(path, parent):
-    """ called before traversing a directory for collection files.
-
-    Stops at first non-None result, see :ref:`firstresult` """
-
-
-def pytest_collect_file(path, parent):
-    """ return collection Node or None for the given path. Any new node
-    needs to have the specified ``parent`` as a parent."""
-
-# logging hooks for collection
-
-
-def pytest_collectstart(collector):
-    """ collector starts collecting. """
-
-
-def pytest_itemcollected(item):
-    """ we just collected a test item. """
-
-
-def pytest_collectreport(report):
-    """ collector finished collecting. """
-
-
-def pytest_deselected(items):
-    """ called for test items deselected by keyword. """
-
-
-@hookspec(firstresult=True)
-def pytest_make_collect_report(collector):
-    """ perform ``collector.collect()`` and return a CollectReport.
-
-    Stops at first non-None result, see :ref:`firstresult` """
-
-# -------------------------------------------------------------------------
-# Python test function related hooks
-# -------------------------------------------------------------------------
-
-
-@hookspec(firstresult=True)
-def pytest_pycollect_makemodule(path, parent):
-    """ return a Module collector or None for the given path.
-    This hook will be called for each matching test module path.
-    The pytest_collect_file hook needs to be used if you want to
-    create test modules for files that do not match as a test module.
-
-    Stops at first non-None result, see :ref:`firstresult` """
-
-
-@hookspec(firstresult=True)
-def pytest_pycollect_makeitem(collector, name, obj):
-    """ return custom item/collector for a python object in a module, or None.
-
-    Stops at first non-None result, see :ref:`firstresult` """
-
-
-@hookspec(firstresult=True)
-def pytest_pyfunc_call(pyfuncitem):
-    """ call underlying test function.
-
-    Stops at first non-None result, see :ref:`firstresult` """
-
-
-def pytest_generate_tests(metafunc):
-    """ generate (multiple) parametrized calls to a test function."""
-
-
-@hookspec(firstresult=True)
-def pytest_make_parametrize_id(config, val, argname):
-    """Return a user-friendly string representation of the given ``val`` that will be used
-    by @pytest.mark.parametrize calls. Return None if the hook doesn't know about ``val``.
-    The parameter name is available as ``argname``, if required.
-
-    Stops at first non-None result, see :ref:`firstresult` """
-
-# -------------------------------------------------------------------------
-# generic runtest related hooks
-# -------------------------------------------------------------------------
-
-
-@hookspec(firstresult=True)
-def pytest_runtestloop(session):
-    """ called for performing the main runtest loop
-    (after collection finished).
-
-    Stops at first non-None result, see :ref:`firstresult` """
-
-
-def pytest_itemstart(item, node):
-    """ (deprecated, use pytest_runtest_logstart). """
-
-
-@hookspec(firstresult=True)
-def pytest_runtest_protocol(item, nextitem):
-    """ implements the runtest_setup/call/teardown protocol for
-    the given test item, including capturing exceptions and calling
-    reporting hooks.
-
-    :arg item: test item for which the runtest protocol is performed.
-
-    :arg nextitem: the scheduled-to-be-next test item (or None if this
-                   is the end my friend).  This argument is passed on to
-                   :py:func:`pytest_runtest_teardown`.
-
-    :return boolean: True if no further hook implementations should be invoked.
-
-
-    Stops at first non-None result, see :ref:`firstresult` """
-
-
-def pytest_runtest_logstart(nodeid, location):
-    """ signal the start of running a single test item. """
-
-
-def pytest_runtest_setup(item):
-    """ called before ``pytest_runtest_call(item)``. """
-
-
-def pytest_runtest_call(item):
-    """ called to execute the test ``item``. """
-
-
-def pytest_runtest_teardown(item, nextitem):
-    """ called after ``pytest_runtest_call``.
-
-    :arg nextitem: the scheduled-to-be-next test item (None if no further
-                   test item is scheduled).  This argument can be used to
-                   perform exact teardowns, i.e. calling just enough finalizers
-                   so that nextitem only needs to call setup-functions.
-    """
-
-
-@hookspec(firstresult=True)
-def pytest_runtest_makereport(item, call):
-    """ return a :py:class:`_pytest.runner.TestReport` object
-    for the given :py:class:`pytest.Item <_pytest.main.Item>` and
-    :py:class:`_pytest.runner.CallInfo`.
-
-    Stops at first non-None result, see :ref:`firstresult` """
-
-
-def pytest_runtest_logreport(report):
-    """ process a test setup/call/teardown report relating to
-    the respective phase of executing a test. """
-
-# -------------------------------------------------------------------------
-# Fixture related hooks
-# -------------------------------------------------------------------------
-
-
-@hookspec(firstresult=True)
-def pytest_fixture_setup(fixturedef, request):
-    """ performs fixture setup execution.
-
-    Stops at first non-None result, see :ref:`firstresult` """
-
-
-def pytest_fixture_post_finalizer(fixturedef):
-    """ called after fixture teardown, but before the cache is cleared so
-    the fixture result cache ``fixturedef.cached_result`` can
-    still be accessed."""
-
-# -------------------------------------------------------------------------
-# test session related hooks
-# -------------------------------------------------------------------------
-
-
-def pytest_sessionstart(session):
-    """ before session.main() is called. """
-
-
-def pytest_sessionfinish(session, exitstatus):
-    """ whole test run finishes. """
-
-
-def pytest_unconfigure(config):
-    """ called before test process is exited.  """
-
-
-# -------------------------------------------------------------------------
-# hooks for customizing the assert methods
-# -------------------------------------------------------------------------
-
-def pytest_assertrepr_compare(config, op, left, right):
-    """return explanation for comparisons in failing assert expressions.
-
-    Return None for no custom explanation, otherwise return a list
-    of strings.  The strings will be joined by newlines but any newlines
-    *in* a string will be escaped.  Note that all but the first line will
-    be indented slightly, the intention is for the first line to be a summary.
-    """
-
-# -------------------------------------------------------------------------
-# hooks for influencing reporting (invoked from _pytest_terminal)
-# -------------------------------------------------------------------------
-
-
-def pytest_report_header(config, startdir):
-    """ return a string or list of strings to be displayed as header info for terminal reporting.
-
-    :param config: the pytest config object.
-    :param startdir: py.path object with the starting dir
-
-    .. note::
-
-        This function should be implemented only in plugins or ``conftest.py``
-        files situated at the tests root directory due to how pytest
-        :ref:`discovers plugins during startup <pluginorder>`.
-    """
-
-
-def pytest_report_collectionfinish(config, startdir, items):
-    """
-    .. versionadded:: 3.2
-
-    return a string or list of strings to be displayed after collection has finished successfully.
-
-    This strings will be displayed after the standard "collected X items" message.
-
-    :param config: the pytest config object.
-    :param startdir: py.path object with the starting dir
-    :param items: list of pytest items that are going to be executed; this list should not be modified.
-    """
-
-
-@hookspec(firstresult=True)
-def pytest_report_teststatus(report):
-    """ return result-category, shortletter and verbose word for reporting.
-
-    Stops at first non-None result, see :ref:`firstresult` """
-
-
-def pytest_terminal_summary(terminalreporter, exitstatus):
-    """ add additional section in terminal summary reporting.  """
-
-
-@hookspec(historic=True)
-def pytest_logwarning(message, code, nodeid, fslocation):
-    """ process a warning specified by a message, a code string,
-    a nodeid and fslocation (both of which may be None
-    if the warning is not tied to a partilar node/location)."""
-
-# -------------------------------------------------------------------------
-# doctest hooks
-# -------------------------------------------------------------------------
-
-
-@hookspec(firstresult=True)
-def pytest_doctest_prepare_content(content):
-    """ return processed content for a given doctest
-
-    Stops at first non-None result, see :ref:`firstresult` """
-
-# -------------------------------------------------------------------------
-# error handling and internal debugging hooks
-# -------------------------------------------------------------------------
-
-
-def pytest_internalerror(excrepr, excinfo):
-    """ called for internal errors. """
-
-
-def pytest_keyboard_interrupt(excinfo):
-    """ called for keyboard interrupt. """
-
-
-def pytest_exception_interact(node, call, report):
-    """called when an exception was raised which can potentially be
-    interactively handled.
-
-    This hook is only called if an exception was raised
-    that is not an internal exception like ``skip.Exception``.
-    """
-
-
-def pytest_enter_pdb(config):
-    """ called upon pdb.set_trace(), can be used by plugins to take special
-    action just before the python debugger enters in interactive mode.
-
-    :arg config: pytest config object
-    :type config: _pytest.config.Config
-    """
deleted file mode 100644
--- a/third_party/python/pytest/_pytest/junitxml.py
+++ /dev/null
@@ -1,453 +0,0 @@
-"""
-    report test results in JUnit-XML format,
-    for use with Jenkins and build integration servers.
-
-
-Based on initial code from Ross Lawley.
-
-Output conforms to https://github.com/jenkinsci/xunit-plugin/blob/master/
-src/main/resources/org/jenkinsci/plugins/xunit/types/model/xsd/junit-10.xsd
-"""
-from __future__ import absolute_import, division, print_function
-
-import functools
-import py
-import os
-import re
-import sys
-import time
-import pytest
-from _pytest import nodes
-from _pytest.config import filename_arg
-
-# Python 2.X and 3.X compatibility
-if sys.version_info[0] < 3:
-    from codecs import open
-else:
-    unichr = chr
-    unicode = str
-    long = int
-
-
-class Junit(py.xml.Namespace):
-    pass
-
-
-# We need to get the subset of the invalid unicode ranges according to
-# XML 1.0 which are valid in this python build.  Hence we calculate
-# this dynamically instead of hardcoding it.  The spec range of valid
-# chars is: Char ::= #x9 | #xA | #xD | [#x20-#xD7FF] | [#xE000-#xFFFD]
-#                    | [#x10000-#x10FFFF]
-_legal_chars = (0x09, 0x0A, 0x0d)
-_legal_ranges = (
-    (0x20, 0x7E), (0x80, 0xD7FF), (0xE000, 0xFFFD), (0x10000, 0x10FFFF),
-)
-_legal_xml_re = [
-    unicode("%s-%s") % (unichr(low), unichr(high))
-    for (low, high) in _legal_ranges if low < sys.maxunicode
-]
-_legal_xml_re = [unichr(x) for x in _legal_chars] + _legal_xml_re
-illegal_xml_re = re.compile(unicode('[^%s]') % unicode('').join(_legal_xml_re))
-del _legal_chars
-del _legal_ranges
-del _legal_xml_re
-
-_py_ext_re = re.compile(r"\.py$")
-
-
-def bin_xml_escape(arg):
-    def repl(matchobj):
-        i = ord(matchobj.group())
-        if i <= 0xFF:
-            return unicode('#x%02X') % i
-        else:
-            return unicode('#x%04X') % i
-
-    return py.xml.raw(illegal_xml_re.sub(repl, py.xml.escape(arg)))
-
-
-class _NodeReporter(object):
-    def __init__(self, nodeid, xml):
-
-        self.id = nodeid
-        self.xml = xml
-        self.add_stats = self.xml.add_stats
-        self.duration = 0
-        self.properties = []
-        self.nodes = []
-        self.testcase = None
-        self.attrs = {}
-
-    def append(self, node):
-        self.xml.add_stats(type(node).__name__)
-        self.nodes.append(node)
-
-    def add_property(self, name, value):
-        self.properties.append((str(name), bin_xml_escape(value)))
-
-    def make_properties_node(self):
-        """Return a Junit node containing custom properties, if any.
-        """
-        if self.properties:
-            return Junit.properties([
-                Junit.property(name=name, value=value)
-                for name, value in self.properties
-            ])
-        return ''
-
-    def record_testreport(self, testreport):
-        assert not self.testcase
-        names = mangle_test_address(testreport.nodeid)
-        classnames = names[:-1]
-        if self.xml.prefix:
-            classnames.insert(0, self.xml.prefix)
-        attrs = {
-            "classname": ".".join(classnames),
-            "name": bin_xml_escape(names[-1]),
-            "file": testreport.location[0],
-        }
-        if testreport.location[1] is not None:
-            attrs["line"] = testreport.location[1]
-        if hasattr(testreport, "url"):
-            attrs["url"] = testreport.url
-        self.attrs = attrs
-
-    def to_xml(self):
-        testcase = Junit.testcase(time=self.duration, **self.attrs)
-        testcase.append(self.make_properties_node())
-        for node in self.nodes:
-            testcase.append(node)
-        return testcase
-
-    def _add_simple(self, kind, message, data=None):
-        data = bin_xml_escape(data)
-        node = kind(data, message=message)
-        self.append(node)
-
-    def write_captured_output(self, report):
-        for capname in ('out', 'err'):
-            content = getattr(report, 'capstd' + capname)
-            if content:
-                tag = getattr(Junit, 'system-' + capname)
-                self.append(tag(bin_xml_escape(content)))
-
-    def append_pass(self, report):
-        self.add_stats('passed')
-
-    def append_failure(self, report):
-        # msg = str(report.longrepr.reprtraceback.extraline)
-        if hasattr(report, "wasxfail"):
-            self._add_simple(
-                Junit.skipped,
-                "xfail-marked test passes unexpectedly")
-        else:
-            if hasattr(report.longrepr, "reprcrash"):
-                message = report.longrepr.reprcrash.message
-            elif isinstance(report.longrepr, (unicode, str)):
-                message = report.longrepr
-            else:
-                message = str(report.longrepr)
-            message = bin_xml_escape(message)
-            fail = Junit.failure(message=message)
-            fail.append(bin_xml_escape(report.longrepr))
-            self.append(fail)
-
-    def append_collect_error(self, report):
-        # msg = str(report.longrepr.reprtraceback.extraline)
-        self.append(Junit.error(bin_xml_escape(report.longrepr),
-                                message="collection failure"))
-
-    def append_collect_skipped(self, report):
-        self._add_simple(
-            Junit.skipped, "collection skipped", report.longrepr)
-
-    def append_error(self, report):
-        if getattr(report, 'when', None) == 'teardown':
-            msg = "test teardown failure"
-        else:
-            msg = "test setup failure"
-        self._add_simple(
-            Junit.error, msg, report.longrepr)
-
-    def append_skipped(self, report):
-        if hasattr(report, "wasxfail"):
-            self._add_simple(
-                Junit.skipped, "expected test failure", report.wasxfail
-            )
-        else:
-            filename, lineno, skipreason = report.longrepr
-            if skipreason.startswith("Skipped: "):
-                skipreason = bin_xml_escape(skipreason[9:])
-            self.append(
-                Junit.skipped("%s:%s: %s" % (filename, lineno, skipreason),
-                              type="pytest.skip",
-                              message=skipreason))
-        self.write_captured_output(report)
-
-    def finalize(self):
-        data = self.to_xml().unicode(indent=0)
-        self.__dict__.clear()
-        self.to_xml = lambda: py.xml.raw(data)
-
-
-@pytest.fixture
-def record_xml_property(request):
-    """Add extra xml properties to the tag for the calling test.
-    The fixture is callable with ``(name, value)``, with value being automatically
-    xml-encoded.
-    """
-    request.node.warn(
-        code='C3',
-        message='record_xml_property is an experimental feature',
-    )
-    xml = getattr(request.config, "_xml", None)
-    if xml is not None:
-        node_reporter = xml.node_reporter(request.node.nodeid)
-        return node_reporter.add_property
-    else:
-        def add_property_noop(name, value):
-            pass
-
-        return add_property_noop
-
-
-def pytest_addoption(parser):
-    group = parser.getgroup("terminal reporting")
-    group.addoption(
-        '--junitxml', '--junit-xml',
-        action="store",
-        dest="xmlpath",
-        metavar="path",
-        type=functools.partial(filename_arg, optname="--junitxml"),
-        default=None,
-        help="create junit-xml style report file at given path.")
-    group.addoption(
-        '--junitprefix', '--junit-prefix',
-        action="store",
-        metavar="str",
-        default=None,
-        help="prepend prefix to classnames in junit-xml output")
-    parser.addini("junit_suite_name", "Test suite name for JUnit report", default="pytest")
-
-
-def pytest_configure(config):
-    xmlpath = config.option.xmlpath
-    # prevent opening xmllog on slave nodes (xdist)
-    if xmlpath and not hasattr(config, 'slaveinput'):
-        config._xml = LogXML(xmlpath, config.option.junitprefix, config.getini("junit_suite_name"))
-        config.pluginmanager.register(config._xml)
-
-
-def pytest_unconfigure(config):
-    xml = getattr(config, '_xml', None)
-    if xml:
-        del config._xml
-        config.pluginmanager.unregister(xml)
-
-
-def mangle_test_address(address):
-    path, possible_open_bracket, params = address.partition('[')
-    names = path.split("::")
-    try:
-        names.remove('()')
-    except ValueError:
-        pass
-    # convert file path to dotted path
-    names[0] = names[0].replace(nodes.SEP, '.')
-    names[0] = _py_ext_re.sub("", names[0])
-    # put any params back
-    names[-1] += possible_open_bracket + params
-    return names
-
-
-class LogXML(object):
-    def __init__(self, logfile, prefix, suite_name="pytest"):
-        logfile = os.path.expanduser(os.path.expandvars(logfile))
-        self.logfile = os.path.normpath(os.path.abspath(logfile))
-        self.prefix = prefix
-        self.suite_name = suite_name
-        self.stats = dict.fromkeys([
-            'error',
-            'passed',
-            'failure',
-            'skipped',
-        ], 0)
-        self.node_reporters = {}  # nodeid -> _NodeReporter
-        self.node_reporters_ordered = []
-        self.global_properties = []
-        # List of reports that failed on call but teardown is pending.
-        self.open_reports = []
-        self.cnt_double_fail_tests = 0
-
-    def finalize(self, report):
-        nodeid = getattr(report, 'nodeid', report)
-        # local hack to handle xdist report order
-        slavenode = getattr(report, 'node', None)
-        reporter = self.node_reporters.pop((nodeid, slavenode))
-        if reporter is not None:
-            reporter.finalize()
-
-    def node_reporter(self, report):
-        nodeid = getattr(report, 'nodeid', report)
-        # local hack to handle xdist report order
-        slavenode = getattr(report, 'node', None)
-
-        key = nodeid, slavenode
-
-        if key in self.node_reporters:
-            # TODO: breasks for --dist=each
-            return self.node_reporters[key]
-
-        reporter = _NodeReporter(nodeid, self)
-
-        self.node_reporters[key] = reporter
-        self.node_reporters_ordered.append(reporter)
-
-        return reporter
-
-    def add_stats(self, key):
-        if key in self.stats:
-            self.stats[key] += 1
-
-    def _opentestcase(self, report):
-        reporter = self.node_reporter(report)
-        reporter.record_testreport(report)
-        return reporter
-
-    def pytest_runtest_logreport(self, report):
-        """handle a setup/call/teardown report, generating the appropriate
-        xml tags as necessary.
-
-        note: due to plugins like xdist, this hook may be called in interlaced
-        order with reports from other nodes. for example:
-
-        usual call order:
-            -> setup node1
-            -> call node1
-            -> teardown node1
-            -> setup node2
-            -> call node2
-            -> teardown node2
-
-        possible call order in xdist:
-            -> setup node1
-            -> call node1
-            -> setup node2
-            -> call node2
-            -> teardown node2
-            -> teardown node1
-        """
-        close_report = None
-        if report.passed:
-            if report.when == "call":  # ignore setup/teardown
-                reporter = self._opentestcase(report)
-                reporter.append_pass(report)
-        elif report.failed:
-            if report.when == "teardown":
-                # The following vars are needed when xdist plugin is used
-                report_wid = getattr(report, "worker_id", None)
-                report_ii = getattr(report, "item_index", None)
-                close_report = next(
-                    (rep for rep in self.open_reports
-                     if (rep.nodeid == report.nodeid and
-                         getattr(rep, "item_index", None) == report_ii and
-                         getattr(rep, "worker_id", None) == report_wid
-                         )
-                     ), None)
-                if close_report:
-                    # We need to open new testcase in case we have failure in
-                    # call and error in teardown in order to follow junit
-                    # schema
-                    self.finalize(close_report)
-                    self.cnt_double_fail_tests += 1
-            reporter = self._opentestcase(report)
-            if report.when == "call":
-                reporter.append_failure(report)
-                self.open_reports.append(report)
-            else:
-                reporter.append_error(report)
-        elif report.skipped:
-            reporter = self._opentestcase(report)
-            reporter.append_skipped(report)
-        self.update_testcase_duration(report)
-        if report.when == "teardown":
-            reporter = self._opentestcase(report)
-            reporter.write_captured_output(report)
-            self.finalize(report)
-            report_wid = getattr(report, "worker_id", None)
-            report_ii = getattr(report, "item_index", None)
-            close_report = next(
-                (rep for rep in self.open_reports
-                 if (rep.nodeid == report.nodeid and
-                     getattr(rep, "item_index", None) == report_ii and
-                     getattr(rep, "worker_id", None) == report_wid
-                     )
-                 ), None)
-            if close_report:
-                self.open_reports.remove(close_report)
-
-    def update_testcase_duration(self, report):
-        """accumulates total duration for nodeid from given report and updates
-        the Junit.testcase with the new total if already created.
-        """
-        reporter = self.node_reporter(report)
-        reporter.duration += getattr(report, 'duration', 0.0)
-
-    def pytest_collectreport(self, report):
-        if not report.passed:
-            reporter = self._opentestcase(report)
-            if report.failed:
-                reporter.append_collect_error(report)
-            else:
-                reporter.append_collect_skipped(report)
-
-    def pytest_internalerror(self, excrepr):
-        reporter = self.node_reporter('internal')
-        reporter.attrs.update(classname="pytest", name='internal')
-        reporter._add_simple(Junit.error, 'internal error', excrepr)
-
-    def pytest_sessionstart(self):
-        self.suite_start_time = time.time()
-
-    def pytest_sessionfinish(self):
-        dirname = os.path.dirname(os.path.abspath(self.logfile))
-        if not os.path.isdir(dirname):
-            os.makedirs(dirname)
-        logfile = open(self.logfile, 'w', encoding='utf-8')
-        suite_stop_time = time.time()
-        suite_time_delta = suite_stop_time - self.suite_start_time
-
-        numtests = (self.stats['passed'] + self.stats['failure'] +
-                    self.stats['skipped'] + self.stats['error'] -
-                    self.cnt_double_fail_tests)
-        logfile.write('<?xml version="1.0" encoding="utf-8"?>')
-
-        logfile.write(Junit.testsuite(
-            self._get_global_properties_node(),
-            [x.to_xml() for x in self.node_reporters_ordered],
-            name=self.suite_name,
-            errors=self.stats['error'],
-            failures=self.stats['failure'],
-            skips=self.stats['skipped'],
-            tests=numtests,
-            time="%.3f" % suite_time_delta, ).unicode(indent=0))
-        logfile.close()
-
-    def pytest_terminal_summary(self, terminalreporter):
-        terminalreporter.write_sep("-",
-                                   "generated xml file: %s" % (self.logfile))
-
-    def add_global_property(self, name, value):
-        self.global_properties.append((str(name), bin_xml_escape(value)))
-
-    def _get_global_properties_node(self):
-        """Return a Junit node containing custom properties, if any.
-        """
-        if self.global_properties:
-            return Junit.properties(
-                [
-                    Junit.property(name=name, value=value)
-                    for name, value in self.global_properties
-                ]
-            )
-        return ''
deleted file mode 100644
--- a/third_party/python/pytest/_pytest/main.py
+++ /dev/null
@@ -1,835 +0,0 @@
-""" core implementation of testing process: init, session, runtest loop. """
-from __future__ import absolute_import, division, print_function
-
-import functools
-import os
-import sys
-
-import _pytest
-from _pytest import nodes
-import _pytest._code
-import py
-try:
-    from collections import MutableMapping as MappingMixin
-except ImportError:
-    from UserDict import DictMixin as MappingMixin
-
-from _pytest.config import directory_arg, UsageError, hookimpl
-from _pytest.outcomes import exit
-from _pytest.runner import collect_one_node
-
-tracebackcutdir = py.path.local(_pytest.__file__).dirpath()
-
-# exitcodes for the command line
-EXIT_OK = 0
-EXIT_TESTSFAILED = 1
-EXIT_INTERRUPTED = 2
-EXIT_INTERNALERROR = 3
-EXIT_USAGEERROR = 4
-EXIT_NOTESTSCOLLECTED = 5
-
-
-def pytest_addoption(parser):
-    parser.addini("norecursedirs", "directory patterns to avoid for recursion",
-                  type="args", default=['.*', 'build', 'dist', 'CVS', '_darcs', '{arch}', '*.egg', 'venv'])
-    parser.addini("testpaths", "directories to search for tests when no files or directories are given in the "
-                               "command line.",
-                  type="args", default=[])
-    # parser.addini("dirpatterns",
-    #    "patterns specifying possible locations of test files",
-    #    type="linelist", default=["**/test_*.txt",
-    #            "**/test_*.py", "**/*_test.py"]
-    # )
-    group = parser.getgroup("general", "running and selection options")
-    group._addoption('-x', '--exitfirst', action="store_const",
-                     dest="maxfail", const=1,
-                     help="exit instantly on first error or failed test."),
-    group._addoption('--maxfail', metavar="num",
-                     action="store", type=int, dest="maxfail", default=0,
-                     help="exit after first num failures or errors.")
-    group._addoption('--strict', action="store_true",
-                     help="marks not registered in configuration file raise errors.")
-    group._addoption("-c", metavar="file", type=str, dest="inifilename",
-                     help="load configuration from `file` instead of trying to locate one of the implicit "
-                          "configuration files.")
-    group._addoption("--continue-on-collection-errors", action="store_true",
-                     default=False, dest="continue_on_collection_errors",
-                     help="Force test execution even if collection errors occur.")
-
-    group = parser.getgroup("collect", "collection")
-    group.addoption('--collectonly', '--collect-only', action="store_true",
-                    help="only collect tests, don't execute them."),
-    group.addoption('--pyargs', action="store_true",
-                    help="try to interpret all arguments as python packages.")
-    group.addoption("--ignore", action="append", metavar="path",
-                    help="ignore path during collection (multi-allowed).")
-    # when changing this to --conf-cut-dir, config.py Conftest.setinitial
-    # needs upgrading as well
-    group.addoption('--confcutdir', dest="confcutdir", default=None,
-                    metavar="dir", type=functools.partial(directory_arg, optname="--confcutdir"),
-                    help="only load conftest.py's relative to specified dir.")
-    group.addoption('--noconftest', action="store_true",
-                    dest="noconftest", default=False,
-                    help="Don't load any conftest.py files.")
-    group.addoption('--keepduplicates', '--keep-duplicates', action="store_true",
-                    dest="keepduplicates", default=False,
-                    help="Keep duplicate tests.")
-    group.addoption('--collect-in-virtualenv', action='store_true',
-                    dest='collect_in_virtualenv', default=False,
-                    help="Don't ignore tests in a local virtualenv directory")
-
-    group = parser.getgroup("debugconfig",
-                            "test session debugging and configuration")
-    group.addoption('--basetemp', dest="basetemp", default=None, metavar="dir",
-                    help="base temporary directory for this test run.")
-
-
-def pytest_namespace():
-    """keeping this one works around a deeper startup issue in pytest
-
-    i tried to find it for a while but the amount of time turned unsustainable,
-    so i put a hack in to revisit later
-    """
-    return {}
-
-
-def pytest_configure(config):
-    __import__('pytest').config = config  # compatibiltiy
-
-
-def wrap_session(config, doit):
-    """Skeleton command line program"""
-    session = Session(config)
-    session.exitstatus = EXIT_OK
-    initstate = 0
-    try:
-        try:
-            config._do_configure()
-            initstate = 1
-            config.hook.pytest_sessionstart(session=session)
-            initstate = 2
-            session.exitstatus = doit(config, session) or 0
-        except UsageError:
-            raise
-        except KeyboardInterrupt:
-            excinfo = _pytest._code.ExceptionInfo()
-            if initstate < 2 and isinstance(excinfo.value, exit.Exception):
-                sys.stderr.write('{0}: {1}\n'.format(
-                    excinfo.typename, excinfo.value.msg))
-            config.hook.pytest_keyboard_interrupt(excinfo=excinfo)
-            session.exitstatus = EXIT_INTERRUPTED
-        except:  # noqa
-            excinfo = _pytest._code.ExceptionInfo()
-            config.notify_exception(excinfo, config.option)
-            session.exitstatus = EXIT_INTERNALERROR
-            if excinfo.errisinstance(SystemExit):
-                sys.stderr.write("mainloop: caught Spurious SystemExit!\n")
-
-    finally:
-        excinfo = None  # Explicitly break reference cycle.
-        session.startdir.chdir()
-        if initstate >= 2:
-            config.hook.pytest_sessionfinish(
-                session=session,
-                exitstatus=session.exitstatus)
-        config._ensure_unconfigure()
-    return session.exitstatus
-
-
-def pytest_cmdline_main(config):
-    return wrap_session(config, _main)
-
-
-def _main(config, session):
-    """ default command line protocol for initialization, session,
-    running tests and reporting. """
-    config.hook.pytest_collection(session=session)
-    config.hook.pytest_runtestloop(session=session)
-
-    if session.testsfailed:
-        return EXIT_TESTSFAILED
-    elif session.testscollected == 0:
-        return EXIT_NOTESTSCOLLECTED
-
-
-def pytest_collection(session):
-    return session.perform_collect()
-
-
-def pytest_runtestloop(session):
-    if (session.testsfailed and
-            not session.config.option.continue_on_collection_errors):
-        raise session.Interrupted(
-            "%d errors during collection" % session.testsfailed)
-
-    if session.config.option.collectonly:
-        return True
-
-    for i, item in enumerate(session.items):
-        nextitem = session.items[i + 1] if i + 1 < len(session.items) else None
-        item.config.hook.pytest_runtest_protocol(item=item, nextitem=nextitem)
-        if session.shouldstop:
-            raise session.Interrupted(session.shouldstop)
-    return True
-
-
-def _in_venv(path):
-    """Attempts to detect if ``path`` is the root of a Virtual Environment by
-    checking for the existence of the appropriate activate script"""
-    bindir = path.join('Scripts' if sys.platform.startswith('win') else 'bin')
-    if not bindir.exists():
-        return False
-    activates = ('activate', 'activate.csh', 'activate.fish',
-                 'Activate', 'Activate.bat', 'Activate.ps1')
-    return any([fname.basename in activates for fname in bindir.listdir()])
-
-
-def pytest_ignore_collect(path, config):
-    ignore_paths = config._getconftest_pathlist("collect_ignore", path=path.dirpath())
-    ignore_paths = ignore_paths or []
-    excludeopt = config.getoption("ignore")
-    if excludeopt:
-        ignore_paths.extend([py.path.local(x) for x in excludeopt])
-
-    if py.path.local(path) in ignore_paths:
-        return True
-
-    allow_in_venv = config.getoption("collect_in_virtualenv")
-    if _in_venv(path) and not allow_in_venv:
-        return True
-
-    # Skip duplicate paths.
-    keepduplicates = config.getoption("keepduplicates")
-    duplicate_paths = config.pluginmanager._duplicatepaths
-    if not keepduplicates:
-        if path in duplicate_paths:
-            return True
-        else:
-            duplicate_paths.add(path)
-
-    return False
-
-
-class FSHookProxy:
-    def __init__(self, fspath, pm, remove_mods):
-        self.fspath = fspath
-        self.pm = pm
-        self.remove_mods = remove_mods
-
-    def __getattr__(self, name):
-        x = self.pm.subset_hook_caller(name, remove_plugins=self.remove_mods)
-        self.__dict__[name] = x
-        return x
-
-
-class _CompatProperty(object):
-    def __init__(self, name):
-        self.name = name
-
-    def __get__(self, obj, owner):
-        if obj is None:
-            return self
-
-        # TODO: reenable in the features branch
-        # warnings.warn(
-        #     "usage of {owner!r}.{name} is deprecated, please use pytest.{name} instead".format(
-        #         name=self.name, owner=type(owner).__name__),
-        #     PendingDeprecationWarning, stacklevel=2)
-        return getattr(__import__('pytest'), self.name)
-
-
-class NodeKeywords(MappingMixin):
-    def __init__(self, node):
-        self.node = node
-        self.parent = node.parent
-        self._markers = {node.name: True}
-
-    def __getitem__(self, key):
-        try:
-            return self._markers[key]
-        except KeyError:
-            if self.parent is None:
-                raise
-            return self.parent.keywords[key]
-
-    def __setitem__(self, key, value):
-        self._markers[key] = value
-
-    def __delitem__(self, key):
-        raise ValueError("cannot delete key in keywords dict")
-
-    def __iter__(self):
-        seen = set(self._markers)
-        if self.parent is not None:
-            seen.update(self.parent.keywords)
-        return iter(seen)
-
-    def __len__(self):
-        return len(self.__iter__())
-
-    def keys(self):
-        return list(self)
-
-    def __repr__(self):
-        return "<NodeKeywords for node %s>" % (self.node, )
-
-
-class Node(object):
-    """ base class for Collector and Item the test collection tree.
-    Collector subclasses have children, Items are terminal nodes."""
-
-    def __init__(self, name, parent=None, config=None, session=None):
-        #: a unique name within the scope of the parent node
-        self.name = name
-
-        #: the parent collector node.
-        self.parent = parent
-
-        #: the pytest config object
-        self.config = config or parent.config
-
-        #: the session this node is part of
-        self.session = session or parent.session
-
-        #: filesystem path where this node was collected from (can be None)
-        self.fspath = getattr(parent, 'fspath', None)
-
-        #: keywords/markers collected from all scopes
-        self.keywords = NodeKeywords(self)
-
-        #: allow adding of extra keywords to use for matching
-        self.extra_keyword_matches = set()
-
-        # used for storing artificial fixturedefs for direct parametrization
-        self._name2pseudofixturedef = {}
-
-    @property
-    def ihook(self):
-        """ fspath sensitive hook proxy used to call pytest hooks"""
-        return self.session.gethookproxy(self.fspath)
-
-    Module = _CompatProperty("Module")
-    Class = _CompatProperty("Class")
-    Instance = _CompatProperty("Instance")
-    Function = _CompatProperty("Function")
-    File = _CompatProperty("File")
-    Item = _CompatProperty("Item")
-
-    def _getcustomclass(self, name):
-        maybe_compatprop = getattr(type(self), name)
-        if isinstance(maybe_compatprop, _CompatProperty):
-            return getattr(__import__('pytest'), name)
-        else:
-            cls = getattr(self, name)
-            # TODO: reenable in the features branch
-            # warnings.warn("use of node.%s is deprecated, "
-            #    "use pytest_pycollect_makeitem(...) to create custom "
-            #    "collection nodes" % name, category=DeprecationWarning)
-        return cls
-
-    def __repr__(self):
-        return "<%s %r>" % (self.__class__.__name__,
-                            getattr(self, 'name', None))
-
-    def warn(self, code, message):
-        """ generate a warning with the given code and message for this
-        item. """
-        assert isinstance(code, str)
-        fslocation = getattr(self, "location", None)
-        if fslocation is None:
-            fslocation = getattr(self, "fspath", None)
-        self.ihook.pytest_logwarning.call_historic(kwargs=dict(
-            code=code, message=message,
-            nodeid=self.nodeid, fslocation=fslocation))
-
-    # methods for ordering nodes
-    @property
-    def nodeid(self):
-        """ a ::-separated string denoting its collection tree address. """
-        try:
-            return self._nodeid
-        except AttributeError:
-            self._nodeid = x = self._makeid()
-            return x
-
-    def _makeid(self):
-        return self.parent.nodeid + "::" + self.name
-
-    def __hash__(self):
-        return hash(self.nodeid)
-
-    def setup(self):
-        pass
-
-    def teardown(self):
-        pass
-
-    def _memoizedcall(self, attrname, function):
-        exattrname = "_ex_" + attrname
-        failure = getattr(self, exattrname, None)
-        if failure is not None:
-            py.builtin._reraise(failure[0], failure[1], failure[2])
-        if hasattr(self, attrname):
-            return getattr(self, attrname)
-        try:
-            res = function()
-        except py.builtin._sysex:
-            raise
-        except:  # noqa
-            failure = sys.exc_info()
-            setattr(self, exattrname, failure)
-            raise
-        setattr(self, attrname, res)
-        return res
-
-    def listchain(self):
-        """ return list of all parent collectors up to self,
-            starting from root of collection tree. """
-        chain = []
-        item = self
-        while item is not None:
-            chain.append(item)
-            item = item.parent
-        chain.reverse()
-        return chain
-
-    def add_marker(self, marker):
-        """ dynamically add a marker object to the node.
-
-        ``marker`` can be a string or pytest.mark.* instance.
-        """
-        from _pytest.mark import MarkDecorator, MARK_GEN
-        if isinstance(marker, py.builtin._basestring):
-            marker = getattr(MARK_GEN, marker)
-        elif not isinstance(marker, MarkDecorator):
-            raise ValueError("is not a string or pytest.mark.* Marker")
-        self.keywords[marker.name] = marker
-
-    def get_marker(self, name):
-        """ get a marker object from this node or None if
-        the node doesn't have a marker with that name. """
-        val = self.keywords.get(name, None)
-        if val is not None:
-            from _pytest.mark import MarkInfo, MarkDecorator
-            if isinstance(val, (MarkDecorator, MarkInfo)):
-                return val
-
-    def listextrakeywords(self):
-        """ Return a set of all extra keywords in self and any parents."""
-        extra_keywords = set()
-        item = self
-        for item in self.listchain():
-            extra_keywords.update(item.extra_keyword_matches)
-        return extra_keywords
-
-    def listnames(self):
-        return [x.name for x in self.listchain()]
-
-    def addfinalizer(self, fin):
-        """ register a function to be called when this node is finalized.
-
-        This method can only be called when this node is active
-        in a setup chain, for example during self.setup().
-        """
-        self.session._setupstate.addfinalizer(fin, self)
-
-    def getparent(self, cls):
-        """ get the next parent node (including ourself)
-        which is an instance of the given class"""
-        current = self
-        while current and not isinstance(current, cls):
-            current = current.parent
-        return current
-
-    def _prunetraceback(self, excinfo):
-        pass
-
-    def _repr_failure_py(self, excinfo, style=None):
-        fm = self.session._fixturemanager
-        if excinfo.errisinstance(fm.FixtureLookupError):
-            return excinfo.value.formatrepr()
-        tbfilter = True
-        if self.config.option.fulltrace:
-            style = "long"
-        else:
-            tb = _pytest._code.Traceback([excinfo.traceback[-1]])
-            self._prunetraceback(excinfo)
-            if len(excinfo.traceback) == 0:
-                excinfo.traceback = tb
-            tbfilter = False  # prunetraceback already does it
-            if style == "auto":
-                style = "long"
-        # XXX should excinfo.getrepr record all data and toterminal() process it?
-        if style is None:
-            if self.config.option.tbstyle == "short":
-                style = "short"
-            else:
-                style = "long"
-
-        try:
-            os.getcwd()
-            abspath = False
-        except OSError:
-            abspath = True
-
-        return excinfo.getrepr(funcargs=True, abspath=abspath,
-                               showlocals=self.config.option.showlocals,
-                               style=style, tbfilter=tbfilter)
-
-    repr_failure = _repr_failure_py
-
-
-class Collector(Node):
-    """ Collector instances create children through collect()
-        and thus iteratively build a tree.
-    """
-
-    class CollectError(Exception):
-        """ an error during collection, contains a custom message. """
-
-    def collect(self):
-        """ returns a list of children (items and collectors)
-            for this collection node.
-        """
-        raise NotImplementedError("abstract")
-
-    def repr_failure(self, excinfo):
-        """ represent a collection failure. """
-        if excinfo.errisinstance(self.CollectError):
-            exc = excinfo.value
-            return str(exc.args[0])
-        return self._repr_failure_py(excinfo, style="short")
-
-    def _prunetraceback(self, excinfo):
-        if hasattr(self, 'fspath'):
-            traceback = excinfo.traceback
-            ntraceback = traceback.cut(path=self.fspath)
-            if ntraceback == traceback:
-                ntraceback = ntraceback.cut(excludepath=tracebackcutdir)
-            excinfo.traceback = ntraceback.filter()
-
-
-class FSCollector(Collector):
-    def __init__(self, fspath, parent=None, config=None, session=None):
-        fspath = py.path.local(fspath)  # xxx only for test_resultlog.py?
-        name = fspath.basename
-        if parent is not None:
-            rel = fspath.relto(parent.fspath)
-            if rel:
-                name = rel
-            name = name.replace(os.sep, nodes.SEP)
-        super(FSCollector, self).__init__(name, parent, config, session)
-        self.fspath = fspath
-
-    def _check_initialpaths_for_relpath(self):
-        for initialpath in self.session._initialpaths:
-            if self.fspath.common(initialpath) == initialpath:
-                return self.fspath.relto(initialpath.dirname)
-
-    def _makeid(self):
-        relpath = self.fspath.relto(self.config.rootdir)
-
-        if not relpath:
-            relpath = self._check_initialpaths_for_relpath()
-        if os.sep != nodes.SEP:
-            relpath = relpath.replace(os.sep, nodes.SEP)
-        return relpath
-
-
-class File(FSCollector):
-    """ base class for collecting tests from a file. """
-
-
-class Item(Node):
-    """ a basic test invocation item. Note that for a single function
-    there might be multiple test invocation items.
-    """
-    nextitem = None
-
-    def __init__(self, name, parent=None, config=None, session=None):
-        super(Item, self).__init__(name, parent, config, session)
-        self._report_sections = []
-
-    def add_report_section(self, when, key, content):
-        """
-        Adds a new report section, similar to what's done internally to add stdout and
-        stderr captured output::
-
-            item.add_report_section("call", "stdout", "report section contents")
-
-        :param str when:
-            One of the possible capture states, ``"setup"``, ``"call"``, ``"teardown"``.
-        :param str key:
-            Name of the section, can be customized at will. Pytest uses ``"stdout"`` and
-            ``"stderr"`` internally.
-
-        :param str content:
-            The full contents as a string.
-        """
-        if content:
-            self._report_sections.append((when, key, content))
-
-    def reportinfo(self):
-        return self.fspath, None, ""
-
-    @property
-    def location(self):
-        try:
-            return self._location
-        except AttributeError:
-            location = self.reportinfo()
-            # bestrelpath is a quite slow function
-            cache = self.config.__dict__.setdefault("_bestrelpathcache", {})
-            try:
-                fspath = cache[location[0]]
-            except KeyError:
-                fspath = self.session.fspath.bestrelpath(location[0])
-                cache[location[0]] = fspath
-            location = (fspath, location[1], str(location[2]))
-            self._location = location
-            return location
-
-
-class NoMatch(Exception):
-    """ raised if matching cannot locate a matching names. """
-
-
-class Interrupted(KeyboardInterrupt):
-    """ signals an interrupted test run. """
-    __module__ = 'builtins'  # for py3
-
-
-class Session(FSCollector):
-    Interrupted = Interrupted
-
-    def __init__(self, config):
-        FSCollector.__init__(self, config.rootdir, parent=None,
-                             config=config, session=self)
-        self.testsfailed = 0
-        self.testscollected = 0
-        self.shouldstop = False
-        self.trace = config.trace.root.get("collection")
-        self._norecursepatterns = config.getini("norecursedirs")
-        self.startdir = py.path.local()
-        self.config.pluginmanager.register(self, name="session")
-
-    def _makeid(self):
-        return ""
-
-    @hookimpl(tryfirst=True)
-    def pytest_collectstart(self):
-        if self.shouldstop:
-            raise self.Interrupted(self.shouldstop)
-
-    @hookimpl(tryfirst=True)
-    def pytest_runtest_logreport(self, report):
-        if report.failed and not hasattr(report, 'wasxfail'):
-            self.testsfailed += 1
-            maxfail = self.config.getvalue("maxfail")
-            if maxfail and self.testsfailed >= maxfail:
-                self.shouldstop = "stopping after %d failures" % (
-                    self.testsfailed)
-    pytest_collectreport = pytest_runtest_logreport
-
-    def isinitpath(self, path):
-        return path in self._initialpaths
-
-    def gethookproxy(self, fspath):
-        # check if we have the common case of running
-        # hooks with all conftest.py filesall conftest.py
-        pm = self.config.pluginmanager
-        my_conftestmodules = pm._getconftestmodules(fspath)
-        remove_mods = pm._conftest_plugins.difference(my_conftestmodules)
-        if remove_mods:
-            # one or more conftests are not in use at this fspath
-            proxy = FSHookProxy(fspath, pm, remove_mods)
-        else:
-            # all plugis are active for this fspath
-            proxy = self.config.hook
-        return proxy
-
-    def perform_collect(self, args=None, genitems=True):
-        hook = self.config.hook
-        try:
-            items = self._perform_collect(args, genitems)
-            self.config.pluginmanager.check_pending()
-            hook.pytest_collection_modifyitems(session=self,
-                                               config=self.config, items=items)
-        finally:
-            hook.pytest_collection_finish(session=self)
-        self.testscollected = len(items)
-        return items
-
-    def _perform_collect(self, args, genitems):
-        if args is None:
-            args = self.config.args
-        self.trace("perform_collect", self, args)
-        self.trace.root.indent += 1
-        self._notfound = []
-        self._initialpaths = set()
-        self._initialparts = []
-        self.items = items = []
-        for arg in args:
-            parts = self._parsearg(arg)
-            self._initialparts.append(parts)
-            self._initialpaths.add(parts[0])
-        rep = collect_one_node(self)
-        self.ihook.pytest_collectreport(report=rep)
-        self.trace.root.indent -= 1
-        if self._notfound:
-            errors = []
-            for arg, exc in self._notfound:
-                line = "(no name %r in any of %r)" % (arg, exc.args[0])
-                errors.append("not found: %s\n%s" % (arg, line))
-                # XXX: test this
-            raise UsageError(*errors)
-        if not genitems:
-            return rep.result
-        else:
-            if rep.passed:
-                for node in rep.result:
-                    self.items.extend(self.genitems(node))
-            return items
-
-    def collect(self):
-        for parts in self._initialparts:
-            arg = "::".join(map(str, parts))
-            self.trace("processing argument", arg)
-            self.trace.root.indent += 1
-            try:
-                for x in self._collect(arg):
-                    yield x
-            except NoMatch:
-                # we are inside a make_report hook so
-                # we cannot directly pass through the exception
-                self._notfound.append((arg, sys.exc_info()[1]))
-
-            self.trace.root.indent -= 1
-
-    def _collect(self, arg):
-        names = self._parsearg(arg)
-        path = names.pop(0)
-        if path.check(dir=1):
-            assert not names, "invalid arg %r" % (arg,)
-            for path in path.visit(fil=lambda x: x.check(file=1),
-                                   rec=self._recurse, bf=True, sort=True):
-                for x in self._collectfile(path):
-                    yield x
-        else:
-            assert path.check(file=1)
-            for x in self.matchnodes(self._collectfile(path), names):
-                yield x
-
-    def _collectfile(self, path):
-        ihook = self.gethookproxy(path)
-        if not self.isinitpath(path):
-            if ihook.pytest_ignore_collect(path=path, config=self.config):
-                return ()
-        return ihook.pytest_collect_file(path=path, parent=self)
-
-    def _recurse(self, path):
-        ihook = self.gethookproxy(path.dirpath())
-        if ihook.pytest_ignore_collect(path=path, config=self.config):
-            return
-        for pat in self._norecursepatterns:
-            if path.check(fnmatch=pat):
-                return False
-        ihook = self.gethookproxy(path)
-        ihook.pytest_collect_directory(path=path, parent=self)
-        return True
-
-    def _tryconvertpyarg(self, x):
-        """Convert a dotted module name to path.
-
-        """
-        import pkgutil
-        try:
-            loader = pkgutil.find_loader(x)
-        except ImportError:
-            return x
-        if loader is None:
-            return x
-        # This method is sometimes invoked when AssertionRewritingHook, which
-        # does not define a get_filename method, is already in place:
-        try:
-            path = loader.get_filename(x)
-        except AttributeError:
-            # Retrieve path from AssertionRewritingHook:
-            path = loader.modules[x][0].co_filename
-        if loader.is_package(x):
-            path = os.path.dirname(path)
-        return path
-
-    def _parsearg(self, arg):
-        """ return (fspath, names) tuple after checking the file exists. """
-        parts = str(arg).split("::")
-        if self.config.option.pyargs:
-            parts[0] = self._tryconvertpyarg(parts[0])
-        relpath = parts[0].replace("/", os.sep)
-        path = self.config.invocation_dir.join(relpath, abs=True)
-        if not path.check():
-            if self.config.option.pyargs:
-                raise UsageError(
-                    "file or package not found: " + arg +
-                    " (missing __init__.py?)")
-            else:
-                raise UsageError("file not found: " + arg)
-        parts[0] = path
-        return parts
-
-    def matchnodes(self, matching, names):
-        self.trace("matchnodes", matching, names)
-        self.trace.root.indent += 1
-        nodes = self._matchnodes(matching, names)
-        num = len(nodes)
-        self.trace("matchnodes finished -> ", num, "nodes")
-        self.trace.root.indent -= 1
-        if num == 0:
-            raise NoMatch(matching, names[:1])
-        return nodes
-
-    def _matchnodes(self, matching, names):
-        if not matching or not names:
-            return matching
-        name = names[0]
-        assert name
-        nextnames = names[1:]
-        resultnodes = []
-        for node in matching:
-            if isinstance(node, Item):
-                if not names:
-                    resultnodes.append(node)
-                continue
-            assert isinstance(node, Collector)
-            rep = collect_one_node(node)
-            if rep.passed:
-                has_matched = False
-                for x in rep.result:
-                    # TODO: remove parametrized workaround once collection structure contains parametrization
-                    if x.name == name or x.name.split("[")[0] == name:
-                        resultnodes.extend(self.matchnodes([x], nextnames))
-                        has_matched = True
-                # XXX accept IDs that don't have "()" for class instances
-                if not has_matched and len(rep.result) == 1 and x.name == "()":
-                    nextnames.insert(0, name)
-                    resultnodes.extend(self.matchnodes([x], nextnames))
-            else:
-                # report collection failures here to avoid failing to run some test
-                # specified in the command line because the module could not be
-                # imported (#134)
-                node.ihook.pytest_collectreport(report=rep)
-        return resultnodes
-
-    def genitems(self, node):
-        self.trace("genitems", node)
-        if isinstance(node, Item):
-            node.ihook.pytest_itemcollected(item=node)
-            yield node
-        else:
-            assert isinstance(node, Collector)
-            rep = collect_one_node(node)
-            if rep.passed:
-                for subnode in rep.result:
-                    for x in self.genitems(subnode):
-                        yield x
-            node.ihook.pytest_collectreport(report=rep)
deleted file mode 100644
--- a/third_party/python/pytest/_pytest/mark.py
+++ /dev/null
@@ -1,465 +0,0 @@
-""" generic mechanism for marking and selecting python functions. """
-from __future__ import absolute_import, division, print_function
-
-import inspect
-import warnings
-from collections import namedtuple
-from operator import attrgetter
-from .compat import imap
-from .deprecated import MARK_PARAMETERSET_UNPACKING
-
-
-def alias(name, warning=None):
-    getter = attrgetter(name)
-
-    def warned(self):
-        warnings.warn(warning, stacklevel=2)
-        return getter(self)
-
-    return property(getter if warning is None else warned, doc='alias for ' + name)
-
-
-class ParameterSet(namedtuple('ParameterSet', 'values, marks, id')):
-    @classmethod
-    def param(cls, *values, **kw):
-        marks = kw.pop('marks', ())
-        if isinstance(marks, MarkDecorator):
-            marks = marks,
-        else:
-            assert isinstance(marks, (tuple, list, set))
-
-        def param_extract_id(id=None):
-            return id
-
-        id = param_extract_id(**kw)
-        return cls(values, marks, id)
-
-    @classmethod
-    def extract_from(cls, parameterset, legacy_force_tuple=False):
-        """
-        :param parameterset:
-            a legacy style parameterset that may or may not be a tuple,
-            and may or may not be wrapped into a mess of mark objects
-
-        :param legacy_force_tuple:
-            enforce tuple wrapping so single argument tuple values
-            don't get decomposed and break tests
-
-        """
-
-        if isinstance(parameterset, cls):
-            return parameterset
-        if not isinstance(parameterset, MarkDecorator) and legacy_force_tuple:
-            return cls.param(parameterset)
-
-        newmarks = []
-        argval = parameterset
-        while isinstance(argval, MarkDecorator):
-            newmarks.append(MarkDecorator(Mark(
-                argval.markname, argval.args[:-1], argval.kwargs)))
-            argval = argval.args[-1]
-        assert not isinstance(argval, ParameterSet)
-        if legacy_force_tuple:
-            argval = argval,
-
-        if newmarks:
-            warnings.warn(MARK_PARAMETERSET_UNPACKING)
-
-        return cls(argval, marks=newmarks, id=None)
-
-    @property
-    def deprecated_arg_dict(self):
-        return dict((mark.name, mark) for mark in self.marks)
-
-
-class MarkerError(Exception):
-
-    """Error in use of a pytest marker/attribute."""
-
-
-def param(*values, **kw):
-    return ParameterSet.param(*values, **kw)
-
-
-def pytest_addoption(parser):
-    group = parser.getgroup("general")
-    group._addoption(
-        '-k',
-        action="store", dest="keyword", default='', metavar="EXPRESSION",
-        help="only run tests which match the given substring expression. "
-             "An expression is a python evaluatable expression "
-             "where all names are substring-matched against test names "
-             "and their parent classes. Example: -k 'test_method or test_"
-             "other' matches all test functions and classes whose name "
-             "contains 'test_method' or 'test_other', while -k 'not test_method' "
-             "matches those that don't contain 'test_method' in their names. "
-             "Additionally keywords are matched to classes and functions "
-             "containing extra names in their 'extra_keyword_matches' set, "
-             "as well as functions which have names assigned directly to them."
-    )
-
-    group._addoption(
-        "-m",
-        action="store", dest="markexpr", default="", metavar="MARKEXPR",
-        help="only run tests matching given mark expression.  "
-             "example: -m 'mark1 and not mark2'."
-    )
-
-    group.addoption(
-        "--markers", action="store_true",
-        help="show markers (builtin, plugin and per-project ones)."
-    )
-
-    parser.addini("markers", "markers for test functions", 'linelist')
-
-
-def pytest_cmdline_main(config):
-    import _pytest.config
-    if config.option.markers:
-        config._do_configure()
-        tw = _pytest.config.create_terminal_writer(config)
-        for line in config.getini("markers"):
-            name, rest = line.split(":", 1)
-            tw.write("@pytest.mark.%s:" % name, bold=True)
-            tw.line(rest)
-            tw.line()
-        config._ensure_unconfigure()
-        return 0
-
-
-pytest_cmdline_main.tryfirst = True
-
-
-def pytest_collection_modifyitems(items, config):
-    keywordexpr = config.option.keyword.lstrip()
-    matchexpr = config.option.markexpr
-    if not keywordexpr and not matchexpr:
-        return
-    # pytest used to allow "-" for negating
-    # but today we just allow "-" at the beginning, use "not" instead
-    # we probably remove "-" altogether soon
-    if keywordexpr.startswith("-"):
-        keywordexpr = "not " + keywordexpr[1:]
-    selectuntil = False
-    if keywordexpr[-1:] == ":":
-        selectuntil = True
-        keywordexpr = keywordexpr[:-1]
-
-    remaining = []
-    deselected = []
-    for colitem in items:
-        if keywordexpr and not matchkeyword(colitem, keywordexpr):
-            deselected.append(colitem)
-        else:
-            if selectuntil:
-                keywordexpr = None
-            if matchexpr:
-                if not matchmark(colitem, matchexpr):
-                    deselected.append(colitem)
-                    continue
-            remaining.append(colitem)
-
-    if deselected:
-        config.hook.pytest_deselected(items=deselected)
-        items[:] = remaining
-
-
-class MarkMapping:
-    """Provides a local mapping for markers where item access
-    resolves to True if the marker is present. """
-
-    def __init__(self, keywords):
-        mymarks = set()
-        for key, value in keywords.items():
-            if isinstance(value, MarkInfo) or isinstance(value, MarkDecorator):
-                mymarks.add(key)
-        self._mymarks = mymarks
-
-    def __getitem__(self, name):
-        return name in self._mymarks
-
-
-class KeywordMapping:
-    """Provides a local mapping for keywords.
-    Given a list of names, map any substring of one of these names to True.
-    """
-
-    def __init__(self, names):
-        self._names = names
-
-    def __getitem__(self, subname):
-        for name in self._names:
-            if subname in name:
-                return True
-        return False
-
-
-def matchmark(colitem, markexpr):
-    """Tries to match on any marker names, attached to the given colitem."""
-    return eval(markexpr, {}, MarkMapping(colitem.keywords))
-
-
-def matchkeyword(colitem, keywordexpr):
-    """Tries to match given keyword expression to given collector item.
-
-    Will match on the name of colitem, including the names of its parents.
-    Only matches names of items which are either a :class:`Class` or a
-    :class:`Function`.
-    Additionally, matches on names in the 'extra_keyword_matches' set of
-    any item, as well as names directly assigned to test functions.
-    """
-    mapped_names = set()
-
-    # Add the names of the current item and any parent items
-    import pytest
-    for item in colitem.listchain():
-        if not isinstance(item, pytest.Instance):
-            mapped_names.add(item.name)
-
-    # Add the names added as extra keywords to current or parent items
-    for name in colitem.listextrakeywords():
-        mapped_names.add(name)
-
-    # Add the names attached to the current function through direct assignment
-    if hasattr(colitem, 'function'):
-        for name in colitem.function.__dict__:
-            mapped_names.add(name)
-
-    mapping = KeywordMapping(mapped_names)
-    if " " not in keywordexpr:
-        # special case to allow for simple "-k pass" and "-k 1.3"
-        return mapping[keywordexpr]
-    elif keywordexpr.startswith("not ") and " " not in keywordexpr[4:]:
-        return not mapping[keywordexpr[4:]]
-    return eval(keywordexpr, {}, mapping)
-
-
-def pytest_configure(config):
-    config._old_mark_config = MARK_GEN._config
-    if config.option.strict:
-        MARK_GEN._config = config
-
-
-def pytest_unconfigure(config):
-    MARK_GEN._config = getattr(config, '_old_mark_config', None)
-
-
-class MarkGenerator:
-    """ Factory for :class:`MarkDecorator` objects - exposed as
-    a ``pytest.mark`` singleton instance.  Example::
-
-         import pytest
-         @pytest.mark.slowtest
-         def test_function():
-            pass
-
-    will set a 'slowtest' :class:`MarkInfo` object
-    on the ``test_function`` object. """
-    _config = None
-
-    def __getattr__(self, name):
-        if name[0] == "_":
-            raise AttributeError("Marker name must NOT start with underscore")
-        if self._config is not None:
-            self._check(name)
-        return MarkDecorator(Mark(name, (), {}))
-
-    def _check(self, name):
-        try:
-            if name in self._markers:
-                return
-        except AttributeError:
-            pass
-        self._markers = values = set()
-        for line in self._config.getini("markers"):
-            marker, _ = line.split(":", 1)
-            marker = marker.rstrip()
-            x = marker.split("(", 1)[0]
-            values.add(x)
-        if name not in self._markers:
-            raise AttributeError("%r not a registered marker" % (name,))
-
-
-def istestfunc(func):
-    return hasattr(func, "__call__") and \
-        getattr(func, "__name__", "<lambda>") != "<lambda>"
-
-
-class MarkDecorator:
-    """ A decorator for test functions and test classes.  When applied
-    it will create :class:`MarkInfo` objects which may be
-    :ref:`retrieved by hooks as item keywords <excontrolskip>`.
-    MarkDecorator instances are often created like this::
-
-        mark1 = pytest.mark.NAME              # simple MarkDecorator
-        mark2 = pytest.mark.NAME(name1=value) # parametrized MarkDecorator
-
-    and can then be applied as decorators to test functions::
-
-        @mark2
-        def test_function():
-            pass
-
-    When a MarkDecorator instance is called it does the following:
-      1. If called with a single class as its only positional argument and no
-         additional keyword arguments, it attaches itself to the class so it
-         gets applied automatically to all test cases found in that class.
-      2. If called with a single function as its only positional argument and
-         no additional keyword arguments, it attaches a MarkInfo object to the
-         function, containing all the arguments already stored internally in
-         the MarkDecorator.
-      3. When called in any other case, it performs a 'fake construction' call,
-         i.e. it returns a new MarkDecorator instance with the original
-         MarkDecorator's content updated with the arguments passed to this
-         call.
-
-    Note: The rules above prevent MarkDecorator objects from storing only a
-    single function or class reference as their positional argument with no
-    additional keyword or positional arguments.
-
-    """
-
-    def __init__(self, mark):
-        assert isinstance(mark, Mark), repr(mark)
-        self.mark = mark
-
-    name = alias('mark.name')
-    args = alias('mark.args')
-    kwargs = alias('mark.kwargs')
-
-    @property
-    def markname(self):
-        return self.name  # for backward-compat (2.4.1 had this attr)
-
-    def __eq__(self, other):
-        return self.mark == other.mark if isinstance(other, MarkDecorator) else False
-
-    def __repr__(self):
-        return "<MarkDecorator %r>" % (self.mark,)
-
-    def with_args(self, *args, **kwargs):
-        """ return a MarkDecorator with extra arguments added
-
-        unlike call this can be used even if the sole argument is a callable/class
-
-        :return: MarkDecorator
-        """
-
-        mark = Mark(self.name, args, kwargs)
-        return self.__class__(self.mark.combined_with(mark))
-
-    def __call__(self, *args, **kwargs):
-        """ if passed a single callable argument: decorate it with mark info.
-            otherwise add *args/**kwargs in-place to mark information. """
-        if args and not kwargs:
-            func = args[0]
-            is_class = inspect.isclass(func)
-            if len(args) == 1 and (istestfunc(func) or is_class):
-                if is_class:
-                    store_mark(func, self.mark)
-                else:
-                    store_legacy_markinfo(func, self.mark)
-                    store_mark(func, self.mark)
-                return func
-        return self.with_args(*args, **kwargs)
-
-
-def get_unpacked_marks(obj):
-    """
-    obtain the unpacked marks that are stored on a object
-    """
-    mark_list = getattr(obj, 'pytestmark', [])
-
-    if not isinstance(mark_list, list):
-        mark_list = [mark_list]
-    return [
-        getattr(mark, 'mark', mark)  # unpack MarkDecorator
-        for mark in mark_list
-    ]
-
-
-def store_mark(obj, mark):
-    """store a Mark on a object
-    this is used to implement the Mark declarations/decorators correctly
-    """
-    assert isinstance(mark, Mark), mark
-    # always reassign name to avoid updating pytestmark
-    # in a reference that was only borrowed
-    obj.pytestmark = get_unpacked_marks(obj) + [mark]
-
-
-def store_legacy_markinfo(func, mark):
-    """create the legacy MarkInfo objects and put them onto the function
-    """
-    if not isinstance(mark, Mark):
-        raise TypeError("got {mark!r} instead of a Mark".format(mark=mark))
-    holder = getattr(func, mark.name, None)
-    if holder is None:
-        holder = MarkInfo(mark)
-        setattr(func, mark.name, holder)
-    else:
-        holder.add_mark(mark)
-
-
-class Mark(namedtuple('Mark', 'name, args, kwargs')):
-
-    def combined_with(self, other):
-        assert self.name == other.name
-        return Mark(
-            self.name, self.args + other.args,
-            dict(self.kwargs, **other.kwargs))
-
-
-class MarkInfo(object):
-    """ Marking object created by :class:`MarkDecorator` instances. """
-
-    def __init__(self, mark):
-        assert isinstance(mark, Mark), repr(mark)
-        self.combined = mark
-        self._marks = [mark]
-
-    name = alias('combined.name')
-    args = alias('combined.args')
-    kwargs = alias('combined.kwargs')
-
-    def __repr__(self):
-        return "<MarkInfo {0!r}>".format(self.combined)
-
-    def add_mark(self, mark):
-        """ add a MarkInfo with the given args and kwargs. """
-        self._marks.append(mark)
-        self.combined = self.combined.combined_with(mark)
-
-    def __iter__(self):
-        """ yield MarkInfo objects each relating to a marking-call. """
-        return imap(MarkInfo, self._marks)
-
-
-MARK_GEN = MarkGenerator()
-
-
-def _marked(func, mark):
-    """ Returns True if :func: is already marked with :mark:, False otherwise.
-    This can happen if marker is applied to class and the test file is
-    invoked more than once.
-    """
-    try:
-        func_mark = getattr(func, mark.name)
-    except AttributeError:
-        return False
-    return mark.args == func_mark.args and mark.kwargs == func_mark.kwargs
-
-
-def transfer_markers(funcobj, cls, mod):
-    """
-    this function transfers class level markers and module level markers
-    into function level markinfo objects
-
-    this is the main reason why marks are so broken
-    the resolution will involve phasing out function level MarkInfo objects
-
-    """
-    for obj in (cls, mod):
-        for mark in get_unpacked_marks(obj):
-            if not _marked(funcobj, mark):
-                store_legacy_markinfo(funcobj, mark)
deleted file mode 100644
--- a/third_party/python/pytest/_pytest/monkeypatch.py
+++ /dev/null
@@ -1,259 +0,0 @@
-""" monkeypatching and mocking functionality.  """
-from __future__ import absolute_import, division, print_function
-
-import os
-import sys
-import re
-
-from py.builtin import _basestring
-from _pytest.fixtures import fixture
-
-RE_IMPORT_ERROR_NAME = re.compile("^No module named (.*)$")
-
-
-@fixture
-def monkeypatch():
-    """The returned ``monkeypatch`` fixture provides these
-    helper methods to modify objects, dictionaries or os.environ::
-
-        monkeypatch.setattr(obj, name, value, raising=True)
-        monkeypatch.delattr(obj, name, raising=True)
-        monkeypatch.setitem(mapping, name, value)
-        monkeypatch.delitem(obj, name, raising=True)
-        monkeypatch.setenv(name, value, prepend=False)
-        monkeypatch.delenv(name, value, raising=True)
-        monkeypatch.syspath_prepend(path)
-        monkeypatch.chdir(path)
-
-    All modifications will be undone after the requesting
-    test function or fixture has finished. The ``raising``
-    parameter determines if a KeyError or AttributeError
-    will be raised if the set/deletion operation has no target.
-    """
-    mpatch = MonkeyPatch()
-    yield mpatch
-    mpatch.undo()
-
-
-def resolve(name):
-    # simplified from zope.dottedname
-    parts = name.split('.')
-
-    used = parts.pop(0)
-    found = __import__(used)
-    for part in parts:
-        used += '.' + part
-        try:
-            found = getattr(found, part)
-        except AttributeError:
-            pass
-        else:
-            continue
-        # we use explicit un-nesting of the handling block in order
-        # to avoid nested exceptions on python 3
-        try:
-            __import__(used)
-        except ImportError as ex:
-            # str is used for py2 vs py3
-            expected = str(ex).split()[-1]
-            if expected == used:
-                raise
-            else:
-                raise ImportError(
-                    'import error in %s: %s' % (used, ex)
-                )
-        found = annotated_getattr(found, part, used)
-    return found
-
-
-def annotated_getattr(obj, name, ann):
-    try:
-        obj = getattr(obj, name)
-    except AttributeError:
-        raise AttributeError(
-            '%r object at %s has no attribute %r' % (
-                type(obj).__name__, ann, name
-            )
-        )
-    return obj
-
-
-def derive_importpath(import_path, raising):
-    if not isinstance(import_path, _basestring) or "." not in import_path:
-        raise TypeError("must be absolute import path string, not %r" %
-                        (import_path,))
-    module, attr = import_path.rsplit('.', 1)
-    target = resolve(module)
-    if raising:
-        annotated_getattr(target, attr, ann=module)
-    return attr, target
-
-
-class Notset:
-    def __repr__(self):
-        return "<notset>"
-
-
-notset = Notset()
-
-
-class MonkeyPatch:
-    """ Object returned by the ``monkeypatch`` fixture keeping a record of setattr/item/env/syspath changes.
-    """
-
-    def __init__(self):
-        self._setattr = []
-        self._setitem = []
-        self._cwd = None
-        self._savesyspath = None
-
-    def setattr(self, target, name, value=notset, raising=True):
-        """ Set attribute value on target, memorizing the old value.
-        By default raise AttributeError if the attribute did not exist.
-
-        For convenience you can specify a string as ``target`` which
-        will be interpreted as a dotted import path, with the last part
-        being the attribute name.  Example:
-        ``monkeypatch.setattr("os.getcwd", lambda x: "/")``
-        would set the ``getcwd`` function of the ``os`` module.
-
-        The ``raising`` value determines if the setattr should fail
-        if the attribute is not already present (defaults to True
-        which means it will raise).
-        """
-        __tracebackhide__ = True
-        import inspect
-
-        if value is notset:
-            if not isinstance(target, _basestring):
-                raise TypeError("use setattr(target, name, value) or "
-                                "setattr(target, value) with target being a dotted "
-                                "import string")
-            value = name
-            name, target = derive_importpath(target, raising)
-
-        oldval = getattr(target, name, notset)
-        if raising and oldval is notset:
-            raise AttributeError("%r has no attribute %r" % (target, name))
-
-        # avoid class descriptors like staticmethod/classmethod
-        if inspect.isclass(target):
-            oldval = target.__dict__.get(name, notset)
-        self._setattr.append((target, name, oldval))
-        setattr(target, name, value)
-
-    def delattr(self, target, name=notset, raising=True):
-        """ Delete attribute ``name`` from ``target``, by default raise
-        AttributeError it the attribute did not previously exist.
-
-        If no ``name`` is specified and ``target`` is a string
-        it will be interpreted as a dotted import path with the
-        last part being the attribute name.
-
-        If ``raising`` is set to False, no exception will be raised if the
-        attribute is missing.
-        """
-        __tracebackhide__ = True
-        if name is notset:
-            if not isinstance(target, _basestring):
-                raise TypeError("use delattr(target, name) or "
-                                "delattr(target) with target being a dotted "
-                                "import string")
-            name, target = derive_importpath(target, raising)
-
-        if not hasattr(target, name):
-            if raising:
-                raise AttributeError(name)
-        else:
-            self._setattr.append((target, name, getattr(target, name, notset)))
-            delattr(target, name)
-
-    def setitem(self, dic, name, value):
-        """ Set dictionary entry ``name`` to value. """
-        self._setitem.append((dic, name, dic.get(name, notset)))
-        dic[name] = value
-
-    def delitem(self, dic, name, raising=True):
-        """ Delete ``name`` from dict. Raise KeyError if it doesn't exist.
-
-        If ``raising`` is set to False, no exception will be raised if the
-        key is missing.
-        """
-        if name not in dic:
-            if raising:
-                raise KeyError(name)
-        else:
-            self._setitem.append((dic, name, dic.get(name, notset)))
-            del dic[name]
-
-    def setenv(self, name, value, prepend=None):
-        """ Set environment variable ``name`` to ``value``.  If ``prepend``
-        is a character, read the current environment variable value
-        and prepend the ``value`` adjoined with the ``prepend`` character."""
-        value = str(value)
-        if prepend and name in os.environ:
-            value = value + prepend + os.environ[name]
-        self.setitem(os.environ, name, value)
-
-    def delenv(self, name, raising=True):
-        """ Delete ``name`` from the environment. Raise KeyError it does not
-        exist.
-
-        If ``raising`` is set to False, no exception will be raised if the
-        environment variable is missing.
-        """
-        self.delitem(os.environ, name, raising=raising)
-
-    def syspath_prepend(self, path):
-        """ Prepend ``path`` to ``sys.path`` list of import locations. """
-        if self._savesyspath is None:
-            self._savesyspath = sys.path[:]
-        sys.path.insert(0, str(path))
-
-    def chdir(self, path):
-        """ Change the current working directory to the specified path.
-        Path can be a string or a py.path.local object.
-        """
-        if self._cwd is None:
-            self._cwd = os.getcwd()
-        if hasattr(path, "chdir"):
-            path.chdir()
-        else:
-            os.chdir(path)
-
-    def undo(self):
-        """ Undo previous changes.  This call consumes the
-        undo stack. Calling it a second time has no effect unless
-        you do more monkeypatching after the undo call.
-
-        There is generally no need to call `undo()`, since it is
-        called automatically during tear-down.
-
-        Note that the same `monkeypatch` fixture is used across a
-        single test function invocation. If `monkeypatch` is used both by
-        the test function itself and one of the test fixtures,
-        calling `undo()` will undo all of the changes made in
-        both functions.
-        """
-        for obj, name, value in reversed(self._setattr):
-            if value is not notset:
-                setattr(obj, name, value)
-            else:
-                delattr(obj, name)
-        self._setattr[:] = []
-        for dictionary, name, value in reversed(self._setitem):
-            if value is notset:
-                try:
-                    del dictionary[name]
-                except KeyError:
-                    pass  # was already deleted, so we have the desired state
-            else:
-                dictionary[name] = value
-        self._setitem[:] = []
-        if self._savesyspath is not None:
-            sys.path[:] = self._savesyspath
-            self._savesyspath = None
-
-        if self._cwd is not None:
-            os.chdir(self._cwd)
-            self._cwd = None
deleted file mode 100644
--- a/third_party/python/pytest/_pytest/nodes.py
+++ /dev/null
@@ -1,37 +0,0 @@
-SEP = "/"
-
-
-def _splitnode(nodeid):
-    """Split a nodeid into constituent 'parts'.
-
-    Node IDs are strings, and can be things like:
-        ''
-        'testing/code'
-        'testing/code/test_excinfo.py'
-        'testing/code/test_excinfo.py::TestFormattedExcinfo::()'
-
-    Return values are lists e.g.
-        []
-        ['testing', 'code']
-        ['testing', 'code', 'test_excinfo.py']
-        ['testing', 'code', 'test_excinfo.py', 'TestFormattedExcinfo', '()']
-    """
-    if nodeid == '':
-        # If there is no root node at all, return an empty list so the caller's logic can remain sane
-        return []
-    parts = nodeid.split(SEP)
-    # Replace single last element 'test_foo.py::Bar::()' with multiple elements 'test_foo.py', 'Bar', '()'
-    parts[-1:] = parts[-1].split("::")
-    return parts
-
-
-def ischildnode(baseid, nodeid):
-    """Return True if the nodeid is a child node of the baseid.
-
-    E.g. 'foo/bar::Baz::()' is a child of 'foo', 'foo/bar' and 'foo/bar::Baz', but not of 'foo/blorp'
-    """
-    base_parts = _splitnode(baseid)
-    node_parts = _splitnode(nodeid)
-    if len(node_parts) < len(base_parts):
-        return False
-    return node_parts[:len(base_parts)] == base_parts
deleted file mode 100644
--- a/third_party/python/pytest/_pytest/nose.py
+++ /dev/null
@@ -1,73 +0,0 @@
-""" run test suites written for nose. """
-from __future__ import absolute_import, division, print_function
-
-import sys
-
-import py
-from _pytest import unittest, runner, python
-from _pytest.config import hookimpl
-
-
-def get_skip_exceptions():
-    skip_classes = set()
-    for module_name in ('unittest', 'unittest2', 'nose'):
-        mod = sys.modules.get(module_name)
-        if hasattr(mod, 'SkipTest'):
-            skip_classes.add(mod.SkipTest)
-    return tuple(skip_classes)
-
-
-def pytest_runtest_makereport(item, call):
-    if call.excinfo and call.excinfo.errisinstance(get_skip_exceptions()):
-        # let's substitute the excinfo with a pytest.skip one
-        call2 = call.__class__(
-            lambda: runner.skip(str(call.excinfo.value)), call.when)
-        call.excinfo = call2.excinfo
-
-
-@hookimpl(trylast=True)
-def pytest_runtest_setup(item):
-    if is_potential_nosetest(item):
-        if isinstance(item.parent, python.Generator):
-            gen = item.parent
-            if not hasattr(gen, '_nosegensetup'):
-                call_optional(gen.obj, 'setup')
-                if isinstance(gen.parent, python.Instance):
-                    call_optional(gen.parent.obj, 'setup')
-                gen._nosegensetup = True
-        if not call_optional(item.obj, 'setup'):
-            # call module level setup if there is no object level one
-            call_optional(item.parent.obj, 'setup')
-        # XXX this implies we only call teardown when setup worked
-        item.session._setupstate.addfinalizer((lambda: teardown_nose(item)), item)
-
-
-def teardown_nose(item):
-    if is_potential_nosetest(item):
-        if not call_optional(item.obj, 'teardown'):
-            call_optional(item.parent.obj, 'teardown')
-        # if hasattr(item.parent, '_nosegensetup'):
-        #    #call_optional(item._nosegensetup, 'teardown')
-        #    del item.parent._nosegensetup
-
-
-def pytest_make_collect_report(collector):
-    if isinstance(collector, python.Generator):
-        call_optional(collector.obj, 'setup')
-
-
-def is_potential_nosetest(item):
-    # extra check needed since we do not do nose style setup/teardown
-    # on direct unittest style classes
-    return isinstance(item, python.Function) and \
-        not isinstance(item, unittest.TestCaseFunction)
-
-
-def call_optional(obj, name):
-    method = getattr(obj, name, None)
-    isfixture = hasattr(method, "_pytestfixturefunction")
-    if method is not None and not isfixture and py.builtin.callable(method):
-        # If there's any problems allow the exception to raise rather than
-        # silently ignoring them
-        method()
-        return True
deleted file mode 100644
--- a/third_party/python/pytest/_pytest/outcomes.py
+++ /dev/null
@@ -1,140 +0,0 @@
-"""
-exception classes and constants handling test outcomes
-as well as functions creating them
-"""
-from __future__ import absolute_import, division, print_function
-import py
-import sys
-
-
-class OutcomeException(BaseException):
-    """ OutcomeException and its subclass instances indicate and
-        contain info about test and collection outcomes.
-    """
-    def __init__(self, msg=None, pytrace=True):
-        BaseException.__init__(self, msg)
-        self.msg = msg
-        self.pytrace = pytrace
-
-    def __repr__(self):
-        if self.msg:
-            val = self.msg
-            if isinstance(val, bytes):
-                val = py._builtin._totext(val, errors='replace')
-            return val
-        return "<%s instance>" % (self.__class__.__name__,)
-    __str__ = __repr__
-
-
-TEST_OUTCOME = (OutcomeException, Exception)
-
-
-class Skipped(OutcomeException):
-    # XXX hackish: on 3k we fake to live in the builtins
-    # in order to have Skipped exception printing shorter/nicer
-    __module__ = 'builtins'
-
-    def __init__(self, msg=None, pytrace=True, allow_module_level=False):
-        OutcomeException.__init__(self, msg=msg, pytrace=pytrace)
-        self.allow_module_level = allow_module_level
-
-
-class Failed(OutcomeException):
-    """ raised from an explicit call to pytest.fail() """
-    __module__ = 'builtins'
-
-
-class Exit(KeyboardInterrupt):
-    """ raised for immediate program exits (no tracebacks/summaries)"""
-    def __init__(self, msg="unknown reason"):
-        self.msg = msg
-        KeyboardInterrupt.__init__(self, msg)
-
-# exposed helper methods
-
-
-def exit(msg):
-    """ exit testing process as if KeyboardInterrupt was triggered. """
-    __tracebackhide__ = True
-    raise Exit(msg)
-
-
-exit.Exception = Exit
-
-
-def skip(msg=""):
-    """ skip an executing test with the given message.  Note: it's usually
-    better to use the pytest.mark.skipif marker to declare a test to be
-    skipped under certain conditions like mismatching platforms or
-    dependencies.  See the pytest_skipping plugin for details.
-    """
-    __tracebackhide__ = True
-    raise Skipped(msg=msg)
-
-
-skip.Exception = Skipped
-
-
-def fail(msg="", pytrace=True):
-    """ explicitly fail an currently-executing test with the given Message.
-
-    :arg pytrace: if false the msg represents the full failure information
-                  and no python traceback will be reported.
-    """
-    __tracebackhide__ = True
-    raise Failed(msg=msg, pytrace=pytrace)
-
-
-fail.Exception = Failed
-
-
-class XFailed(fail.Exception):
-    """ raised from an explicit call to pytest.xfail() """
-
-
-def xfail(reason=""):
-    """ xfail an executing test or setup functions with the given reason."""
-    __tracebackhide__ = True
-    raise XFailed(reason)
-
-
-xfail.Exception = XFailed
-
-
-def importorskip(modname, minversion=None):
-    """ return imported module if it has at least "minversion" as its
-    __version__ attribute.  If no minversion is specified the a skip
-    is only triggered if the module can not be imported.
-    """
-    import warnings
-    __tracebackhide__ = True
-    compile(modname, '', 'eval')  # to catch syntaxerrors
-    should_skip = False
-
-    with warnings.catch_warnings():
-        # make sure to ignore ImportWarnings that might happen because
-        # of existing directories with the same name we're trying to
-        # import but without a __init__.py file
-        warnings.simplefilter('ignore')
-        try:
-            __import__(modname)
-        except ImportError:
-            # Do not raise chained exception here(#1485)
-            should_skip = True
-    if should_skip:
-        raise Skipped("could not import %r" % (modname,), allow_module_level=True)
-    mod = sys.modules[modname]
-    if minversion is None:
-        return mod
-    verattr = getattr(mod, '__version__', None)
-    if minversion is not None:
-        try:
-            from pkg_resources import parse_version as pv
-        except ImportError:
-            raise Skipped("we have a required version for %r but can not import "
-                          "pkg_resources to parse version strings." % (modname,),
-                          allow_module_level=True)
-        if verattr is None or pv(verattr) < pv(minversion):
-            raise Skipped("module %r has __version__ %r, required is: %r" % (
-                          modname, verattr, minversion), allow_module_level=True)
-    return mod
deleted file mode 100644
--- a/third_party/python/pytest/_pytest/pastebin.py
+++ /dev/null
@@ -1,100 +0,0 @@
-""" submit failure or test session information to a pastebin service. """
-from __future__ import absolute_import, division, print_function
-
-import pytest
-import sys
-import tempfile
-
-
-def pytest_addoption(parser):
-    group = parser.getgroup("terminal reporting")
-    group._addoption('--pastebin', metavar="mode",
-                     action='store', dest="pastebin", default=None,
-                     choices=['failed', 'all'],
-                     help="send failed|all info to bpaste.net pastebin service.")
-
-
-@pytest.hookimpl(trylast=True)
-def pytest_configure(config):
-    import py
-    if config.option.pastebin == "all":
-        tr = config.pluginmanager.getplugin('terminalreporter')
-        # if no terminal reporter plugin is present, nothing we can do here;
-        # this can happen when this function executes in a slave node
-        # when using pytest-xdist, for example
-        if tr is not None:
-            # pastebin file will be utf-8 encoded binary file
-            config._pastebinfile = tempfile.TemporaryFile('w+b')
-            oldwrite = tr._tw.write
-
-            def tee_write(s, **kwargs):
-                oldwrite(s, **kwargs)
-                if py.builtin._istext(s):
-                    s = s.encode('utf-8')
-                config._pastebinfile.write(s)
-
-            tr._tw.write = tee_write
-
-
-def pytest_unconfigure(config):
-    if hasattr(config, '_pastebinfile'):
-        # get terminal contents and delete file
-        config._pastebinfile.seek(0)
-        sessionlog = config._pastebinfile.read()
-        config._pastebinfile.close()
-        del config._pastebinfile
-        # undo our patching in the terminal reporter
-        tr = config.pluginmanager.getplugin('terminalreporter')
-        del tr._tw.__dict__['write']
-        # write summary
-        tr.write_sep("=", "Sending information to Paste Service")
-        pastebinurl = create_new_paste(sessionlog)
-        tr.write_line("pastebin session-log: %s\n" % pastebinurl)
-
-
-def create_new_paste(contents):
-    """
-    Creates a new paste using bpaste.net service.
-
-    :contents: paste contents as utf-8 encoded bytes
-    :returns: url to the pasted contents
-    """
-    import re
-    if sys.version_info < (3, 0):
-        from urllib import urlopen, urlencode
-    else:
-        from urllib.request import urlopen
-        from urllib.parse import urlencode
-
-    params = {
-        'code': contents,
-        'lexer': 'python3' if sys.version_info[0] == 3 else 'python',
-        'expiry': '1week',
-    }
-    url = 'https://bpaste.net'
-    response = urlopen(url, data=urlencode(params).encode('ascii')).read()
-    m = re.search(r'href="/raw/(\w+)"', response.decode('utf-8'))
-    if m:
-        return '%s/show/%s' % (url, m.group(1))
-    else:
-        return 'bad response: ' + response
-
-
-def pytest_terminal_summary(terminalreporter):
-    import _pytest.config
-    if terminalreporter.config.option.pastebin != "failed":
-        return
-    tr = terminalreporter
-    if 'failed' in tr.stats:
-        terminalreporter.write_sep("=", "Sending information to Paste Service")
-        for rep in terminalreporter.stats.get('failed'):
-            try:
-                msg = rep.longrepr.reprtraceback.reprentries[-1].reprfileloc
-            except AttributeError:
-                msg = tr._getfailureheadline(rep)
-            tw = _pytest.config.create_terminal_writer(terminalreporter.config, stringio=True)
-            rep.toterminal(tw)
-            s = tw.stringio.getvalue()
-            assert len(s)
-            pastebinurl = create_new_paste(s)
-            tr.write_line("%s --> %s" % (msg, pastebinurl))
deleted file mode 100644
--- a/third_party/python/pytest/_pytest/pytester.py
+++ /dev/null
@@ -1,1167 +0,0 @@
-""" (disabled by default) support for testing pytest and pytest plugins. """
-from __future__ import absolute_import, division, print_function
-
-import codecs
-import gc
-import os
-import platform
-import re
-import subprocess
-import sys
-import time
-import traceback
-from fnmatch import fnmatch
-
-from weakref import WeakKeyDictionary
-
-from _pytest.capture import MultiCapture, SysCapture
-from _pytest._code import Source
-import py
-import pytest
-from _pytest.main import Session, EXIT_OK
-from _pytest.assertion.rewrite import AssertionRewritingHook
-
-
-def pytest_addoption(parser):
-    # group = parser.getgroup("pytester", "pytester (self-tests) options")
-    parser.addoption('--lsof',
-                     action="store_true", dest="lsof", default=False,
-                     help=("run FD checks if lsof is available"))
-
-    parser.addoption('--runpytest', default="inprocess", dest="runpytest",
-                     choices=("inprocess", "subprocess", ),
-                     help=("run pytest sub runs in tests using an 'inprocess' "
-                           "or 'subprocess' (python -m main) method"))
-
-
-def pytest_configure(config):
-    # This might be called multiple times. Only take the first.
-    global _pytest_fullpath
-    try:
-        _pytest_fullpath
-    except NameError:
-        _pytest_fullpath = os.path.abspath(pytest.__file__.rstrip("oc"))
-        _pytest_fullpath = _pytest_fullpath.replace("$py.class", ".py")
-
-    if config.getvalue("lsof"):
-        checker = LsofFdLeakChecker()
-        if checker.matching_platform():
-            config.pluginmanager.register(checker)
-
-
-class LsofFdLeakChecker(object):
-    def get_open_files(self):
-        out = self._exec_lsof()
-        open_files = self._parse_lsof_output(out)
-        return open_files
-
-    def _exec_lsof(self):
-        pid = os.getpid()
-        return py.process.cmdexec("lsof -Ffn0 -p %d" % pid)
-
-    def _parse_lsof_output(self, out):
-        def isopen(line):
-            return line.startswith('f') and ("deleted" not in line and
-                                             'mem' not in line and "txt" not in line and 'cwd' not in line)
-
-        open_files = []
-
-        for line in out.split("\n"):
-            if isopen(line):
-                fields = line.split('\0')
-                fd = fields[0][1:]
-                filename = fields[1][1:]
-                if filename.startswith('/'):
-                    open_files.append((fd, filename))
-
-        return open_files
-
-    def matching_platform(self):
-        try:
-            py.process.cmdexec("lsof -v")
-        except (py.process.cmdexec.Error, UnicodeDecodeError):
-            # cmdexec may raise UnicodeDecodeError on Windows systems
-            # with locale other than english:
-            # https://bitbucket.org/pytest-dev/py/issues/66
-            return False
-        else:
-            return True
-
-    @pytest.hookimpl(hookwrapper=True, tryfirst=True)
-    def pytest_runtest_protocol(self, item):
-        lines1 = self.get_open_files()
-        yield
-        if hasattr(sys, "pypy_version_info"):
-            gc.collect()
-        lines2 = self.get_open_files()
-
-        new_fds = set([t[0] for t in lines2]) - set([t[0] for t in lines1])
-        leaked_files = [t for t in lines2 if t[0] in new_fds]
-        if leaked_files:
-            error = []
-            error.append("***** %s FD leakage detected" % len(leaked_files))
-            error.extend([str(f) for f in leaked_files])
-            error.append("*** Before:")
-            error.extend([str(f) for f in lines1])
-            error.append("*** After:")
-            error.extend([str(f) for f in lines2])
-            error.append(error[0])
-            error.append("*** function %s:%s: %s " % item.location)
-            error.append("See issue #2366")
-            item.warn('', "\n".join(error))
-
-
-# XXX copied from execnet's conftest.py - needs to be merged
-winpymap = {
-    'python2.7': r'C:\Python27\python.exe',
-    'python2.6': r'C:\Python26\python.exe',
-    'python3.1': r'C:\Python31\python.exe',
-    'python3.2': r'C:\Python32\python.exe',
-    'python3.3': r'C:\Python33\python.exe',
-    'python3.4': r'C:\Python34\python.exe',
-    'python3.5': r'C:\Python35\python.exe',
-}
-
-
-def getexecutable(name, cache={}):
-    try:
-        return cache[name]
-    except KeyError:
-        executable = py.path.local.sysfind(name)
-        if executable:
-            import subprocess
-            popen = subprocess.Popen([str(executable), "--version"],
-                                     universal_newlines=True, stderr=subprocess.PIPE)
-            out, err = popen.communicate()
-            if name == "jython":
-                if not err or "2.5" not in err:
-                    executable = None
-                if "2.5.2" in err:
-                    executable = None  # http://bugs.jython.org/issue1790
-            elif popen.returncode != 0:
-                # Handle pyenv's 127.
-                executable = None
-        cache[name] = executable
-        return executable
-
-
-@pytest.fixture(params=['python2.6', 'python2.7', 'python3.3', "python3.4",
-                        'pypy', 'pypy3'])
-def anypython(request):
-    name = request.param
-    executable = getexecutable(name)
-    if executable is None:
-        if sys.platform == "win32":
-            executable = winpymap.get(name, None)
-            if executable:
-                executable = py.path.local(executable)
-                if executable.check():
-                    return executable
-        pytest.skip("no suitable %s found" % (name,))
-    return executable
-
-# used at least by pytest-xdist plugin
-
-
-@pytest.fixture
-def _pytest(request):
-    """ Return a helper which offers a gethookrecorder(hook)
-    method which returns a HookRecorder instance which helps
-    to make assertions about called hooks.
-    """
-    return PytestArg(request)
-
-
-class PytestArg:
-    def __init__(self, request):
-        self.request = request
-
-    def gethookrecorder(self, hook):
-        hookrecorder = HookRecorder(hook._pm)
-        self.request.addfinalizer(hookrecorder.finish_recording)
-        return hookrecorder
-
-
-def get_public_names(values):
-    """Only return names from iterator values without a leading underscore."""
-    return [x for x in values if x[0] != "_"]
-
-
-class ParsedCall:
-    def __init__(self, name, kwargs):
-        self.__dict__.update(kwargs)
-        self._name = name
-
-    def __repr__(self):
-        d = self.__dict__.copy()
-        del d['_name']
-        return "<ParsedCall %r(**%r)>" % (self._name, d)
-
-
-class HookRecorder:
-    """Record all hooks called in a plugin manager.
-
-    This wraps all the hook calls in the plugin manager, recording
-    each call before propagating the normal calls.
-
-    """
-
-    def __init__(self, pluginmanager):
-        self._pluginmanager = pluginmanager
-        self.calls = []
-
-        def before(hook_name, hook_impls, kwargs):
-            self.calls.append(ParsedCall(hook_name, kwargs))
-
-        def after(outcome, hook_name, hook_impls, kwargs):
-            pass
-
-        self._undo_wrapping = pluginmanager.add_hookcall_monitoring(before, after)
-
-    def finish_recording(self):
-        self._undo_wrapping()
-
-    def getcalls(self, names):
-        if isinstance(names, str):
-            names = names.split()
-        return [call for call in self.calls if call._name in names]
-
-    def assert_contains(self, entries):
-        __tracebackhide__ = True
-        i = 0
-        entries = list(entries)
-        backlocals = sys._getframe(1).f_locals
-        while entries:
-            name, check = entries.pop(0)
-            for ind, call in enumerate(self.calls[i:]):
-                if call._name == name:
-                    print("NAMEMATCH", name, call)
-                    if eval(check, backlocals, call.__dict__):
-                        print("CHECKERMATCH", repr(check), "->", call)
-                    else:
-                        print("NOCHECKERMATCH", repr(check), "-", call)
-                        continue
-                    i += ind + 1
-                    break
-                print("NONAMEMATCH", name, "with", call)
-            else:
-                pytest.fail("could not find %r check %r" % (name, check))
-
-    def popcall(self, name):
-        __tracebackhide__ = True
-        for i, call in enumerate(self.calls):
-            if call._name == name:
-                del self.calls[i]
-                return call
-        lines = ["could not find call %r, in:" % (name,)]
-        lines.extend(["  %s" % str(x) for x in self.calls])
-        pytest.fail("\n".join(lines))
-
-    def getcall(self, name):
-        values = self.getcalls(name)
-        assert len(values) == 1, (name, values)
-        return values[0]
-
-    # functionality for test reports
-
-    def getreports(self,
-                   names="pytest_runtest_logreport pytest_collectreport"):
-        return [x.report for x in self.getcalls(names)]
-
-    def matchreport(self, inamepart="",
-                    names="pytest_runtest_logreport pytest_collectreport", when=None):
-        """ return a testreport whose dotted import path matches """
-        values = []
-        for rep in self.getreports(names=names):
-            try:
-                if not when and rep.when != "call" and rep.passed:
-                    # setup/teardown passing reports - let's ignore those
-                    continue
-            except AttributeError:
-                pass
-            if when and getattr(rep, 'when', None) != when:
-                continue
-            if not inamepart or inamepart in rep.nodeid.split("::"):
-                values.append(rep)
-        if not values:
-            raise ValueError("could not find test report matching %r: "
-                             "no test reports at all!" % (inamepart,))
-        if len(values) > 1:
-            raise ValueError(
-                "found 2 or more testreports matching %r: %s" % (inamepart, values))
-        return values[0]
-
-    def getfailures(self,
-                    names='pytest_runtest_logreport pytest_collectreport'):
-        return [rep for rep in self.getreports(names) if rep.failed]
-
-    def getfailedcollections(self):
-        return self.getfailures('pytest_collectreport')
-
-    def listoutcomes(self):
-        passed = []
-        skipped = []
-        failed = []
-        for rep in self.getreports(
-                "pytest_collectreport pytest_runtest_logreport"):
-            if rep.passed:
-                if getattr(rep, "when", None) == "call":
-                    passed.append(rep)
-            elif rep.skipped:
-                skipped.append(rep)
-            elif rep.failed:
-                failed.append(rep)
-        return passed, skipped, failed
-
-    def countoutcomes(self):
-        return [len(x) for x in self.listoutcomes()]
-
-    def assertoutcome(self, passed=0, skipped=0, failed=0):
-        realpassed, realskipped, realfailed = self.listoutcomes()
-        assert passed == len(realpassed)
-        assert skipped == len(realskipped)
-        assert failed == len(realfailed)
-
-    def clear(self):
-        self.calls[:] = []
-
-
-@pytest.fixture
-def linecomp(request):
-    return LineComp()
-
-
-@pytest.fixture(name='LineMatcher')
-def LineMatcher_fixture(request):
-    return LineMatcher
-
-
-@pytest.fixture
-def testdir(request, tmpdir_factory):
-    return Testdir(request, tmpdir_factory)
-
-
-rex_outcome = re.compile(r"(\d+) ([\w-]+)")
-
-
-class RunResult:
-    """The result of running a command.
-
-    Attributes:
-
-    :ret: The return value.
-    :outlines: List of lines captured from stdout.
-    :errlines: List of lines captures from stderr.
-    :stdout: :py:class:`LineMatcher` of stdout, use ``stdout.str()`` to
-       reconstruct stdout or the commonly used
-       ``stdout.fnmatch_lines()`` method.
-    :stderrr: :py:class:`LineMatcher` of stderr.
-    :duration: Duration in seconds.
-
-    """
-
-    def __init__(self, ret, outlines, errlines, duration):
-        self.ret = ret
-        self.outlines = outlines
-        self.errlines = errlines
-        self.stdout = LineMatcher(outlines)
-        self.stderr = LineMatcher(errlines)
-        self.duration = duration
-
-    def parseoutcomes(self):
-        """ Return a dictionary of outcomestring->num from parsing
-        the terminal output that the test process produced."""
-        for line in reversed(self.outlines):
-            if 'seconds' in line:
-                outcomes = rex_outcome.findall(line)
-                if outcomes:
-                    d = {}
-                    for num, cat in outcomes:
-                        d[cat] = int(num)
-                    return d
-        raise ValueError("Pytest terminal report not found")
-
-    def assert_outcomes(self, passed=0, skipped=0, failed=0, error=0):
-        """ assert that the specified outcomes appear with the respective
-        numbers (0 means it didn't occur) in the text output from a test run."""
-        d = self.parseoutcomes()
-        obtained = {
-            'passed': d.get('passed', 0),
-            'skipped': d.get('skipped', 0),
-            'failed': d.get('failed', 0),
-            'error': d.get('error', 0),
-        }
-        assert obtained == dict(passed=passed, skipped=skipped, failed=failed, error=error)
-
-
-class Testdir:
-    """Temporary test directory with tools to test/run pytest itself.
-
-    This is based on the ``tmpdir`` fixture but provides a number of
-    methods which aid with testing pytest itself.  Unless
-    :py:meth:`chdir` is used all methods will use :py:attr:`tmpdir` as
-    current working directory.
-
-    Attributes:
-
-    :tmpdir: The :py:class:`py.path.local` instance of the temporary
-       directory.
-
-    :plugins: A list of plugins to use with :py:meth:`parseconfig` and
-       :py:meth:`runpytest`.  Initially this is an empty list but
-       plugins can be added to the list.  The type of items to add to
-       the list depend on the method which uses them so refer to them
-       for details.
-
-    """
-
-    def __init__(self, request, tmpdir_factory):
-        self.request = request
-        self._mod_collections = WeakKeyDictionary()
-        # XXX remove duplication with tmpdir plugin
-        basetmp = tmpdir_factory.ensuretemp("testdir")
-        name = request.function.__name__
-        for i in range(100):
-            try:
-                tmpdir = basetmp.mkdir(name + str(i))
-            except py.error.EEXIST:
-                continue
-            break
-        self.tmpdir = tmpdir
-        self.plugins = []
-        self._savesyspath = (list(sys.path), list(sys.meta_path))
-        self._savemodulekeys = set(sys.modules)
-        self.chdir()  # always chdir
-        self.request.addfinalizer(self.finalize)
-        method = self.request.config.getoption("--runpytest")
-        if method == "inprocess":
-            self._runpytest_method = self.runpytest_inprocess
-        elif method == "subprocess":
-            self._runpytest_method = self.runpytest_subprocess
-
-    def __repr__(self):
-        return "<Testdir %r>" % (self.tmpdir,)
-
-    def finalize(self):
-        """Clean up global state artifacts.
-
-        Some methods modify the global interpreter state and this
-        tries to clean this up.  It does not remove the temporary
-        directory however so it can be looked at after the test run
-        has finished.
-
-        """
-        sys.path[:], sys.meta_path[:] = self._savesyspath
-        if hasattr(self, '_olddir'):
-            self._olddir.chdir()
-        self.delete_loaded_modules()
-
-    def delete_loaded_modules(self):
-        """Delete modules that have been loaded during a test.
-
-        This allows the interpreter to catch module changes in case
-        the module is re-imported.
-        """
-        for name in set(sys.modules).difference(self._savemodulekeys):
-            # some zope modules used by twisted-related tests keeps internal
-            # state and can't be deleted; we had some trouble in the past
-            # with zope.interface for example
-            if not name.startswith("zope"):
-                del sys.modules[name]
-
-    def make_hook_recorder(self, pluginmanager):
-        """Create a new :py:class:`HookRecorder` for a PluginManager."""
-        assert not hasattr(pluginmanager, "reprec")
-        pluginmanager.reprec = reprec = HookRecorder(pluginmanager)
-        self.request.addfinalizer(reprec.finish_recording)
-        return reprec
-
-    def chdir(self):
-        """Cd into the temporary directory.
-
-        This is done automatically upon instantiation.
-
-        """
-        old = self.tmpdir.chdir()
-        if not hasattr(self, '_olddir'):
-            self._olddir = old
-
-    def _makefile(self, ext, args, kwargs, encoding="utf-8"):
-        items = list(kwargs.items())
-        if args:
-            source = py.builtin._totext("\n").join(
-                map(py.builtin._totext, args)) + py.builtin._totext("\n")
-            basename = self.request.function.__name__
-            items.insert(0, (basename, source))
-        ret = None
-        for name, value in items:
-            p = self.tmpdir.join(name).new(ext=ext)
-            p.dirpath().ensure_dir()
-            source = Source(value)
-
-            def my_totext(s, encoding="utf-8"):
-                if py.builtin._isbytes(s):
-                    s = py.builtin._totext(s, encoding=encoding)
-                return s
-
-            source_unicode = "\n".join([my_totext(line) for line in source.lines])
-            source = py.builtin._totext(source_unicode)
-            content = source.strip().encode(encoding)  # + "\n"
-            # content = content.rstrip() + "\n"
-            p.write(content, "wb")
-            if ret is None:
-                ret = p
-        return ret
-
-    def makefile(self, ext, *args, **kwargs):
-        """Create a new file in the testdir.
-
-        ext: The extension the file should use, including the dot.
-           E.g. ".py".
-
-        args: All args will be treated as strings and joined using
-           newlines.  The result will be written as contents to the
-           file.  The name of the file will be based on the test
-           function requesting this fixture.
-           E.g. "testdir.makefile('.txt', 'line1', 'line2')"
-
-        kwargs: Each keyword is the name of a file, while the value of
-           it will be written as contents of the file.
-           E.g. "testdir.makefile('.ini', pytest='[pytest]\naddopts=-rs\n')"
-
-        """
-        return self._makefile(ext, args, kwargs)
-
-    def makeconftest(self, source):
-        """Write a contest.py file with 'source' as contents."""
-        return self.makepyfile(conftest=source)
-
-    def makeini(self, source):
-        """Write a tox.ini file with 'source' as contents."""
-        return self.makefile('.ini', tox=source)
-
-    def getinicfg(self, source):
-        """Return the pytest section from the tox.ini config file."""
-        p = self.makeini(source)
-        return py.iniconfig.IniConfig(p)['pytest']
-
-    def makepyfile(self, *args, **kwargs):
-        """Shortcut for .makefile() with a .py extension."""
-        return self._makefile('.py', args, kwargs)
-
-    def maketxtfile(self, *args, **kwargs):
-        """Shortcut for .makefile() with a .txt extension."""
-        return self._makefile('.txt', args, kwargs)
-
-    def syspathinsert(self, path=None):
-        """Prepend a directory to sys.path, defaults to :py:attr:`tmpdir`.
-
-        This is undone automatically after the test.
-        """
-        if path is None:
-            path = self.tmpdir
-        sys.path.insert(0, str(path))
-        # a call to syspathinsert() usually means that the caller
-        # wants to import some dynamically created files.
-        # with python3 we thus invalidate import caches.
-        self._possibly_invalidate_import_caches()
-
-    def _possibly_invalidate_import_caches(self):
-        # invalidate caches if we can (py33 and above)
-        try:
-            import importlib
-        except ImportError:
-            pass
-        else:
-            if hasattr(importlib, "invalidate_caches"):
-                importlib.invalidate_caches()
-
-    def mkdir(self, name):
-        """Create a new (sub)directory."""
-        return self.tmpdir.mkdir(name)
-
-    def mkpydir(self, name):
-        """Create a new python package.
-
-        This creates a (sub)directory with an empty ``__init__.py``
-        file so that is recognised as a python package.
-
-        """
-        p = self.mkdir(name)
-        p.ensure("__init__.py")
-        return p
-
-    Session = Session
-
-    def getnode(self, config, arg):
-        """Return the collection node of a file.
-
-        :param config: :py:class:`_pytest.config.Config` instance, see
-           :py:meth:`parseconfig` and :py:meth:`parseconfigure` to
-           create the configuration.
-
-        :param arg: A :py:class:`py.path.local` instance of the file.
-
-        """
-        session = Session(config)
-        assert '::' not in str(arg)
-        p = py.path.local(arg)
-        config.hook.pytest_sessionstart(session=session)
-        res = session.perform_collect([str(p)], genitems=False)[0]
-        config.hook.pytest_sessionfinish(session=session, exitstatus=EXIT_OK)
-        return res
-
-    def getpathnode(self, path):
-        """Return the collection node of a file.
-
-        This is like :py:meth:`getnode` but uses
-        :py:meth:`parseconfigure` to create the (configured) pytest
-        Config instance.
-
-        :param path: A :py:class:`py.path.local` instance of the file.
-
-        """
-        config = self.parseconfigure(path)
-        session = Session(config)
-        x = session.fspath.bestrelpath(path)
-        config.hook.pytest_sessionstart(session=session)
-        res = session.perform_collect([x], genitems=False)[0]
-        config.hook.pytest_sessionfinish(session=session, exitstatus=EXIT_OK)
-        return res
-
-    def genitems(self, colitems):
-        """Generate all test items from a collection node.
-
-        This recurses into the collection node and returns a list of
-        all the test items contained within.
-
-        """
-        session = colitems[0].session
-        result = []
-        for colitem in colitems:
-            result.extend(session.genitems(colitem))
-        return result
-
-    def runitem(self, source):
-        """Run the "test_func" Item.
-
-        The calling test instance (the class which contains the test
-        method) must provide a ``.getrunner()`` method which should
-        return a runner which can run the test protocol for a single
-        item, like e.g. :py:func:`_pytest.runner.runtestprotocol`.
-
-        """
-        # used from runner functional tests
-        item = self.getitem(source)
-        # the test class where we are called from wants to provide the runner
-        testclassinstance = self.request.instance
-        runner = testclassinstance.getrunner()
-        return runner(item)
-
-    def inline_runsource(self, source, *cmdlineargs):
-        """Run a test module in process using ``pytest.main()``.
-
-        This run writes "source" into a temporary file and runs
-        ``pytest.main()`` on it, returning a :py:class:`HookRecorder`
-        instance for the result.
-
-        :param source: The source code of the test module.
-
-        :param cmdlineargs: Any extra command line arguments to use.
-
-        :return: :py:class:`HookRecorder` instance of the result.
-
-        """
-        p = self.makepyfile(source)
-        values = list(cmdlineargs) + [p]
-        return self.inline_run(*values)
-
-    def inline_genitems(self, *args):
-        """Run ``pytest.main(['--collectonly'])`` in-process.
-
-        Returns a tuple of the collected items and a
-        :py:class:`HookRecorder` instance.
-
-        This runs the :py:func:`pytest.main` function to run all of
-        pytest inside the test process itself like
-        :py:meth:`inline_run`.  However the return value is a tuple of
-        the collection items and a :py:class:`HookRecorder` instance.
-
-        """
-        rec = self.inline_run("--collect-only", *args)
-        items = [x.item for x in rec.getcalls("pytest_itemcollected")]
-        return items, rec
-
-    def inline_run(self, *args, **kwargs):
-        """Run ``pytest.main()`` in-process, returning a HookRecorder.
-
-        This runs the :py:func:`pytest.main` function to run all of
-        pytest inside the test process itself.  This means it can
-        return a :py:class:`HookRecorder` instance which gives more
-        detailed results from then run then can be done by matching
-        stdout/stderr from :py:meth:`runpytest`.
-
-        :param args: Any command line arguments to pass to
-           :py:func:`pytest.main`.
-
-        :param plugin: (keyword-only) Extra plugin instances the
-           ``pytest.main()`` instance should use.
-
-        :return: A :py:class:`HookRecorder` instance.
-        """
-        # When running py.test inline any plugins active in the main
-        # test process are already imported.  So this disables the
-        # warning which will trigger to say they can no longer be
-        # re-written, which is fine as they are already re-written.
-        orig_warn = AssertionRewritingHook._warn_already_imported
-
-        def revert():
-            AssertionRewritingHook._warn_already_imported = orig_warn
-
-        self.request.addfinalizer(revert)
-        AssertionRewritingHook._warn_already_imported = lambda *a: None
-
-        rec = []
-
-        class Collect:
-            def pytest_configure(x, config):
-                rec.append(self.make_hook_recorder(config.pluginmanager))
-
-        plugins = kwargs.get("plugins") or []
-        plugins.append(Collect())
-        ret = pytest.main(list(args), plugins=plugins)
-        self.delete_loaded_modules()
-        if len(rec) == 1:
-            reprec = rec.pop()
-        else:
-            class reprec:
-                pass
-        reprec.ret = ret
-
-        # typically we reraise keyboard interrupts from the child run
-        # because it's our user requesting interruption of the testing
-        if ret == 2 and not kwargs.get("no_reraise_ctrlc"):
-            calls = reprec.getcalls("pytest_keyboard_interrupt")
-            if calls and calls[-1].excinfo.type == KeyboardInterrupt:
-                raise KeyboardInterrupt()
-        return reprec
-
-    def runpytest_inprocess(self, *args, **kwargs):
-        """ Return result of running pytest in-process, providing a similar
-        interface to what self.runpytest() provides. """
-        if kwargs.get("syspathinsert"):
-            self.syspathinsert()
-        now = time.time()
-        capture = MultiCapture(Capture=SysCapture)
-        capture.start_capturing()
-        try:
-            try:
-                reprec = self.inline_run(*args, **kwargs)
-            except SystemExit as e:
-
-                class reprec:
-                    ret = e.args[0]
-
-            except Exception:
-                traceback.print_exc()
-
-                class reprec:
-                    ret = 3
-        finally:
-            out, err = capture.readouterr()
-            capture.stop_capturing()
-            sys.stdout.write(out)
-            sys.stderr.write(err)
-
-        res = RunResult(reprec.ret,
-                        out.split("\n"), err.split("\n"),
-                        time.time() - now)
-        res.reprec = reprec
-        return res
-
-    def runpytest(self, *args, **kwargs):
-        """ Run pytest inline or in a subprocess, depending on the command line
-        option "--runpytest" and return a :py:class:`RunResult`.
-
-        """
-        args = self._ensure_basetemp(args)
-        return self._runpytest_method(*args, **kwargs)
-
-    def _ensure_basetemp(self, args):
-        args = [str(x) for x in args]
-        for x in args:
-            if str(x).startswith('--basetemp'):
-                # print("basedtemp exists: %s" %(args,))
-                break
-        else:
-            args.append("--basetemp=%s" % self.tmpdir.dirpath('basetemp'))
-            # print("added basetemp: %s" %(args,))
-        return args
-
-    def parseconfig(self, *args):
-        """Return a new pytest Config instance from given commandline args.
-
-        This invokes the pytest bootstrapping code in _pytest.config
-        to create a new :py:class:`_pytest.core.PluginManager` and
-        call the pytest_cmdline_parse hook to create new
-        :py:class:`_pytest.config.Config` instance.
-
-        If :py:attr:`plugins` has been populated they should be plugin
-        modules which will be registered with the PluginManager.
-
-        """
-        args = self._ensure_basetemp(args)
-
-        import _pytest.config
-        config = _pytest.config._prepareconfig(args, self.plugins)
-        # we don't know what the test will do with this half-setup config
-        # object and thus we make sure it gets unconfigured properly in any
-        # case (otherwise capturing could still be active, for example)
-        self.request.addfinalizer(config._ensure_unconfigure)
-        return config
-
-    def parseconfigure(self, *args):
-        """Return a new pytest configured Config instance.
-
-        This returns a new :py:class:`_pytest.config.Config` instance
-        like :py:meth:`parseconfig`, but also calls the
-        pytest_configure hook.
-
-        """
-        config = self.parseconfig(*args)
-        config._do_configure()
-        self.request.addfinalizer(config._ensure_unconfigure)
-        return config
-
-    def getitem(self, source, funcname="test_func"):
-        """Return the test item for a test function.
-
-        This writes the source to a python file and runs pytest's
-        collection on the resulting module, returning the test item
-        for the requested function name.
-
-        :param source: The module source.
-
-        :param funcname: The name of the test function for which the
-           Item must be returned.
-
-        """
-        items = self.getitems(source)
-        for item in items:
-            if item.name == funcname:
-                return item
-        assert 0, "%r item not found in module:\n%s\nitems: %s" % (
-                  funcname, source, items)
-
-    def getitems(self, source):
-        """Return all test items collected from the module.
-
-        This writes the source to a python file and runs pytest's
-        collection on the resulting module, returning all test items
-        contained within.
-
-        """
-        modcol = self.getmodulecol(source)
-        return self.genitems([modcol])
-
-    def getmodulecol(self, source, configargs=(), withinit=False):
-        """Return the module collection node for ``source``.
-
-        This writes ``source`` to a file using :py:meth:`makepyfile`
-        and then runs the pytest collection on it, returning the
-        collection node for the test module.
-
-        :param source: The source code of the module to collect.
-
-        :param configargs: Any extra arguments to pass to
-           :py:meth:`parseconfigure`.
-
-        :param withinit: Whether to also write a ``__init__.py`` file
-           to the temporary directory to ensure it is a package.
-
-        """
-        kw = {self.request.function.__name__: Source(source).strip()}
-        path = self.makepyfile(**kw)
-        if withinit:
-            self.makepyfile(__init__="#")
-        self.config = config = self.parseconfigure(path, *configargs)
-        node = self.getnode(config, path)
-
-        return node
-
-    def collect_by_name(self, modcol, name):
-        """Return the collection node for name from the module collection.
-
-        This will search a module collection node for a collection
-        node matching the given name.
-
-        :param modcol: A module collection node, see
-           :py:meth:`getmodulecol`.
-
-        :param name: The name of the node to return.
-
-        """
-        if modcol not in self._mod_collections:
-            self._mod_collections[modcol] = list(modcol.collect())
-        for colitem in self._mod_collections[modcol]:
-            if colitem.name == name:
-                return colitem
-
-    def popen(self, cmdargs, stdout, stderr, **kw):
-        """Invoke subprocess.Popen.
-
-        This calls subprocess.Popen making sure the current working
-        directory is the PYTHONPATH.
-
-        You probably want to use :py:meth:`run` instead.
-
-        """
-        env = os.environ.copy()
-        env['PYTHONPATH'] = os.pathsep.join(filter(None, [
-            str(os.getcwd()), env.get('PYTHONPATH', '')]))
-        kw['env'] = env
-
-        popen = subprocess.Popen(cmdargs, stdin=subprocess.PIPE, stdout=stdout, stderr=stderr, **kw)
-        popen.stdin.close()
-
-        return popen
-
-    def run(self, *cmdargs):
-        """Run a command with arguments.
-
-        Run a process using subprocess.Popen saving the stdout and
-        stderr.
-
-        Returns a :py:class:`RunResult`.
-
-        """
-        return self._run(*cmdargs)
-
-    def _run(self, *cmdargs):
-        cmdargs = [str(x) for x in cmdargs]
-        p1 = self.tmpdir.join("stdout")
-        p2 = self.tmpdir.join("stderr")
-        print("running:", ' '.join(cmdargs))
-        print("     in:", str(py.path.local()))
-        f1 = codecs.open(str(p1), "w", encoding="utf8")
-        f2 = codecs.open(str(p2), "w", encoding="utf8")
-        try:
-            now = time.time()
-            popen = self.popen(cmdargs, stdout=f1, stderr=f2,
-                               close_fds=(sys.platform != "win32"))
-            ret = popen.wait()
-        finally:
-            f1.close()
-            f2.close()
-        f1 = codecs.open(str(p1), "r", encoding="utf8")
-        f2 = codecs.open(str(p2), "r", encoding="utf8")
-        try:
-            out = f1.read().splitlines()
-            err = f2.read().splitlines()
-        finally:
-            f1.close()
-            f2.close()
-        self._dump_lines(out, sys.stdout)
-        self._dump_lines(err, sys.stderr)
-        return RunResult(ret, out, err, time.time() - now)
-
-    def _dump_lines(self, lines, fp):
-        try:
-            for line in lines:
-                print(line, file=fp)
-        except UnicodeEncodeError:
-            print("couldn't print to %s because of encoding" % (fp,))
-
-    def _getpytestargs(self):
-        # we cannot use "(sys.executable,script)"
-        # because on windows the script is e.g. a pytest.exe
-        return (sys.executable, _pytest_fullpath,)  # noqa
-
-    def runpython(self, script):
-        """Run a python script using sys.executable as interpreter.
-
-        Returns a :py:class:`RunResult`.
-        """
-        return self.run(sys.executable, script)
-
-    def runpython_c(self, command):
-        """Run python -c "command", return a :py:class:`RunResult`."""
-        return self.run(sys.executable, "-c", command)
-
-    def runpytest_subprocess(self, *args, **kwargs):
-        """Run pytest as a subprocess with given arguments.
-
-        Any plugins added to the :py:attr:`plugins` list will added
-        using the ``-p`` command line option.  Addtionally
-        ``--basetemp`` is used put any temporary files and directories
-        in a numbered directory prefixed with "runpytest-" so they do
-        not conflict with the normal numberd pytest location for
-        temporary files and directories.
-
-        Returns a :py:class:`RunResult`.
-
-        """
-        p = py.path.local.make_numbered_dir(prefix="runpytest-",
-                                            keep=None, rootdir=self.tmpdir)
-        args = ('--basetemp=%s' % p, ) + args
-        # for x in args:
-        #    if '--confcutdir' in str(x):
-        #        break
-        # else:
-        #    pass
-        #    args = ('--confcutdir=.',) + args
-        plugins = [x for x in self.plugins if isinstance(x, str)]
-        if plugins:
-            args = ('-p', plugins[0]) + args
-        args = self._getpytestargs() + args
-        return self.run(*args)
-
-    def spawn_pytest(self, string, expect_timeout=10.0):
-        """Run pytest using pexpect.
-
-        This makes sure to use the right pytest and sets up the
-        temporary directory locations.
-
-        The pexpect child is returned.
-
-        """
-        basetemp = self.tmpdir.mkdir("temp-pexpect")
-        invoke = " ".join(map(str, self._getpytestargs()))
-        cmd = "%s --basetemp=%s %s" % (invoke, basetemp, string)
-        return self.spawn(cmd, expect_timeout=expect_timeout)
-
-    def spawn(self, cmd, expect_timeout=10.0):
-        """Run a command using pexpect.
-
-        The pexpect child is returned.
-        """
-        pexpect = pytest.importorskip("pexpect", "3.0")
-        if hasattr(sys, 'pypy_version_info') and '64' in platform.machine():
-            pytest.skip("pypy-64 bit not supported")
-        if sys.platform.startswith("freebsd"):
-            pytest.xfail("pexpect does not work reliably on freebsd")
-        logfile = self.tmpdir.join("spawn.out").open("wb")
-        child = pexpect.spawn(cmd, logfile=logfile)
-        self.request.addfinalizer(logfile.close)
-        child.timeout = expect_timeout
-        return child
-
-
-def getdecoded(out):
-    try:
-        return out.decode("utf-8")
-    except UnicodeDecodeError:
-        return "INTERNAL not-utf8-decodeable, truncated string:\n%s" % (
-            py.io.saferepr(out),)
-
-
-class LineComp:
-    def __init__(self):
-        self.stringio = py.io.TextIO()
-
-    def assert_contains_lines(self, lines2):
-        """ assert that lines2 are contained (linearly) in lines1.
-            return a list of extralines found.
-        """
-        __tracebackhide__ = True
-        val = self.stringio.getvalue()
-        self.stringio.truncate(0)
-        self.stringio.seek(0)
-        lines1 = val.split("\n")
-        return LineMatcher(lines1).fnmatch_lines(lines2)
-
-
-class LineMatcher:
-    """Flexible matching of text.
-
-    This is a convenience class to test large texts like the output of
-    commands.
-
-    The constructor takes a list of lines without their trailing
-    newlines, i.e. ``text.splitlines()``.
-
-    """
-
-    def __init__(self, lines):
-        self.lines = lines
-        self._log_output = []
-
-    def str(self):
-        """Return the entire original text."""
-        return "\n".join(self.lines)
-
-    def _getlines(self, lines2):
-        if isinstance(lines2, str):
-            lines2 = Source(lines2)
-        if isinstance(lines2, Source):
-            lines2 = lines2.strip().lines
-        return lines2
-
-    def fnmatch_lines_random(self, lines2):
-        """Check lines exist in the output.
-
-        The argument is a list of lines which have to occur in the
-        output, in any order.  Each line can contain glob whildcards.
-
-        """
-        lines2 = self._getlines(lines2)
-        for line in lines2:
-            for x in self.lines:
-                if line == x or fnmatch(x, line):
-                    self._log("matched: ", repr(line))
-                    break
-            else:
-                self._log("line %r not found in output" % line)
-                raise ValueError(self._log_text)
-
-    def get_lines_after(self, fnline):
-        """Return all lines following the given line in the text.
-
-        The given line can contain glob wildcards.
-        """
-        for i, line in enumerate(self.lines):
-            if fnline == line or fnmatch(line, fnline):
-                return self.lines[i + 1:]
-        raise ValueError("line %r not found in output" % fnline)
-
-    def _log(self, *args):
-        self._log_output.append(' '.join((str(x) for x in args)))
-
-    @property
-    def _log_text(self):
-        return '\n'.join(self._log_output)
-
-    def fnmatch_lines(self, lines2):
-        """Search the text for matching lines.
-
-        The argument is a list of lines which have to match and can
-        use glob wildcards.  If they do not match an pytest.fail() is
-        called.  The matches and non-matches are also printed on
-        stdout.
-
-        """
-        lines2 = self._getlines(lines2)
-        lines1 = self.lines[:]
-        nextline = None
-        extralines = []
-        __tracebackhide__ = True
-        for line in lines2:
-            nomatchprinted = False
-            while lines1:
-                nextline = lines1.pop(0)
-                if line == nextline:
-                    self._log("exact match:", repr(line))
-                    break
-                elif fnmatch(nextline, line):
-                    self._log("fnmatch:", repr(line))
-                    self._log("   with:", repr(nextline))
-                    break
-                else:
-                    if not nomatchprinted:
-                        self._log("nomatch:", repr(line))
-                        nomatchprinted = True
-                    self._log("    and:", repr(nextline))
-                extralines.append(nextline)
-            else:
-                self._log("remains unmatched: %r" % (line,))
-                pytest.fail(self._log_text)
deleted file mode 100644
--- a/third_party/python/pytest/_pytest/python.py
+++ /dev/null
@@ -1,1173 +0,0 @@
-""" Python test discovery, setup and run of test functions. """
-from __future__ import absolute_import, division, print_function
-
-import fnmatch
-import inspect
-import sys
-import os
-import collections
-from textwrap import dedent
-from itertools import count
-
-import py
-from _pytest.mark import MarkerError
-from _pytest.config import hookimpl
-
-import _pytest
-import _pytest._pluggy as pluggy
-from _pytest import fixtures
-from _pytest import main
-from _pytest.compat import (
-    isclass, isfunction, is_generator, _ascii_escaped,
-    REGEX_TYPE, STRING_TYPES, NoneType, NOTSET,
-    get_real_func, getfslineno, safe_getattr,
-    safe_str, getlocation, enum,
-)
-from _pytest.outcomes import fail
-from _pytest.mark import transfer_markers
-
-cutdir1 = py.path.local(pluggy.__file__.rstrip("oc"))
-cutdir2 = py.path.local(_pytest.__file__).dirpath()
-cutdir3 = py.path.local(py.__file__).dirpath()
-
-
-def filter_traceback(entry):
-    """Return True if a TracebackEntry instance should be removed from tracebacks:
-    * dynamically generated code (no code to show up for it);
-    * internal traceback from pytest or its internal libraries, py and pluggy.
-    """
-    # entry.path might sometimes return a str object when the entry
-    # points to dynamically generated code
-    # see https://bitbucket.org/pytest-dev/py/issues/71
-    raw_filename = entry.frame.code.raw.co_filename
-    is_generated = '<' in raw_filename and '>' in raw_filename
-    if is_generated:
-        return False
-    # entry.path might point to an inexisting file, in which case it will
-    # alsso return a str object. see #1133
-    p = py.path.local(entry.path)
-    return p != cutdir1 and not p.relto(cutdir2) and not p.relto(cutdir3)
-
-
-def pyobj_property(name):
-    def get(self):
-        node = self.getparent(getattr(__import__('pytest'), name))
-        if node is not None:
-            return node.obj
-    doc = "python %s object this node was collected from (can be None)." % (
-          name.lower(),)
-    return property(get, None, None, doc)
-
-
-def pytest_addoption(parser):
-    group = parser.getgroup("general")
-    group.addoption('--fixtures', '--funcargs',
-                    action="store_true", dest="showfixtures", default=False,
-                    help="show available fixtures, sorted by plugin appearance")
-    group.addoption(
-        '--fixtures-per-test',
-        action="store_true",
-        dest="show_fixtures_per_test",
-        default=False,
-        help="show fixtures per test",
-    )
-    parser.addini("usefixtures", type="args", default=[],
-                  help="list of default fixtures to be used with this project")
-    parser.addini("python_files", type="args",
-                  default=['test_*.py', '*_test.py'],
-                  help="glob-style file patterns for Python test module discovery")
-    parser.addini("python_classes", type="args", default=["Test", ],
-                  help="prefixes or glob names for Python test class discovery")
-    parser.addini("python_functions", type="args", default=["test", ],
-                  help="prefixes or glob names for Python test function and "
-                  "method discovery")
-
-    group.addoption("--import-mode", default="prepend",
-                    choices=["prepend", "append"], dest="importmode",
-                    help="prepend/append to sys.path when importing test modules, "
-                    "default is to prepend.")
-
-
-def pytest_cmdline_main(config):
-    if config.option.showfixtures:
-        showfixtures(config)
-        return 0
-    if config.option.show_fixtures_per_test:
-        show_fixtures_per_test(config)
-        return 0
-
-
-def pytest_generate_tests(metafunc):
-    # those alternative spellings are common - raise a specific error to alert
-    # the user
-    alt_spellings = ['parameterize', 'parametrise', 'parameterise']
-    for attr in alt_spellings:
-        if hasattr(metafunc.function, attr):
-            msg = "{0} has '{1}', spelling should be 'parametrize'"
-            raise MarkerError(msg.format(metafunc.function.__name__, attr))
-    try:
-        markers = metafunc.function.parametrize
-    except AttributeError:
-        return
-    for marker in markers:
-        metafunc.parametrize(*marker.args, **marker.kwargs)
-
-
-def pytest_configure(config):
-    config.addinivalue_line("markers",
-                            "parametrize(argnames, argvalues): call a test function multiple "
-                            "times passing in different arguments in turn. argvalues generally "
-                            "needs to be a list of values if argnames specifies only one name "
-                            "or a list of tuples of values if argnames specifies multiple names. "
-                            "Example: @parametrize('arg1', [1,2]) would lead to two calls of the "
-                            "decorated test function, one with arg1=1 and another with arg1=2."
-                            "see http://pytest.org/latest/parametrize.html for more info and "
-                            "examples."
-                            )
-    config.addinivalue_line("markers",
-                            "usefixtures(fixturename1, fixturename2, ...): mark tests as needing "
-                            "all of the specified fixtures. see http://pytest.org/latest/fixture.html#usefixtures "
-                            )
-
-
-@hookimpl(trylast=True)
-def pytest_pyfunc_call(pyfuncitem):
-    testfunction = pyfuncitem.obj
-    if pyfuncitem._isyieldedfunction():
-        testfunction(*pyfuncitem._args)
-    else:
-        funcargs = pyfuncitem.funcargs
-        testargs = {}
-        for arg in pyfuncitem._fixtureinfo.argnames:
-            testargs[arg] = funcargs[arg]
-        testfunction(**testargs)
-    return True
-
-
-def pytest_collect_file(path, parent):
-    ext = path.ext
-    if ext == ".py":
-        if not parent.session.isinitpath(path):
-            for pat in parent.config.getini('python_files'):
-                if path.fnmatch(pat):
-                    break
-            else:
-                return
-        ihook = parent.session.gethookproxy(path)
-        return ihook.pytest_pycollect_makemodule(path=path, parent=parent)
-
-
-def pytest_pycollect_makemodule(path, parent):
-    return Module(path, parent)
-
-
-@hookimpl(hookwrapper=True)
-def pytest_pycollect_makeitem(collector, name, obj):
-    outcome = yield
-    res = outcome.get_result()
-    if res is not None:
-        return
-    # nothing was collected elsewhere, let's do it here
-    if isclass(obj):
-        if collector.istestclass(obj, name):
-            Class = collector._getcustomclass("Class")
-            outcome.force_result(Class(name, parent=collector))
-    elif collector.istestfunction(obj, name):
-        # mock seems to store unbound methods (issue473), normalize it
-        obj = getattr(obj, "__func__", obj)
-        # We need to try and unwrap the function if it's a functools.partial
-        # or a funtools.wrapped.
-        # We musn't if it's been wrapped with mock.patch (python 2 only)
-        if not (isfunction(obj) or isfunction(get_real_func(obj))):
-            collector.warn(code="C2", message="cannot collect %r because it is not a function."
-                           % name, )
-        elif getattr(obj, "__test__", True):
-            if is_generator(obj):
-                res = Generator(name, parent=collector)
-            else:
-                res = list(collector._genfunctions(name, obj))
-            outcome.force_result(res)
-
-
-def pytest_make_parametrize_id(config, val, argname=None):
-    return None
-
-
-class PyobjContext(object):
-    module = pyobj_property("Module")
-    cls = pyobj_property("Class")
-    instance = pyobj_property("Instance")
-
-
-class PyobjMixin(PyobjContext):
-    def obj():
-        def fget(self):
-            obj = getattr(self, '_obj', None)
-            if obj is None:
-                self._obj = obj = self._getobj()
-            return obj
-
-        def fset(self, value):
-            self._obj = value
-
-        return property(fget, fset, None, "underlying python object")
-
-    obj = obj()
-
-    def _getobj(self):
-        return getattr(self.parent.obj, self.name)
-
-    def getmodpath(self, stopatmodule=True, includemodule=False):
-        """ return python path relative to the containing module. """
-        chain = self.listchain()
-        chain.reverse()
-        parts = []
-        for node in chain:
-            if isinstance(node, Instance):
-                continue
-            name = node.name
-            if isinstance(node, Module):
-                name = os.path.splitext(name)[0]
-                if stopatmodule:
-                    if includemodule:
-                        parts.append(name)
-                    break
-            parts.append(name)
-        parts.reverse()
-        s = ".".join(parts)
-        return s.replace(".[", "[")
-
-    def _getfslineno(self):
-        return getfslineno(self.obj)
-
-    def reportinfo(self):
-        # XXX caching?
-        obj = self.obj
-        compat_co_firstlineno = getattr(obj, 'compat_co_firstlineno', None)
-        if isinstance(compat_co_firstlineno, int):
-            # nose compatibility
-            fspath = sys.modules[obj.__module__].__file__
-            if fspath.endswith(".pyc"):
-                fspath = fspath[:-1]
-            lineno = compat_co_firstlineno
-        else:
-            fspath, lineno = getfslineno(obj)
-        modpath = self.getmodpath()
-        assert isinstance(lineno, int)
-        return fspath, lineno, modpath
-
-
-class PyCollector(PyobjMixin, main.Collector):
-
-    def funcnamefilter(self, name):
-        return self._matches_prefix_or_glob_option('python_functions', name)
-
-    def isnosetest(self, obj):
-        """ Look for the __test__ attribute, which is applied by the
-        @nose.tools.istest decorator
-        """
-        # We explicitly check for "is True" here to not mistakenly treat
-        # classes with a custom __getattr__ returning something truthy (like a
-        # function) as test classes.
-        return safe_getattr(obj, '__test__', False) is True
-
-    def classnamefilter(self, name):
-        return self._matches_prefix_or_glob_option('python_classes', name)
-
-    def istestfunction(self, obj, name):
-        if self.funcnamefilter(name) or self.isnosetest(obj):
-            if isinstance(obj, staticmethod):
-                # static methods need to be unwrapped
-                obj = safe_getattr(obj, '__func__', False)
-                if obj is False:
-                    # Python 2.6 wraps in a different way that we won't try to handle
-                    msg = "cannot collect static method %r because " \
-                          "it is not a function (always the case in Python 2.6)"
-                    self.warn(
-                        code="C2", message=msg % name)
-                    return False
-            return (
-                safe_getattr(obj, "__call__", False) and fixtures.getfixturemarker(obj) is None
-            )
-        else:
-            return False
-
-    def istestclass(self, obj, name):
-        return self.classnamefilter(name) or self.isnosetest(obj)
-
-    def _matches_prefix_or_glob_option(self, option_name, name):
-        """
-        checks if the given name matches the prefix or glob-pattern defined
-        in ini configuration.
-        """
-        for option in self.config.getini(option_name):
-            if name.startswith(option):
-                return True
-            # check that name looks like a glob-string before calling fnmatch
-            # because this is called for every name in each collected module,
-            # and fnmatch is somewhat expensive to call
-            elif ('*' in option or '?' in option or '[' in option) and \
-                    fnmatch.fnmatch(name, option):
-                return True
-        return False
-
-    def collect(self):
-        if not getattr(self.obj, "__test__", True):
-            return []
-
-        # NB. we avoid random getattrs and peek in the __dict__ instead
-        # (XXX originally introduced from a PyPy need, still true?)
-        dicts = [getattr(self.obj, '__dict__', {})]
-        for basecls in inspect.getmro(self.obj.__class__):
-            dicts.append(basecls.__dict__)
-        seen = {}
-        values = []
-        for dic in dicts:
-            for name, obj in list(dic.items()):
-                if name in seen:
-                    continue
-                seen[name] = True
-                res = self.makeitem(name, obj)
-                if res is None:
-                    continue
-                if not isinstance(res, list):
-                    res = [res]
-                values.extend(res)
-        values.sort(key=lambda item: item.reportinfo()[:2])
-        return values
-
-    def makeitem(self, name, obj):
-        # assert self.ihook.fspath == self.fspath, self
-        return self.ihook.pytest_pycollect_makeitem(
-            collector=self, name=name, obj=obj)
-
-    def _genfunctions(self, name, funcobj):
-        module = self.getparent(Module).obj
-        clscol = self.getparent(Class)
-        cls = clscol and clscol.obj or None
-        transfer_markers(funcobj, cls, module)
-        fm = self.session._fixturemanager
-        fixtureinfo = fm.getfixtureinfo(self, funcobj, cls)
-        metafunc = Metafunc(funcobj, fixtureinfo, self.config,
-                            cls=cls, module=module)
-        methods = []
-        if hasattr(module, "pytest_generate_tests"):
-            methods.append(module.pytest_generate_tests)
-        if hasattr(cls, "pytest_generate_tests"):
-            methods.append(cls().pytest_generate_tests)
-        if methods:
-            self.ihook.pytest_generate_tests.call_extra(methods,
-                                                        dict(metafunc=metafunc))
-        else:
-            self.ihook.pytest_generate_tests(metafunc=metafunc)
-
-        Function = self._getcustomclass("Function")
-        if not metafunc._calls:
-            yield Function(name, parent=self, fixtureinfo=fixtureinfo)
-        else:
-            # add funcargs() as fixturedefs to fixtureinfo.arg2fixturedefs
-            fixtures.add_funcarg_pseudo_fixture_def(self, metafunc, fm)
-
-            for callspec in metafunc._calls:
-                subname = "%s[%s]" % (name, callspec.id)
-                yield Function(name=subname, parent=self,
-                               callspec=callspec, callobj=funcobj,
-                               fixtureinfo=fixtureinfo,
-                               keywords={callspec.id: True},
-                               originalname=name,
-                               )
-
-
-class Module(main.File, PyCollector):
-    """ Collector for test classes and functions. """
-
-    def _getobj(self):
-        return self._importtestmodule()
-
-    def collect(self):
-        self.session._fixturemanager.parsefactories(self)
-        return super(Module, self).collect()
-
-    def _importtestmodule(self):
-        # we assume we are only called once per module
-        importmode = self.config.getoption("--import-mode")
-        try:
-            mod = self.fspath.pyimport(ensuresyspath=importmode)
-        except SyntaxError:
-            raise self.CollectError(
-                _pytest._code.ExceptionInfo().getrepr(style="short"))
-        except self.fspath.ImportMismatchError:
-            e = sys.exc_info()[1]
-            raise self.CollectError(
-                "import file mismatch:\n"
-                "imported module %r has this __file__ attribute:\n"
-                "  %s\n"
-                "which is not the same as the test file we want to collect:\n"
-                "  %s\n"
-                "HINT: remove __pycache__ / .pyc files and/or use a "
-                "unique basename for your test file modules"
-                % e.args
-            )
-        except ImportError:
-            from _pytest._code.code import ExceptionInfo
-            exc_info = ExceptionInfo()
-            if self.config.getoption('verbose') < 2:
-                exc_info.traceback = exc_info.traceback.filter(filter_traceback)
-            exc_repr = exc_info.getrepr(style='short') if exc_info.traceback else exc_info.exconly()
-            formatted_tb = safe_str(exc_repr)
-            raise self.CollectError(
-                "ImportError while importing test module '{fspath}'.\n"
-                "Hint: make sure your test modules/packages have valid Python names.\n"
-                "Traceback:\n"
-                "{traceback}".format(fspath=self.fspath, traceback=formatted_tb)
-            )
-        except _pytest.runner.Skipped as e:
-            if e.allow_module_level:
-                raise
-            raise self.CollectError(
-                "Using pytest.skip outside of a test is not allowed. "
-                "To decorate a test function, use the @pytest.mark.skip "
-                "or @pytest.mark.skipif decorators instead, and to skip a "
-                "module use `pytestmark = pytest.mark.{skip,skipif}."
-            )
-        self.config.pluginmanager.consider_module(mod)
-        return mod
-
-    def setup(self):
-        setup_module = _get_xunit_setup_teardown(self.obj, "setUpModule")
-        if setup_module is None:
-            setup_module = _get_xunit_setup_teardown(self.obj, "setup_module")
-        if setup_module is not None:
-            setup_module()
-
-        teardown_module = _get_xunit_setup_teardown(self.obj, 'tearDownModule')
-        if teardown_module is None:
-            teardown_module = _get_xunit_setup_teardown(self.obj, 'teardown_module')
-        if teardown_module is not None:
-            self.addfinalizer(teardown_module)
-
-
-def _get_xunit_setup_teardown(holder, attr_name, param_obj=None):
-    """
-    Return a callable to perform xunit-style setup or teardown if
-    the function exists in the ``holder`` object.
-    The ``param_obj`` parameter is the parameter which will be passed to the function
-    when the callable is called without arguments, defaults to the ``holder`` object.
-    Return ``None`` if a suitable callable is not found.
-    """
-    param_obj = param_obj if param_obj is not None else holder
-    result = _get_xunit_func(holder, attr_name)
-    if result is not None:
-        arg_count = result.__code__.co_argcount
-        if inspect.ismethod(result):
-            arg_count -= 1
-        if arg_count:
-            return lambda: result(param_obj)
-        else:
-            return result
-
-
-def _get_xunit_func(obj, name):
-    """Return the attribute from the given object to be used as a setup/teardown
-    xunit-style function, but only if not marked as a fixture to
-    avoid calling it twice.
-    """
-    meth = getattr(obj, name, None)
-    if fixtures.getfixturemarker(meth) is None:
-        return meth
-
-
-class Class(PyCollector):
-    """ Collector for test methods. """
-
-    def collect(self):
-        if not safe_getattr(self.obj, "__test__", True):
-            return []
-        if hasinit(self.obj):
-            self.warn("C1", "cannot collect test class %r because it has a "
-                      "__init__ constructor" % self.obj.__name__)
-            return []
-        elif hasnew(self.obj):
-            self.warn("C1", "cannot collect test class %r because it has a "
-                            "__new__ constructor" % self.obj.__name__)
-            return []
-        return [self._getcustomclass("Instance")(name="()", parent=self)]
-
-    def setup(self):
-        setup_class = _get_xunit_func(self.obj, 'setup_class')
-        if setup_class is not None:
-            setup_class = getattr(setup_class, 'im_func', setup_class)
-            setup_class = getattr(setup_class, '__func__', setup_class)
-            setup_class(self.obj)
-
-        fin_class = getattr(self.obj, 'teardown_class', None)
-        if fin_class is not None:
-            fin_class = getattr(fin_class, 'im_func', fin_class)
-            fin_class = getattr(fin_class, '__func__', fin_class)
-            self.addfinalizer(lambda: fin_class(self.obj))
-
-
-class Instance(PyCollector):
-    def _getobj(self):
-        return self.parent.obj()
-
-    def collect(self):
-        self.session._fixturemanager.parsefactories(self)
-        return super(Instance, self).collect()
-
-    def newinstance(self):
-        self.obj = self._getobj()
-        return self.obj
-
-
-class FunctionMixin(PyobjMixin):
-    """ mixin for the code common to Function and Generator.
-    """
-
-    def setup(self):
-        """ perform setup for this test function. """
-        if hasattr(self, '_preservedparent'):
-            obj = self._preservedparent
-        elif isinstance(self.parent, Instance):
-            obj = self.parent.newinstance()
-            self.obj = self._getobj()
-        else:
-            obj = self.parent.obj
-        if inspect.ismethod(self.obj):
-            setup_name = 'setup_method'
-            teardown_name = 'teardown_method'
-        else:
-            setup_name = 'setup_function'
-            teardown_name = 'teardown_function'
-        setup_func_or_method = _get_xunit_setup_teardown(obj, setup_name, param_obj=self.obj)
-        if setup_func_or_method is not None:
-            setup_func_or_method()
-        teardown_func_or_method = _get_xunit_setup_teardown(obj, teardown_name, param_obj=self.obj)
-        if teardown_func_or_method is not None:
-            self.addfinalizer(teardown_func_or_method)
-
-    def _prunetraceback(self, excinfo):
-        if hasattr(self, '_obj') and not self.config.option.fulltrace:
-            code = _pytest._code.Code(get_real_func(self.obj))
-            path, firstlineno = code.path, code.firstlineno
-            traceback = excinfo.traceback
-            ntraceback = traceback.cut(path=path, firstlineno=firstlineno)
-            if ntraceback == traceback:
-                ntraceback = ntraceback.cut(path=path)
-                if ntraceback == traceback:
-                    # ntraceback = ntraceback.cut(excludepath=cutdir2)
-                    ntraceback = ntraceback.filter(filter_traceback)
-                    if not ntraceback:
-                        ntraceback = traceback
-
-            excinfo.traceback = ntraceback.filter()
-            # issue364: mark all but first and last frames to
-            # only show a single-line message for each frame
-            if self.config.option.tbstyle == "auto":
-                if len(excinfo.traceback) > 2:
-                    for entry in excinfo.traceback[1:-1]:
-                        entry.set_repr_style('short')
-
-    def _repr_failure_py(self, excinfo, style="long"):
-        if excinfo.errisinstance(fail.Exception):
-            if not excinfo.value.pytrace:
-                return py._builtin._totext(excinfo.value)
-        return super(FunctionMixin, self)._repr_failure_py(excinfo,
-                                                           style=style)
-
-    def repr_failure(self, excinfo, outerr=None):
-        assert outerr is None, "XXX outerr usage is deprecated"
-        style = self.config.option.tbstyle
-        if style == "auto":
-            style = "long"
-        return self._repr_failure_py(excinfo, style=style)
-
-
-class Generator(FunctionMixin, PyCollector):
-    def collect(self):
-        # test generators are seen as collectors but they also
-        # invoke setup/teardown on popular request
-        # (induced by the common "test_*" naming shared with normal tests)
-        from _pytest import deprecated
-        self.session._setupstate.prepare(self)
-        # see FunctionMixin.setup and test_setupstate_is_preserved_134
-        self._preservedparent = self.parent.obj
-        values = []
-        seen = {}
-        for i, x in enumerate(self.obj()):
-            name, call, args = self.getcallargs(x)
-            if not callable(call):
-                raise TypeError("%r yielded non callable test %r" % (self.obj, call,))
-            if name is None:
-                name = "[%d]" % i
-            else:
-                name = "['%s']" % name
-            if name in seen:
-                raise ValueError("%r generated tests with non-unique name %r" % (self, name))
-            seen[name] = True
-            values.append(self.Function(name, self, args=args, callobj=call))
-        self.warn('C1', deprecated.YIELD_TESTS)
-        return values
-
-    def getcallargs(self, obj):
-        if not isinstance(obj, (tuple, list)):
-            obj = (obj,)
-        # explicit naming
-        if isinstance(obj[0], py.builtin._basestring):
-            name = obj[0]
-            obj = obj[1:]
-        else:
-            name = None
-        call, args = obj[0], obj[1:]
-        return name, call, args
-
-
-def hasinit(obj):
-    init = getattr(obj, '__init__', None)
-    if init:
-        return init != object.__init__
-
-
-def hasnew(obj):
-    new = getattr(obj, '__new__', None)
-    if new:
-        return new != object.__new__
-
-
-class CallSpec2(object):
-    def __init__(self, metafunc):
-        self.metafunc = metafunc
-        self.funcargs = {}
-        self._idlist = []
-        self.params = {}
-        self._globalid = NOTSET
-        self._globalid_args = set()
-        self._globalparam = NOTSET
-        self._arg2scopenum = {}  # used for sorting parametrized resources
-        self.keywords = {}
-        self.indices = {}
-
-    def copy(self, metafunc):
-        cs = CallSpec2(self.metafunc)
-        cs.funcargs.update(self.funcargs)
-        cs.params.update(self.params)
-        cs.keywords.update(self.keywords)
-        cs.indices.update(self.indices)
-        cs._arg2scopenum.update(self._arg2scopenum)
-        cs._idlist = list(self._idlist)
-        cs._globalid = self._globalid
-        cs._globalid_args = self._globalid_args
-        cs._globalparam = self._globalparam
-        return cs
-
-    def _checkargnotcontained(self, arg):
-        if arg in self.params or arg in self.funcargs:
-            raise ValueError("duplicate %r" % (arg,))
-
-    def getparam(self, name):
-        try:
-            return self.params[name]
-        except KeyError:
-            if self._globalparam is NOTSET:
-                raise ValueError(name)
-            return self._globalparam
-
-    @property
-    def id(self):
-        return "-".join(map(str, filter(None, self._idlist)))
-
-    def setmulti(self, valtypes, argnames, valset, id, keywords, scopenum,
-                 param_index):
-        for arg, val in zip(argnames, valset):
-            self._checkargnotcontained(arg)
-            valtype_for_arg = valtypes[arg]
-            getattr(self, valtype_for_arg)[arg] = val
-            self.indices[arg] = param_index
-            self._arg2scopenum[arg] = scopenum
-        self._idlist.append(id)
-        self.keywords.update(keywords)
-
-    def setall(self, funcargs, id, param):
-        for x in funcargs:
-            self._checkargnotcontained(x)
-        self.funcargs.update(funcargs)
-        if id is not NOTSET:
-            self._idlist.append(id)
-        if param is not NOTSET:
-            assert self._globalparam is NOTSET
-            self._globalparam = param
-        for arg in funcargs:
-            self._arg2scopenum[arg] = fixtures.scopenum_function
-
-
-class Metafunc(fixtures.FuncargnamesCompatAttr):
-    """
-    Metafunc objects are passed to the ``pytest_generate_tests`` hook.
-    They help to inspect a test function and to generate tests according to
-    test configuration or values specified in the class or module where a
-    test function is defined.
-    """
-
-    def __init__(self, function, fixtureinfo, config, cls=None, module=None):
-        #: access to the :class:`_pytest.config.Config` object for the test session
-        self.config = config
-
-        #: the module object where the test function is defined in.
-        self.module = module
-
-        #: underlying python test function
-        self.function = function
-
-        #: set of fixture names required by the test function
-        self.fixturenames = fixtureinfo.names_closure
-
-        #: class object where the test function is defined in or ``None``.
-        self.cls = cls
-
-        self._calls = []
-        self._ids = py.builtin.set()
-        self._arg2fixturedefs = fixtureinfo.name2fixturedefs
-
-    def parametrize(self, argnames, argvalues, indirect=False, ids=None,
-                    scope=None):
-        """ Add new invocations to the underlying test function using the list
-        of argvalues for the given argnames.  Parametrization is performed
-        during the collection phase.  If you need to setup expensive resources
-        see about setting indirect to do it rather at test setup time.
-
-        :arg argnames: a comma-separated string denoting one or more argument
-                       names, or a list/tuple of argument strings.
-
-        :arg argvalues: The list of argvalues determines how often a
-            test is invoked with different argument values.  If only one
-            argname was specified argvalues is a list of values.  If N
-            argnames were specified, argvalues must be a list of N-tuples,
-            where each tuple-element specifies a value for its respective
-            argname.
-
-        :arg indirect: The list of argnames or boolean. A list of arguments'
-            names (subset of argnames). If True the list contains all names from
-            the argnames. Each argvalue corresponding to an argname in this list will
-            be passed as request.param to its respective argname fixture
-            function so that it can perform more expensive setups during the
-            setup phase of a test rather than at collection time.
-
-        :arg ids: list of string ids, or a callable.
-            If strings, each is corresponding to the argvalues so that they are
-            part of the test id. If None is given as id of specific test, the
-            automatically generated id for that argument will be used.
-            If callable, it should take one argument (a single argvalue) and return
-            a string or return None. If None, the automatically generated id for that
-            argument will be used.
-            If no ids are provided they will be generated automatically from
-            the argvalues.
-
-        :arg scope: if specified it denotes the scope of the parameters.
-            The scope is used for grouping tests by parameter instances.
-            It will also override any fixture-function defined scope, allowing
-            to set a dynamic scope using test context or configuration.
-        """
-        from _pytest.fixtures import scope2index
-        from _pytest.mark import MARK_GEN, ParameterSet
-        from py.io import saferepr
-
-        if not isinstance(argnames, (tuple, list)):
-            argnames = [x.strip() for x in argnames.split(",") if x.strip()]
-            force_tuple = len(argnames) == 1
-        else:
-            force_tuple = False
-        parameters = [
-            ParameterSet.extract_from(x, legacy_force_tuple=force_tuple)
-            for x in argvalues]
-        del argvalues
-
-        if not parameters:
-            fs, lineno = getfslineno(self.function)
-            reason = "got empty parameter set %r, function %s at %s:%d" % (
-                argnames, self.function.__name__, fs, lineno)
-            mark = MARK_GEN.skip(reason=reason)
-            parameters.append(ParameterSet(
-                values=(NOTSET,) * len(argnames),
-                marks=[mark],
-                id=None,
-            ))
-
-        if scope is None:
-            scope = _find_parametrized_scope(argnames, self._arg2fixturedefs, indirect)
-
-        scopenum = scope2index(scope, descr='call to {0}'.format(self.parametrize))
-        valtypes = {}
-        for arg in argnames:
-            if arg not in self.fixturenames:
-                if isinstance(indirect, (tuple, list)):
-                    name = 'fixture' if arg in indirect else 'argument'
-                else:
-                    name = 'fixture' if indirect else 'argument'
-                raise ValueError(
-                    "%r uses no %s %r" % (
-                        self.function, name, arg))
-
-        if indirect is True:
-            valtypes = dict.fromkeys(argnames, "params")
-        elif indirect is False:
-            valtypes = dict.fromkeys(argnames, "funcargs")
-        elif isinstance(indirect, (tuple, list)):
-            valtypes = dict.fromkeys(argnames, "funcargs")
-            for arg in indirect:
-                if arg not in argnames:
-                    raise ValueError("indirect given to %r: fixture %r doesn't exist" % (
-                                     self.function, arg))
-                valtypes[arg] = "params"
-        idfn = None
-        if callable(ids):
-            idfn = ids
-            ids = None
-        if ids:
-            if len(ids) != len(parameters):
-                raise ValueError('%d tests specified with %d ids' % (
-                                 len(parameters), len(ids)))
-            for id_value in ids:
-                if id_value is not None and not isinstance(id_value, py.builtin._basestring):
-                    msg = 'ids must be list of strings, found: %s (type: %s)'
-                    raise ValueError(msg % (saferepr(id_value), type(id_value).__name__))
-        ids = idmaker(argnames, parameters, idfn, ids, self.config)
-        newcalls = []
-        for callspec in self._calls or [CallSpec2(self)]:
-            elements = zip(ids, parameters, count())
-            for a_id, param, param_index in elements:
-                if len(param.values) != len(argnames):
-                    raise ValueError(
-                        'In "parametrize" the number of values ({0}) must be '
-                        'equal to the number of names ({1})'.format(
-                            param.values, argnames))
-                newcallspec = callspec.copy(self)
-                newcallspec.setmulti(valtypes, argnames, param.values, a_id,
-                                     param.deprecated_arg_dict, scopenum, param_index)
-                newcalls.append(newcallspec)
-        self._calls = newcalls
-
-    def addcall(self, funcargs=None, id=NOTSET, param=NOTSET):
-        """ (deprecated, use parametrize) Add a new call to the underlying
-        test function during the collection phase of a test run.  Note that
-        request.addcall() is called during the test collection phase prior and
-        independently to actual test execution.  You should only use addcall()
-        if you need to specify multiple arguments of a test function.
-
-        :arg funcargs: argument keyword dictionary used when invoking
-            the test function.
-
-        :arg id: used for reporting and identification purposes.  If you
-            don't supply an `id` an automatic unique id will be generated.
-
-        :arg param: a parameter which will be exposed to a later fixture function
-            invocation through the ``request.param`` attribute.
-        """
-        assert funcargs is None or isinstance(funcargs, dict)
-        if funcargs is not None:
-            for name in funcargs:
-                if name not in self.fixturenames:
-                    fail("funcarg %r not used in this function." % name)
-        else:
-            funcargs = {}
-        if id is None:
-            raise ValueError("id=None not allowed")
-        if id is NOTSET:
-            id = len(self._calls)
-        id = str(id)
-        if id in self._ids:
-            raise ValueError("duplicate id %r" % id)
-        self._ids.add(id)
-
-        cs = CallSpec2(self)
-        cs.setall(funcargs, id, param)
-        self._calls.append(cs)
-
-
-def _find_parametrized_scope(argnames, arg2fixturedefs, indirect):
-    """Find the most appropriate scope for a parametrized call based on its arguments.
-
-    When there's at least one direct argument, always use "function" scope.
-
-    When a test function is parametrized and all its arguments are indirect
-    (e.g. fixtures), return the most narrow scope based on the fixtures used.
-
-    Related to issue #1832, based on code posted by @Kingdread.
-    """
-    from _pytest.fixtures import scopes
-    indirect_as_list = isinstance(indirect, (list, tuple))
-    all_arguments_are_fixtures = indirect is True or \
-        indirect_as_list and len(indirect) == argnames
-    if all_arguments_are_fixtures:
-        fixturedefs = arg2fixturedefs or {}
-        used_scopes = [fixturedef[0].scope for name, fixturedef in fixturedefs.items()]
-        if used_scopes:
-            # Takes the most narrow scope from used fixtures
-            for scope in reversed(scopes):
-                if scope in used_scopes:
-                    return scope
-
-    return 'function'
-
-
-def _idval(val, argname, idx, idfn, config=None):
-    if idfn:
-        s = None
-        try:
-            s = idfn(val)
-        except Exception:
-            # See issue https://github.com/pytest-dev/pytest/issues/2169
-            import warnings
-            msg = "Raised while trying to determine id of parameter %s at position %d." % (argname, idx)
-            msg += '\nUpdate your code as this will raise an error in pytest-4.0.'
-            warnings.warn(msg, DeprecationWarning)
-        if s:
-            return _ascii_escaped(s)
-
-    if config:
-        hook_id = config.hook.pytest_make_parametrize_id(
-            config=config, val=val, argname=argname)
-        if hook_id:
-            return hook_id
-
-    if isinstance(val, STRING_TYPES):
-        return _ascii_escaped(val)
-    elif isinstance(val, (float, int, bool, NoneType)):
-        return str(val)
-    elif isinstance(val, REGEX_TYPE):
-        return _ascii_escaped(val.pattern)
-    elif enum is not None and isinstance(val, enum.Enum):
-        return str(val)
-    elif isclass(val) and hasattr(val, '__name__'):
-        return val.__name__
-    return str(argname) + str(idx)
-
-
-def _idvalset(idx, parameterset, argnames, idfn, ids, config=None):
-    if parameterset.id is not None:
-        return parameterset.id
-    if ids is None or (idx >= len(ids) or ids[idx] is None):
-        this_id = [_idval(val, argname, idx, idfn, config)
-                   for val, argname in zip(parameterset.values, argnames)]
-        return "-".join(this_id)
-    else:
-        return _ascii_escaped(ids[idx])
-
-
-def idmaker(argnames, parametersets, idfn=None, ids=None, config=None):
-    ids = [_idvalset(valindex, parameterset, argnames, idfn, ids, config)
-           for valindex, parameterset in enumerate(parametersets)]
-    if len(set(ids)) != len(ids):
-        # The ids are not unique
-        duplicates = [testid for testid in ids if ids.count(testid) > 1]
-        counters = collections.defaultdict(lambda: 0)
-        for index, testid in enumerate(ids):
-            if testid in duplicates:
-                ids[index] = testid + str(counters[testid])
-                counters[testid] += 1
-    return ids
-
-
-def show_fixtures_per_test(config):
-    from _pytest.main import wrap_session
-    return wrap_session(config, _show_fixtures_per_test)
-
-
-def _show_fixtures_per_test(config, session):
-    import _pytest.config
-    session.perform_collect()
-    curdir = py.path.local()
-    tw = _pytest.config.create_terminal_writer(config)
-    verbose = config.getvalue("verbose")
-
-    def get_best_relpath(func):
-        loc = getlocation(func, curdir)
-        return curdir.bestrelpath(loc)
-
-    def write_fixture(fixture_def):
-        argname = fixture_def.argname
-        if verbose <= 0 and argname.startswith("_"):
-            return
-        if verbose > 0:
-            bestrel = get_best_relpath(fixture_def.func)
-            funcargspec = "{0} -- {1}".format(argname, bestrel)
-        else:
-            funcargspec = argname
-        tw.line(funcargspec, green=True)
-        fixture_doc = fixture_def.func.__doc__
-        if fixture_doc:
-            write_docstring(tw, fixture_doc)
-        else:
-            tw.line('    no docstring available', red=True)
-
-    def write_item(item):
-        try:
-            info = item._fixtureinfo
-        except AttributeError:
-            # doctests items have no _fixtureinfo attribute
-            return
-        if not info.name2fixturedefs:
-            # this test item does not use any fixtures
-            return
-        tw.line()
-        tw.sep('-', 'fixtures used by {0}'.format(item.name))
-        tw.sep('-', '({0})'.format(get_best_relpath(item.function)))
-        # dict key not used in loop but needed for sorting
-        for _, fixturedefs in sorted(info.name2fixturedefs.items()):
-            assert fixturedefs is not None
-            if not fixturedefs:
-                continue
-            # last item is expected to be the one used by the test item
-            write_fixture(fixturedefs[-1])
-
-    for session_item in session.items:
-        write_item(session_item)
-
-
-def showfixtures(config):
-    from _pytest.main import wrap_session
-    return wrap_session(config, _showfixtures_main)
-
-
-def _showfixtures_main(config, session):
-    import _pytest.config
-    session.perform_collect()
-    curdir = py.path.local()
-    tw = _pytest.config.create_terminal_writer(config)
-    verbose = config.getvalue("verbose")
-
-    fm = session._fixturemanager
-
-    available = []
-    seen = set()
-
-    for argname, fixturedefs in fm._arg2fixturedefs.items():
-        assert fixturedefs is not None
-        if not fixturedefs:
-            continue
-        for fixturedef in fixturedefs:
-            loc = getlocation(fixturedef.func, curdir)
-            if (fixturedef.argname, loc) in seen:
-                continue
-            seen.add((fixturedef.argname, loc))
-            available.append((len(fixturedef.baseid),
-                              fixturedef.func.__module__,
-                              curdir.bestrelpath(loc),
-                              fixturedef.argname, fixturedef))
-
-    available.sort()
-    currentmodule = None
-    for baseid, module, bestrel, argname, fixturedef in available:
-        if currentmodule != module:
-            if not module.startswith("_pytest."):
-                tw.line()
-                tw.sep("-", "fixtures defined from %s" % (module,))
-                currentmodule = module
-        if verbose <= 0 and argname[0] == "_":
-            continue
-        if verbose > 0:
-            funcargspec = "%s -- %s" % (argname, bestrel,)
-        else:
-            funcargspec = argname
-        tw.line(funcargspec, green=True)
-        loc = getlocation(fixturedef.func, curdir)
-        doc = fixturedef.func.__doc__ or ""
-        if doc:
-            write_docstring(tw, doc)
-        else:
-            tw.line("    %s: no docstring available" % (loc,),
-                    red=True)
-
-
-def write_docstring(tw, doc):
-    INDENT = "    "
-    doc = doc.rstrip()
-    if "\n" in doc:
-        firstline, rest = doc.split("\n", 1)
-    else:
-        firstline, rest = doc, ""
-
-    if firstline.strip():
-        tw.line(INDENT + firstline.strip())
-
-    if rest:
-        for line in dedent(rest).split("\n"):
-            tw.write(INDENT + line + "\n")
-
-
-class Function(FunctionMixin, main.Item, fixtures.FuncargnamesCompatAttr):
-    """ a Function Item is responsible for setting up and executing a
-    Python test function.
-    """
-    _genid = None
-
-    def __init__(self, name, parent, args=None, config=None,
-                 callspec=None, callobj=NOTSET, keywords=None, session=None,
-                 fixtureinfo=None, originalname=None):
-        super(Function, self).__init__(name, parent, config=config,
-                                       session=session)
-        self._args = args
-        if callobj is not NOTSET:
-            self.obj = callobj
-
-        self.keywords.update(self.obj.__dict__)
-        if callspec:
-            self.callspec = callspec
-            self.keywords.update(callspec.keywords)
-        if keywords:
-            self.keywords.update(keywords)
-
-        if fixtureinfo is None:
-            fixtureinfo = self.session._fixturemanager.getfixtureinfo(
-                self.parent, self.obj, self.cls,
-                funcargs=not self._isyieldedfunction())
-        self._fixtureinfo = fixtureinfo
-        self.fixturenames = fixtureinfo.names_closure
-        self._initrequest()
-
-        #: original function name, without any decorations (for example
-        #: parametrization adds a ``"[...]"`` suffix to function names).
-        #:
-        #: .. versionadded:: 3.0
-        self.originalname = originalname
-
-    def _initrequest(self):
-        self.funcargs = {}
-        if self._isyieldedfunction():
-            assert not hasattr(self, "callspec"), (
-                "yielded functions (deprecated) cannot have funcargs")
-        else:
-            if hasattr(self, "callspec"):
-                callspec = self.callspec
-                assert not callspec.funcargs
-                self._genid = callspec.id
-                if hasattr(callspec, "param"):
-                    self.param = callspec.param
-        self._request = fixtures.FixtureRequest(self)
-
-    @property
-    def function(self):
-        "underlying python 'function' object"
-        return getattr(self.obj, 'im_func', self.obj)
-
-    def _getobj(self):
-        name = self.name
-        i = name.find("[")  # parametrization
-        if i != -1:
-            name = name[:i]
-        return getattr(self.parent.obj, name)
-
-    @property
-    def _pyfuncitem(self):
-        "(compatonly) for code expecting pytest-2.2 style request objects"
-        return self
-
-    def _isyieldedfunction(self):
-        return getattr(self, "_args", None) is not None
-
-    def runtest(self):
-        """ execute the underlying test function. """
-        self.ihook.pytest_pyfunc_call(pyfuncitem=self)
-
-    def setup(self):
-        super(Function, self).setup()
-        fixtures.fillfixtures(self)
deleted file mode 100644
--- a/third_party/python/pytest/_pytest/python_api.py
+++ /dev/null
@@ -1,626 +0,0 @@
-import math
-import sys
-
-import py
-
-from _pytest.compat import isclass, izip
-from _pytest.outcomes import fail
-import _pytest._code
-
-
-def _cmp_raises_type_error(self, other):
-    """__cmp__ implementation which raises TypeError. Used
-    by Approx base classes to implement only == and != and raise a
-    TypeError for other comparisons.
-
-    Needed in Python 2 only, Python 3 all it takes is not implementing the
-    other operators at all.
-    """
-    __tracebackhide__ = True
-    raise TypeError('Comparison operators other than == and != not supported by approx objects')
-
-
-# builtin pytest.approx helper
-
-
-class ApproxBase(object):
-    """
-    Provide shared utilities for making approximate comparisons between numbers
-    or sequences of numbers.
-    """
-
-    def __init__(self, expected, rel=None, abs=None, nan_ok=False):
-        self.expected = expected
-        self.abs = abs
-        self.rel = rel
-        self.nan_ok = nan_ok
-
-    def __repr__(self):
-        raise NotImplementedError
-
-    def __eq__(self, actual):
-        return all(
-            a == self._approx_scalar(x)
-            for a, x in self._yield_comparisons(actual))
-
-    __hash__ = None
-
-    def __ne__(self, actual):
-        return not (actual == self)
-
-    if sys.version_info[0] == 2:
-        __cmp__ = _cmp_raises_type_error
-
-    def _approx_scalar(self, x):
-        return ApproxScalar(x, rel=self.rel, abs=self.abs, nan_ok=self.nan_ok)
-
-    def _yield_comparisons(self, actual):
-        """
-        Yield all the pairs of numbers to be compared.  This is used to
-        implement the `__eq__` method.
-        """
-        raise NotImplementedError
-
-
-class ApproxNumpy(ApproxBase):
-    """
-    Perform approximate comparisons for numpy arrays.
-    """
-
-    # Tell numpy to use our `__eq__` operator instead of its.
-    __array_priority__ = 100
-
-    def __repr__(self):
-        # It might be nice to rewrite this function to account for the
-        # shape of the array...
-        return "approx({0!r})".format(list(
-            self._approx_scalar(x) for x in self.expected))
-
-    if sys.version_info[0] == 2:
-        __cmp__ = _cmp_raises_type_error
-
-    def __eq__(self, actual):
-        import numpy as np
-
-        try:
-            actual = np.asarray(actual)
-        except:  # noqa
-            raise TypeError("cannot compare '{0}' to numpy.ndarray".format(actual))
-
-        if actual.shape != self.expected.shape:
-            return False
-
-        return ApproxBase.__eq__(self, actual)
-
-    def _yield_comparisons(self, actual):
-        import numpy as np
-
-        # We can be sure that `actual` is a numpy array, because it's
-        # casted in `__eq__` before being passed to `ApproxBase.__eq__`,
-        # which is the only method that calls this one.
-        for i in np.ndindex(self.expected.shape):
-            yield actual[i], self.expected[i]
-
-
-class ApproxMapping(ApproxBase):
-    """
-    Perform approximate comparisons for mappings where the values are numbers
-    (the keys can be anything).
-    """
-
-    def __repr__(self):
-        return "approx({0!r})".format(dict(
-            (k, self._approx_scalar(v))
-            for k, v in self.expected.items()))
-
-    def __eq__(self, actual):
-        if set(actual.keys()) != set(self.expected.keys()):
-            return False
-
-        return ApproxBase.__eq__(self, actual)
-
-    def _yield_comparisons(self, actual):
-        for k in self.expected.keys():
-            yield actual[k], self.expected[k]
-
-
-class ApproxSequence(ApproxBase):
-    """
-    Perform approximate comparisons for sequences of numbers.
-    """
-
-    # Tell numpy to use our `__eq__` operator instead of its.
-    __array_priority__ = 100
-
-    def __repr__(self):
-        seq_type = type(self.expected)
-        if seq_type not in (tuple, list, set):
-            seq_type = list
-        return "approx({0!r})".format(seq_type(
-            self._approx_scalar(x) for x in self.expected))
-
-    def __eq__(self, actual):
-        if len(actual) != len(self.expected):
-            return False
-        return ApproxBase.__eq__(self, actual)
-
-    def _yield_comparisons(self, actual):
-        return izip(actual, self.expected)
-
-
-class ApproxScalar(ApproxBase):
-    """
-    Perform approximate comparisons for single numbers only.
-    """
-
-    def __repr__(self):
-        """
-        Return a string communicating both the expected value and the tolerance
-        for the comparison being made, e.g. '1.0 +- 1e-6'.  Use the unicode
-        plus/minus symbol if this is python3 (it's too hard to get right for
-        python2).
-        """
-        if isinstance(self.expected, complex):
-            return str(self.expected)
-
-        # Infinities aren't compared using tolerances, so don't show a
-        # tolerance.
-        if math.isinf(self.expected):
-            return str(self.expected)
-
-        # If a sensible tolerance can't be calculated, self.tolerance will
-        # raise a ValueError.  In this case, display '???'.
-        try:
-            vetted_tolerance = '{:.1e}'.format(self.tolerance)
-        except ValueError:
-            vetted_tolerance = '???'
-
-        if sys.version_info[0] == 2:
-            return '{0} +- {1}'.format(self.expected, vetted_tolerance)
-        else:
-            return u'{0} \u00b1 {1}'.format(self.expected, vetted_tolerance)
-
-    def __eq__(self, actual):
-        """
-        Return true if the given value is equal to the expected value within
-        the pre-specified tolerance.
-        """
-
-        # Short-circuit exact equality.
-        if actual == self.expected:
-            return True
-
-        # Allow the user to control whether NaNs are considered equal to each
-        # other or not.  The abs() calls are for compatibility with complex
-        # numbers.
-        if math.isnan(abs(self.expected)):
-            return self.nan_ok and math.isnan(abs(actual))
-
-        # Infinity shouldn't be approximately equal to anything but itself, but
-        # if there's a relative tolerance, it will be infinite and infinity
-        # will seem approximately equal to everything.  The equal-to-itself
-        # case would have been short circuited above, so here we can just
-        # return false if the expected value is infinite.  The abs() call is
-        # for compatibility with complex numbers.
-        if math.isinf(abs(self.expected)):
-            return False
-
-        # Return true if the two numbers are within the tolerance.
-        return abs(self.expected - actual) <= self.tolerance
-
-    __hash__ = None
-
-    @property
-    def tolerance(self):
-        """
-        Return the tolerance for the comparison.  This could be either an
-        absolute tolerance or a relative tolerance, depending on what the user
-        specified or which would be larger.
-        """
-        def set_default(x, default):
-            return x if x is not None else default
-
-        # Figure out what the absolute tolerance should be.  ``self.abs`` is
-        # either None or a value specified by the user.
-        absolute_tolerance = set_default(self.abs, 1e-12)
-
-        if absolute_tolerance < 0:
-            raise ValueError("absolute tolerance can't be negative: {}".format(absolute_tolerance))
-        if math.isnan(absolute_tolerance):
-            raise ValueError("absolute tolerance can't be NaN.")
-
-        # If the user specified an absolute tolerance but not a relative one,
-        # just return the absolute tolerance.
-        if self.rel is None:
-            if self.abs is not None:
-                return absolute_tolerance
-
-        # Figure out what the relative tolerance should be.  ``self.rel`` is
-        # either None or a value specified by the user.  This is done after
-        # we've made sure the user didn't ask for an absolute tolerance only,
-        # because we don't want to raise errors about the relative tolerance if
-        # we aren't even going to use it.
-        relative_tolerance = set_default(self.rel, 1e-6) * abs(self.expected)
-
-        if relative_tolerance < 0:
-            raise ValueError("relative tolerance can't be negative: {}".format(absolute_tolerance))
-        if math.isnan(relative_tolerance):
-            raise ValueError("relative tolerance can't be NaN.")
-
-        # Return the larger of the relative and absolute tolerances.
-        return max(relative_tolerance, absolute_tolerance)
-
-
-def approx(expected, rel=None, abs=None, nan_ok=False):
-    """
-    Assert that two numbers (or two sets of numbers) are equal to each other
-    within some tolerance.
-
-    Due to the `intricacies of floating-point arithmetic`__, numbers that we
-    would intuitively expect to be equal are not always so::
-
-        >>> 0.1 + 0.2 == 0.3
-        False
-
-    __ https://docs.python.org/3/tutorial/floatingpoint.html
-
-    This problem is commonly encountered when writing tests, e.g. when making
-    sure that floating-point values are what you expect them to be.  One way to
-    deal with this problem is to assert that two floating-point numbers are
-    equal to within some appropriate tolerance::
-
-        >>> abs((0.1 + 0.2) - 0.3) < 1e-6
-        True
-
-    However, comparisons like this are tedious to write and difficult to
-    understand.  Furthermore, absolute comparisons like the one above are
-    usually discouraged because there's no tolerance that works well for all
-    situations.  ``1e-6`` is good for numbers around ``1``, but too small for
-    very big numbers and too big for very small ones.  It's better to express
-    the tolerance as a fraction of the expected value, but relative comparisons
-    like that are even more difficult to write correctly and concisely.
-
-    The ``approx`` class performs floating-point comparisons using a syntax
-    that's as intuitive as possible::
-
-        >>> from pytest import approx
-        >>> 0.1 + 0.2 == approx(0.3)
-        True
-
-    The same syntax also works for sequences of numbers::
-
-        >>> (0.1 + 0.2, 0.2 + 0.4) == approx((0.3, 0.6))
-        True
-
-    Dictionary *values*::
-
-        >>> {'a': 0.1 + 0.2, 'b': 0.2 + 0.4} == approx({'a': 0.3, 'b': 0.6})
-        True
-
-    And ``numpy`` arrays::
-
-        >>> import numpy as np                                                          # doctest: +SKIP
-        >>> np.array([0.1, 0.2]) + np.array([0.2, 0.4]) == approx(np.array([0.3, 0.6])) # doctest: +SKIP
-        True
-
-    By default, ``approx`` considers numbers within a relative tolerance of
-    ``1e-6`` (i.e. one part in a million) of its expected value to be equal.
-    This treatment would lead to surprising results if the expected value was
-    ``0.0``, because nothing but ``0.0`` itself is relatively close to ``0.0``.
-    To handle this case less surprisingly, ``approx`` also considers numbers
-    within an absolute tolerance of ``1e-12`` of its expected value to be
-    equal.  Infinity and NaN are special cases.  Infinity is only considered
-    equal to itself, regardless of the relative tolerance.  NaN is not
-    considered equal to anything by default, but you can make it be equal to
-    itself by setting the ``nan_ok`` argument to True.  (This is meant to
-    facilitate comparing arrays that use NaN to mean "no data".)
-
-    Both the relative and absolute tolerances can be changed by passing
-    arguments to the ``approx`` constructor::
-
-        >>> 1.0001 == approx(1)
-        False
-        >>> 1.0001 == approx(1, rel=1e-3)
-        True
-        >>> 1.0001 == approx(1, abs=1e-3)
-        True
-
-    If you specify ``abs`` but not ``rel``, the comparison will not consider
-    the relative tolerance at all.  In other words, two numbers that are within
-    the default relative tolerance of ``1e-6`` will still be considered unequal
-    if they exceed the specified absolute tolerance.  If you specify both
-    ``abs`` and ``rel``, the numbers will be considered equal if either
-    tolerance is met::
-
-        >>> 1 + 1e-8 == approx(1)
-        True
-        >>> 1 + 1e-8 == approx(1, abs=1e-12)
-        False
-        >>> 1 + 1e-8 == approx(1, rel=1e-6, abs=1e-12)
-        True
-
-    If you're thinking about using ``approx``, then you might want to know how
-    it compares to other good ways of comparing floating-point numbers.  All of
-    these algorithms are based on relative and absolute tolerances and should
-    agree for the most part, but they do have meaningful differences:
-
-    - ``math.isclose(a, b, rel_tol=1e-9, abs_tol=0.0)``:  True if the relative
-      tolerance is met w.r.t. either ``a`` or ``b`` or if the absolute
-      tolerance is met.  Because the relative tolerance is calculated w.r.t.
-      both ``a`` and ``b``, this test is symmetric (i.e.  neither ``a`` nor
-      ``b`` is a "reference value").  You have to specify an absolute tolerance
-      if you want to compare to ``0.0`` because there is no tolerance by
-      default.  Only available in python>=3.5.  `More information...`__
-
-      __ https://docs.python.org/3/library/math.html#math.isclose
-
-    - ``numpy.isclose(a, b, rtol=1e-5, atol=1e-8)``: True if the difference
-      between ``a`` and ``b`` is less that the sum of the relative tolerance
-      w.r.t. ``b`` and the absolute tolerance.  Because the relative tolerance
-      is only calculated w.r.t. ``b``, this test is asymmetric and you can
-      think of ``b`` as the reference value.  Support for comparing sequences
-      is provided by ``numpy.allclose``.  `More information...`__
-
-      __ http://docs.scipy.org/doc/numpy-1.10.0/reference/generated/numpy.isclose.html
-
-    - ``unittest.TestCase.assertAlmostEqual(a, b)``: True if ``a`` and ``b``
-      are within an absolute tolerance of ``1e-7``.  No relative tolerance is
-      considered and the absolute tolerance cannot be changed, so this function
-      is not appropriate for very large or very small numbers.  Also, it's only
-      available in subclasses of ``unittest.TestCase`` and it's ugly because it
-      doesn't follow PEP8.  `More information...`__
-
-      __ https://docs.python.org/3/library/unittest.html#unittest.TestCase.assertAlmostEqual
-
-    - ``a == pytest.approx(b, rel=1e-6, abs=1e-12)``: True if the relative
-      tolerance is met w.r.t. ``b`` or if the absolute tolerance is met.
-      Because the relative tolerance is only calculated w.r.t. ``b``, this test
-      is asymmetric and you can think of ``b`` as the reference value.  In the
-      special case that you explicitly specify an absolute tolerance but not a
-      relative tolerance, only the absolute tolerance is considered.
-
-    .. warning::
-
-       .. versionchanged:: 3.2
-
-       In order to avoid inconsistent behavior, ``TypeError`` is
-       raised for ``>``, ``>=``, ``<`` and ``<=`` comparisons.
-       The example below illustrates the problem::
-
-           assert approx(0.1) > 0.1 + 1e-10  # calls approx(0.1).__gt__(0.1 + 1e-10)
-           assert 0.1 + 1e-10 > approx(0.1)  # calls approx(0.1).__lt__(0.1 + 1e-10)
-
-       In the second example one expects ``approx(0.1).__le__(0.1 + 1e-10)``
-       to be called. But instead, ``approx(0.1).__lt__(0.1 + 1e-10)`` is used to
-       comparison. This is because the call hierarchy of rich comparisons
-       follows a fixed behavior. `More information...`__
-
-       __ https://docs.python.org/3/reference/datamodel.html#object.__ge__
-    """
-
-    from collections import Mapping, Sequence
-    from _pytest.compat import STRING_TYPES as String
-
-    # Delegate the comparison to a class that knows how to deal with the type
-    # of the expected value (e.g. int, float, list, dict, numpy.array, etc).
-    #
-    # This architecture is really driven by the need to support numpy arrays.
-    # The only way to override `==` for arrays without requiring that approx be
-    # the left operand is to inherit the approx object from `numpy.ndarray`.
-    # But that can't be a general solution, because it requires (1) numpy to be
-    # installed and (2) the expected value to be a numpy array.  So the general
-    # solution is to delegate each type of expected value to a different class.
-    #
-    # This has the advantage that it made it easy to support mapping types
-    # (i.e. dict).  The old code accepted mapping types, but would only compare
-    # their keys, which is probably not what most people would expect.
-
-    if _is_numpy_array(expected):
-        cls = ApproxNumpy
-    elif isinstance(expected, Mapping):
-        cls = ApproxMapping
-    elif isinstance(expected, Sequence) and not isinstance(expected, String):
-        cls = ApproxSequence
-    else:
-        cls = ApproxScalar
-
-    return cls(expected, rel, abs, nan_ok)
-
-
-def _is_numpy_array(obj):
-    """
-    Return true if the given object is a numpy array.  Make a special effort to
-    avoid importing numpy unless it's really necessary.
-    """
-    import inspect
-
-    for cls in inspect.getmro(type(obj)):
-        if cls.__module__ == 'numpy':
-            try:
-                import numpy as np
-                return isinstance(obj, np.ndarray)
-            except ImportError:
-                pass
-
-    return False
-
-
-# builtin pytest.raises helper
-
-def raises(expected_exception, *args, **kwargs):
-    """
-    Assert that a code block/function call raises ``expected_exception``
-    and raise a failure exception otherwise.
-
-    This helper produces a ``ExceptionInfo()`` object (see below).
-
-    If using Python 2.5 or above, you may use this function as a
-    context manager::
-
-        >>> with raises(ZeroDivisionError):
-        ...    1/0
-
-    .. versionchanged:: 2.10
-
-    In the context manager form you may use the keyword argument
-    ``message`` to specify a custom failure message::
-
-        >>> with raises(ZeroDivisionError, message="Expecting ZeroDivisionError"):
-        ...    pass
-        Traceback (most recent call last):
-          ...
-        Failed: Expecting ZeroDivisionError
-
-    .. note::
-
-       When using ``pytest.raises`` as a context manager, it's worthwhile to
-       note that normal context manager rules apply and that the exception
-       raised *must* be the final line in the scope of the context manager.
-       Lines of code after that, within the scope of the context manager will
-       not be executed. For example::
-
-           >>> value = 15
-           >>> with raises(ValueError) as exc_info:
-           ...     if value > 10:
-           ...         raise ValueError("value must be <= 10")
-           ...     assert exc_info.type == ValueError  # this will not execute
-
-       Instead, the following approach must be taken (note the difference in
-       scope)::
-
-           >>> with raises(ValueError) as exc_info:
-           ...     if value > 10:
-           ...         raise ValueError("value must be <= 10")
-           ...
-           >>> assert exc_info.type == ValueError
-
-
-    Since version ``3.1`` you can use the keyword argument ``match`` to assert that the
-    exception matches a text or regex::
-
-        >>> with raises(ValueError, match='must be 0 or None'):
-        ...     raise ValueError("value must be 0 or None")
-
-        >>> with raises(ValueError, match=r'must be \d+$'):
-        ...     raise ValueError("value must be 42")
-
-    **Legacy forms**
-
-    The forms below are fully supported but are discouraged for new code because the
-    context manager form is regarded as more readable and less error-prone.
-
-    It is possible to specify a callable by passing a to-be-called lambda::
-
-        >>> raises(ZeroDivisionError, lambda: 1/0)
-        <ExceptionInfo ...>
-
-    or you can specify an arbitrary callable with arguments::
-
-        >>> def f(x): return 1/x
-        ...
-        >>> raises(ZeroDivisionError, f, 0)
-        <ExceptionInfo ...>
-        >>> raises(ZeroDivisionError, f, x=0)
-        <ExceptionInfo ...>
-
-    It is also possible to pass a string to be evaluated at runtime::
-
-        >>> raises(ZeroDivisionError, "f(0)")
-        <ExceptionInfo ...>
-
-    The string will be evaluated using the same ``locals()`` and ``globals()``
-    at the moment of the ``raises`` call.
-
-    .. autoclass:: _pytest._code.ExceptionInfo
-        :members:
-
-    .. note::
-        Similar to caught exception objects in Python, explicitly clearing
-        local references to returned ``ExceptionInfo`` objects can
-        help the Python interpreter speed up its garbage collection.
-
-        Clearing those references breaks a reference cycle
-        (``ExceptionInfo`` --> caught exception --> frame stack raising
-        the exception --> current frame stack --> local variables -->
-        ``ExceptionInfo``) which makes Python keep all objects referenced
-        from that cycle (including all local variables in the current
-        frame) alive until the next cyclic garbage collection run. See the
-        official Python ``try`` statement documentation for more detailed
-        information.
-
-    """
-    __tracebackhide__ = True
-    msg = ("exceptions must be old-style classes or"
-           " derived from BaseException, not %s")
-    if isinstance(expected_exception, tuple):
-        for exc in expected_exception:
-            if not isclass(exc):
-                raise TypeError(msg % type(exc))
-    elif not isclass(expected_exception):
-        raise TypeError(msg % type(expected_exception))
-
-    message = "DID NOT RAISE {0}".format(expected_exception)
-    match_expr = None
-
-    if not args:
-        if "message" in kwargs:
-            message = kwargs.pop("message")
-        if "match" in kwargs:
-            match_expr = kwargs.pop("match")
-            message += " matching '{0}'".format(match_expr)
-        return RaisesContext(expected_exception, message, match_expr)
-    elif isinstance(args[0], str):
-        code, = args
-        assert isinstance(code, str)
-        frame = sys._getframe(1)
-        loc = frame.f_locals.copy()
-        loc.update(kwargs)
-        # print "raises frame scope: %r" % frame.f_locals
-        try:
-            code = _pytest._code.Source(code).compile()
-            py.builtin.exec_(code, frame.f_globals, loc)
-            # XXX didn'T mean f_globals == f_locals something special?
-            #     this is destroyed here ...
-        except expected_exception:
-            return _pytest._code.ExceptionInfo()
-    else:
-        func = args[0]
-        try:
-            func(*args[1:], **kwargs)
-        except expected_exception:
-            return _pytest._code.ExceptionInfo()
-    fail(message)
-
-
-raises.Exception = fail.Exception
-
-
-class RaisesContext(object):
-    def __init__(self, expected_exception, message, match_expr):
-        self.expected_exception = expected_exception
-        self.message = message
-        self.match_expr = match_expr
-        self.excinfo = None
-
-    def __enter__(self):
-        self.excinfo = object.__new__(_pytest._code.ExceptionInfo)
-        return self.excinfo
-
-    def __exit__(self, *tp):
-        __tracebackhide__ = True
-        if tp[0] is None:
-            fail(self.message)
-        if sys.version_info < (2, 7):
-            # py26: on __exit__() exc_value often does not contain the
-            # exception value.
-            # http://bugs.python.org/issue7853
-            if not isinstance(tp[1], BaseException):
-                exc_type, value, traceback = tp
-                tp = exc_type, exc_type(value), traceback
-        self.excinfo.__init__(tp)
-        suppress_exception = issubclass(self.excinfo.type, self.expected_exception)
-        if sys.version_info[0] == 2 and suppress_exception:
-            sys.exc_clear()
-        if self.match_expr:
-            self.excinfo.match(self.match_expr)
-        return suppress_exception
deleted file mode 100644
--- a/third_party/python/pytest/_pytest/recwarn.py
+++ /dev/null
@@ -1,205 +0,0 @@
-""" recording warnings during test function execution. """
-from __future__ import absolute_import, division, print_function
-
-import inspect
-
-import _pytest._code
-import py
-import sys
-import warnings
-
-from _pytest.fixtures import yield_fixture
-from _pytest.outcomes import fail
-
-
-@yield_fixture
-def recwarn():
-    """Return a WarningsRecorder instance that provides these methods:
-
-    * ``pop(category=None)``: return last warning matching the category.
-    * ``clear()``: clear list of warnings
-
-    See http://docs.python.org/library/warnings.html for information
-    on warning categories.
-    """
-    wrec = WarningsRecorder()
-    with wrec:
-        warnings.simplefilter('default')
-        yield wrec
-
-
-def deprecated_call(func=None, *args, **kwargs):
-    """context manager that can be used to ensure a block of code triggers a
-    ``DeprecationWarning`` or ``PendingDeprecationWarning``::
-
-        >>> import warnings
-        >>> def api_call_v2():
-        ...     warnings.warn('use v3 of this api', DeprecationWarning)
-        ...     return 200
-
-        >>> with deprecated_call():
-        ...    assert api_call_v2() == 200
-
-    ``deprecated_call`` can also be used by passing a function and ``*args`` and ``*kwargs``,
-    in which case it will ensure calling ``func(*args, **kwargs)`` produces one of the warnings
-    types above.
-    """
-    if not func:
-        return _DeprecatedCallContext()
-    else:
-        __tracebackhide__ = True
-        with _DeprecatedCallContext():
-            return func(*args, **kwargs)
-
-
-class _DeprecatedCallContext(object):
-    """Implements the logic to capture deprecation warnings as a context manager."""
-
-    def __enter__(self):
-        self._captured_categories = []
-        self._old_warn = warnings.warn
-        self._old_warn_explicit = warnings.warn_explicit
-        warnings.warn_explicit = self._warn_explicit
-        warnings.warn = self._warn
-
-    def _warn_explicit(self, message, category, *args, **kwargs):
-        self._captured_categories.append(category)
-
-    def _warn(self, message, category=None, *args, **kwargs):
-        if isinstance(message, Warning):
-            self._captured_categories.append(message.__class__)
-        else:
-            self._captured_categories.append(category)
-
-    def __exit__(self, exc_type, exc_val, exc_tb):
-        warnings.warn_explicit = self._old_warn_explicit
-        warnings.warn = self._old_warn
-
-        if exc_type is None:
-            deprecation_categories = (DeprecationWarning, PendingDeprecationWarning)
-            if not any(issubclass(c, deprecation_categories) for c in self._captured_categories):
-                __tracebackhide__ = True
-                msg = "Did not produce DeprecationWarning or PendingDeprecationWarning"
-                raise AssertionError(msg)
-
-
-def warns(expected_warning, *args, **kwargs):
-    """Assert that code raises a particular class of warning.
-
-    Specifically, the input @expected_warning can be a warning class or
-    tuple of warning classes, and the code must return that warning
-    (if a single class) or one of those warnings (if a tuple).
-
-    This helper produces a list of ``warnings.WarningMessage`` objects,
-    one for each warning raised.
-
-    This function can be used as a context manager, or any of the other ways
-    ``pytest.raises`` can be used::
-
-        >>> with warns(RuntimeWarning):
-        ...    warnings.warn("my warning", RuntimeWarning)
-    """
-    wcheck = WarningsChecker(expected_warning)
-    if not args:
-        return wcheck
-    elif isinstance(args[0], str):
-        code, = args
-        assert isinstance(code, str)
-        frame = sys._getframe(1)
-        loc = frame.f_locals.copy()
-        loc.update(kwargs)
-
-        with wcheck:
-            code = _pytest._code.Source(code).compile()
-            py.builtin.exec_(code, frame.f_globals, loc)
-    else:
-        func = args[0]
-        with wcheck:
-            return func(*args[1:], **kwargs)
-
-
-class WarningsRecorder(warnings.catch_warnings):
-    """A context manager to record raised warnings.
-
-    Adapted from `warnings.catch_warnings`.
-    """
-
-    def __init__(self):
-        super(WarningsRecorder, self).__init__(record=True)
-        self._entered = False
-        self._list = []
-
-    @property
-    def list(self):
-        """The list of recorded warnings."""
-        return self._list
-
-    def __getitem__(self, i):
-        """Get a recorded warning by index."""
-        return self._list[i]
-
-    def __iter__(self):
-        """Iterate through the recorded warnings."""
-        return iter(self._list)
-
-    def __len__(self):
-        """The number of recorded warnings."""
-        return len(self._list)
-
-    def pop(self, cls=Warning):
-        """Pop the first recorded warning, raise exception if not exists."""
-        for i, w in enumerate(self._list):
-            if issubclass(w.category, cls):
-                return self._list.pop(i)
-        __tracebackhide__ = True
-        raise AssertionError("%r not found in warning list" % cls)
-
-    def clear(self):
-        """Clear the list of recorded warnings."""
-        self._list[:] = []
-
-    def __enter__(self):
-        if self._entered:
-            __tracebackhide__ = True
-            raise RuntimeError("Cannot enter %r twice" % self)
-        self._list = super(WarningsRecorder, self).__enter__()
-        warnings.simplefilter('always')
-        return self
-
-    def __exit__(self, *exc_info):
-        if not self._entered:
-            __tracebackhide__ = True
-            raise RuntimeError("Cannot exit %r without entering first" % self)
-        super(WarningsRecorder, self).__exit__(*exc_info)
-
-
-class WarningsChecker(WarningsRecorder):
-    def __init__(self, expected_warning=None):
-        super(WarningsChecker, self).__init__()
-
-        msg = ("exceptions must be old-style classes or "
-               "derived from Warning, not %s")
-        if isinstance(expected_warning, tuple):
-            for exc in expected_warning:
-                if not inspect.isclass(exc):
-                    raise TypeError(msg % type(exc))
-        elif inspect.isclass(expected_warning):
-            expected_warning = (expected_warning,)
-        elif expected_warning is not None:
-            raise TypeError(msg % type(expected_warning))
-
-        self.expected_warning = expected_warning
-
-    def __exit__(self, *exc_info):
-        super(WarningsChecker, self).__exit__(*exc_info)
-
-        # only check if we're not currently handling an exception
-        if all(a is None for a in exc_info):
-            if self.expected_warning is not None:
-                if not any(issubclass(r.category, self.expected_warning)
-                           for r in self):
-                    __tracebackhide__ = True
-                    fail("DID NOT WARN. No warnings of type {0} was emitted. "
-                         "The list of emitted warnings is: {1}.".format(
-                             self.expected_warning,
-                             [each.message for each in self]))
deleted file mode 100644
--- a/third_party/python/pytest/_pytest/resultlog.py
+++ /dev/null
@@ -1,113 +0,0 @@
-""" log machine-parseable test session result information in a plain
-text file.
-"""
-from __future__ import absolute_import, division, print_function
-
-import py
-import os
-
-
-def pytest_addoption(parser):
-    group = parser.getgroup("terminal reporting", "resultlog plugin options")
-    group.addoption('--resultlog', '--result-log', action="store",
-                    metavar="path", default=None,
-                    help="DEPRECATED path for machine-readable result log.")
-
-
-def pytest_configure(config):
-    resultlog = config.option.resultlog
-    # prevent opening resultlog on slave nodes (xdist)
-    if resultlog and not hasattr(config, 'slaveinput'):
-        dirname = os.path.dirname(os.path.abspath(resultlog))
-        if not os.path.isdir(dirname):
-            os.makedirs(dirname)
-        logfile = open(resultlog, 'w', 1)  # line buffered
-        config._resultlog = ResultLog(config, logfile)
-        config.pluginmanager.register(config._resultlog)
-
-        from _pytest.deprecated import RESULT_LOG
-        config.warn('C1', RESULT_LOG)
-
-
-def pytest_unconfigure(config):
-    resultlog = getattr(config, '_resultlog', None)
-    if resultlog:
-        resultlog.logfile.close()
-        del config._resultlog
-        config.pluginmanager.unregister(resultlog)
-
-
-def generic_path(item):
-    chain = item.listchain()
-    gpath = [chain[0].name]
-    fspath = chain[0].fspath
-    fspart = False
-    for node in chain[1:]:
-        newfspath = node.fspath
-        if newfspath == fspath:
-            if fspart:
-                gpath.append(':')
-                fspart = False
-            else:
-                gpath.append('.')
-        else:
-            gpath.append('/')
-            fspart = True
-        name = node.name
-        if name[0] in '([':
-            gpath.pop()
-        gpath.append(name)
-        fspath = newfspath
-    return ''.join(gpath)
-
-
-class ResultLog(object):
-    def __init__(self, config, logfile):
-        self.config = config
-        self.logfile = logfile  # preferably line buffered
-
-    def write_log_entry(self, testpath, lettercode, longrepr):
-        print("%s %s" % (lettercode, testpath), file=self.logfile)
-        for line in longrepr.splitlines():
-            print(" %s" % line, file=self.logfile)
-
-    def log_outcome(self, report, lettercode, longrepr):
-        testpath = getattr(report, 'nodeid', None)
-        if testpath is None:
-            testpath = report.fspath
-        self.write_log_entry(testpath, lettercode, longrepr)
-
-    def pytest_runtest_logreport(self, report):
-        if report.when != "call" and report.passed:
-            return
-        res = self.config.hook.pytest_report_teststatus(report=report)
-        code = res[1]
-        if code == 'x':
-            longrepr = str(report.longrepr)
-        elif code == 'X':
-            longrepr = ''
-        elif report.passed:
-            longrepr = ""
-        elif report.failed:
-            longrepr = str(report.longrepr)
-        elif report.skipped:
-            longrepr = str(report.longrepr[2])
-        self.log_outcome(report, code, longrepr)
-
-    def pytest_collectreport(self, report):
-        if not report.passed:
-            if report.failed:
-                code = "F"
-                longrepr = str(report.longrepr)
-            else:
-                assert report.skipped
-                code = "S"
-                longrepr = "%s:%d: %s" % report.longrepr
-            self.log_outcome(report, code, longrepr)
-
-    def pytest_internalerror(self, excrepr):
-        reprcrash = getattr(excrepr, 'reprcrash', None)
-        path = getattr(reprcrash, "path", None)
-        if path is None:
-            path = "cwd:%s" % py.path.local()
-        self.write_log_entry(path, '!', str(excrepr))
deleted file mode 100644
--- a/third_party/python/pytest/_pytest/runner.py
+++ /dev/null
@@ -1,508 +0,0 @@
-""" basic collect and runtest protocol implementations """
-from __future__ import absolute_import, division, print_function
-
-import bdb
-import os
-import sys
-from time import time
-
-import py
-from _pytest.compat import _PY2
-from _pytest._code.code import TerminalRepr, ExceptionInfo
-from _pytest.outcomes import skip, Skipped, TEST_OUTCOME
-
-#
-# pytest plugin hooks
-
-
-def pytest_addoption(parser):
-    group = parser.getgroup("terminal reporting", "reporting", after="general")
-    group.addoption('--durations',
-                    action="store", type=int, default=None, metavar="N",
-                    help="show N slowest setup/test durations (N=0 for all)."),
-
-
-def pytest_terminal_summary(terminalreporter):
-    durations = terminalreporter.config.option.durations
-    if durations is None:
-        return
-    tr = terminalreporter
-    dlist = []
-    for replist in tr.stats.values():
-        for rep in replist:
-            if hasattr(rep, 'duration'):
-                dlist.append(rep)
-    if not dlist:
-        return
-    dlist.sort(key=lambda x: x.duration)
-    dlist.reverse()
-    if not durations:
-        tr.write_sep("=", "slowest test durations")
-    else:
-        tr.write_sep("=", "slowest %s test durations" % durations)
-        dlist = dlist[:durations]
-
-    for rep in dlist:
-        nodeid = rep.nodeid.replace("::()::", "::")
-        tr.write_line("%02.2fs %-8s %s" %
-                      (rep.duration, rep.when, nodeid))
-
-
-def pytest_sessionstart(session):
-    session._setupstate = SetupState()
-
-
-def pytest_sessionfinish(session):
-    session._setupstate.teardown_all()
-
-
-def pytest_runtest_protocol(item, nextitem):
-    item.ihook.pytest_runtest_logstart(
-        nodeid=item.nodeid, location=item.location,
-    )
-    runtestprotocol(item, nextitem=nextitem)
-    return True
-
-
-def runtestprotocol(item, log=True, nextitem=None):
-    hasrequest = hasattr(item, "_request")
-    if hasrequest and not item._request:
-        item._initrequest()
-    rep = call_and_report(item, "setup", log)
-    reports = [rep]
-    if rep.passed:
-        if item.config.option.setupshow:
-            show_test_item(item)
-        if not item.config.option.setuponly:
-            reports.append(call_and_report(item, "call", log))
-    reports.append(call_and_report(item, "teardown", log,
-                                   nextitem=nextitem))
-    # after all teardown hooks have been called
-    # want funcargs and request info to go away
-    if hasrequest:
-        item._request = False
-        item.funcargs = None
-    return reports
-
-
-def show_test_item(item):
-    """Show test function, parameters and the fixtures of the test item."""
-    tw = item.config.get_terminal_writer()
-    tw.line()
-    tw.write(' ' * 8)
-    tw.write(item._nodeid)
-    used_fixtures = sorted(item._fixtureinfo.name2fixturedefs.keys())
-    if used_fixtures:
-        tw.write(' (fixtures used: {0})'.format(', '.join(used_fixtures)))
-
-
-def pytest_runtest_setup(item):
-    _update_current_test_var(item, 'setup')
-    item.session._setupstate.prepare(item)
-
-
-def pytest_runtest_call(item):
-    _update_current_test_var(item, 'call')
-    try:
-        item.runtest()
-    except Exception:
-        # Store trace info to allow postmortem debugging
-        type, value, tb = sys.exc_info()
-        tb = tb.tb_next  # Skip *this* frame
-        sys.last_type = type
-        sys.last_value = value
-        sys.last_traceback = tb
-        del tb  # Get rid of it in this namespace
-        raise
-
-
-def pytest_runtest_teardown(item, nextitem):
-    _update_current_test_var(item, 'teardown')
-    item.session._setupstate.teardown_exact(item, nextitem)
-    _update_current_test_var(item, None)
-
-
-def _update_current_test_var(item, when):
-    """
-    Update PYTEST_CURRENT_TEST to reflect the current item and stage.
-
-    If ``when`` is None, delete PYTEST_CURRENT_TEST from the environment.
-    """
-    var_name = 'PYTEST_CURRENT_TEST'
-    if when:
-        value = '{0} ({1})'.format(item.nodeid, when)
-        if _PY2:
-            # python 2 doesn't like null bytes on environment variables (see #2644)
-            value = value.replace('\x00', '(null)')
-        os.environ[var_name] = value
-    else:
-        os.environ.pop(var_name)
-
-
-def pytest_report_teststatus(report):
-    if report.when in ("setup", "teardown"):
-        if report.failed:
-            #      category, shortletter, verbose-word
-            return "error", "E", "ERROR"
-        elif report.skipped:
-            return "skipped", "s", "SKIPPED"
-        else:
-            return "", "", ""
-
-
-#
-# Implementation
-
-def call_and_report(item, when, log=True, **kwds):
-    call = call_runtest_hook(item, when, **kwds)
-    hook = item.ihook
-    report = hook.pytest_runtest_makereport(item=item, call=call)
-    if log:
-        hook.pytest_runtest_logreport(report=report)
-    if check_interactive_exception(call, report):
-        hook.pytest_exception_interact(node=item, call=call, report=report)
-    return report
-
-
-def check_interactive_exception(call, report):
-    return call.excinfo and not (
-        hasattr(report, "wasxfail") or
-        call.excinfo.errisinstance(skip.Exception) or
-        call.excinfo.errisinstance(bdb.BdbQuit))
-
-
-def call_runtest_hook(item, when, **kwds):
-    hookname = "pytest_runtest_" + when
-    ihook = getattr(item.ihook, hookname)
-    return CallInfo(lambda: ihook(item=item, **kwds), when=when)
-
-
-class CallInfo:
-    """ Result/Exception info a function invocation. """
-    #: None or ExceptionInfo object.
-    excinfo = None
-
-    def __init__(self, func, when):
-        #: context of invocation: one of "setup", "call",
-        #: "teardown", "memocollect"
-        self.when = when
-        self.start = time()
-        try:
-            self.result = func()
-        except KeyboardInterrupt:
-            self.stop = time()
-            raise
-        except:  # noqa
-            self.excinfo = ExceptionInfo()
-        self.stop = time()
-
-    def __repr__(self):
-        if self.excinfo:
-            status = "exception: %s" % str(self.excinfo.value)
-        else:
-            status = "result: %r" % (self.result,)
-        return "<CallInfo when=%r %s>" % (self.when, status)
-
-
-def getslaveinfoline(node):
-    try:
-        return node._slaveinfocache
-    except AttributeError:
-        d = node.slaveinfo
-        ver = "%s.%s.%s" % d['version_info'][:3]
-        node._slaveinfocache = s = "[%s] %s -- Python %s %s" % (
-            d['id'], d['sysplatform'], ver, d['executable'])
-        return s
-
-
-class BaseReport(object):
-
-    def __init__(self, **kw):
-        self.__dict__.update(kw)
-
-    def toterminal(self, out):
-        if hasattr(self, 'node'):
-            out.line(getslaveinfoline(self.node))
-
-        longrepr = self.longrepr
-        if longrepr is None:
-            return
-
-        if hasattr(longrepr, 'toterminal'):
-            longrepr.toterminal(out)
-        else:
-            try:
-                out.line(longrepr)
-            except UnicodeEncodeError:
-                out.line("<unprintable longrepr>")
-
-    def get_sections(self, prefix):
-        for name, content in self.sections:
-            if name.startswith(prefix):
-                yield prefix, content
-
-    @property
-    def longreprtext(self):
-        """
-        Read-only property that returns the full string representation
-        of ``longrepr``.
-
-        .. versionadded:: 3.0
-        """
-        tw = py.io.TerminalWriter(stringio=True)
-        tw.hasmarkup = False
-        self.toterminal(tw)
-        exc = tw.stringio.getvalue()
-        return exc.strip()
-
-    @property
-    def capstdout(self):
-        """Return captured text from stdout, if capturing is enabled
-
-        .. versionadded:: 3.0
-        """
-        return ''.join(content for (prefix, content) in self.get_sections('Captured stdout'))
-
-    @property
-    def capstderr(self):
-        """Return captured text from stderr, if capturing is enabled
-
-        .. versionadded:: 3.0
-        """
-        return ''.join(content for (prefix, content) in self.get_sections('Captured stderr'))
-
-    passed = property(lambda x: x.outcome == "passed")
-    failed = property(lambda x: x.outcome == "failed")
-    skipped = property(lambda x: x.outcome == "skipped")
-
-    @property
-    def fspath(self):
-        return self.nodeid.split("::")[0]
-
-
-def pytest_runtest_makereport(item, call):
-    when = call.when
-    duration = call.stop - call.start
-    keywords = dict([(x, 1) for x in item.keywords])
-    excinfo = call.excinfo
-    sections = []
-    if not call.excinfo:
-        outcome = "passed"
-        longrepr = None
-    else:
-        if not isinstance(excinfo, ExceptionInfo):
-            outcome = "failed"
-            longrepr = excinfo
-        elif excinfo.errisinstance(skip.Exception):
-            outcome = "skipped"
-            r = excinfo._getreprcrash()
-            longrepr = (str(r.path), r.lineno, r.message)
-        else:
-            outcome = "failed"
-            if call.when == "call":
-                longrepr = item.repr_failure(excinfo)
-            else:  # exception in setup or teardown
-                longrepr = item._repr_failure_py(excinfo,
-                                                 style=item.config.option.tbstyle)
-    for rwhen, key, content in item._report_sections:
-        sections.append(("Captured %s %s" % (key, rwhen), content))
-    return TestReport(item.nodeid, item.location,
-                      keywords, outcome, longrepr, when,
-                      sections, duration)
-
-
-class TestReport(BaseReport):
-    """ Basic test report object (also used for setup and teardown calls if
-    they fail).
-    """
-
-    def __init__(self, nodeid, location, keywords, outcome,
-                 longrepr, when, sections=(), duration=0, **extra):
-        #: normalized collection node id
-        self.nodeid = nodeid
-
-        #: a (filesystempath, lineno, domaininfo) tuple indicating the
-        #: actual location of a test item - it might be different from the
-        #: collected one e.g. if a method is inherited from a different module.
-        self.location = location
-
-        #: a name -> value dictionary containing all keywords and
-        #: markers associated with a test invocation.
-        self.keywords = keywords
-
-        #: test outcome, always one of "passed", "failed", "skipped".
-        self.outcome = outcome
-
-        #: None or a failure representation.
-        self.longrepr = longrepr
-
-        #: one of 'setup', 'call', 'teardown' to indicate runtest phase.
-        self.when = when
-
-        #: list of pairs ``(str, str)`` of extra information which needs to
-        #: marshallable. Used by pytest to add captured text
-        #: from ``stdout`` and ``stderr``, but may be used by other plugins
-        #: to add arbitrary information to reports.
-        self.sections = list(sections)
-
-        #: time it took to run just the test
-        self.duration = duration
-
-        self.__dict__.update(extra)
-
-    def __repr__(self):
-        return "<TestReport %r when=%r outcome=%r>" % (
-            self.nodeid, self.when, self.outcome)
-
-
-class TeardownErrorReport(BaseReport):
-    outcome = "failed"
-    when = "teardown"
-
-    def __init__(self, longrepr, **extra):
-        self.longrepr = longrepr
-        self.sections = []
-        self.__dict__.update(extra)
-
-
-def pytest_make_collect_report(collector):
-    call = CallInfo(
-        lambda: list(collector.collect()),
-        'collect')
-    longrepr = None
-    if not call.excinfo:
-        outcome = "passed"
-    else:
-        from _pytest import nose
-        skip_exceptions = (Skipped,) + nose.get_skip_exceptions()
-        if call.excinfo.errisinstance(skip_exceptions):
-            outcome = "skipped"
-            r = collector._repr_failure_py(call.excinfo, "line").reprcrash
-            longrepr = (str(r.path), r.lineno, r.message)
-        else:
-            outcome = "failed"
-            errorinfo = collector.repr_failure(call.excinfo)
-            if not hasattr(errorinfo, "toterminal"):
-                errorinfo = CollectErrorRepr(errorinfo)
-            longrepr = errorinfo
-    rep = CollectReport(collector.nodeid, outcome, longrepr,
-                        getattr(call, 'result', None))
-    rep.call = call  # see collect_one_node
-    return rep
-
-
-class CollectReport(BaseReport):
-    def __init__(self, nodeid, outcome, longrepr, result,
-                 sections=(), **extra):
-        self.nodeid = nodeid
-        self.outcome = outcome
-        self.longrepr = longrepr
-        self.result = result or []
-        self.sections = list(sections)
-        self.__dict__.update(extra)
-
-    @property
-    def location(self):
-        return (self.fspath, None, self.fspath)
-
-    def __repr__(self):
-        return "<CollectReport %r lenresult=%s outcome=%r>" % (
-            self.nodeid, len(self.result), self.outcome)
-
-
-class CollectErrorRepr(TerminalRepr):
-    def __init__(self, msg):
-        self.longrepr = msg
-
-    def toterminal(self, out):
-        out.line(self.longrepr, red=True)
-
-
-class SetupState(object):
-    """ shared state for setting up/tearing down test items or collectors. """
-
-    def __init__(self):
-        self.stack = []
-        self._finalizers = {}
-
-    def addfinalizer(self, finalizer, colitem):
-        """ attach a finalizer to the given colitem.
-        if colitem is None, this will add a finalizer that
-        is called at the end of teardown_all().
-        """
-        assert colitem and not isinstance(colitem, tuple)
-        assert py.builtin.callable(finalizer)
-        # assert colitem in self.stack  # some unit tests don't setup stack :/
-        self._finalizers.setdefault(colitem, []).append(finalizer)
-
-    def _pop_and_teardown(self):
-        colitem = self.stack.pop()
-        self._teardown_with_finalization(colitem)
-
-    def _callfinalizers(self, colitem):
-        finalizers = self._finalizers.pop(colitem, None)
-        exc = None
-        while finalizers:
-            fin = finalizers.pop()
-            try:
-                fin()
-            except TEST_OUTCOME:
-                # XXX Only first exception will be seen by user,
-                #     ideally all should be reported.
-                if exc is None:
-                    exc = sys.exc_info()
-        if exc:
-            py.builtin._reraise(*exc)
-
-    def _teardown_with_finalization(self, colitem):
-        self._callfinalizers(colitem)
-        if hasattr(colitem, "teardown"):
-            colitem.teardown()
-        for colitem in self._finalizers:
-            assert colitem is None or colitem in self.stack \
-                or isinstance(colitem, tuple)
-
-    def teardown_all(self):
-        while self.stack:
-            self._pop_and_teardown()
-        for key in list(self._finalizers):
-            self._teardown_with_finalization(key)
-        assert not self._finalizers
-
-    def teardown_exact(self, item, nextitem):
-        needed_collectors = nextitem and nextitem.listchain() or []
-        self._teardown_towards(needed_collectors)
-
-    def _teardown_towards(self, needed_collectors):
-        while self.stack:
-            if self.stack == needed_collectors[:len(self.stack)]:
-                break
-            self._pop_and_teardown()
-
-    def prepare(self, colitem):
-        """ setup objects along the collector chain to the test-method
-            and teardown previously setup objects."""
-        needed_collectors = colitem.listchain()
-        self._teardown_towards(needed_collectors)
-
-        # check if the last collection node has raised an error
-        for col in self.stack:
-            if hasattr(col, '_prepare_exc'):
-                py.builtin._reraise(*col._prepare_exc)
-        for col in needed_collectors[len(self.stack):]:
-            self.stack.append(col)
-            try:
-                col.setup()
-            except TEST_OUTCOME:
-                col._prepare_exc = sys.exc_info()
-                raise
-
-
-def collect_one_node(collector):
-    ihook = collector.ihook
-    ihook.pytest_collectstart(collector=collector)
-    rep = ihook.pytest_make_collect_report(collector=collector)
-    call = rep.__dict__.pop("call", None)
-    if call and check_interactive_exception(call, rep):
-        ihook.pytest_exception_interact(node=collector, call=call, report=rep)
-    return rep
deleted file mode 100644
--- a/third_party/python/pytest/_pytest/setuponly.py
+++ /dev/null
@@ -1,74 +0,0 @@
-from __future__ import absolute_import, division, print_function
-
-import pytest
-import sys
-
-
-def pytest_addoption(parser):
-    group = parser.getgroup("debugconfig")
-    group.addoption('--setuponly', '--setup-only', action="store_true",
-                    help="only setup fixtures, do not execute tests.")
-    group.addoption('--setupshow', '--setup-show', action="store_true",
-                    help="show setup of fixtures while executing tests.")
-
-
-@pytest.hookimpl(hookwrapper=True)
-def pytest_fixture_setup(fixturedef, request):
-    yield
-    config = request.config
-    if config.option.setupshow:
-        if hasattr(request, 'param'):
-            # Save the fixture parameter so ._show_fixture_action() can
-            # display it now and during the teardown (in .finish()).
-            if fixturedef.ids:
-                if callable(fixturedef.ids):
-                    fixturedef.cached_param = fixturedef.ids(request.param)
-                else:
-                    fixturedef.cached_param = fixturedef.ids[
-                        request.param_index]
-            else:
-                fixturedef.cached_param = request.param
-        _show_fixture_action(fixturedef, 'SETUP')
-
-
-def pytest_fixture_post_finalizer(fixturedef):
-    if hasattr(fixturedef, "cached_result"):
-        config = fixturedef._fixturemanager.config
-        if config.option.setupshow:
-            _show_fixture_action(fixturedef, 'TEARDOWN')
-            if hasattr(fixturedef, "cached_param"):
-                del fixturedef.cached_param
-
-
-def _show_fixture_action(fixturedef, msg):
-    config = fixturedef._fixturemanager.config
-    capman = config.pluginmanager.getplugin('capturemanager')
-    if capman:
-        out, err = capman.suspendcapture()
-
-    tw = config.get_terminal_writer()
-    tw.line()
-    tw.write(' ' * 2 * fixturedef.scopenum)
-    tw.write('{step} {scope} {fixture}'.format(
-        step=msg.ljust(8),  # align the output to TEARDOWN
-        scope=fixturedef.scope[0].upper(),
-        fixture=fixturedef.argname))
-
-    if msg == 'SETUP':
-        deps = sorted(arg for arg in fixturedef.argnames if arg != 'request')
-        if deps:
-            tw.write(' (fixtures used: {0})'.format(', '.join(deps)))
-
-    if hasattr(fixturedef, 'cached_param'):
-        tw.write('[{0}]'.format(fixturedef.cached_param))
-
-    if capman:
-        capman.resumecapture()
-        sys.stdout.write(out)
-        sys.stderr.write(err)
-
-
-@pytest.hookimpl(tryfirst=True)
-def pytest_cmdline_main(config):
-    if config.option.setuponly:
-        config.option.setupshow = True
deleted file mode 100644
--- a/third_party/python/pytest/_pytest/setupplan.py
+++ /dev/null
@@ -1,25 +0,0 @@
-from __future__ import absolute_import, division, print_function
-
-import pytest
-
-
-def pytest_addoption(parser):
-    group = parser.getgroup("debugconfig")
-    group.addoption('--setupplan', '--setup-plan', action="store_true",
-                    help="show what fixtures and tests would be executed but "
-                    "don't execute anything.")
-
-
-@pytest.hookimpl(tryfirst=True)
-def pytest_fixture_setup(fixturedef, request):
-    # Will return a dummy fixture if the setuponly option is provided.
-    if request.config.option.setupplan:
-        fixturedef.cached_result = (None, None, None)
-        return fixturedef.cached_result
-
-
-@pytest.hookimpl(tryfirst=True)
-def pytest_cmdline_main(config):
-    if config.option.setupplan:
-        config.option.setuponly = True
-        config.option.setupshow = True
deleted file mode 100644
--- a/third_party/python/pytest/_pytest/skipping.py
+++ /dev/null
@@ -1,372 +0,0 @@
-""" support for skip/xfail functions and markers. """
-from __future__ import absolute_import, division, print_function
-
-import os
-import sys
-import traceback
-
-import py
-from _pytest.config import hookimpl
-from _pytest.mark import MarkInfo, MarkDecorator
-from _pytest.outcomes import fail, skip, xfail, TEST_OUTCOME
-
-
-def pytest_addoption(parser):
-    group = parser.getgroup("general")
-    group.addoption('--runxfail',
-                    action="store_true", dest="runxfail", default=False,
-                    help="run tests even if they are marked xfail")
-
-    parser.addini("xfail_strict", "default for the strict parameter of xfail "
-                                  "markers when not given explicitly (default: "
-                                  "False)",
-                                  default=False,
-                                  type="bool")
-
-
-def pytest_configure(config):
-    if config.option.runxfail:
-        # yay a hack
-        import pytest
-        old = pytest.xfail
-        config._cleanup.append(lambda: setattr(pytest, "xfail", old))
-
-        def nop(*args, **kwargs):
-            pass
-
-        nop.Exception = xfail.Exception
-        setattr(pytest, "xfail", nop)
-
-    config.addinivalue_line("markers",
-                            "skip(reason=None): skip the given test function with an optional reason. "
-                            "Example: skip(reason=\"no way of currently testing this\") skips the "
-                            "test."
-                            )
-    config.addinivalue_line("markers",
-                            "skipif(condition): skip the given test function if eval(condition) "
-                            "results in a True value.  Evaluation happens within the "
-                            "module global context. Example: skipif('sys.platform == \"win32\"') "
-                            "skips the test if we are on the win32 platform. see "
-                            "http://pytest.org/latest/skipping.html"
-                            )
-    config.addinivalue_line("markers",
-                            "xfail(condition, reason=None, run=True, raises=None, strict=False): "
-                            "mark the test function as an expected failure if eval(condition) "
-                            "has a True value. Optionally specify a reason for better reporting "
-                            "and run=False if you don't even want to execute the test function. "
-                            "If only specific exception(s) are expected, you can list them in "
-                            "raises, and if the test fails in other ways, it will be reported as "
-                            "a true failure. See http://pytest.org/latest/skipping.html"
-                            )
-
-
-class MarkEvaluator:
-    def __init__(self, item, name):
-        self.item = item
-        self.name = name
-
-    @property
-    def holder(self):
-        return self.item.keywords.get(self.name)
-
-    def __bool__(self):
-        return bool(self.holder)
-    __nonzero__ = __bool__
-
-    def wasvalid(self):
-        return not hasattr(self, 'exc')
-
-    def invalidraise(self, exc):
-        raises = self.get('raises')
-        if not raises:
-            return
-        return not isinstance(exc, raises)
-
-    def istrue(self):
-        try:
-            return self._istrue()
-        except TEST_OUTCOME:
-            self.exc = sys.exc_info()
-            if isinstance(self.exc[1], SyntaxError):
-                msg = [" " * (self.exc[1].offset + 4) + "^", ]
-                msg.append("SyntaxError: invalid syntax")
-            else:
-                msg = traceback.format_exception_only(*self.exc[:2])
-            fail("Error evaluating %r expression\n"
-                 "    %s\n"
-                 "%s"
-                 % (self.name, self.expr, "\n".join(msg)),
-                 pytrace=False)
-
-    def _getglobals(self):
-        d = {'os': os, 'sys': sys, 'config': self.item.config}
-        if hasattr(self.item, 'obj'):
-            d.update(self.item.obj.__globals__)
-        return d
-
-    def _istrue(self):
-        if hasattr(self, 'result'):
-            return self.result
-        if self.holder:
-            if self.holder.args or 'condition' in self.holder.kwargs:
-                self.result = False
-                # "holder" might be a MarkInfo or a MarkDecorator; only
-                # MarkInfo keeps track of all parameters it received in an
-                # _arglist attribute
-                marks = getattr(self.holder, '_marks', None) \
-                    or [self.holder.mark]
-                for _, args, kwargs in marks:
-                    if 'condition' in kwargs:
-                        args = (kwargs['condition'],)
-                    for expr in args:
-                        self.expr = expr
-                        if isinstance(expr, py.builtin._basestring):
-                            d = self._getglobals()
-                            result = cached_eval(self.item.config, expr, d)
-                        else:
-                            if "reason" not in kwargs:
-                                # XXX better be checked at collection time
-                                msg = "you need to specify reason=STRING " \
-                                      "when using booleans as conditions."
-                                fail(msg)
-                            result = bool(expr)
-                        if result:
-                            self.result = True
-                            self.reason = kwargs.get('reason', None)
-                            self.expr = expr
-                            return self.result
-            else:
-                self.result = True
-        return getattr(self, 'result', False)
-
-    def get(self, attr, default=None):
-        return self.holder.kwargs.get(attr, default)
-
-    def getexplanation(self):
-        expl = getattr(self, 'reason', None) or self.get('reason', None)
-        if not expl:
-            if not hasattr(self, 'expr'):
-                return ""
-            else:
-                return "condition: " + str(self.expr)
-        return expl
-
-
-@hookimpl(tryfirst=True)
-def pytest_runtest_setup(item):
-    # Check if skip or skipif are specified as pytest marks
-
-    skipif_info = item.keywords.get('skipif')
-    if isinstance(skipif_info, (MarkInfo, MarkDecorator)):
-        eval_skipif = MarkEvaluator(item, 'skipif')
-        if eval_skipif.istrue():
-            item._evalskip = eval_skipif
-            skip(eval_skipif.getexplanation())
-
-    skip_info = item.keywords.get('skip')
-    if isinstance(skip_info, (MarkInfo, MarkDecorator)):
-        item._evalskip = True
-        if 'reason' in skip_info.kwargs:
-            skip(skip_info.kwargs['reason'])
-        elif skip_info.args:
-            skip(skip_info.args[0])
-        else:
-            skip("unconditional skip")
-
-    item._evalxfail = MarkEvaluator(item, 'xfail')
-    check_xfail_no_run(item)
-
-
-@hookimpl(hookwrapper=True)
-def pytest_pyfunc_call(pyfuncitem):
-    check_xfail_no_run(pyfuncitem)
-    outcome = yield
-    passed = outcome.excinfo is None
-    if passed:
-        check_strict_xfail(pyfuncitem)
-
-
-def check_xfail_no_run(item):
-    """check xfail(run=False)"""
-    if not item.config.option.runxfail:
-        evalxfail = item._evalxfail
-        if evalxfail.istrue():
-            if not evalxfail.get('run', True):
-                xfail("[NOTRUN] " + evalxfail.getexplanation())
-
-
-def check_strict_xfail(pyfuncitem):
-    """check xfail(strict=True) for the given PASSING test"""
-    evalxfail = pyfuncitem._evalxfail
-    if evalxfail.istrue():
-        strict_default = pyfuncitem.config.getini('xfail_strict')
-        is_strict_xfail = evalxfail.get('strict', strict_default)
-        if is_strict_xfail:
-            del pyfuncitem._evalxfail
-            explanation = evalxfail.getexplanation()
-            fail('[XPASS(strict)] ' + explanation, pytrace=False)
-
-
-@hookimpl(hookwrapper=True)
-def pytest_runtest_makereport(item, call):
-    outcome = yield
-    rep = outcome.get_result()
-    evalxfail = getattr(item, '_evalxfail', None)
-    evalskip = getattr(item, '_evalskip', None)
-    # unitttest special case, see setting of _unexpectedsuccess
-    if hasattr(item, '_unexpectedsuccess') and rep.when == "call":
-        from _pytest.compat import _is_unittest_unexpected_success_a_failure
-        if item._unexpectedsuccess:
-            rep.longrepr = "Unexpected success: {0}".format(item._unexpectedsuccess)
-        else:
-            rep.longrepr = "Unexpected success"
-        if _is_unittest_unexpected_success_a_failure():
-            rep.outcome = "failed"
-        else:
-            rep.outcome = "passed"
-            rep.wasxfail = rep.longrepr
-    elif item.config.option.runxfail:
-        pass   # don't interefere
-    elif call.excinfo and call.excinfo.errisinstance(xfail.Exception):
-        rep.wasxfail = "reason: " + call.excinfo.value.msg
-        rep.outcome = "skipped"
-    elif evalxfail and not rep.skipped and evalxfail.wasvalid() and \
-            evalxfail.istrue():
-        if call.excinfo:
-            if evalxfail.invalidraise(call.excinfo.value):
-                rep.outcome = "failed"
-            else:
-                rep.outcome = "skipped"
-                rep.wasxfail = evalxfail.getexplanation()
-        elif call.when == "call":
-            strict_default = item.config.getini('xfail_strict')
-            is_strict_xfail = evalxfail.get('strict', strict_default)
-            explanation = evalxfail.getexplanation()
-            if is_strict_xfail:
-                rep.outcome = "failed"
-                rep.longrepr = "[XPASS(strict)] {0}".format(explanation)
-            else:
-                rep.outcome = "passed"
-                rep.wasxfail = explanation
-    elif evalskip is not None and rep.skipped and type(rep.longrepr) is tuple:
-        # skipped by mark.skipif; change the location of the failure
-        # to point to the item definition, otherwise it will display
-        # the location of where the skip exception was raised within pytest
-        filename, line, reason = rep.longrepr
-        filename, line = item.location[:2]
-        rep.longrepr = filename, line, reason
-
-# called by terminalreporter progress reporting
-
-
-def pytest_report_teststatus(report):
-    if hasattr(report, "wasxfail"):
-        if report.skipped:
-            return "xfailed", "x", "xfail"
-        elif report.passed:
-            return "xpassed", "X", ("XPASS", {'yellow': True})
-
-# called by the terminalreporter instance/plugin
-
-
-def pytest_terminal_summary(terminalreporter):
-    tr = terminalreporter
-    if not tr.reportchars:
-        # for name in "xfailed skipped failed xpassed":
-        #    if not tr.stats.get(name, 0):
-        #        tr.write_line("HINT: use '-r' option to see extra "
-        #              "summary info about tests")
-        #        break
-        return
-
-    lines = []
-    for char in tr.reportchars:
-        if char == "x":
-            show_xfailed(terminalreporter, lines)
-        elif char == "X":
-            show_xpassed(terminalreporter, lines)
-        elif char in "fF":
-            show_simple(terminalreporter, lines, 'failed', "FAIL %s")
-        elif char in "sS":
-            show_skipped(terminalreporter, lines)
-        elif char == "E":
-            show_simple(terminalreporter, lines, 'error', "ERROR %s")
-        elif char == 'p':
-            show_simple(terminalreporter, lines, 'passed', "PASSED %s")
-
-    if lines:
-        tr._tw.sep("=", "short test summary info")
-        for line in lines:
-            tr._tw.line(line)
-
-
-def show_simple(terminalreporter, lines, stat, format):
-    failed = terminalreporter.stats.get(stat)
-    if failed:
-        for rep in failed:
-            pos = terminalreporter.config.cwd_relative_nodeid(rep.nodeid)
-            lines.append(format % (pos,))
-
-
-def show_xfailed(terminalreporter, lines):
-    xfailed = terminalreporter.stats.get("xfailed")
-    if xfailed:
-        for rep in xfailed:
-            pos = terminalreporter.config.cwd_relative_nodeid(rep.nodeid)
-            reason = rep.wasxfail
-            lines.append("XFAIL %s" % (pos,))
-            if reason:
-                lines.append("  " + str(reason))
-
-
-def show_xpassed(terminalreporter, lines):
-    xpassed = terminalreporter.stats.get("xpassed")
-    if xpassed:
-        for rep in xpassed:
-            pos = terminalreporter.config.cwd_relative_nodeid(rep.nodeid)
-            reason = rep.wasxfail
-            lines.append("XPASS %s %s" % (pos, reason))
-
-
-def cached_eval(config, expr, d):
-    if not hasattr(config, '_evalcache'):
-        config._evalcache = {}
-    try:
-        return config._evalcache[expr]
-    except KeyError:
-        import _pytest._code
-        exprcode = _pytest._code.compile(expr, mode="eval")
-        config._evalcache[expr] = x = eval(exprcode, d)
-        return x
-
-
-def folded_skips(skipped):
-    d = {}
-    for event in skipped:
-        key = event.longrepr
-        assert len(key) == 3, (event, key)
-        d.setdefault(key, []).append(event)
-    values = []
-    for key, events in d.items():
-        values.append((len(events),) + key)
-    return values
-
-
-def show_skipped(terminalreporter, lines):
-    tr = terminalreporter
-    skipped = tr.stats.get('skipped', [])
-    if skipped:
-        # if not tr.hasopt('skipped'):
-        #    tr.write_line(
-        #        "%d skipped tests, specify -rs for more info" %
-        #        len(skipped))
-        #    return
-        fskips = folded_skips(skipped)
-        if fskips:
-            # tr.write_sep("_", "skipped test summary")
-            for num, fspath, lineno, reason in fskips:
-                if reason.startswith("Skipped: "):
-                    reason = reason[9:]
-                lines.append(
-                    "SKIP [%d] %s:%d: %s" %
-                    (num, fspath, lineno + 1, reason))
deleted file mode 100644
--- a/third_party/python/pytest/_pytest/terminal.py
+++ /dev/null
@@ -1,650 +0,0 @@
-""" terminal reporting of the full testing process.
-
-This is a good source for looking at the various reporting hooks.
-"""
-from __future__ import absolute_import, division, print_function
-
-import itertools
-from _pytest.main import EXIT_OK, EXIT_TESTSFAILED, EXIT_INTERRUPTED, \
-    EXIT_USAGEERROR, EXIT_NOTESTSCOLLECTED
-import pytest
-import py
-import sys
-import time
-import platform
-
-from _pytest import nodes
-import _pytest._pluggy as pluggy
-
-
-def pytest_addoption(parser):
-    group = parser.getgroup("terminal reporting", "reporting", after="general")
-    group._addoption('-v', '--verbose', action="count",
-                     dest="verbose", default=0, help="increase verbosity."),
-    group._addoption('-q', '--quiet', action="count",
-                     dest="quiet", default=0, help="decrease verbosity."),
-    group._addoption('-r',
-                     action="store", dest="reportchars", default='', metavar="chars",
-                     help="show extra test summary info as specified by chars (f)ailed, "
-                     "(E)error, (s)skipped, (x)failed, (X)passed, "
-                     "(p)passed, (P)passed with output, (a)all except pP. "
-                     "Warnings are displayed at all times except when "
-                     "--disable-warnings is set")
-    group._addoption('--disable-warnings', '--disable-pytest-warnings', default=False,
-                     dest='disable_warnings', action='store_true',
-                     help='disable warnings summary')
-    group._addoption('-l', '--showlocals',
-                     action="store_true", dest="showlocals", default=False,
-                     help="show locals in tracebacks (disabled by default).")
-    group._addoption('--tb', metavar="style",
-                     action="store", dest="tbstyle", default='auto',
-                     choices=['auto', 'long', 'short', 'no', 'line', 'native'],
-                     help="traceback print mode (auto/long/short/line/native/no).")
-    group._addoption('--fulltrace', '--full-trace',
-                     action="store_true", default=False,
-                     help="don't cut any tracebacks (default is to cut).")
-    group._addoption('--color', metavar="color",
-                     action="store", dest="color", default='auto',
-                     choices=['yes', 'no', 'auto'],
-                     help="color terminal output (yes/no/auto).")
-
-
-def pytest_configure(config):
-    config.option.verbose -= config.option.quiet
-    reporter = TerminalReporter(config, sys.stdout)
-    config.pluginmanager.register(reporter, 'terminalreporter')
-    if config.option.debug or config.option.traceconfig:
-        def mywriter(tags, args):
-            msg = " ".join(map(str, args))
-            reporter.write_line("[traceconfig] " + msg)
-        config.trace.root.setprocessor("pytest:config", mywriter)
-
-
-def getreportopt(config):
-    reportopts = ""
-    reportchars = config.option.reportchars
-    if not config.option.disable_warnings and 'w' not in reportchars:
-        reportchars += 'w'
-    elif config.option.disable_warnings and 'w' in reportchars:
-        reportchars = reportchars.replace('w', '')
-    if reportchars:
-        for char in reportchars:
-            if char not in reportopts and char != 'a':
-                reportopts += char
-            elif char == 'a':
-                reportopts = 'fEsxXw'
-    return reportopts
-
-
-def pytest_report_teststatus(report):
-    if report.passed:
-        letter = "."
-    elif report.skipped:
-        letter = "s"
-    elif report.failed:
-        letter = "F"
-        if report.when != "call":
-            letter = "f"
-    return report.outcome, letter, report.outcome.upper()
-
-
-class WarningReport:
-    """
-    Simple structure to hold warnings information captured by ``pytest_logwarning``.
-    """
-
-    def __init__(self, code, message, nodeid=None, fslocation=None):
-        """
-        :param code: unused
-        :param str message: user friendly message about the warning
-        :param str|None nodeid: node id that generated the warning (see ``get_location``).
-        :param tuple|py.path.local fslocation:
-            file system location of the source of the warning (see ``get_location``).
-        """
-        self.code = code
-        self.message = message
-        self.nodeid = nodeid
-        self.fslocation = fslocation
-
-    def get_location(self, config):
-        """
-        Returns the more user-friendly information about the location
-        of a warning, or None.
-        """
-        if self.nodeid:
-            return self.nodeid
-        if self.fslocation:
-            if isinstance(self.fslocation, tuple) and len(self.fslocation) >= 2:
-                filename, linenum = self.fslocation[:2]
-                relpath = py.path.local(filename).relto(config.invocation_dir)
-                return '%s:%s' % (relpath, linenum)
-            else:
-                return str(self.fslocation)
-        return None
-
-
-class TerminalReporter:
-    def __init__(self, config, file=None):
-        import _pytest.config
-        self.config = config
-        self.verbosity = self.config.option.verbose
-        self.showheader = self.verbosity >= 0
-        self.showfspath = self.verbosity >= 0
-        self.showlongtestinfo = self.verbosity > 0
-        self._numcollected = 0
-
-        self.stats = {}
-        self.startdir = py.path.local()
-        if file is None:
-            file = sys.stdout
-        self._tw = self.writer = _pytest.config.create_terminal_writer(config,
-                                                                       file)
-        self.currentfspath = None
-        self.reportchars = getreportopt(config)
-        self.hasmarkup = self._tw.hasmarkup
-        self.isatty = file.isatty()
-
-    def hasopt(self, char):
-        char = {'xfailed': 'x', 'skipped': 's'}.get(char, char)
-        return char in self.reportchars
-
-    def write_fspath_result(self, nodeid, res):
-        fspath = self.config.rootdir.join(nodeid.split("::")[0])
-        if fspath != self.currentfspath:
-            self.currentfspath = fspath
-            fspath = self.startdir.bestrelpath(fspath)
-            self._tw.line()
-            self._tw.write(fspath + " ")
-        self._tw.write(res)
-
-    def write_ensure_prefix(self, prefix, extra="", **kwargs):
-        if self.currentfspath != prefix:
-            self._tw.line()
-            self.currentfspath = prefix
-            self._tw.write(prefix)
-        if extra:
-            self._tw.write(extra, **kwargs)
-            self.currentfspath = -2
-
-    def ensure_newline(self):
-        if self.currentfspath:
-            self._tw.line()
-            self.currentfspath = None
-
-    def write(self, content, **markup):
-        self._tw.write(content, **markup)
-
-    def write_line(self, line, **markup):
-        if not py.builtin._istext(line):
-            line = py.builtin.text(line, errors="replace")
-        self.ensure_newline()
-        self._tw.line(line, **markup)
-
-    def rewrite(self, line, **markup):
-        """
-        Rewinds the terminal cursor to the beginning and writes the given line.
-
-        :kwarg erase: if True, will also add spaces until the full terminal width to ensure
-            previous lines are properly erased.
-
-        The rest of the keyword arguments are markup instructions.
-        """
-        erase = markup.pop('erase', False)
-        if erase:
-            fill_count = self._tw.fullwidth - len(line)
-            fill = ' ' * fill_count
-        else:
-            fill = ''
-        line = str(line)
-        self._tw.write("\r" + line + fill, **markup)
-
-    def write_sep(self, sep, title=None, **markup):
-        self.ensure_newline()
-        self._tw.sep(sep, title, **markup)
-
-    def section(self, title, sep="=", **kw):
-        self._tw.sep(sep, title, **kw)
-
-    def line(self, msg, **kw):
-        self._tw.line(msg, **kw)
-
-    def pytest_internalerror(self, excrepr):
-        for line in py.builtin.text(excrepr).split("\n"):
-            self.write_line("INTERNALERROR> " + line)
-        return 1
-
-    def pytest_logwarning(self, code, fslocation, message, nodeid):
-        warnings = self.stats.setdefault("warnings", [])
-        warning = WarningReport(code=code, fslocation=fslocation,
-                                message=message, nodeid=nodeid)
-        warnings.append(warning)
-
-    def pytest_plugin_registered(self, plugin):
-        if self.config.option.traceconfig:
-            msg = "PLUGIN registered: %s" % (plugin,)
-            # XXX this event may happen during setup/teardown time
-            #     which unfortunately captures our output here
-            #     which garbles our output if we use self.write_line
-            self.write_line(msg)
-
-    def pytest_deselected(self, items):
-        self.stats.setdefault('deselected', []).extend(items)
-
-    def pytest_runtest_logstart(self, nodeid, location):
-        # ensure that the path is printed before the
-        # 1st test of a module starts running
-        if self.showlongtestinfo:
-            line = self._locationline(nodeid, *location)
-            self.write_ensure_prefix(line, "")
-        elif self.showfspath:
-            fsid = nodeid.split("::")[0]
-            self.write_fspath_result(fsid, "")
-
-    def pytest_runtest_logreport(self, report):
-        rep = report
-        res = self.config.hook.pytest_report_teststatus(report=rep)
-        cat, letter, word = res
-        self.stats.setdefault(cat, []).append(rep)
-        self._tests_ran = True
-        if not letter and not word:
-            # probably passed setup/teardown
-            return
-        if self.verbosity <= 0:
-            if not hasattr(rep, 'node') and self.showfspath:
-                self.write_fspath_result(rep.nodeid, letter)
-            else:
-                self._tw.write(letter)
-        else:
-            if isinstance(word, tuple):
-                word, markup = word
-            else:
-                if rep.passed:
-                    markup = {'green': True}
-                elif rep.failed:
-                    markup = {'red': True}
-                elif rep.skipped:
-                    markup = {'yellow': True}
-            line = self._locationline(rep.nodeid, *rep.location)
-            if not hasattr(rep, 'node'):
-                self.write_ensure_prefix(line, word, **markup)
-                # self._tw.write(word, **markup)
-            else:
-                self.ensure_newline()
-                if hasattr(rep, 'node'):
-                    self._tw.write("[%s] " % rep.node.gateway.id)
-                self._tw.write(word, **markup)
-                self._tw.write(" " + line)
-                self.currentfspath = -2
-
-    def pytest_collection(self):
-        if not self.isatty and self.config.option.verbose >= 1:
-            self.write("collecting ... ", bold=True)
-
-    def pytest_collectreport(self, report):
-        if report.failed:
-            self.stats.setdefault("error", []).append(report)
-        elif report.skipped:
-            self.stats.setdefault("skipped", []).append(report)
-        items = [x for x in report.result if isinstance(x, pytest.Item)]
-        self._numcollected += len(items)
-        if self.isatty:
-            # self.write_fspath_result(report.nodeid, 'E')
-            self.report_collect()
-
-    def report_collect(self, final=False):
-        if self.config.option.verbose < 0:
-            return
-
-        errors = len(self.stats.get('error', []))
-        skipped = len(self.stats.get('skipped', []))
-        if final:
-            line = "collected "
-        else:
-            line = "collecting "
-        line += str(self._numcollected) + " item" + ('' if self._numcollected == 1 else 's')
-        if errors:
-            line += " / %d errors" % errors
-        if skipped:
-            line += " / %d skipped" % skipped
-        if self.isatty:
-            self.rewrite(line, bold=True, erase=True)
-            if final:
-                self.write('\n')
-        else:
-            self.write_line(line)
-
-    def pytest_collection_modifyitems(self):
-        self.report_collect(True)
-
-    @pytest.hookimpl(trylast=True)
-    def pytest_sessionstart(self, session):
-        self._sessionstarttime = time.time()
-        if not self.showheader:
-            return
-        self.write_sep("=", "test session starts", bold=True)
-        verinfo = platform.python_version()
-        msg = "platform %s -- Python %s" % (sys.platform, verinfo)
-        if hasattr(sys, 'pypy_version_info'):
-            verinfo = ".".join(map(str, sys.pypy_version_info[:3]))
-            msg += "[pypy-%s-%s]" % (verinfo, sys.pypy_version_info[3])
-        msg += ", pytest-%s, py-%s, pluggy-%s" % (
-               pytest.__version__, py.__version__, pluggy.__version__)
-        if self.verbosity > 0 or self.config.option.debug or \
-           getattr(self.config.option, 'pastebin', None):
-            msg += " -- " + str(sys.executable)
-        self.write_line(msg)
-        lines = self.config.hook.pytest_report_header(
-            config=self.config, startdir=self.startdir)
-        self._write_report_lines_from_hooks(lines)
-
-    def _write_report_lines_from_hooks(self, lines):
-        lines.reverse()
-        for line in flatten(lines):
-            self.write_line(line)
-
-    def pytest_report_header(self, config):
-        inifile = ""
-        if config.inifile:
-            inifile = " " + config.rootdir.bestrelpath(config.inifile)
-        lines = ["rootdir: %s, inifile:%s" % (config.rootdir, inifile)]
-
-        plugininfo = config.pluginmanager.list_plugin_distinfo()
-        if plugininfo:
-
-            lines.append(
-                "plugins: %s" % ", ".join(_plugin_nameversions(plugininfo)))
-        return lines
-
-    def pytest_collection_finish(self, session):
-        if self.config.option.collectonly:
-            self._printcollecteditems(session.items)
-            if self.stats.get('failed'):
-                self._tw.sep("!", "collection failures")
-                for rep in self.stats.get('failed'):
-                    rep.toterminal(self._tw)
-                return 1
-            return 0
-        lines = self.config.hook.pytest_report_collectionfinish(
-            config=self.config, startdir=self.startdir, items=session.items)
-        self._write_report_lines_from_hooks(lines)
-
-    def _printcollecteditems(self, items):
-        # to print out items and their parent collectors
-        # we take care to leave out Instances aka ()
-        # because later versions are going to get rid of them anyway
-        if self.config.option.verbose < 0:
-            if self.config.option.verbose < -1:
-                counts = {}
-                for item in items:
-                    name = item.nodeid.split('::', 1)[0]
-                    counts[name] = counts.get(name, 0) + 1
-                for name, count in sorted(counts.items()):
-                    self._tw.line("%s: %d" % (name, count))
-            else:
-                for item in items:
-                    nodeid = item.nodeid
-                    nodeid = nodeid.replace("::()::", "::")
-                    self._tw.line(nodeid)
-            return
-        stack = []
-        indent = ""
-        for item in items:
-            needed_collectors = item.listchain()[1:]  # strip root node
-            while stack:
-                if stack == needed_collectors[:len(stack)]:
-                    break
-                stack.pop()
-            for col in needed_collectors[len(stack):]:
-                stack.append(col)
-                # if col.name == "()":
-                #    continue
-                indent = (len(stack) - 1) * "  "
-                self._tw.line("%s%s" % (indent, col))
-
-    @pytest.hookimpl(hookwrapper=True)
-    def pytest_sessionfinish(self, exitstatus):
-        outcome = yield
-        outcome.get_result()
-        self._tw.line("")
-        summary_exit_codes = (
-            EXIT_OK, EXIT_TESTSFAILED, EXIT_INTERRUPTED, EXIT_USAGEERROR,
-            EXIT_NOTESTSCOLLECTED)
-        if exitstatus in summary_exit_codes:
-            self.config.hook.pytest_terminal_summary(terminalreporter=self,
-                                                     exitstatus=exitstatus)
-            self.summary_errors()
-            self.summary_failures()
-            self.summary_warnings()
-            self.summary_passes()
-        if exitstatus == EXIT_INTERRUPTED:
-            self._report_keyboardinterrupt()
-            del self._keyboardinterrupt_memo
-        self.summary_deselected()
-        self.summary_stats()
-
-    def pytest_keyboard_interrupt(self, excinfo):
-        self._keyboardinterrupt_memo = excinfo.getrepr(funcargs=True)
-
-    def pytest_unconfigure(self):
-        if hasattr(self, '_keyboardinterrupt_memo'):
-            self._report_keyboardinterrupt()
-
-    def _report_keyboardinterrupt(self):
-        excrepr = self._keyboardinterrupt_memo
-        msg = excrepr.reprcrash.message
-        self.write_sep("!", msg)
-        if "KeyboardInterrupt" in msg:
-            if self.config.option.fulltrace:
-                excrepr.toterminal(self._tw)
-            else:
-                self._tw.line("to show a full traceback on KeyboardInterrupt use --fulltrace", yellow=True)
-                excrepr.reprcrash.toterminal(self._tw)
-
-    def _locationline(self, nodeid, fspath, lineno, domain):
-        def mkrel(nodeid):
-            line = self.config.cwd_relative_nodeid(nodeid)
-            if domain and line.endswith(domain):
-                line = line[:-len(domain)]
-                values = domain.split("[")
-                values[0] = values[0].replace('.', '::')  # don't replace '.' in params
-                line += "[".join(values)
-            return line
-        # collect_fspath comes from testid which has a "/"-normalized path
-
-        if fspath:
-            res = mkrel(nodeid).replace("::()", "")  # parens-normalization
-            if nodeid.split("::")[0] != fspath.replace("\\", nodes.SEP):
-                res += " <- " + self.startdir.bestrelpath(fspath)
-        else:
-            res = "[location]"
-        return res + " "
-
-    def _getfailureheadline(self, rep):
-        if hasattr(rep, 'location'):
-            fspath, lineno, domain = rep.location
-            return domain
-        else:
-            return "test session"  # XXX?
-
-    def _getcrashline(self, rep):
-        try:
-            return str(rep.longrepr.reprcrash)
-        except AttributeError:
-            try:
-                return str(rep.longrepr)[:50]
-            except AttributeError:
-                return ""
-
-    #
-    # summaries for sessionfinish
-    #
-    def getreports(self, name):
-        values = []
-        for x in self.stats.get(name, []):
-            if not hasattr(x, '_pdbshown'):
-                values.append(x)
-        return values
-
-    def summary_warnings(self):
-        if self.hasopt("w"):
-            all_warnings = self.stats.get("warnings")
-            if not all_warnings:
-                return
-
-            grouped = itertools.groupby(all_warnings, key=lambda wr: wr.get_location(self.config))
-
-            self.write_sep("=", "warnings summary", yellow=True, bold=False)
-            for location, warnings in grouped:
-                self._tw.line(str(location) or '<undetermined location>')
-                for w in warnings:
-                    lines = w.message.splitlines()
-                    indented = '\n'.join('  ' + x for x in lines)
-                    self._tw.line(indented)
-                self._tw.line()
-            self._tw.line('-- Docs: http://doc.pytest.org/en/latest/warnings.html')
-
-    def summary_passes(self):
-        if self.config.option.tbstyle != "no":
-            if self.hasopt("P"):
-                reports = self.getreports('passed')
-                if not reports:
-                    return
-                self.write_sep("=", "PASSES")
-                for rep in reports:
-                    msg = self._getfailureheadline(rep)
-                    self.write_sep("_", msg)
-                    self._outrep_summary(rep)
-
-    def print_teardown_sections(self, rep):
-        for secname, content in rep.sections:
-            if 'teardown' in secname:
-                self._tw.sep('-', secname)
-                if content[-1:] == "\n":
-                    content = content[:-1]
-                self._tw.line(content)
-
-    def summary_failures(self):
-        if self.config.option.tbstyle != "no":
-            reports = self.getreports('failed')
-            if not reports:
-                return
-            self.write_sep("=", "FAILURES")
-            for rep in reports:
-                if self.config.option.tbstyle == "line":
-                    line = self._getcrashline(rep)
-                    self.write_line(line)
-                else:
-                    msg = self._getfailureheadline(rep)
-                    markup = {'red': True, 'bold': True}
-                    self.write_sep("_", msg, **markup)
-                    self._outrep_summary(rep)
-                    for report in self.getreports(''):
-                        if report.nodeid == rep.nodeid and report.when == 'teardown':
-                            self.print_teardown_sections(report)
-
-    def summary_errors(self):
-        if self.config.option.tbstyle != "no":
-            reports = self.getreports('error')
-            if not reports:
-                return
-            self.write_sep("=", "ERRORS")
-            for rep in self.stats['error']:
-                msg = self._getfailureheadline(rep)
-                if not hasattr(rep, 'when'):
-                    # collect
-                    msg = "ERROR collecting " + msg
-                elif rep.when == "setup":
-                    msg = "ERROR at setup of " + msg
-                elif rep.when == "teardown":
-                    msg = "ERROR at teardown of " + msg
-                self.write_sep("_", msg)
-                self._outrep_summary(rep)
-
-    def _outrep_summary(self, rep):
-        rep.toterminal(self._tw)
-        for secname, content in rep.sections:
-            self._tw.sep("-", secname)
-            if content[-1:] == "\n":
-                content = content[:-1]
-            self._tw.line(content)
-
-    def summary_stats(self):
-        session_duration = time.time() - self._sessionstarttime
-        (line, color) = build_summary_stats_line(self.stats)
-        msg = "%s in %.2f seconds" % (line, session_duration)
-        markup = {color: True, 'bold': True}
-
-        if self.verbosity >= 0:
-            self.write_sep("=", msg, **markup)
-        if self.verbosity == -1:
-            self.write_line(msg, **markup)
-
-    def summary_deselected(self):
-        if 'deselected' in self.stats:
-            self.write_sep("=", "%d tests deselected" % (
-                len(self.stats['deselected'])), bold=True)
-
-
-def repr_pythonversion(v=None):
-    if v is None:
-        v = sys.version_info
-    try:
-        return "%s.%s.%s-%s-%s" % v
-    except (TypeError, ValueError):
-        return str(v)
-
-
-def flatten(values):
-    for x in values:
-        if isinstance(x, (list, tuple)):
-            for y in flatten(x):
-                yield y
-        else:
-            yield x
-
-
-def build_summary_stats_line(stats):
-    keys = ("failed passed skipped deselected "
-            "xfailed xpassed warnings error").split()
-    unknown_key_seen = False
-    for key in stats.keys():
-        if key not in keys:
-            if key:  # setup/teardown reports have an empty key, ignore them
-                keys.append(key)
-                unknown_key_seen = True
-    parts = []
-    for key in keys:
-        val = stats.get(key, None)
-        if val:
-            parts.append("%d %s" % (len(val), key))
-
-    if parts:
-        line = ", ".join(parts)
-    else:
-        line = "no tests ran"
-
-    if 'failed' in stats or 'error' in stats:
-        color = 'red'
-    elif 'warnings' in stats or unknown_key_seen:
-        color = 'yellow'
-    elif 'passed' in stats:
-        color = 'green'
-    else:
-        color = 'yellow'
-
-    return (line, color)
-
-
-def _plugin_nameversions(plugininfo):
-    values = []
-    for plugin, dist in plugininfo:
-        # gets us name and version!
-        name = '{dist.project_name}-{dist.version}'.format(dist=dist)
-        # questionable convenience, but it keeps things short
-        if name.startswith("pytest-"):
-            name = name[7:]
-        # we decided to print python package names
-        # they can have more than one plugin
-        if name not in values:
-            values.append(name)
-    return values
deleted file mode 100644
--- a/third_party/python/pytest/_pytest/tmpdir.py
+++ /dev/null
@@ -1,126 +0,0 @@
-""" support for providing temporary directories to test functions.  """
-from __future__ import absolute_import, division, print_function
-
-import re
-
-import pytest
-import py
-from _pytest.monkeypatch import MonkeyPatch
-
-
-class TempdirFactory:
-    """Factory for temporary directories under the common base temp directory.
-
-    The base directory can be configured using the ``--basetemp`` option.
-    """
-
-    def __init__(self, config):
-        self.config = config
-        self.trace = config.trace.get("tmpdir")
-
-    def ensuretemp(self, string, dir=1):
-        """ (deprecated) return temporary directory path with
-            the given string as the trailing part.  It is usually
-            better to use the 'tmpdir' function argument which
-            provides an empty unique-per-test-invocation directory
-            and is guaranteed to be empty.
-        """
-        # py.log._apiwarn(">1.1", "use tmpdir function argument")
-        return self.getbasetemp().ensure(string, dir=dir)
-
-    def mktemp(self, basename, numbered=True):
-        """Create a subdirectory of the base temporary directory and return it.
-        If ``numbered``, ensure the directory is unique by adding a number
-        prefix greater than any existing one.
-        """
-        basetemp = self.getbasetemp()
-        if not numbered:
-            p = basetemp.mkdir(basename)
-        else:
-            p = py.path.local.make_numbered_dir(prefix=basename,
-                                                keep=0, rootdir=basetemp, lock_timeout=None)
-        self.trace("mktemp", p)
-        return p
-
-    def getbasetemp(self):
-        """ return base temporary directory. """
-        try:
-            return self._basetemp
-        except AttributeError:
-            basetemp = self.config.option.basetemp
-            if basetemp:
-                basetemp = py.path.local(basetemp)
-                if basetemp.check():
-                    basetemp.remove()
-                basetemp.mkdir()
-            else:
-                temproot = py.path.local.get_temproot()
-                user = get_user()
-                if user:
-                    # use a sub-directory in the temproot to speed-up
-                    # make_numbered_dir() call
-                    rootdir = temproot.join('pytest-of-%s' % user)
-                else:
-                    rootdir = temproot
-                rootdir.ensure(dir=1)
-                basetemp = py.path.local.make_numbered_dir(prefix='pytest-',
-                                                           rootdir=rootdir)
-            self._basetemp = t = basetemp.realpath()
-            self.trace("new basetemp", t)
-            return t
-
-    def finish(self):
-        self.trace("finish")
-
-
-def get_user():
-    """Return the current user name, or None if getuser() does not work
-    in the current environment (see #1010).
-    """
-    import getpass
-    try:
-        return getpass.getuser()
-    except (ImportError, KeyError):
-        return None
-
-
-# backward compatibility
-TempdirHandler = TempdirFactory
-
-
-def pytest_configure(config):
-    """Create a TempdirFactory and attach it to the config object.
-
-    This is to comply with existing plugins which expect the handler to be
-    available at pytest_configure time, but ideally should be moved entirely
-    to the tmpdir_factory session fixture.
-    """
-    mp = MonkeyPatch()
-    t = TempdirFactory(config)
-    config._cleanup.extend([mp.undo, t.finish])
-    mp.setattr(config, '_tmpdirhandler', t, raising=False)
-    mp.setattr(pytest, 'ensuretemp', t.ensuretemp, raising=False)
-
-
-@pytest.fixture(scope='session')
-def tmpdir_factory(request):
-    """Return a TempdirFactory instance for the test session.
-    """
-    return request.config._tmpdirhandler
-
-
-@pytest.fixture
-def tmpdir(request, tmpdir_factory):
-    """Return a temporary directory path object
-    which is unique to each test function invocation,
-    created as a sub directory of the base temporary
-    directory.  The returned object is a `py.path.local`_
-    path object.
-    """
-    name = request.node.name
-    name = re.sub(r"[\W]", "_", name)
-    MAXVAL = 30
-    if len(name) > MAXVAL:
-        name = name[:MAXVAL]
-    x = tmpdir_factory.mktemp(name, numbered=True)
-    return x
deleted file mode 100644
--- a/third_party/python/pytest/_pytest/unittest.py
+++ /dev/null
@@ -1,239 +0,0 @@
-""" discovery and running of std-library "unittest" style tests. """
-from __future__ import absolute_import, division, print_function
-
-import sys
-import traceback
-
-# for transferring markers
-import _pytest._code
-from _pytest.config import hookimpl
-from _pytest.outcomes import fail, skip, xfail
-from _pytest.python import transfer_markers, Class, Module, Function
-from _pytest.skipping import MarkEvaluator
-
-
-def pytest_pycollect_makeitem(collector, name, obj):
-    # has unittest been imported and is obj a subclass of its TestCase?
-    try:
-        if not issubclass(obj, sys.modules["unittest"].TestCase):
-            return
-    except Exception:
-        return
-    # yes, so let's collect it
-    return UnitTestCase(name, parent=collector)
-
-
-class UnitTestCase(Class):
-    # marker for fixturemanger.getfixtureinfo()
-    # to declare that our children do not support funcargs
-    nofuncargs = True
-
-    def setup(self):
-        cls = self.obj
-        if getattr(cls, '__unittest_skip__', False):
-            return  # skipped
-        setup = getattr(cls, 'setUpClass', None)
-        if setup is not None:
-            setup()
-        teardown = getattr(cls, 'tearDownClass', None)
-        if teardown is not None:
-            self.addfinalizer(teardown)
-        super(UnitTestCase, self).setup()
-
-    def collect(self):
-        from unittest import TestLoader
-        cls = self.obj
-        if not getattr(cls, "__test__", True):
-            return
-        self.session._fixturemanager.parsefactories(self, unittest=True)
-        loader = TestLoader()
-        module = self.getparent(Module).obj
-        foundsomething = False
-        for name in loader.getTestCaseNames(self.obj):
-            x = getattr(self.obj, name)
-            if not getattr(x, '__test__', True):
-                continue
-            funcobj = getattr(x, 'im_func', x)
-            transfer_markers(funcobj, cls, module)
-            yield TestCaseFunction(name, parent=self)
-            foundsomething = True
-
-        if not foundsomething:
-            runtest = getattr(self.obj, 'runTest', None)
-            if runtest is not None:
-                ut = sys.modules.get("twisted.trial.unittest", None)
-                if ut is None or runtest != ut.TestCase.runTest:
-                    yield TestCaseFunction('runTest', parent=self)
-
-
-class TestCaseFunction(Function):
-    _excinfo = None
-
-    def setup(self):
-        self._testcase = self.parent.obj(self.name)
-        self._fix_unittest_skip_decorator()
-        self._obj = getattr(self._testcase, self.name)
-        if hasattr(self._testcase, 'setup_method'):
-            self._testcase.setup_method(self._obj)
-        if hasattr(self, "_request"):
-            self._request._fillfixtures()
-
-    def _fix_unittest_skip_decorator(self):
-        """
-        The @unittest.skip decorator calls functools.wraps(self._testcase)
-        The call to functools.wraps() fails unless self._testcase
-        has a __name__ attribute. This is usually automatically supplied
-        if the test is a function or method, but we need to add manually
-        here.
-
-        See issue #1169
-        """
-        if sys.version_info[0] == 2:
-            setattr(self._testcase, "__name__", self.name)
-
-    def teardown(self):
-        if hasattr(self._testcase, 'teardown_method'):
-            self._testcase.teardown_method(self._obj)
-        # Allow garbage collection on TestCase instance attributes.
-        self._testcase = None
-        self._obj = None
-
-    def startTest(self, testcase):
-        pass
-
-    def _addexcinfo(self, rawexcinfo):
-        # unwrap potential exception info (see twisted trial support below)
-        rawexcinfo = getattr(rawexcinfo, '_rawexcinfo', rawexcinfo)
-        try:
-            excinfo = _pytest._code.ExceptionInfo(rawexcinfo)
-        except TypeError:
-            try:
-                try:
-                    values = traceback.format_exception(*rawexcinfo)
-                    values.insert(0, "NOTE: Incompatible Exception Representation, "
-                                  "displaying natively:\n\n")
-                    fail("".join(values), pytrace=False)
-                except (fail.Exception, KeyboardInterrupt):
-                    raise
-                except:  # noqa
-                    fail("ERROR: Unknown Incompatible Exception "
-                         "representation:\n%r" % (rawexcinfo,), pytrace=False)
-            except KeyboardInterrupt:
-                raise
-            except fail.Exception:
-                excinfo = _pytest._code.ExceptionInfo()
-        self.__dict__.setdefault('_excinfo', []).append(excinfo)
-
-    def addError(self, testcase, rawexcinfo):
-        self._addexcinfo(rawexcinfo)
-
-    def addFailure(self, testcase, rawexcinfo):
-        self._addexcinfo(rawexcinfo)
-
-    def addSkip(self, testcase, reason):
-        try:
-            skip(reason)
-        except skip.Exception:
-            self._evalskip = MarkEvaluator(self, 'SkipTest')
-            self._evalskip.result = True
-            self._addexcinfo(sys.exc_info())
-
-    def addExpectedFailure(self, testcase, rawexcinfo, reason=""):
-        try:
-            xfail(str(reason))
-        except xfail.Exception:
-            self._addexcinfo(sys.exc_info())
-
-    def addUnexpectedSuccess(self, testcase, reason=""):
-        self._unexpectedsuccess = reason
-
-    def addSuccess(self, testcase):
-        pass
-
-    def stopTest(self, testcase):
-        pass
-
-    def _handle_skip(self):
-        # implements the skipping machinery (see #2137)
-        # analog to pythons Lib/unittest/case.py:run
-        testMethod = getattr(self._testcase, self._testcase._testMethodName)
-        if (getattr(self._testcase.__class__, "__unittest_skip__", False) or
-                getattr(testMethod, "__unittest_skip__", False)):
-            # If the class or method was skipped.
-            skip_why = (getattr(self._testcase.__class__, '__unittest_skip_why__', '') or
-                        getattr(testMethod, '__unittest_skip_why__', ''))
-            try:  # PY3, unittest2 on PY2
-                self._testcase._addSkip(self, self._testcase, skip_why)
-            except TypeError:  # PY2
-                if sys.version_info[0] != 2:
-                    raise
-                self._testcase._addSkip(self, skip_why)
-            return True
-        return False
-
-    def runtest(self):
-        if self.config.pluginmanager.get_plugin("pdbinvoke") is None:
-            self._testcase(result=self)
-        else:
-            # disables tearDown and cleanups for post mortem debugging (see #1890)
-            if self._handle_skip():
-                return
-            self._testcase.debug()
-
-    def _prunetraceback(self, excinfo):
-        Function._prunetraceback(self, excinfo)
-        traceback = excinfo.traceback.filter(
-            lambda x: not x.frame.f_globals.get('__unittest'))
-        if traceback:
-            excinfo.traceback = traceback
-
-
-@hookimpl(tryfirst=True)
-def pytest_runtest_makereport(item, call):
-    if isinstance(item, TestCaseFunction):
-        if item._excinfo:
-            call.excinfo = item._excinfo.pop(0)
-            try:
-                del call.result
-            except AttributeError:
-                pass
-
-# twisted trial support
-
-
-@hookimpl(hookwrapper=True)
-def pytest_runtest_protocol(item):
-    if isinstance(item, TestCaseFunction) and \
-       'twisted.trial.unittest' in sys.modules:
-        ut = sys.modules['twisted.python.failure']
-        Failure__init__ = ut.Failure.__init__
-        check_testcase_implements_trial_reporter()
-
-        def excstore(self, exc_value=None, exc_type=None, exc_tb=None,
-                     captureVars=None):
-            if exc_value is None:
-                self._rawexcinfo = sys.exc_info()
-            else:
-                if exc_type is None:
-                    exc_type = type(exc_value)
-                self._rawexcinfo = (exc_type, exc_value, exc_tb)
-            try:
-                Failure__init__(self, exc_value, exc_type, exc_tb,
-                                captureVars=captureVars)
-            except TypeError:
-                Failure__init__(self, exc_value, exc_type, exc_tb)
-
-        ut.Failure.__init__ = excstore
-        yield
-        ut.Failure.__init__ = Failure__init__
-    else:
-        yield
-
-
-def check_testcase_implements_trial_reporter(done=[]):
-    if done:
-        return
-    from zope.interface import classImplements
-    from twisted.trial.itrial import IReporter
-    classImplements(TestCaseFunction, IReporter)
-    done.append(1)
deleted file mode 100644
--- a/third_party/python/pytest/_pytest/vendored_packages/README.md
+++ /dev/null
@@ -1,13 +0,0 @@
-This directory vendors the `pluggy` module.
-
-For a more detailed discussion for the reasons to vendoring this 
-package, please see [this issue](https://github.com/pytest-dev/pytest/issues/944).
-
-To update the current version, execute:
-
-```
-$ pip install -U pluggy==<version> --no-compile --target=_pytest/vendored_packages
-```
-
-And commit the modified files. The `pluggy-<version>.dist-info` directory 
-created by `pip` should be added as well.
deleted file mode 100644
deleted file mode 100644
--- a/third_party/python/pytest/_pytest/vendored_packages/pluggy-0.4.0.dist-info/DESCRIPTION.rst
+++ /dev/null
@@ -1,11 +0,0 @@
-
-Plugin registration and hook calling for Python
-===============================================
-
-This is the plugin manager as used by pytest but stripped
-of pytest specific details.
-
-During the 0.x series this plugin does not have much documentation
-except extensive docstrings in the pluggy.py module.
-
-
deleted file mode 100644
--- a/third_party/python/pytest/_pytest/vendored_packages/pluggy-0.4.0.dist-info/INSTALLER
+++ /dev/null
@@ -1,1 +0,0 @@
-pip
deleted file mode 100644
--- a/third_party/python/pytest/_pytest/vendored_packages/pluggy-0.4.0.dist-info/METADATA
+++ /dev/null
@@ -1,40 +0,0 @@
-Metadata-Version: 2.0
-Name: pluggy
-Version: 0.4.0
-Summary: plugin and hook calling mechanisms for python
-Home-page: https://github.com/pytest-dev/pluggy
-Author: Holger Krekel
-Author-email: holger at merlinux.eu
-License: MIT license
-Platform: unix
-Platform: linux
-Platform: osx
-Platform: win32
-Classifier: Development Status :: 4 - Beta
-Classifier: Intended Audience :: Developers
-Classifier: License :: OSI Approved :: MIT License
-Classifier: Operating System :: POSIX
-Classifier: Operating System :: Microsoft :: Windows
-Classifier: Operating System :: MacOS :: MacOS X
-Classifier: Topic :: Software Development :: Testing
-Classifier: Topic :: Software Development :: Libraries
-Classifier: Topic :: Utilities
-Classifier: Programming Language :: Python :: 2
-Classifier: Programming Language :: Python :: 2.6
-Classifier: Programming Language :: Python :: 2.7
-Classifier: Programming Language :: Python :: 3
-Classifier: Programming Language :: Python :: 3.3
-Classifier: Programming Language :: Python :: 3.4
-Classifier: Programming Language :: Python :: 3.5
-
-
-Plugin registration and hook calling for Python
-===============================================
-
-This is the plugin manager as used by pytest but stripped
-of pytest specific details.
-
-During the 0.x series this plugin does not have much documentation
-except extensive docstrings in the pluggy.py module.
-
-
deleted file mode 100644
--- a/third_party/python/pytest/_pytest/vendored_packages/pluggy-0.4.0.dist-info/RECORD
+++ /dev/null
@@ -1,9 +0,0 @@
-pluggy.py,sha256=u0oG9cv-oLOkNvEBlwnnu8pp1AyxpoERgUO00S3rvpQ,31543
-pluggy-0.4.0.dist-info/DESCRIPTION.rst,sha256=ltvjkFd40LW_xShthp6RRVM6OB_uACYDFR3kTpKw7o4,307
-pluggy-0.4.0.dist-info/LICENSE.txt,sha256=ruwhUOyV1HgE9F35JVL9BCZ9vMSALx369I4xq9rhpkM,1134
-pluggy-0.4.0.dist-info/METADATA,sha256=pe2hbsqKFaLHC6wAQPpFPn0KlpcPfLBe_BnS4O70bfk,1364
-pluggy-0.4.0.dist-info/RECORD,,
-pluggy-0.4.0.dist-info/WHEEL,sha256=9Z5Xm-eel1bTS7e6ogYiKz0zmPEqDwIypurdHN1hR40,116
-pluggy-0.4.0.dist-info/metadata.json,sha256=T3go5L2qOa_-H-HpCZi3EoVKb8sZ3R-fOssbkWo2nvM,1119
-pluggy-0.4.0.dist-info/top_level.txt,sha256=xKSCRhai-v9MckvMuWqNz16c1tbsmOggoMSwTgcpYHE,7
-pluggy-0.4.0.dist-info/INSTALLER,sha256=zuuue4knoyJ-UwPPXg8fezS7VCrXJQrAP7zeNuwvFQg,4
deleted file mode 100644
--- a/third_party/python/pytest/_pytest/vendored_packages/pluggy-0.4.0.dist-info/WHEEL
+++ /dev/null
@@ -1,6 +0,0 @@
-Wheel-Version: 1.0
-Generator: bdist_wheel (0.29.0)
-Root-Is-Purelib: true
-Tag: py2-none-any
-Tag: py3-none-any
-
deleted file mode 100644
--- a/third_party/python/pytest/_pytest/vendored_packages/pluggy-0.4.0.dist-info/metadata.json
+++ /dev/null
@@ -1,1 +0,0 @@
-{"classifiers": ["Development Status :: 4 - Beta", "Intended Audience :: Developers", "License :: OSI Approved :: MIT License", "Operating System :: POSIX", "Operating System :: Microsoft :: Windows", "Operating System :: MacOS :: MacOS X", "Topic :: Software Development :: Testing", "Topic :: Software Development :: Libraries", "Topic :: Utilities", "Programming Language :: Python :: 2", "Programming Language :: Python :: 2.6", "Programming Language :: Python :: 2.7", "Programming Language :: Python :: 3", "Programming Language :: Python :: 3.3", "Programming Language :: Python :: 3.4", "Programming Language :: Python :: 3.5"], "extensions": {"python.details": {"contacts": [{"email": "holger at merlinux.eu", "name": "Holger Krekel", "role": "author"}], "document_names": {"description": "DESCRIPTION.rst", "license": "LICENSE.txt"}, "project_urls": {"Home": "https://github.com/pytest-dev/pluggy"}}}, "generator": "bdist_wheel (0.29.0)", "license": "MIT license", "metadata_version": "2.0", "name": "pluggy", "platform": "unix", "summary": "plugin and hook calling mechanisms for python", "version": "0.4.0"}
\ No newline at end of file
deleted file mode 100644
--- a/third_party/python/pytest/_pytest/vendored_packages/pluggy-0.4.0.dist-info/top_level.txt
+++ /dev/null
@@ -1,1 +0,0 @@
-pluggy
deleted file mode 100644
--- a/third_party/python/pytest/_pytest/vendored_packages/pluggy.py
+++ /dev/null
@@ -1,802 +0,0 @@
-"""
-PluginManager, basic initialization and tracing.
-
-pluggy is the cristallized core of plugin management as used
-by some 150 plugins for pytest.
-
-Pluggy uses semantic versioning. Breaking changes are only foreseen for
-Major releases (incremented X in "X.Y.Z").  If you want to use pluggy in
-your project you should thus use a dependency restriction like
-"pluggy>=0.1.0,<1.0" to avoid surprises.
-
-pluggy is concerned with hook specification, hook implementations and hook
-calling.  For any given hook specification a hook call invokes up to N implementations.
-A hook implementation can influence its position and type of execution:
-if attributed "tryfirst" or "trylast" it will be tried to execute
-first or last.  However, if attributed "hookwrapper" an implementation
-can wrap all calls to non-hookwrapper implementations.  A hookwrapper
-can thus execute some code ahead and after the execution of other hooks.
-
-Hook specification is done by way of a regular python function where
-both the function name and the names of all its arguments are significant.
-Each hook implementation function is verified against the original specification
-function, including the names of all its arguments.  To allow for hook specifications
-to evolve over the livetime of a project, hook implementations can
-accept less arguments.  One can thus add new arguments and semantics to
-a hook specification by adding another argument typically without breaking
-existing hook implementations.
-
-The chosen approach is meant to let a hook designer think carefuly about
-which objects are needed by an extension writer.  By contrast, subclass-based
-extension mechanisms often expose a lot more state and behaviour than needed,
-thus restricting future developments.
-
-Pluggy currently consists of functionality for:
-
-- a way to register new hook specifications.  Without a hook
-  specification no hook calling can be performed.
-
-- a registry of plugins which contain hook implementation functions.  It
-  is possible to register plugins for which a hook specification is not yet
-  known and validate all hooks when the system is in a more referentially
-  consistent state.  Setting an "optionalhook" attribution to a hook
-  implementation will avoid PluginValidationError's if a specification
-  is missing.  This allows to have optional integration between plugins.
-
-- a "hook" relay object from which you can launch 1:N calls to
-  registered hook implementation functions
-
-- a mechanism for ordering hook implementation functions
-
-- mechanisms for two different type of 1:N calls: "firstresult" for when
-  the call should stop when the first implementation returns a non-None result.
-  And the other (default) way of guaranteeing that all hook implementations
-  will be called and their non-None result collected.
-
-- mechanisms for "historic" extension points such that all newly
-  registered functions will receive all hook calls that happened
-  before their registration.
-
-- a mechanism for discovering plugin objects which are based on
-  setuptools based entry points.
-
-- a simple tracing mechanism, including tracing of plugin calls and
-  their arguments.
-
-"""
-import sys
-import inspect
-
-__version__ = '0.4.0'
-
-__all__ = ["PluginManager", "PluginValidationError", "HookCallError",
-           "HookspecMarker", "HookimplMarker"]
-
-_py3 = sys.version_info > (3, 0)
-
-
-class HookspecMarker:
-    """ Decorator helper class for marking functions as hook specifications.
-
-    You can instantiate it with a project_name to get a decorator.
-    Calling PluginManager.add_hookspecs later will discover all marked functions
-    if the PluginManager uses the same project_name.
-    """
-
-    def __init__(self, project_name):
-        self.project_name = project_name
-
-    def __call__(self, function=None, firstresult=False, historic=False):
-        """ if passed a function, directly sets attributes on the function
-        which will make it discoverable to add_hookspecs().  If passed no
-        function, returns a decorator which can be applied to a function
-        later using the attributes supplied.
-
-        If firstresult is True the 1:N hook call (N being the number of registered
-        hook implementation functions) will stop at I<=N when the I'th function
-        returns a non-None result.
-
-        If historic is True calls to a hook will be memorized and replayed
-        on later registered plugins.
-
-        """
-        def setattr_hookspec_opts(func):
-            if historic and firstresult:
-                raise ValueError("cannot have a historic firstresult hook")
-            setattr(func, self.project_name + "_spec",
-                   dict(firstresult=firstresult, historic=historic))
-            return func
-
-        if function is not None:
-            return setattr_hookspec_opts(function)
-        else:
-            return setattr_hookspec_opts
-
-
-class HookimplMarker:
-    """ Decorator helper class for marking functions as hook implementations.
-
-    You can instantiate with a project_name to get a decorator.
-    Calling PluginManager.register later will discover all marked functions
-    if the PluginManager uses the same project_name.
-    """
-    def __init__(self, project_name):
-        self.project_name = project_name
-
-    def __call__(self, function=None, hookwrapper=False, optionalhook=False,
-                 tryfirst=False, trylast=False):
-
-        """ if passed a function, directly sets attributes on the function
-        which will make it discoverable to register().  If passed no function,
-        returns a decorator which can be applied to a function later using
-        the attributes supplied.
-
-        If optionalhook is True a missing matching hook specification will not result
-        in an error (by default it is an error if no matching spec is found).
-
-        If tryfirst is True this hook implementation will run as early as possible
-        in the chain of N hook implementations for a specfication.
-
-        If trylast is True this hook implementation will run as late as possible
-        in the chain of N hook implementations.
-
-        If hookwrapper is True the hook implementations needs to execute exactly
-        one "yield".  The code before the yield is run early before any non-hookwrapper
-        function is run.  The code after the yield is run after all non-hookwrapper
-        function have run.  The yield receives an ``_CallOutcome`` object representing
-        the exception or result outcome of the inner calls (including other hookwrapper
-        calls).
-
-        """
-        def setattr_hookimpl_opts(func):
-            setattr(func, self.project_name + "_impl",
-                   dict(hookwrapper=hookwrapper, optionalhook=optionalhook,
-                        tryfirst=tryfirst, trylast=trylast))
-            return func
-
-        if function is None:
-            return setattr_hookimpl_opts
-        else:
-            return setattr_hookimpl_opts(function)
-
-
-def normalize_hookimpl_opts(opts):
-    opts.setdefault("tryfirst", False)
-    opts.setdefault("trylast", False)
-    opts.setdefault("hookwrapper", False)
-    opts.setdefault("optionalhook", False)
-
-
-class _TagTracer:
-    def __init__(self):
-        self._tag2proc = {}
-        self.writer = None
-        self.indent = 0
-
-    def get(self, name):
-        return _TagTracerSub(self, (name,))
-
-    def format_message(self, tags, args):
-        if isinstance(args[-1], dict):
-            extra = args[-1]
-            args = args[:-1]
-        else:
-            extra = {}
-
-        content = " ".join(map(str, args))
-        indent = "  " * self.indent
-
-        lines = [
-            "%s%s [%s]\n" % (indent, content, ":".join(tags))
-        ]
-
-        for name, value in extra.items():
-            lines.append("%s    %s: %s\n" % (indent, name, value))
-        return lines
-
-    def processmessage(self, tags, args):
-        if self.writer is not None and args:
-            lines = self.format_message(tags, args)
-            self.writer(''.join(lines))
-        try:
-            self._tag2proc[tags](tags, args)
-        except KeyError:
-            pass
-
-    def setwriter(self, writer):
-        self.writer = writer
-
-    def setprocessor(self, tags, processor):
-        if isinstance(tags, str):
-            tags = tuple(tags.split(":"))
-        else:
-            assert isinstance(tags, tuple)
-        self._tag2proc[tags] = processor
-
-
-class _TagTracerSub:
-    def __init__(self, root, tags):
-        self.root = root
-        self.tags = tags
-
-    def __call__(self, *args):
-        self.root.processmessage(self.tags, args)
-
-    def setmyprocessor(self, processor):
-        self.root.setprocessor(self.tags, processor)
-
-    def get(self, name):
-        return self.__class__(self.root, self.tags + (name,))
-
-
-def _raise_wrapfail(wrap_controller, msg):
-    co = wrap_controller.gi_code
-    raise RuntimeError("wrap_controller at %r %s:%d %s" %
-                   (co.co_name, co.co_filename, co.co_firstlineno, msg))
-
-
-def _wrapped_call(wrap_controller, func):
-    """ Wrap calling to a function with a generator which needs to yield
-    exactly once.  The yield point will trigger calling the wrapped function
-    and return its _CallOutcome to the yield point.  The generator then needs
-    to finish (raise StopIteration) in order for the wrapped call to complete.
-    """
-    try:
-        next(wrap_controller)   # first yield
-    except StopIteration:
-        _raise_wrapfail(wrap_controller, "did not yield")
-    call_outcome = _CallOutcome(func)
-    try:
-        wrap_controller.send(call_outcome)
-        _raise_wrapfail(wrap_controller, "has second yield")
-    except StopIteration:
-        pass
-    return call_outcome.get_result()
-
-
-class _CallOutcome:
-    """ Outcome of a function call, either an exception or a proper result.
-    Calling the ``get_result`` method will return the result or reraise
-    the exception raised when the function was called. """
-    excinfo = None
-
-    def __init__(self, func):
-        try:
-            self.result = func()
-        except BaseException:
-            self.excinfo = sys.exc_info()
-
-    def force_result(self, result):
-        self.result = result
-        self.excinfo = None
-
-    def get_result(self):
-        if self.excinfo is None:
-            return self.result
-        else:
-            ex = self.excinfo
-            if _py3:
-                raise ex[1].with_traceback(ex[2])
-            _reraise(*ex)  # noqa
-
-if not _py3:
-    exec("""
-def _reraise(cls, val, tb):
-    raise cls, val, tb
-""")
-
-
-class _TracedHookExecution:
-    def __init__(self, pluginmanager, before, after):
-        self.pluginmanager = pluginmanager
-        self.before = before
-        self.after = after
-        self.oldcall = pluginmanager._inner_hookexec
-        assert not isinstance(self.oldcall, _TracedHookExecution)
-        self.pluginmanager._inner_hookexec = self
-
-    def __call__(self, hook, hook_impls, kwargs):
-        self.before(hook.name, hook_impls, kwargs)
-        outcome = _CallOutcome(lambda: self.oldcall(hook, hook_impls, kwargs))
-        self.after(outcome, hook.name, hook_impls, kwargs)
-        return outcome.get_result()
-
-    def undo(self):
-        self.pluginmanager._inner_hookexec = self.oldcall
-
-
-class PluginManager(object):
-    """ Core Pluginmanager class which manages registration
-    of plugin objects and 1:N hook calling.
-
-    You can register new hooks by calling ``add_hookspec(module_or_class)``.
-    You can register plugin objects (which contain hooks) by calling
-    ``register(plugin)``.  The Pluginmanager is initialized with a
-    prefix that is searched for in the names of the dict of registered
-    plugin objects.  An optional excludefunc allows to blacklist names which
-    are not considered as hooks despite a matching prefix.
-
-    For debugging purposes you can call ``enable_tracing()``
-    which will subsequently send debug information to the trace helper.
-    """
-
-    def __init__(self, project_name, implprefix=None):
-        """ if implprefix is given implementation functions
-        will be recognized if their name matches the implprefix. """
-        self.project_name = project_name
-        self._name2plugin = {}
-        self._plugin2hookcallers = {}
-        self._plugin_distinfo = []
-        self.trace = _TagTracer().get("pluginmanage")
-        self.hook = _HookRelay(self.trace.root.get("hook"))
-        self._implprefix = implprefix
-        self._inner_hookexec = lambda hook, methods, kwargs: \
-            _MultiCall(methods, kwargs, hook.spec_opts).execute()
-
-    def _hookexec(self, hook, methods, kwargs):
-        # called from all hookcaller instances.
-        # enable_tracing will set its own wrapping function at self._inner_hookexec
-        return self._inner_hookexec(hook, methods, kwargs)
-
-    def register(self, plugin, name=None):
-        """ Register a plugin and return its canonical name or None if the name
-        is blocked from registering.  Raise a ValueError if the plugin is already
-        registered. """
-        plugin_name = name or self.get_canonical_name(plugin)
-
-        if plugin_name in self._name2plugin or plugin in self._plugin2hookcallers:
-            if self._name2plugin.get(plugin_name, -1) is None:
-                return  # blocked plugin, return None to indicate no registration
-            raise ValueError("Plugin already registered: %s=%s\n%s" %
-                            (plugin_name, plugin, self._name2plugin))
-
-        # XXX if an error happens we should make sure no state has been
-        # changed at point of return
-        self._name2plugin[plugin_name] = plugin
-
-        # register matching hook implementations of the plugin
-        self._plugin2hookcallers[plugin] = hookcallers = []
-        for name in dir(plugin):
-            hookimpl_opts = self.parse_hookimpl_opts(plugin, name)
-            if hookimpl_opts is not None:
-                normalize_hookimpl_opts(hookimpl_opts)
-                method = getattr(plugin, name)
-                hookimpl = HookImpl(plugin, plugin_name, method, hookimpl_opts)
-                hook = getattr(self.hook, name, None)
-                if hook is None:
-                    hook = _HookCaller(name, self._hookexec)
-                    setattr(self.hook, name, hook)
-                elif hook.has_spec():
-                    self._verify_hook(hook, hookimpl)
-                    hook._maybe_apply_history(hookimpl)
-                hook._add_hookimpl(hookimpl)
-                hookcallers.append(hook)
-        return plugin_name
-
-    def parse_hookimpl_opts(self, plugin, name):
-        method = getattr(plugin, name)
-        try:
-            res = getattr(method, self.project_name + "_impl", None)
-        except Exception:
-            res = {}
-        if res is not None and not isinstance(res, dict):
-            # false positive
-            res = None
-        elif res is None and self._implprefix and name.startswith(self._implprefix):
-            res = {}
-        return res
-
-    def unregister(self, plugin=None, name=None):
-        """ unregister a plugin object and all its contained hook implementations
-        from internal data structures. """
-        if name is None:
-            assert plugin is not None, "one of name or plugin needs to be specified"
-            name = self.get_name(plugin)
-
-        if plugin is None:
-            plugin = self.get_plugin(name)
-
-        # if self._name2plugin[name] == None registration was blocked: ignore
-        if self._name2plugin.get(name):
-            del self._name2plugin[name]
-
-        for hookcaller in self._plugin2hookcallers.pop(plugin, []):
-            hookcaller._remove_plugin(plugin)
-
-        return plugin
-
-    def set_blocked(self, name):
-        """ block registrations of the given name, unregister if already registered. """
-        self.unregister(name=name)
-        self._name2plugin[name] = None
-
-    def is_blocked(self, name):
-        """ return True if the name blogs registering plugins of that name. """
-        return name in self._name2plugin and self._name2plugin[name] is None
-
-    def add_hookspecs(self, module_or_class):
-        """ add new hook specifications defined in the given module_or_class.
-        Functions are recognized if they have been decorated accordingly. """
-        names = []
-        for name in dir(module_or_class):
-            spec_opts = self.parse_hookspec_opts(module_or_class, name)
-            if spec_opts is not None:
-                hc = getattr(self.hook, name, None)
-                if hc is None:
-                    hc = _HookCaller(name, self._hookexec, module_or_class, spec_opts)
-                    setattr(self.hook, name, hc)
-                else:
-                    # plugins registered this hook without knowing the spec
-                    hc.set_specification(module_or_class, spec_opts)
-                    for hookfunction in (hc._wrappers + hc._nonwrappers):
-                        self._verify_hook(hc, hookfunction)
-                names.append(name)
-
-        if not names:
-            raise ValueError("did not find any %r hooks in %r" %
-                             (self.project_name, module_or_class))
-
-    def parse_hookspec_opts(self, module_or_class, name):
-        method = getattr(module_or_class, name)
-        return getattr(method, self.project_name + "_spec", None)
-
-    def get_plugins(self):
-        """ return the set of registered plugins. """
-        return set(self._plugin2hookcallers)
-
-    def is_registered(self, plugin):
-        """ Return True if the plugin is already registered. """
-        return plugin in self._plugin2hookcallers
-
-    def get_canonical_name(self, plugin):
-        """ Return canonical name for a plugin object. Note that a plugin
-        may be registered under a different name which was specified
-        by the caller of register(plugin, name). To obtain the name
-        of an registered plugin use ``get_name(plugin)`` instead."""
-        return getattr(plugin, "__name__", None) or str(id(plugin))
-
-    def get_plugin(self, name):
-        """ Return a plugin or None for the given name. """
-        return self._name2plugin.get(name)
-
-    def has_plugin(self, name):
-        """ Return True if a plugin with the given name is registered. """
-        return self.get_plugin(name) is not None
-
-    def get_name(self, plugin):
-        """ Return name for registered plugin or None if not registered. """
-        for name, val in self._name2plugin.items():
-            if plugin == val:
-                return name
-
-    def _verify_hook(self, hook, hookimpl):
-        if hook.is_historic() and hookimpl.hookwrapper:
-            raise PluginValidationError(
-                "Plugin %r\nhook %r\nhistoric incompatible to hookwrapper" %
-                (hookimpl.plugin_name, hook.name))
-
-        for arg in hookimpl.argnames:
-            if arg not in hook.argnames:
-                raise PluginValidationError(
-                    "Plugin %r\nhook %r\nargument %r not available\n"
-                    "plugin definition: %s\n"
-                    "available hookargs: %s" %
-                    (hookimpl.plugin_name, hook.name, arg,
-                    _formatdef(hookimpl.function), ", ".join(hook.argnames)))
-
-    def check_pending(self):
-        """ Verify that all hooks which have not been verified against
-        a hook specification are optional, otherwise raise PluginValidationError"""
-        for name in self.hook.__dict__:
-            if name[0] != "_":
-                hook = getattr(self.hook, name)
-                if not hook.has_spec():
-                    for hookimpl in (hook._wrappers + hook._nonwrappers):
-                        if not hookimpl.optionalhook:
-                            raise PluginValidationError(
-                                "unknown hook %r in plugin %r" %
-                                (name, hookimpl.plugin))
-
-    def load_setuptools_entrypoints(self, entrypoint_name):
-        """ Load modules from querying the specified setuptools entrypoint name.
-        Return the number of loaded plugins. """
-        from pkg_resources import (iter_entry_points, DistributionNotFound,
-                                   VersionConflict)
-        for ep in iter_entry_points(entrypoint_name):
-            # is the plugin registered or blocked?
-            if self.get_plugin(ep.name) or self.is_blocked(ep.name):
-                continue
-            try:
-                plugin = ep.load()
-            except DistributionNotFound:
-                continue
-            except VersionConflict as e:
-                raise PluginValidationError(
-                    "Plugin %r could not be loaded: %s!" % (ep.name, e))
-            self.register(plugin, name=ep.name)
-            self._plugin_distinfo.append((plugin, ep.dist))
-        return len(self._plugin_distinfo)
-
-    def list_plugin_distinfo(self):
-        """ return list of distinfo/plugin tuples for all setuptools registered
-        plugins. """
-        return list(self._plugin_distinfo)
-
-    def list_name_plugin(self):
-        """ return list of name/plugin pairs. """
-        return list(self._name2plugin.items())
-
-    def get_hookcallers(self, plugin):
-        """ get all hook callers for the specified plugin. """
-        return self._plugin2hookcallers.get(plugin)
-
-    def add_hookcall_monitoring(self, before, after):
-        """ add before/after tracing functions for all hooks
-        and return an undo function which, when called,
-        will remove the added tracers.
-
-        ``before(hook_name, hook_impls, kwargs)`` will be called ahead
-        of all hook calls and receive a hookcaller instance, a list
-        of HookImpl instances and the keyword arguments for the hook call.
-
-        ``after(outcome, hook_name, hook_impls, kwargs)`` receives the
-        same arguments as ``before`` but also a :py:class:`_CallOutcome <_pytest.vendored_packages.pluggy._CallOutcome>` object
-        which represents the result of the overall hook call.
-        """
-        return _TracedHookExecution(self, before, after).undo
-
-    def enable_tracing(self):
-        """ enable tracing of hook calls and return an undo function. """
-        hooktrace = self.hook._trace
-
-        def before(hook_name, methods, kwargs):
-            hooktrace.root.indent += 1
-            hooktrace(hook_name, kwargs)
-
-        def after(outcome, hook_name, methods, kwargs):
-            if outcome.excinfo is None:
-                hooktrace("finish", hook_name, "-->", outcome.result)
-            hooktrace.root.indent -= 1
-
-        return self.add_hookcall_monitoring(before, after)
-
-    def subset_hook_caller(self, name, remove_plugins):
-        """ Return a new _HookCaller instance for the named method
-        which manages calls to all registered plugins except the
-        ones from remove_plugins. """
-        orig = getattr(self.hook, name)
-        plugins_to_remove = [plug for plug in remove_plugins if hasattr(plug, name)]
-        if plugins_to_remove:
-            hc = _HookCaller(orig.name, orig._hookexec, orig._specmodule_or_class,
-                             orig.spec_opts)
-            for hookimpl in (orig._wrappers + orig._nonwrappers):
-                plugin = hookimpl.plugin
-                if plugin not in plugins_to_remove:
-                    hc._add_hookimpl(hookimpl)
-                    # we also keep track of this hook caller so it
-                    # gets properly removed on plugin unregistration
-                    self._plugin2hookcallers.setdefault(plugin, []).append(hc)
-            return hc
-        return orig
-
-
-class _MultiCall:
-    """ execute a call into multiple python functions/methods. """
-
-    # XXX note that the __multicall__ argument is supported only
-    # for pytest compatibility reasons.  It was never officially
-    # supported there and is explicitely deprecated since 2.8
-    # so we can remove it soon, allowing to avoid the below recursion
-    # in execute() and simplify/speed up the execute loop.
-
-    def __init__(self, hook_impls, kwargs, specopts={}):
-        self.hook_impls = hook_impls
-        self.kwargs = kwargs
-        self.kwargs["__multicall__"] = self
-        self.specopts = specopts
-
-    def execute(self):
-        all_kwargs = self.kwargs
-        self.results = results = []
-        firstresult = self.specopts.get("firstresult")
-
-        while self.hook_impls:
-            hook_impl = self.hook_impls.pop()
-            try:
-                args = [all_kwargs[argname] for argname in hook_impl.argnames]
-            except KeyError:
-                for argname in hook_impl.argnames:
-                    if argname not in all_kwargs:
-                        raise HookCallError(
-                            "hook call must provide argument %r" % (argname,))
-            if hook_impl.hookwrapper:
-                return _wrapped_call(hook_impl.function(*args), self.execute)
-            res = hook_impl.function(*args)
-            if res is not None:
-                if firstresult:
-                    return res
-                results.append(res)
-
-        if not firstresult:
-            return results
-
-    def __repr__(self):
-        status = "%d meths" % (len(self.hook_impls),)
-        if hasattr(self, "results"):
-            status = ("%d results, " % len(self.results)) + status
-        return "<_MultiCall %s, kwargs=%r>" % (status, self.kwargs)
-
-
-def varnames(func, startindex=None):
-    """ return argument name tuple for a function, method, class or callable.
-
-    In case of a class, its "__init__" method is considered.
-    For methods the "self" parameter is not included unless you are passing
-    an unbound method with Python3 (which has no supports for unbound methods)
-    """
-    cache = getattr(func, "__dict__", {})
-    try:
-        return cache["_varnames"]
-    except KeyError:
-        pass
-    if inspect.isclass(func):
-        try:
-            func = func.__init__
-        except AttributeError:
-            return ()
-        startindex = 1
-    else:
-        if not inspect.isfunction(func) and not inspect.ismethod(func):
-            try:
-                func = getattr(func, '__call__', func)
-            except Exception:
-                return ()
-        if startindex is None:
-            startindex = int(inspect.ismethod(func))
-
-    try:
-        rawcode = func.__code__
-    except AttributeError:
-        return ()
-    try:
-        x = rawcode.co_varnames[startindex:rawcode.co_argcount]
-    except AttributeError:
-        x = ()
-    else:
-        defaults = func.__defaults__
-        if defaults:
-            x = x[:-len(defaults)]
-    try:
-        cache["_varnames"] = x
-    except TypeError:
-        pass
-    return x
-
-
-class _HookRelay:
-    """ hook holder object for performing 1:N hook calls where N is the number
-    of registered plugins.
-
-    """
-
-    def __init__(self, trace):
-        self._trace = trace
-
-
-class _HookCaller(object):
-    def __init__(self, name, hook_execute, specmodule_or_class=None, spec_opts=None):
-        self.name = name
-        self._wrappers = []
-        self._nonwrappers = []
-        self._hookexec = hook_execute
-        if specmodule_or_class is not None:
-            assert spec_opts is not None
-            self.set_specification(specmodule_or_class, spec_opts)
-
-    def has_spec(self):
-        return hasattr(self, "_specmodule_or_class")
-
-    def set_specification(self, specmodule_or_class, spec_opts):
-        assert not self.has_spec()
-        self._specmodule_or_class = specmodule_or_class
-        specfunc = getattr(specmodule_or_class, self.name)
-        argnames = varnames(specfunc, startindex=inspect.isclass(specmodule_or_class))
-        assert "self" not in argnames  # sanity check
-        self.argnames = ["__multicall__"] + list(argnames)
-        self.spec_opts = spec_opts
-        if spec_opts.get("historic"):
-            self._call_history = []
-
-    def is_historic(self):
-        return hasattr(self, "_call_history")
-
-    def _remove_plugin(self, plugin):
-        def remove(wrappers):
-            for i, method in enumerate(wrappers):
-                if method.plugin == plugin:
-                    del wrappers[i]
-                    return True
-        if remove(self._wrappers) is None:
-            if remove(self._nonwrappers) is None:
-                raise ValueError("plugin %r not found" % (plugin,))
-
-    def _add_hookimpl(self, hookimpl):
-        if hookimpl.hookwrapper:
-            methods = self._wrappers
-        else:
-            methods = self._nonwrappers
-
-        if hookimpl.trylast:
-            methods.insert(0, hookimpl)
-        elif hookimpl.tryfirst:
-            methods.append(hookimpl)
-        else:
-            # find last non-tryfirst method
-            i = len(methods) - 1
-            while i >= 0 and methods[i].tryfirst:
-                i -= 1
-            methods.insert(i + 1, hookimpl)
-
-    def __repr__(self):
-        return "<_HookCaller %r>" % (self.name,)
-
-    def __call__(self, **kwargs):
-        assert not self.is_historic()
-        return self._hookexec(self, self._nonwrappers + self._wrappers, kwargs)
-
-    def call_historic(self, proc=None, kwargs=None):
-        self._call_history.append((kwargs or {}, proc))
-        # historizing hooks don't return results
-        self._hookexec(self, self._nonwrappers + self._wrappers, kwargs)
-
-    def call_extra(self, methods, kwargs):
-        """ Call the hook with some additional temporarily participating
-        methods using the specified kwargs as call parameters. """
-        old = list(self._nonwrappers), list(self._wrappers)
-        for method in methods:
-            opts = dict(hookwrapper=False, trylast=False, tryfirst=False)
-            hookimpl = HookImpl(None, "<temp>", method, opts)
-            self._add_hookimpl(hookimpl)
-        try:
-            return self(**kwargs)
-        finally:
-            self._nonwrappers, self._wrappers = old
-
-    def _maybe_apply_history(self, method):
-        if self.is_historic():
-            for kwargs, proc in self._call_history:
-                res = self._hookexec(self, [method], kwargs)
-                if res and proc is not None:
-                    proc(res[0])
-
-
-class HookImpl:
-    def __init__(self, plugin, plugin_name, function, hook_impl_opts):
-        self.function = function
-        self.argnames = varnames(self.function)
-        self.plugin = plugin
-        self.opts = hook_impl_opts
-        self.plugin_name = plugin_name
-        self.__dict__.update(hook_impl_opts)
-
-
-class PluginValidationError(Exception):
-    """ plugin failed validation. """
-
-
-class HookCallError(Exception):
-    """ Hook was called wrongly. """
-
-
-if hasattr(inspect, 'signature'):
-    def _formatdef(func):
-        return "%s%s" % (
-            func.__name__,
-            str(inspect.signature(func))
-        )
-else:
-    def _formatdef(func):
-        return "%s%s" % (
-            func.__name__,
-            inspect.formatargspec(*inspect.getargspec(func))
-        )
deleted file mode 100644
--- a/third_party/python/pytest/_pytest/warnings.py
+++ /dev/null
@@ -1,94 +0,0 @@
-from __future__ import absolute_import, division, print_function
-
-import warnings
-from contextlib import contextmanager
-
-import pytest
-
-from _pytest import compat
-
-
-def _setoption(wmod, arg):
-    """
-    Copy of the warning._setoption function but does not escape arguments.
-    """
-    parts = arg.split(':')
-    if len(parts) > 5:
-        raise wmod._OptionError("too many fields (max 5): %r" % (arg,))
-    while len(parts) < 5:
-        parts.append('')
-    action, message, category, module, lineno = [s.strip()
-                                                 for s in parts]
-    action = wmod._getaction(action)
-    category = wmod._getcategory(category)
-    if lineno:
-        try:
-            lineno = int(lineno)
-            if lineno < 0:
-                raise ValueError
-        except (ValueError, OverflowError):
-            raise wmod._OptionError("invalid lineno %r" % (lineno,))
-    else:
-        lineno = 0
-    wmod.filterwarnings(action, message, category, module, lineno)
-
-
-def pytest_addoption(parser):
-    group = parser.getgroup("pytest-warnings")
-    group.addoption(
-        '-W', '--pythonwarnings', action='append',
-        help="set which warnings to report, see -W option of python itself.")
-    parser.addini("filterwarnings", type="linelist",
-                  help="Each line specifies a pattern for "
-                  "warnings.filterwarnings. "
-                  "Processed after -W and --pythonwarnings.")
-
-
-@contextmanager
-def catch_warnings_for_item(item):
-    """
-    catches the warnings generated during setup/call/teardown execution
-    of the given item and after it is done posts them as warnings to this
-    item.
-    """
-    args = item.config.getoption('pythonwarnings') or []
-    inifilters = item.config.getini("filterwarnings")
-    with warnings.catch_warnings(record=True) as log:
-        for arg in args:
-            warnings._setoption(arg)
-
-        for arg in inifilters:
-            _setoption(warnings, arg)
-
-        mark = item.get_marker('filterwarnings')
-        if mark:
-            for arg in mark.args:
-                warnings._setoption(arg)
-
-        yield
-
-        for warning in log:
-            warn_msg = warning.message
-            unicode_warning = False
-
-            if compat._PY2 and any(isinstance(m, compat.UNICODE_TYPES) for m in warn_msg.args):
-                new_args = [compat.safe_str(m) for m in warn_msg.args]
-                unicode_warning = warn_msg.args != new_args
-                warn_msg.args = new_args
-
-            msg = warnings.formatwarning(
-                warn_msg, warning.category,
-                warning.filename, warning.lineno, warning.line)
-            item.warn("unused", msg)
-
-            if unicode_warning:
-                warnings.warn(
-                    "Warning is using unicode non convertible to ascii, "
-                    "converting to a safe representation:\n  %s" % msg,
-                    UnicodeWarning)
-
-
-@pytest.hookimpl(hookwrapper=True)
-def pytest_runtest_protocol(item):
-    with catch_warnings_for_item(item):
-        yield
--- a/third_party/python/pytest/appveyor.yml
+++ b/third_party/python/pytest/appveyor.yml
@@ -5,31 +5,31 @@ environment:
     # using pytestbot account as detailed here:
     # https://www.appveyor.com/docs/build-configuration#secure-variables
 
   matrix:
   # coveralls is not in the default env list
   - TOXENV: "coveralls"
   # note: please use "tox --listenvs" to populate the build matrix below
   - TOXENV: "linting"
-  - TOXENV: "py26"
   - TOXENV: "py27"
-  - TOXENV: "py33"
   - TOXENV: "py34"
   - TOXENV: "py35"
   - TOXENV: "py36"
   - TOXENV: "pypy"
   - TOXENV: "py27-pexpect"
   - TOXENV: "py27-xdist"
   - TOXENV: "py27-trial"
   - TOXENV: "py27-numpy"
+  - TOXENV: "py27-pluggymaster"
   - TOXENV: "py36-pexpect"
   - TOXENV: "py36-xdist"
   - TOXENV: "py36-trial"
   - TOXENV: "py36-numpy"
+  - TOXENV: "py36-pluggymaster"
   - TOXENV: "py27-nobyte"
   - TOXENV: "doctesting"
   - TOXENV: "py35-freeze"
   - TOXENV: "docs"
 
 install:
   - echo Installed Pythons
   - dir c:\Python*
@@ -37,8 +37,12 @@ install:
   - if "%TOXENV%" == "pypy" call scripts\install-pypy.bat
 
   - C:\Python36\python -m pip install --upgrade --pre tox
 
 build: false  # Not a C# project, build stuff at the test step instead.
 
 test_script:
   - call scripts\call-tox.bat
+
+cache:
+  - '%LOCALAPPDATA%\pip\cache'
+  - '%USERPROFILE%\.cache\pre-commit'
--- a/third_party/python/pytest/bench/bench.py
+++ b/third_party/python/pytest/bench/bench.py
@@ -1,12 +1,13 @@
 import sys
 
-if __name__ == '__main__':
+if __name__ == "__main__":
     import cProfile
-    import pytest
+    import pytest  # NOQA
     import pstats
+
     script = sys.argv[1:] if len(sys.argv) > 1 else "empty.py"
-    stats = cProfile.run('pytest.cmdline.main(%r)' % script, 'prof')
+    stats = cProfile.run("pytest.cmdline.main(%r)" % script, "prof")
     p = pstats.Stats("prof")
     p.strip_dirs()
-    p.sort_stats('cumulative')
+    p.sort_stats("cumulative")
     print(p.print_stats(500))
--- a/third_party/python/pytest/bench/bench_argcomplete.py
+++ b/third_party/python/pytest/bench/bench_argcomplete.py
@@ -1,19 +1,22 @@
 
 
 # 10000 iterations, just for relative comparison
 #                      2.7.5     3.3.2
 # FilesCompleter       75.1109   69.2116
 # FastFilesCompleter    0.7383    1.0760
 
+import timeit
 
-if __name__ == '__main__':
-    import sys
-    import timeit
-    from argcomplete.completers import FilesCompleter
-    from _pytest._argcomplete import FastFilesCompleter
-    count = 1000 # only a few seconds
-    setup = 'from __main__ import FastFilesCompleter\nfc = FastFilesCompleter()'
-    run = 'fc("/d")'
-    sys.stdout.write('%s\n' % (timeit.timeit(run,
-                                setup=setup.replace('Fast', ''), number=count)))
-    sys.stdout.write('%s\n' % (timeit.timeit(run, setup=setup, number=count)))
+imports = [
+    "from argcomplete.completers import FilesCompleter as completer",
+    "from _pytest._argcomplete import FastFilesCompleter as completer",
+]
+
+count = 1000  # only a few seconds
+setup = "%s\nfc = completer()"
+run = 'fc("/d")'
+
+
+if __name__ == "__main__":
+    print(timeit.timeit(run, setup=setup % imports[0], number=count))
+    print((timeit.timeit(run, setup=setup % imports[1], number=count)))
--- a/third_party/python/pytest/bench/empty.py
+++ b/third_party/python/pytest/bench/empty.py
@@ -1,3 +1,4 @@
 import py
+
 for i in range(1000):
     py.builtin.exec_("def test_func_%d(): pass" % i)
--- a/third_party/python/pytest/bench/manyparam.py
+++ b/third_party/python/pytest/bench/manyparam.py
@@ -1,12 +1,15 @@
 
 import pytest
 
-@pytest.fixture(scope='module', params=range(966))
+
+@pytest.fixture(scope="module", params=range(966))
 def foo(request):
     return request.param
 
+
 def test_it(foo):
     pass
+
+
 def test_it2(foo):
     pass
-
--- a/third_party/python/pytest/bench/skip.py
+++ b/third_party/python/pytest/bench/skip.py
@@ -1,10 +1,11 @@
-
+from six.moves import range
 import pytest
 
 
 SKIP = True
 
-@pytest.mark.parametrize("x", xrange(5000))
+
+@pytest.mark.parametrize("x", range(5000))
 def test_foo(x):
     if SKIP:
         pytest.skip("heh")
new file mode 100644
--- /dev/null
+++ b/third_party/python/pytest/changelog/README.rst
@@ -0,0 +1,32 @@
+This directory contains "newsfragments" which are short files that contain a small **ReST**-formatted
+text that will be added to the next ``CHANGELOG``.
+
+The ``CHANGELOG`` will be read by users, so this description should be aimed to pytest users
+instead of describing internal changes which are only relevant to the developers.
+
+Make sure to use full sentences with correct case and punctuation, for example::
+
+    Fix issue with non-ascii messages from the ``warnings`` module.
+
+Each file should be named like ``<ISSUE>.<TYPE>.rst``, where
+``<ISSUE>`` is an issue number, and ``<TYPE>`` is one of:
+
+* ``feature``: new user facing features, like new command-line options and new behavior.
+* ``bugfix``: fixes a reported bug.
+* ``doc``: documentation improvement, like rewording an entire session or adding missing docs.
+* ``removal``: feature deprecation or removal.
+* ``vendor``: changes in packages vendored in pytest.
+* ``trivial``: fixing a small typo or internal change that might be noteworthy.
+
+So for example: ``123.feature.rst``, ``456.bugfix.rst``.
+
+If your PR fixes an issue, use that number here. If there is no issue,
+then after you submit the PR and get the PR number you can add a
+changelog using that instead.
+
+If you are not sure what issue type to use, don't hesitate to ask in your PR.
+
+Note that the ``towncrier`` tool will automatically
+reflow your text, so it will work best if you stick to a single paragraph, but multiple sentences and links are OK
+and encouraged. You can install ``towncrier`` and then run ``towncrier --draft``
+if you want to get a preview of how your change will look in the final release notes.
--- a/third_party/python/pytest/doc/en/Makefile
+++ b/third_party/python/pytest/doc/en/Makefile
@@ -8,18 +8,16 @@ PAPER         =
 BUILDDIR      = _build
 
 # Internal variables.
 PAPEROPT_a4     = -D latex_paper_size=a4
 PAPEROPT_letter = -D latex_paper_size=letter
 ALLSPHINXOPTS   = -d $(BUILDDIR)/doctrees $(PAPEROPT_$(PAPER)) $(SPHINXOPTS) .
 
 REGENDOC_ARGS := \
-	--normalize "/={8,} (.*) ={8,}/======= \1 ========/" \
-	--normalize "/_{8,} (.*) _{8,}/_______ \1 ________/" \
 	--normalize "/in \d+.\d+ seconds/in 0.12 seconds/" \
 	--normalize "@/tmp/pytest-of-.*/pytest-\d+@PYTEST_TMPDIR@" \
 	--normalize "@pytest-(\d+)\\.[^ ,]+@pytest-\1.x.y@" \
 	--normalize "@(This is pytest version )(\d+)\\.[^ ,]+@\1\2.x.y@" \
 	--normalize "@py-(\d+)\\.[^ ,]+@py-\1.x.y@" \
 	--normalize "@pluggy-(\d+)\\.[.\d,]+@pluggy-\1.x.y@" \
 	--normalize "@hypothesis-(\d+)\\.[.\d,]+@hypothesis-\1.x.y@" \
 	--normalize "@Python (\d+)\\.[^ ,]+@Python \1.x.y@"
--- a/third_party/python/pytest/doc/en/_templates/globaltoc.html
+++ b/third_party/python/pytest/doc/en/_templates/globaltoc.html
@@ -1,19 +1,20 @@
 <h3><a href="{{ pathto(master_doc) }}">{{ _('Table Of Contents') }}</a></h3>
 
 <ul>
   <li><a href="{{ pathto('index') }}">Home</a></li>
+  <li><a href="{{ pathto('getting-started') }}">Install</a></li>
   <li><a href="{{ pathto('contents') }}">Contents</a></li>
-  <li><a href="{{ pathto('getting-started') }}">Install</a></li>
+  <li><a href="{{ pathto('reference') }}">Reference</a></li>
   <li><a href="{{ pathto('example/index') }}">Examples</a></li>
   <li><a href="{{ pathto('customize') }}">Customize</a></li>
-  <li><a href="{{ pathto('contact') }}">Contact</a></li>
-  <li><a href="{{ pathto('talks') }}">Talks/Posts</a></li>
   <li><a href="{{ pathto('changelog') }}">Changelog</a></li>
+  <li><a href="{{ pathto('contributing') }}">Contributing</a></li>
   <li><a href="{{ pathto('backwards-compatibility') }}">Backwards Compatibility</a></li>
   <li><a href="{{ pathto('license') }}">License</a></li>
+  <li><a href="{{ pathto('contact') }}">Contact Channels</a></li>
 </ul>
 
 {%- if display_toc %}
   <hr>
   {{ toc }}
 {%- endif %}
--- a/third_party/python/pytest/doc/en/_templates/links.html
+++ b/third_party/python/pytest/doc/en/_templates/links.html
@@ -1,11 +1,8 @@
 <h3>Useful Links</h3>
 <ul>
-  <li><a href="{{ pathto('index') }}">The pytest Website</a></li>
-  <li><a href="{{ pathto('contributing') }}">Contribution Guide</a></li>
-  <li><a href="https://pypi.python.org/pypi/pytest">pytest @ PyPI</a></li>
+  <li><a href="https://pypi.org/project/pytest/">pytest @ PyPI</a></li>
   <li><a href="https://github.com/pytest-dev/pytest/">pytest @ GitHub</a></li>
   <li><a href="http://plugincompat.herokuapp.com/">3rd party plugins</a></li>
   <li><a href="https://github.com/pytest-dev/pytest/issues">Issue Tracker</a></li>
   <li><a href="https://media.readthedocs.org/pdf/pytest/latest/pytest.pdf">PDF Documentation</a>
 </ul>
-
--- a/third_party/python/pytest/doc/en/_themes/flask/theme.conf
+++ b/third_party/python/pytest/doc/en/_themes/flask/theme.conf
@@ -1,9 +1,9 @@
 [theme]
 inherit = basic
 stylesheet = flasky.css
 pygments_style = flask_theme_support.FlaskyStyle
 
 [options]
 index_logo = ''
 index_logo_height = 120px
-touch_icon = 
+touch_icon =
--- a/third_party/python/pytest/doc/en/_themes/flask_theme_support.py
+++ b/third_party/python/pytest/doc/en/_themes/flask_theme_support.py
@@ -1,86 +1,89 @@
 # flasky extensions.  flasky pygments style based on tango style
 from pygments.style import Style
-from pygments.token import Keyword, Name, Comment, String, Error, \
-     Number, Operator, Generic, Whitespace, Punctuation, Other, Literal
+from pygments.token import (
+    Keyword,
+    Name,
+    Comment,
+    String,
+    Error,
+    Number,
+    Operator,
+    Generic,
+    Whitespace,
+    Punctuation,
+    Other,
+    Literal,
+)
 
 
 class FlaskyStyle(Style):
     background_color = "#f8f8f8"
     default_style = ""
 
     styles = {
         # No corresponding class for the following:
-        #Text:                     "", # class:  ''
-        Whitespace:                "underline #f8f8f8",      # class: 'w'
-        Error:                     "#a40000 border:#ef2929", # class: 'err'
-        Other:                     "#000000",                # class 'x'
-
-        Comment:                   "italic #8f5902", # class: 'c'
-        Comment.Preproc:           "noitalic",       # class: 'cp'
-
-        Keyword:                   "bold #004461",   # class: 'k'
-        Keyword.Constant:          "bold #004461",   # class: 'kc'
-        Keyword.Declaration:       "bold #004461",   # class: 'kd'
-        Keyword.Namespace:         "bold #004461",   # class: 'kn'
-        Keyword.Pseudo:            "bold #004461",   # class: 'kp'
-        Keyword.Reserved:          "bold #004461",   # class: 'kr'
-        Keyword.Type:              "bold #004461",   # class: 'kt'
-
-        Operator:                  "#582800",   # class: 'o'
-        Operator.Word:             "bold #004461",   # class: 'ow' - like keywords
-
-        Punctuation:               "bold #000000",   # class: 'p'
-
+        # Text:                     "", # class:  ''
+        Whitespace: "underline #f8f8f8",  # class: 'w'
+        Error: "#a40000 border:#ef2929",  # class: 'err'
+        Other: "#000000",  # class 'x'
+        Comment: "italic #8f5902",  # class: 'c'
+        Comment.Preproc: "noitalic",  # class: 'cp'
+        Keyword: "bold #004461",  # class: 'k'
+        Keyword.Constant: "bold #004461",  # class: 'kc'
+        Keyword.Declaration: "bold #004461",  # class: 'kd'
+        Keyword.Namespace: "bold #004461",  # class: 'kn'
+        Keyword.Pseudo: "bold #004461",  # class: 'kp'
+        Keyword.Reserved: "bold #004461",  # class: 'kr'
+        Keyword.Type: "bold #004461",  # class: 'kt'
+        Operator: "#582800",  # class: 'o'
+        Operator.Word: "bold #004461",  # class: 'ow' - like keywords
+        Punctuation: "bold #000000",  # class: 'p'
         # because special names such as Name.Class, Name.Function, etc.
         # are not recognized as such later in the parsing, we choose them
         # to look the same as ordinary variables.
-        Name:                      "#000000",        # class: 'n'
-        Name.Attribute:            "#c4a000",        # class: 'na' - to be revised
-        Name.Builtin:              "#004461",        # class: 'nb'
-        Name.Builtin.Pseudo:       "#3465a4",        # class: 'bp'
-        Name.Class:                "#000000",        # class: 'nc' - to be revised
-        Name.Constant:             "#000000",        # class: 'no' - to be revised
-        Name.Decorator:            "#888",           # class: 'nd' - to be revised
-        Name.Entity:               "#ce5c00",        # class: 'ni'
-        Name.Exception:            "bold #cc0000",   # class: 'ne'
-        Name.Function:             "#000000",        # class: 'nf'
-        Name.Property:             "#000000",        # class: 'py'
-        Name.Label:                "#f57900",        # class: 'nl'
-        Name.Namespace:            "#000000",        # class: 'nn' - to be revised
-        Name.Other:                "#000000",        # class: 'nx'
-        Name.Tag:                  "bold #004461",   # class: 'nt' - like a keyword
-        Name.Variable:             "#000000",        # class: 'nv' - to be revised
-        Name.Variable.Class:       "#000000",        # class: 'vc' - to be revised
-        Name.Variable.Global:      "#000000",        # class: 'vg' - to be revised
-        Name.Variable.Instance:    "#000000",        # class: 'vi' - to be revised
-
-        Number:                    "#990000",        # class: 'm'
-
-        Literal:                   "#000000",        # class: 'l'
-        Literal.Date:              "#000000",        # class: 'ld'
-
-        String:                    "#4e9a06",        # class: 's'
-        String.Backtick:           "#4e9a06",        # class: 'sb'
-        String.Char:               "#4e9a06",        # class: 'sc'
-        String.Doc:                "italic #8f5902", # class: 'sd' - like a comment
-        String.Double:             "#4e9a06",        # class: 's2'
-        String.Escape:             "#4e9a06",        # class: 'se'
-        String.Heredoc:            "#4e9a06",        # class: 'sh'
-        String.Interpol:           "#4e9a06",        # class: 'si'
-        String.Other:              "#4e9a06",        # class: 'sx'
-        String.Regex:              "#4e9a06",        # class: 'sr'
-        String.Single:             "#4e9a06",        # class: 's1'
-        String.Symbol:             "#4e9a06",        # class: 'ss'
-
-        Generic:                   "#000000",        # class: 'g'
-        Generic.Deleted:           "#a40000",        # class: 'gd'
-        Generic.Emph:              "italic #000000", # class: 'ge'
-        Generic.Error:             "#ef2929",        # class: 'gr'
-        Generic.Heading:           "bold #000080",   # class: 'gh'
-        Generic.Inserted:          "#00A000",        # class: 'gi'
-        Generic.Output:            "#888",           # class: 'go'
-        Generic.Prompt:            "#745334",        # class: 'gp'
-        Generic.Strong:            "bold #000000",   # class: 'gs'
-        Generic.Subheading:        "bold #800080",   # class: 'gu'
-        Generic.Traceback:         "bold #a40000",   # class: 'gt'
+        Name: "#000000",  # class: 'n'
+        Name.Attribute: "#c4a000",  # class: 'na' - to be revised
+        Name.Builtin: "#004461",  # class: 'nb'
+        Name.Builtin.Pseudo: "#3465a4",  # class: 'bp'
+        Name.Class: "#000000",  # class: 'nc' - to be revised
+        Name.Constant: "#000000",  # class: 'no' - to be revised
+        Name.Decorator: "#888",  # class: 'nd' - to be revised
+        Name.Entity: "#ce5c00",  # class: 'ni'
+        Name.Exception: "bold #cc0000",  # class: 'ne'
+        Name.Function: "#000000",  # class: 'nf'
+        Name.Property: "#000000",  # class: 'py'
+        Name.Label: "#f57900",  # class: 'nl'
+        Name.Namespace: "#000000",  # class: 'nn' - to be revised
+        Name.Other: "#000000",  # class: 'nx'
+        Name.Tag: "bold #004461",  # class: 'nt' - like a keyword
+        Name.Variable: "#000000",  # class: 'nv' - to be revised
+        Name.Variable.Class: "#000000",  # class: 'vc' - to be revised
+        Name.Variable.Global: "#000000",  # class: 'vg' - to be revised
+        Name.Variable.Instance: "#000000",  # class: 'vi' - to be revised
+        Number: "#990000",  # class: 'm'
+        Literal: "#000000",  # class: 'l'
+        Literal.Date: "#000000",  # class: 'ld'
+        String: "#4e9a06",  # class: 's'
+        String.Backtick: "#4e9a06",  # class: 'sb'
+        String.Char: "#4e9a06",  # class: 'sc'
+        String.Doc: "italic #8f5902",  # class: 'sd' - like a comment
+        String.Double: "#4e9a06",  # class: 's2'
+        String.Escape: "#4e9a06",  # class: 'se'
+        String.Heredoc: "#4e9a06",  # class: 'sh'
+        String.Interpol: "#4e9a06",  # class: 'si'
+        String.Other: "#4e9a06",  # class: 'sx'
+        String.Regex: "#4e9a06",  # class: 'sr'
+        String.Single: "#4e9a06",  # class: 's1'
+        String.Symbol: "#4e9a06",  # class: 'ss'
+        Generic: "#000000",  # class: 'g'
+        Generic.Deleted: "#a40000",  # class: 'gd'
+        Generic.Emph: "italic #000000",  # class: 'ge'
+        Generic.Error: "#ef2929",  # class: 'gr'
+        Generic.Heading: "bold #000080",  # class: 'gh'
+        Generic.Inserted: "#00A000",  # class: 'gi'
+        Generic.Output: "#888",  # class: 'go'
+        Generic.Prompt: "#745334",  # class: 'gp'
+        Generic.Strong: "bold #000000",  # class: 'gs'
+        Generic.Subheading: "bold #800080",  # class: 'gu'
+        Generic.Traceback: "bold #a40000",  # class: 'gt'
     }
--- a/third_party/python/pytest/doc/en/announce/index.rst
+++ b/third_party/python/pytest/doc/en/announce/index.rst
@@ -1,16 +1,27 @@
 
 Release announcements
 ===========================================
 
 .. toctree::
    :maxdepth: 2
 
-   
+
+   release-3.6.2
+   release-3.6.1
+   release-3.6.0
+   release-3.5.1
+   release-3.5.0
+   release-3.4.2
+   release-3.4.1
+   release-3.4.0
+   release-3.3.2
+   release-3.3.1
+   release-3.3.0
    release-3.2.5
    release-3.2.4
    release-3.2.3
    release-3.2.2
    release-3.2.1
    release-3.2.0
    release-3.1.3
    release-3.1.2
--- a/third_party/python/pytest/doc/en/announce/release-2.0.3.rst
+++ b/third_party/python/pytest/doc/en/announce/release-2.0.3.rst
@@ -1,9 +1,9 @@
-py.test 2.0.3: bug fixes and speed ups 
+py.test 2.0.3: bug fixes and speed ups
 ===========================================================================
 
 Welcome to pytest-2.0.3, a maintenance and bug fix release of pytest,
 a mature testing tool for Python, supporting CPython 2.4-3.2, Jython
 and latest PyPy interpreters.  See the extensive docs with tested examples here:
 
     http://pytest.org/
 
@@ -32,9 +32,8 @@ Changes between 2.0.2 and 2.0.3
 
 - don't require zlib (and other libs) for genscript plugin without
   --genscript actually being used.
 
 - speed up skips (by not doing a full traceback representation
   internally)
 
 - fix issue37: avoid invalid characters in junitxml's output
-
--- a/third_party/python/pytest/doc/en/announce/release-2.1.1.rst
+++ b/third_party/python/pytest/doc/en/announce/release-2.1.1.rst
@@ -29,9 +29,8 @@ Changes between 2.1.0 and 2.1.1
 - fix issue60 / fix error conditions involving the creation of __pycache__
 - fix issue63 / assertion rewriting on inserts involving strings containing '%'
 - fix assertion rewriting on calls with a ** arg
 - don't cache rewritten modules if bytecode generation is disabled
 - fix assertion rewriting in read-only directories
 - fix issue59: provide system-out/err tags for junitxml output
 - fix issue61: assertion rewriting on boolean operations with 3 or more operands
 - you can now build a man page with "cd doc ; make man"
-
--- a/third_party/python/pytest/doc/en/announce/release-2.1.2.rst
+++ b/third_party/python/pytest/doc/en/announce/release-2.1.2.rst
@@ -25,9 +25,8 @@ Changes between 2.1.1 and 2.1.2
 ----------------------------------------
 
 - fix assertion rewriting on files with windows newlines on some Python versions
 - refine test discovery by package/module name (--pyargs), thanks Florian Mayer
 - fix issue69 / assertion rewriting fixed on some boolean operations
 - fix issue68 / packages now work with assertion rewriting
 - fix issue66: use different assertion rewriting caches when the -O option is passed
 - don't try assertion rewriting on Jython, use reinterp
-
--- a/third_party/python/pytest/doc/en/announce/release-2.1.3.rst
+++ b/third_party/python/pytest/doc/en/announce/release-2.1.3.rst
@@ -4,17 +4,17 @@ py.test 2.1.3: just some more fixes
 pytest-2.1.3 is a minor backward compatible maintenance release of the
 popular py.test testing tool.  It is commonly used for unit, functional-
 and integration testing.  See extensive docs with examples here:
 
      http://pytest.org/
 
 The release contains another fix to the perfected assertions introduced
 with the 2.1 series as well as the new possibility to customize reporting
-for assertion expressions on a per-directory level.  
+for assertion expressions on a per-directory level.
 
 If you want to install or upgrade pytest, just type one of::
 
     pip install -U pytest # or
     easy_install -U pytest
 
 Thanks to the bug reporters and to Ronny Pfannschmidt, Benjamin Peterson
 and Floris Bruynooghe who implemented the fixes.
--- a/third_party/python/pytest/doc/en/announce/release-2.2.1.rst
+++ b/third_party/python/pytest/doc/en/announce/release-2.2.1.rst
@@ -22,20 +22,20 @@ Gospodnetic and Ralf Schmitt.
 best,
 holger krekel
 
 
 Changes between 2.2.0 and 2.2.1
 ----------------------------------------
 
 - fix issue99 (in pytest and py) internallerrors with resultlog now
-  produce better output - fixed by normalizing pytest_internalerror 
+  produce better output - fixed by normalizing pytest_internalerror
   input arguments.
 - fix issue97 / traceback issues (in pytest and py) improve traceback output
   in conjunction with jinja2 and cython which hack tracebacks
 - fix issue93 (in pytest and pytest-xdist) avoid "delayed teardowns":
   the final test in a test node will now run its teardown directly
   instead of waiting for the end of the session. Thanks Dave Hunt for
   the good reporting and feedback.  The pytest_runtest_protocol as well
-  as the pytest_runtest_teardown hooks now have "nextitem" available 
+  as the pytest_runtest_teardown hooks now have "nextitem" available
   which will be None indicating the end of the test run.
 - fix collection crash due to unknown-source collected items, thanks
   to Ralf Schmitt (fixed by depending on a more recent pylib)
--- a/third_party/python/pytest/doc/en/announce/release-2.2.2.rst
+++ b/third_party/python/pytest/doc/en/announce/release-2.2.2.rst
@@ -1,15 +1,15 @@
 pytest-2.2.2: bug fixes
 ===========================================================================
 
 pytest-2.2.2 (updated to 2.2.3 to fix packaging issues) is a minor
 backward-compatible release of the versatile py.test testing tool.   It
 contains bug fixes and a few refinements particularly to reporting with
-"--collectonly", see below for betails.  
+"--collectonly", see below for betails.
 
 For general information see here:
 
      http://pytest.org/
 
 To install or upgrade pytest:
 
     pip install -U pytest # or
@@ -22,22 +22,22 @@ best,
 holger krekel
 
 
 Changes between 2.2.1 and 2.2.2
 ----------------------------------------
 
 - fix issue101: wrong args to unittest.TestCase test function now
   produce better output
-- fix issue102: report more useful errors and hints for when a 
+- fix issue102: report more useful errors and hints for when a
   test directory was renamed and some pyc/__pycache__ remain
 - fix issue106: allow parametrize to be applied multiple times
   e.g. from module, class and at function level.
 - fix issue107: actually perform session scope finalization
 - don't check in parametrize if indirect parameters are funcarg names
 - add chdir method to monkeypatch funcarg
 - fix crash resulting from calling monkeypatch undo a second time
 - fix issue115: make --collectonly robust against early failure
   (missing files/directories)
 - "-qq --collectonly" now shows only files and the number of tests in them
-- "-q --collectonly" now shows test ids 
+- "-q --collectonly" now shows test ids
 - allow adding of attributes to test reports such that it also works
   with distributed testing (no upgrade of pytest-xdist needed)
--- a/third_party/python/pytest/doc/en/announce/release-2.2.4.rst
+++ b/third_party/python/pytest/doc/en/announce/release-2.2.4.rst
@@ -31,9 +31,8 @@ Changes between 2.2.3 and 2.2.4
 - document integration with the extended distribute/setuptools test commands
 - fix issue 140: properly get the real functions
   of bound classmethods for setup/teardown_class
 - fix issue #141: switch from the deceased paste.pocoo.org to bpaste.net
 - fix issue #143: call unconfigure/sessionfinish always when
   configure/sessionstart where called
 - fix issue #144: better mangle test ids to junitxml classnames
 - upgrade distribute_setup.py to 0.6.27
-
--- a/third_party/python/pytest/doc/en/announce/release-2.3.0.rst
+++ b/third_party/python/pytest/doc/en/announce/release-2.3.0.rst
@@ -1,20 +1,20 @@
 pytest-2.3: improved fixtures / better unittest integration
 =============================================================================
 
-pytest-2.3 comes with many major improvements for fixture/funcarg management 
+pytest-2.3 comes with many major improvements for fixture/funcarg management
 and parametrized testing in Python.  It is now easier, more efficient and
 more predicatable to re-run the same tests with different fixture
 instances.  Also, you can directly declare the caching "scope" of
 fixtures so that dependent tests throughout your whole test suite can
 re-use database or other expensive fixture objects with ease.  Lastly,
 it's possible for fixture functions (formerly known as funcarg
 factories) to use other fixtures, allowing for a completely modular and
-re-useable fixture design. 
+re-useable fixture design.
 
 For detailed info and tutorial-style examples, see:
 
     http://pytest.org/latest/fixture.html
 
 Moreover, there is now support for using pytest fixtures/funcargs with
 unittest-style suites, see here for examples:
 
@@ -22,33 +22,33 @@ unittest-style suites, see here for exam
 
 Besides, more unittest-test suites are now expected to "simply work"
 with pytest.
 
 All changes are backward compatible and you should be able to continue
 to run your test suites and 3rd party plugins that worked with
 pytest-2.2.4.
 
-If you are interested in the precise reasoning (including examples) of the 
+If you are interested in the precise reasoning (including examples) of the
 pytest-2.3 fixture evolution, please consult
 http://pytest.org/latest/funcarg_compare.html
 
 For general info on installation and getting started:
 
     http://pytest.org/latest/getting-started.html
 
 Docs and PDF access as usual at:
 
     http://pytest.org
 
 and more details for those already in the knowing of pytest can be found
 in the CHANGELOG below.
 
 Particular thanks for this release go to Floris Bruynooghe, Alex Okrushko
-Carl Meyer, Ronny Pfannschmidt, Benjamin Peterson and Alex Gaynor for helping 
+Carl Meyer, Ronny Pfannschmidt, Benjamin Peterson and Alex Gaynor for helping
 to get the new features right and well integrated.  Ronny and Floris
 also helped to fix a number of bugs and yet more people helped by
 providing bug reports.
 
 have fun,
 holger krekel
 
 
@@ -89,17 +89,17 @@ Changes between 2.2.4 and 2.3.0
 
 - fix issue128: show captured output when capsys/capfd are used
 
 - fix issue179: properly show the dependency chain of factories
 
 - pluginmanager.register(...) now raises ValueError if the
   plugin has been already registered or the name is taken
 
-- fix issue159: improve http://pytest.org/latest/faq.html 
+- fix issue159: improve http://pytest.org/latest/faq.html
   especially with respect to the "magic" history, also mention
   pytest-django, trial and unittest integration.
 
 - make request.keywords and node.keywords writable.  All descendant
   collection nodes will see keyword values.  Keywords are dictionaries
   containing markers and other info.
 
 - fix issue 178: xml binary escapes are now wrapped in py.xml.raw
@@ -120,15 +120,14 @@ Changes between 2.2.4 and 2.3.0
 - fix issue 156: monkeypatch correctly handles class level descriptors
 
 - reporting refinements:
 
   - pytest_report_header now receives a "startdir" so that
     you can use startdir.bestrelpath(yourpath) to show
     nice relative path
 
-  - allow plugins to implement both pytest_report_header and 
+  - allow plugins to implement both pytest_report_header and
     pytest_sessionstart (sessionstart is invoked first).
 
   - don't show deselected reason line if there is none
 
   - py.test -vv will show all of assert comparisons instead of truncating
-
--- a/third_party/python/pytest/doc/en/announce/release-2.3.1.rst
+++ b/third_party/python/pytest/doc/en/announce/release-2.3.1.rst
@@ -1,23 +1,23 @@
 pytest-2.3.1: fix regression with factory functions
 ===========================================================================
 
 pytest-2.3.1 is a quick follow-up release:
 
-- fix issue202 - regression with fixture functions/funcarg factories:  
-  using "self" is now safe again and works as in 2.2.4.  Thanks 
+- fix issue202 - regression with fixture functions/funcarg factories:
+  using "self" is now safe again and works as in 2.2.4.  Thanks
   to Eduard Schettino for the quick bug report.
 
-- disable pexpect pytest self tests on Freebsd - thanks Koob for the 
+- disable pexpect pytest self tests on Freebsd - thanks Koob for the
   quick reporting
 
 - fix/improve interactive docs with --markers
 
-See 
+See
 
      http://pytest.org/
 
 for general information.  To install or upgrade pytest:
 
     pip install -U pytest # or
     easy_install -U pytest
 
--- a/third_party/python/pytest/doc/en/announce/release-2.3.2.rst
+++ b/third_party/python/pytest/doc/en/announce/release-2.3.2.rst
@@ -3,35 +3,35 @@ pytest-2.3.2: some fixes and more traceb
 
 pytest-2.3.2 is another stabilization release:
 
 - issue 205: fixes a regression with conftest detection
 - issue 208/29: fixes traceback-printing speed in some bad cases
 - fix teardown-ordering for parametrized setups
 - fix unittest and trial compat behaviour with respect  to runTest() methods
 - issue 206 and others: some improvements to packaging
-- fix issue127 and others: improve some docs 
+- fix issue127 and others: improve some docs
 
-See 
+See
 
      http://pytest.org/
 
 for general information.  To install or upgrade pytest:
 
     pip install -U pytest # or
     easy_install -U pytest
 
 best,
 holger krekel
 
 
 Changes between 2.3.1 and 2.3.2
 -----------------------------------
 
-- fix issue208 and fix issue29 use new py version to avoid long pauses 
+- fix issue208 and fix issue29 use new py version to avoid long pauses
   when printing tracebacks in long modules
 
 - fix issue205 - conftests in subdirs customizing
   pytest_pycollect_makemodule and pytest_pycollect_makeitem
   now work properly
 
 - fix teardown-ordering for parametrized setups
 
--- a/third_party/python/pytest/doc/en/announce/release-2.3.3.rst
+++ b/third_party/python/pytest/doc/en/announce/release-2.3.3.rst
@@ -1,27 +1,27 @@
 pytest-2.3.3: integration fixes, py24 support, ``*/**`` shown in traceback
 ===========================================================================
 
 pytest-2.3.3 is another stabilization release of the py.test tool
 which offers uebersimple assertions, scalable fixture mechanisms
 and deep customization for testing with Python.  Particularly,
 this release provides:
 
-- integration fixes and improvements related to flask, numpy, nose, 
+- integration fixes and improvements related to flask, numpy, nose,
   unittest, mock
 
 - makes pytest work on py24 again (yes, people sometimes still need to use it)
 
 - show ``*,**`` args in pytest tracebacks
 
 Thanks to Manuel Jacob, Thomas Waldmann, Ronny Pfannschmidt, Pavel Repin
 and Andreas Taumoefolau for providing patches and all for the issues.
 
-See 
+See
 
      http://pytest.org/
 
 for general information.  To install or upgrade pytest:
 
     pip install -U pytest # or
     easy_install -U pytest
 
@@ -54,9 +54,8 @@ Changes between 2.3.2 and 2.3.3
 - in tracebacks *,** arg values are now shown next to normal arguments
   (thanks Manuel Jacob)
 
 - fix issue217 - support mock.patch with pytest's fixtures - note that
   you need either mock-1.0.1 or the python3.3 builtin unittest.mock.
 
 - fix issue127 - improve documentation for pytest_addoption() and
   add a ``config.getoption(name)`` helper function for consistency.
-
--- a/third_party/python/pytest/doc/en/announce/release-2.3.4.rst
+++ b/third_party/python/pytest/doc/en/announce/release-2.3.4.rst
@@ -5,33 +5,33 @@ pytest-2.3.4 is a small stabilization re
 which offers uebersimple assertions, scalable fixture mechanisms
 and deep customization for testing with Python.  This release
 comes with the following fixes and features:
 
 - make "-k" option accept an expressions the same as with "-m" so that one
   can write: -k "name1 or name2" etc.  This is a slight usage incompatibility
   if you used special syntax like "TestClass.test_method" which you now
   need to write as -k "TestClass and test_method" to match a certain
-  method in a certain test class.  
+  method in a certain test class.
 - allow to dynamically define markers via
   item.keywords[...]=assignment integrating with "-m" option
-- yielded test functions will now have autouse-fixtures active but 
+- yielded test functions will now have autouse-fixtures active but
   cannot accept fixtures as funcargs - it's anyway recommended to
   rather use the post-2.0 parametrize features instead of yield, see:
   http://pytest.org/latest/example/parametrize.html
 - fix autouse-issue where autouse-fixtures would not be discovered
-  if defined in a a/conftest.py file and tests in a/tests/test_some.py
+  if defined in an a/conftest.py file and tests in a/tests/test_some.py
 - fix issue226 - LIFO ordering for fixture teardowns
 - fix issue224 - invocations with >256 char arguments now work
 - fix issue91 - add/discuss package/directory level setups in example
 - fixes related to autouse discovery and calling
 
 Thanks in particular to Thomas Waldmann for spotting and reporting issues.
 
-See 
+See
 
      http://pytest.org/
 
 for general information.  To install or upgrade pytest:
 
     pip install -U pytest # or
     easy_install -U pytest
 
--- a/third_party/python/pytest/doc/en/announce/release-2.3.5.rst
+++ b/third_party/python/pytest/doc/en/announce/release-2.3.5.rst
@@ -8,18 +8,18 @@ prior version are expected to work unmod
 few interesting new plugins saw the light last month:
 
 - pytest-instafail: show failure information while tests are running
 - pytest-qt: testing of GUI applications written with QT/Pyside
 - pytest-xprocess: managing external processes across test runs
 - pytest-random: randomize test ordering
 
 And several others like pytest-django saw maintenance releases.
-For a more complete list, check out 
-https://pypi.python.org/pypi?%3Aaction=search&term=pytest&submit=search.
+For a more complete list, check out
+https://pypi.org/search/?q=pytest
 
 For general information see:
 
      http://pytest.org/
 
 To install or upgrade pytest:
 
     pip install -U pytest # or
@@ -76,22 +76,21 @@ Changes between 2.3.4 and 2.3.5
 
 - move long description of distribution into README.rst
 
 - improve docstring for metafunc.parametrize()
 
 - fix bug where using capsys with pytest.set_trace() in a test
   function would break when looking at capsys.readouterr()
 
-- allow to specify prefixes starting with "_" when 
+- allow to specify prefixes starting with "_" when
   customizing python_functions test discovery. (thanks Graham Horler)
 
 - improve PYTEST_DEBUG tracing output by putting
   extra data on a new lines with additional indent
 
 - ensure OutcomeExceptions like skip/fail have initialized exception attributes
 
 - issue 260 - don't use nose special setup on plain unittest cases
 
 - fix issue134 - print the collect errors that prevent running specified test items
 
 - fix issue266 - accept unicode in MarkEvaluator expressions
-
--- a/third_party/python/pytest/doc/en/announce/release-2.4.0.rst
+++ b/third_party/python/pytest/doc/en/announce/release-2.4.0.rst
@@ -1,57 +1,57 @@
 pytest-2.4.0: new fixture features/hooks and bug fixes
 ===========================================================================
 
-The just released pytest-2.4.0 brings many improvements and numerous 
+The just released pytest-2.4.0 brings many improvements and numerous
 bug fixes while remaining plugin- and test-suite compatible apart
-from a few supposedly very minor incompatibilities.  See below for 
+from a few supposedly very minor incompatibilities.  See below for
 a full list of details.  A few feature highlights:
 
 - new yield-style fixtures `pytest.yield_fixture
   <http://pytest.org/latest/yieldfixture.html>`_, allowing to use
   existing with-style context managers in fixture functions.
 
 - improved pdb support: ``import pdb ; pdb.set_trace()`` now works
   without requiring prior disabling of stdout/stderr capturing.
   Also the ``--pdb`` options works now on collection and internal errors
-  and we introduced a new experimental hook for IDEs/plugins to 
+  and we introduced a new experimental hook for IDEs/plugins to
   intercept debugging: ``pytest_exception_interact(node, call, report)``.
 
 - shorter monkeypatch variant to allow specifying an import path as
   a target, for example: ``monkeypatch.setattr("requests.get", myfunc)``
 
 - better unittest/nose compatibility: all teardown methods are now only
   called if the corresponding setup method succeeded.
 
 - integrate tab-completion on command line options if you
-  have `argcomplete <http://pypi.python.org/pypi/argcomplete>`_ 
+  have `argcomplete <http://pypi.python.org/pypi/argcomplete>`_
   configured.
 
 - allow boolean expression directly with skipif/xfail
   if a "reason" is also specified.
 
 - a new hook ``pytest_load_initial_conftests`` allows plugins like
-  `pytest-django <http://pypi.python.org/pypi/pytest-django>`_ to
+  `pytest-django <https://pypi.org/project/pytest-django/>`_ to
   influence the environment before conftest files import ``django``.
 
 - reporting: color the last line red or green depending if
   failures/errors occurred or everything passed.
 
-The documentation has been updated to accommodate the changes, 
-see `http://pytest.org <http://pytest.org>`_ 
+The documentation has been updated to accommodate the changes,
+see `http://pytest.org <http://pytest.org>`_
 
 To install or upgrade pytest::
 
     pip install -U pytest # or
     easy_install -U pytest
 
 
-**Many thanks to all who helped, including Floris Bruynooghe, 
-Brianna Laugher, Andreas Pelme, Anthon van der Neut, Anatoly Bubenkoff, 
+**Many thanks to all who helped, including Floris Bruynooghe,
+Brianna Laugher, Andreas Pelme, Anthon van der Neut, Anatoly Bubenkoff,
 Vladimir Keleshev, Mathieu Agopian, Ronny Pfannschmidt, Christian
 Theunert and many others.**
 
 may passing tests be with you,
 
 holger krekel
 
 Changes between 2.3.5 and 2.4
@@ -96,22 +96,22 @@ new features:
 
 - reporting: color the last line red or green depending if
   failures/errors occurred or everything passed.  thanks Christian
   Theunert.
 
 - make "import pdb ; pdb.set_trace()" work natively wrt capturing (no
   "-s" needed anymore), making ``pytest.set_trace()`` a mere shortcut.
 
-- fix issue181: --pdb now also works on collect errors (and 
-  on internal errors) .  This was implemented by a slight internal 
-  refactoring and the introduction of a new hook 
+- fix issue181: --pdb now also works on collect errors (and
+  on internal errors) .  This was implemented by a slight internal
+  refactoring and the introduction of a new hook
   ``pytest_exception_interact`` hook (see next item).
 
-- fix issue341: introduce new experimental hook for IDEs/terminals to 
+- fix issue341: introduce new experimental hook for IDEs/terminals to
   intercept debugging: ``pytest_exception_interact(node, call, report)``.
 
 - new monkeypatch.setattr() variant to provide a shorter
   invocation for patching out classes/functions from modules:
 
      monkeypatch.setattr("requests.get", myfunc)
 
   will replace the "get" function of the "requests" module with ``myfunc``.
@@ -119,17 +119,17 @@ new features:
 - fix issue322: tearDownClass is not run if setUpClass failed. Thanks
   Mathieu Agopian for the initial fix.  Also make all of pytest/nose
   finalizer mimic the same generic behaviour: if a setupX exists and
   fails, don't run teardownX.  This internally introduces a new method
   "node.addfinalizer()" helper which can only be called during the setup
   phase of a node.
 
 - simplify pytest.mark.parametrize() signature: allow to pass a
-  CSV-separated string to specify argnames.  For example: 
+  CSV-separated string to specify argnames.  For example:
   ``pytest.mark.parametrize("input,expected",  [(1,2), (2,3)])``
   works as well as the previous:
   ``pytest.mark.parametrize(("input", "expected"), ...)``.
 
 - add support for setUpModule/tearDownModule detection, thanks Brian Okken.
 
 - integrate tab-completion on options through use of "argcomplete".
   Thanks Anthon van der Neut for the PR.
@@ -144,20 +144,20 @@ new features:
 - fix issue 308 - allow to mark/xfail/skip individual parameter sets
   when parametrizing.  Thanks Brianna Laugher.
 
 - call new experimental pytest_load_initial_conftests hook to allow
   3rd party plugins to do something before a conftest is loaded.
 
 Bug fixes:
 
-- fix issue358 - capturing options are now parsed more properly 
+- fix issue358 - capturing options are now parsed more properly
   by using a new parser.parse_known_args method.
 
-- pytest now uses argparse instead of optparse (thanks Anthon) which 
+- pytest now uses argparse instead of optparse (thanks Anthon) which
   means that "argparse" is added as a dependency if installing into python2.6
   environments or below.
 
 - fix issue333: fix a case of bad unittest/pytest hook interaction.
 
 - PR27: correctly handle nose.SkipTest during collection.  Thanks
   Antonio Cuni, Ronny Pfannschmidt.
 
@@ -188,38 +188,37 @@ Bug fixes:
   reporting (thanks Katarzyna Jachim)
 
 - fix issue300 - Fix order of conftest loading when starting py.test
   in a subdirectory.
 
 - fix issue323 - sorting of many module-scoped arg parametrizations
 
 - make sessionfinish hooks execute with the same cwd-context as at
-  session start (helps fix plugin behaviour which write output files 
+  session start (helps fix plugin behaviour which write output files
   with relative path such as pytest-cov)
 
 - fix issue316 - properly reference collection hooks in docs
 
 - fix issue 306 - cleanup of -k/-m options to only match markers/test
   names/keywords respectively.  Thanks Wouter van Ackooy.
 
-- improved doctest counting for doctests in python modules -- 
+- improved doctest counting for doctests in python modules --
   files without any doctest items will not show up anymore
   and doctest examples are counted as separate test items.
   thanks Danilo Bellini.
 
 - fix issue245 by depending on the released py-1.4.14
   which fixes py.io.dupfile to work with files with no
   mode. Thanks Jason R. Coombs.
 
 - fix junitxml generation when test output contains control characters,
-  addressing issue267, thanks Jaap Broekhuizen 
+  addressing issue267, thanks Jaap Broekhuizen
 
 - fix issue338: honor --tb style for setup/teardown errors as well.  Thanks Maho.
 
 - fix issue307 - use yaml.safe_load in example, thanks Mark Eichin.
 
 - better parametrize error messages, thanks Brianna Laugher
 
 - pytest_terminal_summary(terminalreporter) hooks can now use
-  ".section(title)" and ".line(msg)" methods to print extra 
+  ".section(title)" and ".line(msg)" methods to print extra
   information at the end of a test run.
-
--- a/third_party/python/pytest/doc/en/announce/release-2.4.1.rst
+++ b/third_party/python/pytest/doc/en/announce/release-2.4.1.rst
@@ -3,17 +3,17 @@ pytest-2.4.1: fixing three regressions c
 
 pytest-2.4.1 is a quick follow up release to fix three regressions
 compared to 2.3.5 before they hit more people:
 
 - When using parser.addoption() unicode arguments to the
   "type" keyword should also be converted to the respective types.
   thanks Floris Bruynooghe, @dnozay. (fixes issue360 and issue362)
 
-- fix dotted filename completion when using argcomplete 
+- fix dotted filename completion when using argcomplete
   thanks Anthon van der Neuth. (fixes issue361)
 
 - fix regression when a 1-tuple ("arg",) is used for specifying
   parametrization (the values of the parametrization were passed
   nested in a tuple).  Thanks Donald Stufft.
 
 - also merge doc typo fixes, thanks Andy Dirnberger
 
--- a/third_party/python/pytest/doc/en/announce/release-2.4.2.rst
+++ b/third_party/python/pytest/doc/en/announce/release-2.4.2.rst
@@ -21,19 +21,19 @@ pytest-2.4.2 is another bug-fixing relea
 
 - introduce node.get_marker/node.add_marker API for plugins
   like pytest-pep8 and pytest-flakes to avoid the messy
   details of the node.keywords  pseudo-dicts.  Adapted
   docs.
 
 - remove attempt to "dup" stdout at startup as it's icky.
   the normal capturing should catch enough possibilities
-  of tests messing up standard FDs. 
+  of tests messing up standard FDs.
 
-- add pluginmanager.do_configure(config) as a link to 
+- add pluginmanager.do_configure(config) as a link to
   config.do_configure() for plugin-compatibility
 
 as usual, docs at http://pytest.org and upgrades via::
 
     pip install -U pytest
 
 have fun,
 holger krekel
--- a/third_party/python/pytest/doc/en/announce/release-2.5.0.rst
+++ b/third_party/python/pytest/doc/en/announce/release-2.5.0.rst
@@ -1,33 +1,33 @@
 pytest-2.5.0: now down to ZERO reported bugs!
 ===========================================================================
 
 pytest-2.5.0 is a big fixing release, the result of two community bug
 fixing days plus numerous additional works from many people and
 reporters.  The release should be fully compatible to 2.4.2, existing
-plugins and test suites.  We aim at maintaining this level of ZERO reported 
+plugins and test suites.  We aim at maintaining this level of ZERO reported
 bugs because it's no fun if your testing tool has bugs, is it?  Under a
 condition, though: when submitting a bug report please provide
 clear information about the circumstances and a simple example which
 reproduces the problem.
 
 The issue tracker is of course not empty now.  We have many remaining
 "enhacement" issues which we'll hopefully can tackle in 2014 with your
 help.
 
 For those who use older Python versions, please note that pytest is not
 automatically tested on python2.5 due to virtualenv, setuptools and tox
 not supporting it anymore.  Manual verification shows that it mostly
-works fine but it's not going to be part of the automated release 
+works fine but it's not going to be part of the automated release
 process and thus likely to break in the future.
 
-As usual, current docs are at 
+As usual, current docs are at
 
-    http://pytest.org 
+    http://pytest.org
 
 and you can upgrade from pypi via::
 
     pip install -U pytest
 
 Particular thanks for helping with this release go to Anatoly Bubenkoff,
 Floris Bruynooghe, Marc Abramowitz, Ralph Schmitt, Ronny Pfannschmidt,
 Donald Stufft, James Lan, Rob Dennis, Jason R. Coombs, Mathieu Agopian,
@@ -35,58 +35,58 @@ Virgil Dupras, Bruno Oliveira, Alex Gayn
 
 have fun,
 holger krekel
 
 
 2.5.0
 -----------------------------------
 
-- dropped python2.5 from automated release testing of pytest itself 
-  which means it's probably going to break soon (but still works 
+- dropped python2.5 from automated release testing of pytest itself
+  which means it's probably going to break soon (but still works
   with this release we believe).
 
 - simplified and fixed implementation for calling finalizers when
-  parametrized fixtures or function arguments are involved.  finalization 
+  parametrized fixtures or function arguments are involved.  finalization
   is now performed lazily at setup time instead of in the "teardown phase".
-  While this might sound odd at first, it helps to ensure that we are 
+  While this might sound odd at first, it helps to ensure that we are
   correctly handling setup/teardown even in complex code.  User-level code
   should not be affected unless it's implementing the pytest_runtest_teardown
   hook and expecting certain fixture instances are torn down within (very
   unlikely and would have been unreliable anyway).
 
-- PR90: add --color=yes|no|auto option to force terminal coloring 
+- PR90: add --color=yes|no|auto option to force terminal coloring
   mode ("auto" is default).  Thanks Marc Abramowitz.
 
 - fix issue319 - correctly show unicode in assertion errors.  Many
   thanks to Floris Bruynooghe for the complete PR.  Also means
   we depend on py>=1.4.19 now.
 
-- fix issue396 - correctly sort and finalize class-scoped parametrized 
-  tests independently from number of methods on the class.  
+- fix issue396 - correctly sort and finalize class-scoped parametrized
+  tests independently from number of methods on the class.
 
 - refix issue323 in a better way -- parametrization should now never
   cause Runtime Recursion errors because the underlying algorithm
   for re-ordering tests per-scope/per-fixture is not recursive
   anymore (it was tail-call recursive before which could lead
   to problems for more than >966 non-function scoped parameters).
 
 - fix issue290 - there is preliminary support now for parametrizing
-  with repeated same values (sometimes useful to test if calling 
+  with repeated same values (sometimes useful to test if calling
   a second time works as with the first time).
 
 - close issue240 - document precisely how pytest module importing
-  works, discuss the two common test directory layouts, and how it 
+  works, discuss the two common test directory layouts, and how it
   interacts with PEP420-namespace packages.
 
 - fix issue246 fix finalizer order to be LIFO on independent fixtures
-  depending on a parametrized higher-than-function scoped fixture. 
+  depending on a parametrized higher-than-function scoped fixture.
   (was quite some effort so please bear with the complexity of this sentence :)
   Thanks Ralph Schmitt for the precise failure example.
- 
+
 - fix issue244 by implementing special index for parameters to only use
   indices for paramentrized test ids
 
 - fix issue287 by running all finalizers but saving the exception
   from the first failing finalizer and re-raising it so teardown will
   still have failed.  We reraise the first failing exception because
   it might be the cause for other finalizers to fail.
 
@@ -94,27 +94,27 @@ 2.5.0
   are used with test methods.  This fixues issue346 and should
   help with random "xdist" collection failures.  Thanks to
   Ronny Pfannschmidt and Donald Stufft for helping to isolate it.
 
 - fix issue357 - special case "-k" expressions to allow for
   filtering with simple strings that are not valid python expressions.
   Examples: "-k 1.3" matches all tests parametrized with 1.3.
   "-k None" filters all tests that have "None" in their name
-  and conversely "-k 'not None'". 
+  and conversely "-k 'not None'".
   Previously these examples would raise syntax errors.
-  
+
 - fix issue384 by removing the trial support code
   since the unittest compat enhancements allow
   trial to handle it on its own
 
 - don't hide an ImportError when importing a plugin produces one.
   fixes issue375.
 
-- fix issue275 - allow usefixtures and autouse fixtures 
+- fix issue275 - allow usefixtures and autouse fixtures
   for running doctest text files.
 
 - fix issue380 by making --resultlog only rely on longrepr instead
   of the "reprcrash" attribute which only exists sometimes.
 
 - address issue122: allow @pytest.fixture(params=iterator) by exploding
   into a list early on.
 
@@ -130,46 +130,45 @@ 2.5.0
 
 - In assertion rewriting mode on Python 2, fix the detection of coding
   cookies. See issue #330.
 
 - make "--runxfail" turn imperative pytest.xfail calls into no ops
   (it already did neutralize pytest.mark.xfail markers)
 
 - refine pytest / pkg_resources interactions: The AssertionRewritingHook
-  PEP302 compliant loader now registers itself with setuptools/pkg_resources 
+  PEP302 compliant loader now registers itself with setuptools/pkg_resources
   properly so that the pkg_resources.resource_stream method works properly.
   Fixes issue366.  Thanks for the investigations and full PR to Jason R. Coombs.
 
 - pytestconfig fixture is now session-scoped as it is the same object during the
-  whole test run.  Fixes issue370. 
+  whole test run.  Fixes issue370.
 
 - avoid one surprising case of marker malfunction/confusion::
-  
+
       @pytest.mark.some(lambda arg: ...)
       def test_function():
 
-  would not work correctly because pytest assumes @pytest.mark.some 
-  gets a function to be decorated already.  We now at least detect if this 
+  would not work correctly because pytest assumes @pytest.mark.some
+  gets a function to be decorated already.  We now at least detect if this
   arg is a lambda and thus the example will work.  Thanks Alex Gaynor
   for bringing it up.
 
 - xfail a test on pypy that checks wrong encoding/ascii (pypy does
   not error out). fixes issue385.
 
 - internally make varnames() deal with classes's __init__,
   although it's not needed by pytest itself atm.  Also
   fix caching.  Fixes issue376.
 
-- fix issue221 - handle importing of namespace-package with no 
+- fix issue221 - handle importing of namespace-package with no
   __init__.py properly.
 
 - refactor internal FixtureRequest handling to avoid monkeypatching.
-  One of the positive user-facing effects is that the "request" object 
+  One of the positive user-facing effects is that the "request" object
   can now be used in closures.
 
 - fixed version comparison in pytest.importskip(modname, minverstring)
 
 - fix issue377 by clarifying in the nose-compat docs that pytest
   does not duplicate the unittest-API into the "plain" namespace.
 
 - fix verbose reporting for @mock'd test functions
-
--- a/third_party/python/pytest/doc/en/announce/release-2.5.1.rst
+++ b/third_party/python/pytest/doc/en/announce/release-2.5.1.rst
@@ -1,27 +1,27 @@
 pytest-2.5.1: fixes and new home page styling
 ===========================================================================
 
-pytest is a mature Python testing tool with more than a 1000 tests 
-against itself, passing on many different interpreters and platforms.  
+pytest is a mature Python testing tool with more than a 1000 tests
+against itself, passing on many different interpreters and platforms.
 
 The 2.5.1 release maintains the "zero-reported-bugs" promise by fixing
 the three bugs reported since the last release a few days ago.  It also
 features a new home page styling implemented by Tobias Bieniek, based on
 the flask theme from Armin Ronacher:
 
     http://pytest.org
 
-If you have anything more to improve styling and docs, 
+If you have anything more to improve styling and docs,
 we'd be very happy to merge further pull requests.
 
 On the coding side, the release also contains a little enhancement to
 fixture decorators allowing to directly influence generation of test
-ids, thanks to Floris Bruynooghe.  Other thanks for helping with 
+ids, thanks to Floris Bruynooghe.  Other thanks for helping with
 this release go to Anatoly Bubenkoff and Ronny Pfannschmidt.
 
 As usual, you can upgrade from pypi via::
 
     pip install -U pytest
 
 have fun and a nice remaining "bug-free" time of the year :)
 holger krekel
@@ -32,16 +32,15 @@ 2.5.1
 - merge new documentation styling PR from Tobias Bieniek.
 
 - fix issue403: allow parametrize of multiple same-name functions within
   a collection node.  Thanks Andreas Kloeckner and Alex Gaynor for reporting
   and analysis.
 
 - Allow parameterized fixtures to specify the ID of the parameters by
   adding an ids argument to pytest.fixture() and pytest.yield_fixture().
-  Thanks Floris Bruynooghe. 
+  Thanks Floris Bruynooghe.
 
 - fix issue404 by always using the binary xml escape in the junitxml
   plugin.  Thanks Ronny Pfannschmidt.
 
 - fix issue407: fix addoption docstring to point to argparse instead of
   optparse. Thanks Daniel D. Wright.
-
--- a/third_party/python/pytest/doc/en/announce/release-2.5.2.rst
+++ b/third_party/python/pytest/doc/en/announce/release-2.5.2.rst
@@ -1,64 +1,63 @@
-pytest-2.5.2: fixes 
+pytest-2.5.2: fixes
 ===========================================================================
 
-pytest is a mature Python testing tool with more than a 1000 tests 
-against itself, passing on many different interpreters and platforms.  
+pytest is a mature Python testing tool with more than a 1000 tests
+against itself, passing on many different interpreters and platforms.
 
 The 2.5.2 release fixes a few bugs with two maybe-bugs remaining and
 actively being worked on (and waiting for the bug reporter's input).
 We also have a new contribution guide thanks to Piotr Banaszkiewicz
 and others.
 
 See docs at:
 
     http://pytest.org
 
 As usual, you can upgrade from pypi via::
 
     pip install -U pytest
 
 Thanks to the following people who contributed to this release:
 
-    Anatoly Bubenkov 
+    Anatoly Bubenkov
     Ronny Pfannschmidt
     Floris Bruynooghe
-    Bruno Oliveira 
-    Andreas Pelme 
+    Bruno Oliveira
+    Andreas Pelme
     Jurko Gospodnetić
-    Piotr Banaszkiewicz 
-    Simon Liedtke 
-    lakka 
-    Lukasz Balcerzak 
-    Philippe Muller 
-    Daniel Hahler 
+    Piotr Banaszkiewicz
+    Simon Liedtke
+    lakka
+    Lukasz Balcerzak
+    Philippe Muller
+    Daniel Hahler
 
 have fun,
 holger krekel
 
 2.5.2
 -----------------------------------
 
 - fix issue409 -- better interoperate with cx_freeze by not
-  trying to import from collections.abc which causes problems 
+  trying to import from collections.abc which causes problems
   for py27/cx_freeze.  Thanks Wolfgang L. for reporting and tracking it down.
 
 - fixed docs and code to use "pytest" instead of "py.test" almost everywhere.
-  Thanks Jurko Gospodnetic for the complete PR.  
+  Thanks Jurko Gospodnetic for the complete PR.
 
 - fix issue425: mention at end of "py.test -h" that --markers
   and --fixtures work according to specified test path (or current dir)
 
 - fix issue413: exceptions with unicode attributes are now printed
   correctly also on python2 and with pytest-xdist runs. (the fix
   requires py-1.4.20)
 
 - copy, cleanup and integrate py.io capture
   from pylib 1.4.20.dev2 (rev 13d9af95547e)
-  
+
 - address issue416: clarify docs as to conftest.py loading semantics
 
 - fix issue429: comparing byte strings with non-ascii chars in assert
   expressions now work better.  Thanks Floris Bruynooghe.
 
 - make capfd/capsys.capture private, its unused and shouldn't be exposed
-
--- a/third_party/python/pytest/doc/en/announce/release-2.6.1.rst
+++ b/third_party/python/pytest/doc/en/announce/release-2.6.1.rst
@@ -47,13 +47,12 @@ Changes 2.6.1
 
 - fix integration of pytest with unittest.mock.patch decorator when
   it uses the "new" argument.  Thanks Nicolas Delaby for test and PR.
 
 - fix issue with detecting conftest files if the arguments contain
   "::" node id specifications (copy pasted from "-v" output)
 
 - fix issue544 by only removing "@NUM" at the end of "::" separated parts
-  and if the part has an ".py" extension
+  and if the part has a ".py" extension
 
 - don't use py.std import helper, rather import things directly.
   Thanks Bruno Oliveira.
-
--- a/third_party/python/pytest/doc/en/announce/release-2.6.2.rst
+++ b/third_party/python/pytest/doc/en/announce/release-2.6.2.rst
@@ -44,9 +44,8 @@ 2.6.2
 
 - Fix example in monkeypatch documentation, thanks t-8ch.
 
 - fix issue572: correct tmpdir doc example for python3.
 
 - Do not mark as universal wheel because Python 2.6 is different from
   other builds due to the extra argparse dependency.  Fixes issue566.
   Thanks sontek.
-
--- a/third_party/python/pytest/doc/en/announce/release-2.6.3.rst
+++ b/third_party/python/pytest/doc/en/announce/release-2.6.3.rst
@@ -44,9 +44,8 @@ Changes 2.6.3
   CWD outside of a test package pytest would get fixture discovery wrong.
   Thanks to Wolfgang Schnerring for figuring out a reproducible example.
 
 - Introduce pytest_enter_pdb hook (needed e.g. by pytest_timeout to cancel the
   timeout when interactively entering pdb).  Thanks Wolfgang Schnerring.
 
 - check xfail/skip also with non-python function test items. Thanks
   Floris Bruynooghe.
-
--- a/third_party/python/pytest/doc/en/announce/release-2.7.0.rst
+++ b/third_party/python/pytest/doc/en/announce/release-2.7.0.rst
@@ -57,17 +57,17 @@ 2.7.0 (compared to 2.6.4)
 
 - fix issue650: new option ``--docttest-ignore-import-errors`` which
   will turn import errors in doctests into skips.  Thanks Charles Cloud
   for the complete PR.
 
 - fix issue655: work around different ways that cause python2/3
   to leak sys.exc_info into fixtures/tests causing failures in 3rd party code
 
-- fix issue615: assertion re-writing did not correctly escape % signs
+- fix issue615: assertion rewriting did not correctly escape % signs
   when formatting boolean operations, which tripped over mixing
   booleans with modulo operators.  Thanks to Tom Viner for the report,
   triaging and fix.
 
 - implement issue351: add ability to specify parametrize ids as a callable
   to generate custom test ids.  Thanks Brianna Laugher for the idea and
   implementation.
 
@@ -93,9 +93,8 @@ 2.7.0 (compared to 2.6.4)
 
 - allow to override parametrized fixtures with non-parametrized ones and vice versa (bubenkoff).
 
 - fix issue463: raise specific error for 'parameterize' misspelling (pfctdayelise).
 
 - On failure, the ``sys.last_value``, ``sys.last_type`` and
   ``sys.last_traceback`` are set, so that a user can inspect the error
   via postmortem debugging (almarklein).
-
--- a/third_party/python/pytest/doc/en/announce/release-2.7.2.rst
+++ b/third_party/python/pytest/doc/en/announce/release-2.7.2.rst
@@ -50,9 +50,8 @@ 2.7.2 (compared to 2.7.1)
 - fix issue748: unittest.SkipTest reports to internal pytest unittest plugin.
   Thanks Thomas De Schampheleire for reporting and Bruno Oliveira for the PR.
 
 - fix issue718: failed to create representation of sets containing unsortable
   elements in python 2. Thanks Edison Gustavo Muenz
 
 - fix issue756, fix issue752 (and similar issues): depend on py-1.4.29
   which has a refined algorithm for traceback generation.
-
--- a/third_party/python/pytest/doc/en/announce/release-2.8.3.rst
+++ b/third_party/python/pytest/doc/en/announce/release-2.8.3.rst
@@ -48,12 +48,11 @@ 2.8.3 (compared to 2.8.2)
   belongs to a file which is no longer available.
   Thanks Bruno Oliveira for the PR.
 
 - enhancement made to highlight in red the name of the failing tests so
   they stand out in the output.
   Thanks Gabriel Reis for the PR.
 
 - add more talks to the documentation
-- extend documentation on the --ignore cli option 
-- use pytest-runner for setuptools integration 
+- extend documentation on the --ignore cli option
+- use pytest-runner for setuptools integration
 - minor fixes for interaction with OS X El Capitan system integrity protection (thanks Florian)
-
--- a/third_party/python/pytest/doc/en/announce/release-2.8.7.rst
+++ b/third_party/python/pytest/doc/en/announce/release-2.8.7.rst
@@ -23,9 +23,9 @@ Thanks to all who contributed to this re
 
 Happy testing,
 The py.test Development Team
 
 
 2.8.7 (compared to 2.8.6)
 -------------------------
 
-- fix #1338: use predictable object resolution for monkeypatch
\ No newline at end of file
+- fix #1338: use predictable object resolution for monkeypatch
--- a/third_party/python/pytest/doc/en/announce/release-2.9.0.rst
+++ b/third_party/python/pytest/doc/en/announce/release-2.9.0.rst
@@ -9,35 +9,35 @@ See below for the changes and see docs a
     http://pytest.org
 
 As usual, you can upgrade from pypi via::
 
     pip install -U pytest
 
 Thanks to all who contributed to this release, among them:
 
-    Anatoly Bubenkov                                                                                                                                                                                                         
-    Bruno Oliveira                                                                                                                                                                                                           
-    Buck Golemon                                                                                                                                                                                                             
-    David Vierra                                                                                                                                                                                                             
-    Florian Bruhin                                                                                                                                                                                                           
-    Galaczi Endre                                                                                                                                                                                                            
-    Georgy Dyuldin                                                                                                                                                                                                           
-    Lukas Bednar                                                                                                                                                                                                             
-    Luke Murphy                                                                                                                                                                                                              
-    Marcin Biernat                                                                                                                                                                                                           
-    Matt Williams                                                                                                                                                                                                            
-    Michael Aquilina                                                                                                                                                                                                         
-    Raphael Pierzina                                                                                                                                                                                                         
-    Ronny Pfannschmidt                                                                                                                                                                                                       
-    Ryan Wooden                                                                                                                                                                                                              
-    Tiemo Kieft                                                                                                                                                                                                              
-    TomV                                                                                                                                                                                                                     
-    holger krekel                                                                                                                                                                                                            
-    jab   
+    Anatoly Bubenkov
+    Bruno Oliveira
+    Buck Golemon
+    David Vierra
+    Florian Bruhin
+    Galaczi Endre
+    Georgy Dyuldin
+    Lukas Bednar
+    Luke Murphy
+    Marcin Biernat
+    Matt Williams
+    Michael Aquilina
+    Raphael Pierzina
+    Ronny Pfannschmidt
+    Ryan Wooden
+    Tiemo Kieft
+    TomV
+    holger krekel
+    jab
 
 
 Happy testing,
 The py.test Development Team
 
 
 2.9.0 (compared to 2.8.7)
 -------------------------
@@ -71,28 +71,28 @@ 2.9.0 (compared to 2.8.7)
 
 * catch IndexError exceptions when getting exception source location. This fixes
   pytest internal error for dynamically generated code (fixtures and tests)
   where source lines are fake by intention
 
 **Changes**
 
 * **Important**: `py.code <https://pylib.readthedocs.io/en/latest/code.html>`_ has been
-  merged into the ``pytest`` repository as ``pytest._code``. This decision 
-  was made because ``py.code`` had very few uses outside ``pytest`` and the 
-  fact that it was in a different repository made it difficult to fix bugs on 
+  merged into the ``pytest`` repository as ``pytest._code``. This decision
+  was made because ``py.code`` had very few uses outside ``pytest`` and the
+  fact that it was in a different repository made it difficult to fix bugs on
   its code in a timely manner. The team hopes with this to be able to better
   refactor out and improve that code.
   This change shouldn't affect users, but it is useful to let users aware
   if they encounter any strange behavior.
-  
-  Keep in mind that the code for ``pytest._code`` is **private** and 
+
+  Keep in mind that the code for ``pytest._code`` is **private** and
   **experimental**, so you definitely should not import it explicitly!
 
-  Please note that the original ``py.code`` is still available in 
+  Please note that the original ``py.code`` is still available in
   `pylib <https://pylib.readthedocs.io>`_.
 
 * ``pytest_enter_pdb`` now optionally receives the pytest config object.
   Thanks `@nicoddemus`_ for the PR.
 
 * Removed code and documentation for Python 2.5 or lower versions,
   including removal of the obsolete ``_pytest.assertion.oldinterpret`` module.
   Thanks `@nicoddemus`_ for the PR (`#1226`_).
@@ -124,18 +124,18 @@ 2.9.0 (compared to 2.8.7)
   Thanks `@biern`_ for the PR.
 
 * Fix `traceback style docs`_ to describe all of the available options
   (auto/long/short/line/native/no), with `auto` being the default since v2.6.
   Thanks `@hackebrot`_ for the PR.
 
 * Fix (`#1422`_): junit record_xml_property doesn't allow multiple records
   with same name.
-  
-  
+
+
 .. _`traceback style docs`: https://pytest.org/latest/usage.html#modifying-python-traceback-printing
 
 .. _#1422: https://github.com/pytest-dev/pytest/issues/1422
 .. _#1379: https://github.com/pytest-dev/pytest/issues/1379
 .. _#1366: https://github.com/pytest-dev/pytest/issues/1366
 .. _#1040: https://github.com/pytest-dev/pytest/pull/1040
 .. _#680: https://github.com/pytest-dev/pytest/issues/680
 .. _#1287: https://github.com/pytest-dev/pytest/pull/1287
@@ -151,9 +151,9 @@ 2.9.0 (compared to 2.8.7)
 .. _@jab: https://github.com/jab
 .. _@codewarrior0: https://github.com/codewarrior0
 .. _@jaraco: https://github.com/jaraco
 .. _@The-Compiler: https://github.com/The-Compiler
 .. _@Shinkenjoe: https://github.com/Shinkenjoe
 .. _@tomviner: https://github.com/tomviner
 .. _@RonnyPfannschmidt: https://github.com/RonnyPfannschmidt
 .. _@rabbbit: https://github.com/rabbbit
-.. _@hackebrot: https://github.com/hackebrot
\ No newline at end of file
+.. _@hackebrot: https://github.com/hackebrot
--- a/third_party/python/pytest/doc/en/announce/release-2.9.1.rst
+++ b/third_party/python/pytest/doc/en/announce/release-2.9.1.rst
@@ -9,27 +9,27 @@ See below for the changes and see docs a
     http://pytest.org
 
 As usual, you can upgrade from pypi via::
 
     pip install -U pytest
 
 Thanks to all who contributed to this release, among them:
 
-    Bruno Oliveira                                                                                                                                                                                                                            
-    Daniel Hahler                                                                                                                                                                                                                             
-    Dmitry Malinovsky                                                                                                                                                                                                                         
-    Florian Bruhin                                                                                                                                                                                                                            
-    Floris Bruynooghe                                                                                                                                                                                                                         
-    Matt Bachmann                                                                                                                                                                                                                             
-    Ronny Pfannschmidt                                                                                                                                                                                                                        
-    TomV                                                                                                                                                                                                                                      
-    Vladimir Bolshakov                                                                                                                                                                                                                        
-    Zearin                                                                                                                                                                                                                                     
-    palaviv   
+    Bruno Oliveira
+    Daniel Hahler
+    Dmitry Malinovsky
+    Florian Bruhin
+    Floris Bruynooghe
+    Matt Bachmann
+    Ronny Pfannschmidt
+    TomV
+    Vladimir Bolshakov
+    Zearin
+    palaviv
 
 
 Happy testing,
 The py.test Development Team
 
 
 2.9.1 (compared to 2.9.0)
 -------------------------
--- a/third_party/python/pytest/doc/en/announce/release-3.0.0.rst
+++ b/third_party/python/pytest/doc/en/announce/release-3.0.0.rst
@@ -3,20 +3,20 @@ pytest-3.0.0
 
 The pytest team is proud to announce the 3.0.0 release!
 
 pytest is a mature Python testing tool with more than a 1600 tests
 against itself, passing on many different interpreters and platforms.
 
 This release contains a lot of bugs fixes and improvements, and much of
 the work done on it was possible because of the 2016 Sprint[1], which
-was funded by an indiegogo campaign which raised over US$12,000 with 
-nearly 100 backers. 
+was funded by an indiegogo campaign which raised over US$12,000 with
+nearly 100 backers.
 
-There's a "What's new in pytest 3.0" [2] blog post highlighting the 
+There's a "What's new in pytest 3.0" [2] blog post highlighting the
 major features in this release.
 
 To see the complete changelog and documentation, please visit:
 
     http://docs.pytest.org
 
 As usual, you can upgrade from pypi via:
 
--- a/third_party/python/pytest/doc/en/announce/release-3.0.1.rst
+++ b/third_party/python/pytest/doc/en/announce/release-3.0.1.rst
@@ -2,17 +2,17 @@ pytest-3.0.1
 ============
 
 pytest 3.0.1 has just been released to PyPI.
 
 This release fixes some regressions reported in version 3.0.0, being a
 drop-in replacement. To upgrade:
 
   pip install --upgrade pytest
-  
+
 The changelog is available at http://doc.pytest.org/en/latest/changelog.html.
 
 Thanks to all who contributed to this release, among them:
 
       Adam Chainz
       Andrew Svetlov
       Bruno Oliveira
       Daniel Hahler
--- a/third_party/python/pytest/doc/en/announce/release-3.0.2.rst
+++ b/third_party/python/pytest/doc/en/announce/release-3.0.2.rst
@@ -2,17 +2,17 @@ pytest-3.0.2
 ============
 
 pytest 3.0.2 has just been released to PyPI.
 
 This release fixes some regressions and bugs reported in version 3.0.1, being a
 drop-in replacement. To upgrade::
 
   pip install --upgrade pytest
-  
+
 The changelog is available at http://doc.pytest.org/en/latest/changelog.html.
 
 Thanks to all who contributed to this release, among them:
 
 * Ahn Ki-Wook
 * Bruno Oliveira
 * Florian Bruhin
 * Jordan Guymon
--- a/third_party/python/pytest/doc/en/announce/release-3.0.3.rst
+++ b/third_party/python/pytest/doc/en/announce/release-3.0.3.rst
@@ -1,18 +1,18 @@
 pytest-3.0.3
 ============
 
 pytest 3.0.3 has just been released to PyPI.
 
-This release fixes some regressions and bugs reported in the last version, 
+This release fixes some regressions and bugs reported in the last version,
 being a drop-in replacement. To upgrade::
 
   pip install --upgrade pytest
-  
+
 The changelog is available at http://doc.pytest.org/en/latest/changelog.html.
 
 Thanks to all who contributed to this release, among them:
 
 * Bruno Oliveira
 * Florian Bruhin
 * Floris Bruynooghe
 * Huayi Zhang
--- a/third_party/python/pytest/doc/en/announce/release-3.0.4.rst
+++ b/third_party/python/pytest/doc/en/announce/release-3.0.4.rst
@@ -1,18 +1,18 @@
 pytest-3.0.4
 ============
 
 pytest 3.0.4 has just been released to PyPI.
 
-This release fixes some regressions and bugs reported in the last version, 
+This release fixes some regressions and bugs reported in the last version,
 being a drop-in replacement. To upgrade::
 
   pip install --upgrade pytest
-  
+
 The changelog is available at http://doc.pytest.org/en/latest/changelog.html.
 
 Thanks to all who contributed to this release, among them:
 
 * Bruno Oliveira
 * Dan Wandschneider
 * Florian Bruhin
 * Georgy Dyuldin
--- a/third_party/python/pytest/doc/en/announce/release-3.0.5.rst
+++ b/third_party/python/pytest/doc/en/announce/release-3.0.5.rst
@@ -1,17 +1,17 @@
 pytest-3.0.5
 ============
 
 pytest 3.0.5 has just been released to PyPI.
 
 This is a bug-fix release, being a drop-in replacement. To upgrade::
 
   pip install --upgrade pytest
-  
+
 The changelog is available at http://doc.pytest.org/en/latest/changelog.html.
 
 Thanks to all who contributed to this release, among them:
 
 * Ana Vojnovic
 * Bruno Oliveira
 * Daniel Hahler
 * Duncan Betts
--- a/third_party/python/pytest/doc/en/announce/release-3.0.6.rst
+++ b/third_party/python/pytest/doc/en/announce/release-3.0.6.rst
@@ -1,17 +1,17 @@
 pytest-3.0.6
 ============
 
 pytest 3.0.6 has just been released to PyPI.
 
 This is a bug-fix release, being a drop-in replacement. To upgrade::
 
   pip install --upgrade pytest
-  
+
 The full changelog is available at http://doc.pytest.org/en/latest/changelog.html.
 
 
 Thanks to all who contributed to this release, among them:
 
 * Andreas Pelme
 * Bruno Oliveira
 * Dmitry Malinovsky
--- a/third_party/python/pytest/doc/en/announce/release-3.0.7.rst
+++ b/third_party/python/pytest/doc/en/announce/release-3.0.7.rst
@@ -1,17 +1,17 @@
 pytest-3.0.7
 ============
 
 pytest 3.0.7 has just been released to PyPI.
 
 This is a bug-fix release, being a drop-in replacement. To upgrade::
 
   pip install --upgrade pytest
-  
+
 The full changelog is available at http://doc.pytest.org/en/latest/changelog.html.
 
 Thanks to all who contributed to this release, among them:
 
 * Anthony Sottile
 * Barney Gale
 * Bruno Oliveira
 * Florian Bruhin
--- a/third_party/python/pytest/doc/en/announce/release-3.1.1.rst
+++ b/third_party/python/pytest/doc/en/announce/release-3.1.1.rst
@@ -1,17 +1,17 @@
 pytest-3.1.1
 =======================================
 
 pytest 3.1.1 has just been released to PyPI.
 
 This is a bug-fix release, being a drop-in replacement. To upgrade::
 
   pip install --upgrade pytest
-  
+
 The full changelog is available at http://doc.pytest.org/en/latest/changelog.html.
 
 Thanks to all who contributed to this release, among them:
 
 * Bruno Oliveira
 * Florian Bruhin
 * Floris Bruynooghe
 * Jason R. Coombs
--- a/third_party/python/pytest/doc/en/announce/release-3.1.2.rst
+++ b/third_party/python/pytest/doc/en/announce/release-3.1.2.rst
@@ -1,17 +1,17 @@
 pytest-3.1.2
 =======================================
 
 pytest 3.1.2 has just been released to PyPI.
 
 This is a bug-fix release, being a drop-in replacement. To upgrade::
 
   pip install --upgrade pytest
-  
+
 The full changelog is available at http://doc.pytest.org/en/latest/changelog.html.
 
 Thanks to all who contributed to this release, among them:
 
 * Andreas Pelme
 * ApaDoctor
 * Bruno Oliveira
 * Florian Bruhin
--- a/third_party/python/pytest/doc/en/announce/release-3.1.3.rst
+++ b/third_party/python/pytest/doc/en/announce/release-3.1.3.rst
@@ -1,17 +1,17 @@
 pytest-3.1.3
 =======================================
 
 pytest 3.1.3 has just been released to PyPI.
 
 This is a bug-fix release, being a drop-in replacement. To upgrade::
 
   pip install --upgrade pytest
-  
+
 The full changelog is available at http://doc.pytest.org/en/latest/changelog.html.
 
 Thanks to all who contributed to this release, among them:
 
 * Antoine Legrand
 * Bruno Oliveira
 * Max Moroz
 * Raphael Pierzina
--- a/third_party/python/pytest/doc/en/announce/release-3.2.1.rst
+++ b/third_party/python/pytest/doc/en/announce/release-3.2.1.rst
@@ -1,17 +1,17 @@
 pytest-3.2.1
 =======================================
 
 pytest 3.2.1 has just been released to PyPI.
 
 This is a bug-fix release, being a drop-in replacement. To upgrade::
 
   pip install --upgrade pytest
-  
+
 The full changelog is available at http://doc.pytest.org/en/latest/changelog.html.
 
 Thanks to all who contributed to this release, among them:
 
 * Alex Gaynor
 * Bruno Oliveira
 * Florian Bruhin
 * Ronny Pfannschmidt
--- a/third_party/python/pytest/doc/en/announce/release-3.2.2.rst
+++ b/third_party/python/pytest/doc/en/announce/release-3.2.2.rst
@@ -1,17 +1,17 @@
 pytest-3.2.2
 =======================================
 
 pytest 3.2.2 has just been released to PyPI.
 
 This is a bug-fix release, being a drop-in replacement. To upgrade::
 
   pip install --upgrade pytest
-  
+
 The full changelog is available at http://doc.pytest.org/en/latest/changelog.html.
 
 Thanks to all who contributed to this release, among them:
 
 * Andreas Pelme
 * Antonio Hidalgo
 * Bruno Oliveira
 * Felipe Dau
--- a/third_party/python/pytest/doc/en/announce/release-3.2.3.rst
+++ b/third_party/python/pytest/doc/en/announce/release-3.2.3.rst
@@ -1,17 +1,17 @@
 pytest-3.2.3
 =======================================
 
 pytest 3.2.3 has just been released to PyPI.
 
 This is a bug-fix release, being a drop-in replacement. To upgrade::
 
   pip install --upgrade pytest
-  
+
 The full changelog is available at http://doc.pytest.org/en/latest/changelog.html.
 
 Thanks to all who contributed to this release, among them:
 
 * Bruno Oliveira
 * Evan
 * Joe Hamman
 * Oliver Bestwalter
--- a/third_party/python/pytest/doc/en/announce/release-3.2.4.rst
+++ b/third_party/python/pytest/doc/en/announce/release-3.2.4.rst
@@ -1,17 +1,17 @@
 pytest-3.2.4
 =======================================
 
 pytest 3.2.4 has just been released to PyPI.
 
 This is a bug-fix release, being a drop-in replacement. To upgrade::
 
   pip install --upgrade pytest
-  
+
 The full changelog is available at http://doc.pytest.org/en/latest/changelog.html.
 
 Thanks to all who contributed to this release, among them:
 
 * Bruno Oliveira
 * Christian Boelsen
 * Christoph Buchner
 * Daw-Ran Liou
--- a/third_party/python/pytest/doc/en/announce/release-3.2.5.rst
+++ b/third_party/python/pytest/doc/en/announce/release-3.2.5.rst
@@ -1,17 +1,17 @@
 pytest-3.2.5
 =======================================
 
 pytest 3.2.5 has just been released to PyPI.
 
 This is a bug-fix release, being a drop-in replacement. To upgrade::
 
   pip install --upgrade pytest
-  
+
 The full changelog is available at http://doc.pytest.org/en/latest/changelog.html.
 
 Thanks to all who contributed to this release, among them:
 
 * Bruno Oliveira
 
 
 Happy testing,
new file mode 100644
--- /dev/null
+++ b/third_party/python/pytest/doc/en/announce/release-3.3.0.rst
@@ -0,0 +1,50 @@
+pytest-3.3.0
+=======================================
+
+The pytest team is proud to announce the 3.3.0 release!
+
+pytest is a mature Python testing tool with more than a 1600 tests
+against itself, passing on many different interpreters and platforms.
+
+This release contains a number of bugs fixes and improvements, so users are encouraged
+to take a look at the CHANGELOG:
+
+    http://doc.pytest.org/en/latest/changelog.html
+
+For complete documentation, please visit:
+
+    http://docs.pytest.org
+
+As usual, you can upgrade from pypi via:
+
+    pip install -U pytest
+
+Thanks to all who contributed to this release, among them:
+
+* Anthony Sottile
+* Bruno Oliveira
+* Ceridwen
+* Daniel Hahler
+* Dirk Thomas
+* Dmitry Malinovsky
+* Florian Bruhin
+* George Y. Kussumoto
+* Hugo
+* Jesús Espino
+* Joan Massich
+* Ofir
+* OfirOshir
+* Ronny Pfannschmidt
+* Samuel Dion-Girardeau
+* Srinivas Reddy Thatiparthy
+* Sviatoslav Abakumov
+* Tarcisio Fischer
+* Thomas Hisch
+* Tyler Goodlet
+* hugovk
+* je
+* prokaktus
+
+
+Happy testing,
+The Pytest Development Team
new file mode 100644
--- /dev/null
+++ b/third_party/python/pytest/doc/en/announce/release-3.3.1.rst
@@ -0,0 +1,25 @@
+pytest-3.3.1
+=======================================
+
+pytest 3.3.1 has just been released to PyPI.
+
+This is a bug-fix release, being a drop-in replacement. To upgrade::
+
+  pip install --upgrade pytest
+
+The full changelog is available at http://doc.pytest.org/en/latest/changelog.html.
+
+Thanks to all who contributed to this release, among them:
+
+* Bruno Oliveira
+* Daniel Hahler
+* Eugene Prikazchikov
+* Florian Bruhin
+* Roland Puntaier
+* Ronny Pfannschmidt
+* Sebastian Rahlf
+* Tom Viner
+
+
+Happy testing,
+The pytest Development Team
new file mode 100644
--- /dev/null
+++ b/third_party/python/pytest/doc/en/announce/release-3.3.2.rst
@@ -0,0 +1,28 @@
+pytest-3.3.2
+=======================================
+
+pytest 3.3.2 has just been released to PyPI.
+
+This is a bug-fix release, being a drop-in replacement. To upgrade::
+
+  pip install --upgrade pytest
+
+The full changelog is available at http://doc.pytest.org/en/latest/changelog.html.
+
+Thanks to all who contributed to this release, among them:
+
+* Anthony Sottile
+* Antony Lee
+* Austin
+* Bruno Oliveira
+* Florian Bruhin
+* Floris Bruynooghe
+* Henk-Jaap Wagenaar
+* Jurko Gospodnetić
+* Ronny Pfannschmidt
+* Srinivas Reddy Thatiparthy
+* Thomas Hisch
+
+
+Happy testing,
+The pytest Development Team
new file mode 100644
--- /dev/null
+++ b/third_party/python/pytest/doc/en/announce/release-3.4.0.rst
@@ -0,0 +1,52 @@
+pytest-3.4.0
+=======================================
+
+The pytest team is proud to announce the 3.4.0 release!
+
+pytest is a mature Python testing tool with more than a 1600 tests
+against itself, passing on many different interpreters and platforms.
+
+This release contains a number of bugs fixes and improvements, so users are encouraged
+to take a look at the CHANGELOG:
+
+    http://doc.pytest.org/en/latest/changelog.html
+
+For complete documentation, please visit:
+
+    http://docs.pytest.org
+
+As usual, you can upgrade from pypi via:
+
+    pip install -U pytest
+
+Thanks to all who contributed to this release, among them:
+
+* Aaron
+* Alan Velasco
+* Anders Hovmöller
+* Andrew Toolan
+* Anthony Sottile
+* Aron Coyle
+* Brian Maissy
+* Bruno Oliveira
+* Cyrus Maden
+* Florian Bruhin
+* Henk-Jaap Wagenaar
+* Ian Lesperance
+* Jon Dufresne
+* Jurko Gospodnetić
+* Kate
+* Kimberly
+* Per A. Brodtkorb
+* Pierre-Alexandre Fonta
+* Raphael Castaneda
+* Ronny Pfannschmidt
+* ST John
+* Segev Finer
+* Thomas Hisch
+* Tzu-ping Chung
+* feuillemorte
+
+
+Happy testing,
+The Pytest Development Team
new file mode 100644
--- /dev/null
+++ b/third_party/python/pytest/doc/en/announce/release-3.4.1.rst
@@ -0,0 +1,27 @@
+pytest-3.4.1
+=======================================
+
+pytest 3.4.1 has just been released to PyPI.
+
+This is a bug-fix release, being a drop-in replacement. To upgrade::
+
+  pip install --upgrade pytest
+
+The full changelog is available at http://doc.pytest.org/en/latest/changelog.html.
+
+Thanks to all who contributed to this release, among them:
+
+* Aaron
+* Alan Velasco
+* Andy Freeland
+* Brian Maissy
+* Bruno Oliveira
+* Florian Bruhin
+* Jason R. Coombs
+* Marcin Bachry
+* Pedro Algarvio
+* Ronny Pfannschmidt
+
+
+Happy testing,
+The pytest Development Team
new file mode 100644
--- /dev/null
+++ b/third_party/python/pytest/doc/en/announce/release-3.4.2.rst
@@ -0,0 +1,28 @@
+pytest-3.4.2
+=======================================
+
+pytest 3.4.2 has just been released to PyPI.
+
+This is a bug-fix release, being a drop-in replacement. To upgrade::
+
+  pip install --upgrade pytest
+
+The full changelog is available at http://doc.pytest.org/en/latest/changelog.html.
+
+Thanks to all who contributed to this release, among them:
+
+* Allan Feldman
+* Bruno Oliveira
+* Florian Bruhin
+* Jason R. Coombs
+* Kyle Altendorf
+* Maik Figura
+* Ronny Pfannschmidt
+* codetriage-readme-bot
+* feuillemorte
+* joshm91
+* mike
+
+
+Happy testing,
+The pytest Development Team
new file mode 100644
--- /dev/null
+++ b/third_party/python/pytest/doc/en/announce/release-3.5.0.rst
@@ -0,0 +1,51 @@
+pytest-3.5.0
+=======================================
+
+The pytest team is proud to announce the 3.5.0 release!
+
+pytest is a mature Python testing tool with more than a 1600 tests
+against itself, passing on many different interpreters and platforms.
+
+This release contains a number of bugs fixes and improvements, so users are encouraged
+to take a look at the CHANGELOG:
+
+    http://doc.pytest.org/en/latest/changelog.html
+
+For complete documentation, please visit:
+
+    http://docs.pytest.org
+
+As usual, you can upgrade from pypi via:
+
+    pip install -U pytest
+
+Thanks to all who contributed to this release, among them:
+
+* Allan Feldman
+* Brian Maissy
+* Bruno Oliveira
+* Carlos Jenkins
+* Daniel Hahler
+* Florian Bruhin
+* Jason R. Coombs
+* Jeffrey Rackauckas
+* Jordan Speicher
+* Julien Palard
+* Kale Kundert
+* Kostis Anagnostopoulos
+* Kyle Altendorf
+* Maik Figura
+* Pedro Algarvio
+* Ronny Pfannschmidt
+* Tadeu Manoel
+* Tareq Alayan
+* Thomas Hisch
+* William Lee
+* codetriage-readme-bot
+* feuillemorte
+* joshm91
+* mike
+
+
+Happy testing,
+The Pytest Development Team
new file mode 100644
--- /dev/null
+++ b/third_party/python/pytest/doc/en/announce/release-3.5.1.rst
@@ -0,0 +1,30 @@
+pytest-3.5.1
+=======================================
+
+pytest 3.5.1 has just been released to PyPI.
+
+This is a bug-fix release, being a drop-in replacement. To upgrade::
+
+  pip install --upgrade pytest
+
+The full changelog is available at http://doc.pytest.org/en/latest/changelog.html.
+
+Thanks to all who contributed to this release, among them:
+
+* Brian Maissy
+* Bruno Oliveira
+* Darren Burns
+* David Chudzicki
+* Floris Bruynooghe
+* Holger Kohr
+* Irmen de Jong
+* Jeffrey Rackauckas
+* Rachel Kogan
+* Ronny Pfannschmidt
+* Stefan Scherfke
+* Tim Strazny
+* Семён Марьясин
+
+
+Happy testing,
+The pytest Development Team
new file mode 100644
--- /dev/null
+++ b/third_party/python/pytest/doc/en/announce/release-3.6.0.rst
@@ -0,0 +1,41 @@
+pytest-3.6.0
+=======================================
+
+The pytest team is proud to announce the 3.6.0 release!
+
+pytest is a mature Python testing tool with more than a 1600 tests
+against itself, passing on many different interpreters and platforms.
+
+This release contains a number of bugs fixes and improvements, so users are encouraged
+to take a look at the CHANGELOG:
+
+    http://doc.pytest.org/en/latest/changelog.html
+
+For complete documentation, please visit:
+
+    http://docs.pytest.org
+
+As usual, you can upgrade from pypi via:
+
+    pip install -U pytest
+
+Thanks to all who contributed to this release, among them:
+
+* Anthony Shaw
+* ApaDoctor
+* Brian Maissy
+* Bruno Oliveira
+* Jon Dufresne
+* Katerina Koukiou
+* Miro Hrončok
+* Rachel Kogan
+* Ronny Pfannschmidt
+* Tim Hughes
+* Tyler Goodlet
+* Ville Skyttä
+* aviral1701
+* feuillemorte
+
+
+Happy testing,
+The Pytest Development Team
new file mode 100644
--- /dev/null
+++ b/third_party/python/pytest/doc/en/announce/release-3.6.1.rst
@@ -0,0 +1,24 @@
+pytest-3.6.1
+=======================================
+
+pytest 3.6.1 has just been released to PyPI.
+
+This is a bug-fix release, being a drop-in replacement. To upgrade::
+
+  pip install --upgrade pytest
+
+The full changelog is available at http://doc.pytest.org/en/latest/changelog.html.
+
+Thanks to all who contributed to this release, among them:
+
+* Anthony Sottile
+* Bruno Oliveira
+* Jeffrey Rackauckas
+* Miro Hrončok
+* Niklas Meinzer
+* Oliver Bestwalter
+* Ronny Pfannschmidt
+
+
+Happy testing,
+The pytest Development Team
new file mode 100644
--- /dev/null
+++ b/third_party/python/pytest/doc/en/announce/release-3.6.2.rst
@@ -0,0 +1,29 @@
+pytest-3.6.2
+=======================================
+
+pytest 3.6.2 has just been released to PyPI.
+
+This is a bug-fix release, being a drop-in replacement. To upgrade::
+
+  pip install --upgrade pytest
+
+The full changelog is available at http://doc.pytest.org/en/latest/changelog.html.
+
+Thanks to all who contributed to this release, among them:
+
+* Alan Velasco
+* Alex Barbato
+* Anthony Sottile
+* Bartosz Cierocki
+* Bruno Oliveira
+* Daniel Hahler
+* Guoqiang Zhang
+* Hynek Schlawack
+* John T. Wodder II
+* Michael Käufl
+* Ronny Pfannschmidt
+* Samuel Dion-Girardeau
+
+
+Happy testing,
+The pytest Development Team
--- a/third_party/python/pytest/doc/en/assert.rst
+++ b/third_party/python/pytest/doc/en/assert.rst
@@ -20,33 +20,33 @@ following::
 
     def test_function():
         assert f() == 4
 
 to assert that your function returns a certain value. If this assertion fails
 you will see the return value of the function call::
 
     $ pytest test_assert1.py
-    ======= test session starts ========
+    =========================== test session starts ============================
     platform linux -- Python 3.x.y, pytest-3.x.y, py-1.x.y, pluggy-0.x.y
     rootdir: $REGENDOC_TMPDIR, inifile:
     collected 1 item
-    
-    test_assert1.py F
-    
-    ======= FAILURES ========
-    _______ test_function ________
-    
+
+    test_assert1.py F                                                    [100%]
+
+    ================================= FAILURES =================================
+    ______________________________ test_function _______________________________
+
         def test_function():
     >       assert f() == 4
     E       assert 3 == 4
     E        +  where 3 = f()
-    
+
     test_assert1.py:5: AssertionError
-    ======= 1 failed in 0.12 seconds ========
+    ========================= 1 failed in 0.12 seconds =========================
 
 ``pytest`` has support for showing the values of the most common subexpressions
 including calls, attributes, comparisons, and binary and unary
 operators. (See :ref:`tbreportdemo`).  This allows you to use the
 idiomatic python constructs without boilerplate code while not losing
 introspection information.
 
 However, if you specify a message with the assertion like this::
@@ -86,17 +86,17 @@ the actual exception raised.  The main a
 ``.type``, ``.value`` and ``.traceback``.
 
 .. versionchanged:: 3.0
 
 In the context manager form you may use the keyword argument
 ``message`` to specify a custom failure message::
 
      >>> with raises(ZeroDivisionError, message="Expecting ZeroDivisionError"):
-     ...    pass
+     ...     pass
      ... Failed: Expecting ZeroDivisionError
 
 If you want to write test code that works on Python 2.4 as well,
 you may also use two other ways to test for an expected exception::
 
     pytest.raises(ExpectedException, func, *args, **kwargs)
     pytest.raises(ExpectedException, "func(*args, **kwargs)")
 
@@ -163,39 +163,39 @@ when it encounters comparisons.  For exa
     def test_set_comparison():
         set1 = set("1308")
         set2 = set("8035")
         assert set1 == set2
 
 if you run this module::
 
     $ pytest test_assert2.py
-    ======= test session starts ========
+    =========================== test session starts ============================
     platform linux -- Python 3.x.y, pytest-3.x.y, py-1.x.y, pluggy-0.x.y
     rootdir: $REGENDOC_TMPDIR, inifile:
     collected 1 item
-    
-    test_assert2.py F
-    
-    ======= FAILURES ========
-    _______ test_set_comparison ________
-    
+
+    test_assert2.py F                                                    [100%]
+
+    ================================= FAILURES =================================
+    ___________________________ test_set_comparison ____________________________
+
         def test_set_comparison():
             set1 = set("1308")
             set2 = set("8035")
     >       assert set1 == set2
     E       AssertionError: assert {'0', '1', '3', '8'} == {'0', '3', '5', '8'}
     E         Extra items in the left set:
     E         '1'
     E         Extra items in the right set:
     E         '5'
     E         Use -v to get the full diff
-    
+
     test_assert2.py:5: AssertionError
-    ======= 1 failed in 0.12 seconds ========
+    ========================= 1 failed in 0.12 seconds =========================
 
 Special comparisons are done for a number of cases:
 
 * comparing long strings: a context diff is shown
 * comparing long sequences: first failing indices
 * comparing dicts: different entries
 
 See the :ref:`reporting demo <tbreportdemo>` for many more examples.
@@ -204,17 +204,17 @@ Defining your own assertion comparison
 ----------------------------------------------
 
 It is possible to add your own detailed explanations by implementing
 the ``pytest_assertrepr_compare`` hook.
 
 .. autofunction:: _pytest.hookspec.pytest_assertrepr_compare
    :noindex:
 
-As an example consider adding the following hook in a :ref:`conftest.py <conftest.py>` 
+As an example consider adding the following hook in a :ref:`conftest.py <conftest.py>`
 file which provides an alternative explanation for ``Foo`` objects::
 
    # content of conftest.py
    from test_foocompare import Foo
    def pytest_assertrepr_compare(op, left, right):
        if isinstance(left, Foo) and isinstance(right, Foo) and op == "==":
            return ['Comparing Foo instances:',
                    '   vals: %s != %s' % (left.val, right.val)]
@@ -233,27 +233,27 @@ now, given this test module::
        f1 = Foo(1)
        f2 = Foo(2)
        assert f1 == f2
 
 you can run the test module and get the custom output defined in
 the conftest file::
 
    $ pytest -q test_foocompare.py
-   F
-   ======= FAILURES ========
-   _______ test_compare ________
-   
+   F                                                                    [100%]
+   ================================= FAILURES =================================
+   _______________________________ test_compare _______________________________
+
        def test_compare():
            f1 = Foo(1)
            f2 = Foo(2)
    >       assert f1 == f2
    E       assert Comparing Foo instances:
    E            vals: 1 != 2
-   
+
    test_foocompare.py:11: AssertionError
    1 failed in 0.12 seconds
 
 .. _assert-details:
 .. _`assert introspection`:
 
 Advanced assertion introspection
 ----------------------------------
--- a/third_party/python/pytest/doc/en/backwards-compatibility.rst
+++ b/third_party/python/pytest/doc/en/backwards-compatibility.rst
@@ -5,8 +5,16 @@ Backwards Compatibility Policy
 
 Keeping backwards compatibility has a very high priority in the pytest project. Although we have deprecated functionality over the years, most of it is still supported. All deprecations in pytest were done because simpler or more efficient ways of accomplishing the same tasks have emerged, making the old way of doing things unnecessary.
 
 With the pytest 3.0 release we introduced a clear communication scheme for when we will actually remove the old busted joint and politely ask you to use the new hotness instead, while giving you enough time to adjust your tests or raise concerns if there are valid reasons to keep deprecated functionality around.
 
 To communicate changes we are already issuing deprecation warnings, but they are not displayed by default. In pytest 3.0 we changed the default setting so that pytest deprecation warnings are displayed if not explicitly silenced (with ``--disable-pytest-warnings``).
 
 We will only remove deprecated functionality in major releases (e.g. if we deprecate something in 3.0 we will remove it in 4.0), and keep it around for at least two minor releases (e.g. if we deprecate something in 3.9 and 4.0 is the next release, we will not remove it in 4.0 but in 5.0).
+
+
+Deprecation Roadmap
+-------------------
+
+We track deprecation and removal of features using milestones and the `deprecation <https://github.com/pytest-dev/pytest/issues?q=label%3A%22type%3A+deprecation%22>`_ and `removal <https://github.com/pytest-dev/pytest/labels/type%3A%20removal>`_ labels on GitHub.
+
+Following our deprecation policy, after starting issuing deprecation warnings we keep features for *at least* two minor versions before considering removal.
--- a/third_party/python/pytest/doc/en/bash-completion.rst
+++ b/third_party/python/pytest/doc/en/bash-completion.rst
@@ -9,20 +9,17 @@ When using bash as your shell, ``pytest`
 For this ``argcomplete`` needs to be installed **and** enabled.
 
 Install argcomplete using::
 
         sudo pip install 'argcomplete>=0.5.7'
 
 For global activation of all argcomplete enabled python applications run::
 
-	sudo activate-global-python-argcomplete
+    sudo activate-global-python-argcomplete
 
 For permanent (but not global) ``pytest`` activation, use::
 
         register-python-argcomplete pytest >> ~/.bashrc
 
 For one-time activation of argcomplete for ``pytest`` only, use::
 
         eval "$(register-python-argcomplete pytest)"
-
-
-
--- a/third_party/python/pytest/doc/en/builtin.rst
+++ b/third_party/python/pytest/doc/en/builtin.rst
@@ -1,141 +1,122 @@
+:orphan:
 
 .. _`pytest helpers`:
 
 Pytest API and builtin fixtures
 ================================================
 
-This is a list of ``pytest.*`` API functions and fixtures.
+
+Most of the information of this page has been moved over to :ref:`reference`.
 
 For information on plugin hooks and objects, see :ref:`plugins`.
 
 For information on the ``pytest.mark`` mechanism, see :ref:`mark`.
 
-For the below objects, you can also interactively ask for help, e.g. by
-typing on the Python interactive prompt something like::
-
-    import pytest
-    help(pytest)
-
-.. currentmodule:: pytest
-
-Invoking pytest interactively
----------------------------------------------------
-
-.. autofunction:: main
-
-More examples at :ref:`pytest.main-usage`
-
-
-Helpers for assertions about Exceptions/Warnings
---------------------------------------------------------
-
-.. autofunction:: raises
-
-Examples at :ref:`assertraises`.
-
-.. autofunction:: deprecated_call
-
-Comparing floating point numbers
---------------------------------
-
-.. autofunction:: approx
-
-Raising a specific test outcome
---------------------------------------
-
-You can use the following functions in your test, fixture or setup
-functions to force a certain test outcome.  Note that most often
-you can rather use declarative marks, see :ref:`skipping`.
-
-.. autofunction:: _pytest.outcomes.fail
-.. autofunction:: _pytest.outcomes.skip
-.. autofunction:: _pytest.outcomes.importorskip
-.. autofunction:: _pytest.outcomes.xfail
-.. autofunction:: _pytest.outcomes.exit
-
-Fixtures and requests
------------------------------------------------------
-
-To mark a fixture function:
-
-.. autofunction:: _pytest.fixtures.fixture
-
-Tutorial at :ref:`fixtures`.
-
-The ``request`` object that can be used from fixture functions.
-
-.. autoclass:: _pytest.fixtures.FixtureRequest()
-    :members:
-
-
-.. _builtinfixtures:
-.. _builtinfuncargs:
-
-Builtin fixtures/function arguments
------------------------------------------
-
-You can ask for available builtin or project-custom
-:ref:`fixtures <fixtures>` by typing::
+For information about fixtures, see :ref:`fixtures`. To see a complete list of available fixtures (add ``-v`` to also see fixtures with leading ``_``), type ::
 
     $ pytest -q --fixtures
     cache
         Return a cache object that can persist state between testing sessions.
-        
+
         cache.get(key, default)
         cache.set(key, value)
-        
+
         Keys must be a ``/`` separated value, where the first part is usually the
         name of your plugin or application to avoid clashes with other cache users.
-        
+
         Values can be any object handled by the json stdlib module.
     capsys
-        Enable capturing of writes to sys.stdout/sys.stderr and make
+        Enable capturing of writes to ``sys.stdout`` and ``sys.stderr`` and make
         captured output available via ``capsys.readouterr()`` method calls
-        which return a ``(out, err)`` tuple.
+        which return a ``(out, err)`` namedtuple.  ``out`` and ``err`` will be ``text``
+        objects.
+    capsysbinary
+        Enable capturing of writes to ``sys.stdout`` and ``sys.stderr`` and make
+        captured output available via ``capsys.readouterr()`` method calls
+        which return a ``(out, err)`` tuple.  ``out`` and ``err`` will be ``bytes``
+        objects.
     capfd
-        Enable capturing of writes to file descriptors 1 and 2 and make
+        Enable capturing of writes to file descriptors ``1`` and ``2`` and make
         captured output available via ``capfd.readouterr()`` method calls
-        which return a ``(out, err)`` tuple.
+        which return a ``(out, err)`` tuple.  ``out`` and ``err`` will be ``text``
+        objects.
+    capfdbinary
+        Enable capturing of write to file descriptors 1 and 2 and make
+        captured output available via ``capfdbinary.readouterr`` method calls
+        which return a ``(out, err)`` tuple.  ``out`` and ``err`` will be
+        ``bytes`` objects.
     doctest_namespace
-        Inject names into the doctest namespace.
+        Fixture that returns a :py:class:`dict` that will be injected into the namespace of doctests.
     pytestconfig
-        the pytest config object with access to command line opts.
-    record_xml_property
-        Add extra xml properties to the tag for the calling test.
+        Session-scoped fixture that returns the :class:`_pytest.config.Config` object.
+
+        Example::
+
+            def test_foo(pytestconfig):
+                if pytestconfig.getoption("verbose"):
+                    ...
+    record_property
+        Add an extra properties the calling test.
+        User properties become part of the test report and are available to the
+        configured reporters, like JUnit XML.
         The fixture is callable with ``(name, value)``, with value being automatically
         xml-encoded.
+
+        Example::
+
+            def test_function(record_property):
+                record_property("example_key", 1)
+    record_xml_property
+        (Deprecated) use record_property.
+    record_xml_attribute
+        Add extra xml attributes to the tag for the calling test.
+        The fixture is callable with ``(name, value)``, with value being
+        automatically xml-encoded
+    caplog
+        Access and control log capturing.
+
+        Captured logs are available through the following methods::
+
+        * caplog.text            -> string containing formatted log output
+        * caplog.records         -> list of logging.LogRecord instances
+        * caplog.record_tuples   -> list of (logger_name, level, message) tuples
+        * caplog.clear()         -> clear captured records and formatted log output string
     monkeypatch
         The returned ``monkeypatch`` fixture provides these
         helper methods to modify objects, dictionaries or os.environ::
-        
+
             monkeypatch.setattr(obj, name, value, raising=True)
             monkeypatch.delattr(obj, name, raising=True)
             monkeypatch.setitem(mapping, name, value)
             monkeypatch.delitem(obj, name, raising=True)
             monkeypatch.setenv(name, value, prepend=False)
             monkeypatch.delenv(name, value, raising=True)
             monkeypatch.syspath_prepend(path)
             monkeypatch.chdir(path)
-        
+
         All modifications will be undone after the requesting
         test function or fixture has finished. The ``raising``
         parameter determines if a KeyError or AttributeError
         will be raised if the set/deletion operation has no target.
     recwarn
-        Return a WarningsRecorder instance that provides these methods:
-        
-        * ``pop(category=None)``: return last warning matching the category.
-        * ``clear()``: clear list of warnings
-        
+        Return a :class:`WarningsRecorder` instance that records all warnings emitted by test functions.
+
         See http://docs.python.org/library/warnings.html for information
         on warning categories.
     tmpdir_factory
         Return a TempdirFactory instance for the test session.
     tmpdir
         Return a temporary directory path object
         which is unique to each test function invocation,
         created as a sub directory of the base temporary
         directory.  The returned object is a `py.path.local`_
         path object.
-    
+
+        .. _`py.path.local`: https://py.readthedocs.io/en/latest/path.html
+
     no tests ran in 0.12 seconds
+
+You can also interactively ask for help, e.g. by typing on the Python interactive prompt something like::
+
+    import pytest
+    help(pytest)
--- a/third_party/python/pytest/doc/en/cache.rst
+++ b/third_party/python/pytest/doc/en/cache.rst
@@ -15,17 +15,17 @@ last ``pytest`` invocation:
 
 * ``--lf``, ``--last-failed`` - to only re-run the failures.
 * ``--ff``, ``--failed-first`` - to run the failures first and then the rest of
   the tests.
 
 For cleanup (usually not needed), a ``--cache-clear`` option allows to remove
 all cross-session cache contents ahead of a test run.
 
-Other plugins may access the `config.cache`_ object to set/get 
+Other plugins may access the `config.cache`_ object to set/get
 **json encodable** values between ``pytest`` invocations.
 
 .. note::
 
     This plugin is enabled by default, but can be disabled if needed: see
     :ref:`cmdunregister` (the internal name for this plugin is
     ``cacheprovider``).
 
@@ -41,122 +41,135 @@ First, let's create 50 test invocation o
     @pytest.mark.parametrize("i", range(50))
     def test_num(i):
         if i in (17, 25):
            pytest.fail("bad luck")
 
 If you run this for the first time you will see two failures::
 
     $ pytest -q
-    .................F.......F........................
-    ======= FAILURES ========
-    _______ test_num[17] ________
-    
+    .................F.......F........................                   [100%]
+    ================================= FAILURES =================================
+    _______________________________ test_num[17] _______________________________
+
     i = 17
-    
+
         @pytest.mark.parametrize("i", range(50))
         def test_num(i):
             if i in (17, 25):
     >          pytest.fail("bad luck")
     E          Failed: bad luck
-    
+
     test_50.py:6: Failed
-    _______ test_num[25] ________
-    
+    _______________________________ test_num[25] _______________________________
+
     i = 25
-    
+
         @pytest.mark.parametrize("i", range(50))
         def test_num(i):
             if i in (17, 25):
     >          pytest.fail("bad luck")
     E          Failed: bad luck
-    
+
     test_50.py:6: Failed
     2 failed, 48 passed in 0.12 seconds
 
 If you then run it with ``--lf``::
 
     $ pytest --lf
-    ======= test session starts ========
+    =========================== test session starts ============================
     platform linux -- Python 3.x.y, pytest-3.x.y, py-1.x.y, pluggy-0.x.y
     rootdir: $REGENDOC_TMPDIR, inifile:
-    collected 50 items
+    collected 50 items / 48 deselected
     run-last-failure: rerun previous 2 failures
-    
-    test_50.py FF
-    
-    ======= FAILURES ========
-    _______ test_num[17] ________
-    
+
+    test_50.py FF                                                        [100%]
+
+    ================================= FAILURES =================================
+    _______________________________ test_num[17] _______________________________
+
     i = 17
-    
+
         @pytest.mark.parametrize("i", range(50))
         def test_num(i):
             if i in (17, 25):
     >          pytest.fail("bad luck")
     E          Failed: bad luck
-    
+
     test_50.py:6: Failed
-    _______ test_num[25] ________
-    
+    _______________________________ test_num[25] _______________________________
+
     i = 25
-    
+
         @pytest.mark.parametrize("i", range(50))
         def test_num(i):
             if i in (17, 25):
     >          pytest.fail("bad luck")
     E          Failed: bad luck
-    
+
     test_50.py:6: Failed
-    ======= 48 tests deselected ========
-    ======= 2 failed, 48 deselected in 0.12 seconds ========
+    ================= 2 failed, 48 deselected in 0.12 seconds ==================
 
 You have run only the two failing test from the last run, while 48 tests have
 not been run ("deselected").
 
 Now, if you run with the ``--ff`` option, all tests will be run but the first
 previous failures will be executed first (as can be seen from the series
 of ``FF`` and dots)::
 
     $ pytest --ff
-    ======= test session starts ========
+    =========================== test session starts ============================
     platform linux -- Python 3.x.y, pytest-3.x.y, py-1.x.y, pluggy-0.x.y
     rootdir: $REGENDOC_TMPDIR, inifile:
     collected 50 items
     run-last-failure: rerun previous 2 failures first
-    
-    test_50.py FF................................................
-    
-    ======= FAILURES ========
-    _______ test_num[17] ________
-    
+
+    test_50.py FF................................................        [100%]
+
+    ================================= FAILURES =================================
+    _______________________________ test_num[17] _______________________________
+
     i = 17
-    
+
         @pytest.mark.parametrize("i", range(50))
         def test_num(i):
             if i in (17, 25):
     >          pytest.fail("bad luck")
     E          Failed: bad luck
-    
+
     test_50.py:6: Failed
-    _______ test_num[25] ________
-    
+    _______________________________ test_num[25] _______________________________
+
     i = 25
-    
+
         @pytest.mark.parametrize("i", range(50))
         def test_num(i):
             if i in (17, 25):
     >          pytest.fail("bad luck")
     E          Failed: bad luck
-    
+
     test_50.py:6: Failed
-    ======= 2 failed, 48 passed in 0.12 seconds ========
+    =================== 2 failed, 48 passed in 0.12 seconds ====================
 
 .. _`config.cache`:
 
+New ``--nf``, ``--new-first`` options: run new tests first followed by the rest
+of the tests, in both cases tests are also sorted by the file modified time,
+with more recent files coming first.
+
+Behavior when no tests failed in the last run
+---------------------------------------------
+
+When no tests failed in the last run, or when no cached ``lastfailed`` data was
+found, ``pytest`` can be configured either to run all of the tests or no tests,
+using the ``--last-failed-no-failures`` option, which takes one of the following values::
+
+    pytest --last-failed-no-failures all    # run all tests (default behavior)
+    pytest --last-failed-no-failures none   # run no tests and exit
+
 The new config.cache object
 --------------------------------
 
 .. regendoc:wipe
 
 Plugins or conftest.py support code can get a cached value using the
 pytest ``config`` object.  Here is a basic example plugin which
 implements a :ref:`fixture` which re-uses previously created state
@@ -177,92 +190,73 @@ across pytest invocations::
 
     def test_function(mydata):
         assert mydata == 23
 
 If you run this command once, it will take a while because
 of the sleep::
 
     $ pytest -q
-    F
-    ======= FAILURES ========
-    _______ test_function ________
-    
+    F                                                                    [100%]
+    ================================= FAILURES =================================
+    ______________________________ test_function _______________________________
+
     mydata = 42
-    
+
         def test_function(mydata):
     >       assert mydata == 23
     E       assert 42 == 23
-    
+
     test_caching.py:14: AssertionError
     1 failed in 0.12 seconds
 
 If you run it a second time the value will be retrieved from
 the cache and this will be quick::
 
     $ pytest -q
-    F
-    ======= FAILURES ========
-    _______ test_function ________
-    
+    F                                                                    [100%]
+    ================================= FAILURES =================================
+    ______________________________ test_function _______________________________
+
     mydata = 42
-    
+
         def test_function(mydata):
     >       assert mydata == 23
     E       assert 42 == 23
-    
+
     test_caching.py:14: AssertionError
     1 failed in 0.12 seconds
 
-See the `cache-api`_ for more details.
+See the :ref:`cache-api` for more details.
 
 
 Inspecting Cache content
 -------------------------------
 
 You can always peek at the content of the cache using the
 ``--cache-show`` command line option::
 
-    $ py.test --cache-show
-    ======= test session starts ========
+    $ pytest --cache-show
+    =========================== test session starts ============================
     platform linux -- Python 3.x.y, pytest-3.x.y, py-1.x.y, pluggy-0.x.y
     rootdir: $REGENDOC_TMPDIR, inifile:
-    cachedir: $REGENDOC_TMPDIR/.cache
+    cachedir: $REGENDOC_TMPDIR/.pytest_cache
     ------------------------------- cache values -------------------------------
     cache/lastfailed contains:
       {'test_caching.py::test_function': True}
+    cache/nodeids contains:
+      ['test_caching.py::test_function']
     example/value contains:
       42
-    
-    ======= no tests ran in 0.12 seconds ========
+
+    ======================= no tests ran in 0.12 seconds =======================
 
 Clearing Cache content
 -------------------------------
 
 You can instruct pytest to clear all cache files and values
 by adding the ``--cache-clear`` option like this::
 
     pytest --cache-clear
 
 This is recommended for invocations from Continuous Integration
 servers where isolation and correctness is more important
 than speed.
-
-
-.. _`cache-api`:
-
-config.cache API
-------------------
-
-The ``config.cache`` object allows other plugins,
-including ``conftest.py`` files,
-to safely and flexibly store and retrieve values across
-test runs because the ``config`` object is available
-in many places.
-
-Under the hood, the cache plugin uses the simple
-dumps/loads API of the json stdlib module
-
-.. currentmodule:: _pytest.cacheprovider
-
-.. automethod:: Cache.get
-.. automethod:: Cache.set
-.. automethod:: Cache.makedir
--- a/third_party/python/pytest/doc/en/capture.rst
+++ b/third_party/python/pytest/doc/en/capture.rst
@@ -4,17 +4,18 @@
 Capturing of the stdout/stderr output
 =========================================================
 
 Default stdout/stderr/stdin capturing behaviour
 ---------------------------------------------------------
 
 During test execution any output sent to ``stdout`` and ``stderr`` is
 captured.  If a test or a setup method fails its according captured
-output will usually be shown along with the failure traceback.
+output will usually be shown along with the failure traceback. (this
+behavior can be configured by the ``--show-capture`` command-line option).
 
 In addition, ``stdin`` is set to a "null" object which will
 fail on attempts to read from it because it is rarely desired
 to wait for interactive input when running automated tests.
 
 By default capturing is done by intercepting writes to low level
 file descriptors.  This allows to capture output from simple
 print statements as well as output from a subprocess started by
@@ -58,76 +59,95 @@ is that you can use print statements for
 
     def test_func2():
         assert False
 
 and running this module will show you precisely the output
 of the failing function and hide the other one::
 
     $ pytest
-    ======= test session starts ========
+    =========================== test session starts ============================
     platform linux -- Python 3.x.y, pytest-3.x.y, py-1.x.y, pluggy-0.x.y
     rootdir: $REGENDOC_TMPDIR, inifile:
     collected 2 items
-    
-    test_module.py .F
-    
-    ======= FAILURES ========
-    _______ test_func2 ________
-    
+
+    test_module.py .F                                                    [100%]
+
+    ================================= FAILURES =================================
+    ________________________________ test_func2 ________________________________
+
         def test_func2():
     >       assert False
     E       assert False
-    
+
     test_module.py:9: AssertionError
     -------------------------- Captured stdout setup ---------------------------
     setting up <function test_func2 at 0xdeadbeef>
-    ======= 1 failed, 1 passed in 0.12 seconds ========
+    ==================== 1 failed, 1 passed in 0.12 seconds ====================
 
 Accessing captured output from a test function
 ---------------------------------------------------
 
-The ``capsys`` and ``capfd`` fixtures allow to access stdout/stderr
-output created during test execution.  Here is an example test function
-that performs some output related checks:
+The ``capsys``, ``capsysbinary``, ``capfd``, and ``capfdbinary`` fixtures
+allow access to stdout/stderr output created during test execution.  Here is
+an example test function that performs some output related checks:
 
 .. code-block:: python
 
-    def test_myoutput(capsys): # or use "capfd" for fd-level
-        print ("hello")
+    def test_myoutput(capsys):  # or use "capfd" for fd-level
+        print("hello")
         sys.stderr.write("world\n")
-        out, err = capsys.readouterr()
-        assert out == "hello\n"
-        assert err == "world\n"
-        print ("next")
-        out, err = capsys.readouterr()
-        assert out == "next\n"
+        captured = capsys.readouterr()
+        assert captured.out == "hello\n"
+        assert captured.err == "world\n"
+        print("next")
+        captured = capsys.readouterr()
+        assert captured.out == "next\n"
 
 The ``readouterr()`` call snapshots the output so far -
 and capturing will be continued.  After the test
 function finishes the original streams will
 be restored.  Using ``capsys`` this way frees your
 test from having to care about setting/resetting
 output streams and also interacts well with pytest's
 own per-test capturing.
 
 If you want to capture on filedescriptor level you can use
-the ``capfd`` function argument which offers the exact
+the ``capfd`` fixture which offers the exact
 same interface but allows to also capture output from
 libraries or subprocesses that directly write to operating
 system level output streams (FD1 and FD2).
 
+.. versionadded:: 3.3
+
+The return value from ``readouterr`` changed to a ``namedtuple`` with two attributes, ``out`` and ``err``.
+
+.. versionadded:: 3.3
+
+If the code under test writes non-textual data, you can capture this using
+the ``capsysbinary`` fixture which instead returns ``bytes`` from
+the ``readouterr`` method.  The ``capfsysbinary`` fixture is currently only
+available in python 3.
+
+
+.. versionadded:: 3.3
+
+If the code under test writes non-textual data, you can capture this using
+the ``capfdbinary`` fixture which instead returns ``bytes`` from
+the ``readouterr`` method.  The ``capfdbinary`` fixture operates on the
+filedescriptor level.
+
 
 .. versionadded:: 3.0
 
 To temporarily disable capture within a test, both ``capsys``
 and ``capfd`` have a ``disabled()`` method that can be used
 as a context manager, disabling capture inside the ``with`` block:
 
 .. code-block:: python
 
     def test_disabling_capturing(capsys):
-        print('this output is captured')
+        print("this output is captured")
         with capsys.disabled():
-            print('output not captured, going directly to sys.stdout')
-        print('this output is also captured')
+            print("output not captured, going directly to sys.stdout")
+        print("this output is also captured")
 
 .. include:: links.inc
deleted file mode 100644
--- a/third_party/python/pytest/doc/en/check_sphinx.py
+++ /dev/null
@@ -1,17 +0,0 @@
-import py
-import subprocess
-def test_build_docs(tmpdir):
-    doctrees = tmpdir.join("doctrees")
-    htmldir = tmpdir.join("html")
-    subprocess.check_call([
-        "sphinx-build", "-W", "-bhtml",
-          "-d", str(doctrees), ".", str(htmldir)])
-
-def test_linkcheck(tmpdir):
-    doctrees = tmpdir.join("doctrees")
-    htmldir = tmpdir.join("html")
-    subprocess.check_call(
-        ["sphinx-build", "-blinkcheck",
-          "-d", str(doctrees), ".", str(htmldir)])
-
-
--- a/third_party/python/pytest/doc/en/conf.py
+++ b/third_party/python/pytest/doc/en/conf.py
@@ -13,123 +13,134 @@
 
 # The version info for the project you're documenting, acts as replacement for
 # |version| and |release|, also used in various other places throughout the
 # built documents.
 #
 # The full version, including alpha/beta/rc tags.
 # The short X.Y version.
 
-import os, sys
+import os
+import sys
+import datetime
+
 from _pytest import __version__ as version
+
 release = ".".join(version.split(".")[:2])
 
 # If extensions (or modules to document with autodoc) are in another directory,
 # add these directories to sys.path here. If the directory is relative to the
 # documentation root, use os.path.abspath to make it absolute, like shown here.
-#sys.path.insert(0, os.path.abspath('.'))
+# sys.path.insert(0, os.path.abspath('.'))
 
 autodoc_member_order = "bysource"
 todo_include_todos = 1
 
 # -- General configuration -----------------------------------------------------
 
 # If your documentation needs a minimal Sphinx version, state it here.
-#needs_sphinx = '1.0'
+# needs_sphinx = '1.0'
 
 # Add any Sphinx extension module names here, as strings. They can be extensions
 # coming with Sphinx (named 'sphinx.ext.*') or your custom ones.
-extensions = ['sphinx.ext.autodoc', 'sphinx.ext.todo', 'sphinx.ext.autosummary',
-    'sphinx.ext.intersphinx', 'sphinx.ext.viewcode']
+extensions = [
+    "sphinx.ext.autodoc",
+    "sphinx.ext.todo",
+    "sphinx.ext.autosummary",
+    "sphinx.ext.intersphinx",
+    "sphinx.ext.viewcode",
+    "sphinxcontrib_trio",
+]
 
 # Add any paths that contain templates here, relative to this directory.
-templates_path = ['_templates']
+templates_path = ["_templates"]
 
 # The suffix of source filenames.
-source_suffix = '.rst'
+source_suffix = ".rst"
 
 # The encoding of source files.
-#source_encoding = 'utf-8-sig'
+# source_encoding = 'utf-8-sig'
 
 # The master toctree document.
-master_doc = 'contents'
+master_doc = "contents"
 
 # General information about the project.
-project = u'pytest'
-copyright = u'2015, holger krekel and pytest-dev team'
-
+project = u"pytest"
+year = datetime.datetime.utcnow().year
+copyright = u"2015–{} , holger krekel and pytest-dev team".format(year)
 
 
 # The language for content autogenerated by Sphinx. Refer to documentation
 # for a list of supported languages.
-#language = None
+# language = None
 
 # There are two options for replacing |today|: either, you set today to some
 # non-false value, then it is used:
-#today = ''
+# today = ''
 # Else, today_fmt is used as the format for a strftime call.
-#today_fmt = '%B %d, %Y'
+# today_fmt = '%B %d, %Y'
 
 # List of patterns, relative to source directory, that match files and
 # directories to ignore when looking for source files.
-exclude_patterns = ['links.inc', '_build', 'naming20.rst', 'test/*',
+exclude_patterns = [
+    "links.inc",
+    "_build",
+    "naming20.rst",
+    "test/*",
     "old_*",
-    '*attic*',
-    '*/attic*',
-    'funcargs.rst',
-    'setup.rst',
-    'example/remoteinterp.rst',
-    ]
+    "*attic*",
+    "*/attic*",
+    "funcargs.rst",
+    "setup.rst",
+    "example/remoteinterp.rst",
+]
 
 
 # The reST default role (used for this markup: `text`) to use for all documents.
-#default_role = None
+# default_role = None
 
 # If true, '()' will be appended to :func: etc. cross-reference text.
-#add_function_parentheses = True
+# add_function_parentheses = True
 
 # If true, the current module name will be prepended to all description
 # unit titles (such as .. function::).
 add_module_names = False
 
 # If true, sectionauthor and moduleauthor directives will be shown in the
 # output. They are ignored by default.
-#show_authors = False
+# show_authors = False
 
 # The name of the Pygments (syntax highlighting) style to use.
-pygments_style = 'sphinx'
-
+pygments_style = "sphinx"
 
 
 # A list of ignored prefixes for module index sorting.
-#modindex_common_prefix = []
+# modindex_common_prefix = []
 
 
 # -- Options for HTML output ---------------------------------------------------
 
-sys.path.append(os.path.abspath('_themes'))
-html_theme_path = ['_themes']
+sys.path.append(os.path.abspath("_themes"))
+html_theme_path = ["_themes"]
 
 # The theme to use for HTML and HTML Help pages.  See the documentation for
 # a list of builtin themes.
-html_theme = 'flask'
+html_theme = "flask"
 
 # Theme options are theme-specific and customize the look and feel of a theme
 # further.  For a list of options available for each theme, see the
 # documentation.
-html_theme_options = {
-  'index_logo': None
-}
+html_theme_options = {"index_logo": None}
 
 # Add any paths that contain custom themes here, relative to this directory.
-#html_theme_path = []
+# html_theme_path = []
 
 # The name for this set of Sphinx documents.  If None, it defaults to
 # "<project> v<release> documentation".
-html_title = 'pytest documentation'
+html_title = "pytest documentation"
 
 # A shorter title for the navigation bar.  Default is the same as html_title.
 html_short_title = "pytest-%s" % release
 
 # The name of an image file (relative to this directory) to place at the top
 # of the sidebar.
 html_logo = "img/pytest1.png"
 
@@ -140,184 +151,193 @@ html_favicon = "img/pytest1favi.ico"
 
 # Add any paths that contain custom static files (such as style sheets) here,
 # relative to this directory. They are copied after the builtin static files,
 # so a file named "default.css" will overwrite the builtin "default.css".
 # html_static_path = ['_static']
 
 # If not '', a 'Last updated on:' timestamp is inserted at every page bottom,
 # using the given strftime format.
-#html_last_updated_fmt = '%b %d, %Y'
+# html_last_updated_fmt = '%b %d, %Y'
 
 # If true, SmartyPants will be used to convert quotes and dashes to
 # typographically correct entities.
-#html_use_smartypants = True
+# html_use_smartypants = True
 
 # Custom sidebar templates, maps document names to template names.
-#html_sidebars = {}
-#html_sidebars = {'index': 'indexsidebar.html'}
+# html_sidebars = {}
+# html_sidebars = {'index': 'indexsidebar.html'}
 
 html_sidebars = {
-    'index': [
-        'sidebarintro.html',
-        'globaltoc.html',
-        'links.html',
-        'sourcelink.html',
-        'searchbox.html'
+    "index": [
+        "sidebarintro.html",
+        "globaltoc.html",
+        "links.html",
+        "sourcelink.html",
+        "searchbox.html",
     ],
-    '**': [
-        'globaltoc.html',
-        'relations.html',
-        'links.html',
-        'sourcelink.html',
-        'searchbox.html'
-    ]
+    "**": [
+        "globaltoc.html",
+        "relations.html",
+        "links.html",
+        "sourcelink.html",
+        "searchbox.html",
+    ],
 }
 
 # Additional templates that should be rendered to pages, maps page names to
 # template names.
-#html_additional_pages = {}
-#html_additional_pages = {'index': 'index.html'}
+# html_additional_pages = {}
+# html_additional_pages = {'index': 'index.html'}
 
 
 # If false, no module index is generated.
 html_domain_indices = True
 
 # If false, no index is generated.
 html_use_index = False
 
 # If true, the index is split into individual pages for each letter.
-#html_split_index = False
+# html_split_index = False
 
 # If true, links to the reST sources are added to the pages.
 html_show_sourcelink = False
 
 # If true, "Created using Sphinx" is shown in the HTML footer. Default is True.
-#html_show_sphinx = True
+# html_show_sphinx = True
 
 # If true, "(C) Copyright ..." is shown in the HTML footer. Default is True.
-#html_show_copyright = True
+# html_show_copyright = True
 
 # If true, an OpenSearch description file will be output, and all pages will
 # contain a <link> tag referring to it.  The value of this option must be the
 # base URL from which the finished HTML is served.
-#html_use_opensearch = ''
+# html_use_opensearch = ''
 
 # This is the file name suffix for HTML files (e.g. ".xhtml").
-#html_file_suffix = None
+# html_file_suffix = None
 
 # Output file base name for HTML help builder.
-htmlhelp_basename = 'pytestdoc'
+htmlhelp_basename = "pytestdoc"
 
 
 # -- Options for LaTeX output --------------------------------------------------
 
 # The paper size ('letter' or 'a4').
-#latex_paper_size = 'letter'
+# latex_paper_size = 'letter'
 
 # The font size ('10pt', '11pt' or '12pt').
-#latex_font_size = '10pt'
+# latex_font_size = '10pt'
 
 # Grouping the document tree into LaTeX files. List of tuples
 # (source start file, target name, title, author, documentclass [howto/manual]).
 latex_documents = [
-  ('contents', 'pytest.tex', u'pytest Documentation',
-   u'holger krekel, trainer and consultant, http://merlinux.eu', 'manual'),
+    (
+        "contents",
+        "pytest.tex",
+        u"pytest Documentation",
+        u"holger krekel, trainer and consultant, http://merlinux.eu",
+        "manual",
+    )
 ]
 
 # The name of an image file (relative to this directory) to place at the top of
 # the title page.
-latex_logo = 'img/pytest1.png'
+latex_logo = "img/pytest1.png"
 
 # For "manual" documents, if this is true, then toplevel headings are parts,
 # not chapters.
-#latex_use_parts = False
+# latex_use_parts = False
 
 # If true, show page references after internal links.
-#latex_show_pagerefs = False
+# latex_show_pagerefs = False
 
 # If true, show URL addresses after external links.
-#latex_show_urls = False
+# latex_show_urls = False
 
 # Additional stuff for the LaTeX preamble.
-#latex_preamble = ''
+# latex_preamble = ''
 
 # Documents to append as an appendix to all manuals.
-#latex_appendices = []
+# latex_appendices = []
 
 # If false, no module index is generated.
 latex_domain_indices = False
 
 # -- Options for manual page output --------------------------------------------
 
 # One entry per manual page. List of tuples
 # (source start file, name, description, authors, manual section).
-man_pages = [
-    ('usage', 'pytest', u'pytest usage',
-     [u'holger krekel at merlinux eu'], 1)
-]
+man_pages = [("usage", "pytest", u"pytest usage", [u"holger krekel at merlinux eu"], 1)]
 
 
 # -- Options for Epub output ---------------------------------------------------
 
 # Bibliographic Dublin Core info.
-epub_title = u'pytest'
-epub_author = u'holger krekel at merlinux eu'
-epub_publisher = u'holger krekel at merlinux eu'
-epub_copyright = u'2013, holger krekel et alii'
+epub_title = u"pytest"
+epub_author = u"holger krekel at merlinux eu"
+epub_publisher = u"holger krekel at merlinux eu"
+epub_copyright = u"2013, holger krekel et alii"
 
 # The language of the text. It defaults to the language option
 # or en if the language is not set.
-#epub_language = ''
+# epub_language = ''
 
 # The scheme of the identifier. Typical schemes are ISBN or URL.
-#epub_scheme = ''
+# epub_scheme = ''
 
 # The unique identifier of the text. This can be a ISBN number
 # or the project homepage.
-#epub_identifier = ''
+# epub_identifier = ''
 
 # A unique identification for the text.
-#epub_uid = ''
+# epub_uid = ''
 
 # HTML files that should be inserted before the pages created by sphinx.
 # The format is a list of tuples containing the path and title.
-#epub_pre_files = []
+# epub_pre_files = []
 
 # HTML files shat should be inserted after the pages created by sphinx.
 # The format is a list of tuples containing the path and title.
-#epub_post_files = []
+# epub_post_files = []
 
 # A list of files that should not be packed into the epub file.
-#epub_exclude_files = []
+# epub_exclude_files = []
 
 # The depth of the table of contents in toc.ncx.
-#epub_tocdepth = 3
+# epub_tocdepth = 3
 
 # Allow duplicate toc entries.
-#epub_tocdup = True
+# epub_tocdup = True
 
 
 # -- Options for texinfo output ------------------------------------------------
 
 texinfo_documents = [
-  (master_doc, 'pytest', 'pytest Documentation',
-   ('Holger Krekel@*Benjamin Peterson@*Ronny Pfannschmidt@*'
-    'Floris Bruynooghe@*others'),
-   'pytest',
-   'simple powerful testing with Python',
-   'Programming',
-   1),
+    (
+        master_doc,
+        "pytest",
+        "pytest Documentation",
+        (
+            "Holger Krekel@*Benjamin Peterson@*Ronny Pfannschmidt@*"
+            "Floris Bruynooghe@*others"
+        ),
+        "pytest",
+        "simple powerful testing with Python",
+        "Programming",
+        1,
+    )
 ]
 
 
 # Example configuration for intersphinx: refer to the Python standard library.
-intersphinx_mapping = {'python': ('http://docs.python.org/', None),
-#                       'lib': ("http://docs.python.org/2.7library/", None),
-                    }
+intersphinx_mapping = {"python": ("http://docs.python.org/3", None)}
 
 
 def setup(app):
-    #from sphinx.ext.autodoc import cut_lines
-    #app.connect('autodoc-process-docstring', cut_lines(4, what=['module']))
-    app.add_description_unit('confval', 'confval',
-                             objname='configuration value',
-                             indextemplate='pair: %s; configuration value')
+    # from sphinx.ext.autodoc import cut_lines
+    # app.connect('autodoc-process-docstring', cut_lines(4, what=['module']))
+    app.add_description_unit(
+        "confval",
+        "confval",
+        objname="configuration value",
+        indextemplate="pair: %s; configuration value",
+    )
--- a/third_party/python/pytest/doc/en/contact.rst
+++ b/third_party/python/pytest/doc/en/contact.rst
@@ -3,19 +3,19 @@
 .. _`contact`:
 
 Contact channels
 ===================================
 
 - `pytest issue tracker`_ to report bugs or suggest features (for version
   2.0 and above).
 
-- `pytest on stackoverflow.com <http://stackoverflow.com/search?q=pytest>`_ 
-  to post questions with the tag ``pytest``.  New Questions will usually 
-  be seen by pytest users or developers and answered quickly. 
+- `pytest on stackoverflow.com <http://stackoverflow.com/search?q=pytest>`_
+  to post questions with the tag ``pytest``.  New Questions will usually
+  be seen by pytest users or developers and answered quickly.
 
 - `Testing In Python`_: a mailing list for Python testing tools and discussion.
 
 - `pytest-dev at python.org (mailing list)`_ pytest specific announcements and discussions.
 
 - `pytest-commit at python.org (mailing list)`_: for commits and new issues
 
 - :doc:`contribution guide <contributing>` for help on submitting pull
@@ -42,9 +42,8 @@ Contact channels
 
 
 .. _`Testing in Python`: http://lists.idyll.org/listinfo/testing-in-python
 .. _FOAF: http://en.wikipedia.org/wiki/FOAF
 .. _`py-dev`:
 .. _`development mailing list`:
 .. _`pytest-dev at python.org (mailing list)`: http://mail.python.org/mailman/listinfo/pytest-dev
 .. _`pytest-commit at python.org (mailing list)`: http://mail.python.org/mailman/listinfo/pytest-commit
-
--- a/third_party/python/pytest/doc/en/contents.rst
+++ b/third_party/python/pytest/doc/en/contents.rst
@@ -9,32 +9,33 @@ Full pytest documentation
 
 .. toctree::
    :maxdepth: 2
 
    getting-started
    usage
    existingtestsuite
    assert
-   builtin
    fixture
+   mark
    monkeypatch
    tmpdir
    capture
    warnings
    doctest
-   mark
    skipping
    parametrize
    cache
    unittest
    nose
    xunit_setup
    plugins
    writing_plugins
+   logging
+   reference
 
    goodpractices
    pythonpath
    customize
    example/index
    bash-completion
 
    backwards-compatibility
@@ -56,9 +57,8 @@ Full pytest documentation
 
 .. only:: html
 
    .. toctree::
       :hidden:
       :maxdepth: 1
 
       changelog
-
--- a/third_party/python/pytest/doc/en/customize.rst
+++ b/third_party/python/pytest/doc/en/customize.rst
@@ -33,16 +33,20 @@ Here's a summary what ``pytest`` uses ``
 
 * Is used by plugins as a stable location to store project/test run specific information;
   for example, the internal :ref:`cache <cache>` plugin creates a ``.cache`` subdirectory
   in ``rootdir`` to store its cross-test run state.
 
 Important to emphasize that ``rootdir`` is **NOT** used to modify ``sys.path``/``PYTHONPATH`` or
 influence how modules are imported. See :ref:`pythonpath` for more details.
 
+``--rootdir=path`` command-line option can be used to force a specific directory.
+The directory passed may contain environment variables when it is used in conjunction
+with ``addopts`` in a ``pytest.ini`` file.
+
 Finding the ``rootdir``
 ~~~~~~~~~~~~~~~~~~~~~~~
 
 Here is the algorithm which finds the rootdir from ``args``:
 
 - determine the common ancestor directory for the specified ``args`` that are
   recognised as paths that exist in the file system. If no such paths are
   found, the common ancestor directory is set to the current working directory.
@@ -147,168 +151,9 @@ The actual command line executed is::
 
 Note that as usual for other command-line applications, in case of conflicting options the last one wins, so the example
 above will show verbose output because ``-v`` overwrites ``-q``.
 
 
 Builtin configuration file options
 ----------------------------------------------
 
-.. confval:: minversion
-
-   Specifies a minimal pytest version required for running tests.
-
-        minversion = 2.1  # will fail if we run with pytest-2.0
-
-.. confval:: addopts
-
-   Add the specified ``OPTS`` to the set of command line arguments as if they
-   had been specified by the user. Example: if you have this ini file content:
-
-   .. code-block:: ini
-
-        [pytest]
-        addopts = --maxfail=2 -rf  # exit after 2 failures, report fail info
-
-   issuing ``pytest test_hello.py`` actually means::
-
-        pytest --maxfail=2 -rf test_hello.py
-
-   Default is to add no options.
-
-.. confval:: norecursedirs
-
-   Set the directory basename patterns to avoid when recursing
-   for test discovery.  The individual (fnmatch-style) patterns are
-   applied to the basename of a directory to decide if to recurse into it.
-   Pattern matching characters::
-
-        *       matches everything
-        ?       matches any single character
-        [seq]   matches any character in seq
-        [!seq]  matches any char not in seq
-
-   Default patterns are ``'.*', 'build', 'dist', 'CVS', '_darcs', '{arch}', '*.egg', 'venv'``.
-   Setting a ``norecursedirs`` replaces the default.  Here is an example of
-   how to avoid certain directories:
-
-   .. code-block:: ini
-
-        # content of pytest.ini
-        [pytest]
-        norecursedirs = .svn _build tmp*
-
-   This would tell ``pytest`` to not look into typical subversion or
-   sphinx-build directories or into any ``tmp`` prefixed directory.  
-   
-   Additionally, ``pytest`` will attempt to intelligently identify and ignore a
-   virtualenv by the presence of an activation script.  Any directory deemed to
-   be the root of a virtual environment will not be considered during test
-   collection unless ``‑‑collect‑in‑virtualenv`` is given.  Note also that
-   ``norecursedirs`` takes precedence over ``‑‑collect‑in‑virtualenv``; e.g. if
-   you intend to run tests in a virtualenv with a base directory that matches
-   ``'.*'`` you *must* override ``norecursedirs`` in addition to using the
-   ``‑‑collect‑in‑virtualenv`` flag.
-
-.. confval:: testpaths
-
-   .. versionadded:: 2.8
-
-   Sets list of directories that should be searched for tests when
-   no specific directories, files or test ids are given in the command line when
-   executing pytest from the :ref:`rootdir <rootdir>` directory.
-   Useful when all project tests are in a known location to speed up
-   test collection and to avoid picking up undesired tests by accident.
-
-   .. code-block:: ini
-
-        # content of pytest.ini
-        [pytest]
-        testpaths = testing doc
-
-   This tells pytest to only look for tests in ``testing`` and ``doc``
-   directories when executing from the root directory.
-
-.. confval:: python_files
-
-   One or more Glob-style file patterns determining which python files
-   are considered as test modules. By default, pytest will consider
-   any file matching with ``test_*.py`` and ``*_test.py`` globs as a test
-   module.
-
-.. confval:: python_classes
-
-   One or more name prefixes or glob-style patterns determining which classes
-   are considered for test collection. By default, pytest will consider any
-   class prefixed with ``Test`` as a test collection.  Here is an example of how
-   to collect tests from classes that end in ``Suite``:
-
-   .. code-block:: ini
-
-        # content of pytest.ini
-        [pytest]
-        python_classes = *Suite
-
-   Note that ``unittest.TestCase`` derived classes are always collected
-   regardless of this option, as ``unittest``'s own collection framework is used
-   to collect those tests.
-
-.. confval:: python_functions
-
-   One or more name prefixes or glob-patterns determining which test functions
-   and methods are considered tests. By default, pytest will consider any
-   function prefixed with ``test`` as a test.  Here is an example of how
-   to collect test functions and methods that end in ``_test``:
-
-   .. code-block:: ini
-
-        # content of pytest.ini
-        [pytest]
-        python_functions = *_test
-
-   Note that this has no effect on methods that live on a ``unittest
-   .TestCase`` derived class, as ``unittest``'s own collection framework is used
-   to collect those tests.
-
-   See :ref:`change naming conventions` for more detailed examples.
-
-.. confval:: doctest_optionflags
-
-   One or more doctest flag names from the standard ``doctest`` module.
-   :doc:`See how pytest handles doctests <doctest>`.
-
-.. confval:: confcutdir
-
-   Sets a directory where search upwards for ``conftest.py`` files stops.
-   By default, pytest will stop searching for ``conftest.py`` files upwards
-   from ``pytest.ini``/``tox.ini``/``setup.cfg`` of the project if any,
-   or up to the file-system root.
-
-
-.. confval:: filterwarnings
-
-   .. versionadded:: 3.1
-
-   Sets a list of filters and actions that should be taken for matched
-   warnings. By default all warnings emitted during the test session
-   will be displayed in a summary at the end of the test session.
-
-   .. code-block:: ini
-
-        # content of pytest.ini
-        [pytest]
-        filterwarnings =
-            error
-            ignore::DeprecationWarning
-
-   This tells pytest to ignore deprecation warnings and turn all other warnings
-   into errors. For more information please refer to :ref:`warnings`.
-
-.. confval:: cache_dir
-
-   .. versionadded:: 3.2
-
-   Sets a directory where stores content of cache plugin. Default directory is
-   ``.cache`` which is created in :ref:`rootdir <rootdir>`. Directory may be
-   relative or absolute path. If setting relative path, then directory is created
-   relative to :ref:`rootdir <rootdir>`. Additionally path may contain environment
-   variables, that will be expanded. For more information about cache plugin
-   please refer to :ref:`cache_provider`.
+For the full list of options consult the :ref:`reference documentation <ini options ref>`.
--- a/third_party/python/pytest/doc/en/development_guide.rst
+++ b/third_party/python/pytest/doc/en/development_guide.rst
@@ -1,21 +1,21 @@
 =================
 Development Guide
 =================
 
-Some general guidelines regarding development in pytest for core maintainers and general contributors. Nothing here
+Some general guidelines regarding development in pytest for maintainers and contributors. Nothing here
 is set in stone and can't be changed, feel free to suggest improvements or changes in the workflow.
 
 
 Code Style
 ----------
 
 * `PEP-8 <https://www.python.org/dev/peps/pep-0008>`_
-* `flake8 <https://pypi.python.org/pypi/flake8>`_ for quality checks
+* `flake8 <https://pypi.org/project/flake8/>`_ for quality checks
 * `invoke <http://www.pyinvoke.org/>`_ to automate development tasks
 
 
 Branches
 --------
 
 We have two long term branches:
 
@@ -32,77 +32,24 @@ topic or where it makes sense to use som
 Issues
 ------
 
 Any question, feature, bug or proposal is welcome as an issue. Users are encouraged to use them whenever they need.
 
 GitHub issues should use labels to categorize them. Labels should be created sporadically, to fill a niche; we should
 avoid creating labels just for the sake of creating them.
 
-Here is a list of labels and a brief description mentioning their intent.
-
-
-**Type**
+Each label should include a description in the GitHub's interface stating its purpose.
 
-* ``type: backward compatibility``: issue that will cause problems with old pytest versions.
-* ``type: bug``: problem that needs to be addressed.
-* ``type: deprecation``: feature that will be deprecated in the future.
-* ``type: docs``: documentation missing or needing clarification.
-* ``type: enhancement``: new feature or API change, should be merged into ``features``.
-* ``type: feature-branch``: new feature or API change, should be merged into ``features``.
-* ``type: infrastructure``: improvement to development/releases/CI structure.
-* ``type: performance``: performance or memory problem/improvement.
-* ``type: proposal``: proposal for a new feature, often to gather opinions or design the API around the new feature.
-* ``type: question``: question regarding usage, installation, internals or how to test something.
-* ``type: refactoring``: internal improvements to the code.
-* ``type: regression``: indicates a problem that was introduced in a release which was working previously.
-
-**Status**
-
-* ``status: critical``: grave problem or usability issue that affects lots of users.
-* ``status: easy``: easy issue that is friendly to new contributors.
-* ``status: help wanted``: core developers need help from experts on this topic.
-* ``status: needs information``: reporter needs to provide more information; can be closed after 2 or more weeks of inactivity.
-
-**Topic**
+Temporary labels
+~~~~~~~~~~~~~~~~
 
-* ``topic: collection``
-* ``topic: fixtures``
-* ``topic: parametrize``
-* ``topic: reporting``
-* ``topic: selection``
-* ``topic: tracebacks``
-
-**Plugin (internal or external)**
+To classify issues for a special event it is encouraged to create a temporary label. This helps those involved to find
+the relevant issues to work on. Examples of that are sprints in Python events or global hacking events.
 
-* ``plugin: cache``
-* ``plugin: capture``
-* ``plugin: doctests``
-* ``plugin: junitxml``
-* ``plugin: monkeypatch``
-* ``plugin: nose``
-* ``plugin: pastebin``
-* ``plugin: pytester``
-* ``plugin: tmpdir``
-* ``plugin: unittest``
-* ``plugin: warnings``
-* ``plugin: xdist``
-
+* ``temporary: EP2017 sprint``: candidate issues or PRs tackled during the EuroPython 2017
 
-**OS**
-
-Issues specific to a single operating system. Do not use as a means to indicate where an issue originated from, only
-for problems that happen **only** in that system.
+Issues created at those events should have other relevant labels added as well.
 
-* ``os: linux``
-* ``os: mac``
-* ``os: windows``
-
-**Temporary**
-
-Used to classify issues for limited time, to help find issues related in events for example.
-They should be removed after they are no longer relevant.
-
-* ``temporary: EP2017 sprint``:
-* ``temporary: sprint-candidate``:
+Those labels should be removed after they are no longer relevant.
 
 
 .. include:: ../../HOWTORELEASE.rst
--- a/third_party/python/pytest/doc/en/doctest.rst
+++ b/third_party/python/pytest/doc/en/doctest.rst
@@ -56,39 +56,39 @@ and another like this::
         >>> something()
         42
         """
         return 42
 
 then you can just invoke ``pytest`` without command line options::
 
     $ pytest
-    ======= test session starts ========
+    =========================== test session starts ============================
     platform linux -- Python 3.x.y, pytest-3.x.y, py-1.x.y, pluggy-0.x.y
     rootdir: $REGENDOC_TMPDIR, inifile: pytest.ini
     collected 1 item
-    
-    mymodule.py .
-    
-    ======= 1 passed in 0.12 seconds ========
+
+    mymodule.py .                                                        [100%]
+
+    ========================= 1 passed in 0.12 seconds =========================
 
 It is possible to use fixtures using the ``getfixture`` helper::
 
     # content of example.rst
     >>> tmp = getfixture('tmpdir')
     >>> ...
     >>>
 
 Also, :ref:`usefixtures` and :ref:`autouse` fixtures are supported
 when executing text doctest files.
 
 The standard ``doctest`` module provides some setting flags to configure the
-strictness of doctest tests. In pytest You can enable those flags those flags
-using the configuration file. To make pytest ignore trailing whitespaces and
-ignore lengthy exception stack traces you can just write:
+strictness of doctest tests. In pytest, you can enable those flags using the
+configuration file. To make pytest ignore trailing whitespaces and ignore
+lengthy exception stack traces you can just write:
 
 .. code-block:: ini
 
     [pytest]
     doctest_optionflags= NORMALIZE_WHITESPACE IGNORE_EXCEPTION_DETAIL
 
 pytest also introduces new options to allow doctests to run in Python 2 and
 Python 3 unchanged:
@@ -110,16 +110,23 @@ the ``doctest_optionflags`` ini option:
 
 Alternatively, it can be enabled by an inline comment in the doc test
 itself::
 
     # content of example.rst
     >>> get_unicode_greeting()  # doctest: +ALLOW_UNICODE
     'Hello'
 
+By default, pytest would report only the first failure for a given doctest.  If
+you want to continue the test even when you have failures, do::
+
+    pytest --doctest-modules --doctest-continue-on-failure
+
+
+.. _`doctest_namespace`:
 
 The 'doctest_namespace' fixture
 -------------------------------
 
 .. versionadded:: 3.0
 
 The ``doctest_namespace`` fixture can be used to inject items into the
 namespace in which your doctests run. It is intended to be used within
@@ -156,10 +163,8 @@ by using one of standard doctest modules
 (see :data:`python:doctest.REPORT_UDIFF`, :data:`python:doctest.REPORT_CDIFF`,
 :data:`python:doctest.REPORT_NDIFF`, :data:`python:doctest.REPORT_ONLY_FIRST_FAILURE`)::
 
     pytest --doctest-modules --doctest-report none
     pytest --doctest-modules --doctest-report udiff
     pytest --doctest-modules --doctest-report cdiff
     pytest --doctest-modules --doctest-report ndiff
     pytest --doctest-modules --doctest-report only_first_failure
-
-
--- a/third_party/python/pytest/doc/en/example/assertion/failure_demo.py
+++ b/third_party/python/pytest/doc/en/example/assertion/failure_demo.py
@@ -1,238 +1,278 @@
 from pytest import raises
 import _pytest._code
 import py
 
-def otherfunc(a,b):
-    assert a==b
+
+def otherfunc(a, b):
+    assert a == b
+
 
-def somefunc(x,y):
-    otherfunc(x,y)
+def somefunc(x, y):
+    otherfunc(x, y)
+
 
-def otherfunc_multi(a,b):
-    assert (a ==
-            b)
+def otherfunc_multi(a, b):
+    assert a == b
+
 
 def test_generative(param1, param2):
     assert param1 * 2 < param2
 
+
 def pytest_generate_tests(metafunc):
-    if 'param1' in metafunc.fixturenames:
+    if "param1" in metafunc.fixturenames:
         metafunc.addcall(funcargs=dict(param1=3, param2=6))
 
+
 class TestFailing(object):
+
     def test_simple(self):
+
         def f():
             return 42
+
         def g():
             return 43
 
         assert f() == g()
 
     def test_simple_multiline(self):
-        otherfunc_multi(
-                  42,
-                  6*9)
+        otherfunc_multi(42, 6 * 9)
 
     def test_not(self):
+
         def f():
             return 42
+
         assert not f()
 
+
 class TestSpecialisedExplanations(object):
+
     def test_eq_text(self):
-        assert 'spam' == 'eggs'
+        assert "spam" == "eggs"
 
     def test_eq_similar_text(self):
-        assert 'foo 1 bar' == 'foo 2 bar'
+        assert "foo 1 bar" == "foo 2 bar"
 
     def test_eq_multiline_text(self):
-        assert 'foo\nspam\nbar' == 'foo\neggs\nbar'
+        assert "foo\nspam\nbar" == "foo\neggs\nbar"
 
     def test_eq_long_text(self):
-        a = '1'*100 + 'a' + '2'*100
-        b = '1'*100 + 'b' + '2'*100
+        a = "1" * 100 + "a" + "2" * 100
+        b = "1" * 100 + "b" + "2" * 100
         assert a == b
 
     def test_eq_long_text_multiline(self):
-        a = '1\n'*100 + 'a' + '2\n'*100
-        b = '1\n'*100 + 'b' + '2\n'*100
+        a = "1\n" * 100 + "a" + "2\n" * 100
+        b = "1\n" * 100 + "b" + "2\n" * 100
         assert a == b
 
     def test_eq_list(self):
         assert [0, 1, 2] == [0, 1, 3]
 
     def test_eq_list_long(self):
-        a = [0]*100 + [1] + [3]*100
-        b = [0]*100 + [2] + [3]*100
+        a = [0] * 100 + [1] + [3] * 100
+        b = [0] * 100 + [2] + [3] * 100
         assert a == b
 
     def test_eq_dict(self):
-        assert {'a': 0, 'b': 1, 'c': 0} == {'a': 0, 'b': 2, 'd': 0}
+        assert {"a": 0, "b": 1, "c": 0} == {"a": 0, "b": 2, "d": 0}
 
     def test_eq_set(self):
-        assert set([0, 10, 11, 12]) == set([0, 20, 21])
+        assert {0, 10, 11, 12} == {0, 20, 21}
 
     def test_eq_longer_list(self):
-        assert [1,2] == [1,2,3]
+        assert [1, 2] == [1, 2, 3]
 
     def test_in_list(self):
         assert 1 in [0, 2, 3, 4, 5]
 
     def test_not_in_text_multiline(self):
-        text = 'some multiline\ntext\nwhich\nincludes foo\nand a\ntail'
-        assert 'foo' not in text
+        text = "some multiline\ntext\nwhich\nincludes foo\nand a\ntail"
+        assert "foo" not in text
 
     def test_not_in_text_single(self):
-        text = 'single foo line'
-        assert 'foo' not in text
+        text = "single foo line"
+        assert "foo" not in text
 
     def test_not_in_text_single_long(self):
-        text = 'head ' * 50 + 'foo ' + 'tail ' * 20
-        assert 'foo' not in text
+        text = "head " * 50 + "foo " + "tail " * 20
+        assert "foo" not in text
 
     def test_not_in_text_single_long_term(self):
-        text = 'head ' * 50 + 'f'*70 + 'tail ' * 20
-        assert 'f'*70 not in text
+        text = "head " * 50 + "f" * 70 + "tail " * 20
+        assert "f" * 70 not in text
 
 
 def test_attribute():
+
     class Foo(object):
         b = 1
+
     i = Foo()
     assert i.b == 2
 
 
 def test_attribute_instance():
+
     class Foo(object):
         b = 1
+
     assert Foo().b == 2
 
 
 def test_attribute_failure():
+
     class Foo(object):
+
         def _get_b(self):
-            raise Exception('Failed to get attrib')
+            raise Exception("Failed to get attrib")
+
         b = property(_get_b)
+
     i = Foo()
     assert i.b == 2
 
 
 def test_attribute_multiple():
+
     class Foo(object):
         b = 1
+
     class Bar(object):
         b = 2
+
     assert Foo().b == Bar().b
 
 
 def globf(x):
-    return x+1
+    return x + 1
+
 
 class TestRaises(object):
+
     def test_raises(self):
-        s = 'qwe'
+        s = "qwe"  # NOQA
         raises(TypeError, "int(s)")
 
     def test_raises_doesnt(self):
         raises(IOError, "int('3')")
 
     def test_raise(self):
         raise ValueError("demo error")
 
     def test_tupleerror(self):
-        a,b = [1]
+        a, b = [1]  # NOQA
 
     def test_reinterpret_fails_with_print_for_the_fun_of_it(self):
-        l = [1,2,3]
-        print ("l is %r" % l)
-        a,b = l.pop()
+        items = [1, 2, 3]
+        print("items is %r" % items)
+        a, b = items.pop()
 
     def test_some_error(self):
-        if namenotexi:
+        if namenotexi:  # NOQA
             pass
 
     def func1(self):
         assert 41 == 42
 
 
 # thanks to Matthew Scott for this test
 def test_dynamic_compile_shows_nicely():
-    src = 'def foo():\n assert 1 == 0\n'
-    name = 'abc-123'
-    module = py.std.imp.new_module(name)
-    code = _pytest._code.compile(src, name, 'exec')
+    import imp
+    import sys
+
+    src = "def foo():\n assert 1 == 0\n"
+    name = "abc-123"
+    module = imp.new_module(name)
+    code = _pytest._code.compile(src, name, "exec")
     py.builtin.exec_(code, module.__dict__)
-    py.std.sys.modules[name] = module
+    sys.modules[name] = module
     module.foo()
 
 
-
 class TestMoreErrors(object):
+
     def test_complex_error(self):
+
         def f():
             return 44
+
         def g():
             return 43
+
         somefunc(f(), g())
 
     def test_z1_unpack_error(self):
-        l = []
-        a,b  = l
+        items = []
+        a, b = items
 
     def test_z2_type_error(self):
-        l = 3
-        a,b  = l
+        items = 3
+        a, b = items
 
     def test_startswith(self):
         s = "123"
         g = "456"
         assert s.startswith(g)
 
     def test_startswith_nested(self):
+
         def f():
             return "123"
+
         def g():
             return "456"
+
         assert f().startswith(g())
 
     def test_global_func(self):
         assert isinstance(globf(42), float)
 
     def test_instance(self):
-        self.x = 6*7
+        self.x = 6 * 7
         assert self.x != 42
 
     def test_compare(self):
         assert globf(10) < 5
 
     def test_try_finally(self):
         x = 1
         try:
             assert x == 0
         finally:
             x = 0
 
 
 class TestCustomAssertMsg(object):
 
     def test_single_line(self):
+
         class A(object):
             a = 1
+
         b = 2
         assert A.a == b, "A.a appears not to be b"
 
     def test_multiline(self):
+
         class A(object):
             a = 1
+
         b = 2
-        assert A.a == b, "A.a appears not to be b\n" \
-            "or does not appear to be b\none of those"
+        assert (
+            A.a == b
+        ), "A.a appears not to be b\n" "or does not appear to be b\none of those"
 
     def test_custom_repr(self):
+
         class JSON(object):
             a = 1
+
             def __repr__(self):
                 return "This is JSON\n{\n  'foo': 'bar'\n}"
+
         a = JSON()
         b = 2
         assert a.a == b, a
--- a/third_party/python/pytest/doc/en/example/assertion/global_testmodule_config/conftest.py
+++ b/third_party/python/pytest/doc/en/example/assertion/global_testmodule_config/conftest.py
@@ -1,10 +1,13 @@
-import pytest, py
+import pytest
+import py
+
 mydir = py.path.local(__file__).dirpath()
 
+
 def pytest_runtest_setup(item):
     if isinstance(item, pytest.Function):
         if not item.fspath.relto(mydir):
             return
         mod = item.getparent(pytest.Module).obj
-        if hasattr(mod, 'hello'):
-            print ("mod.hello %r" % (mod.hello,))
+        if hasattr(mod, "hello"):
+            print("mod.hello %r" % (mod.hello,))
deleted file mode 100644
--- a/third_party/python/pytest/doc/en/example/assertion/global_testmodule_config/test_hello.py
+++ /dev/null
@@ -1,5 +0,0 @@
-
-hello = "world"
-
-def test_func():
-    pass
new file mode 100644
--- /dev/null
+++ b/third_party/python/pytest/doc/en/example/assertion/global_testmodule_config/test_hello_world.py
@@ -0,0 +1,6 @@
+
+hello = "world"
+
+
+def test_func():
+    pass
--- a/third_party/python/pytest/doc/en/example/assertion/test_failures.py
+++ b/third_party/python/pytest/doc/en/example/assertion/test_failures.py
@@ -1,14 +1,14 @@
 
 import py
-failure_demo = py.path.local(__file__).dirpath('failure_demo.py')
-pytest_plugins = 'pytester',
+
+failure_demo = py.path.local(__file__).dirpath("failure_demo.py")
+pytest_plugins = "pytester",
+
 
 def test_failure_demo_fails_properly(testdir):
     target = testdir.tmpdir.join(failure_demo.basename)
     failure_demo.copy(target)
     failure_demo.copy(testdir.tmpdir.join(failure_demo.basename))
     result = testdir.runpytest(target, syspathinsert=True)
-    result.stdout.fnmatch_lines([
-        "*42 failed*"
-    ])
+    result.stdout.fnmatch_lines(["*42 failed*"])
     assert result.ret != 0
--- a/third_party/python/pytest/doc/en/example/assertion/test_setup_flow_example.py
+++ b/third_party/python/pytest/doc/en/example/assertion/test_setup_flow_example.py
@@ -1,12 +1,14 @@
 def setup_module(module):
     module.TestStateFullThing.classcount = 0
 
+
 class TestStateFullThing(object):
+
     def setup_class(cls):
         cls.classcount += 1
 
     def teardown_class(cls):
         cls.classcount -= 1
 
     def setup_method(self, method):
         self.id = eval(method.__name__[5:])
@@ -14,19 +16,21 @@ class TestStateFullThing(object):
     def test_42(self):
         assert self.classcount == 1
         assert self.id == 42
 
     def test_23(self):
         assert self.classcount == 1
         assert self.id == 23
 
+
 def teardown_module(module):
     assert module.TestStateFullThing.classcount == 0
 
+
 """ For this example the control flow happens as follows::
     import test_setup_flow_example
     setup_module(test_setup_flow_example)
        setup_class(TestStateFullThing)
            instance = TestStateFullThing()
            setup_method(instance, instance.test_42)
               instance.test_42()
            setup_method(instance, instance.test_23)
@@ -34,9 +38,8 @@ def teardown_module(module):
        teardown_class(TestStateFullThing)
     teardown_module(test_setup_flow_example)
 
 Note that ``setup_class(TestStateFullThing)`` is called and not
 ``TestStateFullThing.setup_class()`` which would require you
 to insert ``setup_class = classmethod(setup_class)`` to make
 your setup function callable.
 """
-
--- a/third_party/python/pytest/doc/en/example/attic.rst
+++ b/third_party/python/pytest/doc/en/example/attic.rst
@@ -4,25 +4,28 @@
 example: specifying and selecting acceptance tests
 --------------------------------------------------------------
 
 .. sourcecode:: python
 
     # ./conftest.py
     def pytest_option(parser):
         group = parser.getgroup("myproject")
-        group.addoption("-A", dest="acceptance", action="store_true",
-            help="run (slow) acceptance tests")
+        group.addoption(
+            "-A", dest="acceptance", action="store_true", help="run (slow) acceptance tests"
+        )
+
 
     def pytest_funcarg__accept(request):
         return AcceptFixture(request)
 
+
     class AcceptFixture(object):
         def __init__(self, request):
-            if not request.config.getoption('acceptance'):
+            if not request.config.getoption("acceptance"):
                 pytest.skip("specify -A to run acceptance tests")
             self.tmpdir = request.config.mktemp(request.function.__name__, numbered=True)
 
         def run(self, cmd):
             """ called by test code to execute an acceptance test. """
             self.tmpdir.chdir()
             return py.process.cmdexec(cmd)
 
@@ -56,16 +59,17 @@ extend the `accept example`_ by putting 
 
     def pytest_funcarg__accept(request):
         # call the next factory (living in our conftest.py)
         arg = request.getfuncargvalue("accept")
         # create a special layout in our tempdir
         arg.tmpdir.mkdir("special")
         return arg
 
+
     class TestSpecialAcceptance(object):
         def test_sometest(self, accept):
             assert accept.tmpdir.join("special").check()
 
 Our module level factory will be invoked first and it can
 ask its request object to call the next factory and then
 decorate its result.  This mechanism allows us to stay
 ignorant of how/where the function argument is provided -
--- a/third_party/python/pytest/doc/en/example/costlysetup/conftest.py
+++ b/third_party/python/pytest/doc/en/example/costlysetup/conftest.py
@@ -1,18 +1,22 @@
 
 import pytest
 
+
 @pytest.fixture("session")
 def setup(request):
     setup = CostlySetup()
     yield setup
     setup.finalize()
 
+
 class CostlySetup(object):
+
     def __init__(self):
         import time
-        print ("performing costly setup")
+
+        print("performing costly setup")
         time.sleep(5)
         self.timecostly = 1
 
     def finalize(self):
         del self.timecostly
deleted file mode 100644
--- a/third_party/python/pytest/doc/en/example/costlysetup/sub1/test_quick.py
+++ /dev/null
@@ -1,3 +0,0 @@
-
-def test_quick(setup):
-    pass
deleted file mode 100644
--- a/third_party/python/pytest/doc/en/example/costlysetup/sub2/__init__.py
+++ /dev/null
@@ -1,1 +0,0 @@
-#
deleted file mode 100644
--- a/third_party/python/pytest/doc/en/example/costlysetup/sub2/test_two.py
+++ /dev/null
@@ -1,6 +0,0 @@
-def test_something(setup):
-    assert setup.timecostly == 1
-
-def test_something_more(setup):
-    assert setup.timecostly == 1
-
rename from third_party/python/pytest/doc/en/example/costlysetup/sub1/__init__.py
rename to third_party/python/pytest/doc/en/example/costlysetup/sub_a/__init__.py
new file mode 100644
--- /dev/null
+++ b/third_party/python/pytest/doc/en/example/costlysetup/sub_a/test_quick.py
@@ -0,0 +1,2 @@
+def test_quick(setup):
+    pass
copy from third_party/python/pytest/doc/en/example/costlysetup/sub1/__init__.py
copy to third_party/python/pytest/doc/en/example/costlysetup/sub_b/__init__.py
new file mode 100644
--- /dev/null
+++ b/third_party/python/pytest/doc/en/example/costlysetup/sub_b/test_two.py
@@ -0,0 +1,6 @@
+def test_something(setup):
+    assert setup.timecostly == 1
+
+
+def test_something_more(setup):
+    assert setup.timecostly == 1
--- a/third_party/python/pytest/doc/en/example/markers.rst
+++ b/third_party/python/pytest/doc/en/example/markers.rst
@@ -25,87 +25,85 @@ You can "mark" a test function with cust
         def test_method(self):
             pass
 
 .. versionadded:: 2.2
 
 You can then restrict a test run to only run tests marked with ``webtest``::
 
     $ pytest -v -m webtest
-    ======= test session starts ========
+    =========================== test session starts ============================
     platform linux -- Python 3.x.y, pytest-3.x.y, py-1.x.y, pluggy-0.x.y -- $PYTHON_PREFIX/bin/python3.5
-    cachedir: .cache
+    cachedir: .pytest_cache
     rootdir: $REGENDOC_TMPDIR, inifile:
-    collecting ... collected 4 items
-    
-    test_server.py::test_send_http PASSED
-    
-    ======= 3 tests deselected ========
-    ======= 1 passed, 3 deselected in 0.12 seconds ========
+    collecting ... collected 4 items / 3 deselected
+
+    test_server.py::test_send_http PASSED                                [100%]
+
+    ================== 1 passed, 3 deselected in 0.12 seconds ==================
 
 Or the inverse, running all tests except the webtest ones::
 
     $ pytest -v -m "not webtest"
-    ======= test session starts ========
+    =========================== test session starts ============================
     platform linux -- Python 3.x.y, pytest-3.x.y, py-1.x.y, pluggy-0.x.y -- $PYTHON_PREFIX/bin/python3.5
-    cachedir: .cache
+    cachedir: .pytest_cache
     rootdir: $REGENDOC_TMPDIR, inifile:
-    collecting ... collected 4 items
-    
-    test_server.py::test_something_quick PASSED
-    test_server.py::test_another PASSED
-    test_server.py::TestClass::test_method PASSED
-    
-    ======= 1 tests deselected ========
-    ======= 3 passed, 1 deselected in 0.12 seconds ========
+    collecting ... collected 4 items / 1 deselected
+
+    test_server.py::test_something_quick PASSED                          [ 33%]
+    test_server.py::test_another PASSED                                  [ 66%]
+    test_server.py::TestClass::test_method PASSED                        [100%]
+
+    ================== 3 passed, 1 deselected in 0.12 seconds ==================
 
 Selecting tests based on their node ID
 --------------------------------------
 
 You can provide one or more :ref:`node IDs <node-id>` as positional
 arguments to select only specified tests. This makes it easy to select
 tests based on their module, class, method, or function name::
 
     $ pytest -v test_server.py::TestClass::test_method
-    ======= test session starts ========
+    =========================== test session starts ============================
     platform linux -- Python 3.x.y, pytest-3.x.y, py-1.x.y, pluggy-0.x.y -- $PYTHON_PREFIX/bin/python3.5
-    cachedir: .cache
+    cachedir: .pytest_cache
     rootdir: $REGENDOC_TMPDIR, inifile:
     collecting ... collected 1 item
-    
-    test_server.py::TestClass::test_method PASSED
-    
-    ======= 1 passed in 0.12 seconds ========
+
+    test_server.py::TestClass::test_method PASSED                        [100%]
+
+    ========================= 1 passed in 0.12 seconds =========================
 
 You can also select on the class::
 
     $ pytest -v test_server.py::TestClass
-    ======= test session starts ========
+    =========================== test session starts ============================
     platform linux -- Python 3.x.y, pytest-3.x.y, py-1.x.y, pluggy-0.x.y -- $PYTHON_PREFIX/bin/python3.5
-    cachedir: .cache
+    cachedir: .pytest_cache
     rootdir: $REGENDOC_TMPDIR, inifile:
     collecting ... collected 1 item
-    
-    test_server.py::TestClass::test_method PASSED
-    
-    ======= 1 passed in 0.12 seconds ========
+
+    test_server.py::TestClass::test_method PASSED                        [100%]
+
+    ========================= 1 passed in 0.12 seconds =========================
 
 Or select multiple nodes::
 
   $ pytest -v test_server.py::TestClass test_server.py::test_send_http
-  ======= test session starts ========
+  =========================== test session starts ============================
   platform linux -- Python 3.x.y, pytest-3.x.y, py-1.x.y, pluggy-0.x.y -- $PYTHON_PREFIX/bin/python3.5
-  cachedir: .cache
+  cachedir: .pytest_cache
   rootdir: $REGENDOC_TMPDIR, inifile:
   collecting ... collected 2 items
-  
-  test_server.py::TestClass::test_method PASSED
-  test_server.py::test_send_http PASSED
-  
-  ======= 2 passed in 0.12 seconds ========
+
+  test_server.py::TestClass::test_method PASSED                        [ 50%]
+  test_server.py::test_send_http PASSED                                [100%]
+
+  ========================= 2 passed in 0.12 seconds =========================
 
 .. _node-id:
 
 .. note::
 
     Node IDs are of the form ``module.py::class::method`` or
     ``module.py::function``.  Node IDs control which tests are
     collected, so ``module.py::class`` will select all test methods
@@ -124,57 +122,54 @@ Using ``-k expr`` to select tests based 
 .. versionadded: 2.0/2.3.4
 
 You can use the ``-k`` command line option to specify an expression
 which implements a substring match on the test names instead of the
 exact match on markers that ``-m`` provides.  This makes it easy to
 select tests based on their names::
 
     $ pytest -v -k http  # running with the above defined example module
-    ======= test session starts ========
+    =========================== test session starts ============================
     platform linux -- Python 3.x.y, pytest-3.x.y, py-1.x.y, pluggy-0.x.y -- $PYTHON_PREFIX/bin/python3.5
-    cachedir: .cache
+    cachedir: .pytest_cache
     rootdir: $REGENDOC_TMPDIR, inifile:
-    collecting ... collected 4 items
-    
-    test_server.py::test_send_http PASSED
-    
-    ======= 3 tests deselected ========
-    ======= 1 passed, 3 deselected in 0.12 seconds ========
+    collecting ... collected 4 items / 3 deselected
+
+    test_server.py::test_send_http PASSED                                [100%]
+
+    ================== 1 passed, 3 deselected in 0.12 seconds ==================
 
 And you can also run all tests except the ones that match the keyword::
 
     $ pytest -k "not send_http" -v
-    ======= test session starts ========
+    =========================== test session starts ============================
     platform linux -- Python 3.x.y, pytest-3.x.y, py-1.x.y, pluggy-0.x.y -- $PYTHON_PREFIX/bin/python3.5
-    cachedir: .cache
+    cachedir: .pytest_cache
     rootdir: $REGENDOC_TMPDIR, inifile:
-    collecting ... collected 4 items
-    
-    test_server.py::test_something_quick PASSED
-    test_server.py::test_another PASSED
-    test_server.py::TestClass::test_method PASSED
-    
-    ======= 1 tests deselected ========
-    ======= 3 passed, 1 deselected in 0.12 seconds ========
+    collecting ... collected 4 items / 1 deselected
+
+    test_server.py::test_something_quick PASSED                          [ 33%]
+    test_server.py::test_another PASSED                                  [ 66%]
+    test_server.py::TestClass::test_method PASSED                        [100%]
+
+    ================== 3 passed, 1 deselected in 0.12 seconds ==================
 
 Or to select "http" and "quick" tests::
 
     $ pytest -k "http or quick" -v
-    ======= test session starts ========
+    =========================== test session starts ============================
     platform linux -- Python 3.x.y, pytest-3.x.y, py-1.x.y, pluggy-0.x.y -- $PYTHON_PREFIX/bin/python3.5
-    cachedir: .cache
+    cachedir: .pytest_cache
     rootdir: $REGENDOC_TMPDIR, inifile:
-    collecting ... collected 4 items
-    
-    test_server.py::test_send_http PASSED
-    test_server.py::test_something_quick PASSED
-    
-    ======= 2 tests deselected ========
-    ======= 2 passed, 2 deselected in 0.12 seconds ========
+    collecting ... collected 4 items / 2 deselected
+
+    test_server.py::test_send_http PASSED                                [ 50%]
+    test_server.py::test_something_quick PASSED                          [100%]
+
+    ================== 2 passed, 2 deselected in 0.12 seconds ==================
 
 .. note::
 
     If you are using expressions such as ``"X and Y"`` then both ``X`` and ``Y``
     need to be simple non-keyword names. For example, ``"pass"`` or ``"from"``
     will result in SyntaxErrors because ``"-k"`` evaluates the expression using
     Python's `eval`_ function.
 
@@ -199,45 +194,45 @@ Registering markers for your test suite 
     [pytest]
     markers =
         webtest: mark a test as a webtest.
 
 You can ask which markers exist for your test suite - the list includes our just defined ``webtest`` markers::
 
     $ pytest --markers
     @pytest.mark.webtest: mark a test as a webtest.
-    
+
     @pytest.mark.skip(reason=None): skip the given test function with an optional reason. Example: skip(reason="no way of currently testing this") skips the test.
-    
+
     @pytest.mark.skipif(condition): skip the given test function if eval(condition) results in a True value.  Evaluation happens within the module global context. Example: skipif('sys.platform == "win32"') skips the test if we are on the win32 platform. see http://pytest.org/latest/skipping.html
-    
+
     @pytest.mark.xfail(condition, reason=None, run=True, raises=None, strict=False): mark the test function as an expected failure if eval(condition) has a True value. Optionally specify a reason for better reporting and run=False if you don't even want to execute the test function. If only specific exception(s) are expected, you can list them in raises, and if the test fails in other ways, it will be reported as a true failure. See http://pytest.org/latest/skipping.html
-    
+
     @pytest.mark.parametrize(argnames, argvalues): call a test function multiple times passing in different arguments in turn. argvalues generally needs to be a list of values if argnames specifies only one name or a list of tuples of values if argnames specifies multiple names. Example: @parametrize('arg1', [1,2]) would lead to two calls of the decorated test function, one with arg1=1 and another with arg1=2.see http://pytest.org/latest/parametrize.html for more info and examples.
-    
-    @pytest.mark.usefixtures(fixturename1, fixturename2, ...): mark tests as needing all of the specified fixtures. see http://pytest.org/latest/fixture.html#usefixtures 
-    
+
+    @pytest.mark.usefixtures(fixturename1, fixturename2, ...): mark tests as needing all of the specified fixtures. see http://pytest.org/latest/fixture.html#usefixtures
+
     @pytest.mark.tryfirst: mark a hook implementation function such that the plugin machinery will try to call it first/as early as possible.
-    
+
     @pytest.mark.trylast: mark a hook implementation function such that the plugin machinery will try to call it last/as late as possible.
-    
+
 
 For an example on how to add and work with markers from a plugin, see
 :ref:`adding a custom marker from a plugin`.
 
 .. note::
 
     It is recommended to explicitly register markers so that:
 
     * There is one place in your test suite defining your markers
 
     * Asking for existing markers via ``pytest --markers`` gives good output
 
     * Typos in function markers are treated as an error if you use
-      the ``--strict`` option. 
+      the ``--strict`` option.
 
 .. _`scoped-marking`:
 
 Marking whole classes or modules
 ----------------------------------------------------
 
 You may use ``pytest.mark`` decorators with classes to apply markers to all of
 its test methods::
@@ -330,94 +325,91 @@ specifies via named environments::
             help="only run tests matching the environment NAME.")
 
     def pytest_configure(config):
         # register an additional marker
         config.addinivalue_line("markers",
             "env(name): mark test to run only on named environment")
 
     def pytest_runtest_setup(item):
-        envmarker = item.get_marker("env")
-        if envmarker is not None:
-            envname = envmarker.args[0]
-            if envname != item.config.getoption("-E"):
-                pytest.skip("test requires env %r" % envname)
+        envnames = [mark.args[0] for mark in item.iter_markers(name='env')]
+        if envnames:
+            if item.config.getoption("-E") not in envnames:
+                pytest.skip("test requires env in %r" % envnames)
 
 A test file using this local plugin::
 
     # content of test_someenv.py
 
     import pytest
     @pytest.mark.env("stage1")
     def test_basic_db_operation():
         pass
 
 and an example invocations specifying a different environment than what
 the test needs::
 
     $ pytest -E stage2
-    ======= test session starts ========
+    =========================== test session starts ============================
     platform linux -- Python 3.x.y, pytest-3.x.y, py-1.x.y, pluggy-0.x.y
     rootdir: $REGENDOC_TMPDIR, inifile:
     collected 1 item
-    
-    test_someenv.py s
-    
-    ======= 1 skipped in 0.12 seconds ========
+
+    test_someenv.py s                                                    [100%]
+
+    ======================== 1 skipped in 0.12 seconds =========================
 
 and here is one that specifies exactly the environment needed::
 
     $ pytest -E stage1
-    ======= test session starts ========
+    =========================== test session starts ============================
     platform linux -- Python 3.x.y, pytest-3.x.y, py-1.x.y, pluggy-0.x.y
     rootdir: $REGENDOC_TMPDIR, inifile:
     collected 1 item
-    
-    test_someenv.py .
-    
-    ======= 1 passed in 0.12 seconds ========
+
+    test_someenv.py .                                                    [100%]
+
+    ========================= 1 passed in 0.12 seconds =========================
 
 The ``--markers`` option always gives you a list of available markers::
 
     $ pytest --markers
     @pytest.mark.env(name): mark test to run only on named environment
-    
+
     @pytest.mark.skip(reason=None): skip the given test function with an optional reason. Example: skip(reason="no way of currently testing this") skips the test.
-    
+
     @pytest.mark.skipif(condition): skip the given test function if eval(condition) results in a True value.  Evaluation happens within the module global context. Example: skipif('sys.platform == "win32"') skips the test if we are on the win32 platform. see http://pytest.org/latest/skipping.html
-    
+
     @pytest.mark.xfail(condition, reason=None, run=True, raises=None, strict=False): mark the test function as an expected failure if eval(condition) has a True value. Optionally specify a reason for better reporting and run=False if you don't even want to execute the test function. If only specific exception(s) are expected, you can list them in raises, and if the test fails in other ways, it will be reported as a true failure. See http://pytest.org/latest/skipping.html
-    
+
     @pytest.mark.parametrize(argnames, argvalues): call a test function multiple times passing in different arguments in turn. argvalues generally needs to be a list of values if argnames specifies only one name or a list of tuples of values if argnames specifies multiple names. Example: @parametrize('arg1', [1,2]) would lead to two calls of the decorated test function, one with arg1=1 and another with arg1=2.see http://pytest.org/latest/parametrize.html for more info and examples.
-    
-    @pytest.mark.usefixtures(fixturename1, fixturename2, ...): mark tests as needing all of the specified fixtures. see http://pytest.org/latest/fixture.html#usefixtures 
-    
+
+    @pytest.mark.usefixtures(fixturename1, fixturename2, ...): mark tests as needing all of the specified fixtures. see http://pytest.org/latest/fixture.html#usefixtures
+
     @pytest.mark.tryfirst: mark a hook implementation function such that the plugin machinery will try to call it first/as early as possible.
-    
+
     @pytest.mark.trylast: mark a hook implementation function such that the plugin machinery will try to call it last/as late as possible.
-    
+
 
 .. _`passing callables to custom markers`:
 
 Passing a callable to custom markers
 --------------------------------------------
 
 .. regendoc:wipe
 
 Below is the config file that will be used in the next examples::
 
     # content of conftest.py
     import sys
 
     def pytest_runtest_setup(item):
-        marker = item.get_marker('my_marker')
-        if marker is not None:
-            for info in marker:
-                print('Marker info name={} args={} kwars={}'.format(info.name, info.args, info.kwargs))
-                sys.stdout.flush()
+        for marker in item.iter_markers(name='my_marker'):
+            print(marker)
+            sys.stdout.flush()
 
 A custom marker can have its argument set, i.e. ``args`` and ``kwargs`` properties, defined by either invoking it as a callable or using ``pytest.mark.MARKER_NAME.with_args``. These two methods achieve the same effect most of the time.
 
 However, if there is a callable as the single positional argument with no keyword arguments, using the ``pytest.mark.MARKER_NAME(c)`` will not pass ``c`` as a positional argument but decorate ``c`` with the custom marker (see :ref:`MarkDecorator <mark>`). Fortunately, ``pytest.mark.MARKER_NAME.with_args`` comes to the rescue::
 
     # content of test_custom_marker.py
     import pytest
 
@@ -426,17 +418,17 @@ However, if there is a callable as the s
 
     @pytest.mark.my_marker.with_args(hello_world)
     def test_with_args():
         pass
 
 The output is as follows::
 
     $ pytest -q -s
-    Marker info name=my_marker args=(<function hello_world at 0xdeadbeef>,) kwars={}
+    Mark(name='my_marker', args=(<function hello_world at 0xdeadbeef>,), kwargs={})
     .
     1 passed in 0.12 seconds
 
 We can see that the custom marker has its argument set extended with the function ``hello_world``. This is the key difference between creating a custom marker as a callable, which invokes ``__call__`` behind the scenes, and using ``with_args``.
 
 
 Reading markers which were set from multiple places
 ----------------------------------------------------
@@ -460,21 +452,19 @@ code you can read over all such settings
 
 Here we have the marker "glob" applied three times to the same
 test function.  From a conftest file we can read it like this::
 
     # content of conftest.py
     import sys
 
     def pytest_runtest_setup(item):
-        g = item.get_marker("glob")
-        if g is not None:
-            for info in g:
-                print ("glob args=%s kwargs=%s" %(info.args, info.kwargs))
-                sys.stdout.flush()
+        for mark in item.iter_markers(name='glob'):
+            print ("glob args=%s kwargs=%s" %(mark.args, mark.kwargs))
+            sys.stdout.flush()
 
 Let's run this without capturing output and see what we get::
 
     $ pytest -q -s
     glob args=('function',) kwargs={'x': 3}
     glob args=('class',) kwargs={'x': 2}
     glob args=('module',) kwargs={'x': 1}
     .
@@ -494,21 +484,20 @@ for your particular platform, you could 
     # content of conftest.py
     #
     import sys
     import pytest
 
     ALL = set("darwin linux win32".split())
 
     def pytest_runtest_setup(item):
-        if isinstance(item, item.Function):
-            plat = sys.platform
-            if not item.get_marker(plat):
-                if ALL.intersection(item.keywords):
-                    pytest.skip("cannot run on platform %s" %(plat))
+        supported_platforms = ALL.intersection(mark.name for mark in item.iter_markers())
+        plat = sys.platform
+        if supported_platforms and plat not in supported_platforms:
+            pytest.skip("cannot run on platform %s" % (plat))
 
 then tests will be skipped if they were specified for a different platform.
 Let's do a little test file to show how this looks like::
 
     # content of test_plat.py
 
     import pytest
 
@@ -525,39 +514,38 @@ Let's do a little test file to show how 
         pass
 
     def test_runs_everywhere():
         pass
 
 then you will see two tests skipped and two executed tests as expected::
 
     $ pytest -rs # this option reports skip reasons
-    ======= test session starts ========
+    =========================== test session starts ============================
     platform linux -- Python 3.x.y, pytest-3.x.y, py-1.x.y, pluggy-0.x.y
     rootdir: $REGENDOC_TMPDIR, inifile:
     collected 4 items
-    
-    test_plat.py s.s.
-    ======= short test summary info ========
-    SKIP [2] $REGENDOC_TMPDIR/conftest.py:13: cannot run on platform linux
-    
-    ======= 2 passed, 2 skipped in 0.12 seconds ========
+
+    test_plat.py s.s.                                                    [100%]
+    ========================= short test summary info ==========================
+    SKIP [2] $REGENDOC_TMPDIR/conftest.py:12: cannot run on platform linux
+
+    =================== 2 passed, 2 skipped in 0.12 seconds ====================
 
 Note that if you specify a platform via the marker-command line option like this::
 
     $ pytest -m linux
-    ======= test session starts ========
+    =========================== test session starts ============================
     platform linux -- Python 3.x.y, pytest-3.x.y, py-1.x.y, pluggy-0.x.y
     rootdir: $REGENDOC_TMPDIR, inifile:
-    collected 4 items
-    
-    test_plat.py .
-    
-    ======= 3 tests deselected ========
-    ======= 1 passed, 3 deselected in 0.12 seconds ========
+    collected 4 items / 3 deselected
+
+    test_plat.py .                                                       [100%]
+
+    ================== 1 passed, 3 deselected in 0.12 seconds ==================
 
 then the unmarked-tests will not be run.  It is thus a way to restrict the run to the specific tests.
 
 Automatically adding markers based on test names
 --------------------------------------------------------
 
 .. regendoc:wipe
 
@@ -591,52 +579,50 @@ We want to dynamically define two marker
             if "interface" in item.nodeid:
                 item.add_marker(pytest.mark.interface)
             elif "event" in item.nodeid:
                 item.add_marker(pytest.mark.event)
 
 We can now use the ``-m option`` to select one set::
 
   $ pytest -m interface --tb=short
-  ======= test session starts ========
+  =========================== test session starts ============================
   platform linux -- Python 3.x.y, pytest-3.x.y, py-1.x.y, pluggy-0.x.y
   rootdir: $REGENDOC_TMPDIR, inifile:
-  collected 4 items
-  
-  test_module.py FF
-  
-  ======= FAILURES ========
-  _______ test_interface_simple ________
+  collected 4 items / 2 deselected
+
+  test_module.py FF                                                    [100%]
+
+  ================================= FAILURES =================================
+  __________________________ test_interface_simple ___________________________
   test_module.py:3: in test_interface_simple
       assert 0
   E   assert 0
-  _______ test_interface_complex ________
+  __________________________ test_interface_complex __________________________
   test_module.py:6: in test_interface_complex
       assert 0
   E   assert 0
-  ======= 2 tests deselected ========
-  ======= 2 failed, 2 deselected in 0.12 seconds ========
+  ================== 2 failed, 2 deselected in 0.12 seconds ==================
 
 or to select both "event" and "interface" tests::
 
   $ pytest -m "interface or event" --tb=short
-  ======= test session starts ========
+  =========================== test session starts ============================
   platform linux -- Python 3.x.y, pytest-3.x.y, py-1.x.y, pluggy-0.x.y
   rootdir: $REGENDOC_TMPDIR, inifile:
-  collected 4 items
-  
-  test_module.py FFF
-  
-  ======= FAILURES ========
-  _______ test_interface_simple ________
+  collected 4 items / 1 deselected
+
+  test_module.py FFF                                                   [100%]
+
+  ================================= FAILURES =================================
+  __________________________ test_interface_simple ___________________________
   test_module.py:3: in test_interface_simple
       assert 0
   E   assert 0
-  _______ test_interface_complex ________
+  __________________________ test_interface_complex __________________________
   test_module.py:6: in test_interface_complex
       assert 0
   E   assert 0
-  _______ test_event_simple ________
+  ____________________________ test_event_simple _____________________________
   test_module.py:9: in test_event_simple
       assert 0
   E   assert 0
-  ======= 1 tests deselected ========
-  ======= 3 failed, 1 deselected in 0.12 seconds ========
+  ================== 3 failed, 1 deselected in 0.12 seconds ==================
--- a/third_party/python/pytest/doc/en/example/multipython.py
+++ b/third_party/python/pytest/doc/en/example/multipython.py
@@ -1,52 +1,69 @@
 """
 module containing a parametrized tests testing cross-python
 serialization via the pickle module.
 """
 import py
 import pytest
 import _pytest._code
 
-pythonlist = ['python2.6', 'python2.7', 'python3.4', 'python3.5']
+pythonlist = ["python2.7", "python3.4", "python3.5"]
+
+
 @pytest.fixture(params=pythonlist)
 def python1(request, tmpdir):
     picklefile = tmpdir.join("data.pickle")
     return Python(request.param, picklefile)
 
+
 @pytest.fixture(params=pythonlist)
 def python2(request, python1):
     return Python(request.param, python1.picklefile)
 
+
 class Python(object):
+
     def __init__(self, version, picklefile):
         self.pythonpath = py.path.local.sysfind(version)
         if not self.pythonpath:
-            pytest.skip("%r not found" %(version,))
+            pytest.skip("%r not found" % (version,))
         self.picklefile = picklefile
+
     def dumps(self, obj):
         dumpfile = self.picklefile.dirpath("dump.py")
-        dumpfile.write(_pytest._code.Source("""
+        dumpfile.write(
+            _pytest._code.Source(
+                """
             import pickle
             f = open(%r, 'wb')
             s = pickle.dump(%r, f, protocol=2)
             f.close()
-        """ % (str(self.picklefile), obj)))
-        py.process.cmdexec("%s %s" %(self.pythonpath, dumpfile))
+        """
+                % (str(self.picklefile), obj)
+            )
+        )
+        py.process.cmdexec("%s %s" % (self.pythonpath, dumpfile))
 
     def load_and_is_true(self, expression):
         loadfile = self.picklefile.dirpath("load.py")
-        loadfile.write(_pytest._code.Source("""
+        loadfile.write(
+            _pytest._code.Source(
+                """
             import pickle
             f = open(%r, 'rb')
             obj = pickle.load(f)
             f.close()
             res = eval(%r)
             if not res:
                 raise SystemExit(1)
-        """ % (str(self.picklefile), expression)))
-        print (loadfile)
-        py.process.cmdexec("%s %s" %(self.pythonpath, loadfile))
+        """
+                % (str(self.picklefile), expression)
+            )
+        )
+        print(loadfile)
+        py.process.cmdexec("%s %s" % (self.pythonpath, loadfile))
 
-@pytest.mark.parametrize("obj", [42, {}, {1:3},])
+
+@pytest.mark.parametrize("obj", [42, {}, {1: 3}])
 def test_basic_objects(python1, python2, obj):
     python1.dumps(obj)
     python2.load_and_is_true("obj == %s" % obj)
--- a/third_party/python/pytest/doc/en/example/nonpython.rst
+++ b/third_party/python/pytest/doc/en/example/nonpython.rst
@@ -5,45 +5,45 @@ Working with non-python tests
 ====================================================
 
 .. _`yaml plugin`:
 
 A basic example for specifying tests in Yaml files
 --------------------------------------------------------------
 
 .. _`pytest-yamlwsgi`: http://bitbucket.org/aafshar/pytest-yamlwsgi/src/tip/pytest_yamlwsgi.py
-.. _`PyYAML`: http://pypi.python.org/pypi/PyYAML/
+.. _`PyYAML`: https://pypi.org/project/PyYAML/
 
 Here is an example ``conftest.py`` (extracted from Ali Afshnars special purpose `pytest-yamlwsgi`_ plugin).   This ``conftest.py`` will  collect ``test*.yml`` files and will execute the yaml-formatted content as custom tests:
 
 .. include:: nonpython/conftest.py
     :literal:
 
 You can create a simple example file:
 
 .. include:: nonpython/test_simple.yml
     :literal:
 
 and if you installed `PyYAML`_ or a compatible YAML-parser you can
 now execute the test specification::
 
     nonpython $ pytest test_simple.yml
-    ======= test session starts ========
+    =========================== test session starts ============================
     platform linux -- Python 3.x.y, pytest-3.x.y, py-1.x.y, pluggy-0.x.y
     rootdir: $REGENDOC_TMPDIR/nonpython, inifile:
     collected 2 items
-    
-    test_simple.yml F.
-    
-    ======= FAILURES ========
-    _______ usecase: hello ________
+
+    test_simple.yml F.                                                   [100%]
+
+    ================================= FAILURES =================================
+    ______________________________ usecase: hello ______________________________
     usecase execution failed
        spec failed: 'some': 'other'
        no further details known at this point.
-    ======= 1 failed, 1 passed in 0.12 seconds ========
+    ==================== 1 failed, 1 passed in 0.12 seconds ====================
 
 .. regendoc:wipe
 
 You get one dot for the passing ``sub1: sub1`` check and one failure.
 Obviously in the above ``conftest.py`` you'll want to implement a more
 interesting interpretation of the yaml-values.  You can easily write
 your own domain specific testing language this way.
 
@@ -53,39 +53,39 @@ your own domain specific testing languag
     If you create custom collection nodes you can return an error
     representation string of your choice.  It
     will be reported as a (red) string.
 
 ``reportinfo()`` is used for representing the test location and is also
 consulted when reporting in ``verbose`` mode::
 
     nonpython $ pytest -v
-    ======= test session starts ========
+    =========================== test session starts ============================
     platform linux -- Python 3.x.y, pytest-3.x.y, py-1.x.y, pluggy-0.x.y -- $PYTHON_PREFIX/bin/python3.5
-    cachedir: .cache
+    cachedir: .pytest_cache
     rootdir: $REGENDOC_TMPDIR/nonpython, inifile:
     collecting ... collected 2 items
-    
-    test_simple.yml::hello FAILED
-    test_simple.yml::ok PASSED
-    
-    ======= FAILURES ========
-    _______ usecase: hello ________
+
+    test_simple.yml::hello FAILED                                        [ 50%]
+    test_simple.yml::ok PASSED                                           [100%]
+
+    ================================= FAILURES =================================
+    ______________________________ usecase: hello ______________________________
     usecase execution failed
        spec failed: 'some': 'other'
        no further details known at this point.
-    ======= 1 failed, 1 passed in 0.12 seconds ========
+    ==================== 1 failed, 1 passed in 0.12 seconds ====================
 
 .. regendoc:wipe
 
 While developing your custom test collection and execution it's also
 interesting to just look at the collection tree::
 
     nonpython $ pytest --collect-only
-    ======= test session starts ========
+    =========================== test session starts ============================
     platform linux -- Python 3.x.y, pytest-3.x.y, py-1.x.y, pluggy-0.x.y
     rootdir: $REGENDOC_TMPDIR/nonpython, inifile:
     collected 2 items
     <YamlFile 'test_simple.yml'>
       <YamlItem 'hello'>
       <YamlItem 'ok'>
-    
-    ======= no tests ran in 0.12 seconds ========
+
+    ======================= no tests ran in 0.12 seconds =======================
--- a/third_party/python/pytest/doc/en/example/nonpython/conftest.py
+++ b/third_party/python/pytest/doc/en/example/nonpython/conftest.py
@@ -1,40 +1,49 @@
 # content of conftest.py
 
 import pytest
 
+
 def pytest_collect_file(parent, path):
     if path.ext == ".yml" and path.basename.startswith("test"):
         return YamlFile(path, parent)
 
+
 class YamlFile(pytest.File):
+
     def collect(self):
-        import yaml # we need a yaml parser, e.g. PyYAML
+        import yaml  # we need a yaml parser, e.g. PyYAML
+
         raw = yaml.safe_load(self.fspath.open())
         for name, spec in sorted(raw.items()):
             yield YamlItem(name, self, spec)
 
+
 class YamlItem(pytest.Item):
+
     def __init__(self, name, parent, spec):
         super(YamlItem, self).__init__(name, parent)
         self.spec = spec
 
     def runtest(self):
         for name, value in sorted(self.spec.items()):
             # some custom test execution (dumb example follows)
             if name != value:
                 raise YamlException(self, name, value)
 
     def repr_failure(self, excinfo):
         """ called when self.runtest() raises an exception. """
         if isinstance(excinfo.value, YamlException):
-            return "\n".join([
-                "usecase execution failed",
-                "   spec failed: %r: %r" % excinfo.value.args[1:3],
-                "   no further details known at this point."
-            ])
+            return "\n".join(
+                [
+                    "usecase execution failed",
+                    "   spec failed: %r: %r" % excinfo.value.args[1:3],
+                    "   no further details known at this point.",
+                ]
+            )
 
     def reportinfo(self):
         return self.fspath, 0, "usecase: %s" % self.name
 
+
 class YamlException(Exception):
     """ custom exception for error reporting. """
--- a/third_party/python/pytest/doc/en/example/parametrize.rst
+++ b/third_party/python/pytest/doc/en/example/parametrize.rst
@@ -40,33 +40,33 @@ Now we add a test configuration like thi
                 end = 5
             else:
                 end = 2
             metafunc.parametrize("param1", range(end))
 
 This means that we only run 2 tests if we do not pass ``--all``::
 
     $ pytest -q test_compute.py
-    ..
+    ..                                                                   [100%]
     2 passed in 0.12 seconds
 
 We run only two computations, so we see two dots.
 let's run the full monty::
 
     $ pytest -q --all
-    ....F
-    ======= FAILURES ========
-    _______ test_compute[4] ________
-    
+    ....F                                                                [100%]
+    ================================= FAILURES =================================
+    _____________________________ test_compute[4] ______________________________
+
     param1 = 4
-    
+
         def test_compute(param1):
     >       assert param1 < 4
     E       assert 4 < 4
-    
+
     test_compute.py:3: AssertionError
     1 failed, 4 passed in 0.12 seconds
 
 As expected when running the full range of ``param1`` values
 we'll get an error on the last one.
 
 
 Different options for test IDs
@@ -133,39 +133,39 @@ used as the test IDs. These are succinct
 
 In ``test_timedistance_v2``, we specified ``ids`` as a function that can generate a
 string representation to make part of the test ID. So our ``datetime`` values use the
 label generated by ``idfn``, but because we didn't generate a label for ``timedelta``
 objects, they are still using the default pytest representation::
 
 
     $ pytest test_time.py --collect-only
-    ======= test session starts ========
+    =========================== test session starts ============================
     platform linux -- Python 3.x.y, pytest-3.x.y, py-1.x.y, pluggy-0.x.y
     rootdir: $REGENDOC_TMPDIR, inifile:
     collected 8 items
     <Module 'test_time.py'>
       <Function 'test_timedistance_v0[a0-b0-expected0]'>
       <Function 'test_timedistance_v0[a1-b1-expected1]'>
       <Function 'test_timedistance_v1[forward]'>
       <Function 'test_timedistance_v1[backward]'>
       <Function 'test_timedistance_v2[20011212-20011211-expected0]'>
       <Function 'test_timedistance_v2[20011211-20011212-expected1]'>
       <Function 'test_timedistance_v3[forward]'>
       <Function 'test_timedistance_v3[backward]'>
-    
-    ======= no tests ran in 0.12 seconds ========
+
+    ======================= no tests ran in 0.12 seconds =======================
 
 In ``test_timedistance_v3``, we used ``pytest.param`` to specify the test IDs
 together with the actual data, instead of listing them separately.
 
 A quick port of "testscenarios"
 ------------------------------------
 
-.. _`test scenarios`: http://pypi.python.org/pypi/testscenarios/
+.. _`test scenarios`: https://pypi.org/project/testscenarios/
 
 Here is a quick port to run tests configured with `test scenarios`_,
 an add-on from Robert Collins for the standard unittest framework. We
 only have to work a bit to construct the correct arguments for pytest's
 :py:func:`Metafunc.parametrize`::
 
     # content of test_scenarios.py
 
@@ -189,42 +189,42 @@ only have to work a bit to construct the
             assert isinstance(attribute, str)
 
         def test_demo2(self, attribute):
             assert isinstance(attribute, str)
 
 this is a fully self-contained example which you can run with::
 
     $ pytest test_scenarios.py
-    ======= test session starts ========
+    =========================== test session starts ============================
     platform linux -- Python 3.x.y, pytest-3.x.y, py-1.x.y, pluggy-0.x.y
     rootdir: $REGENDOC_TMPDIR, inifile:
     collected 4 items
-    
-    test_scenarios.py ....
-    
-    ======= 4 passed in 0.12 seconds ========
+
+    test_scenarios.py ....                                               [100%]
+
+    ========================= 4 passed in 0.12 seconds =========================
 
 If you just collect tests you'll also nicely see 'advanced' and 'basic' as variants for the test function::
 
 
     $ pytest --collect-only test_scenarios.py
-    ======= test session starts ========
+    =========================== test session starts ============================
     platform linux -- Python 3.x.y, pytest-3.x.y, py-1.x.y, pluggy-0.x.y
     rootdir: $REGENDOC_TMPDIR, inifile:
     collected 4 items
     <Module 'test_scenarios.py'>
       <Class 'TestSampleWithScenarios'>
         <Instance '()'>
           <Function 'test_demo1[basic]'>
           <Function 'test_demo2[basic]'>
           <Function 'test_demo1[advanced]'>
           <Function 'test_demo2[advanced]'>
-    
-    ======= no tests ran in 0.12 seconds ========
+
+    ======================= no tests ran in 0.12 seconds =======================
 
 Note that we told ``metafunc.parametrize()`` that your scenario values
 should be considered class-scoped.  With pytest-2.3 this leads to a
 resource-based ordering.
 
 Deferring the setup of parametrized resources
 ---------------------------------------------------
 
@@ -267,41 +267,41 @@ creates a database object for the actual
         elif request.param == "d2":
             return DB2()
         else:
             raise ValueError("invalid internal test config")
 
 Let's first see how it looks like at collection time::
 
     $ pytest test_backends.py --collect-only
-    ======= test session starts ========
+    =========================== test session starts ============================
     platform linux -- Python 3.x.y, pytest-3.x.y, py-1.x.y, pluggy-0.x.y
     rootdir: $REGENDOC_TMPDIR, inifile:
     collected 2 items
     <Module 'test_backends.py'>
       <Function 'test_db_initialized[d1]'>
       <Function 'test_db_initialized[d2]'>
-    
-    ======= no tests ran in 0.12 seconds ========
+
+    ======================= no tests ran in 0.12 seconds =======================
 
 And then when we run the test::
 
     $ pytest -q test_backends.py
-    .F
-    ======= FAILURES ========
-    _______ test_db_initialized[d2] ________
-    
+    .F                                                                   [100%]
+    ================================= FAILURES =================================
+    _________________________ test_db_initialized[d2] __________________________
+
     db = <conftest.DB2 object at 0xdeadbeef>
-    
+
         def test_db_initialized(db):
             # a dummy test
             if db.__class__.__name__ == "DB2":
     >           pytest.fail("deliberately failing for demo purposes")
     E           Failed: deliberately failing for demo purposes
-    
+
     test_backends.py:6: Failed
     1 failed, 1 passed in 0.12 seconds
 
 The first invocation with ``db == "DB1"`` passed while the second with ``db == "DB2"`` failed.  Our ``db`` fixture function has instantiated each of the DB values during the setup phase while the ``pytest_generate_tests`` generated two according calls to the ``test_db_initialized`` during the collection phase.
 
 .. regendoc:wipe
 
 Apply indirect on particular arguments
@@ -328,24 +328,24 @@ will be passed to respective fixture fun
     @pytest.mark.parametrize('x, y', [('a', 'b')], indirect=['x'])
     def test_indirect(x,y):
         assert x == 'aaa'
         assert y == 'b'
 
 The result of this test will be successful::
 
     $ pytest test_indirect_list.py --collect-only
-    ======= test session starts ========
+    =========================== test session starts ============================
     platform linux -- Python 3.x.y, pytest-3.x.y, py-1.x.y, pluggy-0.x.y
     rootdir: $REGENDOC_TMPDIR, inifile:
     collected 1 item
     <Module 'test_indirect_list.py'>
       <Function 'test_indirect[a-b]'>
-    
-    ======= no tests ran in 0.12 seconds ========
+
+    ======================= no tests ran in 0.12 seconds =======================
 
 .. regendoc:wipe
 
 Parametrizing test methods through per-class configuration
 --------------------------------------------------------------
 
 .. _`unittest parametrizer`: https://github.com/testing-cabal/unittest-ext/blob/master/params.py
 
@@ -376,26 +376,26 @@ parametrizer`_ but in a lot less code::
 
         def test_zerodivision(self, a, b):
             pytest.raises(ZeroDivisionError, "a/b")
 
 Our test generator looks up a class-level definition which specifies which
 argument sets to use for each test function.  Let's run it::
 
     $ pytest -q
-    F..
-    ======= FAILURES ========
-    _______ TestClass.test_equals[1-2] ________
-    
+    F..                                                                  [100%]
+    ================================= FAILURES =================================
+    ________________________ TestClass.test_equals[1-2] ________________________
+
     self = <test_parametrize.TestClass object at 0xdeadbeef>, a = 1, b = 2
-    
+
         def test_equals(self, a, b):
     >       assert a == b
     E       assert 1 == 2
-    
+
     test_parametrize.py:18: AssertionError
     1 failed, 2 passed in 0.12 seconds
 
 Indirect parametrization with multiple fixtures
 --------------------------------------------------------------
 
 Here is a stripped down real-life example of using parametrized
 testing for testing serialization of objects between different python
@@ -406,20 +406,18 @@ is to be run with different sets of argu
 * ``python2``: second interpreter, run to pickle-load an object from a file
 * ``obj``: object to be dumped/loaded
 
 .. literalinclude:: multipython.py
 
 Running it results in some skips if we don't have all the python interpreters installed and otherwise runs all combinations (5 interpreters times 5 interpreters times 3 objects to serialize/deserialize)::
 
    . $ pytest -rs -q multipython.py
-   sssssssssssssss.........sss.........sss.........
-   ======= short test summary info ========
-   SKIP [21] $REGENDOC_TMPDIR/CWD/multipython.py:24: 'python2.6' not found
-   27 passed, 21 skipped in 0.12 seconds
+   ...........................                                          [100%]
+   27 passed in 0.12 seconds
 
 Indirect parametrization of optional implementations/imports
 --------------------------------------------------------------------
 
 If you want to compare the outcomes of several implementations of a given
 API, you can write test functions that receive the already imported implementations
 and get skipped in case the implementation is not importable/available.  Let's
 say we have a "base" implementation and the other (possibly optimized ones)
@@ -455,28 +453,28 @@ And finally a little test module::
 
     def test_func1(basemod, optmod):
         assert round(basemod.func1(), 3) == round(optmod.func1(), 3)
 
 
 If you run this with reporting for skips enabled::
 
     $ pytest -rs test_module.py
-    ======= test session starts ========
+    =========================== test session starts ============================
     platform linux -- Python 3.x.y, pytest-3.x.y, py-1.x.y, pluggy-0.x.y
     rootdir: $REGENDOC_TMPDIR, inifile:
     collected 2 items
-    
-    test_module.py .s
-    ======= short test summary info ========
+
+    test_module.py .s                                                    [100%]
+    ========================= short test summary info ==========================
     SKIP [1] $REGENDOC_TMPDIR/conftest.py:11: could not import 'opt2'
-    
-    ======= 1 passed, 1 skipped in 0.12 seconds ========
 
-You'll see that we don't have a ``opt2`` module and thus the second test run
+    =================== 1 passed, 1 skipped in 0.12 seconds ====================
+
+You'll see that we don't have an ``opt2`` module and thus the second test run
 of our ``test_func1`` was skipped.  A few notes:
 
 - the fixture functions in the ``conftest.py`` file are "session-scoped" because we
   don't need to import more than once
 
 - if you have multiple test functions and a skipped import, you will see
   the ``[1]`` count increasing in the report
 
@@ -501,20 +499,20 @@ For example::
                      marks=pytest.mark.basic,
                      id='basic_2+4'),
         pytest.param('6*9', 42,
                      marks=[pytest.mark.basic, pytest.mark.xfail],
                      id='basic_6*9'),
     ])
     def test_eval(test_input, expected):
         assert eval(test_input) == expected
-    
+
 In this example, we have 4 parametrized tests. Except for the first test,
 we mark the rest three parametrized tests with the custom marker ``basic``,
-and for the fourth test we also use the built-in mark ``xfail`` to indicate this 
+and for the fourth test we also use the built-in mark ``xfail`` to indicate this
 test is expected to fail. For explicitness, we set test ids for some tests.
 
 Then run ``pytest`` with verbose mode and with only the ``basic`` marker::
 
     pytest -v -m basic
     ============================================ test session starts =============================================
     platform linux -- Python 3.x.y, pytest-3.x.y, py-1.x.y, pluggy-0.x.y
     rootdir: $REGENDOC_TMPDIR, inifile:
--- a/third_party/python/pytest/doc/en/example/py2py3/conftest.py
+++ b/third_party/python/pytest/doc/en/example/py2py3/conftest.py
@@ -1,16 +1,16 @@
 import sys
 import pytest
 
 py3 = sys.version_info[0] >= 3
 
+
 class DummyCollector(pytest.collect.File):
+
     def collect(self):
         return []
 
+
 def pytest_pycollect_makemodule(path, parent):
     bn = path.basename
     if "py3" in bn and not py3 or ("py2" in bn and py3):
         return DummyCollector(path, parent=parent)
-
-
-
--- a/third_party/python/pytest/doc/en/example/py2py3/test_py2.py
+++ b/third_party/python/pytest/doc/en/example/py2py3/test_py2.py
@@ -1,7 +1,6 @@
 
 def test_exception_syntax():
     try:
         0/0
     except ZeroDivisionError, e:
         pass
-
--- a/third_party/python/pytest/doc/en/example/py2py3/test_py3.py
+++ b/third_party/python/pytest/doc/en/example/py2py3/test_py3.py
@@ -1,7 +1,5 @@
-
 def test_exception_syntax():
     try:
-        0/0
+        0 / 0
     except ZeroDivisionError as e:
         pass
-
--- a/third_party/python/pytest/doc/en/example/pythoncollection.py
+++ b/third_party/python/pytest/doc/en/example/pythoncollection.py
@@ -1,11 +1,15 @@
-
 # run this with $ pytest --collect-only test_collectonly.py
 #
+
+
 def test_function():
     pass
 
+
 class TestClass(object):
+
     def test_method(self):
         pass
+
     def test_anothermethod(self):
         pass
--- a/third_party/python/pytest/doc/en/example/pythoncollection.rst
+++ b/third_party/python/pytest/doc/en/example/pythoncollection.rst
@@ -34,45 +34,53 @@ you will see that ``pytest`` only collec
     tests/example/test_example_01.py .
     tests/example/test_example_02.py .
     tests/example/test_example_03.py .
     tests/foobar/test_foobar_01.py .
     tests/foobar/test_foobar_02.py .
 
     ======= 5 passed in 0.02 seconds =======
 
+Deselect tests during test collection
+-------------------------------------
+
+Tests can individually be deselected during collection by passing the ``--deselect=item`` option.
+For example, say ``tests/foobar/test_foobar_01.py`` contains ``test_a`` and ``test_b``.
+You can run all of the tests within ``tests/`` *except* for ``tests/foobar/test_foobar_01.py::test_a``
+by invoking ``pytest`` with ``--deselect tests/foobar/test_foobar_01.py::test_a``.
+``pytest`` allows multiple ``--deselect`` options.
 
 Keeping duplicate paths specified from command line
 ----------------------------------------------------
 
 Default behavior of ``pytest`` is to ignore duplicate paths specified from the command line.
 Example::
 
-    py.test path_a path_a
+    pytest path_a path_a
 
     ...
     collected 1 item
     ...
 
 Just collect tests once.
 
 To collect duplicate tests, use the ``--keep-duplicates`` option on the cli.
 Example::
 
-    py.test --keep-duplicates path_a path_a
+    pytest --keep-duplicates path_a path_a
 
     ...
     collected 2 items
     ...
 
 As the collector just works on directories, if you specify twice a single test file, ``pytest`` will
 still collect it twice, no matter if the ``--keep-duplicates`` is not specified.
 Example::
 
-    py.test test_a.py test_a.py
+    pytest test_a.py test_a.py
 
     ...
     collected 2 items
     ...
 
 
 Changing directory recursion
 -----------------------------------------------------
@@ -111,27 +119,27 @@ that match ``*_check``.  For example, if
         def simple_check(self):
             pass
         def complex_check(self):
             pass
 
 then the test collection looks like this::
 
     $ pytest --collect-only
-    ======= test session starts ========
+    =========================== test session starts ============================
     platform linux -- Python 3.x.y, pytest-3.x.y, py-1.x.y, pluggy-0.x.y
     rootdir: $REGENDOC_TMPDIR, inifile: pytest.ini
     collected 2 items
     <Module 'check_myapp.py'>
       <Class 'CheckMyApp'>
         <Instance '()'>
           <Function 'simple_check'>
           <Function 'complex_check'>
-    
-    ======= no tests ran in 0.12 seconds ========
+
+    ======================= no tests ran in 0.12 seconds =======================
 
 .. note::
 
    the ``python_functions`` and ``python_classes`` options has no effect
    for ``unittest.TestCase`` test discovery because pytest delegates
    detection of test case methods to unittest code.
 
 Interpreting cmdline arguments as Python packages
@@ -157,28 +165,28 @@ if NAME exists as an importable package/
 treat it as a filesystem path.
 
 Finding out what is collected
 -----------------------------------------------
 
 You can always peek at the collection tree without running tests like this::
 
     . $ pytest --collect-only pythoncollection.py
-    ======= test session starts ========
+    =========================== test session starts ============================
     platform linux -- Python 3.x.y, pytest-3.x.y, py-1.x.y, pluggy-0.x.y
     rootdir: $REGENDOC_TMPDIR, inifile: pytest.ini
     collected 3 items
     <Module 'CWD/pythoncollection.py'>
       <Function 'test_function'>
       <Class 'TestClass'>
         <Instance '()'>
           <Function 'test_method'>
           <Function 'test_anothermethod'>
-    
-    ======= no tests ran in 0.12 seconds ========
+
+    ======================= no tests ran in 0.12 seconds =======================
 
 .. _customizing-test-collection:
 
 Customizing test collection
 ---------------------------
 
 .. regendoc:wipe
 
@@ -226,14 +234,14 @@ leave out the ``setup.py`` file::
       <Function 'test_only_on_python2'>
 
     ====== no tests ran in 0.04 seconds ======
 
 If you run with a Python 3 interpreter both the one test and the ``setup.py``
 file will be left out::
 
     $ pytest --collect-only
-    ======= test session starts ========
+    =========================== test session starts ============================
     platform linux -- Python 3.x.y, pytest-3.x.y, py-1.x.y, pluggy-0.x.y
     rootdir: $REGENDOC_TMPDIR, inifile: pytest.ini
     collected 0 items
-    
-    ======= no tests ran in 0.12 seconds ========
+
+    ======================= no tests ran in 0.12 seconds =======================
--- a/third_party/python/pytest/doc/en/example/reportingdemo.rst
+++ b/third_party/python/pytest/doc/en/example/reportingdemo.rst
@@ -5,594 +5,629 @@ Demo of Python failure reports with pyte
 ==================================================
 
 Here is a nice run of several tens of failures
 and how ``pytest`` presents things (unfortunately
 not showing the nice colors here in the HTML that you
 get on the terminal - we are working on that)::
 
     assertion $ pytest failure_demo.py
-    ======= test session starts ========
+    =========================== test session starts ============================
     platform linux -- Python 3.x.y, pytest-3.x.y, py-1.x.y, pluggy-0.x.y
     rootdir: $REGENDOC_TMPDIR/assertion, inifile:
     collected 42 items
-    
-    failure_demo.py FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF
-    
-    ======= FAILURES ========
-    _______ test_generative[0] ________
-    
+
+    failure_demo.py FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF           [100%]
+
+    ================================= FAILURES =================================
+    ____________________________ test_generative[0] ____________________________
+
     param1 = 3, param2 = 6
-    
+
         def test_generative(param1, param2):
     >       assert param1 * 2 < param2
     E       assert (3 * 2) < 6
-    
-    failure_demo.py:16: AssertionError
-    _______ TestFailing.test_simple ________
-    
+
+    failure_demo.py:19: AssertionError
+    _________________________ TestFailing.test_simple __________________________
+
     self = <failure_demo.TestFailing object at 0xdeadbeef>
-    
+
         def test_simple(self):
+
             def f():
                 return 42
+
             def g():
                 return 43
-        
+
     >       assert f() == g()
     E       assert 42 == 43
     E        +  where 42 = <function TestFailing.test_simple.<locals>.f at 0xdeadbeef>()
     E        +  and   43 = <function TestFailing.test_simple.<locals>.g at 0xdeadbeef>()
-    
-    failure_demo.py:29: AssertionError
-    _______ TestFailing.test_simple_multiline ________
-    
+
+    failure_demo.py:37: AssertionError
+    ____________________ TestFailing.test_simple_multiline _____________________
+
     self = <failure_demo.TestFailing object at 0xdeadbeef>
-    
+
         def test_simple_multiline(self):
-            otherfunc_multi(
-                      42,
-    >                 6*9)
-    
-    failure_demo.py:34: 
-    _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
-    
+    >       otherfunc_multi(42, 6 * 9)
+
+    failure_demo.py:40:
+    _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
+
     a = 42, b = 54
-    
-        def otherfunc_multi(a,b):
-    >       assert (a ==
-                    b)
+
+        def otherfunc_multi(a, b):
+    >       assert a == b
     E       assert 42 == 54
-    
-    failure_demo.py:12: AssertionError
-    _______ TestFailing.test_not ________
-    
+
+    failure_demo.py:15: AssertionError
+    ___________________________ TestFailing.test_not ___________________________
+
     self = <failure_demo.TestFailing object at 0xdeadbeef>
-    
+
         def test_not(self):
+
             def f():
                 return 42
+
     >       assert not f()
     E       assert not 42
     E        +  where 42 = <function TestFailing.test_not.<locals>.f at 0xdeadbeef>()
-    
-    failure_demo.py:39: AssertionError
-    _______ TestSpecialisedExplanations.test_eq_text ________
-    
+
+    failure_demo.py:47: AssertionError
+    _________________ TestSpecialisedExplanations.test_eq_text _________________
+
     self = <failure_demo.TestSpecialisedExplanations object at 0xdeadbeef>
-    
+
         def test_eq_text(self):
-    >       assert 'spam' == 'eggs'
+    >       assert "spam" == "eggs"
     E       AssertionError: assert 'spam' == 'eggs'
     E         - spam
     E         + eggs
-    
-    failure_demo.py:43: AssertionError
-    _______ TestSpecialisedExplanations.test_eq_similar_text ________
-    
+
+    failure_demo.py:53: AssertionError
+    _____________ TestSpecialisedExplanations.test_eq_similar_text _____________
+
     self = <failure_demo.TestSpecialisedExplanations object at 0xdeadbeef>
-    
+
         def test_eq_similar_text(self):
-    >       assert 'foo 1 bar' == 'foo 2 bar'
+    >       assert "foo 1 bar" == "foo 2 bar"
     E       AssertionError: assert 'foo 1 bar' == 'foo 2 bar'
     E         - foo 1 bar
     E         ?     ^
     E         + foo 2 bar
     E         ?     ^
-    
-    failure_demo.py:46: AssertionError
-    _______ TestSpecialisedExplanations.test_eq_multiline_text ________
-    
+
+    failure_demo.py:56: AssertionError
+    ____________ TestSpecialisedExplanations.test_eq_multiline_text ____________
+
     self = <failure_demo.TestSpecialisedExplanations object at 0xdeadbeef>
-    
+
         def test_eq_multiline_text(self):
-    >       assert 'foo\nspam\nbar' == 'foo\neggs\nbar'
+    >       assert "foo\nspam\nbar" == "foo\neggs\nbar"
     E       AssertionError: assert 'foo\nspam\nbar' == 'foo\neggs\nbar'
     E           foo
     E         - spam
     E         + eggs
     E           bar
-    
-    failure_demo.py:49: AssertionError
-    _______ TestSpecialisedExplanations.test_eq_long_text ________
-    
+
+    failure_demo.py:59: AssertionError
+    ______________ TestSpecialisedExplanations.test_eq_long_text _______________
+
     self = <failure_demo.TestSpecialisedExplanations object at 0xdeadbeef>
-    
+
         def test_eq_long_text(self):
-            a = '1'*100 + 'a' + '2'*100
-            b = '1'*100 + 'b' + '2'*100
+            a = "1" * 100 + "a" + "2" * 100
+            b = "1" * 100 + "b" + "2" * 100
     >       assert a == b
     E       AssertionError: assert '111111111111...2222222222222' == '1111111111111...2222222222222'
     E         Skipping 90 identical leading characters in diff, use -v to show
     E         Skipping 91 identical trailing characters in diff, use -v to show
     E         - 1111111111a222222222
     E         ?           ^
     E         + 1111111111b222222222
     E         ?           ^
-    
-    failure_demo.py:54: AssertionError
-    _______ TestSpecialisedExplanations.test_eq_long_text_multiline ________
-    
+
+    failure_demo.py:64: AssertionError
+    _________ TestSpecialisedExplanations.test_eq_long_text_multiline __________
+
     self = <failure_demo.TestSpecialisedExplanations object at 0xdeadbeef>
-    
+
         def test_eq_long_text_multiline(self):
-            a = '1\n'*100 + 'a' + '2\n'*100
-            b = '1\n'*100 + 'b' + '2\n'*100
+            a = "1\n" * 100 + "a" + "2\n" * 100
+            b = "1\n" * 100 + "b" + "2\n" * 100
     >       assert a == b
     E       AssertionError: assert '1\n1\n1\n1\n...n2\n2\n2\n2\n' == '1\n1\n1\n1\n1...n2\n2\n2\n2\n'
     E         Skipping 190 identical leading characters in diff, use -v to show
     E         Skipping 191 identical trailing characters in diff, use -v to show
     E           1
     E           1
     E           1
     E           1
     E           1...
-    E         
+    E
     E         ...Full output truncated (7 lines hidden), use '-vv' to show
-    
-    failure_demo.py:59: AssertionError
-    _______ TestSpecialisedExplanations.test_eq_list ________
-    
+
+    failure_demo.py:69: AssertionError
+    _________________ TestSpecialisedExplanations.test_eq_list _________________
+
     self = <failure_demo.TestSpecialisedExplanations object at 0xdeadbeef>
-    
+
         def test_eq_list(self):
     >       assert [0, 1, 2] == [0, 1, 3]
     E       assert [0, 1, 2] == [0, 1, 3]
     E         At index 2 diff: 2 != 3
     E         Use -v to get the full diff
-    
-    failure_demo.py:62: AssertionError
-    _______ TestSpecialisedExplanations.test_eq_list_long ________
-    
+
+    failure_demo.py:72: AssertionError
+    ______________ TestSpecialisedExplanations.test_eq_list_long _______________
+
     self = <failure_demo.TestSpecialisedExplanations object at 0xdeadbeef>
-    
+
         def test_eq_list_long(self):
-            a = [0]*100 + [1] + [3]*100
-            b = [0]*100 + [2] + [3]*100
+            a = [0] * 100 + [1] + [3] * 100
+            b = [0] * 100 + [2] + [3] * 100
     >       assert a == b
     E       assert [0, 0, 0, 0, 0, 0, ...] == [0, 0, 0, 0, 0, 0, ...]
     E         At index 100 diff: 1 != 2
     E         Use -v to get the full diff
-    
-    failure_demo.py:67: AssertionError
-    _______ TestSpecialisedExplanations.test_eq_dict ________
-    
+
+    failure_demo.py:77: AssertionError
+    _________________ TestSpecialisedExplanations.test_eq_dict _________________
+
     self = <failure_demo.TestSpecialisedExplanations object at 0xdeadbeef>
-    
+
         def test_eq_dict(self):
-    >       assert {'a': 0, 'b': 1, 'c': 0} == {'a': 0, 'b': 2, 'd': 0}
+    >       assert {"a": 0, "b": 1, "c": 0} == {"a": 0, "b": 2, "d": 0}
     E       AssertionError: assert {'a': 0, 'b': 1, 'c': 0} == {'a': 0, 'b': 2, 'd': 0}
     E         Omitting 1 identical items, use -vv to show
     E         Differing items:
     E         {'b': 1} != {'b': 2}
     E         Left contains more items:
     E         {'c': 0}
     E         Right contains more items:
     E         {'d': 0}...
-    E         
+    E
     E         ...Full output truncated (2 lines hidden), use '-vv' to show
-    
-    failure_demo.py:70: AssertionError
-    _______ TestSpecialisedExplanations.test_eq_set ________
-    
+
+    failure_demo.py:80: AssertionError
+    _________________ TestSpecialisedExplanations.test_eq_set __________________
+
     self = <failure_demo.TestSpecialisedExplanations object at 0xdeadbeef>
-    
+
         def test_eq_set(self):
-    >       assert set([0, 10, 11, 12]) == set([0, 20, 21])
+    >       assert {0, 10, 11, 12} == {0, 20, 21}
     E       AssertionError: assert {0, 10, 11, 12} == {0, 20, 21}
     E         Extra items in the left set:
     E         10
     E         11
     E         12
     E         Extra items in the right set:
     E         20
     E         21...
-    E         
+    E
     E         ...Full output truncated (2 lines hidden), use '-vv' to show
-    
-    failure_demo.py:73: AssertionError
-    _______ TestSpecialisedExplanations.test_eq_longer_list ________
-    
+
+    failure_demo.py:83: AssertionError
+    _____________ TestSpecialisedExplanations.test_eq_longer_list ______________
+
     self = <failure_demo.TestSpecialisedExplanations object at 0xdeadbeef>
-    
+
         def test_eq_longer_list(self):
-    >       assert [1,2] == [1,2,3]
+    >       assert [1, 2] == [1, 2, 3]
     E       assert [1, 2] == [1, 2, 3]
     E         Right contains more items, first extra item: 3
     E         Use -v to get the full diff
-    
-    failure_demo.py:76: AssertionError
-    _______ TestSpecialisedExplanations.test_in_list ________
-    
+
+    failure_demo.py:86: AssertionError
+    _________________ TestSpecialisedExplanations.test_in_list _________________
+
     self = <failure_demo.TestSpecialisedExplanations object at 0xdeadbeef>
-    
+
         def test_in_list(self):
     >       assert 1 in [0, 2, 3, 4, 5]
     E       assert 1 in [0, 2, 3, 4, 5]
-    
-    failure_demo.py:79: AssertionError
-    _______ TestSpecialisedExplanations.test_not_in_text_multiline ________
-    
+
+    failure_demo.py:89: AssertionError
+    __________ TestSpecialisedExplanations.test_not_in_text_multiline __________
+
     self = <failure_demo.TestSpecialisedExplanations object at 0xdeadbeef>
-    
+
         def test_not_in_text_multiline(self):
-            text = 'some multiline\ntext\nwhich\nincludes foo\nand a\ntail'
-    >       assert 'foo' not in text
+            text = "some multiline\ntext\nwhich\nincludes foo\nand a\ntail"
+    >       assert "foo" not in text
     E       AssertionError: assert 'foo' not in 'some multiline\ntext\nw...ncludes foo\nand a\ntail'
     E         'foo' is contained here:
     E           some multiline
     E           text
     E           which
     E           includes foo
     E         ?          +++
     E           and a...
-    E         
+    E
     E         ...Full output truncated (2 lines hidden), use '-vv' to show
-    
-    failure_demo.py:83: AssertionError
-    _______ TestSpecialisedExplanations.test_not_in_text_single ________
-    
+
+    failure_demo.py:93: AssertionError
+    ___________ TestSpecialisedExplanations.test_not_in_text_single ____________
+
     self = <failure_demo.TestSpecialisedExplanations object at 0xdeadbeef>
-    
+
         def test_not_in_text_single(self):
-            text = 'single foo line'
-    >       assert 'foo' not in text
+            text = "single foo line"
+    >       assert "foo" not in text
     E       AssertionError: assert 'foo' not in 'single foo line'
     E         'foo' is contained here:
     E           single foo line
     E         ?        +++
-    
-    failure_demo.py:87: AssertionError
-    _______ TestSpecialisedExplanations.test_not_in_text_single_long ________
-    
+
+    failure_demo.py:97: AssertionError
+    _________ TestSpecialisedExplanations.test_not_in_text_single_long _________
+
     self = <failure_demo.TestSpecialisedExplanations object at 0xdeadbeef>
-    
+
         def test_not_in_text_single_long(self):
-            text = 'head ' * 50 + 'foo ' + 'tail ' * 20
-    >       assert 'foo' not in text
+            text = "head " * 50 + "foo " + "tail " * 20
+    >       assert "foo" not in text
     E       AssertionError: assert 'foo' not in 'head head head head hea...ail tail tail tail tail '
     E         'foo' is contained here:
-    E           head head foo tail tail tail tail tail tail tail tail tail tail tail tail tail tail tail tail tail tail tail tail 
+    E           head head foo tail tail tail tail tail tail tail tail tail tail tail tail tail tail tail tail tail tail tail tail
     E         ?           +++
-    
-    failure_demo.py:91: AssertionError
+
+    failure_demo.py:101: AssertionError
     ______ TestSpecialisedExplanations.test_not_in_text_single_long_term _______
-    
+
     self = <failure_demo.TestSpecialisedExplanations object at 0xdeadbeef>
-    
+
         def test_not_in_text_single_long_term(self):
-            text = 'head ' * 50 + 'f'*70 + 'tail ' * 20
-    >       assert 'f'*70 not in text
+            text = "head " * 50 + "f" * 70 + "tail " * 20
+    >       assert "f" * 70 not in text
     E       AssertionError: assert 'fffffffffff...ffffffffffff' not in 'head head he...l tail tail '
     E         'ffffffffffffffffff...fffffffffffffffffff' is contained here:
-    E           head head fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffftail tail tail tail tail tail tail tail tail tail tail tail tail tail tail tail tail tail tail tail 
+    E           head head fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffftail tail tail tail tail tail tail tail tail tail tail tail tail tail tail tail tail tail tail tail
     E         ?           ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
-    
-    failure_demo.py:95: AssertionError
-    _______ test_attribute ________
-    
+
+    failure_demo.py:105: AssertionError
+    ______________________________ test_attribute ______________________________
+
         def test_attribute():
+
             class Foo(object):
                 b = 1
+
             i = Foo()
     >       assert i.b == 2
     E       assert 1 == 2
     E        +  where 1 = <failure_demo.test_attribute.<locals>.Foo object at 0xdeadbeef>.b
-    
-    failure_demo.py:102: AssertionError
-    _______ test_attribute_instance ________
-    
+
+    failure_demo.py:114: AssertionError
+    _________________________ test_attribute_instance __________________________
+
         def test_attribute_instance():
+
             class Foo(object):
                 b = 1
+
     >       assert Foo().b == 2
     E       AssertionError: assert 1 == 2
     E        +  where 1 = <failure_demo.test_attribute_instance.<locals>.Foo object at 0xdeadbeef>.b
     E        +    where <failure_demo.test_attribute_instance.<locals>.Foo object at 0xdeadbeef> = <class 'failure_demo.test_attribute_instance.<locals>.Foo'>()
-    
-    failure_demo.py:108: AssertionError
-    _______ test_attribute_failure ________
-    
+
+    failure_demo.py:122: AssertionError
+    __________________________ test_attribute_failure __________________________
+
         def test_attribute_failure():
+
             class Foo(object):
+
                 def _get_b(self):
-                    raise Exception('Failed to get attrib')
+                    raise Exception("Failed to get attrib")
+
                 b = property(_get_b)
+
             i = Foo()
     >       assert i.b == 2
-    
-    failure_demo.py:117: 
-    _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
-    
+
+    failure_demo.py:135:
+    _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
+
     self = <failure_demo.test_attribute_failure.<locals>.Foo object at 0xdeadbeef>
-    
+
         def _get_b(self):
-    >       raise Exception('Failed to get attrib')
+    >       raise Exception("Failed to get attrib")
     E       Exception: Failed to get attrib
-    
-    failure_demo.py:114: Exception
-    _______ test_attribute_multiple ________
-    
+
+    failure_demo.py:130: Exception
+    _________________________ test_attribute_multiple __________________________
+
         def test_attribute_multiple():
+
             class Foo(object):
                 b = 1
+
             class Bar(object):
                 b = 2
+
     >       assert Foo().b == Bar().b
     E       AssertionError: assert 1 == 2
     E        +  where 1 = <failure_demo.test_attribute_multiple.<locals>.Foo object at 0xdeadbeef>.b
     E        +    where <failure_demo.test_attribute_multiple.<locals>.Foo object at 0xdeadbeef> = <class 'failure_demo.test_attribute_multiple.<locals>.Foo'>()
     E        +  and   2 = <failure_demo.test_attribute_multiple.<locals>.Bar object at 0xdeadbeef>.b
     E        +    where <failure_demo.test_attribute_multiple.<locals>.Bar object at 0xdeadbeef> = <class 'failure_demo.test_attribute_multiple.<locals>.Bar'>()
-    
-    failure_demo.py:125: AssertionError
-    _______ TestRaises.test_raises ________
-    
+
+    failure_demo.py:146: AssertionError
+    __________________________ TestRaises.test_raises __________________________
+
     self = <failure_demo.TestRaises object at 0xdeadbeef>
-    
+
         def test_raises(self):
-            s = 'qwe'
+            s = "qwe"  # NOQA
     >       raises(TypeError, "int(s)")
-    
-    failure_demo.py:134: 
-    _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
-    
+
+    failure_demo.py:157:
+    _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
+
     >   int(s)
     E   ValueError: invalid literal for int() with base 10: 'qwe'
-    
-    <0-codegen $PYTHON_PREFIX/lib/python3.5/site-packages/_pytest/python_api.py:580>:1: ValueError
-    _______ TestRaises.test_raises_doesnt ________
-    
+
+    <0-codegen $PYTHON_PREFIX/lib/python3.5/site-packages/_pytest/python_api.py:634>:1: ValueError
+    ______________________ TestRaises.test_raises_doesnt _______________________
+
     self = <failure_demo.TestRaises object at 0xdeadbeef>
-    
+
         def test_raises_doesnt(self):
     >       raises(IOError, "int('3')")
     E       Failed: DID NOT RAISE <class 'OSError'>
-    
-    failure_demo.py:137: Failed
-    _______ TestRaises.test_raise ________
-    
+
+    failure_demo.py:160: Failed
+    __________________________ TestRaises.test_raise ___________________________
+
     self = <failure_demo.TestRaises object at 0xdeadbeef>
-    
+
         def test_raise(self):
     >       raise ValueError("demo error")
     E       ValueError: demo error
-    
-    failure_demo.py:140: ValueError
-    _______ TestRaises.test_tupleerror ________
-    
+
+    failure_demo.py:163: ValueError
+    ________________________ TestRaises.test_tupleerror ________________________
+
     self = <failure_demo.TestRaises object at 0xdeadbeef>
-    
+
         def test_tupleerror(self):
-    >       a,b = [1]
+    >       a, b = [1]  # NOQA
     E       ValueError: not enough values to unpack (expected 2, got 1)
-    
-    failure_demo.py:143: ValueError
+
+    failure_demo.py:166: ValueError
     ______ TestRaises.test_reinterpret_fails_with_print_for_the_fun_of_it ______
-    
+
     self = <failure_demo.TestRaises object at 0xdeadbeef>
-    
+
         def test_reinterpret_fails_with_print_for_the_fun_of_it(self):
-            l = [1,2,3]
-            print ("l is %r" % l)
-    >       a,b = l.pop()
+            items = [1, 2, 3]
+            print("items is %r" % items)
+    >       a, b = items.pop()
     E       TypeError: 'int' object is not iterable
-    
-    failure_demo.py:148: TypeError
+
+    failure_demo.py:171: TypeError
     --------------------------- Captured stdout call ---------------------------
-    l is [1, 2, 3]
-    _______ TestRaises.test_some_error ________
-    
+    items is [1, 2, 3]
+    ________________________ TestRaises.test_some_error ________________________
+
     self = <failure_demo.TestRaises object at 0xdeadbeef>
-    
+
         def test_some_error(self):
-    >       if namenotexi:
+    >       if namenotexi:  # NOQA
     E       NameError: name 'namenotexi' is not defined
-    
-    failure_demo.py:151: NameError
-    _______ test_dynamic_compile_shows_nicely ________
-    
+
+    failure_demo.py:174: NameError
+    ____________________ test_dynamic_compile_shows_nicely _____________________
+
         def test_dynamic_compile_shows_nicely():
-            src = 'def foo():\n assert 1 == 0\n'
-            name = 'abc-123'
-            module = py.std.imp.new_module(name)
-            code = _pytest._code.compile(src, name, 'exec')
+            import imp
+            import sys
+
+            src = "def foo():\n assert 1 == 0\n"
+            name = "abc-123"
+            module = imp.new_module(name)
+            code = _pytest._code.compile(src, name, "exec")
             py.builtin.exec_(code, module.__dict__)
-            py.std.sys.modules[name] = module
+            sys.modules[name] = module
     >       module.foo()
-    
-    failure_demo.py:166: 
-    _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
-    
+
+    failure_demo.py:192:
+    _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
+
         def foo():
     >    assert 1 == 0
     E    AssertionError
-    
-    <2-codegen 'abc-123' $REGENDOC_TMPDIR/assertion/failure_demo.py:163>:2: AssertionError
-    _______ TestMoreErrors.test_complex_error ________
-    
+
+    <2-codegen 'abc-123' $REGENDOC_TMPDIR/assertion/failure_demo.py:189>:2: AssertionError
+    ____________________ TestMoreErrors.test_complex_error _____________________
+
     self = <failure_demo.TestMoreErrors object at 0xdeadbeef>
-    
+
         def test_complex_error(self):
+
             def f():
                 return 44
+
             def g():
                 return 43
+
     >       somefunc(f(), g())
-    
-    failure_demo.py:176: 
-    _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
-    failure_demo.py:9: in somefunc
-        otherfunc(x,y)
-    _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
-    
+
+    failure_demo.py:205:
+    _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
+    failure_demo.py:11: in somefunc
+        otherfunc(x, y)
+    _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
+
     a = 44, b = 43
-    
-        def otherfunc(a,b):
-    >       assert a==b
+
+        def otherfunc(a, b):
+    >       assert a == b
     E       assert 44 == 43
-    
-    failure_demo.py:6: AssertionError
-    _______ TestMoreErrors.test_z1_unpack_error ________
-    
+
+    failure_demo.py:7: AssertionError
+    ___________________ TestMoreErrors.test_z1_unpack_error ____________________
+
     self = <failure_demo.TestMoreErrors object at 0xdeadbeef>
-    
+
         def test_z1_unpack_error(self):
-            l = []
-    >       a,b  = l
+            items = []
+    >       a, b = items
     E       ValueError: not enough values to unpack (expected 2, got 0)
-    
-    failure_demo.py:180: ValueError
-    _______ TestMoreErrors.test_z2_type_error ________
-    
+
+    failure_demo.py:209: ValueError
+    ____________________ TestMoreErrors.test_z2_type_error _____________________
+
     self = <failure_demo.TestMoreErrors object at 0xdeadbeef>
-    
+
         def test_z2_type_error(self):
-            l = 3
-    >       a,b  = l
+            items = 3
+    >       a, b = items
     E       TypeError: 'int' object is not iterable
-    
-    failure_demo.py:184: TypeError
-    _______ TestMoreErrors.test_startswith ________
-    
+
+    failure_demo.py:213: TypeError
+    ______________________ TestMoreErrors.test_startswith ______________________
+
     self = <failure_demo.TestMoreErrors object at 0xdeadbeef>
-    
+
         def test_startswith(self):
             s = "123"
             g = "456"
     >       assert s.startswith(g)
     E       AssertionError: assert False
     E        +  where False = <built-in method startswith of str object at 0xdeadbeef>('456')
     E        +    where <built-in method startswith of str object at 0xdeadbeef> = '123'.startswith
-    
-    failure_demo.py:189: AssertionError
-    _______ TestMoreErrors.test_startswith_nested ________
-    
+
+    failure_demo.py:218: AssertionError
+    __________________ TestMoreErrors.test_startswith_nested ___________________
+
     self = <failure_demo.TestMoreErrors object at 0xdeadbeef>
-    
+
         def test_startswith_nested(self):
+
             def f():
                 return "123"
+
             def g():
                 return "456"
+
     >       assert f().startswith(g())
     E       AssertionError: assert False
     E        +  where False = <built-in method startswith of str object at 0xdeadbeef>('456')
     E        +    where <built-in method startswith of str object at 0xdeadbeef> = '123'.startswith
     E        +      where '123' = <function TestMoreErrors.test_startswith_nested.<locals>.f at 0xdeadbeef>()
     E        +    and   '456' = <function TestMoreErrors.test_startswith_nested.<locals>.g at 0xdeadbeef>()
-    
-    failure_demo.py:196: AssertionError
-    _______ TestMoreErrors.test_global_func ________
-    
+
+    failure_demo.py:228: AssertionError
+    _____________________ TestMoreErrors.test_global_func ______________________
+
     self = <failure_demo.TestMoreErrors object at 0xdeadbeef>
-    
+
         def test_global_func(self):
     >       assert isinstance(globf(42), float)
     E       assert False
     E        +  where False = isinstance(43, float)
     E        +    where 43 = globf(42)
-    
-    failure_demo.py:199: AssertionError
-    _______ TestMoreErrors.test_instance ________
-    
+
+    failure_demo.py:231: AssertionError
+    _______________________ TestMoreErrors.test_instance _______________________
+
     self = <failure_demo.TestMoreErrors object at 0xdeadbeef>
-    
+
         def test_instance(self):
-            self.x = 6*7
+            self.x = 6 * 7
     >       assert self.x != 42
     E       assert 42 != 42
     E        +  where 42 = <failure_demo.TestMoreErrors object at 0xdeadbeef>.x
-    
-    failure_demo.py:203: AssertionError
-    _______ TestMoreErrors.test_compare ________
-    
+
+    failure_demo.py:235: AssertionError
+    _______________________ TestMoreErrors.test_compare ________________________
+
     self = <failure_demo.TestMoreErrors object at 0xdeadbeef>
-    
+
         def test_compare(self):
     >       assert globf(10) < 5
     E       assert 11 < 5
     E        +  where 11 = globf(10)
-    
-    failure_demo.py:206: AssertionError
-    _______ TestMoreErrors.test_try_finally ________
-    
+
+    failure_demo.py:238: AssertionError
+    _____________________ TestMoreErrors.test_try_finally ______________________
+
     self = <failure_demo.TestMoreErrors object at 0xdeadbeef>
-    
+
         def test_try_finally(self):
             x = 1
             try:
     >           assert x == 0
     E           assert 1 == 0
-    
-    failure_demo.py:211: AssertionError
-    _______ TestCustomAssertMsg.test_single_line ________
-    
+
+    failure_demo.py:243: AssertionError
+    ___________________ TestCustomAssertMsg.test_single_line ___________________
+
     self = <failure_demo.TestCustomAssertMsg object at 0xdeadbeef>
-    
+
         def test_single_line(self):
+
             class A(object):
                 a = 1
+
             b = 2
     >       assert A.a == b, "A.a appears not to be b"
     E       AssertionError: A.a appears not to be b
     E       assert 1 == 2
     E        +  where 1 = <class 'failure_demo.TestCustomAssertMsg.test_single_line.<locals>.A'>.a
-    
-    failure_demo.py:222: AssertionError
-    _______ TestCustomAssertMsg.test_multiline ________
-    
+
+    failure_demo.py:256: AssertionError
+    ____________________ TestCustomAssertMsg.test_multiline ____________________
+
     self = <failure_demo.TestCustomAssertMsg object at 0xdeadbeef>
-    
+
         def test_multiline(self):
+
             class A(object):
                 a = 1
+
             b = 2
-    >       assert A.a == b, "A.a appears not to be b\n" \
-                "or does not appear to be b\none of those"
+    >       assert (
+                A.a == b
+            ), "A.a appears not to be b\n" "or does not appear to be b\none of those"
     E       AssertionError: A.a appears not to be b
     E         or does not appear to be b
     E         one of those
     E       assert 1 == 2
     E        +  where 1 = <class 'failure_demo.TestCustomAssertMsg.test_multiline.<locals>.A'>.a
-    
-    failure_demo.py:228: AssertionError
-    _______ TestCustomAssertMsg.test_custom_repr ________
-    
+
+    failure_demo.py:264: AssertionError
+    ___________________ TestCustomAssertMsg.test_custom_repr ___________________
+
     self = <failure_demo.TestCustomAssertMsg object at 0xdeadbeef>
-    
+
         def test_custom_repr(self):
+
             class JSON(object):
                 a = 1
+
                 def __repr__(self):
                     return "This is JSON\n{\n  'foo': 'bar'\n}"
+
             a = JSON()
             b = 2
     >       assert a.a == b, a
     E       AssertionError: This is JSON
     E         {
     E           'foo': 'bar'
     E         }
     E       assert 1 == 2
     E        +  where 1 = This is JSON\n{\n  'foo': 'bar'\n}.a
-    
-    failure_demo.py:238: AssertionError
-    ======= 42 failed in 0.12 seconds ========
+
+    failure_demo.py:278: AssertionError
+    ============================= warnings summary =============================
+    <undetermined location>
+      Metafunc.addcall is deprecated and scheduled to be removed in pytest 4.0.
+      Please use Metafunc.parametrize instead.
+
+    -- Docs: http://doc.pytest.org/en/latest/warnings.html
+    ================== 42 failed, 1 warnings in 0.12 seconds ===================
--- a/third_party/python/pytest/doc/en/example/simple.rst
+++ b/third_party/python/pytest/doc/en/example/simple.rst
@@ -1,87 +1,92 @@
 
 
 Basic patterns and examples
 ==========================================================
 
+.. _request example:
+
 Pass different values to a test function, depending on command line options
 ----------------------------------------------------------------------------
 
 .. regendoc:wipe
 
 Suppose we want to write a test that depends on a command line option.
 Here is a basic pattern to achieve this:
 
 .. code-block:: python
 
     # content of test_sample.py
     def test_answer(cmdopt):
         if cmdopt == "type1":
-            print ("first")
+            print("first")
         elif cmdopt == "type2":
-            print ("second")
-        assert 0 # to see what was printed
+            print("second")
+        assert 0  # to see what was printed
 
 
 For this to work we need to add a command line option and
 provide the ``cmdopt`` through a :ref:`fixture function <fixture function>`:
 
 .. code-block:: python
 
     # content of conftest.py
     import pytest
 
+
     def pytest_addoption(parser):
-        parser.addoption("--cmdopt", action="store", default="type1",
-            help="my option: type1 or type2")
+        parser.addoption(
+            "--cmdopt", action="store", default="type1", help="my option: type1 or type2"
+        )
+
 
     @pytest.fixture
     def cmdopt(request):
         return request.config.getoption("--cmdopt")
 
 Let's run this without supplying our new option::
 
     $ pytest -q test_sample.py
-    F
-    ======= FAILURES ========
-    _______ test_answer ________
-    
+    F                                                                    [100%]
+    ================================= FAILURES =================================
+    _______________________________ test_answer ________________________________
+
     cmdopt = 'type1'
-    
+
         def test_answer(cmdopt):
             if cmdopt == "type1":
-                print ("first")
+                print("first")
             elif cmdopt == "type2":
-                print ("second")
-    >       assert 0 # to see what was printed
+                print("second")
+    >       assert 0  # to see what was printed
     E       assert 0
-    
+
     test_sample.py:6: AssertionError
     --------------------------- Captured stdout call ---------------------------
     first
     1 failed in 0.12 seconds
 
 And now with supplying a command line option::
 
     $ pytest -q --cmdopt=type2
-    F
-    ======= FAILURES ========
-    _______ test_answer ________
-    
+    F                                                                    [100%]
+    ================================= FAILURES =================================
+    _______________________________ test_answer ________________________________
+
     cmdopt = 'type2'
-    
+
         def test_answer(cmdopt):
             if cmdopt == "type1":
-                print ("first")
+                print("first")
             elif cmdopt == "type2":
-                print ("second")
-    >       assert 0 # to see what was printed
+                print("second")
+    >       assert 0  # to see what was printed
     E       assert 0
-    
+
     test_sample.py:6: AssertionError
     --------------------------- Captured stdout call ---------------------------
     second
     1 failed in 0.12 seconds
 
 You can see that the command line option arrived in our test.  This
 completes the basic pattern.  However, one often rather wants to process
 command line options outside of the test and rather pass in different or
@@ -95,53 +100,60 @@ Dynamically adding command line options
 Through :confval:`addopts` you can statically add command line
 options for your project.  You can also dynamically modify
 the command line arguments before they get processed:
 
 .. code-block:: python
 
     # content of conftest.py
     import sys
-    def pytest_cmdline_preparse(args):
-        if 'xdist' in sys.modules: # pytest-xdist plugin
+
+
+    def pytest_load_initial_conftests(args):
+        if "xdist" in sys.modules:  # pytest-xdist plugin
             import multiprocessing
+
             num = max(multiprocessing.cpu_count() / 2, 1)
             args[:] = ["-n", str(num)] + args
 
-If you have the `xdist plugin <https://pypi.python.org/pypi/pytest-xdist>`_ installed
+If you have the `xdist plugin <https://pypi.org/project/pytest-xdist/>`_ installed
 you will now always perform test runs using a number
 of subprocesses close to your CPU. Running in an empty
 directory with the above conftest.py::
 
     $ pytest
-    ======= test session starts ========
+    =========================== test session starts ============================
     platform linux -- Python 3.x.y, pytest-3.x.y, py-1.x.y, pluggy-0.x.y
     rootdir: $REGENDOC_TMPDIR, inifile:
     collected 0 items
-    
-    ======= no tests ran in 0.12 seconds ========
+
+    ======================= no tests ran in 0.12 seconds =======================
 
 .. _`excontrolskip`:
 
 Control skipping of tests according to command line option
 --------------------------------------------------------------
 
 .. regendoc:wipe
 
 Here is a ``conftest.py`` file adding a ``--runslow`` command
 line option to control skipping of ``pytest.mark.slow`` marked tests:
 
 .. code-block:: python
 
     # content of conftest.py
 
     import pytest
+
+
     def pytest_addoption(parser):
-        parser.addoption("--runslow", action="store_true",
-                         default=False, help="run slow tests")
+        parser.addoption(
+            "--runslow", action="store_true", default=False, help="run slow tests"
+        )
+
 
     def pytest_collection_modifyitems(config, items):
         if config.getoption("--runslow"):
             # --runslow given in cli: do not skip slow tests
             return
         skip_slow = pytest.mark.skip(reason="need --runslow option to run")
         for item in items:
             if "slow" in item.keywords:
@@ -161,95 +173,101 @@ We can now write a test module like this
 
     @pytest.mark.slow
     def test_func_slow():
         pass
 
 and when running it will see a skipped "slow" test::
 
     $ pytest -rs    # "-rs" means report details on the little 's'
-    ======= test session starts ========
+    =========================== test session starts ============================
     platform linux -- Python 3.x.y, pytest-3.x.y, py-1.x.y, pluggy-0.x.y
     rootdir: $REGENDOC_TMPDIR, inifile:
     collected 2 items
-    
-    test_module.py .s
-    ======= short test summary info ========
+
+    test_module.py .s                                                    [100%]
+    ========================= short test summary info ==========================
     SKIP [1] test_module.py:8: need --runslow option to run
-    
-    ======= 1 passed, 1 skipped in 0.12 seconds ========
+
+    =================== 1 passed, 1 skipped in 0.12 seconds ====================
 
 Or run it including the ``slow`` marked test::
 
     $ pytest --runslow
-    ======= test session starts ========
+    =========================== test session starts ============================
     platform linux -- Python 3.x.y, pytest-3.x.y, py-1.x.y, pluggy-0.x.y
     rootdir: $REGENDOC_TMPDIR, inifile:
     collected 2 items
-    
-    test_module.py ..
-    
-    ======= 2 passed in 0.12 seconds ========
+
+    test_module.py ..                                                    [100%]
+
+    ========================= 2 passed in 0.12 seconds =========================
 
 Writing well integrated assertion helpers
 --------------------------------------------------
 
 .. regendoc:wipe
 
 If you have a test helper function called from a test you can
 use the ``pytest.fail`` marker to fail a test with a certain message.
 The test support function will not show up in the traceback if you
 set the ``__tracebackhide__`` option somewhere in the helper function.
 Example:
 
 .. code-block:: python
 
     # content of test_checkconfig.py
     import pytest
+
+
     def checkconfig(x):
         __tracebackhide__ = True
         if not hasattr(x, "config"):
-            pytest.fail("not configured: %s" %(x,))
+            pytest.fail("not configured: %s" % (x,))
+
 
     def test_something():
         checkconfig(42)
 
 The ``__tracebackhide__`` setting influences ``pytest`` showing
 of tracebacks: the ``checkconfig`` function will not be shown
 unless the ``--full-trace`` command line option is specified.
 Let's run our little function::
 
     $ pytest -q test_checkconfig.py
-    F
-    ======= FAILURES ========
-    _______ test_something ________
-    
+    F                                                                    [100%]
+    ================================= FAILURES =================================
+    ______________________________ test_something ______________________________
+
         def test_something():
     >       checkconfig(42)
     E       Failed: not configured: 42
-    
-    test_checkconfig.py:8: Failed
+
+    test_checkconfig.py:11: Failed
     1 failed in 0.12 seconds
 
 If you only want to hide certain exceptions, you can set ``__tracebackhide__``
 to a callable which gets the ``ExceptionInfo`` object. You can for example use
 this to make sure unexpected exception types aren't hidden:
 
 .. code-block:: python
 
     import operator
     import pytest
 
+
     class ConfigException(Exception):
         pass
 
+
     def checkconfig(x):
-        __tracebackhide__ = operator.methodcaller('errisinstance', ConfigException)
+        __tracebackhide__ = operator.methodcaller("errisinstance", ConfigException)
         if not hasattr(x, "config"):
-            raise ConfigException("not configured: %s" %(x,))
+            raise ConfigException("not configured: %s" % (x,))
+
 
     def test_something():
         checkconfig(42)
 
 This will avoid hiding the exception traceback on unrelated exceptions (i.e.
 bugs in assertion helpers).
 
 
@@ -262,138 +280,149 @@ Usually it is a bad idea to make applica
 behave differently if called from a test.  But if you
 absolutely must find out if your application code is
 running from a test you can do something like this:
 
 .. code-block:: python
 
     # content of conftest.py
 
+
     def pytest_configure(config):
         import sys
+
         sys._called_from_test = True
 
+
     def pytest_unconfigure(config):
         import sys
+
         del sys._called_from_test
 
 and then check for the ``sys._called_from_test`` flag:
 
 .. code-block:: python
 
-    if hasattr(sys, '_called_from_test'):
+    if hasattr(sys, "_called_from_test"):
         # called from within a test run
+        ...
     else:
         # called "normally"
+        ...
 
 accordingly in your application.  It's also a good idea
 to use your own application module rather than ``sys``
 for handling flag.
 
 Adding info to test report header
 --------------------------------------------------------------
 
 .. regendoc:wipe
 
 It's easy to present extra information in a ``pytest`` run:
 
 .. code-block:: python
 
     # content of conftest.py
 
+
     def pytest_report_header(config):
         return "project deps: mylib-1.1"
 
 which will add the string to the test header accordingly::
 
     $ pytest
-    ======= test session starts ========
+    =========================== test session starts ============================
     platform linux -- Python 3.x.y, pytest-3.x.y, py-1.x.y, pluggy-0.x.y
     project deps: mylib-1.1
     rootdir: $REGENDOC_TMPDIR, inifile:
     collected 0 items
-    
-    ======= no tests ran in 0.12 seconds ========
+
+    ======================= no tests ran in 0.12 seconds =======================
 
 .. regendoc:wipe
 
 It is also possible to return a list of strings which will be considered as several
 lines of information. You may consider ``config.getoption('verbose')`` in order to
 display more information if applicable:
 
 .. code-block:: python
 
     # content of conftest.py
 
+
     def pytest_report_header(config):
-        if config.getoption('verbose') > 0:
+        if config.getoption("verbose") > 0:
             return ["info1: did you know that ...", "did you?"]
 
 which will add info only when run with "--v"::
 
     $ pytest -v
-    ======= test session starts ========
+    =========================== test session starts ============================
     platform linux -- Python 3.x.y, pytest-3.x.y, py-1.x.y, pluggy-0.x.y -- $PYTHON_PREFIX/bin/python3.5
-    cachedir: .cache
+    cachedir: .pytest_cache
     info1: did you know that ...
     did you?
     rootdir: $REGENDOC_TMPDIR, inifile:
     collecting ... collected 0 items
-    
-    ======= no tests ran in 0.12 seconds ========
+
+    ======================= no tests ran in 0.12 seconds =======================
 
 and nothing when run plainly::
 
     $ pytest
-    ======= test session starts ========
+    =========================== test session starts ============================
     platform linux -- Python 3.x.y, pytest-3.x.y, py-1.x.y, pluggy-0.x.y
     rootdir: $REGENDOC_TMPDIR, inifile:
     collected 0 items
-    
-    ======= no tests ran in 0.12 seconds ========
+
+    ======================= no tests ran in 0.12 seconds =======================
 
 profiling test duration
 --------------------------
 
 .. regendoc:wipe
 
 .. versionadded: 2.2
 
 If you have a slow running large test suite you might want to find
 out which tests are the slowest. Let's make an artificial test suite:
 
 .. code-block:: python
 
     # content of test_some_are_slow.py
     import time
 
+
     def test_funcfast():
         time.sleep(0.1)
 
+
     def test_funcslow1():
         time.sleep(0.2)
 
+
     def test_funcslow2():
         time.sleep(0.3)
 
 Now we can profile which test functions execute the slowest::
 
     $ pytest --durations=3
-    ======= test session starts ========
+    =========================== test session starts ============================
     platform linux -- Python 3.x.y, pytest-3.x.y, py-1.x.y, pluggy-0.x.y
     rootdir: $REGENDOC_TMPDIR, inifile:
     collected 3 items
-    
-    test_some_are_slow.py ...
-    
-    ======= slowest 3 test durations ========
+
+    test_some_are_slow.py ...                                            [100%]
+
+    ========================= slowest 3 test durations =========================
     0.30s call     test_some_are_slow.py::test_funcslow2
     0.20s call     test_some_are_slow.py::test_funcslow1
     0.10s call     test_some_are_slow.py::test_funcfast
-    ======= 3 passed in 0.12 seconds ========
+    ========================= 3 passed in 0.12 seconds =========================
 
 incremental testing - test steps
 ---------------------------------------------------
 
 .. regendoc:wipe
 
 Sometimes you may have a testing situation which consists of a series
 of test steps.  If one step fails it makes no sense to execute further
@@ -402,73 +431,79 @@ add no insight.  Here is a simple ``conf
 an ``incremental`` marker which is to be used on classes:
 
 .. code-block:: python
 
     # content of conftest.py
 
     import pytest
 
+
     def pytest_runtest_makereport(item, call):
         if "incremental" in item.keywords:
             if call.excinfo is not None:
                 parent = item.parent
                 parent._previousfailed = item
 
+
     def pytest_runtest_setup(item):
         if "incremental" in item.keywords:
             previousfailed = getattr(item.parent, "_previousfailed", None)
             if previousfailed is not None:
-                pytest.xfail("previous test failed (%s)" %previousfailed.name)
+                pytest.xfail("previous test failed (%s)" % previousfailed.name)
 
 These two hook implementations work together to abort incremental-marked
 tests in a class.  Here is a test module example:
 
 .. code-block:: python
 
     # content of test_step.py
 
     import pytest
 
+
     @pytest.mark.incremental
     class TestUserHandling(object):
         def test_login(self):
             pass
+
         def test_modification(self):
             assert 0
+
         def test_deletion(self):
             pass
 
+
     def test_normal():
         pass
 
 If we run this::
 
     $ pytest -rx
-    ======= test session starts ========
+    =========================== test session starts ============================
     platform linux -- Python 3.x.y, pytest-3.x.y, py-1.x.y, pluggy-0.x.y
     rootdir: $REGENDOC_TMPDIR, inifile:
     collected 4 items
-    
-    test_step.py .Fx.
-    ======= short test summary info ========
-    XFAIL test_step.py::TestUserHandling::()::test_deletion
-      reason: previous test failed (test_modification)
-    
-    ======= FAILURES ========
-    _______ TestUserHandling.test_modification ________
-    
+
+    test_step.py .Fx.                                                    [100%]
+
+    ================================= FAILURES =================================
+    ____________________ TestUserHandling.test_modification ____________________
+
     self = <test_step.TestUserHandling object at 0xdeadbeef>
-    
+
         def test_modification(self):
     >       assert 0
     E       assert 0
-    
-    test_step.py:9: AssertionError
-    ======= 1 failed, 2 passed, 1 xfailed in 0.12 seconds ========
+
+    test_step.py:11: AssertionError
+    ========================= short test summary info ==========================
+    XFAIL test_step.py::TestUserHandling::()::test_deletion
+      reason: previous test failed (test_modification)
+    ============== 1 failed, 2 passed, 1 xfailed in 0.12 seconds ===============
 
 We'll see that ``test_deletion`` was not executed because ``test_modification``
 failed.  It is reported as an "expected failure".
 
 
 Package/Directory-level fixtures (setups)
 -------------------------------------------------------
 
@@ -482,19 +517,21 @@ setup/teardown functions, especially if 
 
 Here is an example for making a ``db`` fixture available in a directory:
 
 .. code-block:: python
 
     # content of a/conftest.py
     import pytest
 
+
     class DB(object):
         pass
 
+
     @pytest.fixture(scope="session")
     def db():
         return DB()
 
 and then a test module in that directory:
 
 .. code-block:: python
 
@@ -517,66 +554,66 @@ the ``db`` fixture:
 
     # content of b/test_error.py
     def test_root(db):  # no db here, will error out
         pass
 
 We can run this::
 
     $ pytest
-    ======= test session starts ========
+    =========================== test session starts ============================
     platform linux -- Python 3.x.y, pytest-3.x.y, py-1.x.y, pluggy-0.x.y
     rootdir: $REGENDOC_TMPDIR, inifile:
     collected 7 items
-    
-    test_step.py .Fx.
-    a/test_db.py F
-    a/test_db2.py F
-    b/test_error.py E
-    
-    ======= ERRORS ========
-    _______ ERROR at setup of test_root ________
+
+    test_step.py .Fx.                                                    [ 57%]
+    a/test_db.py F                                                       [ 71%]
+    a/test_db2.py F                                                      [ 85%]
+    b/test_error.py E                                                    [100%]
+
+    ================================== ERRORS ==================================
+    _______________________ ERROR at setup of test_root ________________________
     file $REGENDOC_TMPDIR/b/test_error.py, line 1
       def test_root(db):  # no db here, will error out
     E       fixture 'db' not found
-    >       available fixtures: cache, capfd, capsys, doctest_namespace, monkeypatch, pytestconfig, record_xml_property, recwarn, tmpdir, tmpdir_factory
+    >       available fixtures: cache, capfd, capfdbinary, caplog, capsys, capsysbinary, doctest_namespace, monkeypatch, pytestconfig, record_property, record_xml_attribute, record_xml_property, recwarn, tmpdir, tmpdir_factory
     >       use 'pytest --fixtures [testpath]' for help on them.
-    
+
     $REGENDOC_TMPDIR/b/test_error.py:1
-    ======= FAILURES ========
-    _______ TestUserHandling.test_modification ________
-    
+    ================================= FAILURES =================================
+    ____________________ TestUserHandling.test_modification ____________________
+
     self = <test_step.TestUserHandling object at 0xdeadbeef>
-    
+
         def test_modification(self):
     >       assert 0
     E       assert 0
-    
-    test_step.py:9: AssertionError
-    _______ test_a1 ________
-    
+
+    test_step.py:11: AssertionError
+    _________________________________ test_a1 __________________________________
+
     db = <conftest.DB object at 0xdeadbeef>
-    
+
         def test_a1(db):
     >       assert 0, db  # to show value
     E       AssertionError: <conftest.DB object at 0xdeadbeef>
     E       assert 0
-    
+
     a/test_db.py:2: AssertionError
-    _______ test_a2 ________
-    
+    _________________________________ test_a2 __________________________________
+
     db = <conftest.DB object at 0xdeadbeef>
-    
+
         def test_a2(db):
     >       assert 0, db  # to show value
     E       AssertionError: <conftest.DB object at 0xdeadbeef>
     E       assert 0
-    
+
     a/test_db2.py:2: AssertionError
-    ======= 3 failed, 2 passed, 1 xfailed, 1 error in 0.12 seconds ========
+    ========== 3 failed, 2 passed, 1 xfailed, 1 error in 0.12 seconds ==========
 
 The two test modules in the ``a`` directory see the same ``db`` fixture instance
 while the one test in the sister-directory ``b`` doesn't see it.  We could of course
 also define a ``db`` fixture in that sister directory's ``conftest.py`` file.
 Note that each fixture is only instantiated if there is a test actually needing
 it (unless you use "autouse" fixture which are always executed ahead of the first test
 executing).
 
@@ -593,16 +630,17 @@ case we just write some information out 
 
 .. code-block:: python
 
     # content of conftest.py
 
     import pytest
     import os.path
 
+
     @pytest.hookimpl(tryfirst=True, hookwrapper=True)
     def pytest_runtest_makereport(item, call):
         # execute all other hooks to obtain the report object
         outcome = yield
         rep = outcome.get_result()
 
         # we only look at actual failing test calls, not setup/teardown
         if rep.when == "call" and rep.failed:
@@ -619,47 +657,49 @@ case we just write some information out 
 
 if you then have failing tests:
 
 .. code-block:: python
 
     # content of test_module.py
     def test_fail1(tmpdir):
         assert 0
+
+
     def test_fail2():
         assert 0
 
 and run them::
 
     $ pytest test_module.py
-    ======= test session starts ========
+    =========================== test session starts ============================
     platform linux -- Python 3.x.y, pytest-3.x.y, py-1.x.y, pluggy-0.x.y
     rootdir: $REGENDOC_TMPDIR, inifile:
     collected 2 items
-    
-    test_module.py FF
-    
-    ======= FAILURES ========
-    _______ test_fail1 ________
-    
+
+    test_module.py FF                                                    [100%]
+
+    ================================= FAILURES =================================
+    ________________________________ test_fail1 ________________________________
+
     tmpdir = local('PYTEST_TMPDIR/test_fail10')
-    
+
         def test_fail1(tmpdir):
     >       assert 0
     E       assert 0
-    
+
     test_module.py:2: AssertionError
-    _______ test_fail2 ________
-    
+    ________________________________ test_fail2 ________________________________
+
         def test_fail2():
     >       assert 0
     E       assert 0
-    
-    test_module.py:4: AssertionError
-    ======= 2 failed in 0.12 seconds ========
+
+    test_module.py:6: AssertionError
+    ========================= 2 failed in 0.12 seconds =========================
 
 you will have a "failures" file which contains the failing test ids::
 
     $ cat failures
     test_module.py::test_fail1 (PYTEST_TMPDIR/test_fail10)
     test_module.py::test_fail2
 
 Making test result information available in fixtures
@@ -671,16 +711,17 @@ If you want to make test result reports 
 here is a little example implemented via a local plugin:
 
 .. code-block:: python
 
     # content of conftest.py
 
     import pytest
 
+
     @pytest.hookimpl(tryfirst=True, hookwrapper=True)
     def pytest_runtest_makereport(item, call):
         # execute all other hooks to obtain the report object
         outcome = yield
         rep = outcome.get_result()
 
         # set a report attribute for each phase of a call, which can
         # be "setup", "call", "teardown"
@@ -689,106 +730,112 @@ here is a little example implemented via
 
 
     @pytest.fixture
     def something(request):
         yield
         # request.node is an "item" because we use the default
         # "function" scope
         if request.node.rep_setup.failed:
-            print ("setting up a test failed!", request.node.nodeid)
+            print("setting up a test failed!", request.node.nodeid)
         elif request.node.rep_setup.passed:
             if request.node.rep_call.failed:
-                print ("executing test failed", request.node.nodeid)
+                print("executing test failed", request.node.nodeid)
 
 
 if you then have failing tests:
 
 .. code-block:: python
 
     # content of test_module.py
 
     import pytest
 
+
     @pytest.fixture
     def other():
         assert 0
 
+
     def test_setup_fails(something, other):
         pass
 
+
     def test_call_fails(something):
         assert 0
 
+
     def test_fail2():
         assert 0
 
 and run it::
 
     $ pytest -s test_module.py
-    ======= test session starts ========
+    =========================== test session starts ============================
     platform linux -- Python 3.x.y, pytest-3.x.y, py-1.x.y, pluggy-0.x.y
     rootdir: $REGENDOC_TMPDIR, inifile:
     collected 3 items
-    
+
     test_module.py Esetting up a test failed! test_module.py::test_setup_fails
     Fexecuting test failed test_module.py::test_call_fails
     F
-    
-    ======= ERRORS ========
-    _______ ERROR at setup of test_setup_fails ________
-    
+
+    ================================== ERRORS ==================================
+    ____________________ ERROR at setup of test_setup_fails ____________________
+
         @pytest.fixture
         def other():
     >       assert 0
     E       assert 0
-    
-    test_module.py:6: AssertionError
-    ======= FAILURES ========
-    _______ test_call_fails ________
-    
+
+    test_module.py:7: AssertionError
+    ================================= FAILURES =================================
+    _____________________________ test_call_fails ______________________________
+
     something = None
-    
+
         def test_call_fails(something):
     >       assert 0
     E       assert 0
-    
-    test_module.py:12: AssertionError
-    _______ test_fail2 ________
-    
+
+    test_module.py:15: AssertionError
+    ________________________________ test_fail2 ________________________________
+
         def test_fail2():
     >       assert 0
     E       assert 0
-    
-    test_module.py:15: AssertionError
-    ======= 2 failed, 1 error in 0.12 seconds ========
+
+    test_module.py:19: AssertionError
+    ==================== 2 failed, 1 error in 0.12 seconds =====================
 
 You'll see that the fixture finalizers could use the precise reporting
 information.
 
+.. _pytest current test env:
+
 ``PYTEST_CURRENT_TEST`` environment variable
 --------------------------------------------
 
 .. versionadded:: 3.2
 
 Sometimes a test session might get stuck and there might be no easy way to figure out
 which test got stuck, for example if pytest was run in quiet mode (``-q``) or you don't have access to the console
 output. This is particularly a problem if the problem helps only sporadically, the famous "flaky" kind of tests.
 
 ``pytest`` sets a ``PYTEST_CURRENT_TEST`` environment variable when running tests, which can be inspected
-by process monitoring utilities or libraries like `psutil <https://pypi.python.org/pypi/psutil>`_ to discover which
+by process monitoring utilities or libraries like `psutil <https://pypi.org/project/psutil/>`_ to discover which
 test got stuck if necessary:
 
 .. code-block:: python
 
     import psutil
 
     for pid in psutil.pids():
         environ = psutil.Process(pid).environ()
-        if 'PYTEST_CURRENT_TEST' in environ:
+        if "PYTEST_CURRENT_TEST" in environ:
             print(f'pytest process {pid} running: {environ["PYTEST_CURRENT_TEST"]}')
 
 During the test session pytest will set ``PYTEST_CURRENT_TEST`` to the current test
 :ref:`nodeid <nodeids>` and the current stage, which can be ``setup``, ``call``
 and ``teardown``.
 
 For example, when running a single test function named ``test_foo`` from ``foo_module.py``,
 ``PYTEST_CURRENT_TEST`` will be set to:
@@ -800,46 +847,52 @@ For example, when running a single test 
 In that order.
 
 .. note::
 
     The contents of ``PYTEST_CURRENT_TEST`` is meant to be human readable and the actual format
     can be changed between releases (even bug fixes) so it shouldn't be relied on for scripting
     or automation.
 
-Freezing pytest 
+Freezing pytest
 ---------------
 
 If you freeze your application using a tool like
 `PyInstaller <https://pyinstaller.readthedocs.io>`_
 in order to distribute it to your end-users, it is a good idea to also package
 your test runner and run your tests using the frozen application. This way packaging
 errors such as dependencies not being included into the executable can be detected early
 while also allowing you to send test files to users so they can run them in their
 machines, which can be useful to obtain more information about a hard to reproduce bug.
 
 Fortunately recent ``PyInstaller`` releases already have a custom hook
-for pytest, but if you are using another tool to freeze executables 
+for pytest, but if you are using another tool to freeze executables
 such as ``cx_freeze`` or ``py2exe``, you can use ``pytest.freeze_includes()``
 to obtain the full list of internal pytest modules. How to configure the tools
 to find the internal modules varies from tool to tool, however.
 
-Instead of freezing the pytest runner as a separate executable, you can make 
+Instead of freezing the pytest runner as a separate executable, you can make
 your frozen program work as the pytest runner by some clever
-argument handling during program startup. This allows you to 
+argument handling during program startup. This allows you to
 have a single executable, which is usually more convenient.
+Please note that the mechanism for plugin discovery used by pytest
+(setupttools entry points) doesn't work with frozen executables so pytest
+can't find any third party plugins automatically. To include third party plugins
+like ``pytest-timeout`` they must be imported explicitly and passed on to pytest.main.
 
 .. code-block:: python
 
     # contents of app_main.py
     import sys
+    import pytest_timeout  # Third party plugin
 
-    if len(sys.argv) > 1 and sys.argv[1] == '--pytest':
+    if len(sys.argv) > 1 and sys.argv[1] == "--pytest":
         import pytest
-        sys.exit(pytest.main(sys.argv[2:]))
+
+        sys.exit(pytest.main(sys.argv[2:], plugins=[pytest_timeout]))
     else:
         # normal application execution: at this point argv can be parsed
         # by your argument-parsing library of choice as usual
         ...
 
 
 This allows you to execute tests using the frozen
 application with standard ``pytest`` command-line options::
--- a/third_party/python/pytest/doc/en/example/xfail_demo.py
+++ b/third_party/python/pytest/doc/en/example/xfail_demo.py
@@ -1,30 +1,38 @@
 import pytest
+
 xfail = pytest.mark.xfail
 
+
 @xfail
 def test_hello():
     assert 0
 
+
 @xfail(run=False)
 def test_hello2():
     assert 0
 
+
 @xfail("hasattr(os, 'sep')")
 def test_hello3():
     assert 0
 
+
 @xfail(reason="bug 110")
 def test_hello4():
     assert 0
 
+
 @xfail('pytest.__version__[0] != "17"')
 def test_hello5():
     assert 0
 
+
 def test_hello6():
     pytest.xfail("reason")
 
+
 @xfail(raises=IndexError)
 def test_hello7():
     x = []
     x[1] = 1
--- a/third_party/python/pytest/doc/en/faq.rst
+++ b/third_party/python/pytest/doc/en/faq.rst
@@ -25,24 +25,24 @@ how does pytest relate to twisted's tria
 ++++++++++++++++++++++++++++++++++++++++++++++
 
 Since some time ``pytest`` has builtin support for supporting tests
 written using trial. It does not itself start a reactor, however,
 and does not handle Deferreds returned from a test in pytest style.
 If you are using trial's unittest.TestCase chances are that you can
 just run your tests even if you return Deferreds.  In addition,
 there also is a dedicated `pytest-twisted
-<http://pypi.python.org/pypi/pytest-twisted>`_ plugin which allows you to
+<https://pypi.org/project/pytest-twisted/>`_ plugin which allows you to
 return deferreds from pytest-style tests, allowing the use of
 :ref:`fixtures` and other features.
 
 how does pytest work with Django?
 ++++++++++++++++++++++++++++++++++++++++++++++
 
-In 2012, some work is going into the `pytest-django plugin <http://pypi.python.org/pypi/pytest-django>`_.  It substitutes the usage of Django's
+In 2012, some work is going into the `pytest-django plugin <https://pypi.org/project/pytest-django/>`_.  It substitutes the usage of Django's
 ``manage.py test`` and allows the use of all pytest features_ most of which
 are not available from Django directly.
 
 .. _features: features.html
 
 
 What's this "magic" with pytest? (historic notes)
 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++
--- a/third_party/python/pytest/doc/en/fixture.rst
+++ b/third_party/python/pytest/doc/en/fixture.rst
@@ -64,36 +64,36 @@ using it::
         assert response == 250
         assert 0 # for demo purposes
 
 Here, the ``test_ehlo`` needs the ``smtp`` fixture value.  pytest
 will discover and call the :py:func:`@pytest.fixture <_pytest.python.fixture>`
 marked ``smtp`` fixture function.  Running the test looks like this::
 
     $ pytest test_smtpsimple.py
-    ======= test session starts ========
+    =========================== test session starts ============================
     platform linux -- Python 3.x.y, pytest-3.x.y, py-1.x.y, pluggy-0.x.y
     rootdir: $REGENDOC_TMPDIR, inifile:
     collected 1 item
-    
-    test_smtpsimple.py F
-    
-    ======= FAILURES ========
-    _______ test_ehlo ________
-    
+
+    test_smtpsimple.py F                                                 [100%]
+
+    ================================= FAILURES =================================
+    ________________________________ test_ehlo _________________________________
+
     smtp = <smtplib.SMTP object at 0xdeadbeef>
-    
+
         def test_ehlo(smtp):
             response, msg = smtp.ehlo()
             assert response == 250
     >       assert 0 # for demo purposes
     E       assert 0
-    
+
     test_smtpsimple.py:11: AssertionError
-    ======= 1 failed in 0.12 seconds ========
+    ========================= 1 failed in 0.12 seconds =========================
 
 In the failure traceback we see that the test function was called with a
 ``smtp`` argument, the ``smtplib.SMTP()`` instance created by the fixture
 function.  The test function fails on our deliberate ``assert 0``.  Here is
 the exact protocol used by ``pytest`` to call the test function this way:
 
 1. pytest :ref:`finds <test discovery>` the ``test_ehlo`` because
    of the ``test_`` prefix.  The test function needs a function argument
@@ -106,21 +106,21 @@ 3. ``test_ehlo(<SMTP instance>)`` is cal
    line of the test function.
 
 Note that if you misspell a function argument or want
 to use one that isn't available, you'll see an error
 with a list of available function arguments.
 
 .. note::
 
-    You can always issue::
+    You can always issue ::
 
         pytest --fixtures test_simplefactory.py
 
-    to see available fixtures.
+    to see available fixtures (fixtures with leading ``_`` are only shown if you add the ``-v`` option).
 
 Fixtures: a prime example of dependency injection
 ---------------------------------------------------
 
 Fixtures allow test functions to easily receive and work
 against specific pre-initialized application objects without having
 to care about import/setup/cleanup details.
 It's a prime example of `dependency injection`_ where fixture
@@ -136,48 +136,48 @@ functions take the role of the *injector
 If during implementing your tests you realize that you
 want to use a fixture function from multiple test files you can move it
 to a ``conftest.py`` file.
 You don't need to import the fixture you want to use in a test, it
 automatically gets discovered by pytest. The discovery of
 fixture functions starts at test classes, then test modules, then
 ``conftest.py`` files and finally builtin and third party plugins.
 
-You can also use the ``conftest.py`` file to implement 
+You can also use the ``conftest.py`` file to implement
 :ref:`local per-directory plugins <conftest.py plugins>`.
 
 Sharing test data
 -----------------
 
 If you want to make test data from files available to your tests, a good way
 to do this is by loading these data in a fixture for use by your tests.
 This makes use of the automatic caching mechanisms of pytest.
 
 Another good approach is by adding the data files in the ``tests`` folder.
-There are also community plugins available to help managing this aspect of 
-testing, e.g. `pytest-datadir <https://github.com/gabrielcnr/pytest-datadir>`__ 
-and `pytest-datafiles <https://pypi.python.org/pypi/pytest-datafiles>`__. 
+There are also community plugins available to help managing this aspect of
+testing, e.g. `pytest-datadir <https://github.com/gabrielcnr/pytest-datadir>`__
+and `pytest-datafiles <https://pypi.python.org/pypi/pytest-datafiles>`__.
 
 .. _smtpshared:
 
 Scope: sharing a fixture instance across tests in a class, module or session
 ----------------------------------------------------------------------------
 
 .. regendoc:wipe
 
 Fixtures requiring network access depend on connectivity and are
 usually time-expensive to create.  Extending the previous example, we
-can add a ``scope='module'`` parameter to the
+can add a ``scope="module"`` parameter to the
 :py:func:`@pytest.fixture <_pytest.python.fixture>` invocation
 to cause the decorated ``smtp`` fixture function to only be invoked once
 per test *module* (the default is to invoke once per test *function*).
 Multiple test functions in a test module will thus
 each receive the same ``smtp`` fixture instance, thus saving time.
 
-The next example puts the fixture function into a separate ``conftest.py`` file 
+The next example puts the fixture function into a separate ``conftest.py`` file
 so that tests from multiple test modules in the directory can
 access the fixture function::
 
     # content of conftest.py
     import pytest
     import smtplib
 
     @pytest.fixture(scope="module")
@@ -200,99 +200,149 @@ function (in or below the directory wher
         response, msg = smtp.noop()
         assert response == 250
         assert 0  # for demo purposes
 
 We deliberately insert failing ``assert 0`` statements in order to
 inspect what is going on and can now run the tests::
 
     $ pytest test_module.py
-    ======= test session starts ========
+    =========================== test session starts ============================
     platform linux -- Python 3.x.y, pytest-3.x.y, py-1.x.y, pluggy-0.x.y
     rootdir: $REGENDOC_TMPDIR, inifile:
     collected 2 items
-    
-    test_module.py FF
-    
-    ======= FAILURES ========
-    _______ test_ehlo ________
-    
+
+    test_module.py FF                                                    [100%]
+
+    ================================= FAILURES =================================
+    ________________________________ test_ehlo _________________________________
+
     smtp = <smtplib.SMTP object at 0xdeadbeef>
-    
+
         def test_ehlo(smtp):
             response, msg = smtp.ehlo()
             assert response == 250
             assert b"smtp.gmail.com" in msg
     >       assert 0  # for demo purposes
     E       assert 0
-    
+
     test_module.py:6: AssertionError
-    _______ test_noop ________
-    
+    ________________________________ test_noop _________________________________
+
     smtp = <smtplib.SMTP object at 0xdeadbeef>
-    
+
         def test_noop(smtp):
             response, msg = smtp.noop()
             assert response == 250
     >       assert 0  # for demo purposes
     E       assert 0
-    
+
     test_module.py:11: AssertionError
-    ======= 2 failed in 0.12 seconds ========
+    ========================= 2 failed in 0.12 seconds =========================
 
 You see the two ``assert 0`` failing and more importantly you can also see
 that the same (module-scoped) ``smtp`` object was passed into the two
 test functions because pytest shows the incoming argument values in the
 traceback.  As a result, the two test functions using ``smtp`` run as
 quick as a single one because they reuse the same instance.
 
 If you decide that you rather want to have a session-scoped ``smtp``
 instance, you can simply declare it:
 
 .. code-block:: python
 
     @pytest.fixture(scope="session")
-    def smtp(...):
+    def smtp():
         # the returned fixture value will be shared for
         # all tests needing it
+        ...
 
 Finally, the ``class`` scope will invoke the fixture once per test *class*.
 
+
+Higher-scoped fixtures are instantiated first
+---------------------------------------------
+
+.. versionadded:: 3.5
+
+Within a function request for features, fixture of higher-scopes (such as ``session``) are instantiated first than
+lower-scoped fixtures (such as ``function`` or ``class``). The relative order of fixtures of same scope follows
+the declared order in the test function and honours dependencies between fixtures.
+
+Consider the code below:
+
+.. code-block:: python
+
+    @pytest.fixture(scope="session")
+    def s1():
+        pass
+
+
+    @pytest.fixture(scope="module")
+    def m1():
+        pass
+
+
+    @pytest.fixture
+    def f1(tmpdir):
+        pass
+
+
+    @pytest.fixture
+    def f2():
+        pass
+
+
+    def test_foo(f1, m1, f2, s1):
+        ...
+
+
+The fixtures requested by ``test_foo`` will be instantiated in the following order:
+
+1. ``s1``: is the highest-scoped fixture (``session``).
+2. ``m1``: is the second highest-scoped fixture (``module``).
+3. ``tmpdir``: is a ``function``-scoped fixture, required by ``f1``: it needs to be instantiated at this point
+   because it is a dependency of ``f1``.
+4. ``f1``: is the first ``function``-scoped fixture in ``test_foo`` parameter list.
+5. ``f2``: is the last ``function``-scoped fixture in ``test_foo`` parameter list.
+
+
 .. _`finalization`:
 
 Fixture finalization / executing teardown code
 -------------------------------------------------------------
 
 pytest supports execution of fixture specific finalization code
 when the fixture goes out of scope.  By using a ``yield`` statement instead of ``return``, all
 the code after the *yield* statement serves as the teardown code:
 
 .. code-block:: python
 
     # content of conftest.py
 
     import smtplib
     import pytest
 
+
     @pytest.fixture(scope="module")
     def smtp():
         smtp = smtplib.SMTP("smtp.gmail.com", 587, timeout=5)
         yield smtp  # provide the fixture value
         print("teardown smtp")
         smtp.close()
 
 The ``print`` and ``smtp.close()`` statements will execute when the last test in
 the module has finished execution, regardless of the exception status of the
 tests.
 
 Let's execute it::
 
     $ pytest -s -q --tb=no
     FFteardown smtp
-    
+
     2 failed in 0.12 seconds
 
 We see that the ``smtp`` instance is finalized after the two
 tests finished execution.  Note that if we decorated our fixture
 function with ``scope='function'`` then fixture setup and cleanup would
 occur around each single test.  In either case the test
 module itself does not need to change or know about these details
 of fixture setup.
@@ -301,16 +351,17 @@ Note that we can also seamlessly use the
 
 .. code-block:: python
 
     # content of test_yield2.py
 
     import smtplib
     import pytest
 
+
     @pytest.fixture(scope="module")
     def smtp():
         with smtplib.SMTP("smtp.gmail.com", 587, timeout=5) as smtp:
             yield smtp  # provide the fixture value
 
 
 The ``smtp`` connection will be closed after the test finished execution
 because the ``smtp`` object automatically closes when
@@ -326,22 +377,25 @@ finalization functions.
 Here's the ``smtp`` fixture changed to use ``addfinalizer`` for cleanup:
 
 .. code-block:: python
 
     # content of conftest.py
     import smtplib
     import pytest
 
+
     @pytest.fixture(scope="module")
     def smtp(request):
         smtp = smtplib.SMTP("smtp.gmail.com", 587, timeout=5)
+
         def fin():
-            print ("teardown smtp")
+            print("teardown smtp")
             smtp.close()
+
         request.addfinalizer(fin)
         return smtp  # provide the fixture value
 
 
 Both ``yield`` and ``addfinalizer`` methods work similarly by calling their code after the test
 ends, but ``addfinalizer`` has two key differences over ``yield``:
 
 1. It is possible to register multiple finalizer functions.
@@ -364,17 +418,17 @@ 2. Finalizers will always be called rega
    registered then it will not be executed.
 
 
 .. _`request-context`:
 
 Fixtures can introspect the requesting test context
 -------------------------------------------------------------
 
-Fixture function can accept the :py:class:`request <FixtureRequest>` object
+Fixture functions can accept the :py:class:`request <FixtureRequest>` object
 to introspect the "requesting" test function, class or module context.
 Further extending the previous ``smtp`` fixture example, let's
 read an optional server URL from the test module which uses our fixture::
 
     # content of conftest.py
     import pytest
     import smtplib
 
@@ -387,45 +441,98 @@ read an optional server URL from the tes
         smtp.close()
 
 We use the ``request.module`` attribute to optionally obtain an
 ``smtpserver`` attribute from the test module.  If we just execute
 again, nothing much has changed::
 
     $ pytest -s -q --tb=no
     FFfinalizing <smtplib.SMTP object at 0xdeadbeef> (smtp.gmail.com)
-    
+
     2 failed in 0.12 seconds
 
 Let's quickly create another test module that actually sets the
 server URL in its module namespace::
 
     # content of test_anothersmtp.py
 
     smtpserver = "mail.python.org"  # will be read by smtp fixture
 
     def test_showhelo(smtp):
         assert 0, smtp.helo()
 
 Running it::
 
     $ pytest -qq --tb=short test_anothersmtp.py
-    F
-    ======= FAILURES ========
-    _______ test_showhelo ________
+    F                                                                    [100%]
+    ================================= FAILURES =================================
+    ______________________________ test_showhelo _______________________________
     test_anothersmtp.py:5: in test_showhelo
         assert 0, smtp.helo()
     E   AssertionError: (250, b'mail.python.org')
     E   assert 0
     ------------------------- Captured stdout teardown -------------------------
     finalizing <smtplib.SMTP object at 0xdeadbeef> (mail.python.org)
 
 voila! The ``smtp`` fixture function picked up our mail server name
 from the module namespace.
 
+.. _`fixture-factory`:
+
+Factories as fixtures
+-------------------------------------------------------------
+
+The "factory as fixture" pattern can help in situations where the result
+of a fixture is needed multiple times in a single test. Instead of returning
+data directly, the fixture instead returns a function which generates the data.
+This function can then be called multiple times in the test.
+
+Factories can have have parameters as needed::
+
+    @pytest.fixture
+    def make_customer_record():
+
+        def _make_customer_record(name):
+            return {
+                "name": name,
+                "orders": []
+            }
+
+        return _make_customer_record
+
+
+    def test_customer_records(make_customer_record):
+        customer_1 = make_customer_record("Lisa")
+        customer_2 = make_customer_record("Mike")
+        customer_3 = make_customer_record("Meredith")
+
+If the data created by the factory requires managing, the fixture can take care of that::
+
+    @pytest.fixture
+    def make_customer_record():
+
+        created_records = []
+
+        def _make_customer_record(name):
+            record = models.Customer(name=name, orders=[])
+            created_records.append(record)
+            return record
+
+        yield _make_customer_record
+
+        for record in created_records:
+            record.destroy()
+
+
+    def test_customer_records(make_customer_record):
+        customer_1 = make_customer_record("Lisa")
+        customer_2 = make_customer_record("Mike")
+        customer_3 = make_customer_record("Meredith")
+
+
 .. _`fixture-parametrize`:
 
 Parametrizing fixtures
 -----------------------------------------------------------------
 
 Fixture functions can be parametrized in which case they will be called
 multiple times, each time executing the set of dependent tests, i. e. the
 tests that depend on this fixture.  Test functions do usually not need
@@ -452,64 +559,64 @@ through the special :py:class:`request <
 
 The main change is the declaration of ``params`` with
 :py:func:`@pytest.fixture <_pytest.python.fixture>`, a list of values
 for each of which the fixture function will execute and can access
 a value via ``request.param``.  No test function code needs to change.
 So let's just do another run::
 
     $ pytest -q test_module.py
-    FFFF
-    ======= FAILURES ========
-    _______ test_ehlo[smtp.gmail.com] ________
-    
+    FFFF                                                                 [100%]
+    ================================= FAILURES =================================
+    ________________________ test_ehlo[smtp.gmail.com] _________________________
+
     smtp = <smtplib.SMTP object at 0xdeadbeef>
-    
+
         def test_ehlo(smtp):
             response, msg = smtp.ehlo()
             assert response == 250
             assert b"smtp.gmail.com" in msg
     >       assert 0  # for demo purposes
     E       assert 0
-    
+
     test_module.py:6: AssertionError
-    _______ test_noop[smtp.gmail.com] ________
-    
+    ________________________ test_noop[smtp.gmail.com] _________________________
+
     smtp = <smtplib.SMTP object at 0xdeadbeef>
-    
+
         def test_noop(smtp):
             response, msg = smtp.noop()
             assert response == 250
     >       assert 0  # for demo purposes
     E       assert 0
-    
+
     test_module.py:11: AssertionError
-    _______ test_ehlo[mail.python.org] ________
-    
+    ________________________ test_ehlo[mail.python.org] ________________________
+
     smtp = <smtplib.SMTP object at 0xdeadbeef>
-    
+
         def test_ehlo(smtp):
             response, msg = smtp.ehlo()
             assert response == 250
     >       assert b"smtp.gmail.com" in msg
     E       AssertionError: assert b'smtp.gmail.com' in b'mail.python.org\nPIPELINING\nSIZE 51200000\nETRN\nSTARTTLS\nAUTH DIGEST-MD5 NTLM CRAM-MD5\nENHANCEDSTATUSCODES\n8BITMIME\nDSN\nSMTPUTF8'
-    
+
     test_module.py:5: AssertionError
     -------------------------- Captured stdout setup ---------------------------
     finalizing <smtplib.SMTP object at 0xdeadbeef>
-    _______ test_noop[mail.python.org] ________
-    
+    ________________________ test_noop[mail.python.org] ________________________
+
     smtp = <smtplib.SMTP object at 0xdeadbeef>
-    
+
         def test_noop(smtp):
             response, msg = smtp.noop()
             assert response == 250
     >       assert 0  # for demo purposes
     E       assert 0
-    
+
     test_module.py:11: AssertionError
     ------------------------- Captured stdout teardown -------------------------
     finalizing <smtplib.SMTP object at 0xdeadbeef>
     4 failed in 0.12 seconds
 
 We see that our two test functions each ran twice, against the different
 ``smtp`` instances.  Note also, that with the ``mail.python.org``
 connection the second test fails in ``test_ehlo`` because a
@@ -554,35 +661,69 @@ the string used in a test ID for a certa
 The above shows how ``ids`` can be either a list of strings to use or
 a function which will be called with the fixture value and then
 has to return a string to use.  In the latter case if the function
 return ``None`` then pytest's auto-generated ID will be used.
 
 Running the above tests results in the following test IDs being used::
 
    $ pytest --collect-only
-   ======= test session starts ========
+   =========================== test session starts ============================
    platform linux -- Python 3.x.y, pytest-3.x.y, py-1.x.y, pluggy-0.x.y
    rootdir: $REGENDOC_TMPDIR, inifile:
    collected 10 items
    <Module 'test_anothersmtp.py'>
      <Function 'test_showhelo[smtp.gmail.com]'>
      <Function 'test_showhelo[mail.python.org]'>
    <Module 'test_ids.py'>
      <Function 'test_a[spam]'>
      <Function 'test_a[ham]'>
      <Function 'test_b[eggs]'>
      <Function 'test_b[1]'>
    <Module 'test_module.py'>
      <Function 'test_ehlo[smtp.gmail.com]'>
      <Function 'test_noop[smtp.gmail.com]'>
      <Function 'test_ehlo[mail.python.org]'>
      <Function 'test_noop[mail.python.org]'>
-   
-   ======= no tests ran in 0.12 seconds ========
+
+   ======================= no tests ran in 0.12 seconds =======================
+
+.. _`fixture-parametrize-marks`:
+
+Using marks with parametrized fixtures
+--------------------------------------
+
+:func:`pytest.param` can be used to apply marks in values sets of parametrized fixtures in the same way
+that they can be used with :ref:`@pytest.mark.parametrize <@pytest.mark.parametrize>`.
+
+Example::
+
+    # content of test_fixture_marks.py
+    import pytest
+    @pytest.fixture(params=[0, 1, pytest.param(2, marks=pytest.mark.skip)])
+    def data_set(request):
+        return request.param
+
+    def test_data(data_set):
+        pass
+
+Running this test will *skip* the invocation of ``data_set`` with value ``2``::
+
+    $ pytest test_fixture_marks.py -v
+    =========================== test session starts ============================
+    platform linux -- Python 3.x.y, pytest-3.x.y, py-1.x.y, pluggy-0.x.y -- $PYTHON_PREFIX/bin/python3.5
+    cachedir: .pytest_cache
+    rootdir: $REGENDOC_TMPDIR, inifile:
+    collecting ... collected 3 items
+
+    test_fixture_marks.py::test_data[0] PASSED                           [ 33%]
+    test_fixture_marks.py::test_data[1] PASSED                           [ 66%]
+    test_fixture_marks.py::test_data[2] SKIPPED                          [100%]
+
+    =================== 2 passed, 1 skipped in 0.12 seconds ====================
 
 .. _`interdependent fixtures`:
 
 Modularity: using fixtures from a fixture function
 ----------------------------------------------------------
 
 You can not only use fixtures in test functions but fixture functions
 can use other fixtures themselves.  This contributes to a modular design
@@ -605,26 +746,26 @@ and instantiate an object ``app`` where 
 
     def test_smtp_exists(app):
         assert app.smtp
 
 Here we declare an ``app`` fixture which receives the previously defined
 ``smtp`` fixture and instantiates an ``App`` object with it.  Let's run it::
 
     $ pytest -v test_appsetup.py
-    ======= test session starts ========
+    =========================== test session starts ============================
     platform linux -- Python 3.x.y, pytest-3.x.y, py-1.x.y, pluggy-0.x.y -- $PYTHON_PREFIX/bin/python3.5
-    cachedir: .cache
+    cachedir: .pytest_cache
     rootdir: $REGENDOC_TMPDIR, inifile:
     collecting ... collected 2 items
-    
-    test_appsetup.py::test_smtp_exists[smtp.gmail.com] PASSED
-    test_appsetup.py::test_smtp_exists[mail.python.org] PASSED
-    
-    ======= 2 passed in 0.12 seconds ========
+
+    test_appsetup.py::test_smtp_exists[smtp.gmail.com] PASSED            [ 50%]
+    test_appsetup.py::test_smtp_exists[mail.python.org] PASSED           [100%]
+
+    ========================= 2 passed in 0.12 seconds =========================
 
 Due to the parametrization of ``smtp`` the test will run twice with two
 different ``App`` instances and respective smtp servers.  There is no
 need for the ``app`` fixture to be aware of the ``smtp`` parametrization
 as pytest will fully analyse the fixture dependency graph.
 
 Note, that the ``app`` fixture has a scope of ``module`` and uses a
 module-scoped ``smtp`` fixture.  The example would still work if ``smtp``
@@ -674,56 +815,56 @@ to show the setup/teardown flow::
         print ("  RUN test1 with modarg %s" % modarg)
     def test_2(otherarg, modarg):
         print ("  RUN test2 with otherarg %s and modarg %s" % (otherarg, modarg))
 
 
 Let's run the tests in verbose mode and with looking at the print-output::
 
     $ pytest -v -s test_module.py
-    ======= test session starts ========
+    =========================== test session starts ============================
     platform linux -- Python 3.x.y, pytest-3.x.y, py-1.x.y, pluggy-0.x.y -- $PYTHON_PREFIX/bin/python3.5
-    cachedir: .cache
+    cachedir: .pytest_cache
     rootdir: $REGENDOC_TMPDIR, inifile:
     collecting ... collected 8 items
-    
+
     test_module.py::test_0[1]   SETUP otherarg 1
       RUN test0 with otherarg 1
     PASSED  TEARDOWN otherarg 1
-    
+
     test_module.py::test_0[2]   SETUP otherarg 2
       RUN test0 with otherarg 2
     PASSED  TEARDOWN otherarg 2
-    
+
     test_module.py::test_1[mod1]   SETUP modarg mod1
       RUN test1 with modarg mod1
     PASSED
-    test_module.py::test_2[1-mod1]   SETUP otherarg 1
+    test_module.py::test_2[mod1-1]   SETUP otherarg 1
       RUN test2 with otherarg 1 and modarg mod1
     PASSED  TEARDOWN otherarg 1
-    
-    test_module.py::test_2[2-mod1]   SETUP otherarg 2
+
+    test_module.py::test_2[mod1-2]   SETUP otherarg 2
       RUN test2 with otherarg 2 and modarg mod1
     PASSED  TEARDOWN otherarg 2
-    
+
     test_module.py::test_1[mod2]   TEARDOWN modarg mod1
       SETUP modarg mod2
       RUN test1 with modarg mod2
     PASSED
-    test_module.py::test_2[1-mod2]   SETUP otherarg 1
+    test_module.py::test_2[mod2-1]   SETUP otherarg 1
       RUN test2 with otherarg 1 and modarg mod2
     PASSED  TEARDOWN otherarg 1
-    
-    test_module.py::test_2[2-mod2]   SETUP otherarg 2
+
+    test_module.py::test_2[mod2-2]   SETUP otherarg 2
       RUN test2 with otherarg 2 and modarg mod2
     PASSED  TEARDOWN otherarg 2
       TEARDOWN modarg mod2
-    
-    
-    ======= 8 passed in 0.12 seconds ========
+
+
+    ========================= 8 passed in 0.12 seconds =========================
 
 You can see that the parametrized module-scoped ``modarg`` resource caused an
 ordering of test execution that lead to the fewest possible "active" resources.
 The finalizer for the ``mod1`` parametrized resource was executed before the
 ``mod2`` resource was setup.
 
 In particular notice that test_0 is completely independent and finishes first.
 Then test_1 is executed with ``mod1``, then test_2 with ``mod1``, then test_1
@@ -776,24 +917,26 @@ and declare its use in a test module via
             assert os.listdir(os.getcwd()) == []
 
 Due to the ``usefixtures`` marker, the ``cleandir`` fixture
 will be required for the execution of each test method, just as if
 you specified a "cleandir" function argument to each of them.  Let's run it
 to verify our fixture is activated and the tests pass::
 
     $ pytest -q
-    ..
+    ..                                                                   [100%]
     2 passed in 0.12 seconds
 
 You can specify multiple fixtures like this:
 
 .. code-block:: python
 
     @pytest.mark.usefixtures("cleandir", "anotherfixture")
+    def test():
+        ...
 
 and you may specify fixture usage at the test module level, using
 a generic feature of the mark mechanism:
 
 .. code-block:: python
 
     pytestmark = pytest.mark.usefixtures("cleandir")
 
@@ -857,17 +1000,17 @@ self-contained implementation of this id
 The class-level ``transact`` fixture is marked with *autouse=true*
 which implies that all test methods in the class will use this fixture
 without a need to state it in the test function signature or with a
 class-level ``usefixtures`` decorator.
 
 If we run it, we get two passing tests::
 
     $ pytest -q
-    ..
+    ..                                                                   [100%]
     2 passed in 0.12 seconds
 
 Here is how autouse fixtures work in other scopes:
 
 - autouse fixtures obey the ``scope=`` keyword-argument: if an autouse fixture
   has ``scope='session'`` it will only be run once, no matter where it is
   defined. ``scope='class'`` means it will be run once per class, etc.
 
--- a/third_party/python/pytest/doc/en/funcarg_compare.rst
+++ b/third_party/python/pytest/doc/en/funcarg_compare.rst
@@ -1,109 +1,109 @@
 :orphan:
 
 .. _`funcargcompare`:
 
 pytest-2.3: reasoning for fixture/funcarg evolution
 =============================================================
 
-**Target audience**: Reading this document requires basic knowledge of 
-python testing, xUnit setup methods and the (previous) basic pytest 
-funcarg mechanism, see http://pytest.org/2.2.4/funcargs.html 
+**Target audience**: Reading this document requires basic knowledge of
+python testing, xUnit setup methods and the (previous) basic pytest
+funcarg mechanism, see http://pytest.org/2.2.4/funcargs.html
 If you are new to pytest, then you can simply ignore this
 section and read the other sections.
 
 .. currentmodule:: _pytest
 
 Shortcomings of the previous ``pytest_funcarg__`` mechanism
 --------------------------------------------------------------
 
 The pre pytest-2.3 funcarg mechanism calls a factory each time a
 funcarg for a test function is required.  If a factory wants to
-re-use a resource across different scopes, it often used 
-the ``request.cached_setup()`` helper to manage caching of 
-resources.  Here is a basic example how we could implement 
+re-use a resource across different scopes, it often used
+the ``request.cached_setup()`` helper to manage caching of
+resources.  Here is a basic example how we could implement
 a per-session Database object::
 
-    # content of conftest.py 
+    # content of conftest.py
     class Database(object):
         def __init__(self):
             print ("database instance created")
         def destroy(self):
             print ("database instance destroyed")
 
     def pytest_funcarg__db(request):
-        return request.cached_setup(setup=DataBase, 
+        return request.cached_setup(setup=DataBase,
                                     teardown=lambda db: db.destroy,
                                     scope="session")
 
 There are several limitations and difficulties with this approach:
 
 1. Scoping funcarg resource creation is not straight forward, instead one must
    understand the intricate cached_setup() method mechanics.
 
-2. parametrizing the "db" resource is not straight forward: 
+2. parametrizing the "db" resource is not straight forward:
    you need to apply a "parametrize" decorator or implement a
-   :py:func:`~hookspec.pytest_generate_tests` hook 
+   :py:func:`~hookspec.pytest_generate_tests` hook
    calling :py:func:`~python.Metafunc.parametrize` which
-   performs parametrization at the places where the resource 
-   is used.  Moreover, you need to modify the factory to use an 
-   ``extrakey`` parameter containing ``request.param`` to the 
+   performs parametrization at the places where the resource
+   is used.  Moreover, you need to modify the factory to use an
+   ``extrakey`` parameter containing ``request.param`` to the
    :py:func:`~python.Request.cached_setup` call.
 
 3. Multiple parametrized session-scoped resources will be active
    at the same time, making it hard for them to affect global state
    of the application under test.
 
 4. there is no way how you can make use of funcarg factories
    in xUnit setup methods.
 
-5. A non-parametrized fixture function cannot use a parametrized 
+5. A non-parametrized fixture function cannot use a parametrized
    funcarg resource if it isn't stated in the test function signature.
 
 All of these limitations are addressed with pytest-2.3 and its
 improved :ref:`fixture mechanism <fixture>`.
 
 
 Direct scoping of fixture/funcarg factories
 --------------------------------------------------------
 
 Instead of calling cached_setup() with a cache scope, you can use the
 :ref:`@pytest.fixture <pytest.fixture>` decorator and directly state
 the scope::
 
     @pytest.fixture(scope="session")
     def db(request):
-        # factory will only be invoked once per session - 
+        # factory will only be invoked once per session -
         db = DataBase()
         request.addfinalizer(db.destroy)  # destroy when session is finished
         return db
 
 This factory implementation does not need to call ``cached_setup()`` anymore
-because it will only be invoked once per session.  Moreover, the 
+because it will only be invoked once per session.  Moreover, the
 ``request.addfinalizer()`` registers a finalizer according to the specified
 resource scope on which the factory function is operating.
 
 
-Direct parametrization of funcarg resource factories 
+Direct parametrization of funcarg resource factories
 ----------------------------------------------------------
 
 Previously, funcarg factories could not directly cause parametrization.
 You needed to specify a ``@parametrize`` decorator on your test function
 or implement a ``pytest_generate_tests`` hook to perform
 parametrization, i.e. calling a test multiple times with different value
 sets.  pytest-2.3 introduces a decorator for use on the factory itself::
 
     @pytest.fixture(params=["mysql", "pg"])
     def db(request):
         ... # use request.param
 
-Here the factory will be invoked twice (with the respective "mysql" 
-and "pg" values set as ``request.param`` attributes) and all of 
-the tests requiring "db" will run twice as well.  The "mysql" and 
+Here the factory will be invoked twice (with the respective "mysql"
+and "pg" values set as ``request.param`` attributes) and all of
+the tests requiring "db" will run twice as well.  The "mysql" and
 "pg" values will also be used for reporting the test-invocation variants.
 
 This new way of parametrizing funcarg factories should in many cases
 allow to re-use already written factories because effectively
 ``request.param`` was already used when test functions/classes were
 parametrized via
 :py:func:`~_pytest.python.Metafunc.parametrize(indirect=True)` calls.
 
@@ -131,17 +131,17 @@ denotes the name under which the resourc
 argument::
 
     @pytest.fixture()
     def db(request):
         ...
 
 The name under which the funcarg resource can be requested is ``db``.
 
-You can still use the "old" non-decorator way of specifying funcarg factories 
+You can still use the "old" non-decorator way of specifying funcarg factories
 aka::
 
     def pytest_funcarg__db(request):
         ...
 
 
 But it is then not possible to define scoping and parametrization.
 It is thus recommended to use the factory decorator.
@@ -151,20 +151,20 @@ solving per-session setup / autouse fixt
 --------------------------------------------------------------
 
 pytest for a long time offered a pytest_configure and a pytest_sessionstart
 hook which are often used to setup global resources.  This suffers from
 several problems:
 
 1. in distributed testing the master process would setup test resources
    that are never needed because it only co-ordinates the test run
-   activities of the slave processes.  
+   activities of the slave processes.
 
-2. if you only perform a collection (with "--collect-only") 
-   resource-setup will still be executed.  
+2. if you only perform a collection (with "--collect-only")
+   resource-setup will still be executed.
 
 3. If a pytest_sessionstart is contained in some subdirectories
    conftest.py file, it will not be called.  This stems from the
    fact that this hook is actually used for reporting, in particular
    the test-header with platform/custom information.
 
 Moreover, it was not easy to define a scoped setup from plugins or
 conftest files other than to implement a ``pytest_runtest_setup()`` hook
@@ -189,30 +189,28 @@ overview of fixture management in your p
 
 .. _`compatibility notes`:
 
 .. _`funcargscompat`:
 
 Conclusion and compatibility notes
 ---------------------------------------------------------
 
-**funcargs** were originally introduced to pytest-2.0.  In pytest-2.3 
+**funcargs** were originally introduced to pytest-2.0.  In pytest-2.3
 the mechanism was extended and refined and is now described as
 fixtures:
 
-* previously funcarg factories were specified with a special 
-  ``pytest_funcarg__NAME`` prefix instead of using the 
+* previously funcarg factories were specified with a special
+  ``pytest_funcarg__NAME`` prefix instead of using the
   ``@pytest.fixture`` decorator.
 
 * Factories received a ``request`` object which managed caching through
-  ``request.cached_setup()`` calls and allowed using other funcargs via 
-  ``request.getfuncargvalue()`` calls.  These intricate APIs made it hard 
+  ``request.cached_setup()`` calls and allowed using other funcargs via
+  ``request.getfuncargvalue()`` calls.  These intricate APIs made it hard
   to do proper parametrization and implement resource caching. The
   new :py:func:`pytest.fixture` decorator allows to declare the scope
   and let pytest figure things out for you.
 
 * if you used parametrization and funcarg factories which made use of
   ``request.cached_setup()`` it is recommended to invest a few minutes
   and simplify your fixture function code to use the :ref:`@pytest.fixture`
-  decorator instead.  This will also allow to take advantage of 
+  decorator instead.  This will also allow to take advantage of
   the automatic per-resource grouping of tests.
-
-
--- a/third_party/python/pytest/doc/en/funcargs.rst
+++ b/third_party/python/pytest/doc/en/funcargs.rst
@@ -6,9 +6,8 @@ funcargs: resource injection and paramet
 pytest-2.3 introduces major refinements to fixture management
 of which the funcarg mechanism introduced with pytest-2.0 remains
 a core part.  The documentation has been refactored as well
 and you can read on here:
 
 - :ref:`fixtures`
 - :ref:`parametrize`
 - :ref:`funcargcompare`
-
deleted file mode 100644
--- a/third_party/python/pytest/doc/en/genapi.py
+++ /dev/null
@@ -1,41 +0,0 @@
-import textwrap
-import inspect
-
-class Writer(object):
-    def __init__(self, clsname):
-        self.clsname = clsname
-
-    def __enter__(self):
-        self.file = open("%s.api" % self.clsname, "w")
-        return self
-
-    def __exit__(self, *args):
-        self.file.close()
-        print "wrote", self.file.name
-
-    def line(self, line):
-        self.file.write(line+"\n")
-
-    def docmethod(self, method):
-        doc = " ".join(method.__doc__.split())
-        indent = "         "
-        w = textwrap.TextWrapper(initial_indent=indent,
-                                 subsequent_indent=indent)
-
-        spec = inspect.getargspec(method)
-        del spec.args[0]
-        self.line(".. py:method:: " + method.__name__ +
-                  inspect.formatargspec(*spec))
-        self.line("")
-        self.line(w.fill(doc))
-        self.line("")
-
-def pytest_funcarg__a(request):
-    with Writer("request") as writer:
-        writer.docmethod(request.getfixturevalue)
-        writer.docmethod(request.cached_setup)
-        writer.docmethod(request.addfinalizer)
-        writer.docmethod(request.applymarker)
-
-def test_hello(a):
-    pass
--- a/third_party/python/pytest/doc/en/getting-started.rst
+++ b/third_party/python/pytest/doc/en/getting-started.rst
@@ -1,200 +1,183 @@
 Installation and Getting Started
 ===================================
 
-**Pythons**: Python 2.6,2.7,3.3,3.4,3.5,3.6 Jython, PyPy-2.3
+**Pythons**: Python 2.7, 3.4, 3.5, 3.6, Jython, PyPy-2.3
 
 **Platforms**: Unix/Posix and Windows
 
-**PyPI package name**: `pytest <http://pypi.python.org/pypi/pytest>`_
+**PyPI package name**: `pytest <https://pypi.org/project/pytest/>`_
 
-**dependencies**: `py <http://pypi.python.org/pypi/py>`_,
-`colorama (Windows) <http://pypi.python.org/pypi/colorama>`_,
-`argparse (py26) <http://pypi.python.org/pypi/argparse>`_,
-`ordereddict (py26) <http://pypi.python.org/pypi/ordereddict>`_.
+**Dependencies**: `py <https://pypi.org/project/py/>`_,
+`colorama (Windows) <https://pypi.org/project/colorama/>`_,
 
-**documentation as PDF**: `download latest <https://media.readthedocs.org/pdf/pytest/latest/pytest.pdf>`_
+**Documentation as PDF**: `download latest <https://media.readthedocs.org/pdf/pytest/latest/pytest.pdf>`_
+
+``pytest`` is a framework that makes building simple and scalable tests easy. Tests are expressive and readable—no boilerplate code required. Get started in minutes with a small unit test or complex functional test for your application or library.
 
 .. _`getstarted`:
-.. _installation:
+.. _`installation`:
 
-Installation
+Install ``pytest``
 ----------------------------------------
 
-Installation::
+1. Run the following command in your command line::
 
     pip install -U pytest
 
-To check your installation has installed the correct version::
+2. Check that you installed the correct version::
 
     $ pytest --version
     This is pytest version 3.x.y, imported from $PYTHON_PREFIX/lib/python3.5/site-packages/pytest.py
 
 .. _`simpletest`:
 
-Our first test run
+Create your first test
 ----------------------------------------------------------
 
-Let's create a first test file with a simple test function::
+Create a simple test function with just four lines of code::
 
     # content of test_sample.py
     def func(x):
         return x + 1
 
     def test_answer():
         assert func(3) == 5
 
-That's it. You can execute the test function now::
+That’s it. You can now execute the test function::
 
     $ pytest
-    ======= test session starts ========
+    =========================== test session starts ============================
     platform linux -- Python 3.x.y, pytest-3.x.y, py-1.x.y, pluggy-0.x.y
     rootdir: $REGENDOC_TMPDIR, inifile:
     collected 1 item
-    
-    test_sample.py F
-    
-    ======= FAILURES ========
-    _______ test_answer ________
-    
+
+    test_sample.py F                                                     [100%]
+
+    ================================= FAILURES =================================
+    _______________________________ test_answer ________________________________
+
         def test_answer():
     >       assert func(3) == 5
     E       assert 4 == 5
     E        +  where 4 = func(3)
-    
+
     test_sample.py:5: AssertionError
-    ======= 1 failed in 0.12 seconds ========
+    ========================= 1 failed in 0.12 seconds =========================
 
-We got a failure report because our little ``func(3)`` call did not return ``5``.
+This test returns a failure report because ``func(3)`` does not return ``5``.
 
 .. note::
 
-    You can simply use the ``assert`` statement for asserting test
-    expectations.  pytest's :ref:`assert introspection` will intelligently
-    report intermediate values of the assert expression freeing
-    you from the need to learn the many names of `JUnit legacy methods`_.
+    You can use the ``assert`` statement to verify test expectations. pytest’s `Advanced assertion introspection <http://docs.python.org/reference/simple_stmts.html#the-assert-statement>`_ will intelligently report intermediate values of the assert expression so you can avoid the many names `of JUnit legacy methods <http://docs.python.org/library/unittest.html#test-cases>`_.
 
-.. _`JUnit legacy methods`: http://docs.python.org/library/unittest.html#test-cases
-
-.. _`assert statement`: http://docs.python.org/reference/simple_stmts.html#the-assert-statement
-
-Running multiple tests
+Run multiple tests
 ----------------------------------------------------------
 
-``pytest`` will run all files in the current directory and its subdirectories of the form test_*.py or \*_test.py. More generally, it follows :ref:`standard test discovery rules <test discovery>`.
+``pytest`` will run all files of the form test_*.py or \*_test.py in the current directory and its subdirectories. More generally, it follows :ref:`standard test discovery rules <test discovery>`.
 
 
-Asserting that a certain exception is raised
+Assert that a certain exception is raised
 --------------------------------------------------------------
 
-If you want to assert that some code raises an exception you can
-use the ``raises`` helper::
+Use the ``raises`` helper to assert that some code raises an exception::
 
     # content of test_sysexit.py
     import pytest
     def f():
         raise SystemExit(1)
 
     def test_mytest():
         with pytest.raises(SystemExit):
             f()
 
-Running it with, this time in "quiet" reporting mode::
+Execute the test function with “quiet” reporting mode::
 
     $ pytest -q test_sysexit.py
-    .
+    .                                                                    [100%]
     1 passed in 0.12 seconds
 
-Grouping multiple tests in a class
+Group multiple tests in a class
 --------------------------------------------------------------
 
-Once you start to have more than a few tests it often makes sense
-to group tests logically, in classes and modules.  Let's write a class
-containing two tests::
+Once you develop multiple tests, you may want to group them into a class. pytest makes it easy to create a class containing more than one test::
 
     # content of test_class.py
     class TestClass(object):
         def test_one(self):
             x = "this"
             assert 'h' in x
 
         def test_two(self):
             x = "hello"
             assert hasattr(x, 'check')
 
-The two tests are found because of the standard :ref:`test discovery`.
-There is no need to subclass anything.  We can simply
-run the module by passing its filename::
+``pytest`` discovers all tests following its :ref:`Conventions for Python test discovery <test discovery>`, so it finds both ``test_`` prefixed functions. There is no need to subclass anything. We can simply run the module by passing its filename::
 
     $ pytest -q test_class.py
-    .F
-    ======= FAILURES ========
-    _______ TestClass.test_two ________
-    
+    .F                                                                   [100%]
+    ================================= FAILURES =================================
+    ____________________________ TestClass.test_two ____________________________
+
     self = <test_class.TestClass object at 0xdeadbeef>
-    
+
         def test_two(self):
             x = "hello"
     >       assert hasattr(x, 'check')
     E       AssertionError: assert False
     E        +  where False = hasattr('hello', 'check')
-    
+
     test_class.py:8: AssertionError
     1 failed, 1 passed in 0.12 seconds
 
-The first test passed, the second failed. Again we can easily see
-the intermediate values used in the assertion, helping us to
-understand the reason for the failure.
+The first test passed and the second failed. You can easily see the intermediate values in the assertion to help you understand the reason for the failure.
 
-Going functional: requesting a unique temporary directory
+Request a unique temporary directory for functional tests
 --------------------------------------------------------------
 
-For functional tests one often needs to create some files
-and pass them to application objects.  pytest provides
-:ref:`builtinfixtures` which allow to request arbitrary
-resources, for example a unique temporary directory::
+``pytest`` provides `Builtin fixtures/function arguments <https://docs.pytest.org/en/latest/builtin.html#builtinfixtures>`_ to request arbitrary resources, like a unique temporary directory::
 
     # content of test_tmpdir.py
     def test_needsfiles(tmpdir):
         print (tmpdir)
         assert 0
 
-We list the name ``tmpdir`` in the test function signature and
-``pytest`` will lookup and call a fixture factory to create the resource
-before performing the test function call.  Let's just run it::
+List the name ``tmpdir`` in the test function signature and ``pytest`` will lookup and call a fixture factory to create the resource before performing the test function call. Before the test runs, ``pytest`` creates a unique-per-test-invocation temporary directory::
 
     $ pytest -q test_tmpdir.py
-    F
-    ======= FAILURES ========
-    _______ test_needsfiles ________
-    
+    F                                                                    [100%]
+    ================================= FAILURES =================================
+    _____________________________ test_needsfiles ______________________________
+
     tmpdir = local('PYTEST_TMPDIR/test_needsfiles0')
-    
+
         def test_needsfiles(tmpdir):
             print (tmpdir)
     >       assert 0
     E       assert 0
-    
+
     test_tmpdir.py:3: AssertionError
     --------------------------- Captured stdout call ---------------------------
     PYTEST_TMPDIR/test_needsfiles0
     1 failed in 0.12 seconds
 
-Before the test runs, a unique-per-test-invocation temporary directory
-was created.  More info at :ref:`tmpdir handling`.
+More info on tmpdir handling is available at :ref:`Temporary directories and files <tmpdir handling>`.
 
-You can find out what kind of builtin :ref:`fixtures` exist by typing::
+Find out what kind of builtin :ref:`pytest fixtures <fixtures>` exist with the command::
 
     pytest --fixtures   # shows builtin and custom fixtures
 
-Where to go next
+Note that this command omits fixtures with leading ``_`` unless the ``-v`` option is added.
+
+Continue reading
 -------------------------------------
 
-Here are a few suggestions where to go next:
+Check out additional pytest resources to help you customize tests for your unique workflow:
 
-* :ref:`cmdline` for command line invocation examples
-* :ref:`good practices <goodpractices>` for virtualenv, test layout
-* :ref:`existingtestsuite` for working with pre-existing tests
-* :ref:`fixtures` for providing a functional baseline to your tests
-* :ref:`plugins` managing and writing plugins
+* ":ref:`cmdline`" for command line invocation examples
+* ":ref:`existingtestsuite`" for working with pre-existing tests
+* ":ref:`mark`" for information on the ``pytest.mark`` mechanism
+* ":ref:`fixtures`" for providing a functional baseline to your tests
+* ":ref:`plugins`" for managing and writing plugins
+* ":ref:`goodpractices`" for virtualenv and test layouts
 
 .. include:: links.inc
--- a/third_party/python/pytest/doc/en/goodpractices.rst
+++ b/third_party/python/pytest/doc/en/goodpractices.rst
@@ -140,17 +140,17 @@ Note that this layout also works in conj
     files from your directories it should just work on Python3.3 and above.  From
     "inlined tests", however, you will need to use absolute imports for
     getting at your application code.
 
 .. _`test package name`:
 
 .. note::
 
-    If ``pytest`` finds a "a/b/test_module.py" test file while
+    If ``pytest`` finds an "a/b/test_module.py" test file while
     recursing into the filesystem it determines the import name
     as follows:
 
     * determine ``basedir``: this is the first "upward" (towards the root)
       directory not containing an ``__init__.py``.  If e.g. both ``a``
       and ``b`` contain an ``__init__.py`` file then the parent directory
       of ``a`` will become the ``basedir``.
 
@@ -163,23 +163,23 @@ Note that this layout also works in conj
       names map directly to the import names.
 
     The reason for this somewhat evolved importing technique is
     that in larger projects multiple test modules might import
     from each other and thus deriving a canonical import name helps
     to avoid surprises such as a test module getting imported twice.
 
 
-.. _`virtualenv`: http://pypi.python.org/pypi/virtualenv
+.. _`virtualenv`: https://pypi.org/project/virtualenv/
 .. _`buildout`: http://www.buildout.org/
-.. _pip: http://pypi.python.org/pypi/pip
+.. _pip: https://pypi.org/project/pip/
 
 .. _`use tox`:
 
-Tox
+tox
 ------
 
 For development, we recommend to use virtualenv_ environments and pip_
 for installing your application and any dependencies
 as well as the ``pytest`` package itself. This ensures your code and
 dependencies are isolated from the system Python installation.
 
 You can then install your package in "editable" mode::
@@ -189,40 +189,40 @@ You can then install your package in "ed
 which lets you change your source code (both tests and application) and rerun tests at will.
 This is similar to running `python setup.py develop` or `conda develop` in that it installs
 your package using a symlink to your development code.
 
 Once you are done with your work and want to make sure that your actual
 package passes all tests you may want to look into `tox`_, the
 virtualenv test automation tool and its `pytest support
 <https://tox.readthedocs.io/en/latest/example/pytest.html>`_.
-Tox helps you to setup virtualenv environments with pre-defined
+tox helps you to setup virtualenv environments with pre-defined
 dependencies and then executing a pre-configured test command with
 options.  It will run tests against the installed package and not
 against your source code checkout, helping to detect packaging
 glitches.
 
 
 Integrating with setuptools / ``python setup.py test`` / ``pytest-runner``
 --------------------------------------------------------------------------
 
 You can integrate test runs into your setuptools based project
-with the `pytest-runner <https://pypi.python.org/pypi/pytest-runner>`_ plugin.
+with the `pytest-runner <https://pypi.org/project/pytest-runner/>`_ plugin.
 
 Add this to ``setup.py`` file:
 
 .. code-block:: python
 
     from setuptools import setup
 
     setup(
-        #...,
-        setup_requires=['pytest-runner', ...],
-        tests_require=['pytest', ...],
-        #...,
+        # ...,
+        setup_requires=["pytest-runner", ...],
+        tests_require=["pytest", ...],
+        # ...,
     )
 
 
 And create an alias into ``setup.cfg`` file:
 
 
 .. code-block:: ini
 
@@ -258,35 +258,37 @@ your own setuptools Test command for inv
 .. code-block:: python
 
     import sys
 
     from setuptools.command.test import test as TestCommand
 
 
     class PyTest(TestCommand):
-        user_options = [('pytest-args=', 'a', "Arguments to pass to pytest")]
+        user_options = [("pytest-args=", "a", "Arguments to pass to pytest")]
 
         def initialize_options(self):
             TestCommand.initialize_options(self)
-            self.pytest_args = ''
+            self.pytest_args = ""
 
         def run_tests(self):
             import shlex
-            #import here, cause outside the eggs aren't loaded
+
+            # import here, cause outside the eggs aren't loaded
             import pytest
+
             errno = pytest.main(shlex.split(self.pytest_args))
             sys.exit(errno)
 
 
     setup(
-        #...,
-        tests_require=['pytest'],
-        cmdclass = {'test': PyTest},
-        )
+        # ...,
+        tests_require=["pytest"],
+        cmdclass={"test": PyTest},
+    )
 
 Now if you run::
 
     python setup.py test
 
 this will download ``pytest`` if needed and then run your tests
 as you would expect it to. You can pass a single string of arguments
 using the ``--pytest-args`` or ``-a`` command-line option. For example::
--- a/third_party/python/pytest/doc/en/index.rst
+++ b/third_party/python/pytest/doc/en/index.rst
@@ -12,57 +12,58 @@ scales to support complex functional tes
 An example of a simple test:
 
 .. code-block:: python
 
     # content of test_sample.py
     def inc(x):
         return x + 1
 
+
     def test_answer():
         assert inc(3) == 5
 
 
 To execute it::
 
     $ pytest
-    ======= test session starts ========
+    =========================== test session starts ============================
     platform linux -- Python 3.x.y, pytest-3.x.y, py-1.x.y, pluggy-0.x.y
     rootdir: $REGENDOC_TMPDIR, inifile:
     collected 1 item
-    
-    test_sample.py F
-    
-    ======= FAILURES ========
-    _______ test_answer ________
-    
+
+    test_sample.py F                                                     [100%]
+
+    ================================= FAILURES =================================
+    _______________________________ test_answer ________________________________
+
         def test_answer():
     >       assert inc(3) == 5
     E       assert 4 == 5
     E        +  where 4 = inc(3)
-    
-    test_sample.py:5: AssertionError
-    ======= 1 failed in 0.12 seconds ========
+
+    test_sample.py:6: AssertionError
+    ========================= 1 failed in 0.12 seconds =========================
 
 Due to ``pytest``'s detailed assertion introspection, only plain ``assert`` statements are used.
 See :ref:`Getting Started <getstarted>` for more examples.
 
 
 Features
 --------
 
 - Detailed info on failing :ref:`assert statements <assert>` (no need to remember ``self.assert*`` names);
 
 - :ref:`Auto-discovery <test discovery>` of test modules and functions;
 
 - :ref:`Modular fixtures <fixture>` for managing small or parametrized long-lived test resources;
 
 - Can run :ref:`unittest <unittest>` (including trial) and :ref:`nose <noseintegration>` test suites out of the box;
 
-- Python2.6+, Python3.3+, PyPy-2.3, Jython-2.5 (untested);
+- Python 2.7, Python 3.4+, PyPy 2.3, Jython 2.5 (untested);
 
 - Rich plugin architecture, with over 315+ `external plugins <http://plugincompat.herokuapp.com>`_ and thriving community;
 
 
 Documentation
 -------------
 
 Please see :ref:`Contents <toc>` for full documentation, including installation, tutorials and PDF documents.
--- a/third_party/python/pytest/doc/en/links.inc
+++ b/third_party/python/pytest/doc/en/links.inc
@@ -2,20 +2,20 @@
 .. _`skipping plugin`: plugin/skipping.html
 .. _`funcargs mechanism`: funcargs.html
 .. _`doctest.py`: http://docs.python.org/library/doctest.html
 .. _`xUnit style setup`: xunit_setup.html
 .. _`pytest_nose`: plugin/nose.html
 .. _`reStructured Text`: http://docutils.sourceforge.net
 .. _`Python debugger`: http://docs.python.org/lib/module-pdb.html
 .. _nose: https://nose.readthedocs.io/en/latest/
-.. _pytest: http://pypi.python.org/pypi/pytest
+.. _pytest: https://pypi.org/project/pytest/
 .. _mercurial: http://mercurial.selenic.com/wiki/
-.. _`setuptools`: http://pypi.python.org/pypi/setuptools
+.. _`setuptools`: https://pypi.org/project/setuptools/
 .. _`easy_install`:
 .. _`distribute docs`:
-.. _`distribute`: http://pypi.python.org/pypi/distribute
-.. _`pip`: http://pypi.python.org/pypi/pip
-.. _`virtualenv`: http://pypi.python.org/pypi/virtualenv
+.. _`distribute`: https://pypi.org/project/distribute/
+.. _`pip`: https://pypi.org/project/pip/
+.. _`virtualenv`: https://pypi.org/project/virtualenv/
 .. _hudson: http://hudson-ci.org/
 .. _jenkins: http://jenkins-ci.org/
 .. _tox: http://testrun.org/tox
 .. _pylib: https://py.readthedocs.io/en/latest/
new file mode 100644
--- /dev/null
+++ b/third_party/python/pytest/doc/en/logging.rst
@@ -0,0 +1,245 @@
+.. _logging:
+
+Logging
+-------
+
+.. versionadded:: 3.3
+.. versionchanged:: 3.4
+
+pytest captures log messages of level ``WARNING`` or above automatically and displays them in their own section
+for each failed test in the same manner as captured stdout and stderr.
+
+Running without options::
+
+    pytest
+
+Shows failed tests like so::
+
+    ----------------------- Captured stdlog call ----------------------
+    test_reporting.py    26 WARNING  text going to logger
+    ----------------------- Captured stdout call ----------------------
+    text going to stdout
+    ----------------------- Captured stderr call ----------------------
+    text going to stderr
+    ==================== 2 failed in 0.02 seconds =====================
+
+By default each captured log message shows the module, line number, log level
+and message.
+
+If desired the log and date format can be specified to
+anything that the logging module supports by passing specific formatting options::
+
+    pytest --log-format="%(asctime)s %(levelname)s %(message)s" \
+            --log-date-format="%Y-%m-%d %H:%M:%S"
+
+Shows failed tests like so::
+
+    ----------------------- Captured stdlog call ----------------------
+    2010-04-10 14:48:44 WARNING text going to logger
+    ----------------------- Captured stdout call ----------------------
+    text going to stdout
+    ----------------------- Captured stderr call ----------------------
+    text going to stderr
+    ==================== 2 failed in 0.02 seconds =====================
+
+These options can also be customized through ``pytest.ini`` file:
+
+.. code-block:: ini
+
+    [pytest]
+    log_format = %(asctime)s %(levelname)s %(message)s
+    log_date_format = %Y-%m-%d %H:%M:%S
+
+Further it is possible to disable reporting of captured content (stdout,
+stderr and logs) on failed tests completely with::
+
+    pytest --show-capture=no
+
+
+caplog fixture
+^^^^^^^^^^^^^^
+
+Inside tests it is possible to change the log level for the captured log
+messages.  This is supported by the ``caplog`` fixture::
+
+    def test_foo(caplog):
+        caplog.set_level(logging.INFO)
+        pass
+
+By default the level is set on the root logger,
+however as a convenience it is also possible to set the log level of any
+logger::
+
+    def test_foo(caplog):
+        caplog.set_level(logging.CRITICAL, logger='root.baz')
+        pass
+
+The log levels set are restored automatically at the end of the test.
+
+It is also possible to use a context manager to temporarily change the log
+level inside a ``with`` block::
+
+    def test_bar(caplog):
+        with caplog.at_level(logging.INFO):
+            pass
+
+Again, by default the level of the root logger is affected but the level of any
+logger can be changed instead with::
+
+    def test_bar(caplog):
+        with caplog.at_level(logging.CRITICAL, logger='root.baz'):
+            pass
+
+Lastly all the logs sent to the logger during the test run are made available on
+the fixture in the form of both the ``logging.LogRecord`` instances and the final log text.
+This is useful for when you want to assert on the contents of a message::
+
+    def test_baz(caplog):
+        func_under_test()
+        for record in caplog.records:
+            assert record.levelname != 'CRITICAL'
+        assert 'wally' not in caplog.text
+
+For all the available attributes of the log records see the
+``logging.LogRecord`` class.
+
+You can also resort to ``record_tuples`` if all you want to do is to ensure,
+that certain messages have been logged under a given logger name with a given
+severity and message::
+
+    def test_foo(caplog):
+        logging.getLogger().info('boo %s', 'arg')
+
+        assert caplog.record_tuples == [
+            ('root', logging.INFO, 'boo arg'),
+        ]
+
+You can call ``caplog.clear()`` to reset the captured log records in a test::
+
+    def test_something_with_clearing_records(caplog):
+        some_method_that_creates_log_records()
+        caplog.clear()
+        your_test_method()
+        assert ['Foo'] == [rec.message for rec in caplog.records]
+
+
+The ``caplog.records`` attribute contains records from the current stage only, so
+inside the ``setup`` phase it contains only setup logs, same with the ``call`` and
+``teardown`` phases.
+
+To access logs from other stages, use the ``caplog.get_records(when)`` method. As an example,
+if you want to make sure that tests which use a certain fixture never log any warnings, you can inspect
+the records for the ``setup`` and ``call`` stages during teardown like so:
+
+.. code-block:: python
+
+
+    @pytest.fixture
+    def window(caplog):
+        window = create_window()
+        yield window
+        for when in ("setup", "call"):
+            messages = [
+                x.message for x in caplog.get_records(when) if x.level == logging.WARNING
+            ]
+            if messages:
+                pytest.fail(
+                    "warning messages encountered during testing: {}".format(messages)
+                )
+
+
+
+The full API is available at :class:`_pytest.logging.LogCaptureFixture`.
+
+
+.. _live_logs:
+
+Live Logs
+^^^^^^^^^
+
+By setting the :confval:`log_cli` configuration option to ``true``, pytest will output
+logging records as they are emitted directly into the console.
+
+You can specify the logging level for which log records with equal or higher
+level are printed to the console by passing ``--log-cli-level``. This setting
+accepts the logging level names as seen in python's documentation or an integer
+as the logging level num.
+
+Additionally, you can also specify ``--log-cli-format`` and
+``--log-cli-date-format`` which mirror and default to ``--log-format`` and
+``--log-date-format`` if not provided, but are applied only to the console
+logging handler.
+
+All of the CLI log options can also be set in the configuration INI file. The
+option names are:
+
+* ``log_cli_level``
+* ``log_cli_format``
+* ``log_cli_date_format``
+
+If you need to record the whole test suite logging calls to a file, you can pass
+``--log-file=/path/to/log/file``. This log file is opened in write mode which
+means that it will be overwritten at each run tests session.
+
+You can also specify the logging level for the log file by passing
+``--log-file-level``. This setting accepts the logging level names as seen in
+python's documentation(ie, uppercased level names) or an integer as the logging
+level num.
+
+Additionally, you can also specify ``--log-file-format`` and
+``--log-file-date-format`` which are equal to ``--log-format`` and
+``--log-date-format`` but are applied to the log file logging handler.
+
+All of the log file options can also be set in the configuration INI file. The
+option names are:
+
+* ``log_file``
+* ``log_file_level``
+* ``log_file_format``
+* ``log_file_date_format``
+
+.. _log_release_notes:
+
+Release notes
+^^^^^^^^^^^^^
+
+This feature was introduced as a drop-in replacement for the `pytest-catchlog
+<https://pypi.org/project/pytest-catchlog/>`_ plugin and they conflict
+with each other. The backward compatibility API with ``pytest-capturelog``
+has been dropped when this feature was introduced, so if for that reason you
+still need ``pytest-catchlog`` you can disable the internal feature by
+adding to your ``pytest.ini``:
+
+.. code-block:: ini
+
+   [pytest]
+       addopts=-p no:logging
+
+
+.. _log_changes_3_4:
+
+Incompatible changes in pytest 3.4
+^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+This feature was introduced in ``3.3`` and some **incompatible changes** have been
+made in ``3.4`` after community feedback:
+
+* Log levels are no longer changed unless explicitly requested by the :confval:`log_level` configuration
+  or ``--log-level`` command-line options. This allows users to configure logger objects themselves.
+* :ref:`Live Logs <live_logs>` is now disabled by default and can be enabled setting the
+  :confval:`log_cli` configuration option to ``true``. When enabled, the verbosity is increased so logging for each
+  test is visible.
+* :ref:`Live Logs <live_logs>` are now sent to ``sys.stdout`` and no longer require the ``-s`` command-line option
+  to work.
+
+If you want to partially restore the logging behavior of version ``3.3``, you can add this options to your ``ini``
+file:
+
+.. code-block:: ini
+
+    [pytest]
+    log_cli=true
+    log_level=NOTSET
+
+More details about the discussion that lead to this changes can be read in
+issue `#3013 <https://github.com/pytest-dev/pytest/issues/3013>`_.
--- a/third_party/python/pytest/doc/en/mark.rst
+++ b/third_party/python/pytest/doc/en/mark.rst
@@ -1,15 +1,14 @@
 
 .. _mark:
 
 Marking test functions with attributes
 =================================================================
 
-.. currentmodule:: _pytest.mark
 
 By using the ``pytest.mark`` helper you can easily set
 metadata on your test functions. There are
 some builtin markers, for example:
 
 * :ref:`skip <skip>` - always skip a test function
 * :ref:`skipif <skipif>` - skip a test function if a certain condition is met
 * :ref:`xfail <xfail>` - produce an "expected failure" outcome if a certain
@@ -22,20 +21,139 @@ to whole test classes or modules. See :r
 which also serve as documentation.
 
 .. note::
 
     Marks can only be applied to tests, having no effect on
     :ref:`fixtures <fixtures>`.
 
 
-API reference for mark related objects
-------------------------------------------------
+Raising errors on unknown marks: --strict
+-----------------------------------------
+
+When the ``--strict`` command-line flag is passed, any marks not registered in the ``pytest.ini`` file will trigger an error.
+
+Marks can be registered like this:
+
+.. code-block:: ini
+
+    [pytest]
+    markers =
+        slow
+        serial
+
+This can be used to prevent users mistyping mark names by accident. Test suites that want to enforce this
+should add ``--strict`` to ``addopts``:
+
+.. code-block:: ini
+
+    [pytest]
+    addopts = --strict
+    markers =
+        slow
+        serial
+
+
+.. `marker-iteration`
+
+Marker revamp and iteration
+---------------------------
 
-.. autoclass:: MarkGenerator
-    :members:
+.. versionadded:: 3.6
+
+pytest's marker implementation traditionally worked by simply updating the ``__dict__`` attribute of functions to add markers, in a cumulative manner. As a result of the this, markers would unintendely be passed along class hierarchies in surprising ways plus the API for retriving them was inconsistent, as markers from parameterization would be stored differently than markers applied using the ``@pytest.mark`` decorator and markers added via ``node.add_marker``.
+
+This state of things made it technically next to impossible to use data from markers correctly without having a deep understanding of the internals, leading to subtle and hard to understand bugs in more advanced usages.
+
+Depending on how a marker got declared/changed one would get either a ``MarkerInfo`` which might contain markers from sibling classes,
+``MarkDecorators`` when marks came from parameterization or from a ``node.add_marker`` call, discarding prior marks. Also ``MarkerInfo`` acts like a single mark, when it in fact represents a merged view on multiple marks with the same name.
+
+On top of that markers where not accessible the same way for modules, classes, and functions/methods,
+in fact, markers where only accessible in functions, even if they where declared on classes/modules.
+
+A new API to access markers has been introduced in pytest 3.6 in order to solve the problems with the initial design, providing :func:`_pytest.nodes.Node.iter_markers` method to iterate over markers in a consistent manner and reworking the internals, which solved great deal of problems with the initial design.
+
+
+.. _update marker code:
+
+Updating code
+~~~~~~~~~~~~~
+
+The old ``Node.get_marker(name)`` function is considered deprecated because it returns an internal ``MarkerInfo`` object
+which contains the merged name, ``*args`` and ``**kwargs`` of all the markers which apply to that node.
+
+In general there are two scenarios on how markers should be handled:
+
+1. Marks overwrite each other. Order matters but you only want to think of your mark as a single item. E.g.
+``log_level('info')`` at a module level can be overwritten by ``log_level('debug')`` for a specific test.
+
+    In this case replace use ``Node.get_closest_marker(name)``:
+
+    .. code-block:: python
 
-.. autoclass:: MarkDecorator
-    :members:
+        # replace this:
+        marker = item.get_marker("log_level")
+        if marker:
+            level = marker.args[0]
+
+        # by this:
+        marker = item.get_closest_marker("log_level")
+        if marker:
+            level = marker.args[0]
+
+2. Marks compose additive. E.g. ``skipif(condition)`` marks means you just want to evaluate all of them,
+order doesn't even matter. You probably want to think of your marks as a set here.
+
+   In this case iterate over each mark and handle their ``*args`` and ``**kwargs`` individually.
+
+   .. code-block:: python
+
+        # replace this
+        skipif = item.get_marker("skipif")
+        if skipif:
+            for condition in skipif.args:
+                # eval condition
+                ...
+
+        # by this:
+        for skipif in item.iter_markers("skipif"):
+            condition = skipif.args[0]
+            # eval condition
+
+
+If you are unsure or have any questions, please consider opening
+`an issue <https://github.com/pytest-dev/pytest/issues>`_.
 
-.. autoclass:: MarkInfo
-    :members:
+Related issues
+~~~~~~~~~~~~~~
+
+Here is a non-exhaustive list of issues fixed by the new implementation:
+
+* Marks don't pick up nested classes (`#199 <https://github.com/pytest-dev/pytest/issues/199>`_).
+
+* markers stains on all related classes (`#568 <https://github.com/pytest-dev/pytest/issues/568>`_).
+
+* combining marks - args and kwargs calculation (`#2897 <https://github.com/pytest-dev/pytest/issues/2897>`_).
+
+* ``request.node.get_marker('name')`` returns ``None`` for markers applied in classes (`#902 <https://github.com/pytest-dev/pytest/issues/902>`_).
+
+* marks applied in parametrize are stored as markdecorator (`#2400 <https://github.com/pytest-dev/pytest/issues/2400>`_).
+
+* fix marker interaction in a backward incompatible way (`#1670 <https://github.com/pytest-dev/pytest/issues/1670>`_).
 
+* Refactor marks to get rid of the current "marks transfer" mechanism (`#2363 <https://github.com/pytest-dev/pytest/issues/2363>`_).
+
+* Introduce FunctionDefinition node, use it in generate_tests (`#2522 <https://github.com/pytest-dev/pytest/issues/2522>`_).
+
+* remove named marker attributes and collect markers in items (`#891 <https://github.com/pytest-dev/pytest/issues/891>`_).
+
+* skipif mark from parametrize hides module level skipif mark (`#1540 <https://github.com/pytest-dev/pytest/issues/1540>`_).
+
+* skipif + parametrize not skipping tests (`#1296 <https://github.com/pytest-dev/pytest/issues/1296>`_).
+
+* marker transfer incompatible with inheritance (`#535 <https://github.com/pytest-dev/pytest/issues/535>`_).
+
+More details can be found in the `original PR <https://github.com/pytest-dev/pytest/pull/3317>`_.
+
+.. note::
+
+    in a future major relase of pytest we will introduce class based markers,
+    at which points markers will no longer be limited to instances of :py:class:`Mark`
--- a/third_party/python/pytest/doc/en/monkeypatch.rst
+++ b/third_party/python/pytest/doc/en/monkeypatch.rst
@@ -30,46 +30,60 @@ patch this function before calling into 
     def test_mytest(monkeypatch):
         def mockreturn(path):
             return '/abc'
         monkeypatch.setattr(os.path, 'expanduser', mockreturn)
         x = getssh()
         assert x == '/abc/.ssh'
 
 Here our test function monkeypatches ``os.path.expanduser`` and
-then calls into a function that calls it.  After the test function 
+then calls into a function that calls it.  After the test function
 finishes the ``os.path.expanduser`` modification will be undone.
 
 example: preventing "requests" from remote operations
 ------------------------------------------------------
 
 If you want to prevent the "requests" library from performing http
 requests in all your tests, you can do::
 
     # content of conftest.py
     import pytest
     @pytest.fixture(autouse=True)
     def no_requests(monkeypatch):
         monkeypatch.delattr("requests.sessions.Session.request")
 
 This autouse fixture will be executed for each test function and it
-will delete the method ``request.session.Session.request`` 
+will delete the method ``request.session.Session.request``
 so that any attempts within tests to create http requests will fail.
 
 
 .. note::
-    
+
     Be advised that it is not recommended to patch builtin functions such as ``open``,
     ``compile``, etc., because it might break pytest's internals. If that's
-    unavoidable, passing ``--tb=native``, ``--assert=plain`` and ``--capture=no`` might 
+    unavoidable, passing ``--tb=native``, ``--assert=plain`` and ``--capture=no`` might
     help although there's no guarantee.
-    
+
+.. note::
 
-Method reference of the monkeypatch fixture
--------------------------------------------
+    Mind that patching ``stdlib`` functions and some third-party libraries used by pytest
+    might break pytest itself, therefore in those cases it is recommended to use
+    :meth:`MonkeyPatch.context` to limit the patching to the block you want tested:
+
+    .. code-block:: python
+
+        import functools
+
 
-.. autoclass:: MonkeyPatch
-    :members:
+        def test_partial(monkeypatch):
+            with monkeypatch.context() as m:
+                m.setattr(functools, "partial", 3)
+                assert functools.partial == 3
+
+    See issue `#3290 <https://github.com/pytest-dev/pytest/issues/3290>`_ for details.
 
-``monkeypatch.setattr/delattr/delitem/delenv()`` all
-by default raise an Exception if the target does not exist.
-Pass ``raising=False`` if you want to skip this check.
+
+.. currentmodule:: _pytest.monkeypatch
 
+API Reference
+-------------
+
+Consult the docs for the :class:`MonkeyPatch` class.
--- a/third_party/python/pytest/doc/en/nose.rst
+++ b/third_party/python/pytest/doc/en/nose.rst
@@ -53,23 +53,20 @@ Unsupported idioms / known issues
   If you place a conftest.py file in the root directory of your project
   (as determined by pytest) pytest will run tests "nose style" against
   the code below that directory by adding it to your ``sys.path`` instead of
   running against your installed code.
 
   You may find yourself wanting to do this if you ran ``python setup.py install``
   to set up your project, as opposed to ``python setup.py develop`` or any of
   the package manager equivalents.  Installing with develop in a
-  virtual environment like Tox is recommended over this pattern.
+  virtual environment like tox is recommended over this pattern.
 
 - nose-style doctests are not collected and executed correctly,
   also doctest fixtures don't work.
 
 - no nose-configuration is recognized.
 
 - ``yield``-based methods don't support ``setup`` properly because
   the ``setup`` method is always called in the same class instance.
   There are no plans to fix this currently because ``yield``-tests
   are deprecated in pytest 3.0, with ``pytest.mark.parametrize``
   being the recommended alternative.
-
-
-
--- a/third_party/python/pytest/doc/en/parametrize.rst
+++ b/third_party/python/pytest/doc/en/parametrize.rst
@@ -6,39 +6,39 @@
 
 .. _`parametrize-basics`:
 
 Parametrizing fixtures and test functions
 ==========================================================================
 
 pytest enables test parametrization at several levels:
 
-- :py:func:`pytest.fixture` allows one to :ref:`parametrize fixture 
+- :py:func:`pytest.fixture` allows one to :ref:`parametrize fixture
   functions <fixture-parametrize>`.
 
-* `@pytest.mark.parametrize`_ allows one to define multiple sets of 
+* `@pytest.mark.parametrize`_ allows one to define multiple sets of
   arguments and fixtures at the test function or class.
 
-* `pytest_generate_tests`_ allows one to define custom parametrization 
+* `pytest_generate_tests`_ allows one to define custom parametrization
   schemes or extensions.
 
 .. _parametrizemark:
 .. _`@pytest.mark.parametrize`:
 
 
 ``@pytest.mark.parametrize``: parametrizing test functions
 ---------------------------------------------------------------------
 
 .. regendoc: wipe
 
 .. versionadded:: 2.2
 .. versionchanged:: 2.4
     Several improvements.
 
-The builtin ``pytest.mark.parametrize`` decorator enables
+The builtin :ref:`pytest.mark.parametrize ref` decorator enables
 parametrization of arguments for a test function.  Here is a typical example
 of a test function that implements checking that a certain input leads
 to an expected output::
 
     # content of test_expectation.py
     import pytest
     @pytest.mark.parametrize("test_input,expected", [
         ("3+5", 8),
@@ -48,40 +48,40 @@ to an expected output::
     def test_eval(test_input, expected):
         assert eval(test_input) == expected
 
 Here, the ``@parametrize`` decorator defines three different ``(test_input,expected)``
 tuples so that the ``test_eval`` function will run three times using
 them in turn::
 
     $ pytest
-    ======= test session starts ========
+    =========================== test session starts ============================
     platform linux -- Python 3.x.y, pytest-3.x.y, py-1.x.y, pluggy-0.x.y
     rootdir: $REGENDOC_TMPDIR, inifile:
     collected 3 items
-    
-    test_expectation.py ..F
-    
-    ======= FAILURES ========
-    _______ test_eval[6*9-42] ________
-    
+
+    test_expectation.py ..F                                              [100%]
+
+    ================================= FAILURES =================================
+    ____________________________ test_eval[6*9-42] _____________________________
+
     test_input = '6*9', expected = 42
-    
+
         @pytest.mark.parametrize("test_input,expected", [
             ("3+5", 8),
             ("2+4", 6),
             ("6*9", 42),
         ])
         def test_eval(test_input, expected):
     >       assert eval(test_input) == expected
     E       AssertionError: assert 54 == 42
     E        +  where 54 = eval('6*9')
-    
+
     test_expectation.py:8: AssertionError
-    ======= 1 failed, 2 passed in 0.12 seconds ========
+    ==================== 1 failed, 2 passed in 0.12 seconds ====================
 
 As designed in this example, only one pair of input/output values fails
 the simple test function.  And as usual with test function arguments,
 you can see the ``input`` and ``output`` values in the traceback.
 
 Note that you could also use the parametrize marker on a class or a module
 (see :ref:`mark`) which would invoke several functions with the argument sets.
 
@@ -97,39 +97,39 @@ for example with the builtin ``mark.xfai
                      marks=pytest.mark.xfail),
     ])
     def test_eval(test_input, expected):
         assert eval(test_input) == expected
 
 Let's run this::
 
     $ pytest
-    ======= test session starts ========
+    =========================== test session starts ============================
     platform linux -- Python 3.x.y, pytest-3.x.y, py-1.x.y, pluggy-0.x.y
     rootdir: $REGENDOC_TMPDIR, inifile:
     collected 3 items
-    
-    test_expectation.py ..x
-    
-    ======= 2 passed, 1 xfailed in 0.12 seconds ========
+
+    test_expectation.py ..x                                              [100%]
+
+    =================== 2 passed, 1 xfailed in 0.12 seconds ====================
 
 The one parameter set which caused a failure previously now
 shows up as an "xfailed (expected to fail)" test.
 
 To get all combinations of multiple parametrized arguments you can stack
 ``parametrize`` decorators::
 
     import pytest
     @pytest.mark.parametrize("x", [0, 1])
     @pytest.mark.parametrize("y", [2, 3])
     def test_foo(x, y):
         pass
 
-This will run the test with the arguments set to ``x=0/y=2``, ``x=0/y=3``, ``x=1/y=2`` and
-``x=1/y=3``.
+This will run the test with the arguments set to ``x=0/y=2``, ``x=1/y=2``,
+``x=0/y=3``, and ``x=1/y=3`` exhausting parameters in the order of the decorators.
 
 .. _`pytest_generate_tests`:
 
 Basic ``pytest_generate_tests`` example
 ---------------------------------------------
 
 Sometimes you may want to implement your own parametrization scheme
 or implement some dynamism for determining the parameters or scope
@@ -160,58 +160,49 @@ command line option and the parametrizat
     def pytest_generate_tests(metafunc):
         if 'stringinput' in metafunc.fixturenames:
             metafunc.parametrize("stringinput",
                                  metafunc.config.getoption('stringinput'))
 
 If we now pass two stringinput values, our test will run twice::
 
     $ pytest -q --stringinput="hello" --stringinput="world" test_strings.py
-    ..
+    ..                                                                   [100%]
     2 passed in 0.12 seconds
 
 Let's also run with a stringinput that will lead to a failing test::
 
     $ pytest -q --stringinput="!" test_strings.py
-    F
-    ======= FAILURES ========
-    _______ test_valid_string[!] ________
-    
+    F                                                                    [100%]
+    ================================= FAILURES =================================
+    ___________________________ test_valid_string[!] ___________________________
+
     stringinput = '!'
-    
+
         def test_valid_string(stringinput):
     >       assert stringinput.isalpha()
     E       AssertionError: assert False
     E        +  where False = <built-in method isalpha of str object at 0xdeadbeef>()
     E        +    where <built-in method isalpha of str object at 0xdeadbeef> = '!'.isalpha
-    
+
     test_strings.py:3: AssertionError
     1 failed in 0.12 seconds
 
 As expected our test function fails.
 
 If you don't specify a stringinput it will be skipped because
 ``metafunc.parametrize()`` will be called with an empty parameter
 list::
 
     $ pytest -q -rs test_strings.py
-    s
-    ======= short test summary info ========
-    SKIP [1] test_strings.py:2: got empty parameter set ['stringinput'], function test_valid_string at $REGENDOC_TMPDIR/test_strings.py:1
+    s                                                                    [100%]
+    ========================= short test summary info ==========================
+    SKIP [1] test_strings.py: got empty parameter set ['stringinput'], function test_valid_string at $REGENDOC_TMPDIR/test_strings.py:1
     1 skipped in 0.12 seconds
 
-Note that when calling ``metafunc.parametrize`` multiple times with different parameter sets, all parameter names across 
+Note that when calling ``metafunc.parametrize`` multiple times with different parameter sets, all parameter names across
 those sets cannot be duplicated, otherwise an error will be raised.
 
 More examples
 -------------
 
 For further examples, you might want to look at :ref:`more
 parametrization examples <paramexamples>`.
-
-.. _`metafunc object`:
-
-The **metafunc** object
--------------------------------------------
-
-.. currentmodule:: _pytest.python
-.. autoclass:: Metafunc
-    :members:
--- a/third_party/python/pytest/doc/en/plugins.rst
+++ b/third_party/python/pytest/doc/en/plugins.rst
@@ -15,78 +15,82 @@ Installing a third party plugin can be e
 
 If a plugin is installed, ``pytest`` automatically finds and integrates it,
 there is no need to activate it.
 
 Here is a little annotated list for some popular plugins:
 
 .. _`django`: https://www.djangoproject.com/
 
-* `pytest-django <http://pypi.python.org/pypi/pytest-django>`_: write tests
+* `pytest-django <https://pypi.org/project/pytest-django/>`_: write tests
   for `django`_ apps, using pytest integration.
 
-* `pytest-twisted <http://pypi.python.org/pypi/pytest-twisted>`_: write tests
+* `pytest-twisted <https://pypi.org/project/pytest-twisted/>`_: write tests
   for `twisted <http://twistedmatrix.com>`_ apps, starting a reactor and
   processing deferreds from test functions.
 
-* `pytest-catchlog <http://pypi.python.org/pypi/pytest-catchlog>`_:
-  to capture and assert about messages from the logging module
-
-* `pytest-cov <http://pypi.python.org/pypi/pytest-cov>`_:
+* `pytest-cov <https://pypi.org/project/pytest-cov/>`_:
   coverage reporting, compatible with distributed testing
 
-* `pytest-xdist <http://pypi.python.org/pypi/pytest-xdist>`_:
+* `pytest-xdist <https://pypi.org/project/pytest-xdist/>`_:
   to distribute tests to CPUs and remote hosts, to run in boxed
   mode which allows to survive segmentation faults, to run in
   looponfailing mode, automatically re-running failing tests
   on file changes.
 
-* `pytest-instafail <http://pypi.python.org/pypi/pytest-instafail>`_:
+* `pytest-instafail <https://pypi.org/project/pytest-instafail/>`_:
   to report failures while the test run is happening.
 
-* `pytest-bdd <http://pypi.python.org/pypi/pytest-bdd>`_ and
-  `pytest-konira <http://pypi.python.org/pypi/pytest-konira>`_
+* `pytest-bdd <https://pypi.org/project/pytest-bdd/>`_ and
+  `pytest-konira <https://pypi.org/project/pytest-konira/>`_
   to write tests using behaviour-driven testing.
 
-* `pytest-timeout <http://pypi.python.org/pypi/pytest-timeout>`_:
+* `pytest-timeout <https://pypi.org/project/pytest-timeout/>`_:
   to timeout tests based on function marks or global definitions.
 
-* `pytest-pep8 <http://pypi.python.org/pypi/pytest-pep8>`_:
+* `pytest-pep8 <https://pypi.org/project/pytest-pep8/>`_:
   a ``--pep8`` option to enable PEP8 compliance checking.
 
-* `pytest-flakes <https://pypi.python.org/pypi/pytest-flakes>`_:
+* `pytest-flakes <https://pypi.org/project/pytest-flakes/>`_:
   check source code with pyflakes.
 
-* `oejskit <http://pypi.python.org/pypi/oejskit>`_:
+* `oejskit <https://pypi.org/project/oejskit/>`_:
   a plugin to run javascript unittests in live browsers.
 
 To see a complete list of all plugins with their latest testing
 status against different pytest and Python versions, please visit
 `plugincompat <http://plugincompat.herokuapp.com/>`_.
 
 You may also discover more plugins through a `pytest- pypi.python.org search`_.
 
+.. _`pytest- pypi.python.org search`: https://pypi.org/search/?q=pytest-
+
+
 .. _`available installable plugins`:
-.. _`pytest- pypi.python.org search`: http://pypi.python.org/pypi?%3Aaction=search&term=pytest-&submit=search
-
 
 Requiring/Loading plugins in a test module or conftest file
 -----------------------------------------------------------
 
 You can require plugins in a test module or a conftest file like this::
 
     pytest_plugins = "myapp.testsupport.myplugin",
 
 When the test module or conftest plugin is loaded the specified plugins
 will be loaded as well.
 
     pytest_plugins = "myapp.testsupport.myplugin"
 
 which will import the specified module as a ``pytest`` plugin.
 
+.. note::
+    Requiring plugins using a ``pytest_plugins`` variable in non-root
+    ``conftest.py`` files is deprecated. See
+    :ref:`full explanation <requiring plugins in non-root conftests>`
+    in the Writing plugins section.
+
 .. _`findpluginname`:
 
 Finding out which plugins are active
 ------------------------------------
 
 If you want to find out which plugins are active in your
 environment you can type::
 
@@ -118,40 +122,8 @@ this option to your ``pytest.ini`` file:
 
 Alternatively to disable it only in certain environments (for example in a
 CI server), you can set ``PYTEST_ADDOPTS`` environment variable to
 ``-p no:name``.
 
 See :ref:`findpluginname` for how to obtain the name of a plugin.
 
 .. _`builtin plugins`:
-
-Pytest default plugin reference
--------------------------------
-
-
-You can find the source code for the following plugins
-in the `pytest repository <https://github.com/pytest-dev/pytest>`_.
-
-.. autosummary::
-
-    _pytest.assertion
-    _pytest.cacheprovider
-    _pytest.capture
-    _pytest.config
-    _pytest.doctest
-    _pytest.helpconfig
-    _pytest.junitxml
-    _pytest.mark
-    _pytest.monkeypatch
-    _pytest.nose
-    _pytest.pastebin
-    _pytest.debugging
-    _pytest.pytester
-    _pytest.python
-    _pytest.recwarn
-    _pytest.resultlog
-    _pytest.runner
-    _pytest.main
-    _pytest.skipping
-    _pytest.terminal
-    _pytest.tmpdir
-    _pytest.unittest
--- a/third_party/python/pytest/doc/en/projects.rst
+++ b/third_party/python/pytest/doc/en/projects.rst
@@ -27,50 +27,50 @@ Here are some examples of projects using
 * the `MoinMoin <http://moinmo.in>`_ Wiki Engine
 * `sentry <https://getsentry.com/welcome/>`_, realtime app-maintenance and exception tracking
 * `Astropy <http://www.astropy.org/>`_ and `affiliated packages <http://www.astropy.org/affiliated/index.html>`_
 * `tox <http://testrun.org/tox>`_, virtualenv/Hudson integration tool
 * `PIDA <http://pida.co.uk>`_ framework for integrated development
 * `PyPM <http://code.activestate.com/pypm/>`_ ActiveState's package manager
 * `Fom <http://packages.python.org/Fom/>`_ a fluid object mapper for FluidDB
 * `applib <https://github.com/ActiveState/applib>`_ cross-platform utilities
-* `six <http://pypi.python.org/pypi/six/>`_ Python 2 and 3 compatibility utilities
+* `six <https://pypi.org/project/six/>`_ Python 2 and 3 compatibility utilities
 * `pediapress <http://code.pediapress.com/wiki/wiki>`_ MediaWiki articles
-* `mwlib <http://pypi.python.org/pypi/mwlib>`_ mediawiki parser and utility library
+* `mwlib <https://pypi.org/project/mwlib/>`_ mediawiki parser and utility library
 * `The Translate Toolkit <http://translate.sourceforge.net/wiki/toolkit/index>`_ for localization and conversion
 * `execnet <http://codespeak.net/execnet>`_ rapid multi-Python deployment
-* `pylib <http://py.rtfd.org>`_ cross-platform path, IO, dynamic code library
+* `pylib <https://py.readthedocs.io>`_ cross-platform path, IO, dynamic code library
 * `Pacha <http://pacha.cafepais.com/>`_ configuration management in five minutes
-* `bbfreeze <http://pypi.python.org/pypi/bbfreeze>`_ create standalone executables from Python scripts
+* `bbfreeze <https://pypi.org/project/bbfreeze/>`_ create standalone executables from Python scripts
 * `pdb++ <http://bitbucket.org/antocuni/pdb>`_ a fancier version of PDB
 * `py-s3fuse <http://code.google.com/p/py-s3fuse/>`_ Amazon S3 FUSE based filesystem
 * `waskr <http://code.google.com/p/waskr/>`_ WSGI Stats Middleware
 * `guachi <http://code.google.com/p/guachi/>`_ global persistent configs for Python modules
-* `Circuits <http://pypi.python.org/pypi/circuits>`_ lightweight Event Driven Framework
+* `Circuits <https://pypi.org/project/circuits/>`_ lightweight Event Driven Framework
 * `pygtk-helpers <http://bitbucket.org/aafshar/pygtkhelpers-main/>`_ easy interaction with PyGTK
 * `QuantumCore <http://quantumcore.org/>`_ statusmessage and repoze openid plugin
 * `pydataportability <http://pydataportability.net/>`_ libraries for managing the open web
 * `XIST <http://www.livinglogic.de/Python/xist/>`_ extensible HTML/XML generator
-* `tiddlyweb <http://pypi.python.org/pypi/tiddlyweb>`_ optionally headless, extensible RESTful datastore
+* `tiddlyweb <https://pypi.org/project/tiddlyweb/>`_ optionally headless, extensible RESTful datastore
 * `fancycompleter <http://bitbucket.org/antocuni/fancycompleter/src>`_ for colorful tab-completion
 * `Paludis <http://paludis.exherbo.org/>`_ tools for Gentoo Paludis package manager
 * `Gerald <http://halfcooked.com/code/gerald/>`_ schema comparison tool
 * `abjad <http://code.google.com/p/abjad/>`_ Python API for Formalized Score control
 * `bu <http://packages.python.org/bu/>`_ a microscopic build system
 * `katcp <https://bitbucket.org/hodgestar/katcp>`_ Telescope communication protocol over Twisted
-* `kss plugin timer <http://pypi.python.org/pypi/kss.plugin.timer>`_
+* `kss plugin timer <https://pypi.org/project/kss.plugin.timer/>`_
 * `pyudev <https://pyudev.readthedocs.io/en/latest/tests/plugins.html>`_ a pure Python binding to the Linux library libudev
-* `pytest-localserver <https://bitbucket.org/basti/pytest-localserver/>`_ a plugin for pytest that provides an httpserver and smtpserver
-* `pytest-monkeyplus <http://pypi.python.org/pypi/pytest-monkeyplus/>`_ a plugin that extends monkeypatch
+* `pytest-localserver <https://bitbucket.org/pytest-dev/pytest-localserver/>`_ a plugin for pytest that provides an httpserver and smtpserver
+* `pytest-monkeyplus <https://pypi.org/project/pytest-monkeyplus/>`_ a plugin that extends monkeypatch
 
 These projects help integrate ``pytest`` into other Python frameworks:
 
-* `pytest-django <http://pypi.python.org/pypi/pytest-django/>`_ for Django
+* `pytest-django <https://pypi.org/project/pytest-django/>`_ for Django
 * `zope.pytest <http://packages.python.org/zope.pytest/>`_ for Zope and Grok
-* `pytest_gae <http://pypi.python.org/pypi/pytest_gae/0.2.1>`_ for Google App Engine
+* `pytest_gae <https://pypi.org/project/pytest_gae/0.2.1/>`_ for Google App Engine
 * There is `some work <https://github.com/Kotti/Kotti/blob/master/kotti/testing.py>`_ underway for Kotti, a CMS built in Pyramid/Pylons
 
 
 Some organisations using pytest
 -----------------------------------
 
 * `Square Kilometre Array, Cape Town <http://ska.ac.za/>`_
 * `Some Mozilla QA people <http://www.theautomatedtester.co.uk/blog/2011/pytest_and_xdist_plugin.html>`_ use pytest to distribute their Selenium tests
--- a/third_party/python/pytest/doc/en/proposals/parametrize_with_fixtures.rst
+++ b/third_party/python/pytest/doc/en/proposals/parametrize_with_fixtures.rst
@@ -30,36 +30,39 @@ emulates user input.
   - specify 'author' and 'project_slug'
 
 This is how a functional test could look like:
 
 .. code-block:: python
 
     import pytest
 
+
     @pytest.fixture
     def default_context():
-        return {'extra_context': {}}
+        return {"extra_context": {}}
 
 
-    @pytest.fixture(params=[
-        {'author': 'alice'},
-        {'project_slug': 'helloworld'},
-        {'author': 'bob', 'project_slug': 'foobar'},
-    ])
+    @pytest.fixture(
+        params=[
+            {"author": "alice"},
+            {"project_slug": "helloworld"},
+            {"author": "bob", "project_slug": "foobar"},
+        ]
+    )
     def extra_context(request):
-        return {'extra_context': request.param}
+        return {"extra_context": request.param}
 
 
-    @pytest.fixture(params=['default', 'extra'])
+    @pytest.fixture(params=["default", "extra"])
     def context(request):
-        if request.param == 'default':
-            return request.getfuncargvalue('default_context')
+        if request.param == "default":
+            return request.getfuncargvalue("default_context")
         else:
-            return request.getfuncargvalue('extra_context')
+            return request.getfuncargvalue("extra_context")
 
 
     def test_generate_project(cookies, context):
         """Call the cookiecutter API to generate a new project from a
         template.
         """
         result = cookies.bake(extra_context=context)
 
@@ -90,18 +93,17 @@ Proposed solution
 -----------------
 
 A new function that can be used in modules can be used to dynamically define
 fixtures from existing ones.
 
 .. code-block:: python
 
     pytest.define_combined_fixture(
-        name='context',
-        fixtures=['default_context', 'extra_context'],
+        name="context", fixtures=["default_context", "extra_context"]
     )
 
 The new fixture ``context`` inherits the scope from the used fixtures and yield
 the following values.
 
 - ``{}``
 
 - ``{'author': 'alice'}``
@@ -113,25 +115,27 @@ the following values.
 Alternative approach
 --------------------
 
 A new helper function named ``fixture_request`` would tell pytest to yield
 all parameters marked as a fixture.
 
 .. note::
 
-    The `pytest-lazy-fixture <https://pypi.python.org/pypi/pytest-lazy-fixture>`_ plugin implements a very
+    The `pytest-lazy-fixture <https://pypi.org/project/pytest-lazy-fixture/>`_ plugin implements a very
     similar solution to the proposal below, make sure to check it out.
 
 .. code-block:: python
 
-    @pytest.fixture(params=[
-        pytest.fixture_request('default_context'),
-        pytest.fixture_request('extra_context'),
-    ])
+    @pytest.fixture(
+        params=[
+            pytest.fixture_request("default_context"),
+            pytest.fixture_request("extra_context"),
+        ]
+    )
     def context(request):
         """Returns all values for ``default_context``, one-by-one before it
         does the same for ``extra_context``.
 
         request.param:
             - {}
             - {'author': 'alice'}
             - {'project_slug': 'helloworld'}
@@ -140,20 +144,20 @@ all parameters marked as a fixture.
         return request.param
 
 The same helper can be used in combination with ``pytest.mark.parametrize``.
 
 .. code-block:: python
 
 
     @pytest.mark.parametrize(
-        'context, expected_response_code',
+        "context, expected_response_code",
         [
-            (pytest.fixture_request('default_context'), 0),
-            (pytest.fixture_request('extra_context'), 0),
+            (pytest.fixture_request("default_context"), 0),
+            (pytest.fixture_request("extra_context"), 0),
         ],
     )
     def test_generate_project(cookies, context, exit_code):
         """Call the cookiecutter API to generate a new project from a
         template.
         """
         result = cookies.bake(extra_context=context)
 
new file mode 100644
--- /dev/null
+++ b/third_party/python/pytest/doc/en/reference.rst
@@ -0,0 +1,1296 @@
+
+Reference
+=========
+
+This page contains the full reference to pytest's API.
+
+.. contents::
+    :depth: 3
+    :local:
+
+Functions
+---------
+
+pytest.approx
+~~~~~~~~~~~~~
+
+.. autofunction:: _pytest.python_api.approx
+
+pytest.fail
+~~~~~~~~~~~
+
+**Tutorial**: :ref:`skipping`
+
+.. autofunction:: _pytest.outcomes.fail
+
+pytest.skip
+~~~~~~~~~~~
+
+.. autofunction:: _pytest.outcomes.skip(msg, [allow_module_level=False])
+
+pytest.importorskip
+~~~~~~~~~~~~~~~~~~~
+
+.. autofunction:: _pytest.outcomes.importorskip
+
+pytest.xfail
+~~~~~~~~~~~~
+
+.. autofunction:: _pytest.outcomes.xfail
+
+pytest.exit
+~~~~~~~~~~~
+
+.. autofunction:: _pytest.outcomes.exit
+
+pytest.main
+~~~~~~~~~~~
+
+.. autofunction:: _pytest.config.main
+
+pytest.param
+~~~~~~~~~~~~~
+
+.. autofunction:: pytest.param(*values, [id], [marks])
+
+pytest.raises
+~~~~~~~~~~~~~
+
+**Tutorial**: :ref:`assertraises`.
+
+.. autofunction:: pytest.raises(expected_exception: Exception, [match], [message])
+    :with: excinfo
+
+pytest.deprecated_call
+~~~~~~~~~~~~~~~~~~~~~~
+
+**Tutorial**: :ref:`ensuring_function_triggers`.
+
+.. autofunction:: pytest.deprecated_call()
+    :with:
+
+pytest.register_assert_rewrite
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+**Tutorial**: :ref:`assertion-rewriting`.
+
+.. autofunction:: pytest.register_assert_rewrite
+
+pytest.warns
+~~~~~~~~~~~~
+
+**Tutorial**: :ref:`assertwarnings`
+
+.. autofunction:: pytest.warns(expected_warning: Exception, [match])
+    :with:
+
+
+.. _`marks ref`:
+
+Marks
+-----
+
+Marks can be used apply meta data to *test functions* (but not fixtures), which can then be accessed by
+fixtures or plugins.
+
+
+
+
+.. _`pytest.mark.filterwarnings ref`:
+
+pytest.mark.filterwarnings
+~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+**Tutorial**: :ref:`filterwarnings`.
+
+Add warning filters to marked test items.
+
+.. py:function:: pytest.mark.filterwarnings(filter)
+
+    :keyword str filter:
+        A *warning specification string*, which is composed of contents of the tuple ``(action, message, category, module, lineno)``
+        as specified in `The Warnings filter <https://docs.python.org/3/library/warnings.html#warning-filter>`_ section of
+        the Python documentation, separated by ``":"``. Optional fields can be omitted.
+
+        For example:
+
+        .. code-block:: python
+
+            @pytest.mark.warnings("ignore:.*usage will be deprecated.*:DeprecationWarning")
+            def test_foo():
+                ...
+
+
+.. _`pytest.mark.parametrize ref`:
+
+pytest.mark.parametrize
+~~~~~~~~~~~~~~~~~~~~~~~
+
+**Tutorial**: :doc:`parametrize`.
+
+.. automethod:: _pytest.python.Metafunc.parametrize
+
+
+.. _`pytest.mark.skip ref`:
+
+pytest.mark.skip
+~~~~~~~~~~~~~~~~
+
+**Tutorial**: :ref:`skip`.
+
+Unconditionally skip a test function.
+
+.. py:function:: pytest.mark.skip(*, reason=None)
+
+    :keyword str reason: Reason why the test function is being skipped.
+
+
+.. _`pytest.mark.skipif ref`:
+
+pytest.mark.skipif
+~~~~~~~~~~~~~~~~~~
+
+**Tutorial**: :ref:`skipif`.
+
+Skip a test function if a condition is ``True``.
+
+.. py:function:: pytest.mark.skipif(condition, *, reason=None)
+
+    :type condition: bool or str
+    :param condition: ``True/False`` if the condition should be skipped or a :ref:`condition string <string conditions>`.
+    :keyword str reason: Reason why the test function is being skipped.
+
+
+.. _`pytest.mark.xfail ref`:
+
+pytest.mark.xfail
+~~~~~~~~~~~~~~~~~~
+
+**Tutorial**: :ref:`xfail`.
+
+Marks a test function as *expected to fail*.
+
+.. py:function:: pytest.mark.xfail(condition=None, *, reason=None, raises=None, run=True, strict=False)
+
+    :type condition: bool or str
+    :param condition: ``True/False`` if the condition should be marked as xfail or a :ref:`condition string <string conditions>`.
+    :keyword str reason: Reason why the test function is marked as xfail.
+    :keyword Exception raises: Exception subclass expected to be raised by the test function; other exceptions will fail the test.
+    :keyword bool run:
+        If the test function should actually be executed. If ``False``, the function will always xfail and will
+        not be executed (useful a function is segfaulting).
+    :keyword bool strict:
+        * If ``False`` (the default) the function will be shown in the terminal output as ``xfailed`` if it fails
+          and as ``xpass`` if it passes. In both cases this will not cause the test suite to fail as a whole. This
+          is particularly useful to mark *flaky* tests (tests that random at fail) to be tackled later.
+        * If ``True``, the function will be shown in the terminal output as ``xfailed`` if it fails, but if it
+          unexpectedly passes then it will **fail** the test suite. This is particularly useful to mark functions
+          that are always failing and there should be a clear indication if they unexpectedly start to pass (for example
+          a new release of a library fixes a known bug).
+
+
+custom marks
+~~~~~~~~~~~~
+
+Marks are created dynamically using the factory object ``pytest.mark`` and applied as a decorator.
+
+For example:
+
+.. code-block:: python
+
+    @pytest.mark.timeout(10, "slow", method="thread")
+    def test_function():
+        ...
+
+Will create and attach a :class:`Mark <_pytest.mark.structures.Mark>` object to the collected
+:class:`Item <_pytest.nodes.Item>`, which can then be accessed by fixtures or hooks with
+:meth:`Node.iter_markers <_pytest.nodes.Node.iter_markers>`. The ``mark`` object will have the following attributes:
+
+.. code-block:: python
+
+    mark.args == (10, "slow")
+    mark.kwargs == {"method": "thread"}
+
+
+Fixtures
+--------
+
+**Tutorial**: :ref:`fixture`.
+
+Fixtures are requested by test functions or other fixtures by declaring them as argument names.
+
+
+Example of a test requiring a fixture:
+
+.. code-block:: python
+
+    def test_output(capsys):
+        print("hello")
+        out, err = capsys.readouterr()
+        assert out == "hello\n"
+
+
+Example of a fixture requiring another fixture:
+
+.. code-block:: python
+
+    @pytest.fixture
+    def db_session(tmpdir):
+        fn = tmpdir / "db.file"
+        return connect(str(fn))
+
+For more details, consult the full :ref:`fixtures docs <fixture>`.
+
+
+@pytest.fixture
+~~~~~~~~~~~~~~~
+
+.. autofunction:: pytest.fixture
+    :decorator:
+
+
+.. _`cache-api`:
+
+config.cache
+~~~~~~~~~~~~
+
+**Tutorial**: :ref:`cache`.
+
+The ``config.cache`` object allows other plugins and fixtures
+to store and retrieve values across test runs. To access it from fixtures
+request ``pytestconfig`` into your fixture and get it with ``pytestconfig.cache``.
+
+Under the hood, the cache plugin uses the simple
+``dumps``/``loads`` API of the :py:mod:`json` stdlib module.
+
+.. currentmodule:: _pytest.cacheprovider
+
+.. automethod:: Cache.get
+.. automethod:: Cache.set
+.. automethod:: Cache.makedir
+
+
+capsys
+~~~~~~
+
+**Tutorial**: :doc:`capture`.
+
+.. currentmodule:: _pytest.capture
+
+.. autofunction:: capsys()
+    :no-auto-options:
+
+    Returns an instance of :py:class:`CaptureFixture`.
+
+    Example:
+
+    .. code-block:: python
+
+        def test_output(capsys):
+            print("hello")
+            captured = capsys.readouterr()
+            assert captured.out == "hello\n"
+
+.. autoclass:: CaptureFixture()
+    :members:
+
+
+capsysbinary
+~~~~~~~~~~~~
+
+**Tutorial**: :doc:`capture`.
+
+.. autofunction:: capsysbinary()
+    :no-auto-options:
+
+    Returns an instance of :py:class:`CaptureFixture`.
+
+    Example:
+
+    .. code-block:: python
+
+        def test_output(capsysbinary):
+            print("hello")
+            captured = capsysbinary.readouterr()
+            assert captured.out == b"hello\n"
+
+
+capfd
+~~~~~~
+
+**Tutorial**: :doc:`capture`.
+
+.. autofunction:: capfd()
+    :no-auto-options:
+
+    Returns an instance of :py:class:`CaptureFixture`.
+
+    Example:
+
+    .. code-block:: python
+
+        def test_system_echo(capfd):
+            os.system('echo "hello"')
+            captured = capsys.readouterr()
+            assert captured.out == "hello\n"
+
+
+capfdbinary
+~~~~~~~~~~~~
+
+**Tutorial**: :doc:`capture`.
+
+.. autofunction:: capfdbinary()
+    :no-auto-options:
+
+    Returns an instance of :py:class:`CaptureFixture`.
+
+    Example:
+
+    .. code-block:: python
+
+        def test_system_echo(capfdbinary):
+            os.system('echo "hello"')
+            captured = capfdbinary.readouterr()
+            assert captured.out == b"hello\n"
+
+
+doctest_namespace
+~~~~~~~~~~~~~~~~~
+
+**Tutorial**: :doc:`doctest`.
+
+.. autofunction:: _pytest.doctest.doctest_namespace()
+
+    Usually this fixture is used in conjunction with another ``autouse`` fixture:
+
+    .. code-block:: python
+
+        @pytest.fixture(autouse=True)
+        def add_np(doctest_namespace):
+            doctest_namespace["np"] = numpy
+
+    For more details: :ref:`doctest_namespace`.
+
+
+request
+~~~~~~~
+
+**Tutorial**: :ref:`request example`.
+
+The ``request`` fixture is a special fixture providing information of the requesting test function.
+
+.. autoclass:: _pytest.fixtures.FixtureRequest()
+    :members:
+
+
+pytestconfig
+~~~~~~~~~~~~
+
+.. autofunction:: _pytest.fixtures.pytestconfig()
+
+
+record_property
+~~~~~~~~~~~~~~~~~~~
+
+**Tutorial**: :ref:`record_property example`.
+
+.. autofunction:: _pytest.junitxml.record_property()
+
+caplog
+~~~~~~
+
+**Tutorial**: :doc:`logging`.
+
+.. autofunction:: _pytest.logging.caplog()
+    :no-auto-options:
+
+    This returns a :class:`_pytest.logging.LogCaptureFixture` instance.
+
+.. autoclass:: _pytest.logging.LogCaptureFixture
+    :members:
+
+
+monkeypatch
+~~~~~~~~~~~
+
+.. currentmodule:: _pytest.monkeypatch
+
+**Tutorial**: :doc:`monkeypatch`.
+
+.. autofunction:: _pytest.monkeypatch.monkeypatch()
+    :no-auto-options:
+
+    This returns a :class:`MonkeyPatch` instance.
+
+.. autoclass:: _pytest.monkeypatch.MonkeyPatch
+    :members:
+
+testdir
+~~~~~~~
+
+.. currentmodule:: _pytest.pytester
+
+This fixture provides a :class:`Testdir` instance useful for black-box testing of test files, making it ideal to
+test plugins.
+
+To use it, include in your top-most ``conftest.py`` file::
+
+    pytest_plugins = 'pytester'
+
+
+
+.. autoclass:: Testdir()
+    :members: runpytest,runpytest_subprocess,runpytest_inprocess,makeconftest,makepyfile
+
+.. autoclass:: RunResult()
+    :members:
+
+.. autoclass:: LineMatcher()
+    :members:
+
+
+recwarn
+~~~~~~~
+
+**Tutorial**: :ref:`assertwarnings`
+
+.. currentmodule:: _pytest.recwarn
+
+.. autofunction:: recwarn()
+    :no-auto-options:
+
+.. autoclass:: _pytest.recwarn.WarningsRecorder()
+    :members:
+
+Each recorded warning is an instance of :class:`warnings.WarningMessage`.
+
+.. note::
+    :class:`RecordedWarning` was changed from a plain class to a namedtuple in pytest 3.1
+
+.. note::
+    ``DeprecationWarning`` and ``PendingDeprecationWarning`` are treated
+    differently; see :ref:`ensuring_function_triggers`.
+
+
+tmpdir
+~~~~~~
+
+**Tutorial**: :doc:`tmpdir`
+
+.. currentmodule:: _pytest.tmpdir
+
+.. autofunction:: tmpdir()
+    :no-auto-options:
+
+
+tmpdir_factory
+~~~~~~~~~~~~~~
+
+**Tutorial**: :ref:`tmpdir factory example`
+
+.. _`tmpdir factory api`:
+
+``tmpdir_factory`` instances have the following methods:
+
+.. currentmodule:: _pytest.tmpdir
+
+.. automethod:: TempdirFactory.mktemp
+.. automethod:: TempdirFactory.getbasetemp
+
+
+.. _`hook-reference`:
+
+Hooks
+-----
+
+**Tutorial**: :doc:`writing_plugins`.
+
+.. currentmodule:: _pytest.hookspec
+
+Reference to all hooks which can be implemented by :ref:`conftest.py files <localplugin>` and :ref:`plugins <plugins>`.
+
+Bootstrapping hooks
+~~~~~~~~~~~~~~~~~~~
+
+Bootstrapping hooks called for plugins registered early enough (internal and setuptools plugins).
+
+.. autofunction:: pytest_load_initial_conftests
+.. autofunction:: pytest_cmdline_preparse
+.. autofunction:: pytest_cmdline_parse
+.. autofunction:: pytest_cmdline_main
+
+Initialization hooks
+~~~~~~~~~~~~~~~~~~~~
+
+Initialization hooks called for plugins and ``conftest.py`` files.
+
+.. autofunction:: pytest_addoption
+.. autofunction:: pytest_addhooks
+.. autofunction:: pytest_configure
+.. autofunction:: pytest_unconfigure
+.. autofunction:: pytest_sessionstart
+.. autofunction:: pytest_sessionfinish
+
+Test running hooks
+~~~~~~~~~~~~~~~~~~
+
+All runtest related hooks receive a :py:class:`pytest.Item <_pytest.main.Item>` object.
+
+.. autofunction:: pytest_runtestloop
+.. autofunction:: pytest_runtest_protocol
+.. autofunction:: pytest_runtest_logstart
+.. autofunction:: pytest_runtest_logfinish
+.. autofunction:: pytest_runtest_setup
+.. autofunction:: pytest_runtest_call
+.. autofunction:: pytest_runtest_teardown
+.. autofunction:: pytest_runtest_makereport
+
+For deeper understanding you may look at the default implementation of
+these hooks in :py:mod:`_pytest.runner` and maybe also
+in :py:mod:`_pytest.pdb` which interacts with :py:mod:`_pytest.capture`
+and its input/output capturing in order to immediately drop
+into interactive debugging when a test failure occurs.
+
+The :py:mod:`_pytest.terminal` reported specifically uses
+the reporting hook to print information about a test run.
+
+Collection hooks
+~~~~~~~~~~~~~~~~
+
+``pytest`` calls the following hooks for collecting files and directories:
+
+.. autofunction:: pytest_collection
+.. autofunction:: pytest_ignore_collect
+.. autofunction:: pytest_collect_directory
+.. autofunction:: pytest_collect_file
+
+For influencing the collection of objects in Python modules
+you can use the following hook:
+
+.. autofunction:: pytest_pycollect_makeitem
+.. autofunction:: pytest_generate_tests
+.. autofunction:: pytest_make_parametrize_id
+
+After collection is complete, you can modify the order of
+items, delete or otherwise amend the test items:
+
+.. autofunction:: pytest_collection_modifyitems
+
+Reporting hooks
+~~~~~~~~~~~~~~~
+
+Session related reporting hooks:
+
+.. autofunction:: pytest_collectstart
+.. autofunction:: pytest_itemcollected
+.. autofunction:: pytest_collectreport
+.. autofunction:: pytest_deselected
+.. autofunction:: pytest_report_header
+.. autofunction:: pytest_report_collectionfinish
+.. autofunction:: pytest_report_teststatus
+.. autofunction:: pytest_terminal_summary
+.. autofunction:: pytest_fixture_setup
+.. autofunction:: pytest_fixture_post_finalizer
+
+And here is the central hook for reporting about
+test execution:
+
+.. autofunction:: pytest_runtest_logreport
+
+You can also use this hook to customize assertion representation for some
+types:
+
+.. autofunction:: pytest_assertrepr_compare
+
+
+Debugging/Interaction hooks
+~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+There are few hooks which can be used for special
+reporting or interaction with exceptions:
+
+.. autofunction:: pytest_internalerror
+.. autofunction:: pytest_keyboard_interrupt
+.. autofunction:: pytest_exception_interact
+.. autofunction:: pytest_enter_pdb
+
+
+Objects
+-------
+
+Full reference to objects accessible from :ref:`fixtures <fixture>` or :ref:`hooks <hook-reference>`.
+
+
+CallInfo
+~~~~~~~~
+
+.. autoclass:: _pytest.runner.CallInfo()
+    :members:
+
+
+Class
+~~~~~
+
+.. autoclass:: _pytest.python.Class()
+    :members:
+    :show-inheritance:
+
+Collector
+~~~~~~~~~
+
+.. autoclass:: _pytest.nodes.Collector()
+    :members:
+    :show-inheritance:
+
+Config
+~~~~~~
+
+.. autoclass:: _pytest.config.Config()
+    :members:
+
+ExceptionInfo
+~~~~~~~~~~~~~
+
+.. autoclass:: _pytest._code.ExceptionInfo
+    :members:
+
+FixtureDef
+~~~~~~~~~~
+
+.. autoclass:: _pytest.fixtures.FixtureDef()
+    :members:
+    :show-inheritance:
+
+FSCollector
+~~~~~~~~~~~
+
+.. autoclass:: _pytest.nodes.FSCollector()
+    :members:
+    :show-inheritance:
+
+Function
+~~~~~~~~
+
+.. autoclass:: _pytest.python.Function()
+    :members:
+    :show-inheritance:
+
+Item
+~~~~
+
+.. autoclass:: _pytest.nodes.Item()
+    :members:
+    :show-inheritance:
+
+MarkDecorator
+~~~~~~~~~~~~~
+
+.. autoclass:: _pytest.mark.MarkDecorator
+    :members:
+
+
+MarkGenerator
+~~~~~~~~~~~~~
+
+.. autoclass:: _pytest.mark.MarkGenerator
+    :members:
+
+
+MarkInfo
+~~~~~~~~
+
+.. autoclass:: _pytest.mark.MarkInfo
+    :members:
+
+
+Mark
+~~~~
+
+.. autoclass:: _pytest.mark.structures.Mark
+    :members:
+
+
+Metafunc
+~~~~~~~~
+
+.. autoclass:: _pytest.python.Metafunc
+    :members:
+
+Module
+~~~~~~
+
+.. autoclass:: _pytest.python.Module()
+    :members:
+    :show-inheritance:
+
+Node
+~~~~
+
+.. autoclass:: _pytest.nodes.Node()
+    :members:
+
+Parser
+~~~~~~
+
+.. autoclass:: _pytest.config.argparsing.Parser()
+    :members:
+
+PluginManager
+~~~~~~~~~~~~~
+
+.. autoclass:: pluggy.PluginManager()
+    :members:
+
+
+PytestPluginManager
+~~~~~~~~~~~~~~~~~~~
+
+.. autoclass:: _pytest.config.PytestPluginManager()
+    :members:
+    :undoc-members:
+    :show-inheritance:
+
+Session
+~~~~~~~
+
+.. autoclass:: _pytest.main.Session()
+    :members:
+    :show-inheritance:
+
+TestReport
+~~~~~~~~~~
+
+.. autoclass:: _pytest.runner.TestReport()
+    :members:
+    :inherited-members:
+
+_Result
+~~~~~~~
+
+.. autoclass:: pluggy._Result
+    :members:
+
+Special Variables
+-----------------
+
+pytest treats some global variables in a special manner when defined in a test module.
+
+
+pytest_plugins
+~~~~~~~~~~~~~~
+
+**Tutorial**: :ref:`available installable plugins`
+
+Can be declared at the **global** level in *test modules* and *conftest.py files* to register additional plugins.
+Can be either a ``str`` or ``Sequence[str]``.
+
+.. code-block:: python
+
+    pytest_plugins = "myapp.testsupport.myplugin"
+
+.. code-block:: python
+
+    pytest_plugins = ("myapp.testsupport.tools", "myapp.testsupport.regression")
+
+
+pytest_mark
+~~~~~~~~~~~
+
+**Tutorial**: :ref:`scoped-marking`
+
+Can be declared at the **global** level in *test modules* to apply one or more :ref:`marks <marks ref>` to all
+test functions and methods. Can be either a single mark or a sequence of marks.
+
+.. code-block:: python
+
+    import pytest
+
+    pytestmark = pytest.mark.webtest
+
+
+.. code-block:: python
+
+    import pytest
+
+    pytestmark = (pytest.mark.integration, pytest.mark.slow)
+
+PYTEST_DONT_REWRITE (module docstring)
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+The text ``PYTEST_DONT_REWRITE`` can be add to any **module docstring** to disable
+:ref:`assertion rewriting <assert introspection>` for that module.
+
+
+Environment Variables
+---------------------
+
+Environment variables that can be used to change pytest's behavior.
+
+PYTEST_ADDOPTS
+~~~~~~~~~~~~~~
+
+This contains a command-line (parsed by the py:mod:`shlex` module) that will be **prepended** to the command line given
+by the user, see :ref:`adding default options` for more information.
+
+PYTEST_DEBUG
+~~~~~~~~~~~~
+
+When set, pytest will print tracing and debug information.
+
+PYTEST_PLUGINS
+~~~~~~~~~~~~~~
+
+Contains comma-separated list of modules that should be loaded as plugins:
+
+.. code-block:: bash
+
+    export PYTEST_PLUGINS=mymodule.plugin,xdist
+
+
+PYTEST_CURRENT_TEST
+~~~~~~~~~~~~~~~~~~~
+
+This is not meant to be set by users, but is set by pytest internally with the name of the current test so other
+processes can inspect it, see :ref:`pytest current test env` for more information.
+
+
+.. _`ini options ref`:
+
+Configuration Options
+---------------------
+
+Here is a list of builtin configuration options that may be written in a ``pytest.ini``, ``tox.ini`` or ``setup.cfg``
+file, usually located at the root of your repository. All options must be under a ``[pytest]`` section
+(``[tool:pytest]`` for ``setup.cfg`` files).
+
+Configuration file options may be overwritten in the command-line by using ``-o/--override``, which can also be
+passed multiple times. The expected format is ``name=value``. For example::
+
+   pytest -o console_output_style=classic -o cache_dir=/tmp/mycache
+
+
+.. confval:: addopts
+
+   Add the specified ``OPTS`` to the set of command line arguments as if they
+   had been specified by the user. Example: if you have this ini file content:
+
+   .. code-block:: ini
+
+        # content of pytest.ini
+        [pytest]
+        addopts = --maxfail=2 -rf  # exit after 2 failures, report fail info
+
+   issuing ``pytest test_hello.py`` actually means::
+
+        pytest --maxfail=2 -rf test_hello.py
+
+   Default is to add no options.
+
+
+.. confval:: cache_dir
+
+   .. versionadded:: 3.2
+
+   Sets a directory where stores content of cache plugin. Default directory is
+   ``.pytest_cache`` which is created in :ref:`rootdir <rootdir>`. Directory may be
+   relative or absolute path. If setting relative path, then directory is created
+   relative to :ref:`rootdir <rootdir>`. Additionally path may contain environment
+   variables, that will be expanded. For more information about cache plugin
+   please refer to :ref:`cache_provider`.
+
+
+.. confval:: confcutdir
+
+   Sets a directory where search upwards for ``conftest.py`` files stops.
+   By default, pytest will stop searching for ``conftest.py`` files upwards
+   from ``pytest.ini``/``tox.ini``/``setup.cfg`` of the project if any,
+   or up to the file-system root.
+
+
+.. confval:: console_output_style
+
+   .. versionadded:: 3.3
+
+   Sets the console output style while running tests:
+
+   * ``classic``: classic pytest output.
+   * ``progress``: like classic pytest output, but with a progress indicator.
+
+   The default is ``progress``, but you can fallback to ``classic`` if you prefer or
+   the new mode is causing unexpected problems:
+
+   .. code-block:: ini
+
+        # content of pytest.ini
+        [pytest]
+        console_output_style = classic
+
+
+.. confval:: doctest_encoding
+
+   .. versionadded:: 3.1
+
+   Default encoding to use to decode text files with docstrings.
+   :doc:`See how pytest handles doctests <doctest>`.
+
+
+.. confval:: doctest_optionflags
+
+   One or more doctest flag names from the standard ``doctest`` module.
+   :doc:`See how pytest handles doctests <doctest>`.
+
+
+.. confval:: empty_parameter_set_mark
+
+    .. versionadded:: 3.4
+
+    Allows to pick the action for empty parametersets in parameterization
+
+    * ``skip`` skips tests with an empty parameterset (default)
+    * ``xfail`` marks tests with an empty parameterset as xfail(run=False)
+
+    .. code-block:: ini
+
+      # content of pytest.ini
+      [pytest]
+      empty_parameter_set_mark = xfail
+
+    .. note::
+
+      The default value of this option is planned to change to ``xfail`` in future releases
+      as this is considered less error prone, see `#3155 <https://github.com/pytest-dev/pytest/issues/3155>`_
+      for more details.
+
+
+.. confval:: filterwarnings
+
+   .. versionadded:: 3.1
+
+   Sets a list of filters and actions that should be taken for matched
+   warnings. By default all warnings emitted during the test session
+   will be displayed in a summary at the end of the test session.
+
+   .. code-block:: ini
+
+        # content of pytest.ini
+        [pytest]
+        filterwarnings =
+            error
+            ignore::DeprecationWarning
+
+   This tells pytest to ignore deprecation warnings and turn all other warnings
+   into errors. For more information please refer to :ref:`warnings`.
+
+
+.. confval:: junit_suite_name
+
+    .. versionadded:: 3.1
+
+    To set the name of the root test suite xml item, you can configure the ``junit_suite_name`` option in your config file:
+
+    .. code-block:: ini
+
+        [pytest]
+        junit_suite_name = my_suite
+
+
+.. confval:: log_cli_date_format
+
+    .. versionadded:: 3.3
+
+    Sets a :py:func:`time.strftime`-compatible string that will be used when formatting dates for live logging.
+
+    .. code-block:: ini
+
+        [pytest]
+        log_cli_date_format = %Y-%m-%d %H:%M:%S
+
+    For more information, see :ref:`live_logs`.
+
+.. confval:: log_cli_format
+
+    .. versionadded:: 3.3
+
+    Sets a :py:mod:`logging`-compatible string used to format live logging messages.
+
+    .. code-block:: ini
+
+        [pytest]
+        log_cli_format = %(asctime)s %(levelname)s %(message)s
+
+    For more information, see :ref:`live_logs`.
+
+
+.. confval:: log_cli_level
+
+    .. versionadded:: 3.3
+
+    Sets the minimum log message level that should be captured for live logging. The integer value or
+    the names of the levels can be used.
+
+    .. code-block:: ini
+
+        [pytest]
+        log_cli_level = INFO
+
+    For more information, see :ref:`live_logs`.
+
+
+.. confval:: log_date_format
+
+    .. versionadded:: 3.3
+
+    Sets a :py:func:`time.strftime`-compatible string that will be used when formatting dates for logging capture.
+
+    .. code-block:: ini
+
+        [pytest]
+        log_date_format = %Y-%m-%d %H:%M:%S
+
+    For more information, see :ref:`logging`.
+
+
+.. confval:: log_file
+
+    .. versionadded:: 3.3
+
+    Sets a file name relative to the ``pytest.ini`` file where log messages should be written to, in addition
+    to the other logging facilities that are active.
+
+    .. code-block:: ini
+
+        [pytest]
+        log_file = logs/pytest-logs.txt
+
+    For more information, see :ref:`logging`.
+
+
+.. confval:: log_file_date_format
+
+    .. versionadded:: 3.3
+
+    Sets a :py:func:`time.strftime`-compatible string that will be used when formatting dates for the logging file.
+
+    .. code-block:: ini
+
+        [pytest]
+        log_file_date_format = %Y-%m-%d %H:%M:%S
+
+    For more information, see :ref:`logging`.
+
+.. confval:: log_file_format
+
+    .. versionadded:: 3.3
+
+    Sets a :py:mod:`logging`-compatible string used to format logging messages redirected to the logging file.
+
+    .. code-block:: ini
+
+        [pytest]
+        log_file_format = %(asctime)s %(levelname)s %(message)s
+
+    For more information, see :ref:`logging`.
+
+.. confval:: log_file_level
+
+    .. versionadded:: 3.3
+
+    Sets the minimum log message level that should be captured for the logging file. The integer value or
+    the names of the levels can be used.
+
+    .. code-block:: ini
+
+        [pytest]
+        log_file_level = INFO
+
+    For more information, see :ref:`logging`.
+
+
+.. confval:: log_format
+
+    .. versionadded:: 3.3
+
+    Sets a :py:mod:`logging`-compatible string used to format captured logging messages.
+
+    .. code-block:: ini
+
+        [pytest]
+        log_format = %(asctime)s %(levelname)s %(message)s
+
+    For more information, see :ref:`logging`.
+
+
+.. confval:: log_level
+
+    .. versionadded:: 3.3
+
+    Sets the minimum log message level that should be captured for logging capture. The integer value or
+    the names of the levels can be used.
+
+    .. code-block:: ini
+
+        [pytest]
+        log_level = INFO
+
+    For more information, see :ref:`logging`.
+
+
+.. confval:: log_print
+
+    .. versionadded:: 3.3
+
+    If set to ``False``, will disable displaying captured logging messages for failed tests.
+
+    .. code-block:: ini
+
+        [pytest]
+        log_print = False
+
+    For more information, see :ref:`logging`.
+
+
+.. confval:: markers
+
+    List of markers that are allowed in test functions, enforced when ``--strict`` command-line argument is used.
+    You can use a marker name per line, indented from the option name.
+
+    .. code-block:: ini
+
+        [pytest]
+        markers =
+            slow
+            serial
+
+.. confval:: minversion
+
+   Specifies a minimal pytest version required for running tests.
+
+   .. code-block:: ini
+
+        # content of pytest.ini
+        [pytest]
+        minversion = 3.0  # will fail if we run with pytest-2.8
+
+
+.. confval:: norecursedirs
+
+   Set the directory basename patterns to avoid when recursing
+   for test discovery.  The individual (fnmatch-style) patterns are
+   applied to the basename of a directory to decide if to recurse into it.
+   Pattern matching characters::
+
+        *       matches everything
+        ?       matches any single character
+        [seq]   matches any character in seq
+        [!seq]  matches any char not in seq
+
+   Default patterns are ``'.*', 'build', 'dist', 'CVS', '_darcs', '{arch}', '*.egg', 'venv'``.
+   Setting a ``norecursedirs`` replaces the default.  Here is an example of
+   how to avoid certain directories:
+
+   .. code-block:: ini
+
+        [pytest]
+        norecursedirs = .svn _build tmp*
+
+   This would tell ``pytest`` to not look into typical subversion or
+   sphinx-build directories or into any ``tmp`` prefixed directory.
+
+   Additionally, ``pytest`` will attempt to intelligently identify and ignore a
+   virtualenv by the presence of an activation script.  Any directory deemed to
+   be the root of a virtual environment will not be considered during test
+   collection unless ``‑‑collect‑in‑virtualenv`` is given.  Note also that
+   ``norecursedirs`` takes precedence over ``‑‑collect‑in‑virtualenv``; e.g. if
+   you intend to run tests in a virtualenv with a base directory that matches
+   ``'.*'`` you *must* override ``norecursedirs`` in addition to using the
+   ``‑‑collect‑in‑virtualenv`` flag.
+
+
+.. confval:: python_classes
+
+   One or more name prefixes or glob-style patterns determining which classes
+   are considered for test collection. By default, pytest will consider any
+   class prefixed with ``Test`` as a test collection.  Here is an example of how
+   to collect tests from classes that end in ``Suite``:
+
+   .. code-block:: ini
+
+        [pytest]
+        python_classes = *Suite
+
+   Note that ``unittest.TestCase`` derived classes are always collected
+   regardless of this option, as ``unittest``'s own collection framework is used
+   to collect those tests.
+
+
+.. confval:: python_files
+
+   One or more Glob-style file patterns determining which python files
+   are considered as test modules. By default, pytest will consider
+   any file matching with ``test_*.py`` and ``*_test.py`` globs as a test
+   module.
+
+
+.. confval:: python_functions
+
+   One or more name prefixes or glob-patterns determining which test functions
+   and methods are considered tests. By default, pytest will consider any
+   function prefixed with ``test`` as a test.  Here is an example of how
+   to collect test functions and methods that end in ``_test``:
+
+   .. code-block:: ini
+
+        [pytest]
+        python_functions = *_test
+
+   Note that this has no effect on methods that live on a ``unittest
+   .TestCase`` derived class, as ``unittest``'s own collection framework is used
+   to collect those tests.
+
+   See :ref:`change naming conventions` for more detailed examples.
+
+
+.. confval:: testpaths
+
+   .. versionadded:: 2.8
+
+   Sets list of directories that should be searched for tests when
+   no specific directories, files or test ids are given in the command line when
+   executing pytest from the :ref:`rootdir <rootdir>` directory.
+   Useful when all project tests are in a known location to speed up
+   test collection and to avoid picking up undesired tests by accident.
+
+   .. code-block:: ini
+
+        [pytest]
+        testpaths = testing doc
+
+   This tells pytest to only look for tests in ``testing`` and ``doc``
+   directories when executing from the root directory.
+
+
+.. confval:: usefixtures
+
+    List of fixtures that will be applied to all test functions; this is semantically the same to apply
+    the ``@pytest.mark.usefixtures`` marker to all test functions.
+
+
+    .. code-block:: ini
+
+        [pytest]
+        usefixtures =
+            clean_db
+
+
+.. confval:: xfail_strict
+
+    If set to ``True``, tests marked with ``@pytest.mark.xfail`` that actually succeed will by default fail the
+    test suite.
+    For more information, see :ref:`xfail strict tutorial`.
+
+
+    .. code-block:: ini
+
+        [pytest]
+        xfail_strict = True
--- a/third_party/python/pytest/doc/en/requirements.txt
+++ b/third_party/python/pytest/doc/en/requirements.txt
@@ -1,3 +1,4 @@
 # pinning sphinx to 1.4.* due to search issues with rtd:
 # https://github.com/rtfd/readthedocs-sphinx-ext/issues/25
 sphinx ==1.4.*
+sphinxcontrib-trio
--- a/third_party/python/pytest/doc/en/skipping.rst
+++ b/third_party/python/pytest/doc/en/skipping.rst
@@ -53,31 +53,43 @@ Alternatively, it is also possible to sk
 by calling the ``pytest.skip(reason)`` function:
 
 .. code-block:: python
 
     def test_function():
         if not valid_config():
             pytest.skip("unsupported configuration")
 
+It is also possible to skip the whole module using
+``pytest.skip(reason, allow_module_level=True)`` at the module level:
+
+.. code-block:: python
+
+    import pytest
+
+    if not pytest.config.getoption("--custom-flag"):
+        pytest.skip("--custom-flag is missing, skipping tests", allow_module_level=True)
+
 The imperative method is useful when it is not possible to evaluate the skip condition
 during import time.
 
+**Reference**: :ref:`pytest.mark.skip ref`
+
 ``skipif``
 ~~~~~~~~~~
 
 .. versionadded:: 2.0
 
 If you wish to skip something conditionally then you can use ``skipif`` instead.
 Here is an example of marking a test function to be skipped
-when run on a Python3.3 interpreter::
+when run on a Python3.6 interpreter::
 
     import sys
-    @pytest.mark.skipif(sys.version_info < (3,3),
-                        reason="requires python3.3")
+    @pytest.mark.skipif(sys.version_info < (3,6),
+                        reason="requires python3.6")
     def test_function():
         ...
 
 If the condition evaluates to ``True`` during collection, the test function will be skipped,
 with the specified reason appearing in the summary when using ``-rs``.
 
 You can share ``skipif`` markers between modules.  Consider this test module::
 
@@ -101,16 +113,18 @@ You can import the marker and reuse it i
 For larger test suites it's usually a good idea to have one file
 where you define the markers which you then consistently apply
 throughout your test suite.
 
 Alternatively, you can use :ref:`condition strings
 <string conditions>` instead of booleans, but they can't be shared between modules easily
 so they are supported mainly for backward compatibility reasons.
 
+**Reference**: :ref:`pytest.mark.skipif ref`
+
 
 Skip all test functions of a class or module
 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 
 You can use the ``skipif`` marker (as any other marker) on classes::
 
     @pytest.mark.skipif(sys.platform == 'win32',
                         reason="does not run on windows")
@@ -173,29 +187,29 @@ Summary
 ~~~~~~~
 
 Here's a quick guide on how to skip tests in a module in different situations:
 
 1. Skip all tests in a module unconditionally:
 
   .. code-block:: python
 
-        pytestmark = pytest.mark.skip('all tests still WIP')
+        pytestmark = pytest.mark.skip("all tests still WIP")
 
 2. Skip all tests in a module based on some condition:
 
   .. code-block:: python
 
-        pytestmark = pytest.mark.skipif(sys.platform == 'win32', 'tests for linux only')
+        pytestmark = pytest.mark.skipif(sys.platform == "win32", "tests for linux only")
 
 3. Skip all tests in a module if some import is missing:
 
   .. code-block:: python
 
-        pexpect = pytest.importorskip('pexpect')
+        pexpect = pytest.importorskip("pexpect")
 
 
 .. _xfail:
 
 XFail: mark test functions as expected to fail
 ----------------------------------------------
 
 You can use the ``xfail`` marker to indicate that you
@@ -217,25 +231,20 @@ imperatively:
     def test_function():
         if not valid_config():
             pytest.xfail("failing configuration (but should work)")
 
 This will unconditionally make ``test_function`` ``XFAIL``. Note that no other code is executed
 after ``pytest.xfail`` call, differently from the marker. That's because it is implemented
 internally by raising a known exception.
 
-Here's the signature of the ``xfail`` **marker** (not the function), using Python 3 keyword-only
-arguments syntax:
-
-.. code-block:: python
-
-    def xfail(condition=None, *, reason=None, raises=None, run=True, strict=False):
+**Reference**: :ref:`pytest.mark.xfail ref`
 
 
-
+.. _`xfail strict tutorial`:
 
 ``strict`` parameter
 ~~~~~~~~~~~~~~~~~~~~
 
 .. versionadded:: 2.9
 
 Both ``XFAIL`` and ``XPASS`` don't fail the test suite, unless the ``strict`` keyword-only
 parameter is passed as ``True``:
@@ -259,18 +268,18 @@ You can change the default value of the 
 
 
 ``reason`` parameter
 ~~~~~~~~~~~~~~~~~~~~
 
 As with skipif_ you can also mark your expectation of a failure
 on a particular platform::
 
-    @pytest.mark.xfail(sys.version_info >= (3,3),
-                       reason="python3.3 api changes")
+    @pytest.mark.xfail(sys.version_info >= (3,6),
+                       reason="python3.6 api changes")
     def test_function():
         ...
 
 
 ``raises`` parameter
 ~~~~~~~~~~~~~~~~~~~~
 
 If you want to be more specific as to why the test is failing, you can specify
@@ -316,53 +325,59 @@ Examples
 
 Here is a simple test file with the several usages:
 
 .. literalinclude:: example/xfail_demo.py
 
 Running it with the report-on-xfail option gives this output::
 
     example $ pytest -rx xfail_demo.py
-    ======= test session starts ========
+    =========================== test session starts ============================
     platform linux -- Python 3.x.y, pytest-3.x.y, py-1.x.y, pluggy-0.x.y
     rootdir: $REGENDOC_TMPDIR/example, inifile:
     collected 7 items
-    
-    xfail_demo.py xxxxxxx
-    ======= short test summary info ========
+
+    xfail_demo.py xxxxxxx                                                [100%]
+    ========================= short test summary info ==========================
     XFAIL xfail_demo.py::test_hello
     XFAIL xfail_demo.py::test_hello2
-      reason: [NOTRUN] 
+      reason: [NOTRUN]
     XFAIL xfail_demo.py::test_hello3
       condition: hasattr(os, 'sep')
     XFAIL xfail_demo.py::test_hello4
       bug 110
     XFAIL xfail_demo.py::test_hello5
       condition: pytest.__version__[0] != "17"
     XFAIL xfail_demo.py::test_hello6
       reason: reason
     XFAIL xfail_demo.py::test_hello7
-    
-    ======= 7 xfailed in 0.12 seconds ========
+
+    ======================== 7 xfailed in 0.12 seconds =========================
 
 .. _`skip/xfail with parametrize`:
 
 Skip/xfail with parametrize
 ---------------------------
 
 It is possible to apply markers like skip and xfail to individual
 test instances when using parametrize:
 
 .. code-block:: python
 
     import pytest
 
-    @pytest.mark.parametrize(("n", "expected"), [
-        (1, 2),
-    pytest.param(1, 0, marks=pytest.mark.xfail),
-	pytest.param(1, 3, marks=pytest.mark.xfail(reason="some bug")),
-        (2, 3),
-        (3, 4),
-        (4, 5),
-    pytest.param(10, 11, marks=pytest.mark.skipif(sys.version_info >= (3, 0), reason="py2k")),
-    ])
+
+    @pytest.mark.parametrize(
+        ("n", "expected"),
+        [
+            (1, 2),
+            pytest.param(1, 0, marks=pytest.mark.xfail),
+            pytest.param(1, 3, marks=pytest.mark.xfail(reason="some bug")),
+            (2, 3),
+            (3, 4),
+            (4, 5),
+            pytest.param(
+                10, 11, marks=pytest.mark.skipif(sys.version_info >= (3, 0), reason="py2k")
+            ),
+        ],
+    )
     def test_increment(n, expected):
         assert n + 1 == expected
--- a/third_party/python/pytest/doc/en/talks.rst
+++ b/third_party/python/pytest/doc/en/talks.rst
@@ -93,13 +93,8 @@ Plugin specific examples:
 .. _`monkeypatch plugin`: monkeypatch.html
 .. _`application setup in test functions with fixtures`: fixture.html#interdependent-fixtures
 .. _`simultaneously test your code on all platforms`: http://tetamap.wordpress.com/2009/03/23/new-simultanously-test-your-code-on-all-platforms/
 .. _`monkey patching done right`: http://tetamap.wordpress.com/2009/03/03/monkeypatching-in-unit-tests-done-right/
 .. _`putting test-hooks into local or global plugins`: http://tetamap.wordpress.com/2009/05/14/putting-test-hooks-into-local-and-global-plugins/
 .. _`parametrizing tests, generalized`: http://tetamap.wordpress.com/2009/05/13/parametrizing-python-tests-generalized/
 .. _`generating parametrized tests with fixtures`: parametrize.html#test-generators
 .. _`test generators and cached setup`: http://bruynooghe.blogspot.com/2010/06/pytest-test-generators-and-cached-setup.html
-
-
-
-
-
deleted file mode 100644
--- a/third_party/python/pytest/doc/en/test/attic.rst
+++ /dev/null
@@ -1,117 +0,0 @@
-===============================================
-ATTIC documentation
-===============================================
-
-XXX REVIEW and remove the below  XXX
-
-Customizing the testing process
-===============================
-
-writing conftest.py files
------------------------------------
-
-You may put conftest.py files containing project-specific
-configuration in your project's root directory, it's usually
-best to put it just into the same directory level as your
-topmost ``__init__.py``.  In fact, ``pytest`` performs
-an "upwards" search starting from the directory that you specify
-to be tested and will lookup configuration values right-to-left.
-You may have options that reside e.g. in your home directory
-but note that project specific settings will be considered
-first.  There is a flag that helps you debugging your
-conftest.py configurations::
-
-    pytest --trace-config
-
-
-customizing the collecting and running process
------------------------------------------------
-
-To introduce different test items you can create
-one or more ``conftest.py`` files in your project.
-When the collection process traverses directories
-and modules the default collectors will produce
-custom Collectors and Items if they are found
-in a local ``conftest.py`` file.
-
-
-Customizing the collection process in a module
-----------------------------------------------
-
-If you have a module where you want to take responsibility for
-collecting your own test Items and possibly even for executing
-a test then you can provide `generative tests`_ that yield
-callables and possibly arguments as a tuple.   This is especially
-useful for calling application test machinery with different
-parameter sets but counting each of the calls as a separate
-tests.
-
-.. _`generative tests`: features.html#generative-tests
-
-The other extension possibility is about
-specifying a custom test ``Item`` class which
-is responsible for setting up and executing an underlying
-test.  Or you can extend the collection process for a whole
-directory tree by putting Items in a ``conftest.py`` configuration file.
-The collection process dynamically consults the *chain of conftest.py*
-modules to determine collectors and items at ``Directory``, ``Module``,
-``Class``, ``Function`` or ``Generator`` level respectively.
-
-Customizing execution of Items and Functions
-----------------------------------------------------
-
-- ``pytest.Function`` test items control execution
-  of a test function through its ``function.runtest()`` method.
-  This method is responsible for performing setup and teardown
-  ("Test Fixtures") for a test Function.
-
-- ``Function.execute(target, *args)`` methods are invoked by
-  the default ``Function.run()`` to actually execute a python
-  function with the given (usually empty set of) arguments.
-
-.. _`py-dev mailing list`: http://codespeak.net/mailman/listinfo/py-dev
-
-
-.. _`test generators`: funcargs.html#test-generators
-
-.. _`generative tests`:
-
-generative tests: yielding parametrized tests
-====================================================
-
-Deprecated since 1.0 in favour of `test generators`_.
-
-*Generative tests* are test methods that are *generator functions* which
-``yield`` callables and their arguments.  This is useful for running a
-test function multiple times against different parameters.  Example::
-
-    def test_generative():
-        for x in (42,17,49):
-            yield check, x
-
-    def check(arg):
-        assert arg % 7 == 0   # second generated tests fails!
-
-Note that ``test_generative()`` will cause three tests
-to get run, notably ``check(42)``, ``check(17)`` and ``check(49)``
-of which the middle one will obviously fail.
-
-To make it easier to distinguish the generated tests it is possible to specify an explicit name for them, like for example::
-
-    def test_generative():
-        for x in (42,17,49):
-            yield "case %d" % x, check, x
-
-
-disabling a test class
-----------------------
-
-If you want to disable a complete test class you
-can set the class-level attribute ``disabled``.
-For example, in order to avoid running some tests on Win32::
-
-    class TestPosixOnly(object):
-        disabled = sys.platform == 'win32'
-
-        def test_xxx(self):
-            ...
deleted file mode 100644
--- a/third_party/python/pytest/doc/en/test/config.html
+++ /dev/null
@@ -1,18 +0,0 @@
-<html>
-    <head>
-        <meta http-equiv="refresh" content=" 1 ; URL=customize.html" />
-    </head>
-
-    <body>
-<script type="text/javascript">
-var gaJsHost = (("https:" == document.location.protocol) ? "https://ssl." : "http://www.");
-document.write(unescape("%3Cscript src='" + gaJsHost + "google-analytics.com/ga.js' type='text/javascript'%3E%3C/script%3E"));
-</script>
-<script type="text/javascript">
-try {
-var pageTracker = _gat._getTracker("UA-7597274-3");
-pageTracker._trackPageview();
-} catch(err) {}</script>
-</body>
-</html>
-    
deleted file mode 100644
--- a/third_party/python/pytest/doc/en/test/dist.html
+++ /dev/null
@@ -1,18 +0,0 @@
-<html>
-    <head>
-        <meta http-equiv="refresh" content=" 1 ; URL=plugin/xdist.html" />
-    </head>
-
-    <body>
-<script type="text/javascript">
-var gaJsHost = (("https:" == document.location.protocol) ? "https://ssl." : "http://www.");
-document.write(unescape("%3Cscript src='" + gaJsHost + "google-analytics.com/ga.js' type='text/javascript'%3E%3C/script%3E"));
-</script>
-<script type="text/javascript">
-try {
-var pageTracker = _gat._getTracker("UA-7597274-3");
-pageTracker._trackPageview();
-} catch(err) {}</script>
-</body>
-</html>
-    
deleted file mode 100644
--- a/third_party/python/pytest/doc/en/test/extend.html
+++ /dev/null
@@ -1,18 +0,0 @@
-<html>
-    <head>
-        <meta http-equiv="refresh" content=" 1 ; URL=customize.html" />
-    </head>
-
-    <body>
-<script type="text/javascript">
-var gaJsHost = (("https:" == document.location.protocol) ? "https://ssl." : "http://www.");
-document.write(unescape("%3Cscript src='" + gaJsHost + "google-analytics.com/ga.js' type='text/javascript'%3E%3C/script%3E"));
-</script>
-<script type="text/javascript">
-try {
-var pageTracker = _gat._getTracker("UA-7597274-3");
-pageTracker._trackPageview();
-} catch(err) {}</script>
-</body>
-</html>
-    
deleted file mode 100644
--- a/third_party/python/pytest/doc/en/test/index.rst
+++ /dev/null
@@ -1,35 +0,0 @@
-=======================================
-pytest documentation index
-=======================================
-
-
-features_: overview and discussion of features.
-
-quickstart_: getting started with writing a simple test.
-
-`talks, tutorials, examples`_: tutorial examples, slides
-
-funcargs_: powerful parametrized test function setup
-
-`plugins`_: list of available plugins with usage examples and feature details.
-
-customize_: configuration, customization, extensions
-
-changelog_: history of changes covering last releases
-
-**Continuous Integration of pytest's own tests and plugins with Hudson**:
-
-    `http://hudson.testrun.org/view/pytest`_
-
-.. _`http://hudson.testrun.org/view/pytest`: http://hudson.testrun.org/view/pytest/
-
-
-.. _changelog: ../changelog.html
-.. _`plugins`: plugin/index.html
-.. _`talks, tutorials, examples`: talks.html
-.. _quickstart: quickstart.html
-.. _features: features.html
-.. _funcargs: funcargs.html
-.. _customize: customize.html
-
-
deleted file mode 100644
--- a/third_party/python/pytest/doc/en/test/mission.rst
+++ /dev/null
@@ -1,13 +0,0 @@
-
-Mission
-====================================
-
-``pytest`` strives to make testing a fun and no-boilerplate effort.
-
-The tool is distributed as a `pytest` package.  Its project independent
-``pytest`` command line tool helps you to:
-
-* rapidly collect and run tests
-* run unit- or doctests, functional or integration tests
-* distribute tests to multiple environments
-* use local or global plugins for custom test types and setup
deleted file mode 100644
--- a/third_party/python/pytest/doc/en/test/plugin/cov.rst
+++ /dev/null
@@ -1,230 +0,0 @@
-
-produce code coverage reports using the 'coverage' package, including support for distributed testing.
-======================================================================================================
-
-
-.. contents::
-  :local:
-
-This plugin produces coverage reports.  It supports centralised testing and distributed testing in
-both load and each modes.  It also supports coverage of subprocesses.
-
-All features offered by the coverage package should be available, either through pytest-cov or
-through coverage's config file.
-
-
-Installation
-------------
-
-The `pytest-cov`_ package may be installed with pip or easy_install::
-
-    pip install pytest-cov
-    easy_install pytest-cov
-
-.. _`pytest-cov`: http://pypi.python.org/pypi/pytest-cov/
-
-
-Uninstallation
---------------
-
-Uninstalling packages is supported by pip::
-
-    pip uninstall pytest-cov
-
-However easy_install does not provide an uninstall facility.
-
-.. IMPORTANT::
-
-    Ensure that you manually delete the init_covmain.pth file in your
-    site-packages directory.
-
-    This file starts coverage collection of subprocesses if appropriate during
-    site initialization at python startup.
-
-
-Usage
------
-
-Centralised Testing
-~~~~~~~~~~~~~~~~~~~
-
-Centralised testing will report on the combined coverage of the main process and all of it's
-subprocesses.
-
-Running centralised testing::
-
-    pytest --cov myproj tests/
-
-Shows a terminal report::
-
-    -------------------- coverage: platform linux2, python 2.6.4-final-0 ---------------------
-    Name                 Stmts   Miss  Cover
-    ----------------------------------------
-    myproj/__init__          2      0   100%
-    myproj/myproj          257     13    94%
-    myproj/feature4286      94      7    92%
-    ----------------------------------------
-    TOTAL                  353     20    94%
-
-
-Distributed Testing: Load
-~~~~~~~~~~~~~~~~~~~~~~~~~
-
-Distributed testing with dist mode set to load will report on the combined coverage of all slaves.
-The slaves may be spread out over any number of hosts and each slave may be located anywhere on the
-file system.  Each slave will have it's subprocesses measured.
-
-Running distributed testing with dist mode set to load::
-
-    pytest --cov myproj -n 2 tests/
-
-Shows a terminal report::
-
-    -------------------- coverage: platform linux2, python 2.6.4-final-0 ---------------------
-    Name                 Stmts   Miss  Cover
-    ----------------------------------------
-    myproj/__init__          2      0   100%
-    myproj/myproj          257     13    94%
-    myproj/feature4286      94      7    92%
-    ----------------------------------------
-    TOTAL                  353     20    94%
-
-
-Again but spread over different hosts and different directories::
-
-    pytest --cov myproj --dist load
-            --tx ssh=memedough@host1//chdir=testenv1
-            --tx ssh=memedough@host2//chdir=/tmp/testenv2//python=/tmp/env1/bin/python
-            --rsyncdir myproj --rsyncdir tests --rsync examples
-            tests/
-
-Shows a terminal report::
-
-    -------------------- coverage: platform linux2, python 2.6.4-final-0 ---------------------
-    Name                 Stmts   Miss  Cover
-    ----------------------------------------
-    myproj/__init__          2      0   100%
-    myproj/myproj          257     13    94%
-    myproj/feature4286      94      7    92%
-    ----------------------------------------
-    TOTAL                  353     20    94%
-
-
-Distributed Testing: Each
-~~~~~~~~~~~~~~~~~~~~~~~~~
-
-Distributed testing with dist mode set to each will report on the combined coverage of all slaves.
-Since each slave is running all tests this allows generating a combined coverage report for multiple
-environments.
-
-Running distributed testing with dist mode set to each::
-
-    pytest --cov myproj --dist each
-            --tx popen//chdir=/tmp/testenv3//python=/usr/local/python27/bin/python
-            --tx ssh=memedough@host2//chdir=/tmp/testenv4//python=/tmp/env2/bin/python
-            --rsyncdir myproj --rsyncdir tests --rsync examples
-            tests/
-
-Shows a terminal report::
-
-    ---------------------------------------- coverage ----------------------------------------
-                              platform linux2, python 2.6.5-final-0
-                              platform linux2, python 2.7.0-final-0
-    Name                 Stmts   Miss  Cover
-    ----------------------------------------
-    myproj/__init__          2      0   100%
-    myproj/myproj          257     13    94%
-    myproj/feature4286      94      7    92%
-    ----------------------------------------
-    TOTAL                  353     20    94%
-
-
-Reporting
----------
-
-It is possible to generate any combination of the reports for a single test run.
-
-The available reports are terminal (with or without missing line numbers shown), HTML, XML and
-annotated source code.
-
-The terminal report without line numbers (default)::
-
-    pytest --cov-report term --cov myproj tests/
-
-    -------------------- coverage: platform linux2, python 2.6.4-final-0 ---------------------
-    Name                 Stmts   Miss  Cover
-    ----------------------------------------
-    myproj/__init__          2      0   100%
-    myproj/myproj          257     13    94%
-    myproj/feature4286      94      7    92%
-    ----------------------------------------
-    TOTAL                  353     20    94%
-
-
-The terminal report with line numbers::
-
-    pytest --cov-report term-missing --cov myproj tests/
-
-    -------------------- coverage: platform linux2, python 2.6.4-final-0 ---------------------
-    Name                 Stmts   Miss  Cover   Missing
-    --------------------------------------------------
-    myproj/__init__          2      0   100%
-    myproj/myproj          257     13    94%   24-26, 99, 149, 233-236, 297-298, 369-370
-    myproj/feature4286      94      7    92%   183-188, 197
-    --------------------------------------------------
-    TOTAL                  353     20    94%
-
-
-The remaining three reports output to files without showing anything on the terminal (useful for
-when the output is going to a continuous integration server)::
-
-    pytest --cov-report html --cov-report xml --cov-report annotate --cov myproj tests/
-
-
-Coverage Data File
-------------------
-
-The data file is erased at the beginning of testing to ensure clean data for each test run.
-
-The data file is left at the end of testing so that it is possible to use normal coverage tools to
-examine it.
-
-
-Limitations
------------
-
-For distributed testing the slaves must have the pytest-cov package installed.  This is needed since
-the plugin must be registered through setuptools / distribute for pytest to start the plugin on the
-slave.
-
-For subprocess measurement environment variables must make it from the main process to the
-subprocess.  The python used by the subprocess must have pytest-cov installed.  The subprocess must
-do normal site initialization so that the environment variables can be detected and coverage
-started.
-
-
-Acknowledgments
-----------------
-
-Holger Krekel for pytest with its distributed testing support.
-
-Ned Batchelder for coverage and its ability to combine the coverage results of parallel runs.
-
-Whilst this plugin has been built fresh from the ground up to support distributed testing it has
-been influenced by the work done on pytest-coverage (Ross Lawley, James Mills, Holger Krekel) and
-nose-cover (Jason Pellerin) which are other coverage plugins for pytest and nose respectively.
-
-No doubt others have contributed to these tools as well.
-
-command line options
---------------------
-
-
-``--cov=path``
-    measure coverage for filesystem path (multi-allowed)
-``--cov-report=type``
-    type of report to generate: term, term-missing, annotate, html, xml (multi-allowed)
-``--cov-config=path``
-    config file for coverage, default: .coveragerc
-
-.. include:: links.txt
deleted file mode 100644
--- a/third_party/python/pytest/doc/en/test/plugin/coverage.rst
+++ /dev/null
@@ -1,51 +0,0 @@
-
-Write and report coverage data with the 'coverage' package.
-===========================================================
-
-
-.. contents::
-  :local:
-
-Note: Original code by Ross Lawley. 
-
-Install
---------------
-
-Use pip to (un)install::
-
-    pip install pytest-coverage 
-    pip uninstall pytest-coverage 
-
-or alternatively use easy_install to install::
-
-    easy_install pytest-coverage 
-
-
-Usage 
--------------
-
-To get full test coverage reports for a particular package type::
-
-    pytest --cover-report=report
-
-command line options
---------------------
-
-
-``--cover=COVERPACKAGES``
-    (multi allowed) only include info from specified package.
-``--cover-report=REPORT_TYPE``
-    html: Directory for html output.
-                    report: Output a text report.
-                    annotate: Annotate your source code for which lines were executed and which were not.
-                    xml: Output an xml report compatible with the cobertura plugin for hudson.
-``--cover-directory=DIRECTORY``
-    Directory for the reports (html / annotate results) defaults to ./coverage
-``--cover-xml-file=XML_FILE``
-    File for the xml report defaults to ./coverage.xml
-``--cover-show-missing``
-    Show missing files
-``--cover-ignore-errors=IGNORE_ERRORS``
-    Ignore errors of finding source files for code.
-
-.. include:: links.txt
deleted file mode 100644
--- a/third_party/python/pytest/doc/en/test/plugin/django.rst
+++ /dev/null
@@ -1,7 +0,0 @@
-pytest_django plugin (EXTERNAL)
-==========================================
-
-pytest_django is a plugin for ``pytest`` that provides a set of useful tools for testing Django applications, checkout Ben Firshman's `pytest_django github page`_.
-
-.. _`pytest_django github page`: http://github.com/bfirsh/pytest_django/tree/master
-
deleted file mode 100644
--- a/third_party/python/pytest/doc/en/test/plugin/figleaf.rst
+++ /dev/null
@@ -1,44 +0,0 @@
-
-report test coverage using the 'figleaf' package.
-=================================================
-
-
-.. contents::
-  :local:
-
-Install
----------------
-
-To install the plugin issue::
-
-    easy_install pytest-figleaf  # or
-    pip install pytest-figleaf   
-
-and if you are using pip you can also uninstall::
-
-    pip uninstall pytest-figleaf
-
-
-Usage
----------------
-
-After installation you can simply type::
-
-    pytest --figleaf [...]
-
-to enable figleaf coverage in your test run.  A default ".figleaf" data file
-and "html" directory will be created.  You can use command line options
-to control where data and html files are created.
-
-command line options
---------------------
-
-
-``--figleaf``
-    trace python coverage with figleaf and write HTML for files below the current working dir
-``--fig-data=dir``
-    set tracing file, default: ".figleaf".
-``--fig-html=dir``
-    set html reporting dir, default "html".
-
-.. include:: links.txt
deleted file mode 100644
--- a/third_party/python/pytest/doc/en/test/plugin/helpconfig.rst
+++ /dev/null
@@ -1,36 +0,0 @@
-
-provide version info, conftest/environment config names.
-========================================================
-
-
-.. contents::
-  :local:
-
-
-
-command line options
---------------------
-
-
-``--version``
-    display py lib version and import information.
-``-p name``
-    early-load given plugin (multi-allowed).
-``--trace-config``
-    trace considerations of conftest.py files.
-``--debug``
-    generate and show internal debugging information.
-``--help-config``
-    show available conftest.py and ENV-variable names.
-
-Start improving this plugin in 30 seconds
-=========================================
-
-
-1. Download `pytest_helpconfig.py`_ plugin source code
-2. put it somewhere as ``pytest_helpconfig.py`` into your import path
-3. a subsequent ``pytest`` run will use your local version
-
-Checkout customize_, other plugins_ or `get in contact`_.
-
-.. include:: links.txt
deleted file mode 100644
--- a/third_party/python/pytest/doc/en/test/plugin/index.rst
+++ /dev/null
@@ -1,68 +0,0 @@
-
-advanced python testing
-=======================
-
-skipping_ advanced skipping for python test functions, classes or modules.
-
-mark_ generic mechanism for marking python functions.
-
-pdb_ interactive debugging with the Python Debugger.
-
-figleaf_ (external) report test coverage using the 'figleaf' package.
-
-monkeypatch_ safely patch object attributes, dicts and environment variables.
-
-coverage_ (external) Write and report coverage data with the 'coverage' package.
-
-cov_ (external) produce code coverage reports using the 'coverage' package, including support for distributed testing.
-
-capture_ configurable per-test stdout/stderr capturing mechanisms.
-
-capturelog_ (external) capture output of logging module.
-
-recwarn_ helpers for asserting deprecation and other warnings.
-
-tmpdir_ provide temporary directories to test functions.
-
-
-distributed testing, CI and deployment
-======================================
-
-xdist_ (external) loop on failing tests, distribute test runs to CPUs and hosts.
-
-pastebin_ submit failure or test session information to a pastebin service.
-
-junitxml_ logging of test results in JUnit-XML format, for use with Hudson
-
-resultlog_ non-xml machine-readable logging of test results.
-
-genscript_ generate standalone test script to be distributed along with an application.
-
-
-testing domains and conventions codecheckers
-============================================
-
-oejskit_ (external) run javascript tests in real life browsers
-
-django_ (external) for testing django applications
-
-unittest_ automatically discover and run traditional "unittest.py" style tests.
-
-nose_ nose-compatibility plugin: allow to run nose test suites natively.
-
-doctest_ collect and execute doctests from modules and test files.
-
-restdoc_ perform ReST syntax, local and remote reference tests on .rst/.txt files.
-
-
-internal, debugging, help functionality
-=======================================
-
-helpconfig_ provide version info, conftest/environment config names.
-
-terminal_ Implements terminal reporting of the full testing process.
-
-hooklog_ log invocations of extension hooks to a file.
-
-
-.. include:: links.txt
deleted file mode 100644
--- a/third_party/python/pytest/doc/en/test/plugin/links.rst
+++ /dev/null
@@ -1,45 +0,0 @@
-.. _`helpconfig`: helpconfig.html
-.. _`pytest_recwarn.py`: http://bitbucket.org/hpk42/py-trunk/raw/1.3.4/py/_plugin/pytest_recwarn.py
-.. _`unittest`: unittest.html
-.. _`pytest_monkeypatch.py`: http://bitbucket.org/hpk42/py-trunk/raw/1.3.4/py/_plugin/pytest_monkeypatch.py
-.. _`pastebin`: pastebin.html
-.. _`skipping`: skipping.html
-.. _`plugins`: index.html
-.. _`mark`: mark.html
-.. _`tmpdir`: tmpdir.html
-.. _`pytest_doctest.py`: http://bitbucket.org/hpk42/py-trunk/raw/1.3.4/py/_plugin/pytest_doctest.py
-.. _`capture`: capture.html
-.. _`pytest_nose.py`: http://bitbucket.org/hpk42/py-trunk/raw/1.3.4/py/_plugin/pytest_nose.py
-.. _`pytest_restdoc.py`: http://bitbucket.org/hpk42/py-trunk/raw/1.3.4/py/_plugin/pytest_restdoc.py
-.. _`restdoc`: restdoc.html
-.. _`xdist`: xdist.html
-.. _`pytest_pastebin.py`: http://bitbucket.org/hpk42/py-trunk/raw/1.3.4/py/_plugin/pytest_pastebin.py
-.. _`pytest_tmpdir.py`: http://bitbucket.org/hpk42/py-trunk/raw/1.3.4/py/_plugin/pytest_tmpdir.py
-.. _`terminal`: terminal.html
-.. _`pytest_hooklog.py`: http://bitbucket.org/hpk42/py-trunk/raw/1.3.4/py/_plugin/pytest_hooklog.py
-.. _`capturelog`: capturelog.html
-.. _`junitxml`: junitxml.html
-.. _`pytest_skipping.py`: http://bitbucket.org/hpk42/py-trunk/raw/1.3.4/py/_plugin/pytest_skipping.py
-.. _`checkout the pytest development version`: ../../install.html#checkout
-.. _`pytest_helpconfig.py`: http://bitbucket.org/hpk42/py-trunk/raw/1.3.4/py/_plugin/pytest_helpconfig.py
-.. _`oejskit`: oejskit.html
-.. _`doctest`: doctest.html
-.. _`pytest_mark.py`: http://bitbucket.org/hpk42/py-trunk/raw/1.3.4/py/_plugin/pytest_mark.py
-.. _`get in contact`: ../../contact.html
-.. _`pytest_capture.py`: http://bitbucket.org/hpk42/py-trunk/raw/1.3.4/py/_plugin/pytest_capture.py
-.. _`figleaf`: figleaf.html
-.. _`customize`: ../customize.html
-.. _`hooklog`: hooklog.html
-.. _`pytest_terminal.py`: http://bitbucket.org/hpk42/py-trunk/raw/1.3.4/py/_plugin/pytest_terminal.py
-.. _`recwarn`: recwarn.html
-.. _`pytest_pdb.py`: http://bitbucket.org/hpk42/py-trunk/raw/1.3.4/py/_plugin/pytest_pdb.py
-.. _`monkeypatch`: monkeypatch.html
-.. _`coverage`: coverage.html
-.. _`resultlog`: resultlog.html
-.. _`cov`: cov.html
-.. _`pytest_junitxml.py`: http://bitbucket.org/hpk42/py-trunk/raw/1.3.4/py/_plugin/pytest_junitxml.py
-.. _`django`: django.html
-.. _`pytest_unittest.py`: http://bitbucket.org/hpk42/py-trunk/raw/1.3.4/py/_plugin/pytest_unittest.py
-.. _`nose`: nose.html
-.. _`pytest_resultlog.py`: http://bitbucket.org/hpk42/py-trunk/raw/1.3.4/py/_plugin/pytest_resultlog.py
-.. _`pdb`: pdb.html
deleted file mode 100644
--- a/third_party/python/pytest/doc/en/test/plugin/nose.rst
+++ /dev/null
@@ -1,56 +0,0 @@
-
-nose-compatibility plugin: allow to run nose test suites natively.
-==================================================================
-
-
-.. contents::
-  :local:
-
-This is an experimental plugin for allowing to run tests written
-in 'nosetests' style with ``pytest``.
-
-Usage
--------------
-
-type::
-
-    pytest  # instead of 'nosetests'
-
-and you should be able to run nose style tests and at the same
-time can make full use of pytest's capabilities.
-
-Supported nose Idioms
-----------------------
-
-* setup and teardown at module/class/method level
-* SkipTest exceptions and markers
-* setup/teardown decorators
-* yield-based tests and their setup
-* general usage of nose utilities
-
-Unsupported idioms / issues
-----------------------------------
-
-- nose-style doctests are not collected and executed correctly,
-  also fixtures don't work.
-
-- no nose-configuration is recognized
-
-If you find other issues or have suggestions please run::
-
-    pytest --pastebin=all
-
-and send the resulting URL to a ``pytest`` contact channel,
-at best to the mailing list.
-
-Start improving this plugin in 30 seconds
-=========================================
-
-
-1. Download `pytest_nose.py`_ plugin source code
-2. put it somewhere as ``pytest_nose.py`` into your import path
-3. a subsequent ``pytest`` run will use your local version
-
-Checkout customize_, other plugins_ or `get in contact`_.
-
-.. include:: links.txt
deleted file mode 100644
--- a/third_party/python/pytest/doc/en/test/plugin/oejskit.rst
+++ /dev/null
@@ -1,12 +0,0 @@
-pytest_oejskit plugin (EXTERNAL)
-==========================================
-
-The `oejskit`_ offers a ``pytest`` plugin for running Javascript tests in live browsers.   Running inside the browsers comes with some speed cost, on the other hand it means for example the code is tested against the real-word DOM implementations.
-The approach enables to write integration tests such that the JavaScript code is tested against server-side Python code mocked as necessary. Any server-side framework that can already be exposed through WSGI (or for which a subset of WSGI can be written to accommodate the jskit own needs) can play along.
-
-For more info and download please visit the `oejskit PyPI`_ page.
-
-.. _`oejskit`:
-.. _`oejskit PyPI`: http://pypi.python.org/pypi/oejskit
-
-.. source link 'http://bitbucket.org/pedronis/js-infrastructure/src/tip/pytest_jstests.py',
deleted file mode 100644
--- a/third_party/python/pytest/doc/en/test/plugin/terminal.rst
+++ /dev/null
@@ -1,38 +0,0 @@
-
-Implements terminal reporting of the full testing process.
-==========================================================
-
-
-.. contents::
-  :local:
-
-This is a good source for looking at the various reporting hooks.
-
-command line options
---------------------
-
-
-``-v, --verbose``
-    increase verbosity.
-``-r chars``
-    show extra test summary info as specified by chars (f)ailed, (s)skipped, (x)failed, (X)passed.
-``-l, --showlocals``
-    show locals in tracebacks (disabled by default).
-``--tb=style``
-    traceback print mode (long/short/line/no).
-``--full-trace``
-    don't cut any tracebacks (default is to cut).
-``--fixtures``
-    show available function arguments, sorted by plugin
-
-Start improving this plugin in 30 seconds
-=========================================
-
-
-1. Download `pytest_terminal.py`_ plugin source code
-2. put it somewhere as ``pytest_terminal.py`` into your import path
-3. a subsequent ``pytest`` run will use your local version
-
-Checkout customize_, other plugins_ or `get in contact`_.
-
-.. include:: links.txt
deleted file mode 100644
--- a/third_party/python/pytest/doc/en/test/plugin/xdist.rst
+++ /dev/null
@@ -1,172 +0,0 @@
-
-loop on failing tests, distribute test runs to CPUs and hosts.
-==============================================================
-
-
-.. contents::
-  :local:
-
-The `pytest-xdist`_ plugin extends ``pytest`` with some unique
-test execution modes:
-
-* Looponfail: run your tests repeatedly in a subprocess.  After each run
-  ``pytest`` waits until a file in your project changes and then re-runs the
-  previously failing tests.  This is repeated until all tests pass after which
-  again a full run is performed.
-
-* Load-balancing: if you have multiple CPUs or hosts you can use
-  those for a combined test run.  This allows to speed up
-  development or to use special resources of remote machines.
-
-* Multi-Platform coverage: you can specify different Python interpreters
-  or different platforms and run tests in parallel on all of them.
-
-Before running tests remotely, ``pytest`` efficiently synchronizes your
-program source code to the remote place.  All test results
-are reported back and displayed to your local test session.
-You may specify different Python versions and interpreters.
-
-.. _`pytest-xdist`: http://pypi.python.org/pypi/pytest-xdist
-
-Usage examples
----------------------
-
-Speed up test runs by sending tests to multiple CPUs
-+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
-
-To send tests to multiple CPUs, type::
-
-    pytest -n NUM
-
-Especially for longer running tests or tests requiring
-a lot of IO this can lead to considerable speed ups.
-
-
-Running tests in a Python subprocess
-+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
-
-To instantiate a python2.4 sub process and send tests to it, you may type::
-
-    pytest -d --tx popen//python=python2.4
-
-This will start a subprocess which is run with the "python2.4"
-Python interpreter, found in your system binary lookup path.
-
-If you prefix the --tx option value like this::
-
-    --tx 3*popen//python=python2.4
-
-then three subprocesses would be created and tests
-will be load-balanced across these three processes.
-
-
-Sending tests to remote SSH accounts
-+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
-
-Suppose you have a package ``mypkg`` which contains some
-tests that you can successfully run locally. And you
-have a ssh-reachable machine ``myhost``.  Then
-you can ad-hoc distribute your tests by typing::
-
-    pytest -d --tx ssh=myhostpopen --rsyncdir mypkg mypkg
-
-This will synchronize your ``mypkg`` package directory
-to a remote ssh account and then locally collect tests
-and send them to remote places for execution.
-
-You can specify multiple ``--rsyncdir`` directories
-to be sent to the remote side.
-
-**NOTE:** For ``pytest`` to collect and send tests correctly
-you not only need to make sure all code and tests
-directories are rsynced, but that any test (sub) directory
-also has an ``__init__.py`` file because internally
-``pytest`` references tests using their fully qualified python
-module path.  **You will otherwise get strange errors**
-during setup of the remote side.
-
-Sending tests to remote Socket Servers
-+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
-
-Download the single-module `socketserver.py`_ Python program
-and run it like this::
-
-    python socketserver.py
-
-It will tell you that it starts listening on the default
-port.  You can now on your home machine specify this
-new socket host with something like this::
-
-    pytest -d --tx socket=192.168.1.102:8888 --rsyncdir mypkg mypkg
-
-
-.. _`atonce`:
-
-Running tests on many platforms at once
-+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
-
-The basic command to run tests on multiple platforms is::
-
-    pytest --dist=each --tx=spec1 --tx=spec2
-
-If you specify a windows host, an OSX host and a Linux
-environment this command will send each tests to all
-platforms - and report back failures from all platforms
-at once.   The specifications strings use the `xspec syntax`_.
-
-.. _`xspec syntax`: http://codespeak.net/execnet/trunk/basics.html#xspec
-
-.. _`socketserver.py`: http://codespeak.net/svn/py/dist/py/execnet/script/socketserver.py
-
-.. _`execnet`: http://codespeak.net/execnet
-
-Specifying test exec environments in a conftest.py
-+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
-
-Instead of specifying command line options, you can
-put options values in a ``conftest.py`` file like this::
-
-    option_tx = ['ssh=myhost//python=python2.7', 'popen//python=python2.7']
-    option_dist = True
-
-Any commandline ``--tx`` specifications  will add to the list of
-available execution environments.
-
-Specifying "rsync" dirs in a conftest.py
-+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
-
-In your ``mypkg/conftest.py`` you may specify directories to synchronise
-or to exclude::
-
-    rsyncdirs = ['.', '../plugins']
-    rsyncignore = ['_cache']
-
-These directory specifications are relative to the directory
-where the ``conftest.py`` is found.
-
-command line options
---------------------
-
-
-``-f, --looponfail``
-    run tests in subprocess, wait for modified files and re-run failing test set until all pass.
-``-n numprocesses``
-    shortcut for '--dist=load --tx=NUM*popen'
-``--boxed``
-    box each test run in a separate process (unix)
-``--dist=distmode``
-    set mode for distributing tests to exec environments.
-
-    each: send each test to each available environment.
-
-    load: send each test to one available environment so it is run only once.
-
-    (default) no: run tests inprocess, don't distribute.
-``--tx=xspec``
-    add a test execution environment. some examples: --tx popen//python=python2.7 --tx socket=192.168.1.102:8888 --tx ssh=user@codespeak.net//chdir=testcache
-``-d``
-    load-balance tests.  shortcut for '--dist=load'
-``--rsyncdir=dir1``
-    add directory for rsyncing to remote tx nodes.
-
-.. include:: links.txt
deleted file mode 100644
--- a/third_party/python/pytest/doc/en/test/test.html
+++ /dev/null
@@ -1,18 +0,0 @@
-<html>
-    <head>
-        <meta http-equiv="refresh" content=" 1 ; URL=index.html" />
-    </head>
-
-    <body>
-<script type="text/javascript">
-var gaJsHost = (("https:" == document.location.protocol) ? "https://ssl." : "http://www.");
-document.write(unescape("%3Cscript src='" + gaJsHost + "google-analytics.com/ga.js' type='text/javascript'%3E%3C/script%3E"));
-</script>
-<script type="text/javascript">
-try {
-var pageTracker = _gat._getTracker("UA-7597274-3");
-pageTracker._trackPageview();
-} catch(err) {}</script>
-</body>
-</html>
-    
--- a/third_party/python/pytest/doc/en/tmpdir.rst
+++ b/third_party/python/pytest/doc/en/tmpdir.rst
@@ -23,38 +23,40 @@ and more.  Here is an example test usage
         assert p.read() == "content"
         assert len(tmpdir.listdir()) == 1
         assert 0
 
 Running this would result in a passed test except for the last
 ``assert 0`` line which we use to look at values::
 
     $ pytest test_tmpdir.py
-    ======= test session starts ========
+    =========================== test session starts ============================
     platform linux -- Python 3.x.y, pytest-3.x.y, py-1.x.y, pluggy-0.x.y
     rootdir: $REGENDOC_TMPDIR, inifile:
     collected 1 item
-    
-    test_tmpdir.py F
-    
-    ======= FAILURES ========
-    _______ test_create_file ________
-    
+
+    test_tmpdir.py F                                                     [100%]
+
+    ================================= FAILURES =================================
+    _____________________________ test_create_file _____________________________
+
     tmpdir = local('PYTEST_TMPDIR/test_create_file0')
-    
+
         def test_create_file(tmpdir):
             p = tmpdir.mkdir("sub").join("hello.txt")
             p.write("content")
             assert p.read() == "content"
             assert len(tmpdir.listdir()) == 1
     >       assert 0
     E       assert 0
-    
+
     test_tmpdir.py:7: AssertionError
-    ======= 1 failed in 0.12 seconds ========
+    ========================= 1 failed in 0.12 seconds =========================
+
+.. _`tmpdir factory example`:
 
 The 'tmpdir_factory' fixture
 ----------------------------
 
 .. versionadded:: 2.8
 
 The ``tmpdir_factory`` is a session-scoped fixture which can be used
 to create arbitrary temporary directories from any other fixture or test.
@@ -64,34 +66,32 @@ generated procedurally. Instead of compu
 that uses it into its own ``tmpdir``, you can generate it once per-session
 to save time:
 
 .. code-block:: python
 
     # contents of conftest.py
     import pytest
 
-    @pytest.fixture(scope='session')
+
+    @pytest.fixture(scope="session")
     def image_file(tmpdir_factory):
         img = compute_expensive_image()
-        fn = tmpdir_factory.mktemp('data').join('img.png')
+        fn = tmpdir_factory.mktemp("data").join("img.png")
         img.save(str(fn))
         return fn
 
+
     # contents of test_image.py
     def test_histogram(image_file):
         img = load_image(image_file)
         # compute and test histogram
 
-``tmpdir_factory`` instances have the following methods:
+See :ref:`tmpdir_factory API <tmpdir factory api>` for details.
 
-.. currentmodule:: _pytest.tmpdir
-
-.. automethod:: TempdirFactory.mktemp
-.. automethod:: TempdirFactory.getbasetemp
 
 .. _`base temporary directory`:
 
 The default base temporary directory
 -----------------------------------------------
 
 Temporary directories are by default created as sub-directories of
 the system temporary directory.  The base name will be ``pytest-NUM`` where
@@ -101,11 +101,9 @@ than 3 temporary directories will be rem
 You can override the default temporary directory setting like this::
 
     pytest --basetemp=mydir
 
 When distributing tests on the local machine, ``pytest`` takes care to
 configure a basetemp directory for the sub processes such that all temporary
 data lands below a single per-test run basetemp directory.
 
-.. _`py.path.local`: http://py.rtfd.org/en/latest/path.html
-
-
+.. _`py.path.local`: https://py.readthedocs.io/en/latest/path.html
--- a/third_party/python/pytest/doc/en/unittest.rst
+++ b/third_party/python/pytest/doc/en/unittest.rst
@@ -41,19 +41,19 @@ By running your test suite with pytest y
 in most cases without having to modify existing code:
 
 * Obtain :ref:`more informative tracebacks <tbreportdemo>`;
 * :ref:`stdout and stderr <captures>` capturing;
 * :ref:`Test selection options <select-tests>` using ``-k`` and ``-m`` flags;
 * :ref:`maxfail`;
 * :ref:`--pdb <pdb-option>` command-line option for debugging on test failures
   (see :ref:`note <pdb-unittest-note>` below);
-* Distribute tests to multiple CPUs using the `pytest-xdist <http://pypi.python.org/pypi/pytest-xdist>`_ plugin;
+* Distribute tests to multiple CPUs using the `pytest-xdist <https://pypi.org/project/pytest-xdist/>`_ plugin;
 * Use :ref:`plain assert-statements <assert>` instead of ``self.assert*`` functions (`unittest2pytest
-  <https://pypi.python.org/pypi/unittest2pytest/>`__ is immensely helpful in this);
+  <https://pypi.org/project/unittest2pytest/>`__ is immensely helpful in this);
 
 
 pytest features in ``unittest.TestCase`` subclasses
 ---------------------------------------------------
 
 The following pytest features work in ``unittest.TestCase`` subclasses:
 
 * :ref:`Marks <mark>`: :ref:`skip <skip>`, :ref:`skipif <skipif>`, :ref:`xfail <xfail>`;
@@ -87,94 +87,94 @@ it from a unittest-style test::
     # referencing its name from tests
 
     import pytest
 
     @pytest.fixture(scope="class")
     def db_class(request):
         class DummyDB(object):
             pass
-        # set a class attribute on the invoking test context 
+        # set a class attribute on the invoking test context
         request.cls.db = DummyDB()
 
-This defines a fixture function ``db_class`` which - if used - is 
-called once for each test class and which sets the class-level 
+This defines a fixture function ``db_class`` which - if used - is
+called once for each test class and which sets the class-level
 ``db`` attribute to a ``DummyDB`` instance.  The fixture function
 achieves this by receiving a special ``request`` object which gives
 access to :ref:`the requesting test context <request-context>` such
-as the ``cls`` attribute, denoting the class from which the fixture 
+as the ``cls`` attribute, denoting the class from which the fixture
 is used.  This architecture de-couples fixture writing from actual test
 code and allows re-use of the fixture by a minimal reference, the fixture
-name.  So let's write an actual ``unittest.TestCase`` class using our 
+name.  So let's write an actual ``unittest.TestCase`` class using our
 fixture definition::
 
     # content of test_unittest_db.py
 
     import unittest
     import pytest
 
     @pytest.mark.usefixtures("db_class")
     class MyTest(unittest.TestCase):
         def test_method1(self):
             assert hasattr(self, "db")
             assert 0, self.db   # fail for demo purposes
 
         def test_method2(self):
             assert 0, self.db   # fail for demo purposes
 
-The ``@pytest.mark.usefixtures("db_class")`` class-decorator makes sure that 
+The ``@pytest.mark.usefixtures("db_class")`` class-decorator makes sure that
 the pytest fixture function ``db_class`` is called once per class.
 Due to the deliberately failing assert statements, we can take a look at
 the ``self.db`` values in the traceback::
 
     $ pytest test_unittest_db.py
-    ======= test session starts ========
+    =========================== test session starts ============================
     platform linux -- Python 3.x.y, pytest-3.x.y, py-1.x.y, pluggy-0.x.y
     rootdir: $REGENDOC_TMPDIR, inifile:
     collected 2 items
-    
-    test_unittest_db.py FF
-    
-    ======= FAILURES ========
-    _______ MyTest.test_method1 ________
-    
+
+    test_unittest_db.py FF                                               [100%]
+
+    ================================= FAILURES =================================
+    ___________________________ MyTest.test_method1 ____________________________
+
     self = <test_unittest_db.MyTest testMethod=test_method1>
-    
+
         def test_method1(self):
             assert hasattr(self, "db")
     >       assert 0, self.db   # fail for demo purposes
     E       AssertionError: <conftest.db_class.<locals>.DummyDB object at 0xdeadbeef>
     E       assert 0
-    
+
     test_unittest_db.py:9: AssertionError
-    _______ MyTest.test_method2 ________
-    
+    ___________________________ MyTest.test_method2 ____________________________
+
     self = <test_unittest_db.MyTest testMethod=test_method2>
-    
+
         def test_method2(self):
     >       assert 0, self.db   # fail for demo purposes
     E       AssertionError: <conftest.db_class.<locals>.DummyDB object at 0xdeadbeef>
     E       assert 0
-    
+
     test_unittest_db.py:12: AssertionError
-    ======= 2 failed in 0.12 seconds ========
+    ========================= 2 failed in 0.12 seconds =========================
 
 This default pytest traceback shows that the two test methods
 share the same ``self.db`` instance which was our intention
 when writing the class-scoped fixture function above.
 
 
 Using autouse fixtures and accessing other fixtures
 ---------------------------------------------------
 
 Although it's usually better to explicitly declare use of fixtures you need
-for a given test, you may sometimes want to have fixtures that are 
-automatically used in a given context.  After all, the traditional 
+for a given test, you may sometimes want to have fixtures that are
+automatically used in a given context.  After all, the traditional
 style of unittest-setup mandates the use of this implicit fixture writing
-and chances are, you are used to it or like it.  
+and chances are, you are used to it or like it.
 
 You can flag fixture functions with ``@pytest.fixture(autouse=True)``
 and define the fixture function in the context where you want it used.
 Let's look at an ``initdir`` fixture which makes all test methods of a
 ``TestCase`` class execute in a temporary directory with a
 pre-initialized ``samplefile.ini``.  Our ``initdir`` fixture itself uses
 the pytest builtin :ref:`tmpdir <tmpdir>` fixture to delegate the
 creation of a per-test temporary directory::
@@ -198,17 +198,17 @@ creation of a per-test temporary directo
 Due to the ``autouse`` flag the ``initdir`` fixture function will be
 used for all methods of the class where it is defined.  This is a
 shortcut for using a ``@pytest.mark.usefixtures("initdir")`` marker
 on the class like in the previous example.
 
 Running this test module ...::
 
     $ pytest -q test_unittest_cleandir.py
-    .
+    .                                                                    [100%]
     1 passed in 0.12 seconds
 
 ... gives us one passed test because the ``initdir`` fixture function
 was executed ahead of the ``test_method``.
 
 .. note::
 
    ``unittest.TestCase`` methods cannot directly receive fixture
--- a/third_party/python/pytest/doc/en/usage.rst
+++ b/third_party/python/pytest/doc/en/usage.rst
@@ -106,19 +106,19 @@ Will run all tests which are decorated w
 
 For more information see :ref:`marks <mark>`.
 
 **Run tests from packages**
 
 ::
 
     pytest --pyargs pkg.testing
-     
+
 This will import ``pkg.testing`` and use its filesystem location to find and run tests from.
-    
+
 
 Modifying Python traceback printing
 ----------------------------------------------
 
 Examples for modifying traceback printing::
 
     pytest --showlocals # show local variables in tracebacks
     pytest -l           # show local variables (shortcut)
@@ -147,19 +147,19 @@ Dropping to PDB_ (Python Debugger) on fa
 
 .. _PDB: http://docs.python.org/library/pdb.html
 
 Python comes with a builtin Python debugger called PDB_.  ``pytest``
 allows one to drop into the PDB_ prompt via a command line option::
 
     pytest --pdb
 
-This will invoke the Python debugger on every failure.  Often you might
-only want to do this for the first failing test to understand a certain
-failure situation::
+This will invoke the Python debugger on every failure (or KeyboardInterrupt).
+Often you might only want to do this for the first failing test to understand
+a certain failure situation::
 
     pytest -x --pdb   # drop to PDB on first failure, then end test session
     pytest --pdb --maxfail=3  # drop to PDB for first three failures
 
 Note that on any failure the exception information is stored on
 ``sys.last_value``, ``sys.last_type`` and ``sys.last_traceback``. In
 interactive use, this allows one to drop into postmortem debugging with
 any debug tool. One can also manually access the exception information,
@@ -185,16 +185,29 @@ in your code and pytest automatically di
 * Any prior test output that has already been captured and will be processed as
   such.
 * Any later output produced within the same test will not be captured and will
   instead get sent directly to ``sys.stdout``. Note that this holds true even
   for test output occurring after you exit the interactive PDB_ tracing session
   and continue with the regular test run.
 
 
+.. _`breakpoint-builtin`:
+
+Using the builtin breakpoint function
+-------------------------------------
+
+Python 3.7 introduces a builtin ``breakpoint()`` function.
+Pytest supports the use of ``breakpoint()`` with the following behaviours:
+
+ - When ``breakpoint()`` is called and ``PYTHONBREAKPOINT`` is set to the default value, pytest will use the custom internal PDB trace UI instead of the system default ``Pdb``.
+ - When tests are complete, the system will default back to the system ``Pdb`` trace UI.
+ - If ``--pdb`` is called on execution of pytest, the custom internal Pdb trace UI is used on ``bothbreakpoint()`` and failed tests/unhandled exceptions.
+ - If ``--pdbcls`` is used, the custom class debugger will be executed when a test fails (as expected within existing behaviour), but also when ``breakpoint()`` is called from within a test, the custom class debugger will be instantiated.
+
 .. _durations:
 
 Profiling test execution duration
 -------------------------------------
 
 .. versionadded: 2.2
 
 To get a list of the slowest 10 test durations::
@@ -216,77 +229,178 @@ to create an XML file at ``path``.
 
 To set the name of the root test suite xml item, you can configure the ``junit_suite_name`` option in your config file:
 
 .. code-block:: ini
 
     [pytest]
     junit_suite_name = my_suite
 
-record_xml_property
-^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+.. _record_property example:
+
+record_property
+^^^^^^^^^^^^^^^
 
 .. versionadded:: 2.8
+.. versionchanged:: 3.5
+
+   Fixture renamed from ``record_xml_property`` to ``record_property`` as user
+   properties are now available to all reporters.
+   ``record_xml_property`` is now deprecated.
 
 If you want to log additional information for a test, you can use the
-``record_xml_property`` fixture:
+``record_property`` fixture:
 
 .. code-block:: python
 
-    def test_function(record_xml_property):
-        record_xml_property("example_key", 1)
-        assert 0
+    def test_function(record_property):
+        record_property("example_key", 1)
+        assert True
 
 This will add an extra property ``example_key="1"`` to the generated
 ``testcase`` tag:
 
 .. code-block:: xml
 
     <testcase classname="test_function" file="test_function.py" line="0" name="test_function" time="0.0009">
       <properties>
         <property name="example_key" value="1" />
       </properties>
     </testcase>
 
+Alternatively, you can integrate this functionality with custom markers:
+
+.. code-block:: python
+
+    # content of conftest.py
+
+
+    def pytest_collection_modifyitems(session, config, items):
+        for item in items:
+            for marker in item.iter_markers(name="test_id"):
+                test_id = marker.args[0]
+                item.user_properties.append(("test_id", test_id))
+
+And in your tests:
+
+.. code-block:: python
+
+    # content of test_function.py
+    import pytest
+
+
+    @pytest.mark.test_id(1501)
+    def test_function():
+        assert True
+
+Will result in:
+
+.. code-block:: xml
+
+    <testcase classname="test_function" file="test_function.py" line="0" name="test_function" time="0.0009">
+      <properties>
+        <property name="test_id" value="1501" />
+      </properties>
+    </testcase>
+
 .. warning::
 
-    ``record_xml_property`` is an experimental feature, and its interface might be replaced
+    ``record_property`` is an experimental feature and may change in the future.
+
+    Also please note that using this feature will break any schema verification.
+    This might be a problem when used with some CI servers.
+
+record_xml_attribute
+^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+.. versionadded:: 3.4
+
+To add an additional xml attribute to a testcase element, you can use
+``record_xml_attribute`` fixture. This can also be used to override existing values:
+
+.. code-block:: python
+
+    def test_function(record_xml_attribute):
+        record_xml_attribute("assertions", "REQ-1234")
+        record_xml_attribute("classname", "custom_classname")
+        print("hello world")
+        assert True
+
+Unlike ``record_property``, this will not add a new child element.
+Instead, this will add an attribute ``assertions="REQ-1234"`` inside the generated
+``testcase`` tag and override the default ``classname`` with ``"classname=custom_classname"``:
+
+.. code-block:: xml
+
+    <testcase classname="custom_classname" file="test_function.py" line="0" name="test_function" time="0.003" assertions="REQ-1234">
+        <system-out>
+            hello world
+        </system-out>
+    </testcase>
+
+.. warning::
+
+    ``record_xml_attribute`` is an experimental feature, and its interface might be replaced
     by something more powerful and general in future versions. The
     functionality per-se will be kept, however.
 
-    Currently it does not work when used with the ``pytest-xdist`` plugin.
+    Using this over ``record_xml_property`` can help when using ci tools to parse the xml report.
+    However, some parsers are quite strict about the elements and attributes that are allowed.
+    Many tools use an xsd schema (like the example below) to validate incoming xml.
+    Make sure you are using attribute names that are allowed by your parser.
+
+    Below is the Scheme used by Jenkins to validate the XML report:
+
+    .. code-block:: xml
 
-    Also please note that using this feature will break any schema verification.
-    This might be a problem when used with some CI servers.
+        <xs:element name="testcase">
+            <xs:complexType>
+                <xs:sequence>
+                    <xs:element ref="skipped" minOccurs="0" maxOccurs="1"/>
+                    <xs:element ref="error" minOccurs="0" maxOccurs="unbounded"/>
+                    <xs:element ref="failure" minOccurs="0" maxOccurs="unbounded"/>
+                    <xs:element ref="system-out" minOccurs="0" maxOccurs="unbounded"/>
+                    <xs:element ref="system-err" minOccurs="0" maxOccurs="unbounded"/>
+                </xs:sequence>
+                <xs:attribute name="name" type="xs:string" use="required"/>
+                <xs:attribute name="assertions" type="xs:string" use="optional"/>
+                <xs:attribute name="time" type="xs:string" use="optional"/>
+                <xs:attribute name="classname" type="xs:string" use="optional"/>
+                <xs:attribute name="status" type="xs:string" use="optional"/>
+            </xs:complexType>
+        </xs:element>
 
 LogXML: add_global_property
 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
 
 .. versionadded:: 3.0
 
 If you want to add a properties node in the testsuite level, which may contains properties that are relevant
 to all testcases you can use ``LogXML.add_global_properties``
 
 .. code-block:: python
 
     import pytest
 
+
     @pytest.fixture(scope="session")
     def log_global_env_facts(f):
 
-        if pytest.config.pluginmanager.hasplugin('junitxml'):
-            my_junit = getattr(pytest.config, '_xml', None)
+        if pytest.config.pluginmanager.hasplugin("junitxml"):
+            my_junit = getattr(pytest.config, "_xml", None)
 
-        my_junit.add_global_property('ARCH', 'PPC')
-        my_junit.add_global_property('STORAGE_TYPE', 'CEPH')
+        my_junit.add_global_property("ARCH", "PPC")
+        my_junit.add_global_property("STORAGE_TYPE", "CEPH")
 
-    @pytest.mark.usefixtures(log_global_env_facts)
+
+    @pytest.mark.usefixtures(log_global_env_facts.__name__)
     def start_and_prepare_env():
         pass
 
+
     class TestMe(object):
         def test_foo(self):
             assert True
 
 This will add a property node below the testsuite node to the generated xml:
 
 .. code-block:: xml
 
@@ -307,17 +421,17 @@ This will add a property node below the 
 Creating resultlog format files
 ----------------------------------------------------
 
 .. deprecated:: 3.0
 
     This option is rarely used and is scheduled for removal in 4.0.
 
     An alternative for users which still need similar functionality is to use the
-    `pytest-tap <https://pypi.python.org/pypi/pytest-tap>`_ plugin which provides
+    `pytest-tap <https://pypi.org/project/pytest-tap/>`_ plugin which provides
     a stream of test data.
 
     If you have any concerns, please don't hesitate to
     `open an issue <https://github.com/pytest-dev/pytest/issues>`_.
 
 To create plain-text machine-readable result files you can issue::
 
     pytest --resultlog=path
@@ -382,12 +496,22 @@ You can specify additional plugins to ``
             print("*** test run reporting finishing")
 
     pytest.main(["-qq"], plugins=[MyPlugin()])
 
 Running it will show that ``MyPlugin`` was added and its
 hook was invoked::
 
     $ python myinvoke.py
-    *** test run reporting finishing
-    
+    .                                                                    [100%]*** test run reporting finishing
+
+
+.. note::
+
+    Calling ``pytest.main()`` will result in importing your tests and any modules
+    that they import. Due to the caching mechanism of python's import system,
+    making subsequent calls to ``pytest.main()`` from the same process will not
+    reflect changes to those files between the calls. For this reason, making
+    multiple calls to ``pytest.main()`` from the same process (in order to re-run
+    tests, for example) is not recommended.
+
 
 .. include:: links.inc
--- a/third_party/python/pytest/doc/en/warnings.rst
+++ b/third_party/python/pytest/doc/en/warnings.rst
@@ -16,51 +16,51 @@ and displays them at the end of the sess
         return 1
 
     def test_one():
         assert api_v1() == 1
 
 Running pytest now produces this output::
 
     $ pytest test_show_warnings.py
-    ======= test session starts ========
+    =========================== test session starts ============================
     platform linux -- Python 3.x.y, pytest-3.x.y, py-1.x.y, pluggy-0.x.y
     rootdir: $REGENDOC_TMPDIR, inifile:
     collected 1 item
-    
-    test_show_warnings.py .
-    
-    ======= warnings summary ========
+
+    test_show_warnings.py .                                              [100%]
+
+    ============================= warnings summary =============================
     test_show_warnings.py::test_one
       $REGENDOC_TMPDIR/test_show_warnings.py:4: UserWarning: api v1, should use functions from v2
         warnings.warn(UserWarning("api v1, should use functions from v2"))
-    
+
     -- Docs: http://doc.pytest.org/en/latest/warnings.html
-    ======= 1 passed, 1 warnings in 0.12 seconds ========
+    =================== 1 passed, 1 warnings in 0.12 seconds ===================
 
 Pytest by default catches all warnings except for ``DeprecationWarning`` and ``PendingDeprecationWarning``.
 
 The ``-W`` flag can be passed to control which warnings will be displayed or even turn
 them into errors::
 
     $ pytest -q test_show_warnings.py -W error::UserWarning
-    F
-    ======= FAILURES ========
-    _______ test_one ________
-    
+    F                                                                    [100%]
+    ================================= FAILURES =================================
+    _________________________________ test_one _________________________________
+
         def test_one():
     >       assert api_v1() == 1
-    
-    test_show_warnings.py:8: 
-    _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
-    
+
+    test_show_warnings.py:8:
+    _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
+
         def api_v1():
     >       warnings.warn(UserWarning("api v1, should use functions from v2"))
     E       UserWarning: api v1, should use functions from v2
-    
+
     test_show_warnings.py:4: UserWarning
     1 failed in 0.12 seconds
 
 The same option can be set in the ``pytest.ini`` file using the ``filterwarnings`` ini option.
 For example, the configuration below will ignore all user warnings, but will transform
 all other warnings into errors.
 
 .. code-block:: ini
@@ -73,49 +73,60 @@ all other warnings into errors.
 
 When a warning matches more than one option in the list, the action for the last matching option
 is performed.
 
 Both ``-W`` command-line option and ``filterwarnings`` ini option are based on Python's own
 `-W option`_ and `warnings.simplefilter`_, so please refer to those sections in the Python
 documentation for other examples and advanced usage.
 
+
+.. _`filterwarnings`:
+
 ``@pytest.mark.filterwarnings``
 -------------------------------
 
 .. versionadded:: 3.2
 
 You can use the ``@pytest.mark.filterwarnings`` to add warning filters to specific test items,
 allowing you to have finer control of which warnings should be captured at test, class or
 even module level:
 
 .. code-block:: python
 
     import warnings
 
+
     def api_v1():
         warnings.warn(UserWarning("api v1, should use functions from v2"))
         return 1
 
-    @pytest.mark.filterwarnings('ignore:api v1')
+
+    @pytest.mark.filterwarnings("ignore:api v1")
     def test_one():
         assert api_v1() == 1
 
 
 Filters applied using a mark take precedence over filters passed on the command line or configured
 by the ``filterwarnings`` ini option.
 
 You may apply a filter to all tests of a class by using the ``filterwarnings`` mark as a class
 decorator or to all tests in a module by setting the ``pytestmark`` variable:
 
 .. code-block:: python
 
     # turns all warnings into errors for this module
-    pytestmark = pytest.mark.filterwarnings('error')
+    pytestmark = pytest.mark.filterwarnings("error")
+
 
+.. note::
+
+    Except for these features, pytest does not change the python warning filter; it only captures
+    and displays the warnings which are issued with respect to the currently configured filter,
+    including changes to the filter made by test functions or by the system under test.
 
 .. note::
 
     ``DeprecationWarning`` and ``PendingDeprecationWarning`` are hidden by the standard library
     by default so you have to explicitly configure them to be displayed in your ``pytest.ini``:
 
     .. code-block:: ini
 
@@ -163,17 +174,30 @@ which works in a similar manner to :ref:
 
     import warnings
     import pytest
 
     def test_warning():
         with pytest.warns(UserWarning):
             warnings.warn("my warning", UserWarning)
 
-The test will fail if the warning in question is not raised.
+The test will fail if the warning in question is not raised. The keyword
+argument ``match`` to assert that the exception matches a text or regex::
+
+    >>> with warns(UserWarning, match='must be 0 or None'):
+    ...     warnings.warn("value must be 0 or None", UserWarning)
+
+    >>> with warns(UserWarning, match=r'must be \d+$'):
+    ...     warnings.warn("value must be 42", UserWarning)
+
+    >>> with warns(UserWarning, match=r'must be \d+$'):
+    ...     warnings.warn("this is not here", UserWarning)
+    Traceback (most recent call last):
+      ...
+    Failed: DID NOT WARN. No warnings of type ...UserWarning... was emitted...
 
 You can also call ``pytest.warns`` on a function or code string::
 
     pytest.warns(expected_warning, func, *args, **kwargs)
     pytest.warns(expected_warning, "func(*args, **kwargs)")
 
 The function also returns a list of all raised warnings (as
 ``warnings.WarningMessage`` objects), which you can query for
@@ -226,33 +250,21 @@ The ``recwarn`` fixture will record warn
         assert issubclass(w.category, UserWarning)
         assert str(w.message) == "hello"
         assert w.filename
         assert w.lineno
 
 Both ``recwarn`` and ``pytest.warns`` return the same interface for recorded
 warnings: a WarningsRecorder instance. To view the recorded warnings, you can
 iterate over this instance, call ``len`` on it to get the number of recorded
-warnings, or index into it to get a particular recorded warning. It also
-provides these methods:
-
-.. autoclass:: _pytest.recwarn.WarningsRecorder()
-    :members:
+warnings, or index into it to get a particular recorded warning.
 
-Each recorded warning has the attributes ``message``, ``category``,
-``filename``, ``lineno``, ``file``, and ``line``. The ``category`` is the
-class of the warning. The ``message`` is the warning itself; calling
-``str(message)`` will return the actual message of the warning.
+.. currentmodule:: _pytest.warnings
 
-.. note::
-    :class:`RecordedWarning` was changed from a plain class to a namedtuple in pytest 3.1
-
-.. note::
-    ``DeprecationWarning`` and ``PendingDeprecationWarning`` are treated
-    differently; see :ref:`ensuring_function_triggers`.
+Full API: :class:`WarningsRecorder`.
 
 .. _`ensuring a function triggers a deprecation warning`:
 
 .. _ensuring_function_triggers:
 
 Ensuring a function triggers a deprecation warning
 -------------------------------------------------------
 
--- a/third_party/python/pytest/doc/en/writing_plugins.rst
+++ b/third_party/python/pytest/doc/en/writing_plugins.rst
@@ -7,19 +7,19 @@ Writing plugins
 It is easy to implement `local conftest plugins`_ for your own project
 or `pip-installable plugins`_ that can be used throughout many projects,
 including third party projects.  Please refer to :ref:`using plugins` if you
 only want to use but not write plugins.
 
 A plugin contains one or multiple hook functions. :ref:`Writing hooks <writinghooks>`
 explains the basics and details of how you can write a hook function yourself.
 ``pytest`` implements all aspects of configuration, collection, running and
-reporting by calling `well specified hooks`_ of the following plugins:
+reporting by calling :ref:`well specified hooks <hook-reference>` of the following plugins:
 
-* :ref:`builtin plugins`: loaded from pytest's internal ``_pytest`` directory.
+* builtin plugins: loaded from pytest's internal ``_pytest`` directory.
 
 * :ref:`external plugins <extplugins>`: modules discovered through
   `setuptools entry points`_
 
 * `conftest.py plugins`_: modules auto-discovered in test directories
 
 In principle, each hook call is a ``1:N`` Python function call where ``N`` is the
 number of registered implementation functions for a given specification.
@@ -80,44 +80,44 @@ sub directory but not for other director
             pass
 
     test_flat.py:
         def test_flat():
             pass
 
 Here is how you might run it::
 
-     pytest test_flat.py   # will not show "setting up"
-     pytest a/test_sub.py  # will show "setting up"
+     pytest test_flat.py --capture=no  # will not show "setting up"
+     pytest a/test_sub.py --capture=no  # will show "setting up"
 
 .. note::
     If you have ``conftest.py`` files which do not reside in a
     python package directory (i.e. one containing an ``__init__.py``) then
     "import conftest" can be ambiguous because there might be other
     ``conftest.py`` files as well on your ``PYTHONPATH`` or ``sys.path``.
     It is thus good practice for projects to either put ``conftest.py``
     under a package scope or to never import anything from a
     ``conftest.py`` file.
 
     See also: :ref:`pythonpath`.
 
 
 Writing your own plugin
 -----------------------
 
-.. _`setuptools`: http://pypi.python.org/pypi/setuptools
+.. _`setuptools`: https://pypi.org/project/setuptools/
 
 If you want to write a plugin, there are many real-life examples
 you can copy from:
 
 * a custom collection example plugin: :ref:`yaml plugin`
-* around 20 :ref:`builtin plugins` which provide pytest's own functionality
+* builtin plugins which provide pytest's own functionality
 * many `external plugins <http://plugincompat.herokuapp.com>`_ providing additional features
 
-All of these plugins implement the documented `well specified hooks`_
+All of these plugins implement :ref:`hooks <hook-reference>` and/or :ref:`fixtures <fixture>`
 to extend and add functionality.
 
 .. note::
     Make sure to check out the excellent
     `cookiecutter-pytest-plugin <https://github.com/pytest-dev/cookiecutter-pytest-plugin>`_
     project, which is a `cookiecutter template <https://github.com/audreyr/cookiecutter>`_
     for authoring plugins.
 
@@ -145,96 +145,87 @@ it in your setuptools-invocation:
 
 .. sourcecode:: python
 
     # sample ./setup.py file
     from setuptools import setup
 
     setup(
         name="myproject",
-        packages = ['myproject']
-
+        packages=["myproject"],
         # the following makes a plugin available to pytest
-        entry_points = {
-            'pytest11': [
-                'name_of_plugin = myproject.pluginmodule',
-            ]
-        },
-
+        entry_points={"pytest11": ["name_of_plugin = myproject.pluginmodule"]},
         # custom PyPI classifier for pytest plugins
-        classifiers=[
-            "Framework :: Pytest",
-        ],
+        classifiers=["Framework :: Pytest"],
     )
 
 If a package is installed this way, ``pytest`` will load
 ``myproject.pluginmodule`` as a plugin which can define
-`well specified hooks`_.
+:ref:`hooks <hook-reference>`.
 
 .. note::
 
     Make sure to include ``Framework :: Pytest`` in your list of
     `PyPI classifiers <https://python-packaging-user-guide.readthedocs.io/distributing/#classifiers>`_
     to make it easy for users to find your plugin.
 
 
+.. _assertion-rewriting:
+
 Assertion Rewriting
 -------------------
 
 One of the main features of ``pytest`` is the use of plain assert
 statements and the detailed introspection of expressions upon
 assertion failures.  This is provided by "assertion rewriting" which
 modifies the parsed AST before it gets compiled to bytecode.  This is
 done via a :pep:`302` import hook which gets installed early on when
-``pytest`` starts up and will perform this re-writing when modules get
+``pytest`` starts up and will perform this rewriting when modules get
 imported.  However since we do not want to test different bytecode
-then you will run in production this hook only re-writes test modules
+then you will run in production this hook only rewrites test modules
 themselves as well as any modules which are part of plugins.  Any
-other imported module will not be re-written and normal assertion
+other imported module will not be rewritten and normal assertion
 behaviour will happen.
 
 If you have assertion helpers in other modules where you would need
 assertion rewriting to be enabled you need to ask ``pytest``
-explicitly to re-write this module before it gets imported.
+explicitly to rewrite this module before it gets imported.
 
 .. autofunction:: pytest.register_assert_rewrite
+    :noindex:
 
 This is especially important when you write a pytest plugin which is
 created using a package.  The import hook only treats ``conftest.py``
 files and any modules which are listed in the ``pytest11`` entrypoint
 as plugins.  As an example consider the following package::
 
    pytest_foo/__init__.py
    pytest_foo/plugin.py
    pytest_foo/helper.py
 
 With the following typical ``setup.py`` extract:
 
 .. code-block:: python
 
-   setup(
-      ...
-      entry_points={'pytest11': ['foo = pytest_foo.plugin']},
-      ...
-   )
+   setup(..., entry_points={"pytest11": ["foo = pytest_foo.plugin"]}, ...)
 
-In this case only ``pytest_foo/plugin.py`` will be re-written.  If the
+In this case only ``pytest_foo/plugin.py`` will be rewritten.  If the
 helper module also contains assert statements which need to be
-re-written it needs to be marked as such, before it gets imported.
-This is easiest by marking it for re-writing inside the
+rewritten it needs to be marked as such, before it gets imported.
+This is easiest by marking it for rewriting inside the
 ``__init__.py`` module, which will always be imported first when a
 module inside a package is imported.  This way ``plugin.py`` can still
 import ``helper.py`` normally.  The contents of
 ``pytest_foo/__init__.py`` will then need to look like this:
 
 .. code-block:: python
 
    import pytest
 
-   pytest.register_assert_rewrite('pytest_foo.helper')
+   pytest.register_assert_rewrite("pytest_foo.helper")
 
 
 
 Requiring/Loading plugins in a test module or conftest file
 -----------------------------------------------------------
 
 You can require plugins in a test module or a ``conftest.py`` file like this:
 
@@ -249,41 +240,53 @@ application modules:
 .. code-block:: python
 
     pytest_plugins = "myapp.testsupport.myplugin"
 
 ``pytest_plugins`` variables are processed recursively, so note that in the example above
 if ``myapp.testsupport.myplugin`` also declares ``pytest_plugins``, the contents
 of the variable will also be loaded as plugins, and so on.
 
+.. _`requiring plugins in non-root conftests`:
+
+.. note::
+    Requiring plugins using a ``pytest_plugins`` variable in non-root
+    ``conftest.py`` files is deprecated.
+
+    This is important because ``conftest.py`` files implement per-directory
+    hook implementations, but once a plugin is imported, it will affect the
+    entire directory tree. In order to avoid confusion, defining
+    ``pytest_plugins`` in any ``conftest.py`` file which is not located in the
+    tests root directory is deprecated, and will raise a warning.
+
 This mechanism makes it easy to share fixtures within applications or even
 external applications without the need to create external plugins using
 the ``setuptools``'s entry point technique.
 
 Plugins imported by ``pytest_plugins`` will also automatically be marked
 for assertion rewriting (see :func:`pytest.register_assert_rewrite`).
 However for this to have any effect the module must not be
 imported already; if it was already imported at the time the
 ``pytest_plugins`` statement is processed, a warning will result and
-assertions inside the plugin will not be re-written.  To fix this you
+assertions inside the plugin will not be rewritten.  To fix this you
 can either call :func:`pytest.register_assert_rewrite` yourself before
 the module is imported, or you can arrange the code to delay the
 importing until after the plugin is registered.
 
 
 Accessing another plugin by name
 --------------------------------
 
 If a plugin wants to collaborate with code from
 another plugin it can obtain a reference through
 the plugin manager like this:
 
 .. sourcecode:: python
 
-    plugin = config.pluginmanager.getplugin("name_of_plugin")
+    plugin = config.pluginmanager.get_plugin("name_of_plugin")
 
 If you want to look at the names of existing plugins, use
 the ``--trace-config`` option.
 
 Testing plugins
 ---------------
 
 pytest comes with a plugin named ``pytester`` that helps you write tests for
@@ -312,68 +315,74 @@ string value of ``Hello World!`` if we d
 {value}!`` if we do supply a string value.
 
 .. code-block:: python
 
     # -*- coding: utf-8 -*-
 
     import pytest
 
+
     def pytest_addoption(parser):
-        group = parser.getgroup('helloworld')
+        group = parser.getgroup("helloworld")
         group.addoption(
-            '--name',
-            action='store',
-            dest='name',
-            default='World',
-            help='Default "name" for hello().'
+            "--name",
+            action="store",
+            dest="name",
+            default="World",
+            help='Default "name" for hello().',
         )
 
+
     @pytest.fixture
     def hello(request):
-        name = request.config.getoption('name')
+        name = request.config.getoption("name")
 
         def _hello(name=None):
             if not name:
-                name = request.config.getoption('name')
+                name = request.config.getoption("name")
             return "Hello {name}!".format(name=name)
 
         return _hello
 
 
 Now the ``testdir`` fixture provides a convenient API for creating temporary
 ``conftest.py`` files and test files. It also allows us to run the tests and
 return a result object, with which we can assert the tests' outcomes.
 
 .. code-block:: python
 
     def test_hello(testdir):
         """Make sure that our plugin works."""
 
         # create a temporary conftest.py file
-        testdir.makeconftest("""
+        testdir.makeconftest(
+            """
             import pytest
 
             @pytest.fixture(params=[
                 "Brianna",
                 "Andreas",
                 "Floris",
             ])
             def name(request):
                 return request.param
-        """)
+        """
+        )
 
         # create a temporary pytest test file
-        testdir.makepyfile("""
+        testdir.makepyfile(
+            """
             def test_hello_default(hello):
                 assert hello() == "Hello World!"
 
             def test_hello_name(hello, name):
                 assert hello(name) == "Hello {0}!".format(name)
-        """)
+        """
+        )
 
         # run all tests with pytest
         result = testdir.runpytest()
 
         # check that all 4 tests passed
         result.assert_outcomes(passed=4)
 
 
@@ -405,16 +414,17 @@ names which match the specification and 
 
 Let's look at a possible implementation:
 
 .. code-block:: python
 
     def pytest_collection_modifyitems(config, items):
         # called after collection is completed
         # you can modify the ``items`` list
+        ...
 
 Here, ``pytest`` will pass in ``config`` (the pytest config object)
 and ``items`` (the list of collected test items) but will not pass
 in the ``session`` argument because we didn't list it in the function
 signature.  This dynamic "pruning" of arguments allows ``pytest`` to
 be "future-compatible": we can introduce new hook named parameters without
 breaking the signatures of existing hook implementations.  It is one of
 the reasons for the general long-lived compatibility of pytest plugins.
@@ -447,60 +457,69 @@ hookwrapper: executing around other hook
 
 pytest plugins can implement hook wrappers which wrap the execution
 of other hook implementations.  A hook wrapper is a generator function
 which yields exactly once. When pytest invokes hooks it first executes
 hook wrappers and passes the same arguments as to the regular hooks.
 
 At the yield point of the hook wrapper pytest will execute the next hook
 implementations and return their result to the yield point in the form of
-a :py:class:`CallOutcome <_pytest.vendored_packages.pluggy._CallOutcome>` instance which encapsulates a result or
+a :py:class:`Result <pluggy._Result>` instance which encapsulates a result or
 exception info.  The yield point itself will thus typically not raise
 exceptions (unless there are bugs).
 
 Here is an example definition of a hook wrapper::
 
     import pytest
 
     @pytest.hookimpl(hookwrapper=True)
     def pytest_pyfunc_call(pyfuncitem):
-        # do whatever you want before the next hook executes
+        do_something_before_next_hook_executes()
 
         outcome = yield
         # outcome.excinfo may be None or a (cls, val, tb) tuple
 
         res = outcome.get_result()  # will raise if outcome was exception
-        # postprocess result
+
+        post_process_result(res)
+
+        outcome.force_result(new_res)  # to override the return value to the plugin system
 
 Note that hook wrappers don't return results themselves, they merely
 perform tracing or other side effects around the actual hook implementations.
 If the result of the underlying hook is a mutable object, they may modify
 that result but it's probably better to avoid it.
 
+For more information, consult the `pluggy documentation <http://pluggy.readthedocs.io/en/latest/#wrappers>`_.
+
 
 Hook function ordering / call example
 -------------------------------------
 
 For any given hook specification there may be more than one
 implementation and we thus generally view ``hook`` execution as a
 ``1:N`` function call where ``N`` is the number of registered functions.
 There are ways to influence if a hook implementation comes before or
 after others, i.e.  the position in the ``N``-sized list of functions:
 
 .. code-block:: python
 
     # Plugin 1
     @pytest.hookimpl(tryfirst=True)
     def pytest_collection_modifyitems(items):
         # will execute as early as possible
+        ...
+
 
     # Plugin 2
     @pytest.hookimpl(trylast=True)
     def pytest_collection_modifyitems(items):
         # will execute as late as possible
+        ...
+
 
     # Plugin 3
     @pytest.hookimpl(hookwrapper=True)
     def pytest_collection_modifyitems(items):
         # will execute even before the tryfirst one above!
         outcome = yield
         # will execute after all non-hookwrappers executed
 
@@ -512,17 +531,17 @@ 1. Plugin3's pytest_collection_modifyite
 2. Plugin1's pytest_collection_modifyitems is called because it is marked
    with ``tryfirst=True``.
 
 3. Plugin2's pytest_collection_modifyitems is called because it is marked
    with ``trylast=True`` (but even without this mark it would come after
    Plugin1).
 
 4. Plugin3's pytest_collection_modifyitems then executing the code after the yield
-   point.  The yield receives a :py:class:`CallOutcome <_pytest.vendored_packages.pluggy._CallOutcome>` instance which encapsulates
+   point.  The yield receives a :py:class:`Result <pluggy._Result>` instance which encapsulates
    the result from calling the non-wrappers.  Wrappers shall not modify the result.
 
 It's possible to use ``tryfirst`` and ``trylast`` also in conjunction with
 ``hookwrapper=True`` in which case it will influence the ordering of hookwrappers
 among each other.
 
 
 Declaring new hooks
@@ -530,16 +549,17 @@ Declaring new hooks
 
 .. currentmodule:: _pytest.hookspec
 
 Plugins and ``conftest.py`` files may declare new hooks that can then be
 implemented by other plugins in order to alter behaviour or interact with
 the new plugin:
 
 .. autofunction:: pytest_addhooks
+    :noindex:
 
 Hooks are usually declared as do-nothing functions that contain only
 documentation describing when the hook will be called and what return values
 are expected.
 
 For an example, see `newhooks.py`_ from `xdist <https://github.com/pytest-dev/pytest-xdist>`_.
 
 .. _`newhooks.py`: https://github.com/pytest-dev/pytest-xdist/blob/974bd566c599dc6a9ea291838c6f226197208b46/xdist/newhooks.py
@@ -566,174 +586,8 @@ declaring the hook functions directly in
             """
 
     def pytest_configure(config):
         if config.pluginmanager.hasplugin('xdist'):
             config.pluginmanager.register(DeferPlugin())
 
 This has the added benefit of allowing you to conditionally install hooks
 depending on which plugins are installed.
-
-.. _`well specified hooks`:
-
-.. currentmodule:: _pytest.hookspec
-
-pytest hook reference
-=====================
-
-
-Initialization, command line and configuration hooks
-----------------------------------------------------
-
-.. autofunction:: pytest_load_initial_conftests
-.. autofunction:: pytest_cmdline_preparse
-.. autofunction:: pytest_cmdline_parse
-.. autofunction:: pytest_addoption
-.. autofunction:: pytest_cmdline_main
-.. autofunction:: pytest_configure
-.. autofunction:: pytest_unconfigure
-
-Generic "runtest" hooks
------------------------
-
-All runtest related hooks receive a :py:class:`pytest.Item <_pytest.main.Item>` object.
-
-.. autofunction:: pytest_runtest_protocol
-.. autofunction:: pytest_runtest_setup
-.. autofunction:: pytest_runtest_call
-.. autofunction:: pytest_runtest_teardown
-.. autofunction:: pytest_runtest_makereport
-
-For deeper understanding you may look at the default implementation of
-these hooks in :py:mod:`_pytest.runner` and maybe also
-in :py:mod:`_pytest.pdb` which interacts with :py:mod:`_pytest.capture`
-and its input/output capturing in order to immediately drop
-into interactive debugging when a test failure occurs.
-
-The :py:mod:`_pytest.terminal` reported specifically uses
-the reporting hook to print information about a test run.
-
-Collection hooks
-----------------
-
-``pytest`` calls the following hooks for collecting files and directories:
-
-.. autofunction:: pytest_ignore_collect
-.. autofunction:: pytest_collect_directory
-.. autofunction:: pytest_collect_file
-
-For influencing the collection of objects in Python modules
-you can use the following hook:
-
-.. autofunction:: pytest_pycollect_makeitem
-.. autofunction:: pytest_generate_tests
-.. autofunction:: pytest_make_parametrize_id
-
-After collection is complete, you can modify the order of
-items, delete or otherwise amend the test items:
-
-.. autofunction:: pytest_collection_modifyitems
-
-Reporting hooks
----------------
-
-Session related reporting hooks:
-
-.. autofunction:: pytest_collectstart
-.. autofunction:: pytest_itemcollected
-.. autofunction:: pytest_collectreport
-.. autofunction:: pytest_deselected
-.. autofunction:: pytest_report_header
-.. autofunction:: pytest_report_collectionfinish
-.. autofunction:: pytest_report_teststatus
-.. autofunction:: pytest_terminal_summary
-.. autofunction:: pytest_fixture_setup
-.. autofunction:: pytest_fixture_post_finalizer
-
-And here is the central hook for reporting about
-test execution:
-
-.. autofunction:: pytest_runtest_logreport
-
-You can also use this hook to customize assertion representation for some
-types:
-
-.. autofunction:: pytest_assertrepr_compare
-
-
-Debugging/Interaction hooks
----------------------------
-
-There are few hooks which can be used for special
-reporting or interaction with exceptions:
-
-.. autofunction:: pytest_internalerror
-.. autofunction:: pytest_keyboard_interrupt
-.. autofunction:: pytest_exception_interact
-.. autofunction:: pytest_enter_pdb
-
-
-Reference of objects involved in hooks
-======================================
-
-.. autoclass:: _pytest.config.Config()
-    :members:
-
-.. autoclass:: _pytest.config.Parser()
-    :members:
-
-.. autoclass:: _pytest.main.Node()
-    :members:
-
-.. autoclass:: _pytest.main.Collector()
-    :members:
-    :show-inheritance:
-
-.. autoclass:: _pytest.main.Item()
-    :members:
-    :show-inheritance:
-
-.. autoclass:: _pytest.python.Module()
-    :members:
-    :show-inheritance:
-
-.. autoclass:: _pytest.python.Class()
-    :members:
-    :show-inheritance:
-
-.. autoclass:: _pytest.python.Function()
-    :members:
-    :show-inheritance:
-
-.. autoclass:: _pytest.fixtures.FixtureDef()
-    :members:
-    :show-inheritance:
-
-.. autoclass:: _pytest.runner.CallInfo()
-    :members:
-
-.. autoclass:: _pytest.runner.TestReport()
-    :members:
-    :inherited-members:
-
-.. autoclass:: _pytest.vendored_packages.pluggy._CallOutcome()
-    :members:
-
-.. autofunction:: _pytest.config.get_plugin_manager()
-
-.. autoclass:: _pytest.config.PytestPluginManager()
-    :members:
-    :undoc-members:
-    :show-inheritance:
-
-.. autoclass:: _pytest.vendored_packages.pluggy.PluginManager()
-    :members:
-
-.. currentmodule:: _pytest.pytester
-
-.. autoclass:: Testdir()
-    :members: runpytest,runpytest_subprocess,runpytest_inprocess,makeconftest,makepyfile
-
-.. autoclass:: RunResult()
-    :members:
-
-.. autoclass:: LineMatcher()
-    :members:
--- a/third_party/python/pytest/doc/en/xunit_setup.rst
+++ b/third_party/python/pytest/doc/en/xunit_setup.rst
@@ -1,17 +1,17 @@
 
 .. _`classic xunit`:
 .. _xunitsetup:
 
 classic xunit-style setup
 ========================================
 
 This section describes a classic and popular way how you can implement
-fixtures (setup and teardown test state) on a per-module/class/function basis.  
+fixtures (setup and teardown test state) on a per-module/class/function basis.
 
 
 .. note::
 
     While these setup/teardown methods are simple and familiar to those
     coming from a ``unittest`` or nose ``background``, you may also consider
     using pytest's more powerful :ref:`fixture mechanism
     <fixture>` which leverages the concept of dependency injection, allowing
--- a/third_party/python/pytest/extra/get_issues.py
+++ b/third_party/python/pytest/extra/get_issues.py
@@ -1,36 +1,34 @@
 import json
 import py
-import textwrap
+import requests
 
 issues_url = "https://api.github.com/repos/pytest-dev/pytest/issues"
 
-import requests
-
 
 def get_issues():
     issues = []
     url = issues_url
     while 1:
         get_data = {"state": "all"}
         r = requests.get(url, params=get_data)
         data = r.json()
         if r.status_code == 403:
             # API request limit exceeded
-            print(data['message'])
+            print(data["message"])
             exit(1)
         issues.extend(data)
 
         # Look for next page
-        links = requests.utils.parse_header_links(r.headers['Link'])
+        links = requests.utils.parse_header_links(r.headers["Link"])
         another_page = False
         for link in links:
-            if link['rel'] == 'next':
-                url = link['url']
+            if link["rel"] == "next":
+                url = link["url"]
                 another_page = True
         if not another_page:
             return issues
 
 
 def main(args):
     cachefile = py.path.local(args.cache)
     if not cachefile.exists() or args.refresh:
@@ -41,44 +39,46 @@ def main(args):
 
     open_issues = [x for x in issues if x["state"] == "open"]
 
     open_issues.sort(key=lambda x: x["number"])
     report(open_issues)
 
 
 def _get_kind(issue):
-    labels = [l['name'] for l in issue['labels']]
-    for key in ('bug', 'enhancement', 'proposal'):
+    labels = [l["name"] for l in issue["labels"]]
+    for key in ("bug", "enhancement", "proposal"):
         if key in labels:
             return key
-    return 'issue'
+    return "issue"
 
 
 def report(issues):
     for issue in issues:
         title = issue["title"]
-        body = issue["body"]
+        # body = issue["body"]
         kind = _get_kind(issue)
         status = issue["state"]
         number = issue["number"]
         link = "https://github.com/pytest-dev/pytest/issues/%s/" % number
         print("----")
         print(status, kind, link)
         print(title)
-        #print()
-        #lines = body.split("\n")
-        #print ("\n".join(lines[:3]))
-        #if len(lines) > 3 or len(body) > 240:
+        # print()
+        # lines = body.split("\n")
+        # print ("\n".join(lines[:3]))
+        # if len(lines) > 3 or len(body) > 240:
         #    print ("...")
     print("\n\nFound %s open issues" % len(issues))
 
 
 if __name__ == "__main__":
     import argparse
+
     parser = argparse.ArgumentParser("process bitbucket issues")
-    parser.add_argument("--refresh", action="store_true",
-                        help="invalidate cache, refresh issues")
-    parser.add_argument("--cache", action="store", default="issues.json",
-                        help="cache file")
+    parser.add_argument(
+        "--refresh", action="store_true", help="invalidate cache, refresh issues"
+    )
+    parser.add_argument(
+        "--cache", action="store", default="issues.json", help="cache file"
+    )
     args = parser.parse_args()
     main(args)
-
--- a/third_party/python/pytest/pyproject.toml
+++ b/third_party/python/pytest/pyproject.toml
@@ -1,10 +1,18 @@
+[build-system]
+requires = [
+  "setuptools",
+  "setuptools-scm",
+  "wheel",
+]
+
 [tool.towncrier]
 package = "pytest"
+package_dir = "src"
 filename = "CHANGELOG.rst"
 directory = "changelog/"
 template = "changelog/_template.rst"
 
   [[tool.towncrier.type]]
   directory = "removal"
   name = "Deprecations and Removals"
   showcontent = true
deleted file mode 100644
--- a/third_party/python/pytest/pytest.py
+++ /dev/null
@@ -1,78 +0,0 @@
-# PYTHON_ARGCOMPLETE_OK
-"""
-pytest: unit and functional testing with Python.
-"""
-
-
-# else we are imported
-
-from _pytest.config import (
-    main, UsageError, _preloadplugins, cmdline,
-    hookspec, hookimpl
-)
-from _pytest.fixtures import fixture, yield_fixture
-from _pytest.assertion import register_assert_rewrite
-from _pytest.freeze_support import freeze_includes
-from _pytest import __version__
-from _pytest.debugging import pytestPDB as __pytestPDB
-from _pytest.recwarn import warns, deprecated_call
-from _pytest.outcomes import fail, skip, importorskip, exit, xfail
-from _pytest.mark import MARK_GEN as mark, param
-from _pytest.main import Item, Collector, File, Session
-from _pytest.fixtures import fillfixtures as _fillfuncargs
-from _pytest.python import (
-    Module, Class, Instance, Function, Generator,
-)
-
-from _pytest.python_api import approx, raises
-
-set_trace = __pytestPDB.set_trace
-
-__all__ = [
-    'main',
-    'UsageError',
-    'cmdline',
-    'hookspec',
-    'hookimpl',
-    '__version__',
-    'register_assert_rewrite',
-    'freeze_includes',
-    'set_trace',
-    'warns',
-    'deprecated_call',
-    'fixture',
-    'yield_fixture',
-    'fail',
-    'skip',
-    'xfail',
-    'importorskip',
-    'exit',
-    'mark',
-    'param',
-    'approx',
-    '_fillfuncargs',
-
-    'Item',
-    'File',
-    'Collector',
-    'Session',
-    'Module',
-    'Class',
-    'Instance',
-    'Function',
-    'Generator',
-    'raises',
-
-
-]
-
-if __name__ == '__main__':
-    # if run as a script or by 'python -m pytest'
-    # we trigger the below "else" condition by the following import
-    import pytest
-    raise SystemExit(pytest.main())
-else:
-
-    from _pytest.compat import _setup_collect_fakemodule
-    _preloadplugins()  # to populate pytest.* namespace so help(pytest) works
-    _setup_collect_fakemodule()
deleted file mode 100644
--- a/third_party/python/pytest/scripts/check-rst.py
+++ /dev/null
@@ -1,11 +0,0 @@
-
-from __future__ import print_function
-
-import subprocess
-import glob
-import sys
-
-sys.exit(subprocess.call([
-    'rst-lint', '--encoding', 'utf-8',
-    'CHANGELOG.rst', 'HOWTORELEASE.rst', 'README.rst',
-] + glob.glob('changelog/[0-9]*.*')))
--- a/third_party/python/pytest/setup.py
+++ b/third_party/python/pytest/setup.py
@@ -1,100 +1,124 @@
 import os
 import sys
 import setuptools
 import pkg_resources
-from setuptools import setup, Command
+from setuptools import setup
 
 classifiers = [
-    'Development Status :: 6 - Mature',
-    'Intended Audience :: Developers',
-    'License :: OSI Approved :: MIT License',
-    'Operating System :: POSIX',
-    'Operating System :: Microsoft :: Windows',
-    'Operating System :: MacOS :: MacOS X',
-    'Topic :: Software Development :: Testing',
-    'Topic :: Software Development :: Libraries',
-    'Topic :: Utilities',
+    "Development Status :: 6 - Mature",
+    "Intended Audience :: Developers",
+    "License :: OSI Approved :: MIT License",
+    "Operating System :: POSIX",
+    "Operating System :: Microsoft :: Windows",
+    "Operating System :: MacOS :: MacOS X",
+    "Topic :: Software Development :: Testing",
+    "Topic :: Software Development :: Libraries",
+    "Topic :: Utilities",
 ] + [
-    ('Programming Language :: Python :: %s' % x)
-    for x in '2 2.6 2.7 3 3.3 3.4 3.5 3.6'.split()
+    ("Programming Language :: Python :: %s" % x)
+    for x in "2 2.7 3 3.4 3.5 3.6 3.7".split()
 ]
 
-with open('README.rst') as fd:
+with open("README.rst") as fd:
     long_description = fd.read()
 
 
-def has_environment_marker_support():
+def get_environment_marker_support_level():
     """
-    Tests that setuptools has support for PEP-426 environment marker support.
+    Tests how well setuptools supports PEP-426 environment marker.
 
     The first known release to support it is 0.7 (and the earliest on PyPI seems to be 0.7.2
-    so we're using that), see: http://pythonhosted.org/setuptools/history.html#id142
+    so we're using that), see: https://setuptools.readthedocs.io/en/latest/history.html#id350
+
+    The support is later enhanced to allow direct conditional inclusions inside install_requires,
+    which is now recommended by setuptools. It first appeared in 36.2.0, went broken with 36.2.1, and
+    again worked since 36.2.2, so we're using that. See:
+    https://setuptools.readthedocs.io/en/latest/history.html#v36-2-2
+    https://github.com/pypa/setuptools/issues/1099
 
     References:
 
     * https://wheel.readthedocs.io/en/latest/index.html#defining-conditional-dependencies
     * https://www.python.org/dev/peps/pep-0426/#environment-markers
+    * https://setuptools.readthedocs.io/en/latest/setuptools.html#declaring-platform-specific-dependencies
     """
     try:
-        return pkg_resources.parse_version(setuptools.__version__) >= pkg_resources.parse_version('0.7.2')
+        version = pkg_resources.parse_version(setuptools.__version__)
+        if version >= pkg_resources.parse_version("36.2.2"):
+            return 2
+        if version >= pkg_resources.parse_version("0.7.2"):
+            return 1
     except Exception as exc:
         sys.stderr.write("Could not test setuptool's version: %s\n" % exc)
-        return False
+
+    # as of testing on 2018-05-26 fedora was on version 37* and debian was on version 33+
+    # we should consider erroring on those
+    return 0
 
 
 def main():
-    install_requires = ['py>=1.4.33', 'setuptools']  # pluggy is vendored in _pytest.vendored_packages
     extras_require = {}
-    if has_environment_marker_support():
-        extras_require[':python_version=="2.6"'] = ['argparse', 'ordereddict']
-        extras_require[':sys_platform=="win32"'] = ['colorama']
+    install_requires = [
+        "py>=1.5.0",
+        "six>=1.10.0",
+        "setuptools",
+        "attrs>=17.4.0",
+        "more-itertools>=4.0.0",
+        "atomicwrites>=1.0",
+    ]
+    # if _PYTEST_SETUP_SKIP_PLUGGY_DEP is set, skip installing pluggy;
+    # used by tox.ini to test with pluggy master
+    if "_PYTEST_SETUP_SKIP_PLUGGY_DEP" not in os.environ:
+        install_requires.append("pluggy>=0.5,<0.7")
+    environment_marker_support_level = get_environment_marker_support_level()
+    if environment_marker_support_level >= 2:
+        install_requires.append('funcsigs;python_version<"3.0"')
+        install_requires.append('colorama;sys_platform=="win32"')
+    elif environment_marker_support_level == 1:
+        extras_require[':python_version<"3.0"'] = ["funcsigs"]
+        extras_require[':sys_platform=="win32"'] = ["colorama"]
     else:
-        if sys.version_info < (2, 7):
-            install_requires.append('argparse')
-            install_requires.append('ordereddict')
-        if sys.platform == 'win32':
-            install_requires.append('colorama')
+        if sys.platform == "win32":
+            install_requires.append("colorama")
+        if sys.version_info < (3, 0):
+            install_requires.append("funcsigs")
 
     setup(
-        name='pytest',
-        description='pytest: simple powerful testing with Python',
+        name="pytest",
+        description="pytest: simple powerful testing with Python",
         long_description=long_description,
-        use_scm_version={
-            'write_to': '_pytest/_version.py',
+        use_scm_version={"write_to": "src/_pytest/_version.py"},
+        url="http://pytest.org",
+        project_urls={
+            "Source": "https://github.com/pytest-dev/pytest",
+            "Tracker": "https://github.com/pytest-dev/pytest/issues",
         },
-        url='http://pytest.org',
-        license='MIT license',
-        platforms=['unix', 'linux', 'osx', 'cygwin', 'win32'],
-        author='Holger Krekel, Bruno Oliveira, Ronny Pfannschmidt, Floris Bruynooghe, Brianna Laugher, Florian Bruhin and others',
-        entry_points={'console_scripts':
-                          ['pytest=pytest:main', 'py.test=pytest:main']},
+        license="MIT license",
+        platforms=["unix", "linux", "osx", "cygwin", "win32"],
+        author=(
+            "Holger Krekel, Bruno Oliveira, Ronny Pfannschmidt, "
+            "Floris Bruynooghe, Brianna Laugher, Florian Bruhin and others"
+        ),
+        entry_points={"console_scripts": ["pytest=pytest:main", "py.test=pytest:main"]},
         classifiers=classifiers,
         keywords="test unittest",
-        cmdclass={'test': PyTest},
         # the following should be enabled for release
-        setup_requires=['setuptools-scm'],
+        setup_requires=["setuptools-scm"],
+        package_dir={"": "src"},
+        python_requires=">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*",
         install_requires=install_requires,
         extras_require=extras_require,
-        packages=['_pytest', '_pytest.assertion', '_pytest._code', '_pytest.vendored_packages'],
-        py_modules=['pytest'],
+        packages=[
+            "_pytest",
+            "_pytest.assertion",
+            "_pytest._code",
+            "_pytest.mark",
+            "_pytest.config",
+        ],
+        py_modules=["pytest"],
         zip_safe=False,
     )
 
 
-class PyTest(Command):
-    user_options = []
-    def initialize_options(self):
-        pass
-    def finalize_options(self):
-        pass
-    def run(self):
-        import subprocess
-        PPATH = [x for x in os.environ.get('PYTHONPATH', '').split(':') if x]
-        PPATH.insert(0, os.getcwd())
-        os.environ['PYTHONPATH'] = ':'.join(PPATH)
-        errno = subprocess.call([sys.executable, 'pytest.py', '--ignore=doc'])
-        raise SystemExit(errno)
-
-
-if __name__ == '__main__':
+if __name__ == "__main__":
     main()
new file mode 100644
--- /dev/null
+++ b/third_party/python/pytest/src/_pytest/__init__.py
@@ -0,0 +1,8 @@
+__all__ = ["__version__"]
+
+try:
+    from ._version import version as __version__
+except ImportError:
+    # broken installation, we don't even try
+    # unknown only works because we do poor mans version compare
+    __version__ = "unknown"
new file mode 100644
--- /dev/null
+++ b/third_party/python/pytest/src/_pytest/_argcomplete.py
@@ -0,0 +1,107 @@
+
+"""allow bash-completion for argparse with argcomplete if installed
+needs argcomplete>=0.5.6 for python 3.2/3.3 (older versions fail
+to find the magic string, so _ARGCOMPLETE env. var is never set, and
+this does not need special code.
+
+Function try_argcomplete(parser) should be called directly before
+the call to ArgumentParser.parse_args().
+
+The filescompleter is what you normally would use on the positional
+arguments specification, in order to get "dirname/" after "dirn<TAB>"
+instead of the default "dirname ":
+
+   optparser.add_argument(Config._file_or_dir, nargs='*'
+                               ).completer=filescompleter
+
+Other, application specific, completers should go in the file
+doing the add_argument calls as they need to be specified as .completer
+attributes as well. (If argcomplete is not installed, the function the
+attribute points to will not be used).
+
+SPEEDUP
+=======
+The generic argcomplete script for bash-completion
+(/etc/bash_completion.d/python-argcomplete.sh )
+uses a python program to determine startup script generated by pip.
+You can speed up completion somewhat by changing this script to include
+  # PYTHON_ARGCOMPLETE_OK
+so the the python-argcomplete-check-easy-install-script does not
+need to be called to find the entry point of the code and see if that is
+marked  with PYTHON_ARGCOMPLETE_OK
+
+INSTALL/DEBUGGING
+=================
+To include this support in another application that has setup.py generated
+scripts:
+- add the line:
+    # PYTHON_ARGCOMPLETE_OK
+  near the top of the main python entry point
+- include in the file calling parse_args():
+    from _argcomplete import try_argcomplete, filescompleter
+   , call try_argcomplete just before parse_args(), and optionally add
+   filescompleter to the positional arguments' add_argument()
+If things do not work right away:
+- switch on argcomplete debugging with (also helpful when doing custom
+  completers):
+    export _ARC_DEBUG=1
+- run:
+    python-argcomplete-check-easy-install-script $(which appname)
+    echo $?
+  will echo 0 if the magic line has been found, 1 if not
+- sometimes it helps to find early on errors using:
+    _ARGCOMPLETE=1 _ARC_DEBUG=1 appname
+  which should throw a KeyError: 'COMPLINE' (which is properly set by the
+  global argcomplete script).
+"""
+from __future__ import absolute_import, division, print_function
+import sys
+import os
+from glob import glob
+
+
+class FastFilesCompleter(object):
+    "Fast file completer class"
+
+    def __init__(self, directories=True):
+        self.directories = directories
+
+    def __call__(self, prefix, **kwargs):
+        """only called on non option completions"""
+        if os.path.sep in prefix[1:]:
+            prefix_dir = len(os.path.dirname(prefix) + os.path.sep)
+        else:
+            prefix_dir = 0
+        completion = []
+        globbed = []
+        if "*" not in prefix and "?" not in prefix:
+            # we are on unix, otherwise no bash
+            if not prefix or prefix[-1] == os.path.sep:
+                globbed.extend(glob(prefix + ".*"))
+            prefix += "*"
+        globbed.extend(glob(prefix))
+        for x in sorted(globbed):
+            if os.path.isdir(x):
+                x += "/"
+            # append stripping the prefix (like bash, not like compgen)
+            completion.append(x[prefix_dir:])
+        return completion
+
+
+if os.environ.get("_ARGCOMPLETE"):
+    try:
+        import argcomplete.completers
+    except ImportError:
+        sys.exit(-1)
+    filescompleter = FastFilesCompleter()
+
+    def try_argcomplete(parser):
+        argcomplete.autocomplete(parser, always_complete_options=False)
+
+
+else:
+
+    def try_argcomplete(parser):
+        pass
+
+    filescompleter = None
rename from third_party/python/pytest/_pytest/_code/__init__.py
rename to third_party/python/pytest/src/_pytest/_code/__init__.py
new file mode 100644
--- /dev/null
+++ b/third_party/python/pytest/src/_pytest/_code/_py2traceback.py
@@ -0,0 +1,89 @@
+# copied from python-2.7.3's traceback.py
+# CHANGES:
+# - some_str is replaced, trying to create unicode strings
+#
+from __future__ import absolute_import, division, print_function
+import types
+from six import text_type
+
+
+def format_exception_only(etype, value):
+    """Format the exception part of a traceback.
+
+    The arguments are the exception type and value such as given by
+    sys.last_type and sys.last_value. The return value is a list of
+    strings, each ending in a newline.
+
+    Normally, the list contains a single string; however, for
+    SyntaxError exceptions, it contains several lines that (when
+    printed) display detailed information about where the syntax
+    error occurred.
+
+    The message indicating which exception occurred is always the last
+    string in the list.
+
+    """
+
+    # An instance should not have a meaningful value parameter, but
+    # sometimes does, particularly for string exceptions, such as
+    # >>> raise string1, string2  # deprecated
+    #
+    # Clear these out first because issubtype(string1, SyntaxError)
+    # would throw another exception and mask the original problem.
+    if (
+        isinstance(etype, BaseException)
+        or isinstance(etype, types.InstanceType)
+        or etype is None
+        or type(etype) is str
+    ):
+        return [_format_final_exc_line(etype, value)]
+
+    stype = etype.__name__
+
+    if not issubclass(etype, SyntaxError):
+        return [_format_final_exc_line(stype, value)]
+
+    # It was a syntax error; show exactly where the problem was found.
+    lines = []
+    try:
+        msg, (filename, lineno, offset, badline) = value.args
+    except Exception:
+        pass
+    else:
+        filename = filename or "<string>"
+        lines.append('  File "%s", line %d\n' % (filename, lineno))
+        if badline is not None:
+            if isinstance(badline, bytes):  # python 2 only
+                badline = badline.decode("utf-8", "replace")
+            lines.append(u"    %s\n" % badline.strip())
+            if offset is not None:
+                caretspace = badline.rstrip("\n")[:offset].lstrip()
+                # non-space whitespace (likes tabs) must be kept for alignment
+                caretspace = ((c.isspace() and c or " ") for c in caretspace)
+                # only three spaces to account for offset1 == pos 0
+                lines.append("   %s^\n" % "".join(caretspace))
+        value = msg
+
+    lines.append(_format_final_exc_line(stype, value))
+    return lines
+
+
+def _format_final_exc_line(etype, value):
+    """Return a list of a single line -- normal case for format_exception_only"""
+    valuestr = _some_str(value)
+    if value is None or not valuestr:
+        line = "%s\n" % etype
+    else:
+        line = "%s: %s\n" % (etype, valuestr)
+    return line
+
+
+def _some_str(value):
+    try:
+        return text_type(value)
+    except Exception:
+        try:
+            return str(value)
+        except Exception:
+            pass
+    return "<unprintable %s object>" % type(value).__name__
new file mode 100644
--- /dev/null
+++ b/third_party/python/pytest/src/_pytest/_code/code.py
@@ -0,0 +1,970 @@
+from __future__ import absolute_import, division, print_function
+import inspect
+import sys
+import traceback
+from inspect import CO_VARARGS, CO_VARKEYWORDS
+
+import attr
+import re
+from weakref import ref
+from _pytest.compat import _PY2, _PY3, PY35, safe_str
+from six import text_type
+import py
+
+builtin_repr = repr
+
+if _PY3:
+    from traceback import format_exception_only
+else:
+    from ._py2traceback import format_exception_only
+
+
+class Code(object):
+    """ wrapper around Python code objects """
+
+    def __init__(self, rawcode):
+        if not hasattr(rawcode, "co_filename"):
+            rawcode = getrawcode(rawcode)
+        try:
+            self.filename = rawcode.co_filename
+            self.firstlineno = rawcode.co_firstlineno - 1
+            self.name = rawcode.co_name
+        except AttributeError:
+            raise TypeError("not a code object: %r" % (rawcode,))
+        self.raw = rawcode
+
+    def __eq__(self, other):
+        return self.raw == other.raw
+
+    __hash__ = None
+
+    def __ne__(self, other):
+        return not self == other
+
+    @property
+    def path(self):
+        """ return a path object pointing to source code (note that it
+        might not point to an actually existing file). """
+        try:
+            p = py.path.local(self.raw.co_filename)
+            # maybe don't try this checking
+            if not p.check():
+                raise OSError("py.path check failed.")
+        except OSError:
+            # XXX maybe try harder like the weird logic
+            # in the standard lib [linecache.updatecache] does?
+            p = self.raw.co_filename
+
+        return p
+
+    @property
+    def fullsource(self):
+        """ return a _pytest._code.Source object for the full source file of the code
+        """
+        from _pytest._code import source
+
+        full, _ = source.findsource(self.raw)
+        return full
+
+    def source(self):
+        """ return a _pytest._code.Source object for the code object's source only
+        """
+        # return source only for that part of code
+        import _pytest._code
+
+        return _pytest._code.Source(self.raw)
+
+    def getargs(self, var=False):
+        """ return a tuple with the argument names for the code object
+
+            if 'var' is set True also return the names of the variable and
+            keyword arguments when present
+        """
+        # handfull shortcut for getting args
+        raw = self.raw
+        argcount = raw.co_argcount
+        if var:
+            argcount += raw.co_flags & CO_VARARGS
+            argcount += raw.co_flags & CO_VARKEYWORDS
+        return raw.co_varnames[:argcount]
+
+
+class Frame(object):
+    """Wrapper around a Python frame holding f_locals and f_globals
+    in which expressions can be evaluated."""
+
+    def __init__(self, frame):
+        self.lineno = frame.f_lineno - 1
+        self.f_globals = frame.f_globals
+        self.f_locals = frame.f_locals
+        self.raw = frame
+        self.code = Code(frame.f_code)
+
+    @property
+    def statement(self):
+        """ statement this frame is at """
+        import _pytest._code
+
+        if self.code.fullsource is None:
+            return _pytest._code.Source("")
+        return self.code.fullsource.getstatement(self.lineno)
+
+    def eval(self, code, **vars):
+        """ evaluate 'code' in the frame
+
+            'vars' are optional additional local variables
+
+            returns the result of the evaluation
+        """
+        f_locals = self.f_locals.copy()
+        f_locals.update(vars)
+        return eval(code, self.f_globals, f_locals)
+
+    def exec_(self, code, **vars):
+        """ exec 'code' in the frame
+
+            'vars' are optiona; additional local variables
+        """
+        f_locals = self.f_locals.copy()
+        f_locals.update(vars)
+        py.builtin.exec_(code, self.f_globals, f_locals)
+
+    def repr(self, object):
+        """ return a 'safe' (non-recursive, one-line) string repr for 'object'
+        """
+        return py.io.saferepr(object)
+
+    def is_true(self, object):
+        return object
+
+    def getargs(self, var=False):
+        """ return a list of tuples (name, value) for all arguments
+
+            if 'var' is set True also include the variable and keyword
+            arguments when present
+        """
+        retval = []
+        for arg in self.code.getargs(var):
+            try:
+                retval.append((arg, self.f_locals[arg]))
+            except KeyError:
+                pass  # this can occur when using Psyco
+        return retval
+
+
+class TracebackEntry(object):
+    """ a single entry in a traceback """
+
+    _repr_style = None
+    exprinfo = None
+
+    def __init__(self, rawentry, excinfo=None):
+        self._excinfo = excinfo
+        self._rawentry = rawentry
+        self.lineno = rawentry.tb_lineno - 1
+
+    def set_repr_style(self, mode):
+        assert mode in ("short", "long")
+        self._repr_style = mode
+
+    @property
+    def frame(self):
+        import _pytest._code
+
+        return _pytest._code.Frame(self._rawentry.tb_frame)
+
+    @property
+    def relline(self):
+        return self.lineno - self.frame.code.firstlineno
+
+    def __repr__(self):
+        return "<TracebackEntry %s:%d>" % (self.frame.code.path, self.lineno + 1)
+
+    @property
+    def statement(self):
+        """ _pytest._code.Source object for the current statement """
+        source = self.frame.code.fullsource
+        return source.getstatement(self.lineno)
+
+    @property
+    def path(self):
+        """ path to the source code """
+        return self.frame.code.path
+
+    def getlocals(self):
+        return self.frame.f_locals
+
+    locals = property(getlocals, None, None, "locals of underlaying frame")
+
+    def getfirstlinesource(self):
+        # on Jython this firstlineno can be -1 apparently
+        return max(self.frame.code.firstlineno, 0)
+
+    def getsource(self, astcache=None):
+        """ return failing source code. """
+        # we use the passed in astcache to not reparse asttrees
+        # within exception info printing
+        from _pytest._code.source import getstatementrange_ast
+
+        source = self.frame.code.fullsource
+        if source is None:
+            return None
+        key = astnode = None
+        if astcache is not None:
+            key = self.frame.code.path
+            if key is not None:
+                astnode = astcache.get(key, None)
+        start = self.getfirstlinesource()
+        try:
+            astnode, _, end = getstatementrange_ast(
+                self.lineno, source, astnode=astnode
+            )
+        except SyntaxError:
+            end = self.lineno + 1
+        else:
+            if key is not None:
+                astcache[key] = astnode
+        return source[start:end]
+
+    source = property(getsource)
+
+    def ishidden(self):
+        """ return True if the current frame has a var __tracebackhide__
+            resolving to True
+
+            If __tracebackhide__ is a callable, it gets called with the
+            ExceptionInfo instance and can decide whether to hide the traceback.
+
+            mostly for internal use
+        """
+        try:
+            tbh = self.frame.f_locals["__tracebackhide__"]
+        except KeyError:
+            try:
+                tbh = self.frame.f_globals["__tracebackhide__"]
+            except KeyError:
+                return False
+
+        if callable(tbh):
+            return tbh(None if self._excinfo is None else self._excinfo())
+        else:
+            return tbh
+
+    def __str__(self):
+        try:
+            fn = str(self.path)
+        except py.error.Error:
+            fn = "???"
+        name = self.frame.code.name
+        try:
+            line = str(self.statement).lstrip()
+        except KeyboardInterrupt:
+            raise
+        except:  # noqa
+            line = "???"
+        return "  File %r:%d in %s\n  %s\n" % (fn, self.lineno + 1, name, line)
+
+    def name(self):
+        return self.frame.code.raw.co_name
+
+    name = property(name, None, None, "co_name of underlaying code")
+
+
+class Traceback(list):
+    """ Traceback objects encapsulate and offer higher level
+        access to Traceback entries.
+    """
+    Entry = TracebackEntry
+
+    def __init__(self, tb, excinfo=None):
+        """ initialize from given python traceback object and ExceptionInfo """
+        self._excinfo = excinfo
+        if hasattr(tb, "tb_next"):
+
+            def f(cur):
+                while cur is not None:
+                    yield self.Entry(cur, excinfo=excinfo)
+                    cur = cur.tb_next
+
+            list.__init__(self, f(tb))
+        else:
+            list.__init__(self, tb)
+
+    def cut(self, path=None, lineno=None, firstlineno=None, excludepath=None):
+        """ return a Traceback instance wrapping part of this Traceback
+
+            by provding any combination of path, lineno and firstlineno, the
+            first frame to start the to-be-returned traceback is determined
+
+            this allows cutting the first part of a Traceback instance e.g.
+            for formatting reasons (removing some uninteresting bits that deal
+            with handling of the exception/traceback)
+        """
+        for x in self:
+            code = x.frame.code
+            codepath = code.path
+            if (
+                (path is None or codepath == path)
+                and (
+                    excludepath is None
+                    or not hasattr(codepath, "relto")
+                    or not codepath.relto(excludepath)
+                )
+                and (lineno is None or x.lineno == lineno)
+                and (firstlineno is None or x.frame.code.firstlineno == firstlineno)
+            ):
+                return Traceback(x._rawentry, self._excinfo)
+        return self
+
+    def __getitem__(self, key):
+        val = super(Traceback, self).__getitem__(key)
+        if isinstance(key, type(slice(0))):
+            val = self.__class__(val)
+        return val
+
+    def filter(self, fn=lambda x: not x.ishidden()):
+        """ return a Traceback instance with certain items removed
+
+            fn is a function that gets a single argument, a TracebackEntry
+            instance, and should return True when the item should be added
+            to the Traceback, False when not
+
+            by default this removes all the TracebackEntries which are hidden
+            (see ishidden() above)
+        """
+        return Traceback(filter(fn, self), self._excinfo)
+
+    def getcrashentry(self):
+        """ return last non-hidden traceback entry that lead
+        to the exception of a traceback.
+        """
+        for i in range(-1, -len(self) - 1, -1):
+            entry = self[i]
+            if not entry.ishidden():
+                return entry
+        return self[-1]
+
+    def recursionindex(self):
+        """ return the index of the frame/TracebackEntry where recursion
+            originates if appropriate, None if no recursion occurred
+        """
+        cache = {}
+        for i, entry in enumerate(self):
+            # id for the code.raw is needed to work around
+            # the strange metaprogramming in the decorator lib from pypi
+            # which generates code objects that have hash/value equality
+            # XXX needs a test
+            key = entry.frame.code.path, id(entry.frame.code.raw), entry.lineno
+            # print "checking for recursion at", key
+            values = cache.setdefault(key, [])
+            if values:
+                f = entry.frame
+                loc = f.f_locals
+                for otherloc in values:
+                    if f.is_true(
+                        f.eval(
+                            co_equal,
+                            __recursioncache_locals_1=loc,
+                            __recursioncache_locals_2=otherloc,
+                        )
+                    ):
+                        return i
+            values.append(entry.frame.f_locals)
+        return None
+
+
+co_equal = compile(
+    "__recursioncache_locals_1 == __recursioncache_locals_2", "?", "eval"
+)
+
+
+class ExceptionInfo(object):
+    """ wraps sys.exc_info() objects and offers
+        help for navigating the traceback.
+    """
+    _striptext = ""
+    _assert_start_repr = "AssertionError(u'assert " if _PY2 else "AssertionError('assert "
+
+    def __init__(self, tup=None, exprinfo=None):
+        import _pytest._code
+
+        if tup is None:
+            tup = sys.exc_info()
+            if exprinfo is None and isinstance(tup[1], AssertionError):
+                exprinfo = getattr(tup[1], "msg", None)
+                if exprinfo is None:
+                    exprinfo = py.io.saferepr(tup[1])
+                if exprinfo and exprinfo.startswith(self._assert_start_repr):
+                    self._striptext = "AssertionError: "
+        self._excinfo = tup
+        #: the exception class
+        self.type = tup[0]
+        #: the exception instance
+        self.value = tup[1]
+        #: the exception raw traceback
+        self.tb = tup[2]
+        #: the exception type name
+        self.typename = self.type.__name__
+        #: the exception traceback (_pytest._code.Traceback instance)
+        self.traceback = _pytest._code.Traceback(self.tb, excinfo=ref(self))
+
+    def __repr__(self):
+        return "<ExceptionInfo %s tblen=%d>" % (self.typename, len(self.traceback))
+
+    def exconly(self, tryshort=False):
+        """ return the exception as a string
+
+            when 'tryshort' resolves to True, and the exception is a
+            _pytest._code._AssertionError, only the actual exception part of
+            the exception representation is returned (so 'AssertionError: ' is
+            removed from the beginning)
+        """
+        lines = format_exception_only(self.type, self.value)
+        text = "".join(lines)
+        text = text.rstrip()
+        if tryshort:
+            if text.startswith(self._striptext):
+                text = text[len(self._striptext):]
+        return text
+
+    def errisinstance(self, exc):
+        """ return True if the exception is an instance of exc """
+        return isinstance(self.value, exc)
+
+    def _getreprcrash(self):
+        exconly = self.exconly(tryshort=True)
+        entry = self.traceback.getcrashentry()
+        path, lineno = entry.frame.code.raw.co_filename, entry.lineno
+        return ReprFileLocation(path, lineno + 1, exconly)
+
+    def getrepr(
+        self,
+        showlocals=False,
+        style="long",
+        abspath=False,
+        tbfilter=True,
+        funcargs=False,
+    ):
+        """ return str()able representation of this exception info.
+            showlocals: show locals per traceback entry
+            style: long|short|no|native traceback style
+            tbfilter: hide entries (where __tracebackhide__ is true)
+
+            in case of style==native, tbfilter and showlocals is ignored.
+        """
+        if style == "native":
+            return ReprExceptionInfo(
+                ReprTracebackNative(
+                    traceback.format_exception(
+                        self.type, self.value, self.traceback[0]._rawentry
+                    )
+                ),
+                self._getreprcrash(),
+            )
+
+        fmt = FormattedExcinfo(
+            showlocals=showlocals,
+            style=style,
+            abspath=abspath,
+            tbfilter=tbfilter,
+            funcargs=funcargs,
+        )
+        return fmt.repr_excinfo(self)
+
+    def __str__(self):
+        entry = self.traceback[-1]
+        loc = ReprFileLocation(entry.path, entry.lineno + 1, self.exconly())
+        return str(loc)
+
+    def __unicode__(self):
+        entry = self.traceback[-1]
+        loc = ReprFileLocation(entry.path, entry.lineno + 1, self.exconly())
+        return text_type(loc)
+
+    def match(self, regexp):
+        """
+        Match the regular expression 'regexp' on the string representation of
+        the exception. If it matches then True is returned (so that it is
+        possible to write 'assert excinfo.match()'). If it doesn't match an
+        AssertionError is raised.
+        """
+        __tracebackhide__ = True
+        if not re.search(regexp, str(self.value)):
+            assert 0, "Pattern '{!s}' not found in '{!s}'".format(regexp, self.value)
+        return True
+
+
+@attr.s
+class FormattedExcinfo(object):
+    """ presenting information about failing Functions and Generators. """
+    # for traceback entries
+    flow_marker = ">"
+    fail_marker = "E"
+
+    showlocals = attr.ib(default=False)
+    style = attr.ib(default="long")
+    abspath = attr.ib(default=True)
+    tbfilter = attr.ib(default=True)
+    funcargs = attr.ib(default=False)
+    astcache = attr.ib(default=attr.Factory(dict), init=False, repr=False)
+
+    def _getindent(self, source):
+        # figure out indent for given source
+        try:
+            s = str(source.getstatement(len(source) - 1))
+        except KeyboardInterrupt:
+            raise
+        except:  # noqa
+            try:
+                s = str(source[-1])
+            except KeyboardInterrupt:
+                raise
+            except:  # noqa
+                return 0
+        return 4 + (len(s) - len(s.lstrip()))
+
+    def _getentrysource(self, entry):
+        source = entry.getsource(self.astcache)
+        if source is not None:
+            source = source.deindent()
+        return source
+
+    def _saferepr(self, obj):
+        return py.io.saferepr(obj)
+
+    def repr_args(self, entry):
+        if self.funcargs:
+            args = []
+            for argname, argvalue in entry.frame.getargs(var=True):
+                args.append((argname, self._saferepr(argvalue)))
+            return ReprFuncArgs(args)
+
+    def get_source(self, source, line_index=-1, excinfo=None, short=False):
+        """ return formatted and marked up source lines. """
+        import _pytest._code
+
+        lines = []
+        if source is None or line_index >= len(source.lines):
+            source = _pytest._code.Source("???")
+            line_index = 0
+        if line_index < 0:
+            line_index += len(source)
+        space_prefix = "    "
+        if short:
+            lines.append(space_prefix + source.lines[line_index].strip())
+        else:
+            for line in source.lines[:line_index]:
+                lines.append(space_prefix + line)
+            lines.append(self.flow_marker + "   " + source.lines[line_index])
+            for line in source.lines[line_index + 1:]:
+                lines.append(space_prefix + line)
+        if excinfo is not None:
+            indent = 4 if short else self._getindent(source)
+            lines.extend(self.get_exconly(excinfo, indent=indent, markall=True))
+        return lines
+
+    def get_exconly(self, excinfo, indent=4, markall=False):
+        lines = []
+        indent = " " * indent
+        # get the real exception information out
+        exlines = excinfo.exconly(tryshort=True).split("\n")
+        failindent = self.fail_marker + indent[1:]
+        for line in exlines:
+            lines.append(failindent + line)
+            if not markall:
+                failindent = indent
+        return lines
+
+    def repr_locals(self, locals):
+        if self.showlocals:
+            lines = []
+            keys = [loc for loc in locals if loc[0] != "@"]
+            keys.sort()
+            for name in keys:
+                value = locals[name]
+                if name == "__builtins__":
+                    lines.append("__builtins__ = <builtins>")
+                else:
+                    # This formatting could all be handled by the
+                    # _repr() function, which is only reprlib.Repr in
+                    # disguise, so is very configurable.
+                    str_repr = self._saferepr(value)
+                    # if len(str_repr) < 70 or not isinstance(value,
+                    #                            (list, tuple, dict)):
+                    lines.append("%-10s = %s" % (name, str_repr))
+                    # else:
+                    #    self._line("%-10s =\\" % (name,))
+                    #    # XXX
+                    #    pprint.pprint(value, stream=self.excinfowriter)
+            return ReprLocals(lines)
+
+    def repr_traceback_entry(self, entry, excinfo=None):
+        import _pytest._code
+
+        source = self._getentrysource(entry)
+        if source is None:
+            source = _pytest._code.Source("???")
+            line_index = 0
+        else:
+            # entry.getfirstlinesource() can be -1, should be 0 on jython
+            line_index = entry.lineno - max(entry.getfirstlinesource(), 0)
+
+        lines = []
+        style = entry._repr_style
+        if style is None:
+            style = self.style
+        if style in ("short", "long"):
+            short = style == "short"
+            reprargs = self.repr_args(entry) if not short else None
+            s = self.get_source(source, line_index, excinfo, short=short)
+            lines.extend(s)
+            if short:
+                message = "in %s" % (entry.name)
+            else:
+                message = excinfo and excinfo.typename or ""
+            path = self._makepath(entry.path)
+            filelocrepr = ReprFileLocation(path, entry.lineno + 1, message)
+            localsrepr = None
+            if not short:
+                localsrepr = self.repr_locals(entry.locals)
+            return ReprEntry(lines, reprargs, localsrepr, filelocrepr, style)
+        if excinfo:
+            lines.extend(self.get_exconly(excinfo, indent=4))
+        return ReprEntry(lines, None, None, None, style)
+
+    def _makepath(self, path):
+        if not self.abspath:
+            try:
+                np = py.path.local().bestrelpath(path)
+            except OSError:
+                return path
+            if len(np) < len(str(path)):
+                path = np
+        return path
+
+    def repr_traceback(self, excinfo):
+        traceback = excinfo.traceback
+        if self.tbfilter:
+            traceback = traceback.filter()
+
+        if is_recursion_error(excinfo):
+            traceback, extraline = self._truncate_recursive_traceback(traceback)
+        else:
+            extraline = None
+
+        last = traceback[-1]
+        entries = []
+        for index, entry in enumerate(traceback):
+            einfo = (last == entry) and excinfo or None
+            reprentry = self.repr_traceback_entry(entry, einfo)
+            entries.append(reprentry)
+        return ReprTraceback(entries, extraline, style=self.style)
+
+    def _truncate_recursive_traceback(self, traceback):
+        """
+        Truncate the given recursive traceback trying to find the starting point
+        of the recursion.
+
+        The detection is done by going through each traceback entry and finding the
+        point in which the locals of the frame are equal to the locals of a previous frame (see ``recursionindex()``.
+
+        Handle the situation where the recursion process might raise an exception (for example
+        comparing numpy arrays using equality raises a TypeError), in which case we do our best to
+        warn the user of the error and show a limited traceback.
+        """
+        try:
+            recursionindex = traceback.recursionindex()
+        except Exception as e:
+            max_frames = 10
+            extraline = (
+                "!!! Recursion error detected, but an error occurred locating the origin of recursion.\n"
+                "  The following exception happened when comparing locals in the stack frame:\n"
+                "    {exc_type}: {exc_msg}\n"
+                "  Displaying first and last {max_frames} stack frames out of {total}."
+            ).format(
+                exc_type=type(e).__name__,
+                exc_msg=safe_str(e),
+                max_frames=max_frames,
+                total=len(traceback),
+            )
+            traceback = traceback[:max_frames] + traceback[-max_frames:]
+        else:
+            if recursionindex is not None:
+                extraline = "!!! Recursion detected (same locals & position)"
+                traceback = traceback[:recursionindex + 1]
+            else:
+                extraline = None
+
+        return traceback, extraline
+
+    def repr_excinfo(self, excinfo):
+        if _PY2:
+            reprtraceback = self.repr_traceback(excinfo)
+            reprcrash = excinfo._getreprcrash()
+
+            return ReprExceptionInfo(reprtraceback, reprcrash)
+        else:
+            repr_chain = []
+            e = excinfo.value
+            descr = None
+            while e is not None:
+                if excinfo:
+                    reprtraceback = self.repr_traceback(excinfo)
+                    reprcrash = excinfo._getreprcrash()
+                else:
+                    # fallback to native repr if the exception doesn't have a traceback:
+                    # ExceptionInfo objects require a full traceback to work
+                    reprtraceback = ReprTracebackNative(
+                        traceback.format_exception(type(e), e, None)
+                    )
+                    reprcrash = None
+
+                repr_chain += [(reprtraceback, reprcrash, descr)]
+                if e.__cause__ is not None:
+                    e = e.__cause__
+                    excinfo = ExceptionInfo(
+                        (type(e), e, e.__traceback__)
+                    ) if e.__traceback__ else None
+                    descr = "The above exception was the direct cause of the following exception:"
+                elif (e.__context__ is not None and not e.__suppress_context__):
+                    e = e.__context__
+                    excinfo = ExceptionInfo(
+                        (type(e), e, e.__traceback__)
+                    ) if e.__traceback__ else None
+                    descr = "During handling of the above exception, another exception occurred:"
+                else:
+                    e = None
+            repr_chain.reverse()
+            return ExceptionChainRepr(repr_chain)
+
+
+class TerminalRepr(object):
+
+    def __str__(self):
+        s = self.__unicode__()
+        if _PY2:
+            s = s.encode("utf-8")
+        return s
+
+    def __unicode__(self):
+        # FYI this is called from pytest-xdist's serialization of exception
+        # information.
+        io = py.io.TextIO()
+        tw = py.io.TerminalWriter(file=io)
+        self.toterminal(tw)
+        return io.getvalue().strip()
+
+    def __repr__(self):
+        return "<%s instance at %0x>" % (self.__class__, id(self))
+
+
+class ExceptionRepr(TerminalRepr):
+
+    def __init__(self):
+        self.sections = []
+
+    def addsection(self, name, content, sep="-"):
+        self.sections.append((name, content, sep))
+
+    def toterminal(self, tw):
+        for name, content, sep in self.sections:
+            tw.sep(sep, name)
+            tw.line(content)
+
+
+class ExceptionChainRepr(ExceptionRepr):
+
+    def __init__(self, chain):
+        super(ExceptionChainRepr, self).__init__()
+        self.chain = chain
+        # reprcrash and reprtraceback of the outermost (the newest) exception
+        # in the chain
+        self.reprtraceback = chain[-1][0]
+        self.reprcrash = chain[-1][1]
+
+    def toterminal(self, tw):
+        for element in self.chain:
+            element[0].toterminal(tw)
+            if element[2] is not None:
+                tw.line("")
+                tw.line(element[2], yellow=True)
+        super(ExceptionChainRepr, self).toterminal(tw)
+
+
+class ReprExceptionInfo(ExceptionRepr):
+
+    def __init__(self, reprtraceback, reprcrash):
+        super(ReprExceptionInfo, self).__init__()
+        self.reprtraceback = reprtraceback
+        self.reprcrash = reprcrash
+
+    def toterminal(self, tw):
+        self.reprtraceback.toterminal(tw)
+        super(ReprExceptionInfo, self).toterminal(tw)
+
+
+class ReprTraceback(TerminalRepr):
+    entrysep = "_ "
+
+    def __init__(self, reprentries, extraline, style):
+        self.reprentries = reprentries
+        self.extraline = extraline
+        self.style = style
+
+    def toterminal(self, tw):
+        # the entries might have different styles
+        for i, entry in enumerate(self.reprentries):
+            if entry.style == "long":
+                tw.line("")
+            entry.toterminal(tw)
+            if i < len(self.reprentries) - 1:
+                next_entry = self.reprentries[i + 1]
+                if (
+                    entry.style == "long"
+                    or entry.style == "short"
+                    and next_entry.style == "long"
+                ):
+                    tw.sep(self.entrysep)
+
+        if self.extraline:
+            tw.line(self.extraline)
+
+
+class ReprTracebackNative(ReprTraceback):
+
+    def __init__(self, tblines):
+        self.style = "native"
+        self.reprentries = [ReprEntryNative(tblines)]
+        self.extraline = None
+
+
+class ReprEntryNative(TerminalRepr):
+    style = "native"
+
+    def __init__(self, tblines):
+        self.lines = tblines
+
+    def toterminal(self, tw):
+        tw.write("".join(self.lines))
+
+
+class ReprEntry(TerminalRepr):
+    localssep = "_ "
+
+    def __init__(self, lines, reprfuncargs, reprlocals, filelocrepr, style):
+        self.lines = lines
+        self.reprfuncargs = reprfuncargs
+        self.reprlocals = reprlocals
+        self.reprfileloc = filelocrepr
+        self.style = style
+
+    def toterminal(self, tw):
+        if self.style == "short":
+            self.reprfileloc.toterminal(tw)
+            for line in self.lines:
+                red = line.startswith("E   ")
+                tw.line(line, bold=True, red=red)
+            # tw.line("")
+            return
+        if self.reprfuncargs:
+            self.reprfuncargs.toterminal(tw)
+        for line in self.lines:
+            red = line.startswith("E   ")
+            tw.line(line, bold=True, red=red)
+        if self.reprlocals:
+            # tw.sep(self.localssep, "Locals")
+            tw.line("")
+            self.reprlocals.toterminal(tw)
+        if self.reprfileloc:
+            if self.lines:
+                tw.line("")
+            self.reprfileloc.toterminal(tw)
+
+    def __str__(self):
+        return "%s\n%s\n%s" % ("\n".join(self.lines), self.reprlocals, self.reprfileloc)
+
+
+class ReprFileLocation(TerminalRepr):
+
+    def __init__(self, path, lineno, message):
+        self.path = str(path)
+        self.lineno = lineno
+        self.message = message
+
+    def toterminal(self, tw):
+        # filename and lineno output for each entry,
+        # using an output format that most editors unterstand
+        msg = self.message
+        i = msg.find("\n")
+        if i != -1:
+            msg = msg[:i]
+        tw.write(self.path, bold=True, red=True)
+        tw.line(":%s: %s" % (self.lineno, msg))
+
+
+class ReprLocals(TerminalRepr):
+
+    def __init__(self, lines):
+        self.lines = lines
+
+    def toterminal(self, tw):
+        for line in self.lines:
+            tw.line(line)
+
+
+class ReprFuncArgs(TerminalRepr):
+
+    def __init__(self, args):
+        self.args = args
+
+    def toterminal(self, tw):
+        if self.args:
+            linesofar = ""
+            for name, value in self.args:
+                ns = "%s = %s" % (safe_str(name), safe_str(value))
+                if len(ns) + len(linesofar) + 2 > tw.fullwidth:
+                    if linesofar:
+                        tw.line(linesofar)
+                    linesofar = ns
+                else:
+                    if linesofar:
+                        linesofar += ", " + ns
+                    else:
+                        linesofar = ns
+            if linesofar:
+                tw.line(linesofar)
+            tw.line("")
+
+
+def getrawcode(obj, trycall=True):
+    """ return code object for given function. """
+    try:
+        return obj.__code__
+    except AttributeError:
+        obj = getattr(obj, "im_func", obj)
+        obj = getattr(obj, "func_code", obj)
+        obj = getattr(obj, "f_code", obj)
+        obj = getattr(obj, "__code__", obj)
+        if trycall and not hasattr(obj, "co_firstlineno"):
+            if hasattr(obj, "__call__") and not inspect.isclass(obj):
+                x = getrawcode(obj.__call__, trycall=False)
+                if hasattr(x, "co_firstlineno"):
+                    return x
+        return obj
+
+
+if PY35:  # RecursionError introduced in 3.5
+
+    def is_recursion_error(excinfo):
+        return excinfo.errisinstance(RecursionError)  # noqa
+
+
+else:
+
+    def is_recursion_error(excinfo):
+        if not excinfo.errisinstance(RuntimeError):
+            return False
+        try:
+            return "maximum recursion depth exceeded" in str(excinfo.value)
+        except UnicodeError:
+            return False
new file mode 100644
--- /dev/null
+++ b/third_party/python/pytest/src/_pytest/_code/source.py
@@ -0,0 +1,379 @@
+from __future__ import absolute_import, division, generators, print_function
+
+import ast
+from ast import PyCF_ONLY_AST as _AST_FLAG
+from bisect import bisect_right
+import linecache
+import sys
+import six
+import inspect
+import tokenize
+import py
+
+cpy_compile = compile
+
+
+class Source(object):
+    """ an immutable object holding a source code fragment,
+        possibly deindenting it.
+    """
+    _compilecounter = 0
+
+    def __init__(self, *parts, **kwargs):
+        self.lines = lines = []
+        de = kwargs.get("deindent", True)
+        rstrip = kwargs.get("rstrip", True)
+        for part in parts:
+            if not part:
+                partlines = []
+            elif isinstance(part, Source):
+                partlines = part.lines
+            elif isinstance(part, (tuple, list)):
+                partlines = [x.rstrip("\n") for x in part]
+            elif isinstance(part, six.string_types):
+                partlines = part.split("\n")
+                if rstrip:
+                    while partlines:
+                        if partlines[-1].strip():
+                            break
+                        partlines.pop()
+            else:
+                partlines = getsource(part, deindent=de).lines
+            if de:
+                partlines = deindent(partlines)
+            lines.extend(partlines)
+
+    def __eq__(self, other):
+        try:
+            return self.lines == other.lines
+        except AttributeError:
+            if isinstance(other, str):
+                return str(self) == other
+            return False
+
+    __hash__ = None
+
+    def __getitem__(self, key):
+        if isinstance(key, int):
+            return self.lines[key]
+        else:
+            if key.step not in (None, 1):
+                raise IndexError("cannot slice a Source with a step")
+            newsource = Source()
+            newsource.lines = self.lines[key.start:key.stop]
+            return newsource
+
+    def __len__(self):
+        return len(self.lines)
+
+    def strip(self):
+        """ return new source object with trailing
+            and leading blank lines removed.
+        """
+        start, end = 0, len(self)
+        while start < end and not self.lines[start].strip():
+            start += 1
+        while end > start and not self.lines[end - 1].strip():
+            end -= 1
+        source = Source()
+        source.lines[:] = self.lines[start:end]
+        return source
+
+    def putaround(self, before="", after="", indent=" " * 4):
+        """ return a copy of the source object with
+            'before' and 'after' wrapped around it.
+        """
+        before = Source(before)
+        after = Source(after)
+        newsource = Source()
+        lines = [(indent + line) for line in self.lines]
+        newsource.lines = before.lines + lines + after.lines
+        return newsource
+
+    def indent(self, indent=" " * 4):
+        """ return a copy of the source object with
+            all lines indented by the given indent-string.
+        """
+        newsource = Source()
+        newsource.lines = [(indent + line) for line in self.lines]
+        return newsource
+
+    def getstatement(self, lineno):
+        """ return Source statement which contains the
+            given linenumber (counted from 0).
+        """
+        start, end = self.getstatementrange(lineno)
+        return self[start:end]
+
+    def getstatementrange(self, lineno):
+        """ return (start, end) tuple which spans the minimal
+            statement region which containing the given lineno.
+        """
+        if not (0 <= lineno < len(self)):
+            raise IndexError("lineno out of range")
+        ast, start, end = getstatementrange_ast(lineno, self)
+        return start, end
+
+    def deindent(self, offset=None):
+        """ return a new source object deindented by offset.
+            If offset is None then guess an indentation offset from
+            the first non-blank line.  Subsequent lines which have a
+            lower indentation offset will be copied verbatim as
+            they are assumed to be part of multilines.
+        """
+        # XXX maybe use the tokenizer to properly handle multiline
+        #     strings etc.pp?
+        newsource = Source()
+        newsource.lines[:] = deindent(self.lines, offset)
+        return newsource
+
+    def isparseable(self, deindent=True):
+        """ return True if source is parseable, heuristically
+            deindenting it by default.
+        """
+        from parser import suite as syntax_checker
+
+        if deindent:
+            source = str(self.deindent())
+        else:
+            source = str(self)
+        try:
+            # compile(source+'\n', "x", "exec")
+            syntax_checker(source + "\n")
+        except KeyboardInterrupt:
+            raise
+        except Exception:
+            return False
+        else:
+            return True
+
+    def __str__(self):
+        return "\n".join(self.lines)
+
+    def compile(
+        self,
+        filename=None,
+        mode="exec",
+        flag=generators.compiler_flag,
+        dont_inherit=0,
+        _genframe=None,
+    ):
+        """ return compiled code object. if filename is None
+            invent an artificial filename which displays
+            the source/line position of the caller frame.
+        """
+        if not filename or py.path.local(filename).check(file=0):
+            if _genframe is None:
+                _genframe = sys._getframe(1)  # the caller
+            fn, lineno = _genframe.f_code.co_filename, _genframe.f_lineno
+            base = "<%d-codegen " % self._compilecounter
+            self.__class__._compilecounter += 1
+            if not filename:
+                filename = base + "%s:%d>" % (fn, lineno)
+            else:
+                filename = base + "%r %s:%d>" % (filename, fn, lineno)
+        source = "\n".join(self.lines) + "\n"
+        try:
+            co = cpy_compile(source, filename, mode, flag)
+        except SyntaxError:
+            ex = sys.exc_info()[1]
+            # re-represent syntax errors from parsing python strings
+            msglines = self.lines[:ex.lineno]
+            if ex.offset:
+                msglines.append(" " * ex.offset + "^")
+            msglines.append("(code was compiled probably from here: %s)" % filename)
+            newex = SyntaxError("\n".join(msglines))
+            newex.offset = ex.offset
+            newex.lineno = ex.lineno
+            newex.text = ex.text
+            raise newex
+        else:
+            if flag & _AST_FLAG:
+                return co
+            lines = [(x + "\n") for x in self.lines]
+            linecache.cache[filename] = (1, None, lines, filename)
+            return co
+
+
+#
+# public API shortcut functions
+#
+
+
+def compile_(
+    source, filename=None, mode="exec", flags=generators.compiler_flag, dont_inherit=0
+):
+    """ compile the given source to a raw code object,
+        and maintain an internal cache which allows later
+        retrieval of the source code for the code object
+        and any recursively created code objects.
+    """
+    if isinstance(source, ast.AST):
+        # XXX should Source support having AST?
+        return cpy_compile(source, filename, mode, flags, dont_inherit)
+    _genframe = sys._getframe(1)  # the caller
+    s = Source(source)
+    co = s.compile(filename, mode, flags, _genframe=_genframe)
+    return co
+
+
+def getfslineno(obj):
+    """ Return source location (path, lineno) for the given object.
+    If the source cannot be determined return ("", -1)
+    """
+    from .code import Code
+
+    try:
+        code = Code(obj)
+    except TypeError:
+        try:
+            fn = inspect.getsourcefile(obj) or inspect.getfile(obj)
+        except TypeError:
+            return "", -1
+
+        fspath = fn and py.path.local(fn) or None
+        lineno = -1
+        if fspath:
+            try:
+                _, lineno = findsource(obj)
+            except IOError:
+                pass
+    else:
+        fspath = code.path
+        lineno = code.firstlineno
+    assert isinstance(lineno, int)
+    return fspath, lineno
+
+
+#
+# helper functions
+#
+
+
+def findsource(obj):
+    try:
+        sourcelines, lineno = inspect.findsource(obj)
+    except py.builtin._sysex:
+        raise
+    except:  # noqa
+        return None, -1
+    source = Source()
+    source.lines = [line.rstrip() for line in sourcelines]
+    return source, lineno
+
+
+def getsource(obj, **kwargs):
+    from .code import getrawcode
+
+    obj = getrawcode(obj)
+    try:
+        strsrc = inspect.getsource(obj)
+    except IndentationError:
+        strsrc = '"Buggy python version consider upgrading, cannot get source"'
+    assert isinstance(strsrc, str)
+    return Source(strsrc, **kwargs)
+
+
+def deindent(lines, offset=None):
+    if offset is None:
+        for line in lines:
+            line = line.expandtabs()
+            s = line.lstrip()
+            if s:
+                offset = len(line) - len(s)
+                break
+        else:
+            offset = 0
+    if offset == 0:
+        return list(lines)
+    newlines = []
+
+    def readline_generator(lines):
+        for line in lines:
+            yield line + "\n"
+
+    it = readline_generator(lines)
+
+    try:
+        for _, _, (sline, _), (eline, _), _ in tokenize.generate_tokens(
+            lambda: next(it)
+        ):
+            if sline > len(lines):
+                break  # End of input reached
+            if sline > len(newlines):
+                line = lines[sline - 1].expandtabs()
+                if line.lstrip() and line[:offset].isspace():
+                    line = line[offset:]  # Deindent
+                newlines.append(line)
+
+            for i in range(sline, eline):
+                # Don't deindent continuing lines of
+                # multiline tokens (i.e. multiline strings)
+                newlines.append(lines[i])
+    except (IndentationError, tokenize.TokenError):
+        pass
+    # Add any lines we didn't see. E.g. if an exception was raised.
+    newlines.extend(lines[len(newlines):])
+    return newlines
+
+
+def get_statement_startend2(lineno, node):
+    import ast
+
+    # flatten all statements and except handlers into one lineno-list
+    # AST's line numbers start indexing at 1
+    values = []
+    for x in ast.walk(node):
+        if isinstance(x, (ast.stmt, ast.ExceptHandler)):
+            values.append(x.lineno - 1)
+            for name in ("finalbody", "orelse"):
+                val = getattr(x, name, None)
+                if val:
+                    # treat the finally/orelse part as its own statement
+                    values.append(val[0].lineno - 1 - 1)
+    values.sort()
+    insert_index = bisect_right(values, lineno)
+    start = values[insert_index - 1]
+    if insert_index >= len(values):
+        end = None
+    else:
+        end = values[insert_index]
+    return start, end
+
+
+def getstatementrange_ast(lineno, source, assertion=False, astnode=None):
+    if astnode is None:
+        content = str(source)
+        astnode = compile(content, "source", "exec", 1024)  # 1024 for AST
+
+    start, end = get_statement_startend2(lineno, astnode)
+    # we need to correct the end:
+    # - ast-parsing strips comments
+    # - there might be empty lines
+    # - we might have lesser indented code blocks at the end
+    if end is None:
+        end = len(source.lines)
+
+    if end > start + 1:
+        # make sure we don't span differently indented code blocks
+        # by using the BlockFinder helper used which inspect.getsource() uses itself
+        block_finder = inspect.BlockFinder()
+        # if we start with an indented line, put blockfinder to "started" mode
+        block_finder.started = source.lines[start][0].isspace()
+        it = ((x + "\n") for x in source.lines[start:end])
+        try:
+            for tok in tokenize.generate_tokens(lambda: next(it)):
+                block_finder.tokeneater(*tok)
+        except (inspect.EndOfBlock, IndentationError):
+            end = block_finder.last + start
+        except Exception:
+            pass
+
+    # the end might still point to a comment or empty line, correct it
+    while end:
+        line = source.lines[end - 1].lstrip()
+        if line.startswith("#") or not line:
+            end -= 1
+        else:
+            break
+    return astnode, start, end
new file mode 100644
--- /dev/null
+++ b/third_party/python/pytest/src/_pytest/_version.py
@@ -0,0 +1,4 @@
+# coding: utf-8
+# file generated by setuptools_scm
+# don't change, don't track in version control
+version = '3.6.2'
new file mode 100644
--- /dev/null
+++ b/third_party/python/pytest/src/_pytest/assertion/__init__.py
@@ -0,0 +1,151 @@
+"""
+support for presenting detailed information in failing assertions.
+"""
+from __future__ import absolute_import, division, print_function
+import sys
+import six
+
+from _pytest.assertion import util
+from _pytest.assertion import rewrite
+from _pytest.assertion import truncate
+
+
+def pytest_addoption(parser):
+    group = parser.getgroup("debugconfig")
+    group.addoption(
+        "--assert",
+        action="store",
+        dest="assertmode",
+        choices=("rewrite", "plain"),
+        default="rewrite",
+        metavar="MODE",
+        help="""Control assertion debugging tools.  'plain'
+                            performs no assertion debugging.  'rewrite'
+                            (the default) rewrites assert statements in
+                            test modules on import to provide assert
+                            expression information.""",
+    )
+
+
+def register_assert_rewrite(*names):
+    """Register one or more module names to be rewritten on import.
+
+    This function will make sure that this module or all modules inside
+    the package will get their assert statements rewritten.
+    Thus you should make sure to call this before the module is
+    actually imported, usually in your __init__.py if you are a plugin
+    using a package.
+
+    :raise TypeError: if the given module names are not strings.
+    """
+    for name in names:
+        if not isinstance(name, str):
+            msg = "expected module names as *args, got {0} instead"
+            raise TypeError(msg.format(repr(names)))
+    for hook in sys.meta_path:
+        if isinstance(hook, rewrite.AssertionRewritingHook):
+            importhook = hook
+            break
+    else:
+        importhook = DummyRewriteHook()
+    importhook.mark_rewrite(*names)
+
+
+class DummyRewriteHook(object):
+    """A no-op import hook for when rewriting is disabled."""
+
+    def mark_rewrite(self, *names):
+        pass
+
+
+class AssertionState(object):
+    """State for the assertion plugin."""
+
+    def __init__(self, config, mode):
+        self.mode = mode
+        self.trace = config.trace.root.get("assertion")
+        self.hook = None
+
+
+def install_importhook(config):
+    """Try to install the rewrite hook, raise SystemError if it fails."""
+    # Jython has an AST bug that make the assertion rewriting hook malfunction.
+    if sys.platform.startswith("java"):
+        raise SystemError("rewrite not supported")
+
+    config._assertstate = AssertionState(config, "rewrite")
+    config._assertstate.hook = hook = rewrite.AssertionRewritingHook(config)
+    sys.meta_path.insert(0, hook)
+    config._assertstate.trace("installed rewrite import hook")
+
+    def undo():
+        hook = config._assertstate.hook
+        if hook is not None and hook in sys.meta_path:
+            sys.meta_path.remove(hook)
+
+    config.add_cleanup(undo)
+    return hook
+
+
+def pytest_collection(session):
+    # this hook is only called when test modules are collected
+    # so for example not in the master process of pytest-xdist
+    # (which does not collect test modules)
+    assertstate = getattr(session.config, "_assertstate", None)
+    if assertstate:
+        if assertstate.hook is not None:
+            assertstate.hook.set_session(session)
+
+
+def pytest_runtest_setup(item):
+    """Setup the pytest_assertrepr_compare hook
+
+    The newinterpret and rewrite modules will use util._reprcompare if
+    it exists to use custom reporting via the
+    pytest_assertrepr_compare hook.  This sets up this custom
+    comparison for the test.
+    """
+
+    def callbinrepr(op, left, right):
+        """Call the pytest_assertrepr_compare hook and prepare the result
+
+        This uses the first result from the hook and then ensures the
+        following:
+        * Overly verbose explanations are truncated unless configured otherwise
+          (eg. if running in verbose mode).
+        * Embedded newlines are escaped to help util.format_explanation()
+          later.
+        * If the rewrite mode is used embedded %-characters are replaced
+          to protect later % formatting.
+
+        The result can be formatted by util.format_explanation() for
+        pretty printing.
+        """
+        hook_result = item.ihook.pytest_assertrepr_compare(
+            config=item.config, op=op, left=left, right=right
+        )
+        for new_expl in hook_result:
+            if new_expl:
+                new_expl = truncate.truncate_if_required(new_expl, item)
+                new_expl = [line.replace("\n", "\\n") for line in new_expl]
+                res = six.text_type("\n~").join(new_expl)
+                if item.config.getvalue("assertmode") == "rewrite":
+                    res = res.replace("%", "%%")
+                return res
+
+    util._reprcompare = callbinrepr
+
+
+def pytest_runtest_teardown(item):
+    util._reprcompare = None
+
+
+def pytest_sessionfinish(session):
+    assertstate = getattr(session.config, "_assertstate", None)
+    if assertstate:
+        if assertstate.hook is not None:
+            assertstate.hook.set_session(None)
+
+
+# Expose this plugin's implementation for the pytest_assertrepr_compare hook
+pytest_assertrepr_compare = util.assertrepr_compare
new file mode 100644
--- /dev/null
+++ b/third_party/python/pytest/src/_pytest/assertion/rewrite.py
@@ -0,0 +1,954 @@
+"""Rewrite assertion AST to produce nice error messages"""
+from __future__ import absolute_import, division, print_function
+import ast
+import errno
+import itertools
+import imp
+import marshal
+import os
+import re
+import six
+import struct
+import sys
+import types
+
+import atomicwrites
+import py
+
+from _pytest.assertion import util
+
+
+# pytest caches rewritten pycs in __pycache__.
+if hasattr(imp, "get_tag"):
+    PYTEST_TAG = imp.get_tag() + "-PYTEST"
+else:
+    if hasattr(sys, "pypy_version_info"):
+        impl = "pypy"
+    elif sys.platform == "java":
+        impl = "jython"
+    else:
+        impl = "cpython"
+    ver = sys.version_info
+    PYTEST_TAG = "%s-%s%s-PYTEST" % (impl, ver[0], ver[1])
+    del ver, impl
+
+PYC_EXT = ".py" + (__debug__ and "c" or "o")
+PYC_TAIL = "." + PYTEST_TAG + PYC_EXT
+
+ASCII_IS_DEFAULT_ENCODING = sys.version_info[0] < 3
+
+if sys.version_info >= (3, 5):
+    ast_Call = ast.Call
+else:
+
+    def ast_Call(a, b, c):
+        return ast.Call(a, b, c, None, None)
+
+
+class AssertionRewritingHook(object):
+    """PEP302 Import hook which rewrites asserts."""
+
+    def __init__(self, config):
+        self.config = config
+        self.fnpats = config.getini("python_files")
+        self.session = None
+        self.modules = {}
+        self._rewritten_names = set()
+        self._register_with_pkg_resources()
+        self._must_rewrite = set()
+
+    def set_session(self, session):
+        self.session = session
+
+    def find_module(self, name, path=None):
+        state = self.config._assertstate
+        state.trace("find_module called for: %s" % name)
+        names = name.rsplit(".", 1)
+        lastname = names[-1]
+        pth = None
+        if path is not None:
+            # Starting with Python 3.3, path is a _NamespacePath(), which
+            # causes problems if not converted to list.
+            path = list(path)
+            if len(path) == 1:
+                pth = path[0]
+        if pth is None:
+            try:
+                fd, fn, desc = imp.find_module(lastname, path)
+            except ImportError:
+                return None
+            if fd is not None:
+                fd.close()
+            tp = desc[2]
+            if tp == imp.PY_COMPILED:
+                if hasattr(imp, "source_from_cache"):
+                    try:
+                        fn = imp.source_from_cache(fn)
+                    except ValueError:
+                        # Python 3 doesn't like orphaned but still-importable
+                        # .pyc files.
+                        fn = fn[:-1]
+                else:
+                    fn = fn[:-1]
+            elif tp != imp.PY_SOURCE:
+                # Don't know what this is.
+                return None
+        else:
+            fn = os.path.join(pth, name.rpartition(".")[2] + ".py")
+
+        fn_pypath = py.path.local(fn)
+        if not self._should_rewrite(name, fn_pypath, state):
+            return None
+
+        self._rewritten_names.add(name)
+
+        # The requested module looks like a test file, so rewrite it. This is
+        # the most magical part of the process: load the source, rewrite the
+        # asserts, and load the rewritten source. We also cache the rewritten
+        # module code in a special pyc. We must be aware of the possibility of
+        # concurrent pytest processes rewriting and loading pycs. To avoid
+        # tricky race conditions, we maintain the following invariant: The
+        # cached pyc is always a complete, valid pyc. Operations on it must be
+        # atomic. POSIX's atomic rename comes in handy.
+        write = not sys.dont_write_bytecode
+        cache_dir = os.path.join(fn_pypath.dirname, "__pycache__")
+        if write:
+            try:
+                os.mkdir(cache_dir)
+            except OSError:
+                e = sys.exc_info()[1].errno
+                if e == errno.EEXIST:
+                    # Either the __pycache__ directory already exists (the
+                    # common case) or it's blocked by a non-dir node. In the
+                    # latter case, we'll ignore it in _write_pyc.
+                    pass
+                elif e in [errno.ENOENT, errno.ENOTDIR]:
+                    # One of the path components was not a directory, likely
+                    # because we're in a zip file.
+                    write = False
+                elif e in [errno.EACCES, errno.EROFS, errno.EPERM]:
+                    state.trace("read only directory: %r" % fn_pypath.dirname)
+                    write = False
+                else:
+                    raise
+        cache_name = fn_pypath.basename[:-3] + PYC_TAIL
+        pyc = os.path.join(cache_dir, cache_name)
+        # Notice that even if we're in a read-only directory, I'm going
+        # to check for a cached pyc. This may not be optimal...
+        co = _read_pyc(fn_pypath, pyc, state.trace)
+        if co is None:
+            state.trace("rewriting %r" % (fn,))
+            source_stat, co = _rewrite_test(self.config, fn_pypath)
+            if co is None:
+                # Probably a SyntaxError in the test.
+                return None
+            if write:
+                _write_pyc(state, co, source_stat, pyc)
+        else:
+            state.trace("found cached rewritten pyc for %r" % (fn,))
+        self.modules[name] = co, pyc
+        return self
+
+    def _should_rewrite(self, name, fn_pypath, state):
+        # always rewrite conftest files
+        fn = str(fn_pypath)
+        if fn_pypath.basename == "conftest.py":
+            state.trace("rewriting conftest file: %r" % (fn,))
+            return True
+
+        if self.session is not None:
+            if self.session.isinitpath(fn):
+                state.trace("matched test file (was specified on cmdline): %r" % (fn,))
+                return True
+
+        # modules not passed explicitly on the command line are only
+        # rewritten if they match the naming convention for test files
+        for pat in self.fnpats:
+            if fn_pypath.fnmatch(pat):
+                state.trace("matched test file %r" % (fn,))
+                return True
+
+        for marked in self._must_rewrite:
+            if name == marked or name.startswith(marked + "."):
+                state.trace("matched marked file %r (from %r)" % (name, marked))
+                return True
+
+        return False
+
+    def mark_rewrite(self, *names):
+        """Mark import names as needing to be rewritten.
+
+        The named module or package as well as any nested modules will
+        be rewritten on import.
+        """
+        already_imported = (
+            set(names).intersection(sys.modules).difference(self._rewritten_names)
+        )
+        for name in already_imported:
+            if not AssertionRewriter.is_rewrite_disabled(
+                sys.modules[name].__doc__ or ""
+            ):
+                self._warn_already_imported(name)
+        self._must_rewrite.update(names)
+
+    def _warn_already_imported(self, name):
+        self.config.warn(
+            "P1", "Module already imported so cannot be rewritten: %s" % name
+        )
+
+    def load_module(self, name):
+        # If there is an existing module object named 'fullname' in
+        # sys.modules, the loader must use that existing module. (Otherwise,
+        # the reload() builtin will not work correctly.)
+        if name in sys.modules:
+            return sys.modules[name]
+
+        co, pyc = self.modules.pop(name)
+        # I wish I could just call imp.load_compiled here, but __file__ has to
+        # be set properly. In Python 3.2+, this all would be handled correctly
+        # by load_compiled.
+        mod = sys.modules[name] = imp.new_module(name)
+        try:
+            mod.__file__ = co.co_filename
+            # Normally, this attribute is 3.2+.
+            mod.__cached__ = pyc
+            mod.__loader__ = self
+            py.builtin.exec_(co, mod.__dict__)
+        except:  # noqa
+            if name in sys.modules:
+                del sys.modules[name]
+            raise
+        return sys.modules[name]
+
+    def is_package(self, name):
+        try:
+            fd, fn, desc = imp.find_module(name)
+        except ImportError:
+            return False
+        if fd is not None:
+            fd.close()
+        tp = desc[2]
+        return tp == imp.PKG_DIRECTORY
+
+    @classmethod
+    def _register_with_pkg_resources(cls):
+        """
+        Ensure package resources can be loaded from this loader. May be called
+        multiple times, as the operation is idempotent.
+        """
+        try:
+            import pkg_resources
+
+            # access an attribute in case a deferred importer is present
+            pkg_resources.__name__
+        except ImportError:
+            return
+
+        # Since pytest tests are always located in the file system, the
+        #  DefaultProvider is appropriate.
+        pkg_resources.register_loader_type(cls, pkg_resources.DefaultProvider)
+
+    def get_data(self, pathname):
+        """Optional PEP302 get_data API.
+        """
+        with open(pathname, "rb") as f:
+            return f.read()
+
+
+def _write_pyc(state, co, source_stat, pyc):
+    # Technically, we don't have to have the same pyc format as
+    # (C)Python, since these "pycs" should never be seen by builtin
+    # import. However, there's little reason deviate, and I hope
+    # sometime to be able to use imp.load_compiled to load them. (See
+    # the comment in load_module above.)
+    try:
+        with atomicwrites.atomic_write(pyc, mode="wb", overwrite=True) as fp:
+            fp.write(imp.get_magic())
+            mtime = int(source_stat.mtime)
+            size = source_stat.size & 0xFFFFFFFF
+            fp.write(struct.pack("<ll", mtime, size))
+            fp.write(marshal.dumps(co))
+    except EnvironmentError as e:
+        state.trace("error writing pyc file at %s: errno=%s" % (pyc, e.errno))
+        # we ignore any failure to write the cache file
+        # there are many reasons, permission-denied, __pycache__ being a
+        # file etc.
+        return False
+    return True
+
+
+RN = "\r\n".encode("utf-8")
+N = "\n".encode("utf-8")
+
+cookie_re = re.compile(r"^[ \t\f]*#.*coding[:=][ \t]*[-\w.]+")
+BOM_UTF8 = "\xef\xbb\xbf"
+
+
+def _rewrite_test(config, fn):
+    """Try to read and rewrite *fn* and return the code object."""
+    state = config._assertstate
+    try:
+        stat = fn.stat()
+        source = fn.read("rb")
+    except EnvironmentError:
+        return None, None
+    if ASCII_IS_DEFAULT_ENCODING:
+        # ASCII is the default encoding in Python 2. Without a coding
+        # declaration, Python 2 will complain about any bytes in the file
+        # outside the ASCII range. Sadly, this behavior does not extend to
+        # compile() or ast.parse(), which prefer to interpret the bytes as
+        # latin-1. (At least they properly handle explicit coding cookies.) To
+        # preserve this error behavior, we could force ast.parse() to use ASCII
+        # as the encoding by inserting a coding cookie. Unfortunately, that
+        # messes up line numbers. Thus, we have to check ourselves if anything
+        # is outside the ASCII range in the case no encoding is explicitly
+        # declared. For more context, see issue #269. Yay for Python 3 which
+        # gets this right.
+        end1 = source.find("\n")
+        end2 = source.find("\n", end1 + 1)
+        if (
+            not source.startswith(BOM_UTF8)
+            and cookie_re.match(source[0:end1]) is None
+            and cookie_re.match(source[end1 + 1:end2]) is None
+        ):
+            if hasattr(state, "_indecode"):
+                # encodings imported us again, so don't rewrite.
+                return None, None
+            state._indecode = True
+            try:
+                try:
+                    source.decode("ascii")
+                except UnicodeDecodeError:
+                    # Let it fail in real import.
+                    return None, None
+            finally:
+                del state._indecode
+    try:
+        tree = ast.parse(source)
+    except SyntaxError:
+        # Let this pop up again in the real import.
+        state.trace("failed to parse: %r" % (fn,))
+        return None, None
+    rewrite_asserts(tree, fn, config)
+    try:
+        co = compile(tree, fn.strpath, "exec", dont_inherit=True)
+    except SyntaxError:
+        # It's possible that this error is from some bug in the
+        # assertion rewriting, but I don't know of a fast way to tell.
+        state.trace("failed to compile: %r" % (fn,))
+        return None, None
+    return stat, co
+
+
+def _read_pyc(source, pyc, trace=lambda x: None):
+    """Possibly read a pytest pyc containing rewritten code.
+
+    Return rewritten code if successful or None if not.
+    """
+    try:
+        fp = open(pyc, "rb")
+    except IOError:
+        return None
+    with fp:
+        try:
+            mtime = int(source.mtime())
+            size = source.size()
+            data = fp.read(12)
+        except EnvironmentError as e:
+            trace("_read_pyc(%s): EnvironmentError %s" % (source, e))
+            return None
+        # Check for invalid or out of date pyc file.
+        if (
+            len(data) != 12
+            or data[:4] != imp.get_magic()
+            or struct.unpack("<ll", data[4:]) != (mtime, size)
+        ):
+            trace("_read_pyc(%s): invalid or out of date pyc" % source)
+            return None
+        try:
+            co = marshal.load(fp)
+        except Exception as e:
+            trace("_read_pyc(%s): marshal.load error %s" % (source, e))
+            return None
+        if not isinstance(co, types.CodeType):
+            trace("_read_pyc(%s): not a code object" % source)
+            return None
+        return co
+
+
+def rewrite_asserts(mod, module_path=None, config=None):
+    """Rewrite the assert statements in mod."""
+    AssertionRewriter(module_path, config).run(mod)
+
+
+def _saferepr(obj):
+    """Get a safe repr of an object for assertion error messages.
+
+    The assertion formatting (util.format_explanation()) requires
+    newlines to be escaped since they are a special character for it.
+    Normally assertion.util.format_explanation() does this but for a
+    custom repr it is possible to contain one of the special escape
+    sequences, especially '\n{' and '\n}' are likely to be present in
+    JSON reprs.
+
+    """
+    repr = py.io.saferepr(obj)
+    if isinstance(repr, six.text_type):
+        t = six.text_type
+    else:
+        t = six.binary_type
+    return repr.replace(t("\n"), t("\\n"))
+
+
+from _pytest.assertion.util import format_explanation as _format_explanation  # noqa
+
+
+def _format_assertmsg(obj):
+    """Format the custom assertion message given.
+
+    For strings this simply replaces newlines with '\n~' so that
+    util.format_explanation() will preserve them instead of escaping
+    newlines.  For other objects py.io.saferepr() is used first.
+
+    """
+    # reprlib appears to have a bug which means that if a string
+    # contains a newline it gets escaped, however if an object has a
+    # .__repr__() which contains newlines it does not get escaped.
+    # However in either case we want to preserve the newline.
+    if isinstance(obj, six.text_type) or isinstance(obj, six.binary_type):
+        s = obj
+        is_repr = False
+    else:
+        s = py.io.saferepr(obj)
+        is_repr = True
+    if isinstance(s, six.text_type):
+        t = six.text_type
+    else:
+        t = six.binary_type
+    s = s.replace(t("\n"), t("\n~")).replace(t("%"), t("%%"))
+    if is_repr:
+        s = s.replace(t("\\n"), t("\n~"))
+    return s
+
+
+def _should_repr_global_name(obj):
+    return not hasattr(obj, "__name__") and not callable(obj)
+
+
+def _format_boolop(explanations, is_or):
+    explanation = "(" + (is_or and " or " or " and ").join(explanations) + ")"
+    if isinstance(explanation, six.text_type):
+        t = six.text_type
+    else:
+        t = six.binary_type
+    return explanation.replace(t("%"), t("%%"))
+
+
+def _call_reprcompare(ops, results, expls, each_obj):
+    for i, res, expl in zip(range(len(ops)), results, expls):
+        try:
+            done = not res
+        except Exception:
+            done = True
+        if done:
+            break
+    if util._reprcompare is not None:
+        custom = util._reprcompare(ops[i], each_obj[i], each_obj[i + 1])
+        if custom is not None:
+            return custom
+    return expl
+
+
+unary_map = {ast.Not: "not %s", ast.Invert: "~%s", ast.USub: "-%s", ast.UAdd: "+%s"}
+
+binop_map = {
+    ast.BitOr: "|",
+    ast.BitXor: "^",
+    ast.BitAnd: "&",
+    ast.LShift: "<<",
+    ast.RShift: ">>",
+    ast.Add: "+",
+    ast.Sub: "-",
+    ast.Mult: "*",
+    ast.Div: "/",
+    ast.FloorDiv: "//",
+    ast.Mod: "%%",  # escaped for string formatting
+    ast.Eq: "==",
+    ast.NotEq: "!=",
+    ast.Lt: "<",
+    ast.LtE: "<=",
+    ast.Gt: ">",
+    ast.GtE: ">=",
+    ast.Pow: "**",
+    ast.Is: "is",
+    ast.IsNot: "is not",
+    ast.In: "in",
+    ast.NotIn: "not in",
+}
+# Python 3.5+ compatibility
+try:
+    binop_map[ast.MatMult] = "@"
+except AttributeError:
+    pass
+
+# Python 3.4+ compatibility
+if hasattr(ast, "NameConstant"):
+    _NameConstant = ast.NameConstant
+else:
+
+    def _NameConstant(c):
+        return ast.Name(str(c), ast.Load())
+
+
+def set_location(node, lineno, col_offset):
+    """Set node location information recursively."""
+
+    def _fix(node, lineno, col_offset):
+        if "lineno" in node._attributes:
+            node.lineno = lineno
+        if "col_offset" in node._attributes:
+            node.col_offset = col_offset
+        for child in ast.iter_child_nodes(node):
+            _fix(child, lineno, col_offset)
+
+    _fix(node, lineno, col_offset)
+    return node
+
+
+class AssertionRewriter(ast.NodeVisitor):
+    """Assertion rewriting implementation.
+
+    The main entrypoint is to call .run() with an ast.Module instance,
+    this will then find all the assert statements and rewrite them to
+    provide intermediate values and a detailed assertion error.  See
+    http://pybites.blogspot.be/2011/07/behind-scenes-of-pytests-new-assertion.html
+    for an overview of how this works.
+
+    The entry point here is .run() which will iterate over all the
+    statements in an ast.Module and for each ast.Assert statement it
+    finds call .visit() with it.  Then .visit_Assert() takes over and
+    is responsible for creating new ast statements to replace the
+    original assert statement: it rewrites the test of an assertion
+    to provide intermediate values and replace it with an if statement
+    which raises an assertion error with a detailed explanation in
+    case the expression is false.
+
+    For this .visit_Assert() uses the visitor pattern to visit all the
+    AST nodes of the ast.Assert.test field, each visit call returning
+    an AST node and the corresponding explanation string.  During this
+    state is kept in several instance attributes:
+
+    :statements: All the AST statements which will replace the assert
+       statement.
+
+    :variables: This is populated by .variable() with each variable
+       used by the statements so that they can all be set to None at
+       the end of the statements.
+
+    :variable_counter: Counter to create new unique variables needed
+       by statements.  Variables are created using .variable() and
+       have the form of "@py_assert0".
+
+    :on_failure: The AST statements which will be executed if the
+       assertion test fails.  This is the code which will construct
+       the failure message and raises the AssertionError.
+
+    :explanation_specifiers: A dict filled by .explanation_param()
+       with %-formatting placeholders and their corresponding
+       expressions to use in the building of an assertion message.
+       This is used by .pop_format_context() to build a message.
+
+    :stack: A stack of the explanation_specifiers dicts maintained by
+       .push_format_context() and .pop_format_context() which allows
+       to build another %-formatted string while already building one.
+
+    This state is reset on every new assert statement visited and used
+    by the other visitors.
+
+    """
+
+    def __init__(self, module_path, config):
+        super(AssertionRewriter, self).__init__()
+        self.module_path = module_path
+        self.config = config
+
+    def run(self, mod):
+        """Find all assert statements in *mod* and rewrite them."""
+        if not mod.body:
+            # Nothing to do.
+            return
+        # Insert some special imports at the top of the module but after any
+        # docstrings and __future__ imports.
+        aliases = [
+            ast.alias(py.builtin.builtins.__name__, "@py_builtins"),
+            ast.alias("_pytest.assertion.rewrite", "@pytest_ar"),
+        ]
+        doc = getattr(mod, "docstring", None)
+        expect_docstring = doc is None
+        if doc is not None and self.is_rewrite_disabled(doc):
+            return
+        pos = 0
+        lineno = 1
+        for item in mod.body:
+            if (
+                expect_docstring
+                and isinstance(item, ast.Expr)
+                and isinstance(item.value, ast.Str)
+            ):
+                doc = item.value.s
+                if self.is_rewrite_disabled(doc):
+                    return
+                expect_docstring = False
+            elif (
+                not isinstance(item, ast.ImportFrom)
+                or item.level > 0
+                or item.module != "__future__"
+            ):
+                lineno = item.lineno
+                break
+            pos += 1
+        else:
+            lineno = item.lineno
+        imports = [
+            ast.Import([alias], lineno=lineno, col_offset=0) for alias in aliases
+        ]
+        mod.body[pos:pos] = imports
+        # Collect asserts.
+        nodes = [mod]
+        while nodes:
+            node = nodes.pop()
+            for name, field in ast.iter_fields(node):
+                if isinstance(field, list):
+                    new = []
+                    for i, child in enumerate(field):
+                        if isinstance(child, ast.Assert):
+                            # Transform assert.
+                            new.extend(self.visit(child))
+                        else:
+                            new.append(child)
+                            if isinstance(child, ast.AST):
+                                nodes.append(child)
+                    setattr(node, name, new)
+                elif (
+                    isinstance(field, ast.AST)
+                    and
+                    # Don't recurse into expressions as they can't contain
+                    # asserts.
+                    not isinstance(field, ast.expr)
+                ):
+                    nodes.append(field)
+
+    @staticmethod
+    def is_rewrite_disabled(docstring):
+        return "PYTEST_DONT_REWRITE" in docstring
+
+    def variable(self):
+        """Get a new variable."""
+        # Use a character invalid in python identifiers to avoid clashing.
+        name = "@py_assert" + str(next(self.variable_counter))
+        self.variables.append(name)
+        return name
+
+    def assign(self, expr):
+        """Give *expr* a name."""
+        name = self.variable()
+        self.statements.append(ast.Assign([ast.Name(name, ast.Store())], expr))
+        return ast.Name(name, ast.Load())
+
+    def display(self, expr):
+        """Call py.io.saferepr on the expression."""
+        return self.helper("saferepr", expr)
+
+    def helper(self, name, *args):
+        """Call a helper in this module."""
+        py_name = ast.Name("@pytest_ar", ast.Load())
+        attr = ast.Attribute(py_name, "_" + name, ast.Load())
+        return ast_Call(attr, list(args), [])
+
+    def builtin(self, name):
+        """Return the builtin called *name*."""
+        builtin_name = ast.Name("@py_builtins", ast.Load())
+        return ast.Attribute(builtin_name, name, ast.Load())
+
+    def explanation_param(self, expr):
+        """Return a new named %-formatting placeholder for expr.
+
+        This creates a %-formatting placeholder for expr in the
+        current formatting context, e.g. ``%(py0)s``.  The placeholder
+        and expr are placed in the current format context so that it
+        can be used on the next call to .pop_format_context().
+
+        """
+        specifier = "py" + str(next(self.variable_counter))
+        self.explanation_specifiers[specifier] = expr
+        return "%(" + specifier + ")s"
+
+    def push_format_context(self):
+        """Create a new formatting context.
+
+        The format context is used for when an explanation wants to
+        have a variable value formatted in the assertion message.  In
+        this case the value required can be added using
+        .explanation_param().  Finally .pop_format_context() is used
+        to format a string of %-formatted values as added by
+        .explanation_param().
+
+        """
+        self.explanation_specifiers = {}
+        self.stack.append(self.explanation_specifiers)
+
+    def pop_format_context(self, expl_expr):
+        """Format the %-formatted string with current format context.
+
+        The expl_expr should be an ast.Str instance constructed from
+        the %-placeholders created by .explanation_param().  This will
+        add the required code to format said string to .on_failure and
+        return the ast.Name instance of the formatted string.
+
+        """
+        current = self.stack.pop()
+        if self.stack:
+            self.explanation_specifiers = self.stack[-1]
+        keys = [ast.Str(key) for key in current.keys()]
+        format_dict = ast.Dict(keys, list(current.values()))
+        form = ast.BinOp(expl_expr, ast.Mod(), format_dict)
+        name = "@py_format" + str(next(self.variable_counter))
+        self.on_failure.append(ast.Assign([ast.Name(name, ast.Store())], form))
+        return ast.Name(name, ast.Load())
+
+    def generic_visit(self, node):
+        """Handle expressions we don't have custom code for."""
+        assert isinstance(node, ast.expr)
+        res = self.assign(node)
+        return res, self.explanation_param(self.display(res))
+
+    def visit_Assert(self, assert_):
+        """Return the AST statements to replace the ast.Assert instance.
+
+        This rewrites the test of an assertion to provide
+        intermediate values and replace it with an if statement which
+        raises an assertion error with a detailed explanation in case
+        the expression is false.
+
+        """
+        if isinstance(assert_.test, ast.Tuple) and self.config is not None:
+            fslocation = (self.module_path, assert_.lineno)
+            self.config.warn(
+                "R1",
+                "assertion is always true, perhaps " "remove parentheses?",
+                fslocation=fslocation,
+            )
+        self.statements = []
+        self.variables = []
+        self.variable_counter = itertools.count()
+        self.stack = []
+        self.on_failure = []
+        self.push_format_context()
+        # Rewrite assert into a bunch of statements.
+        top_condition, explanation = self.visit(assert_.test)
+        # Create failure message.
+        body = self.on_failure
+        negation = ast.UnaryOp(ast.Not(), top_condition)
+        self.statements.append(ast.If(negation, body, []))
+        if assert_.msg:
+            assertmsg = self.helper("format_assertmsg", assert_.msg)
+            explanation = "\n>assert " + explanation
+        else:
+            assertmsg = ast.Str("")
+            explanation = "assert " + explanation
+        template = ast.BinOp(assertmsg, ast.Add(), ast.Str(explanation))
+        msg = self.pop_format_context(template)
+        fmt = self.helper("format_explanation", msg)
+        err_name = ast.Name("AssertionError", ast.Load())
+        exc = ast_Call(err_name, [fmt], [])
+        if sys.version_info[0] >= 3:
+            raise_ = ast.Raise(exc, None)
+        else:
+            raise_ = ast.Raise(exc, None, None)
+        body.append(raise_)
+        # Clear temporary variables by setting them to None.
+        if self.variables:
+            variables = [ast.Name(name, ast.Store()) for name in self.variables]
+            clear = ast.Assign(variables, _NameConstant(None))
+            self.statements.append(clear)
+        # Fix line numbers.
+        for stmt in self.statements:
+            set_location(stmt, assert_.lineno, assert_.col_offset)
+        return self.statements
+
+    def visit_Name(self, name):
+        # Display the repr of the name if it's a local variable or
+        # _should_repr_global_name() thinks it's acceptable.
+        locs = ast_Call(self.builtin("locals"), [], [])
+        inlocs = ast.Compare(ast.Str(name.id), [ast.In()], [locs])
+        dorepr = self.helper("should_repr_global_name", name)
+        test = ast.BoolOp(ast.Or(), [inlocs, dorepr])
+        expr = ast.IfExp(test, self.display(name), ast.Str(name.id))
+        return name, self.explanation_param(expr)
+
+    def visit_BoolOp(self, boolop):
+        res_var = self.variable()
+        expl_list = self.assign(ast.List([], ast.Load()))
+        app = ast.Attribute(expl_list, "append", ast.Load())
+        is_or = int(isinstance(boolop.op, ast.Or))
+        body = save = self.statements
+        fail_save = self.on_failure
+        levels = len(boolop.values) - 1
+        self.push_format_context()
+        # Process each operand, short-circuting if needed.
+        for i, v in enumerate(boolop.values):
+            if i:
+                fail_inner = []
+                # cond is set in a prior loop iteration below
+                self.on_failure.append(ast.If(cond, fail_inner, []))  # noqa
+                self.on_failure = fail_inner
+            self.push_format_context()
+            res, expl = self.visit(v)
+            body.append(ast.Assign([ast.Name(res_var, ast.Store())], res))
+            expl_format = self.pop_format_context(ast.Str(expl))
+            call = ast_Call(app, [expl_format], [])
+            self.on_failure.append(ast.Expr(call))
+            if i < levels:
+                cond = res
+                if is_or:
+                    cond = ast.UnaryOp(ast.Not(), cond)
+                inner = []
+                self.statements.append(ast.If(cond, inner, []))
+                self.statements = body = inner
+        self.statements = save
+        self.on_failure = fail_save
+        expl_template = self.helper("format_boolop", expl_list, ast.Num(is_or))
+        expl = self.pop_format_context(expl_template)
+        return ast.Name(res_var, ast.Load()), self.explanation_param(expl)
+
+    def visit_UnaryOp(self, unary):
+        pattern = unary_map[unary.op.__class__]
+        operand_res, operand_expl = self.visit(unary.operand)
+        res = self.assign(ast.UnaryOp(unary.op, operand_res))
+        return res, pattern % (operand_expl,)
+
+    def visit_BinOp(self, binop):
+        symbol = binop_map[binop.op.__class__]
+        left_expr, left_expl = self.visit(binop.left)
+        right_expr, right_expl = self.visit(binop.right)
+        explanation = "(%s %s %s)" % (left_expl, symbol, right_expl)
+        res = self.assign(ast.BinOp(left_expr, binop.op, right_expr))
+        return res, explanation
+
+    def visit_Call_35(self, call):
+        """
+        visit `ast.Call` nodes on Python3.5 and after
+        """
+        new_func, func_expl = self.visit(call.func)
+        arg_expls = []
+        new_args = []
+        new_kwargs = []
+        for arg in call.args:
+            res, expl = self.visit(arg)
+            arg_expls.append(expl)
+            new_args.append(res)
+        for keyword in call.keywords:
+            res, expl = self.visit(keyword.value)
+            new_kwargs.append(ast.keyword(keyword.arg, res))
+            if keyword.arg:
+                arg_expls.append(keyword.arg + "=" + expl)
+            else:  # **args have `arg` keywords with an .arg of None
+                arg_expls.append("**" + expl)
+
+        expl = "%s(%s)" % (func_expl, ", ".join(arg_expls))
+        new_call = ast.Call(new_func, new_args, new_kwargs)
+        res = self.assign(new_call)
+        res_expl = self.explanation_param(self.display(res))
+        outer_expl = "%s\n{%s = %s\n}" % (res_expl, res_expl, expl)
+        return res, outer_expl
+
+    def visit_Starred(self, starred):
+        # From Python 3.5, a Starred node can appear in a function call
+        res, expl = self.visit(starred.value)
+        return starred, "*" + expl
+
+    def visit_Call_legacy(self, call):
+        """
+        visit `ast.Call nodes on 3.4 and below`
+        """
+        new_func, func_expl = self.visit(call.func)
+        arg_expls = []
+        new_args = []
+        new_kwargs = []
+        new_star = new_kwarg = None
+        for arg in call.args:
+            res, expl = self.visit(arg)
+            new_args.append(res)
+            arg_expls.append(expl)
+        for keyword in call.keywords:
+            res, expl = self.visit(keyword.value)
+            new_kwargs.append(ast.keyword(keyword.arg, res))
+            arg_expls.append(keyword.arg + "=" + expl)
+        if call.starargs:
+            new_star, expl = self.visit(call.starargs)
+            arg_expls.append("*" + expl)
+        if call.kwargs:
+            new_kwarg, expl = self.visit(call.kwargs)
+            arg_expls.append("**" + expl)
+        expl = "%s(%s)" % (func_expl, ", ".join(arg_expls))
+        new_call = ast.Call(new_func, new_args, new_kwargs, new_star, new_kwarg)
+        res = self.assign(new_call)
+        res_expl = self.explanation_param(self.display(res))
+        outer_expl = "%s\n{%s = %s\n}" % (res_expl, res_expl, expl)
+        return res, outer_expl
+
+    # ast.Call signature changed on 3.5,
+    # conditionally change  which methods is named
+    # visit_Call depending on Python version
+    if sys.version_info >= (3, 5):
+        visit_Call = visit_Call_35
+    else:
+        visit_Call = visit_Call_legacy
+
+    def visit_Attribute(self, attr):
+        if not isinstance(attr.ctx, ast.Load):
+            return self.generic_visit(attr)
+        value, value_expl = self.visit(attr.value)
+        res = self.assign(ast.Attribute(value, attr.attr, ast.Load()))
+        res_expl = self.explanation_param(self.display(res))
+        pat = "%s\n{%s = %s.%s\n}"
+        expl = pat % (res_expl, res_expl, value_expl, attr.attr)
+        return res, expl
+
+    def visit_Compare(self, comp):
+        self.push_format_context()
+        left_res, left_expl = self.visit(comp.left)
+        if isinstance(comp.left, (ast.Compare, ast.BoolOp)):
+            left_expl = "({})".format(left_expl)
+        res_variables = [self.variable() for i in range(len(comp.ops))]
+        load_names = [ast.Name(v, ast.Load()) for v in res_variables]
+        store_names = [ast.Name(v, ast.Store()) for v in res_variables]
+        it = zip(range(len(comp.ops)), comp.ops, comp.comparators)
+        expls = []
+        syms = []
+        results = [left_res]
+        for i, op, next_operand in it:
+            next_res, next_expl = self.visit(next_operand)
+            if isinstance(next_operand, (ast.Compare, ast.BoolOp)):
+                next_expl = "({})".format(next_expl)
+            results.append(next_res)
+            sym = binop_map[op.__class__]
+            syms.append(ast.Str(sym))
+            expl = "%s %s %s" % (left_expl, sym, next_expl)
+            expls.append(ast.Str(expl))
+            res_expr = ast.Compare(left_res, [op], [next_res])
+            self.statements.append(ast.Assign([store_names[i]], res_expr))
+            left_res, left_expl = next_res, next_expl
+        # Use pytest.assertion.util._reprcompare if that's available.
+        expl_call = self.helper(
+            "call_reprcompare",
+            ast.Tuple(syms, ast.Load()),
+            ast.Tuple(load_names, ast.Load()),
+            ast.Tuple(expls, ast.Load()),
+            ast.Tuple(results, ast.Load()),
+        )
+        if len(comp.ops) > 1:
+            res = ast.BoolOp(ast.And(), load_names)
+        else:
+            res = load_names[0]
+        return res, self.explanation_param(self.pop_format_context(expl_call))
new file mode 100644
--- /dev/null
+++ b/third_party/python/pytest/src/_pytest/assertion/truncate.py
@@ -0,0 +1,99 @@
+"""
+Utilities for truncating assertion output.
+
+Current default behaviour is to truncate assertion explanations at
+~8 terminal lines, unless running in "-vv" mode or running on CI.
+"""
+from __future__ import absolute_import, division, print_function
+import os
+
+import six
+
+
+DEFAULT_MAX_LINES = 8
+DEFAULT_MAX_CHARS = 8 * 80
+USAGE_MSG = "use '-vv' to show"
+
+
+def truncate_if_required(explanation, item, max_length=None):
+    """
+    Truncate this assertion explanation if the given test item is eligible.
+    """
+    if _should_truncate_item(item):
+        return _truncate_explanation(explanation)
+    return explanation
+
+
+def _should_truncate_item(item):
+    """
+    Whether or not this test item is eligible for truncation.
+    """
+    verbose = item.config.option.verbose
+    return verbose < 2 and not _running_on_ci()
+
+
+def _running_on_ci():
+    """Check if we're currently running on a CI system."""
+    env_vars = ["CI", "BUILD_NUMBER"]
+    return any(var in os.environ for var in env_vars)
+
+
+def _truncate_explanation(input_lines, max_lines=None, max_chars=None):
+    """
+    Truncate given list of strings that makes up the assertion explanation.
+
+    Truncates to either 8 lines, or 640 characters - whichever the input reaches
+    first. The remaining lines will be replaced by a usage message.
+    """
+
+    if max_lines is None:
+        max_lines = DEFAULT_MAX_LINES
+    if max_chars is None:
+        max_chars = DEFAULT_MAX_CHARS
+
+    # Check if truncation required
+    input_char_count = len("".join(input_lines))
+    if len(input_lines) <= max_lines and input_char_count <= max_chars:
+        return input_lines
+
+    # Truncate first to max_lines, and then truncate to max_chars if max_chars
+    # is exceeded.
+    truncated_explanation = input_lines[:max_lines]
+    truncated_explanation = _truncate_by_char_count(truncated_explanation, max_chars)
+
+    # Add ellipsis to final line
+    truncated_explanation[-1] = truncated_explanation[-1] + "..."
+
+    # Append useful message to explanation
+    truncated_line_count = len(input_lines) - len(truncated_explanation)
+    truncated_line_count += 1  # Account for the part-truncated final line
+    msg = "...Full output truncated"
+    if truncated_line_count == 1:
+        msg += " ({} line hidden)".format(truncated_line_count)
+    else:
+        msg += " ({} lines hidden)".format(truncated_line_count)
+    msg += ", {}".format(USAGE_MSG)
+    truncated_explanation.extend([six.text_type(""), six.text_type(msg)])
+    return truncated_explanation
+
+
+def _truncate_by_char_count(input_lines, max_chars):
+    # Check if truncation required
+    if len("".join(input_lines)) <= max_chars:
+        return input_lines
+
+    # Find point at which input length exceeds total allowed length
+    iterated_char_count = 0
+    for iterated_index, input_line in enumerate(input_lines):
+        if iterated_char_count + len(input_line) > max_chars:
+            break
+        iterated_char_count += len(input_line)
+
+    # Create truncated explanation with modified final line
+    truncated_result = input_lines[:iterated_index]
+    final_line = input_lines[iterated_index]
+    if final_line:
+        final_line_truncate_point = max_chars - iterated_char_count
+        final_line = final_line[:final_line_truncate_point]
+    truncated_result.append(final_line)
+    return truncated_result
new file mode 100644
--- /dev/null
+++ b/third_party/python/pytest/src/_pytest/assertion/util.py
@@ -0,0 +1,338 @@
+"""Utilities for assertion debugging"""
+from __future__ import absolute_import, division, print_function
+import pprint
+
+import _pytest._code
+import py
+import six
+from ..compat import Sequence
+
+u = six.text_type
+
+# The _reprcompare attribute on the util module is used by the new assertion
+# interpretation code and assertion rewriter to detect this plugin was
+# loaded and in turn call the hooks defined here as part of the
+# DebugInterpreter.
+_reprcompare = None
+
+
+# the re-encoding is needed for python2 repr
+# with non-ascii characters (see issue 877 and 1379)
+def ecu(s):
+    try:
+        return u(s, "utf-8", "replace")
+    except TypeError:
+        return s
+
+
+def format_explanation(explanation):
+    """This formats an explanation
+
+    Normally all embedded newlines are escaped, however there are
+    three exceptions: \n{, \n} and \n~.  The first two are intended
+    cover nested explanations, see function and attribute explanations
+    for examples (.visit_Call(), visit_Attribute()).  The last one is
+    for when one explanation needs to span multiple lines, e.g. when
+    displaying diffs.
+    """
+    explanation = ecu(explanation)
+    lines = _split_explanation(explanation)
+    result = _format_lines(lines)
+    return u("\n").join(result)
+
+
+def _split_explanation(explanation):
+    """Return a list of individual lines in the explanation
+
+    This will return a list of lines split on '\n{', '\n}' and '\n~'.
+    Any other newlines will be escaped and appear in the line as the
+    literal '\n' characters.
+    """
+    raw_lines = (explanation or u("")).split("\n")
+    lines = [raw_lines[0]]
+    for values in raw_lines[1:]:
+        if values and values[0] in ["{", "}", "~", ">"]:
+            lines.append(values)
+        else:
+            lines[-1] += "\\n" + values
+    return lines
+
+
+def _format_lines(lines):
+    """Format the individual lines
+
+    This will replace the '{', '}' and '~' characters of our mini
+    formatting language with the proper 'where ...', 'and ...' and ' +
+    ...' text, taking care of indentation along the way.
+
+    Return a list of formatted lines.
+    """
+    result = lines[:1]
+    stack = [0]
+    stackcnt = [0]
+    for line in lines[1:]:
+        if line.startswith("{"):
+            if stackcnt[-1]:
+                s = u("and   ")
+            else:
+                s = u("where ")
+            stack.append(len(result))
+            stackcnt[-1] += 1
+            stackcnt.append(0)
+            result.append(u(" +") + u("  ") * (len(stack) - 1) + s + line[1:])
+        elif line.startswith("}"):
+            stack.pop()
+            stackcnt.pop()
+            result[stack[-1]] += line[1:]
+        else:
+            assert line[0] in ["~", ">"]
+            stack[-1] += 1
+            indent = len(stack) if line.startswith("~") else len(stack) - 1
+            result.append(u("  ") * indent + line[1:])
+    assert len(stack) == 1
+    return result
+
+
+# Provide basestring in python3
+try:
+    basestring = basestring
+except NameError:
+    basestring = str
+
+
+def assertrepr_compare(config, op, left, right):
+    """Return specialised explanations for some operators/operands"""
+    width = 80 - 15 - len(op) - 2  # 15 chars indentation, 1 space around op
+    left_repr = py.io.saferepr(left, maxsize=int(width // 2))
+    right_repr = py.io.saferepr(right, maxsize=width - len(left_repr))
+
+    summary = u("%s %s %s") % (ecu(left_repr), op, ecu(right_repr))
+
+    def issequence(x):
+        return isinstance(x, Sequence) and not isinstance(x, basestring)
+
+    def istext(x):
+        return isinstance(x, basestring)
+
+    def isdict(x):
+        return isinstance(x, dict)
+
+    def isset(x):
+        return isinstance(x, (set, frozenset))
+
+    def isiterable(obj):
+        try:
+            iter(obj)
+            return not istext(obj)
+        except TypeError:
+            return False
+
+    verbose = config.getoption("verbose")
+    explanation = None
+    try:
+        if op == "==":
+            if istext(left) and istext(right):
+                explanation = _diff_text(left, right, verbose)
+            else:
+                if issequence(left) and issequence(right):
+                    explanation = _compare_eq_sequence(left, right, verbose)
+                elif isset(left) and isset(right):
+                    explanation = _compare_eq_set(left, right, verbose)
+                elif isdict(left) and isdict(right):
+                    explanation = _compare_eq_dict(left, right, verbose)
+                if isiterable(left) and isiterable(right):
+                    expl = _compare_eq_iterable(left, right, verbose)
+                    if explanation is not None:
+                        explanation.extend(expl)
+                    else:
+                        explanation = expl
+        elif op == "not in":
+            if istext(left) and istext(right):
+                explanation = _notin_text(left, right, verbose)
+    except Exception:
+        explanation = [
+            u(
+                "(pytest_assertion plugin: representation of details failed.  "
+                "Probably an object has a faulty __repr__.)"
+            ),
+            u(_pytest._code.ExceptionInfo()),
+        ]
+
+    if not explanation:
+        return None
+
+    return [summary] + explanation
+
+
+def _diff_text(left, right, verbose=False):
+    """Return the explanation for the diff between text or bytes
+
+    Unless --verbose is used this will skip leading and trailing
+    characters which are identical to keep the diff minimal.
+
+    If the input are bytes they will be safely converted to text.
+    """
+    from difflib import ndiff
+
+    explanation = []
+
+    def escape_for_readable_diff(binary_text):
+        """
+        Ensures that the internal string is always valid unicode, converting any bytes safely to valid unicode.
+        This is done using repr() which then needs post-processing to fix the encompassing quotes and un-escape
+        newlines and carriage returns (#429).
+        """
+        r = six.text_type(repr(binary_text)[1:-1])
+        r = r.replace(r"\n", "\n")
+        r = r.replace(r"\r", "\r")
+        return r
+
+    if isinstance(left, six.binary_type):
+        left = escape_for_readable_diff(left)
+    if isinstance(right, six.binary_type):
+        right = escape_for_readable_diff(right)
+    if not verbose:
+        i = 0  # just in case left or right has zero length
+        for i in range(min(len(left), len(right))):
+            if left[i] != right[i]:
+                break
+        if i > 42:
+            i -= 10  # Provide some context
+            explanation = [
+                u("Skipping %s identical leading " "characters in diff, use -v to show")
+                % i
+            ]
+            left = left[i:]
+            right = right[i:]
+        if len(left) == len(right):
+            for i in range(len(left)):
+                if left[-i] != right[-i]:
+                    break
+            if i > 42:
+                i -= 10  # Provide some context
+                explanation += [
+                    u(
+                        "Skipping %s identical trailing "
+                        "characters in diff, use -v to show"
+                    )
+                    % i
+                ]
+                left = left[:-i]
+                right = right[:-i]
+    keepends = True
+    if left.isspace() or right.isspace():
+        left = repr(str(left))
+        right = repr(str(right))
+        explanation += [u"Strings contain only whitespace, escaping them using repr()"]
+    explanation += [
+        line.strip("\n")
+        for line in ndiff(left.splitlines(keepends), right.splitlines(keepends))
+    ]
+    return explanation
+
+
+def _compare_eq_iterable(left, right, verbose=False):
+    if not verbose:
+        return [u("Use -v to get the full diff")]
+    # dynamic import to speedup pytest
+    import difflib
+
+    try:
+        left_formatting = pprint.pformat(left).splitlines()
+        right_formatting = pprint.pformat(right).splitlines()
+        explanation = [u("Full diff:")]
+    except Exception:
+        # hack: PrettyPrinter.pformat() in python 2 fails when formatting items that can't be sorted(), ie, calling
+        # sorted() on a list would raise. See issue #718.
+        # As a workaround, the full diff is generated by using the repr() string of each item of each container.
+        left_formatting = sorted(repr(x) for x in left)
+        right_formatting = sorted(repr(x) for x in right)
+        explanation = [u("Full diff (fallback to calling repr on each item):")]
+    explanation.extend(
+        line.strip() for line in difflib.ndiff(left_formatting, right_formatting)
+    )
+    return explanation
+
+
+def _compare_eq_sequence(left, right, verbose=False):
+    explanation = []
+    for i in range(min(len(left), len(right))):
+        if left[i] != right[i]:
+            explanation += [u("At index %s diff: %r != %r") % (i, left[i], right[i])]
+            break
+    if len(left) > len(right):
+        explanation += [
+            u("Left contains more items, first extra item: %s")
+            % py.io.saferepr(left[len(right)])
+        ]
+    elif len(left) < len(right):
+        explanation += [
+            u("Right contains more items, first extra item: %s")
+            % py.io.saferepr(right[len(left)])
+        ]
+    return explanation
+
+
+def _compare_eq_set(left, right, verbose=False):
+    explanation = []
+    diff_left = left - right
+    diff_right = right - left
+    if diff_left:
+        explanation.append(u("Extra items in the left set:"))
+        for item in diff_left:
+            explanation.append(py.io.saferepr(item))
+    if diff_right:
+        explanation.append(u("Extra items in the right set:"))
+        for item in diff_right:
+            explanation.append(py.io.saferepr(item))
+    return explanation
+
+
+def _compare_eq_dict(left, right, verbose=False):
+    explanation = []
+    common = set(left).intersection(set(right))
+    same = {k: left[k] for k in common if left[k] == right[k]}
+    if same and verbose < 2:
+        explanation += [u("Omitting %s identical items, use -vv to show") % len(same)]
+    elif same:
+        explanation += [u("Common items:")]
+        explanation += pprint.pformat(same).splitlines()
+    diff = {k for k in common if left[k] != right[k]}
+    if diff:
+        explanation += [u("Differing items:")]
+        for k in diff:
+            explanation += [
+                py.io.saferepr({k: left[k]}) + " != " + py.io.saferepr({k: right[k]})
+            ]
+    extra_left = set(left) - set(right)
+    if extra_left:
+        explanation.append(u("Left contains more items:"))
+        explanation.extend(
+            pprint.pformat({k: left[k] for k in extra_left}).splitlines()
+        )
+    extra_right = set(right) - set(left)
+    if extra_right:
+        explanation.append(u("Right contains more items:"))
+        explanation.extend(
+            pprint.pformat({k: right[k] for k in extra_right}).splitlines()
+        )
+    return explanation
+
+
+def _notin_text(term, text, verbose=False):
+    index = text.find(term)
+    head = text[:index]
+    tail = text[index + len(term):]
+    correct_text = head + tail
+    diff = _diff_text(correct_text, text, verbose)
+    newdiff = [u("%s is contained here:") % py.io.saferepr(term, maxsize=42)]
+    for line in diff:
+        if line.startswith(u("Skipping")):
+            continue
+        if line.startswith(u("- ")):
+            continue
+        if line.startswith(u("+ ")):
+            newdiff.append(u("  ") + line[2:])
+        else:
+            newdiff.append(line)
+    return newdiff
new file mode 100755
--- /dev/null
+++ b/third_party/python/pytest/src/_pytest/cacheprovider.py
@@ -0,0 +1,339 @@
+"""
+merged implementation of the cache provider
+
+the name cache was not chosen to ensure pluggy automatically
+ignores the external pytest-cache
+"""
+from __future__ import absolute_import, division, print_function
+
+from collections import OrderedDict
+
+import py
+import six
+
+import pytest
+import json
+import os
+from os.path import sep as _sep, altsep as _altsep
+
+
+class Cache(object):
+
+    def __init__(self, config):
+        self.config = config
+        self._cachedir = Cache.cache_dir_from_config(config)
+        self.trace = config.trace.root.get("cache")
+        if config.getoption("cacheclear"):
+            self.trace("clearing cachedir")
+            if self._cachedir.check():
+                self._cachedir.remove()
+            self._cachedir.mkdir()
+
+    @staticmethod
+    def cache_dir_from_config(config):
+        cache_dir = config.getini("cache_dir")
+        cache_dir = os.path.expanduser(cache_dir)
+        cache_dir = os.path.expandvars(cache_dir)
+        if os.path.isabs(cache_dir):
+            return py.path.local(cache_dir)
+        else:
+            return config.rootdir.join(cache_dir)
+
+    def makedir(self, name):
+        """ return a directory path object with the given name.  If the
+        directory does not yet exist, it will be created.  You can use it
+        to manage files likes e. g. store/retrieve database
+        dumps across test sessions.
+
+        :param name: must be a string not containing a ``/`` separator.
+             Make sure the name contains your plugin or application
+             identifiers to prevent clashes with other cache users.
+        """
+        if _sep in name or _altsep is not None and _altsep in name:
+            raise ValueError("name is not allowed to contain path separators")
+        return self._cachedir.ensure_dir("d", name)
+
+    def _getvaluepath(self, key):
+        return self._cachedir.join("v", *key.split("/"))
+
+    def get(self, key, default):
+        """ return cached value for the given key.  If no value
+        was yet cached or the value cannot be read, the specified
+        default is returned.
+
+        :param key: must be a ``/`` separated value. Usually the first
+             name is the name of your plugin or your application.
+        :param default: must be provided in case of a cache-miss or
+             invalid cache values.
+
+        """
+        path = self._getvaluepath(key)
+        if path.check():
+            try:
+                with path.open("r") as f:
+                    return json.load(f)
+            except ValueError:
+                self.trace("cache-invalid at %s" % (path,))
+        return default
+
+    def set(self, key, value):
+        """ save value for the given key.
+
+        :param key: must be a ``/`` separated value. Usually the first
+             name is the name of your plugin or your application.
+        :param value: must be of any combination of basic
+               python types, including nested types
+               like e. g. lists of dictionaries.
+        """
+        path = self._getvaluepath(key)
+        try:
+            path.dirpath().ensure_dir()
+        except (py.error.EEXIST, py.error.EACCES):
+            self.config.warn(
+                code="I9", message="could not create cache path %s" % (path,)
+            )
+            return
+        try:
+            f = path.open("w")
+        except py.error.ENOTDIR:
+            self.config.warn(
+                code="I9", message="cache could not write path %s" % (path,)
+            )
+        else:
+            with f:
+                self.trace("cache-write %s: %r" % (key, value))
+                json.dump(value, f, indent=2, sort_keys=True)
+
+
+class LFPlugin(object):
+    """ Plugin which implements the --lf (run last-failing) option """
+
+    def __init__(self, config):
+        self.config = config
+        active_keys = "lf", "failedfirst"
+        self.active = any(config.getoption(key) for key in active_keys)
+        self.lastfailed = config.cache.get("cache/lastfailed", {})
+        self._previously_failed_count = None
+        self._no_failures_behavior = self.config.getoption("last_failed_no_failures")
+
+    def pytest_report_collectionfinish(self):
+        if self.active:
+            if not self._previously_failed_count:
+                mode = "run {} (no recorded failures)".format(
+                    self._no_failures_behavior
+                )
+            else:
+                noun = "failure" if self._previously_failed_count == 1 else "failures"
+                suffix = " first" if self.config.getoption("failedfirst") else ""
+                mode = "rerun previous {count} {noun}{suffix}".format(
+                    count=self._previously_failed_count, suffix=suffix, noun=noun
+                )
+            return "run-last-failure: %s" % mode
+
+    def pytest_runtest_logreport(self, report):
+        if (report.when == "call" and report.passed) or report.skipped:
+            self.lastfailed.pop(report.nodeid, None)
+        elif report.failed:
+            self.lastfailed[report.nodeid] = True
+
+    def pytest_collectreport(self, report):
+        passed = report.outcome in ("passed", "skipped")
+        if passed:
+            if report.nodeid in self.lastfailed:
+                self.lastfailed.pop(report.nodeid)
+                self.lastfailed.update((item.nodeid, True) for item in report.result)
+        else:
+            self.lastfailed[report.nodeid] = True
+
+    def pytest_collection_modifyitems(self, session, config, items):
+        if self.active:
+            if self.lastfailed:
+                previously_failed = []
+                previously_passed = []
+                for item in items:
+                    if item.nodeid in self.lastfailed:
+                        previously_failed.append(item)
+                    else:
+                        previously_passed.append(item)
+                self._previously_failed_count = len(previously_failed)
+                if not previously_failed:
+                    # running a subset of all tests with recorded failures outside
+                    # of the set of tests currently executing
+                    return
+                if self.config.getoption("lf"):
+                    items[:] = previously_failed
+                    config.hook.pytest_deselected(items=previously_passed)
+                else:
+                    items[:] = previously_failed + previously_passed
+            elif self._no_failures_behavior == "none":
+                config.hook.pytest_deselected(items=items)
+                items[:] = []
+
+    def pytest_sessionfinish(self, session):
+        config = self.config
+        if config.getoption("cacheshow") or hasattr(config, "slaveinput"):
+            return
+
+        saved_lastfailed = config.cache.get("cache/lastfailed", {})
+        if saved_lastfailed != self.lastfailed:
+            config.cache.set("cache/lastfailed", self.lastfailed)
+
+
+class NFPlugin(object):
+    """ Plugin which implements the --nf (run new-first) option """
+
+    def __init__(self, config):
+        self.config = config
+        self.active = config.option.newfirst
+        self.cached_nodeids = config.cache.get("cache/nodeids", [])
+
+    def pytest_collection_modifyitems(self, session, config, items):
+        if self.active:
+            new_items = OrderedDict()
+            other_items = OrderedDict()
+            for item in items:
+                if item.nodeid not in self.cached_nodeids:
+                    new_items[item.nodeid] = item
+                else:
+                    other_items[item.nodeid] = item
+
+            items[:] = self._get_increasing_order(
+                six.itervalues(new_items)
+            ) + self._get_increasing_order(
+                six.itervalues(other_items)
+            )
+        self.cached_nodeids = [x.nodeid for x in items if isinstance(x, pytest.Item)]
+
+    def _get_increasing_order(self, items):
+        return sorted(items, key=lambda item: item.fspath.mtime(), reverse=True)
+
+    def pytest_sessionfinish(self, session):
+        config = self.config
+        if config.getoption("cacheshow") or hasattr(config, "slaveinput"):
+            return
+
+        config.cache.set("cache/nodeids", self.cached_nodeids)
+
+
+def pytest_addoption(parser):
+    group = parser.getgroup("general")
+    group.addoption(
+        "--lf",
+        "--last-failed",
+        action="store_true",
+        dest="lf",
+        help="rerun only the tests that failed "
+        "at the last run (or all if none failed)",
+    )
+    group.addoption(
+        "--ff",
+        "--failed-first",
+        action="store_true",
+        dest="failedfirst",
+        help="run all tests but run the last failures first.  "
+        "This may re-order tests and thus lead to "
+        "repeated fixture setup/teardown",
+    )
+    group.addoption(
+        "--nf",
+        "--new-first",
+        action="store_true",
+        dest="newfirst",
+        help="run tests from new files first, then the rest of the tests "
+        "sorted by file mtime",
+    )
+    group.addoption(
+        "--cache-show",
+        action="store_true",
+        dest="cacheshow",
+        help="show cache contents, don't perform collection or tests",
+    )
+    group.addoption(
+        "--cache-clear",
+        action="store_true",
+        dest="cacheclear",
+        help="remove all cache contents at start of test run.",
+    )
+    parser.addini("cache_dir", default=".pytest_cache", help="cache directory path.")
+    group.addoption(
+        "--lfnf",
+        "--last-failed-no-failures",
+        action="store",
+        dest="last_failed_no_failures",
+        choices=("all", "none"),
+        default="all",
+        help="change the behavior when no test failed in the last run or no "
+        "information about the last failures was found in the cache",
+    )
+
+
+def pytest_cmdline_main(config):
+    if config.option.cacheshow:
+        from _pytest.main import wrap_session
+
+        return wrap_session(config, cacheshow)
+
+
+@pytest.hookimpl(tryfirst=True)
+def pytest_configure(config):
+    config.cache = Cache(config)
+    config.pluginmanager.register(LFPlugin(config), "lfplugin")
+    config.pluginmanager.register(NFPlugin(config), "nfplugin")
+
+
+@pytest.fixture
+def cache(request):
+    """
+    Return a cache object that can persist state between testing sessions.
+
+    cache.get(key, default)
+    cache.set(key, value)
+
+    Keys must be a ``/`` separated value, where the first part is usually the
+    name of your plugin or application to avoid clashes with other cache users.
+
+    Values can be any object handled by the json stdlib module.
+    """
+    return request.config.cache
+
+
+def pytest_report_header(config):
+    if config.option.verbose:
+        relpath = py.path.local().bestrelpath(config.cache._cachedir)
+        return "cachedir: %s" % relpath
+
+
+def cacheshow(config, session):
+    from pprint import pprint
+
+    tw = py.io.TerminalWriter()
+    tw.line("cachedir: " + str(config.cache._cachedir))
+    if not config.cache._cachedir.check():
+        tw.line("cache is empty")
+        return 0
+    dummy = object()
+    basedir = config.cache._cachedir
+    vdir = basedir.join("v")
+    tw.sep("-", "cache values")
+    for valpath in sorted(vdir.visit(lambda x: x.isfile())):
+        key = valpath.relto(vdir).replace(valpath.sep, "/")
+        val = config.cache.get(key, dummy)
+        if val is dummy:
+            tw.line("%s contains unreadable content, " "will be ignored" % key)
+        else:
+            tw.line("%s contains:" % key)
+            stream = py.io.TextIO()
+            pprint(val, stream=stream)
+            for line in stream.getvalue().splitlines():
+                tw.line("  " + line)
+
+    ddir = basedir.join("d")
+    if ddir.isdir() and ddir.listdir():
+        tw.sep("-", "cache directories")
+        for p in sorted(basedir.join("d").visit()):
+            # if p.check(dir=1):
+            #    print("%s/" % p.relto(basedir))
+            if p.isfile():
+                key = p.relto(basedir)
+                tw.line("%s is a file of length %d" % (key, p.size()))
+    return 0
new file mode 100644
--- /dev/null
+++ b/third_party/python/pytest/src/_pytest/capture.py
@@ -0,0 +1,724 @@
+"""
+per-test stdout/stderr capturing mechanism.
+
+"""
+from __future__ import absolute_import, division, print_function
+
+import collections
+import contextlib
+import sys
+import os
+import io
+from io import UnsupportedOperation
+from tempfile import TemporaryFile
+
+import six
+import pytest
+from _pytest.compat import CaptureIO
+
+
+patchsysdict = {0: "stdin", 1: "stdout", 2: "stderr"}
+
+
+def pytest_addoption(parser):
+    group = parser.getgroup("general")
+    group._addoption(
+        "--capture",
+        action="store",
+        default="fd" if hasattr(os, "dup") else "sys",
+        metavar="method",
+        choices=["fd", "sys", "no"],
+        help="per-test capturing method: one of fd|sys|no.",
+    )
+    group._addoption(
+        "-s",
+        action="store_const",
+        const="no",
+        dest="capture",
+        help="shortcut for --capture=no.",
+    )
+
+
+@pytest.hookimpl(hookwrapper=True)
+def pytest_load_initial_conftests(early_config, parser, args):
+    ns = early_config.known_args_namespace
+    if ns.capture == "fd":
+        _py36_windowsconsoleio_workaround(sys.stdout)
+    _colorama_workaround()
+    _readline_workaround()
+    pluginmanager = early_config.pluginmanager
+    capman = CaptureManager(ns.capture)
+    pluginmanager.register(capman, "capturemanager")
+
+    # make sure that capturemanager is properly reset at final shutdown
+    early_config.add_cleanup(capman.stop_global_capturing)
+
+    # make sure logging does not raise exceptions at the end
+    def silence_logging_at_shutdown():
+        if "logging" in sys.modules:
+            sys.modules["logging"].raiseExceptions = False
+
+    early_config.add_cleanup(silence_logging_at_shutdown)
+
+    # finally trigger conftest loading but while capturing (issue93)
+    capman.start_global_capturing()
+    outcome = yield
+    out, err = capman.suspend_global_capture()
+    if outcome.excinfo is not None:
+        sys.stdout.write(out)
+        sys.stderr.write(err)
+
+
+class CaptureManager(object):
+    """
+    Capture plugin, manages that the appropriate capture method is enabled/disabled during collection and each
+    test phase (setup, call, teardown). After each of those points, the captured output is obtained and
+    attached to the collection/runtest report.
+
+    There are two levels of capture:
+    * global: which is enabled by default and can be suppressed by the ``-s`` option. This is always enabled/disabled
+      during collection and each test phase.
+    * fixture: when a test function or one of its fixture depend on the ``capsys`` or ``capfd`` fixtures. In this
+      case special handling is needed to ensure the fixtures take precedence over the global capture.
+    """
+
+    def __init__(self, method):
+        self._method = method
+        self._global_capturing = None
+
+    def _getcapture(self, method):
+        if method == "fd":
+            return MultiCapture(out=True, err=True, Capture=FDCapture)
+        elif method == "sys":
+            return MultiCapture(out=True, err=True, Capture=SysCapture)
+        elif method == "no":
+            return MultiCapture(out=False, err=False, in_=False)
+        else:
+            raise ValueError("unknown capturing method: %r" % method)
+
+    def start_global_capturing(self):
+        assert self._global_capturing is None
+        self._global_capturing = self._getcapture(self._method)
+        self._global_capturing.start_capturing()
+
+    def stop_global_capturing(self):
+        if self._global_capturing is not None:
+            self._global_capturing.pop_outerr_to_orig()
+            self._global_capturing.stop_capturing()
+            self._global_capturing = None
+
+    def resume_global_capture(self):
+        self._global_capturing.resume_capturing()
+
+    def suspend_global_capture(self, item=None, in_=False):
+        if item is not None:
+            self.deactivate_fixture(item)
+        cap = getattr(self, "_global_capturing", None)
+        if cap is not None:
+            try:
+                outerr = cap.readouterr()
+            finally:
+                cap.suspend_capturing(in_=in_)
+            return outerr
+
+    def activate_fixture(self, item):
+        """If the current item is using ``capsys`` or ``capfd``, activate them so they take precedence over
+        the global capture.
+        """
+        fixture = getattr(item, "_capture_fixture", None)
+        if fixture is not None:
+            fixture._start()
+
+    def deactivate_fixture(self, item):
+        """Deactivates the ``capsys`` or ``capfd`` fixture of this item, if any."""
+        fixture = getattr(item, "_capture_fixture", None)
+        if fixture is not None:
+            fixture.close()
+
+    @pytest.hookimpl(hookwrapper=True)
+    def pytest_make_collect_report(self, collector):
+        if isinstance(collector, pytest.File):
+            self.resume_global_capture()
+            outcome = yield
+            out, err = self.suspend_global_capture()
+            rep = outcome.get_result()
+            if out:
+                rep.sections.append(("Captured stdout", out))
+            if err:
+                rep.sections.append(("Captured stderr", err))
+        else:
+            yield
+
+    @pytest.hookimpl(hookwrapper=True)
+    def pytest_runtest_setup(self, item):
+        self.resume_global_capture()
+        # no need to activate a capture fixture because they activate themselves during creation; this
+        # only makes sense when a fixture uses a capture fixture, otherwise the capture fixture will
+        # be activated during pytest_runtest_call
+        yield
+        self.suspend_capture_item(item, "setup")
+
+    @pytest.hookimpl(hookwrapper=True)
+    def pytest_runtest_call(self, item):
+        self.resume_global_capture()
+        # it is important to activate this fixture during the call phase so it overwrites the "global"
+        # capture
+        self.activate_fixture(item)
+        yield
+        self.suspend_capture_item(item, "call")
+
+    @pytest.hookimpl(hookwrapper=True)
+    def pytest_runtest_teardown(self, item):
+        self.resume_global_capture()
+        self.activate_fixture(item)
+        yield
+        self.suspend_capture_item(item, "teardown")
+
+    @pytest.hookimpl(tryfirst=True)
+    def pytest_keyboard_interrupt(self, excinfo):
+        self.stop_global_capturing()
+
+    @pytest.hookimpl(tryfirst=True)
+    def pytest_internalerror(self, excinfo):
+        self.stop_global_capturing()
+
+    def suspend_capture_item(self, item, when, in_=False):
+        out, err = self.suspend_global_capture(item, in_=in_)
+        item.add_report_section(when, "stdout", out)
+        item.add_report_section(when, "stderr", err)
+
+
+capture_fixtures = {"capfd", "capfdbinary", "capsys", "capsysbinary"}
+
+
+def _ensure_only_one_capture_fixture(request, name):
+    fixtures = set(request.fixturenames) & capture_fixtures - {name}
+    if fixtures:
+        fixtures = sorted(fixtures)
+        fixtures = fixtures[0] if len(fixtures) == 1 else fixtures
+        raise request.raiseerror(
+            "cannot use {} and {} at the same time".format(fixtures, name)
+        )
+
+
+@pytest.fixture
+def capsys(request):
+    """Enable capturing of writes to ``sys.stdout`` and ``sys.stderr`` and make
+    captured output available via ``capsys.readouterr()`` method calls
+    which return a ``(out, err)`` namedtuple.  ``out`` and ``err`` will be ``text``
+    objects.
+    """
+    _ensure_only_one_capture_fixture(request, "capsys")
+    with _install_capture_fixture_on_item(request, SysCapture) as fixture:
+        yield fixture
+
+
+@pytest.fixture
+def capsysbinary(request):
+    """Enable capturing of writes to ``sys.stdout`` and ``sys.stderr`` and make
+    captured output available via ``capsys.readouterr()`` method calls
+    which return a ``(out, err)`` tuple.  ``out`` and ``err`` will be ``bytes``
+    objects.
+    """
+    _ensure_only_one_capture_fixture(request, "capsysbinary")
+    # Currently, the implementation uses the python3 specific `.buffer`
+    # property of CaptureIO.
+    if sys.version_info < (3,):
+        raise request.raiseerror("capsysbinary is only supported on python 3")
+    with _install_capture_fixture_on_item(request, SysCaptureBinary) as fixture:
+        yield fixture
+
+
+@pytest.fixture
+def capfd(request):
+    """Enable capturing of writes to file descriptors ``1`` and ``2`` and make
+    captured output available via ``capfd.readouterr()`` method calls
+    which return a ``(out, err)`` tuple.  ``out`` and ``err`` will be ``text``
+    objects.
+    """
+    _ensure_only_one_capture_fixture(request, "capfd")
+    if not hasattr(os, "dup"):
+        pytest.skip(
+            "capfd fixture needs os.dup function which is not available in this system"
+        )
+    with _install_capture_fixture_on_item(request, FDCapture) as fixture:
+        yield fixture
+
+
+@pytest.fixture
+def capfdbinary(request):
+    """Enable capturing of write to file descriptors 1 and 2 and make
+    captured output available via ``capfdbinary.readouterr`` method calls
+    which return a ``(out, err)`` tuple.  ``out`` and ``err`` will be
+    ``bytes`` objects.
+    """
+    _ensure_only_one_capture_fixture(request, "capfdbinary")
+    if not hasattr(os, "dup"):
+        pytest.skip(
+            "capfdbinary fixture needs os.dup function which is not available in this system"
+        )
+    with _install_capture_fixture_on_item(request, FDCaptureBinary) as fixture:
+        yield fixture
+
+
+@contextlib.contextmanager
+def _install_capture_fixture_on_item(request, capture_class):
+    """
+    Context manager which creates a ``CaptureFixture`` instance and "installs" it on
+    the item/node of the given request. Used by ``capsys`` and ``capfd``.
+
+    The CaptureFixture is added as attribute of the item because it needs to accessed
+    by ``CaptureManager`` during its ``pytest_runtest_*`` hooks.
+    """
+    request.node._capture_fixture = fixture = CaptureFixture(capture_class, request)
+    capmanager = request.config.pluginmanager.getplugin("capturemanager")
+    # need to active this fixture right away in case it is being used by another fixture (setup phase)
+    # if this fixture is being used only by a test function (call phase), then we wouldn't need this
+    # activation, but it doesn't hurt
+    capmanager.activate_fixture(request.node)
+    yield fixture
+    fixture.close()
+    del request.node._capture_fixture
+
+
+class CaptureFixture(object):
+    """
+    Object returned by :py:func:`capsys`, :py:func:`capsysbinary`, :py:func:`capfd` and :py:func:`capfdbinary`
+    fixtures.
+    """
+
+    def __init__(self, captureclass, request):
+        self.captureclass = captureclass
+        self.request = request
+
+    def _start(self):
+        self._capture = MultiCapture(
+            out=True, err=True, in_=False, Capture=self.captureclass
+        )
+        self._capture.start_capturing()
+
+    def close(self):
+        cap = self.__dict__.pop("_capture", None)
+        if cap is not None:
+            self._outerr = cap.pop_outerr_to_orig()
+            cap.stop_capturing()
+
+    def readouterr(self):
+        """Read and return the captured output so far, resetting the internal buffer.
+
+        :return: captured content as a namedtuple with  ``out`` and ``err`` string attributes
+        """
+        try:
+            return self._capture.readouterr()
+        except AttributeError:
+            return self._outerr
+
+    @contextlib.contextmanager
+    def disabled(self):
+        """Temporarily disables capture while inside the 'with' block."""
+        self._capture.suspend_capturing()
+        capmanager = self.request.config.pluginmanager.getplugin("capturemanager")
+        capmanager.suspend_global_capture(item=None, in_=False)
+        try:
+            yield
+        finally:
+            capmanager.resume_global_capture()
+            self._capture.resume_capturing()
+
+
+def safe_text_dupfile(f, mode, default_encoding="UTF8"):
+    """ return an open text file object that's a duplicate of f on the
+        FD-level if possible.
+    """
+    encoding = getattr(f, "encoding", None)
+    try:
+        fd = f.fileno()
+    except Exception:
+        if "b" not in getattr(f, "mode", "") and hasattr(f, "encoding"):
+            # we seem to have a text stream, let's just use it
+            return f
+    else:
+        newfd = os.dup(fd)
+        if "b" not in mode:
+            mode += "b"
+        f = os.fdopen(newfd, mode, 0)  # no buffering
+    return EncodedFile(f, encoding or default_encoding)
+
+
+class EncodedFile(object):
+    errors = "strict"  # possibly needed by py3 code (issue555)
+
+    def __init__(self, buffer, encoding):
+        self.buffer = buffer
+        self.encoding = encoding
+
+    def write(self, obj):
+        if isinstance(obj, six.text_type):
+            obj = obj.encode(self.encoding, "replace")
+        self.buffer.write(obj)
+
+    def writelines(self, linelist):
+        data = "".join(linelist)
+        self.write(data)
+
+    @property
+    def name(self):
+        """Ensure that file.name is a string."""
+        return repr(self.buffer)
+
+    def __getattr__(self, name):
+        return getattr(object.__getattribute__(self, "buffer"), name)
+
+
+CaptureResult = collections.namedtuple("CaptureResult", ["out", "err"])
+
+
+class MultiCapture(object):
+    out = err = in_ = None
+
+    def __init__(self, out=True, err=True, in_=True, Capture=None):
+        if in_:
+            self.in_ = Capture(0)
+        if out:
+            self.out = Capture(1)
+        if err:
+            self.err = Capture(2)
+
+    def start_capturing(self):
+        if self.in_:
+            self.in_.start()
+        if self.out:
+            self.out.start()
+        if self.err:
+            self.err.start()
+
+    def pop_outerr_to_orig(self):
+        """ pop current snapshot out/err capture and flush to orig streams. """
+        out, err = self.readouterr()
+        if out:
+            self.out.writeorg(out)
+        if err:
+            self.err.writeorg(err)
+        return out, err
+
+    def suspend_capturing(self, in_=False):
+        if self.out:
+            self.out.suspend()
+        if self.err:
+            self.err.suspend()
+        if in_ and self.in_:
+            self.in_.suspend()
+            self._in_suspended = True
+
+    def resume_capturing(self):
+        if self.out:
+            self.out.resume()
+        if self.err:
+            self.err.resume()
+        if hasattr(self, "_in_suspended"):
+            self.in_.resume()
+            del self._in_suspended
+
+    def stop_capturing(self):
+        """ stop capturing and reset capturing streams """
+        if hasattr(self, "_reset"):
+            raise ValueError("was already stopped")
+        self._reset = True
+        if self.out:
+            self.out.done()
+        if self.err:
+            self.err.done()
+        if self.in_:
+            self.in_.done()
+
+    def readouterr(self):
+        """ return snapshot unicode value of stdout/stderr capturings. """
+        return CaptureResult(
+            self.out.snap() if self.out is not None else "",
+            self.err.snap() if self.err is not None else "",
+        )
+
+
+class NoCapture(object):
+    __init__ = start = done = suspend = resume = lambda *args: None
+
+
+class FDCaptureBinary(object):
+    """Capture IO to/from a given os-level filedescriptor.
+
+    snap() produces `bytes`
+    """
+
+    def __init__(self, targetfd, tmpfile=None):
+        self.targetfd = targetfd
+        try:
+            self.targetfd_save = os.dup(self.targetfd)
+        except OSError:
+            self.start = lambda: None
+            self.done = lambda: None
+        else:
+            if targetfd == 0:
+                assert not tmpfile, "cannot set tmpfile with stdin"
+                tmpfile = open(os.devnull, "r")
+                self.syscapture = SysCapture(targetfd)
+            else:
+                if tmpfile is None:
+                    f = TemporaryFile()
+                    with f:
+                        tmpfile = safe_text_dupfile(f, mode="wb+")
+                if targetfd in patchsysdict:
+                    self.syscapture = SysCapture(targetfd, tmpfile)
+                else:
+                    self.syscapture = NoCapture()
+            self.tmpfile = tmpfile
+            self.tmpfile_fd = tmpfile.fileno()
+
+    def __repr__(self):
+        return "<FDCapture %s oldfd=%s>" % (self.targetfd, self.targetfd_save)
+
+    def start(self):
+        """ Start capturing on targetfd using memorized tmpfile. """
+        try:
+            os.fstat(self.targetfd_save)
+        except (AttributeError, OSError):
+            raise ValueError("saved filedescriptor not valid anymore")
+        os.dup2(self.tmpfile_fd, self.targetfd)
+        self.syscapture.start()
+
+    def snap(self):
+        self.tmpfile.seek(0)
+        res = self.tmpfile.read()
+        self.tmpfile.seek(0)
+        self.tmpfile.truncate()
+        return res
+
+    def done(self):
+        """ stop capturing, restore streams, return original capture file,
+        seeked to position zero. """
+        targetfd_save = self.__dict__.pop("targetfd_save")
+        os.dup2(targetfd_save, self.targetfd)
+        os.close(targetfd_save)
+        self.syscapture.done()
+        _attempt_to_close_capture_file(self.tmpfile)
+
+    def suspend(self):
+        self.syscapture.suspend()
+        os.dup2(self.targetfd_save, self.targetfd)
+
+    def resume(self):
+        self.syscapture.resume()
+        os.dup2(self.tmpfile_fd, self.targetfd)
+
+    def writeorg(self, data):
+        """ write to original file descriptor. """
+        if isinstance(data, six.text_type):
+            data = data.encode("utf8")  # XXX use encoding of original stream
+        os.write(self.targetfd_save, data)
+
+
+class FDCapture(FDCaptureBinary):
+    """Capture IO to/from a given os-level filedescriptor.
+
+    snap() produces text
+    """
+
+    def snap(self):
+        res = FDCaptureBinary.snap(self)
+        enc = getattr(self.tmpfile, "encoding", None)
+        if enc and isinstance(res, bytes):
+            res = six.text_type(res, enc, "replace")
+        return res
+
+
+class SysCapture(object):
+
+    def __init__(self, fd, tmpfile=None):
+        name = patchsysdict[fd]
+        self._old = getattr(sys, name)
+        self.name = name
+        if tmpfile is None:
+            if name == "stdin":
+                tmpfile = DontReadFromInput()
+            else:
+                tmpfile = CaptureIO()
+        self.tmpfile = tmpfile
+
+    def start(self):
+        setattr(sys, self.name, self.tmpfile)
+
+    def snap(self):
+        res = self.tmpfile.getvalue()
+        self.tmpfile.seek(0)
+        self.tmpfile.truncate()
+        return res
+
+    def done(self):
+        setattr(sys, self.name, self._old)
+        del self._old
+        _attempt_to_close_capture_file(self.tmpfile)
+
+    def suspend(self):
+        setattr(sys, self.name, self._old)
+
+    def resume(self):
+        setattr(sys, self.name, self.tmpfile)
+
+    def writeorg(self, data):
+        self._old.write(data)
+        self._old.flush()
+
+
+class SysCaptureBinary(SysCapture):
+
+    def snap(self):
+        res = self.tmpfile.buffer.getvalue()
+        self.tmpfile.seek(0)
+        self.tmpfile.truncate()
+        return res
+
+
+class DontReadFromInput(six.Iterator):
+    """Temporary stub class.  Ideally when stdin is accessed, the
+    capturing should be turned off, with possibly all data captured
+    so far sent to the screen.  This should be configurable, though,
+    because in automated test runs it is better to crash than
+    hang indefinitely.
+    """
+
+    encoding = None
+
+    def read(self, *args):
+        raise IOError("reading from stdin while output is captured")
+
+    readline = read
+    readlines = read
+    __next__ = read
+
+    def __iter__(self):
+        return self
+
+    def fileno(self):
+        raise UnsupportedOperation("redirected stdin is pseudofile, " "has no fileno()")
+
+    def isatty(self):
+        return False
+
+    def close(self):
+        pass
+
+    @property
+    def buffer(self):
+        if sys.version_info >= (3, 0):
+            return self
+        else:
+            raise AttributeError("redirected stdin has no attribute buffer")
+
+
+def _colorama_workaround():
+    """
+    Ensure colorama is imported so that it attaches to the correct stdio
+    handles on Windows.
+
+    colorama uses the terminal on import time. So if something does the
+    first import of colorama while I/O capture is active, colorama will
+    fail in various ways.
+    """
+
+    if not sys.platform.startswith("win32"):
+        return
+    try:
+        import colorama  # noqa
+    except ImportError:
+        pass
+
+
+def _readline_workaround():
+    """
+    Ensure readline is imported so that it attaches to the correct stdio
+    handles on Windows.
+
+    Pdb uses readline support where available--when not running from the Python
+    prompt, the readline module is not imported until running the pdb REPL.  If
+    running pytest with the --pdb option this means the readline module is not
+    imported until after I/O capture has been started.
+
+    This is a problem for pyreadline, which is often used to implement readline
+    support on Windows, as it does not attach to the correct handles for stdout
+    and/or stdin if they have been redirected by the FDCapture mechanism.  This
+    workaround ensures that readline is imported before I/O capture is setup so
+    that it can attach to the actual stdin/out for the console.
+
+    See https://github.com/pytest-dev/pytest/pull/1281
+    """
+
+    if not sys.platform.startswith("win32"):
+        return
+    try:
+        import readline  # noqa
+    except ImportError:
+        pass
+
+
+def _py36_windowsconsoleio_workaround(stream):
+    """
+    Python 3.6 implemented unicode console handling for Windows. This works
+    by reading/writing to the raw console handle using
+    ``{Read,Write}ConsoleW``.
+
+    The problem is that we are going to ``dup2`` over the stdio file
+    descriptors when doing ``FDCapture`` and this will ``CloseHandle`` the
+    handles used by Python to write to the console. Though there is still some
+    weirdness and the console handle seems to only be closed randomly and not
+    on the first call to ``CloseHandle``, or maybe it gets reopened with the
+    same handle value when we suspend capturing.
+
+    The workaround in this case will reopen stdio with a different fd which
+    also means a different handle by replicating the logic in
+    "Py_lifecycle.c:initstdio/create_stdio".
+
+    :param stream: in practice ``sys.stdout`` or ``sys.stderr``, but given
+        here as parameter for unittesting purposes.
+
+    See https://github.com/pytest-dev/py/issues/103
+    """
+    if not sys.platform.startswith("win32") or sys.version_info[:2] < (3, 6):
+        return
+
+    # bail out if ``stream`` doesn't seem like a proper ``io`` stream (#2666)
+    if not hasattr(stream, "buffer"):
+        return
+
+    buffered = hasattr(stream.buffer, "raw")
+    raw_stdout = stream.buffer.raw if buffered else stream.buffer
+
+    if not isinstance(raw_stdout, io._WindowsConsoleIO):
+        return
+
+    def _reopen_stdio(f, mode):
+        if not buffered and mode[0] == "w":
+            buffering = 0
+        else:
+            buffering = -1
+
+        return io.TextIOWrapper(
+            open(os.dup(f.fileno()), mode, buffering),
+            f.encoding,
+            f.errors,
+            f.newlines,
+            f.line_buffering,
+        )
+
+    sys.__stdin__ = sys.stdin = _reopen_stdio(sys.stdin, "rb")
+    sys.__stdout__ = sys.stdout = _reopen_stdio(sys.stdout, "wb")
+    sys.__stderr__ = sys.stderr = _reopen_stdio(sys.stderr, "wb")
+
+
+def _attempt_to_close_capture_file(f):
+    """Suppress IOError when closing the temporary file used for capturing streams in py27 (#2370)"""
+    if six.PY2:
+        try:
+            f.close()
+        except IOError:
+            pass
+    else:
+        f.close()
new file mode 100644
--- /dev/null
+++ b/third_party/python/pytest/src/_pytest/compat.py
@@ -0,0 +1,371 @@
+"""
+python version compatibility code
+"""
+from __future__ import absolute_import, division, print_function
+
+import codecs
+import functools
+import inspect
+import re
+import sys
+
+import py
+
+import _pytest
+from _pytest.outcomes import TEST_OUTCOME
+from six import text_type
+import six
+
+try:
+    import enum
+except ImportError:  # pragma: no cover
+    # Only available in Python 3.4+ or as a backport
+    enum = None
+
+
+_PY3 = sys.version_info > (3, 0)
+_PY2 = not _PY3
+
+
+if _PY3:
+    from inspect import signature, Parameter as Parameter
+else:
+    from funcsigs import signature, Parameter as Parameter
+
+
+NoneType = type(None)
+NOTSET = object()
+
+PY35 = sys.version_info[:2] >= (3, 5)
+PY36 = sys.version_info[:2] >= (3, 6)
+MODULE_NOT_FOUND_ERROR = "ModuleNotFoundError" if PY36 else "ImportError"
+
+if _PY3:
+    from collections.abc import MutableMapping as MappingMixin  # noqa
+    from collections.abc import Mapping, Sequence  # noqa
+else:
+    # those raise DeprecationWarnings in Python >=3.7
+    from collections import MutableMapping as MappingMixin  # noqa
+    from collections import Mapping, Sequence  # noqa
+
+
+def _format_args(func):
+    return str(signature(func))
+
+
+isfunction = inspect.isfunction
+isclass = inspect.isclass
+# used to work around a python2 exception info leak
+exc_clear = getattr(sys, "exc_clear", lambda: None)
+# The type of re.compile objects is not exposed in Python.
+REGEX_TYPE = type(re.compile(""))
+
+
+def is_generator(func):
+    genfunc = inspect.isgeneratorfunction(func)
+    return genfunc and not iscoroutinefunction(func)
+
+
+def iscoroutinefunction(func):
+    """Return True if func is a decorated coroutine function.
+
+    Note: copied and modified from Python 3.5's builtin couroutines.py to avoid import asyncio directly,
+    which in turns also initializes the "logging" module as side-effect (see issue #8).
+    """
+    return (
+        getattr(func, "_is_coroutine", False)
+        or (
+            hasattr(inspect, "iscoroutinefunction")
+            and inspect.iscoroutinefunction(func)
+        )
+    )
+
+
+def getlocation(function, curdir):
+    fn = py.path.local(inspect.getfile(function))
+    lineno = function.__code__.co_firstlineno
+    if fn.relto(curdir):
+        fn = fn.relto(curdir)
+    return "%s:%d" % (fn, lineno + 1)
+
+
+def num_mock_patch_args(function):
+    """ return number of arguments used up by mock arguments (if any) """
+    patchings = getattr(function, "patchings", None)
+    if not patchings:
+        return 0
+    mock_modules = [sys.modules.get("mock"), sys.modules.get("unittest.mock")]
+    if any(mock_modules):
+        sentinels = [m.DEFAULT for m in mock_modules if m is not None]
+        return len(
+            [p for p in patchings if not p.attribute_name and p.new in sentinels]
+        )
+    return len(patchings)
+
+
+def getfuncargnames(function, is_method=False, cls=None):
+    """Returns the names of a function's mandatory arguments.
+
+    This should return the names of all function arguments that:
+        * Aren't bound to an instance or type as in instance or class methods.
+        * Don't have default values.
+        * Aren't bound with functools.partial.
+        * Aren't replaced with mocks.
+
+    The is_method and cls arguments indicate that the function should
+    be treated as a bound method even though it's not unless, only in
+    the case of cls, the function is a static method.
+
+    @RonnyPfannschmidt: This function should be refactored when we
+    revisit fixtures. The fixture mechanism should ask the node for
+    the fixture names, and not try to obtain directly from the
+    function object well after collection has occurred.
+
+    """
+    # The parameters attribute of a Signature object contains an
+    # ordered mapping of parameter names to Parameter instances.  This
+    # creates a tuple of the names of the parameters that don't have
+    # defaults.
+    arg_names = tuple(
+        p.name
+        for p in signature(function).parameters.values()
+        if (
+            p.kind is Parameter.POSITIONAL_OR_KEYWORD
+            or p.kind is Parameter.KEYWORD_ONLY
+        )
+        and p.default is Parameter.empty
+    )
+    # If this function should be treated as a bound method even though
+    # it's passed as an unbound method or function, remove the first
+    # parameter name.
+    if (
+        is_method
+        or (
+            cls
+            and not isinstance(cls.__dict__.get(function.__name__, None), staticmethod)
+        )
+    ):
+        arg_names = arg_names[1:]
+    # Remove any names that will be replaced with mocks.
+    if hasattr(function, "__wrapped__"):
+        arg_names = arg_names[num_mock_patch_args(function):]
+    return arg_names
+
+
+def get_default_arg_names(function):
+    # Note: this code intentionally mirrors the code at the beginning of getfuncargnames,
+    # to get the arguments which were excluded from its result because they had default values
+    return tuple(
+        p.name
+        for p in signature(function).parameters.values()
+        if p.kind in (Parameter.POSITIONAL_OR_KEYWORD, Parameter.KEYWORD_ONLY)
+        and p.default is not Parameter.empty
+    )
+
+
+if _PY3:
+    STRING_TYPES = bytes, str
+    UNICODE_TYPES = six.text_type
+
+    if PY35:
+
+        def _bytes_to_ascii(val):
+            return val.decode("ascii", "backslashreplace")
+
+    else:
+
+        def _bytes_to_ascii(val):
+            if val:
+                # source: http://goo.gl/bGsnwC
+                encoded_bytes, _ = codecs.escape_encode(val)
+                return encoded_bytes.decode("ascii")
+            else:
+                # empty bytes crashes codecs.escape_encode (#1087)
+                return ""
+
+    def ascii_escaped(val):
+        """If val is pure ascii, returns it as a str().  Otherwise, escapes
+        bytes objects into a sequence of escaped bytes:
+
+        b'\xc3\xb4\xc5\xd6' -> u'\\xc3\\xb4\\xc5\\xd6'
+
+        and escapes unicode objects into a sequence of escaped unicode
+        ids, e.g.:
+
+        '4\\nV\\U00043efa\\x0eMXWB\\x1e\\u3028\\u15fd\\xcd\\U0007d944'
+
+        note:
+           the obvious "v.decode('unicode-escape')" will return
+           valid utf-8 unicode if it finds them in bytes, but we
+           want to return escaped bytes for any byte, even if they match
+           a utf-8 string.
+
+        """
+        if isinstance(val, bytes):
+            return _bytes_to_ascii(val)
+        else:
+            return val.encode("unicode_escape").decode("ascii")
+
+
+else:
+    STRING_TYPES = six.string_types
+    UNICODE_TYPES = six.text_type
+
+    def ascii_escaped(val):
+        """In py2 bytes and str are the same type, so return if it's a bytes
+        object, return it unchanged if it is a full ascii string,
+        otherwise escape it into its binary form.
+
+        If it's a unicode string, change the unicode characters into
+        unicode escapes.
+
+        """
+        if isinstance(val, bytes):
+            try:
+                return val.encode("ascii")
+            except UnicodeDecodeError:
+                return val.encode("string-escape")
+        else:
+            return val.encode("unicode-escape")
+
+
+def get_real_func(obj):
+    """ gets the real function object of the (possibly) wrapped object by
+    functools.wraps or functools.partial.
+    """
+    start_obj = obj
+    for i in range(100):
+        new_obj = getattr(obj, "__wrapped__", None)
+        if new_obj is None:
+            break
+        obj = new_obj
+    else:
+        raise ValueError(
+            ("could not find real function of {start}" "\nstopped at {current}").format(
+                start=py.io.saferepr(start_obj), current=py.io.saferepr(obj)
+            )
+        )
+    if isinstance(obj, functools.partial):
+        obj = obj.func
+    return obj
+
+
+def getfslineno(obj):
+    # xxx let decorators etc specify a sane ordering
+    obj = get_real_func(obj)
+    if hasattr(obj, "place_as"):
+        obj = obj.place_as
+    fslineno = _pytest._code.getfslineno(obj)
+    assert isinstance(fslineno[1], int), obj
+    return fslineno
+
+
+def getimfunc(func):
+    try:
+        return func.__func__
+    except AttributeError:
+        return func
+
+
+def safe_getattr(object, name, default):
+    """ Like getattr but return default upon any Exception or any OutcomeException.
+
+    Attribute access can potentially fail for 'evil' Python objects.
+    See issue #214.
+    It catches OutcomeException because of #2490 (issue #580), new outcomes are derived from BaseException
+    instead of Exception (for more details check #2707)
+    """
+    try:
+        return getattr(object, name, default)
+    except TEST_OUTCOME:
+        return default
+
+
+def _is_unittest_unexpected_success_a_failure():
+    """Return if the test suite should fail if an @expectedFailure unittest test PASSES.
+
+    From https://docs.python.org/3/library/unittest.html?highlight=unittest#unittest.TestResult.wasSuccessful:
+        Changed in version 3.4: Returns False if there were any
+        unexpectedSuccesses from tests marked with the expectedFailure() decorator.
+    """
+    return sys.version_info >= (3, 4)
+
+
+if _PY3:
+
+    def safe_str(v):
+        """returns v as string"""
+        return str(v)
+
+
+else:
+
+    def safe_str(v):
+        """returns v as string, converting to ascii if necessary"""
+        try:
+            return str(v)
+        except UnicodeError:
+            if not isinstance(v, text_type):
+                v = text_type(v)
+            errors = "replace"
+            return v.encode("utf-8", errors)
+
+
+COLLECT_FAKEMODULE_ATTRIBUTES = (
+    "Collector",
+    "Module",
+    "Generator",
+    "Function",
+    "Instance",
+    "Session",
+    "Item",
+    "Class",
+    "File",
+    "_fillfuncargs",
+)
+
+
+def _setup_collect_fakemodule():
+    from types import ModuleType
+    import pytest
+
+    pytest.collect = ModuleType("pytest.collect")
+    pytest.collect.__all__ = []  # used for setns
+    for attr in COLLECT_FAKEMODULE_ATTRIBUTES:
+        setattr(pytest.collect, attr, getattr(pytest, attr))
+
+
+if _PY2:
+    # Without this the test_dupfile_on_textio will fail, otherwise CaptureIO could directly inherit from StringIO.
+    from py.io import TextIO
+
+    class CaptureIO(TextIO):
+
+        @property
+        def encoding(self):
+            return getattr(self, "_encoding", "UTF-8")
+
+
+else:
+    import io
+
+    class CaptureIO(io.TextIOWrapper):
+
+        def __init__(self):
+            super(CaptureIO, self).__init__(
+                io.BytesIO(), encoding="UTF-8", newline="", write_through=True
+            )
+
+        def getvalue(self):
+            return self.buffer.getvalue().decode("UTF-8")
+
+
+class FuncargnamesCompatAttr(object):
+    """ helper class so that Metafunc, Function and FixtureRequest
+    don't need to each define the "funcargnames" compatibility attribute.
+    """
+
+    @property
+    def funcargnames(self):
+        """ alias attribute for ``fixturenames`` for pre-2.3 compatibility"""
+        return self.fixturenames
new file mode 100644
--- /dev/null
+++ b/third_party/python/pytest/src/_pytest/config/__init__.py
@@ -0,0 +1,979 @@
+""" command line options, ini-file and conftest.py processing. """
+from __future__ import absolute_import, division, print_function
+import argparse
+import shlex
+import traceback
+import types
+import warnings
+import copy
+import six
+import py
+
+# DON't import pytest here because it causes import cycle troubles
+import sys
+import os
+from _pytest.outcomes import Skipped
+
+import _pytest._code
+import _pytest.hookspec  # the extension point definitions
+import _pytest.assertion
+from pluggy import PluginManager, HookimplMarker, HookspecMarker
+from _pytest.compat import safe_str
+from .exceptions import UsageError, PrintHelp
+from .findpaths import determine_setup, exists
+
+hookimpl = HookimplMarker("pytest")
+hookspec = HookspecMarker("pytest")
+
+# pytest startup
+#
+
+
+class ConftestImportFailure(Exception):
+
+    def __init__(self, path, excinfo):
+        Exception.__init__(self, path, excinfo)
+        self.path = path
+        self.excinfo = excinfo
+
+    def __str__(self):
+        etype, evalue, etb = self.excinfo
+        formatted = traceback.format_tb(etb)
+        # The level of the tracebacks we want to print is hand crafted :(
+        return repr(evalue) + "\n" + "".join(formatted[2:])
+
+
+def main(args=None, plugins=None):
+    """ return exit code, after performing an in-process test run.
+
+    :arg args: list of command line arguments.
+
+    :arg plugins: list of plugin objects to be auto-registered during
+                  initialization.
+    """
+    try:
+        try:
+            config = _prepareconfig(args, plugins)
+        except ConftestImportFailure as e:
+            tw = py.io.TerminalWriter(sys.stderr)
+            for line in traceback.format_exception(*e.excinfo):
+                tw.line(line.rstrip(), red=True)
+            tw.line("ERROR: could not load %s\n" % (e.path,), red=True)
+            return 4
+        else:
+            try:
+                return config.hook.pytest_cmdline_main(config=config)
+            finally:
+                config._ensure_unconfigure()
+    except UsageError as e:
+        tw = py.io.TerminalWriter(sys.stderr)
+        for msg in e.args:
+            tw.line("ERROR: {}\n".format(msg), red=True)
+        return 4
+
+
+class cmdline(object):  # NOQA compatibility namespace
+    main = staticmethod(main)
+
+
+def filename_arg(path, optname):
+    """ Argparse type validator for filename arguments.
+
+    :path: path of filename
+    :optname: name of the option
+    """
+    if os.path.isdir(path):
+        raise UsageError("{} must be a filename, given: {}".format(optname, path))
+    return path
+
+
+def directory_arg(path, optname):
+    """Argparse type validator for directory arguments.
+
+    :path: path of directory
+    :optname: name of the option
+    """
+    if not os.path.isdir(path):
+        raise UsageError("{} must be a directory, given: {}".format(optname, path))
+    return path
+
+
+default_plugins = (
+    "mark",
+    "main",
+    "terminal",
+    "runner",
+    "python",
+    "fixtures",
+    "debugging",
+    "unittest",
+    "capture",
+    "skipping",
+    "tmpdir",
+    "monkeypatch",
+    "recwarn",
+    "pastebin",
+    "helpconfig",
+    "nose",
+    "assertion",
+    "junitxml",
+    "resultlog",
+    "doctest",
+    "cacheprovider",
+    "freeze_support",
+    "setuponly",
+    "setupplan",
+    "warnings",
+    "logging",
+)
+
+
+builtin_plugins = set(default_plugins)
+builtin_plugins.add("pytester")
+
+
+def get_config():
+    # subsequent calls to main will create a fresh instance
+    pluginmanager = PytestPluginManager()
+    config = Config(pluginmanager)
+    for spec in default_plugins:
+        pluginmanager.import_plugin(spec)
+    return config
+
+
+def get_plugin_manager():
+    """
+    Obtain a new instance of the
+    :py:class:`_pytest.config.PytestPluginManager`, with default plugins
+    already loaded.
+
+    This function can be used by integration with other tools, like hooking
+    into pytest to run tests into an IDE.
+    """
+    return get_config().pluginmanager
+
+
+def _prepareconfig(args=None, plugins=None):
+    warning = None
+    if args is None:
+        args = sys.argv[1:]
+    elif isinstance(args, py.path.local):
+        args = [str(args)]
+    elif not isinstance(args, (tuple, list)):
+        if not isinstance(args, str):
+            raise ValueError("not a string or argument list: %r" % (args,))
+        args = shlex.split(args, posix=sys.platform != "win32")
+        from _pytest import deprecated
+
+        warning = deprecated.MAIN_STR_ARGS
+    config = get_config()
+    pluginmanager = config.pluginmanager
+    try:
+        if plugins:
+            for plugin in plugins:
+                if isinstance(plugin, six.string_types):
+                    pluginmanager.consider_pluginarg(plugin)
+                else:
+                    pluginmanager.register(plugin)
+        if warning:
+            config.warn("C1", warning)
+        return pluginmanager.hook.pytest_cmdline_parse(
+            pluginmanager=pluginmanager, args=args
+        )
+    except BaseException:
+        config._ensure_unconfigure()
+        raise
+
+
+class PytestPluginManager(PluginManager):
+    """
+    Overwrites :py:class:`pluggy.PluginManager <pluggy.PluginManager>` to add pytest-specific
+    functionality:
+
+    * loading plugins from the command line, ``PYTEST_PLUGINS`` env variable and
+      ``pytest_plugins`` global variables found in plugins being loaded;
+    * ``conftest.py`` loading during start-up;
+    """
+
+    def __init__(self):
+        super(PytestPluginManager, self).__init__("pytest")
+        self._conftest_plugins = set()
+
+        # state related to local conftest plugins
+        self._path2confmods = {}
+        self._conftestpath2mod = {}
+        self._confcutdir = None
+        self._noconftest = False
+        self._duplicatepaths = set()
+
+        self.add_hookspecs(_pytest.hookspec)
+        self.register(self)
+        if os.environ.get("PYTEST_DEBUG"):
+            err = sys.stderr
+            encoding = getattr(err, "encoding", "utf8")
+            try:
+                err = py.io.dupfile(err, encoding=encoding)
+            except Exception:
+                pass
+            self.trace.root.setwriter(err.write)
+            self.enable_tracing()
+
+        # Config._consider_importhook will set a real object if required.
+        self.rewrite_hook = _pytest.assertion.DummyRewriteHook()
+        # Used to know when we are importing conftests after the pytest_configure stage
+        self._configured = False
+
+    def addhooks(self, module_or_class):
+        """
+        .. deprecated:: 2.8
+
+        Use :py:meth:`pluggy.PluginManager.add_hookspecs <PluginManager.add_hookspecs>`
+        instead.
+        """
+        warning = dict(
+            code="I2",
+            fslocation=_pytest._code.getfslineno(sys._getframe(1)),
+            nodeid=None,
+            message="use pluginmanager.add_hookspecs instead of "
+            "deprecated addhooks() method.",
+        )
+        self._warn(warning)
+        return self.add_hookspecs(module_or_class)
+
+    def parse_hookimpl_opts(self, plugin, name):
+        # pytest hooks are always prefixed with pytest_
+        # so we avoid accessing possibly non-readable attributes
+        # (see issue #1073)
+        if not name.startswith("pytest_"):
+            return
+        # ignore some historic special names which can not be hooks anyway
+        if name == "pytest_plugins" or name.startswith("pytest_funcarg__"):
+            return
+
+        method = getattr(plugin, name)
+        opts = super(PytestPluginManager, self).parse_hookimpl_opts(plugin, name)
+
+        # collect unmarked hooks as long as they have the `pytest_' prefix
+        if opts is None and name.startswith("pytest_"):
+            opts = {}
+
+        if opts is not None:
+            for name in ("tryfirst", "trylast", "optionalhook", "hookwrapper"):
+                opts.setdefault(name, hasattr(method, name))
+        return opts
+
+    def parse_hookspec_opts(self, module_or_class, name):
+        opts = super(PytestPluginManager, self).parse_hookspec_opts(
+            module_or_class, name
+        )
+        if opts is None:
+            method = getattr(module_or_class, name)
+            if name.startswith("pytest_"):
+                opts = {
+                    "firstresult": hasattr(method, "firstresult"),
+                    "historic": hasattr(method, "historic"),
+                }
+        return opts
+
+    def register(self, plugin, name=None):
+        if name in ["pytest_catchlog", "pytest_capturelog"]:
+            self._warn(
+                "{} plugin has been merged into the core, "
+                "please remove it from your requirements.".format(
+                    name.replace("_", "-")
+                )
+            )
+            return
+        ret = super(PytestPluginManager, self).register(plugin, name)
+        if ret:
+            self.hook.pytest_plugin_registered.call_historic(
+                kwargs=dict(plugin=plugin, manager=self)
+            )
+
+            if isinstance(plugin, types.ModuleType):
+                self.consider_module(plugin)
+        return ret
+
+    def getplugin(self, name):
+        # support deprecated naming because plugins (xdist e.g.) use it
+        return self.get_plugin(name)
+
+    def hasplugin(self, name):
+        """Return True if the plugin with the given name is registered."""
+        return bool(self.get_plugin(name))
+
+    def pytest_configure(self, config):
+        # XXX now that the pluginmanager exposes hookimpl(tryfirst...)
+        # we should remove tryfirst/trylast as markers
+        config.addinivalue_line(
+            "markers",
+            "tryfirst: mark a hook implementation function such that the "
+            "plugin machinery will try to call it first/as early as possible.",
+        )
+        config.addinivalue_line(
+            "markers",
+            "trylast: mark a hook implementation function such that the "
+            "plugin machinery will try to call it last/as late as possible.",
+        )
+        self._configured = True
+
+    def _warn(self, message):
+        kwargs = message if isinstance(message, dict) else {
+            "code": "I1", "message": message, "fslocation": None, "nodeid": None
+        }
+        self.hook.pytest_logwarning.call_historic(kwargs=kwargs)
+
+    #
+    # internal API for local conftest plugin handling
+    #
+    def _set_initial_conftests(self, namespace):
+        """ load initial conftest files given a preparsed "namespace".
+            As conftest files may add their own command line options
+            which have arguments ('--my-opt somepath') we might get some
+            false positives.  All builtin and 3rd party plugins will have
+            been loaded, however, so common options will not confuse our logic
+            here.
+        """
+        current = py.path.local()
+        self._confcutdir = current.join(
+            namespace.confcutdir, abs=True
+        ) if namespace.confcutdir else None
+        self._noconftest = namespace.noconftest
+        testpaths = namespace.file_or_dir
+        foundanchor = False
+        for path in testpaths:
+            path = str(path)
+            # remove node-id syntax
+            i = path.find("::")
+            if i != -1:
+                path = path[:i]
+            anchor = current.join(path, abs=1)
+            if exists(anchor):  # we found some file object
+                self._try_load_conftest(anchor)
+                foundanchor = True
+        if not foundanchor:
+            self._try_load_conftest(current)
+
+    def _try_load_conftest(self, anchor):
+        self._getconftestmodules(anchor)
+        # let's also consider test* subdirs
+        if anchor.check(dir=1):
+            for x in anchor.listdir("test*"):
+                if x.check(dir=1):
+                    self._getconftestmodules(x)
+
+    def _getconftestmodules(self, path):
+        if self._noconftest:
+            return []
+        try:
+            return self._path2confmods[path]
+        except KeyError:
+            if path.isfile():
+                clist = self._getconftestmodules(path.dirpath())
+            else:
+                # XXX these days we may rather want to use config.rootdir
+                # and allow users to opt into looking into the rootdir parent
+                # directories instead of requiring to specify confcutdir
+                clist = []
+                for parent in path.parts():
+                    if self._confcutdir and self._confcutdir.relto(parent):
+                        continue
+                    conftestpath = parent.join("conftest.py")
+                    if conftestpath.isfile():
+                        mod = self._importconftest(conftestpath)
+                        clist.append(mod)
+
+            self._path2confmods[path] = clist
+            return clist
+
+    def _rget_with_confmod(self, name, path):
+        modules = self._getconftestmodules(path)
+        for mod in reversed(modules):
+            try:
+                return mod, getattr(mod, name)
+            except AttributeError:
+                continue
+        raise KeyError(name)
+
+    def _importconftest(self, conftestpath):
+        try:
+            return self._conftestpath2mod[conftestpath]
+        except KeyError:
+            pkgpath = conftestpath.pypkgpath()
+            if pkgpath is None:
+                _ensure_removed_sysmodule(conftestpath.purebasename)
+            try:
+                mod = conftestpath.pyimport()
+                if hasattr(mod, "pytest_plugins") and self._configured:
+                    from _pytest.deprecated import PYTEST_PLUGINS_FROM_NON_TOP_LEVEL_CONFTEST
+
+                    warnings.warn(PYTEST_PLUGINS_FROM_NON_TOP_LEVEL_CONFTEST)
+            except Exception:
+                raise ConftestImportFailure(conftestpath, sys.exc_info())
+
+            self._conftest_plugins.add(mod)
+            self._conftestpath2mod[conftestpath] = mod
+            dirpath = conftestpath.dirpath()
+            if dirpath in self._path2confmods:
+                for path, mods in self._path2confmods.items():
+                    if path and path.relto(dirpath) or path == dirpath:
+                        assert mod not in mods
+                        mods.append(mod)
+            self.trace("loaded conftestmodule %r" % (mod))
+            self.consider_conftest(mod)
+            return mod
+
+    #
+    # API for bootstrapping plugin loading
+    #
+    #
+
+    def consider_preparse(self, args):
+        for opt1, opt2 in zip(args, args[1:]):
+            if opt1 == "-p":
+                self.consider_pluginarg(opt2)
+
+    def consider_pluginarg(self, arg):
+        if arg.startswith("no:"):
+            name = arg[3:]
+            self.set_blocked(name)
+            if not name.startswith("pytest_"):
+                self.set_blocked("pytest_" + name)
+        else:
+            self.import_plugin(arg)
+
+    def consider_conftest(self, conftestmodule):
+        self.register(conftestmodule, name=conftestmodule.__file__)
+
+    def consider_env(self):
+        self._import_plugin_specs(os.environ.get("PYTEST_PLUGINS"))
+
+    def consider_module(self, mod):
+        self._import_plugin_specs(getattr(mod, "pytest_plugins", []))
+
+    def _import_plugin_specs(self, spec):
+        plugins = _get_plugin_specs_as_list(spec)
+        for import_spec in plugins:
+            self.import_plugin(import_spec)
+
+    def import_plugin(self, modname):
+        # most often modname refers to builtin modules, e.g. "pytester",
+        # "terminal" or "capture".  Those plugins are registered under their
+        # basename for historic purposes but must be imported with the
+        # _pytest prefix.
+        assert isinstance(modname, (six.text_type, str)), (
+            "module name as text required, got %r" % modname
+        )
+        modname = str(modname)
+        if self.is_blocked(modname) or self.get_plugin(modname) is not None:
+            return
+        if modname in builtin_plugins:
+            importspec = "_pytest." + modname
+        else:
+            importspec = modname
+        self.rewrite_hook.mark_rewrite(importspec)
+        try:
+            __import__(importspec)
+        except ImportError as e:
+            new_exc_type = ImportError
+            new_exc_message = 'Error importing plugin "%s": %s' % (
+                modname, safe_str(e.args[0])
+            )
+            new_exc = new_exc_type(new_exc_message)
+
+            six.reraise(new_exc_type, new_exc, sys.exc_info()[2])
+
+        except Skipped as e:
+            self._warn("skipped plugin %r: %s" % ((modname, e.msg)))
+        else:
+            mod = sys.modules[importspec]
+            self.register(mod, modname)
+
+
+def _get_plugin_specs_as_list(specs):
+    """
+    Parses a list of "plugin specs" and returns a list of plugin names.
+
+    Plugin specs can be given as a list of strings separated by "," or already as a list/tuple in
+    which case it is returned as a list. Specs can also be `None` in which case an
+    empty list is returned.
+    """
+    if specs is not None:
+        if isinstance(specs, str):
+            specs = specs.split(",") if specs else []
+        if not isinstance(specs, (list, tuple)):
+            raise UsageError(
+                "Plugin specs must be a ','-separated string or a "
+                "list/tuple of strings for plugin names. Given: %r" % specs
+            )
+        return list(specs)
+    return []
+
+
+def _ensure_removed_sysmodule(modname):
+    try:
+        del sys.modules[modname]
+    except KeyError:
+        pass
+
+
+class Notset(object):
+
+    def __repr__(self):
+        return "<NOTSET>"
+
+
+notset = Notset()
+
+
+def _iter_rewritable_modules(package_files):
+    for fn in package_files:
+        is_simple_module = "/" not in fn and fn.endswith(".py")
+        is_package = fn.count("/") == 1 and fn.endswith("__init__.py")
+        if is_simple_module:
+            module_name, _ = os.path.splitext(fn)
+            yield module_name
+        elif is_package:
+            package_name = os.path.dirname(fn)
+            yield package_name
+
+
+class Config(object):
+    """ access to configuration values, pluginmanager and plugin hooks.  """
+
+    def __init__(self, pluginmanager):
+        #: access to command line option as attributes.
+        #: (deprecated), use :py:func:`getoption() <_pytest.config.Config.getoption>` instead
+        self.option = argparse.Namespace()
+        from .argparsing import Parser, FILE_OR_DIR
+
+        _a = FILE_OR_DIR
+        self._parser = Parser(
+            usage="%%(prog)s [options] [%s] [%s] [...]" % (_a, _a),
+            processopt=self._processopt,
+        )
+        #: a pluginmanager instance
+        self.pluginmanager = pluginmanager
+        self.trace = self.pluginmanager.trace.root.get("config")
+        self.hook = self.pluginmanager.hook
+        self._inicache = {}
+        self._override_ini = ()
+        self._opt2dest = {}
+        self._cleanup = []
+        self._warn = self.pluginmanager._warn
+        self.pluginmanager.register(self, "pytestconfig")
+        self._configured = False
+
+        def do_setns(dic):
+            import pytest
+
+            setns(pytest, dic)
+
+        self.hook.pytest_namespace.call_historic(do_setns, {})
+        self.hook.pytest_addoption.call_historic(kwargs=dict(parser=self._parser))
+
+    def add_cleanup(self, func):
+        """ Add a function to be called when the config object gets out of
+        use (usually coninciding with pytest_unconfigure)."""
+        self._cleanup.append(func)
+
+    def _do_configure(self):
+        assert not self._configured
+        self._configured = True
+        self.hook.pytest_configure.call_historic(kwargs=dict(config=self))
+
+    def _ensure_unconfigure(self):
+        if self._configured:
+            self._configured = False
+            self.hook.pytest_unconfigure(config=self)
+            self.hook.pytest_configure._call_history = []
+        while self._cleanup:
+            fin = self._cleanup.pop()
+            fin()
+
+    def warn(self, code, message, fslocation=None, nodeid=None):
+        """ generate a warning for this test session. """
+        self.hook.pytest_logwarning.call_historic(
+            kwargs=dict(
+                code=code, message=message, fslocation=fslocation, nodeid=nodeid
+            )
+        )
+
+    def get_terminal_writer(self):
+        return self.pluginmanager.get_plugin("terminalreporter")._tw
+
+    def pytest_cmdline_parse(self, pluginmanager, args):
+        # REF1 assert self == pluginmanager.config, (self, pluginmanager.config)
+        self.parse(args)
+        return self
+
+    def notify_exception(self, excinfo, option=None):
+        if option and option.fulltrace:
+            style = "long"
+        else:
+            style = "native"
+        excrepr = excinfo.getrepr(
+            funcargs=True, showlocals=getattr(option, "showlocals", False), style=style
+        )
+        res = self.hook.pytest_internalerror(excrepr=excrepr, excinfo=excinfo)
+        if not any(res):
+            for line in str(excrepr).split("\n"):
+                sys.stderr.write("INTERNALERROR> %s\n" % line)
+                sys.stderr.flush()
+
+    def cwd_relative_nodeid(self, nodeid):
+        # nodeid's are relative to the rootpath, compute relative to cwd
+        if self.invocation_dir != self.rootdir:
+            fullpath = self.rootdir.join(nodeid)
+            nodeid = self.invocation_dir.bestrelpath(fullpath)
+        return nodeid
+
+    @classmethod
+    def fromdictargs(cls, option_dict, args):
+        """ constructor useable for subprocesses. """
+        config = get_config()
+        config.option.__dict__.update(option_dict)
+        config.parse(args, addopts=False)
+        for x in config.option.plugins:
+            config.pluginmanager.consider_pluginarg(x)
+        return config
+
+    def _processopt(self, opt):
+        for name in opt._short_opts + opt._long_opts:
+            self._opt2dest[name] = opt.dest
+
+        if hasattr(opt, "default") and opt.dest:
+            if not hasattr(self.option, opt.dest):
+                setattr(self.option, opt.dest, opt.default)
+
+    @hookimpl(trylast=True)
+    def pytest_load_initial_conftests(self, early_config):
+        self.pluginmanager._set_initial_conftests(early_config.known_args_namespace)
+
+    def _initini(self, args):
+        ns, unknown_args = self._parser.parse_known_and_unknown_args(
+            args, namespace=copy.copy(self.option)
+        )
+        r = determine_setup(
+            ns.inifilename,
+            ns.file_or_dir + unknown_args,
+            warnfunc=self.warn,
+            rootdir_cmd_arg=ns.rootdir or None,
+        )
+        self.rootdir, self.inifile, self.inicfg = r
+        self._parser.extra_info["rootdir"] = self.rootdir
+        self._parser.extra_info["inifile"] = self.inifile
+        self.invocation_dir = py.path.local()
+        self._parser.addini("addopts", "extra command line options", "args")
+        self._parser.addini("minversion", "minimally required pytest version")
+        self._override_ini = ns.override_ini or ()
+
+    def _consider_importhook(self, args):
+        """Install the PEP 302 import hook if using assertion rewriting.
+
+        Needs to parse the --assert=<mode> option from the commandline
+        and find all the installed plugins to mark them for rewriting
+        by the importhook.
+        """
+        ns, unknown_args = self._parser.parse_known_and_unknown_args(args)
+        mode = ns.assertmode
+        if mode == "rewrite":
+            try:
+                hook = _pytest.assertion.install_importhook(self)
+            except SystemError:
+                mode = "plain"
+            else:
+                self._mark_plugins_for_rewrite(hook)
+        _warn_about_missing_assertion(mode)
+
+    def _mark_plugins_for_rewrite(self, hook):
+        """
+        Given an importhook, mark for rewrite any top-level
+        modules or packages in the distribution package for
+        all pytest plugins.
+        """
+        import pkg_resources
+
+        self.pluginmanager.rewrite_hook = hook
+
+        # 'RECORD' available for plugins installed normally (pip install)
+        # 'SOURCES.txt' available for plugins installed in dev mode (pip install -e)
+        # for installed plugins 'SOURCES.txt' returns an empty list, and vice-versa
+        # so it shouldn't be an issue
+        metadata_files = "RECORD", "SOURCES.txt"
+
+        package_files = (
+            entry.split(",")[0]
+            for entrypoint in pkg_resources.iter_entry_points("pytest11")
+            for metadata in metadata_files
+            for entry in entrypoint.dist._get_metadata(metadata)
+        )
+
+        for name in _iter_rewritable_modules(package_files):
+            hook.mark_rewrite(name)
+
+    def _preparse(self, args, addopts=True):
+        if addopts:
+            args[:] = shlex.split(os.environ.get("PYTEST_ADDOPTS", "")) + args
+        self._initini(args)
+        if addopts:
+            args[:] = self.getini("addopts") + args
+        self._checkversion()
+        self._consider_importhook(args)
+        self.pluginmanager.consider_preparse(args)
+        self.pluginmanager.load_setuptools_entrypoints("pytest11")
+        self.pluginmanager.consider_env()
+        self.known_args_namespace = ns = self._parser.parse_known_args(
+            args, namespace=copy.copy(self.option)
+        )
+        if self.known_args_namespace.confcutdir is None and self.inifile:
+            confcutdir = py.path.local(self.inifile).dirname
+            self.known_args_namespace.confcutdir = confcutdir
+        try:
+            self.hook.pytest_load_initial_conftests(
+                early_config=self, args=args, parser=self._parser
+            )
+        except ConftestImportFailure:
+            e = sys.exc_info()[1]
+            if ns.help or ns.version:
+                # we don't want to prevent --help/--version to work
+                # so just let is pass and print a warning at the end
+                self._warn("could not load initial conftests (%s)\n" % e.path)
+            else:
+                raise
+
+    def _checkversion(self):
+        import pytest
+
+        minver = self.inicfg.get("minversion", None)
+        if minver:
+            ver = minver.split(".")
+            myver = pytest.__version__.split(".")
+            if myver < ver:
+                raise pytest.UsageError(
+                    "%s:%d: requires pytest-%s, actual pytest-%s'"
+                    % (
+                        self.inicfg.config.path,
+                        self.inicfg.lineof("minversion"),
+                        minver,
+                        pytest.__version__,
+                    )
+                )
+
+    def parse(self, args, addopts=True):
+        # parse given cmdline arguments into this config object.
+        assert not hasattr(
+            self, "args"
+        ), "can only parse cmdline args at most once per Config object"
+        self._origargs = args
+        self.hook.pytest_addhooks.call_historic(
+            kwargs=dict(pluginmanager=self.pluginmanager)
+        )
+        self._preparse(args, addopts=addopts)
+        # XXX deprecated hook:
+        self.hook.pytest_cmdline_preparse(config=self, args=args)
+        self._parser.after_preparse = True
+        try:
+            args = self._parser.parse_setoption(
+                args, self.option, namespace=self.option
+            )
+            if not args:
+                cwd = os.getcwd()
+                if cwd == self.rootdir:
+                    args = self.getini("testpaths")
+                if not args:
+                    args = [cwd]
+            self.args = args
+        except PrintHelp:
+            pass
+
+    def addinivalue_line(self, name, line):
+        """ add a line to an ini-file option. The option must have been
+        declared but might not yet be set in which case the line becomes the
+        the first line in its value. """
+        x = self.getini(name)
+        assert isinstance(x, list)
+        x.append(line)  # modifies the cached list inline
+
+    def getini(self, name):
+        """ return configuration value from an :ref:`ini file <inifiles>`. If the
+        specified name hasn't been registered through a prior
+        :py:func:`parser.addini <_pytest.config.Parser.addini>`
+        call (usually from a plugin), a ValueError is raised. """
+        try:
+            return self._inicache[name]
+        except KeyError:
+            self._inicache[name] = val = self._getini(name)
+            return val
+
+    def _getini(self, name):
+        try:
+            description, type, default = self._parser._inidict[name]
+        except KeyError:
+            raise ValueError("unknown configuration value: %r" % (name,))
+        value = self._get_override_ini_value(name)
+        if value is None:
+            try:
+                value = self.inicfg[name]
+            except KeyError:
+                if default is not None:
+                    return default
+                if type is None:
+                    return ""
+                return []
+        if type == "pathlist":
+            dp = py.path.local(self.inicfg.config.path).dirpath()
+            values = []
+            for relpath in shlex.split(value):
+                values.append(dp.join(relpath, abs=True))
+            return values
+        elif type == "args":
+            return shlex.split(value)
+        elif type == "linelist":
+            return [t for t in map(lambda x: x.strip(), value.split("\n")) if t]
+        elif type == "bool":
+            return bool(_strtobool(value.strip()))
+        else:
+            assert type is None
+            return value
+
+    def _getconftest_pathlist(self, name, path):
+        try:
+            mod, relroots = self.pluginmanager._rget_with_confmod(name, path)
+        except KeyError:
+            return None
+        modpath = py.path.local(mod.__file__).dirpath()
+        values = []
+        for relroot in relroots:
+            if not isinstance(relroot, py.path.local):
+                relroot = relroot.replace("/", py.path.local.sep)
+                relroot = modpath.join(relroot, abs=True)
+            values.append(relroot)
+        return values
+
+    def _get_override_ini_value(self, name):
+        value = None
+        # override_ini is a list of "ini=value" options
+        # always use the last item if multiple values are set for same ini-name,
+        # e.g. -o foo=bar1 -o foo=bar2 will set foo to bar2
+        for ini_config in self._override_ini:
+            try:
+                key, user_ini_value = ini_config.split("=", 1)
+            except ValueError:
+                raise UsageError("-o/--override-ini expects option=value style.")
+            else:
+                if key == name:
+                    value = user_ini_value
+        return value
+
+    def getoption(self, name, default=notset, skip=False):
+        """ return command line option value.
+
+        :arg name: name of the option.  You may also specify
+            the literal ``--OPT`` option instead of the "dest" option name.
+        :arg default: default value if no option of that name exists.
+        :arg skip: if True raise pytest.skip if option does not exists
+            or has a None value.
+        """
+        name = self._opt2dest.get(name, name)
+        try:
+            val = getattr(self.option, name)
+            if val is None and skip:
+                raise AttributeError(name)
+            return val
+        except AttributeError:
+            if default is not notset:
+                return default
+            if skip:
+                import pytest
+
+                pytest.skip("no %r option found" % (name,))
+            raise ValueError("no option named %r" % (name,))
+
+    def getvalue(self, name, path=None):
+        """ (deprecated, use getoption()) """
+        return self.getoption(name)
+
+    def getvalueorskip(self, name, path=None):
+        """ (deprecated, use getoption(skip=True)) """
+        return self.getoption(name, skip=True)
+
+
+def _assertion_supported():
+    try:
+        assert False
+    except AssertionError:
+        return True
+    else:
+        return False
+
+
+def _warn_about_missing_assertion(mode):
+    if not _assertion_supported():
+        if mode == "plain":
+            sys.stderr.write(
+                "WARNING: ASSERTIONS ARE NOT EXECUTED"
+                " and FAILING TESTS WILL PASS.  Are you"
+                " using python -O?"
+            )
+        else:
+            sys.stderr.write(
+                "WARNING: assertions not in test modules or"
+                " plugins will be ignored"
+                " because assert statements are not executed "
+                "by the underlying Python interpreter "
+                "(are you using python -O?)\n"
+            )
+
+
+def setns(obj, dic):
+    import pytest
+
+    for name, value in dic.items():
+        if isinstance(value, dict):
+            mod = getattr(obj, name, None)
+            if mod is None:
+                modname = "pytest.%s" % name
+                mod = types.ModuleType(modname)
+                sys.modules[modname] = mod
+                mod.__all__ = []
+                setattr(obj, name, mod)
+            obj.__all__.append(name)
+            setns(mod, value)
+        else:
+            setattr(obj, name, value)
+            obj.__all__.append(name)
+            # if obj != pytest:
+            #    pytest.__all__.append(name)
+            setattr(pytest, name, value)
+
+
+def create_terminal_writer(config, *args, **kwargs):
+    """Create a TerminalWriter instance configured according to the options
+    in the config object. Every code which requires a TerminalWriter object
+    and has access to a config object should use this function.
+    """
+    tw = py.io.TerminalWriter(*args, **kwargs)
+    if config.option.color == "yes":
+        tw.hasmarkup = True
+    if config.option.color == "no":
+        tw.hasmarkup = False
+    return tw
+
+
+def _strtobool(val):
+    """Convert a string representation of truth to true (1) or false (0).
+
+    True values are 'y', 'yes', 't', 'true', 'on', and '1'; false values
+    are 'n', 'no', 'f', 'false', 'off', and '0'.  Raises ValueError if
+    'val' is anything else.
+
+    .. note:: copied from distutils.util
+    """
+    val = val.lower()
+    if val in ("y", "yes", "t", "true", "on", "1"):
+        return 1
+    elif val in ("n", "no", "f", "false", "off", "0"):
+        return 0
+    else:
+        raise ValueError("invalid truth value %r" % (val,))
new file mode 100644
--- /dev/null
+++ b/third_party/python/pytest/src/_pytest/config/argparsing.py
@@ -0,0 +1,394 @@
+import six
+import warnings
+import argparse
+
+FILE_OR_DIR = "file_or_dir"
+
+
+class Parser(object):
+    """ Parser for command line arguments and ini-file values.
+
+    :ivar extra_info: dict of generic param -> value to display in case
+        there's an error processing the command line arguments.
+    """
+
+    def __init__(self, usage=None, processopt=None):
+        self._anonymous = OptionGroup("custom options", parser=self)
+        self._groups = []
+        self._processopt = processopt
+        self._usage = usage
+        self._inidict = {}
+        self._ininames = []
+        self.extra_info = {}
+
+    def processoption(self, option):
+        if self._processopt:
+            if option.dest:
+                self._processopt(option)
+
+    def getgroup(self, name, description="", after=None):
+        """ get (or create) a named option Group.
+
+        :name: name of the option group.
+        :description: long description for --help output.
+        :after: name of other group, used for ordering --help output.
+
+        The returned group object has an ``addoption`` method with the same
+        signature as :py:func:`parser.addoption
+        <_pytest.config.Parser.addoption>` but will be shown in the
+        respective group in the output of ``pytest. --help``.
+        """
+        for group in self._groups:
+            if group.name == name:
+                return group
+        group = OptionGroup(name, description, parser=self)
+        i = 0
+        for i, grp in enumerate(self._groups):
+            if grp.name == after:
+                break
+        self._groups.insert(i + 1, group)
+        return group
+
+    def addoption(self, *opts, **attrs):
+        """ register a command line option.
+
+        :opts: option names, can be short or long options.
+        :attrs: same attributes which the ``add_option()`` function of the
+           `argparse library
+           <http://docs.python.org/2/library/argparse.html>`_
+           accepts.
+
+        After command line parsing options are available on the pytest config
+        object via ``config.option.NAME`` where ``NAME`` is usually set
+        by passing a ``dest`` attribute, for example
+        ``addoption("--long", dest="NAME", ...)``.
+        """
+        self._anonymous.addoption(*opts, **attrs)
+
+    def parse(self, args, namespace=None):
+        from _pytest._argcomplete import try_argcomplete
+
+        self.optparser = self._getparser()
+        try_argcomplete(self.optparser)
+        return self.optparser.parse_args([str(x) for x in args], namespace=namespace)
+
+    def _getparser(self):
+        from _pytest._argcomplete import filescompleter
+
+        optparser = MyOptionParser(self, self.extra_info)
+        groups = self._groups + [self._anonymous]
+        for group in groups:
+            if group.options:
+                desc = group.description or group.name
+                arggroup = optparser.add_argument_group(desc)
+                for option in group.options:
+                    n = option.names()
+                    a = option.attrs()
+                    arggroup.add_argument(*n, **a)
+        # bash like autocompletion for dirs (appending '/')
+        optparser.add_argument(FILE_OR_DIR, nargs="*").completer = filescompleter
+        return optparser
+
+    def parse_setoption(self, args, option, namespace=None):
+        parsedoption = self.parse(args, namespace=namespace)
+        for name, value in parsedoption.__dict__.items():
+            setattr(option, name, value)
+        return getattr(parsedoption, FILE_OR_DIR)
+
+    def parse_known_args(self, args, namespace=None):
+        """parses and returns a namespace object with known arguments at this
+        point.
+        """
+        return self.parse_known_and_unknown_args(args, namespace=namespace)[0]
+
+    def parse_known_and_unknown_args(self, args, namespace=None):
+        """parses and returns a namespace object with known arguments, and
+        the remaining arguments unknown at this point.
+        """
+        optparser = self._getparser()
+        args = [str(x) for x in args]
+        return optparser.parse_known_args(args, namespace=namespace)
+
+    def addini(self, name, help, type=None, default=None):
+        """ register an ini-file option.
+
+        :name: name of the ini-variable
+        :type: type of the variable, can be ``pathlist``, ``args``, ``linelist``
+               or ``bool``.
+        :default: default value if no ini-file option exists but is queried.
+
+        The value of ini-variables can be retrieved via a call to
+        :py:func:`config.getini(name) <_pytest.config.Config.getini>`.
+        """
+        assert type in (None, "pathlist", "args", "linelist", "bool")
+        self._inidict[name] = (help, type, default)
+        self._ininames.append(name)
+
+
+class ArgumentError(Exception):
+    """
+    Raised if an Argument instance is created with invalid or
+    inconsistent arguments.
+    """
+
+    def __init__(self, msg, option):
+        self.msg = msg
+        self.option_id = str(option)
+
+    def __str__(self):
+        if self.option_id:
+            return "option %s: %s" % (self.option_id, self.msg)
+        else:
+            return self.msg
+
+
+class Argument(object):
+    """class that mimics the necessary behaviour of optparse.Option
+
+    its currently a least effort implementation
+    and ignoring choices and integer prefixes
+    https://docs.python.org/3/library/optparse.html#optparse-standard-option-types
+    """
+    _typ_map = {"int": int, "string": str, "float": float, "complex": complex}
+
+    def __init__(self, *names, **attrs):
+        """store parms in private vars for use in add_argument"""
+        self._attrs = attrs
+        self._short_opts = []
+        self._long_opts = []
+        self.dest = attrs.get("dest")
+        if "%default" in (attrs.get("help") or ""):
+            warnings.warn(
+                'pytest now uses argparse. "%default" should be'
+                ' changed to "%(default)s" ',
+                DeprecationWarning,
+                stacklevel=3,
+            )
+        try:
+            typ = attrs["type"]
+        except KeyError:
+            pass
+        else:
+            # this might raise a keyerror as well, don't want to catch that
+            if isinstance(typ, six.string_types):
+                if typ == "choice":
+                    warnings.warn(
+                        "type argument to addoption() is a string %r."
+                        " For parsearg this is optional and when supplied"
+                        " should be a type."
+                        " (options: %s)" % (typ, names),
+                        DeprecationWarning,
+                        stacklevel=3,
+                    )
+                    # argparse expects a type here take it from
+                    # the type of the first element
+                    attrs["type"] = type(attrs["choices"][0])
+                else:
+                    warnings.warn(
+                        "type argument to addoption() is a string %r."
+                        " For parsearg this should be a type."
+                        " (options: %s)" % (typ, names),
+                        DeprecationWarning,
+                        stacklevel=3,
+                    )
+                    attrs["type"] = Argument._typ_map[typ]
+                # used in test_parseopt -> test_parse_defaultgetter
+                self.type = attrs["type"]
+            else:
+                self.type = typ
+        try:
+            # attribute existence is tested in Config._processopt
+            self.default = attrs["default"]
+        except KeyError:
+            pass
+        self._set_opt_strings(names)
+        if not self.dest:
+            if self._long_opts:
+                self.dest = self._long_opts[0][2:].replace("-", "_")
+            else:
+                try:
+                    self.dest = self._short_opts[0][1:]
+                except IndexError:
+                    raise ArgumentError("need a long or short option", self)
+
+    def names(self):
+        return self._short_opts + self._long_opts
+
+    def attrs(self):
+        # update any attributes set by processopt
+        attrs = "default dest help".split()
+        if self.dest:
+            attrs.append(self.dest)
+        for attr in attrs:
+            try:
+                self._attrs[attr] = getattr(self, attr)
+            except AttributeError:
+                pass
+        if self._attrs.get("help"):
+            a = self._attrs["help"]
+            a = a.replace("%default", "%(default)s")
+            # a = a.replace('%prog', '%(prog)s')
+            self._attrs["help"] = a
+        return self._attrs
+
+    def _set_opt_strings(self, opts):
+        """directly from optparse
+
+        might not be necessary as this is passed to argparse later on"""
+        for opt in opts:
+            if len(opt) < 2:
+                raise ArgumentError(
+                    "invalid option string %r: "
+                    "must be at least two characters long" % opt,
+                    self,
+                )
+            elif len(opt) == 2:
+                if not (opt[0] == "-" and opt[1] != "-"):
+                    raise ArgumentError(
+                        "invalid short option string %r: "
+                        "must be of the form -x, (x any non-dash char)" % opt,
+                        self,
+                    )
+                self._short_opts.append(opt)
+            else:
+                if not (opt[0:2] == "--" and opt[2] != "-"):
+                    raise ArgumentError(
+                        "invalid long option string %r: "
+                        "must start with --, followed by non-dash" % opt,
+                        self,
+                    )
+                self._long_opts.append(opt)
+
+    def __repr__(self):
+        args = []
+        if self._short_opts:
+            args += ["_short_opts: " + repr(self._short_opts)]
+        if self._long_opts:
+            args += ["_long_opts: " + repr(self._long_opts)]
+        args += ["dest: " + repr(self.dest)]
+        if hasattr(self, "type"):
+            args += ["type: " + repr(self.type)]
+        if hasattr(self, "default"):
+            args += ["default: " + repr(self.default)]
+        return "Argument({})".format(", ".join(args))
+
+
+class OptionGroup(object):
+
+    def __init__(self, name, description="", parser=None):
+        self.name = name
+        self.description = description
+        self.options = []
+        self.parser = parser
+
+    def addoption(self, *optnames, **attrs):
+        """ add an option to this group.
+
+        if a shortened version of a long option is specified it will
+        be suppressed in the help. addoption('--twowords', '--two-words')
+        results in help showing '--two-words' only, but --twowords gets
+        accepted **and** the automatic destination is in args.twowords
+        """
+        conflict = set(optnames).intersection(
+            name for opt in self.options for name in opt.names()
+        )
+        if conflict:
+            raise ValueError("option names %s already added" % conflict)
+        option = Argument(*optnames, **attrs)
+        self._addoption_instance(option, shortupper=False)
+
+    def _addoption(self, *optnames, **attrs):
+        option = Argument(*optnames, **attrs)
+        self._addoption_instance(option, shortupper=True)
+
+    def _addoption_instance(self, option, shortupper=False):
+        if not shortupper:
+            for opt in option._short_opts:
+                if opt[0] == "-" and opt[1].islower():
+                    raise ValueError("lowercase shortoptions reserved")
+        if self.parser:
+            self.parser.processoption(option)
+        self.options.append(option)
+
+
+class MyOptionParser(argparse.ArgumentParser):
+
+    def __init__(self, parser, extra_info=None):
+        if not extra_info:
+            extra_info = {}
+        self._parser = parser
+        argparse.ArgumentParser.__init__(
+            self,
+            usage=parser._usage,
+            add_help=False,
+            formatter_class=DropShorterLongHelpFormatter,
+        )
+        # extra_info is a dict of (param -> value) to display if there's
+        # an usage error to provide more contextual information to the user
+        self.extra_info = extra_info
+
+    def parse_args(self, args=None, namespace=None):
+        """allow splitting of positional arguments"""
+        args, argv = self.parse_known_args(args, namespace)
+        if argv:
+            for arg in argv:
+                if arg and arg[0] == "-":
+                    lines = ["unrecognized arguments: %s" % (" ".join(argv))]
+                    for k, v in sorted(self.extra_info.items()):
+                        lines.append("  %s: %s" % (k, v))
+                    self.error("\n".join(lines))
+            getattr(args, FILE_OR_DIR).extend(argv)
+        return args
+
+
+class DropShorterLongHelpFormatter(argparse.HelpFormatter):
+    """shorten help for long options that differ only in extra hyphens
+
+    - collapse **long** options that are the same except for extra hyphens
+    - special action attribute map_long_option allows surpressing additional
+      long options
+    - shortcut if there are only two options and one of them is a short one
+    - cache result on action object as this is called at least 2 times
+    """
+
+    def _format_action_invocation(self, action):
+        orgstr = argparse.HelpFormatter._format_action_invocation(self, action)
+        if orgstr and orgstr[0] != "-":  # only optional arguments
+            return orgstr
+        res = getattr(action, "_formatted_action_invocation", None)
+        if res:
+            return res
+        options = orgstr.split(", ")
+        if len(options) == 2 and (len(options[0]) == 2 or len(options[1]) == 2):
+            # a shortcut for '-h, --help' or '--abc', '-a'
+            action._formatted_action_invocation = orgstr
+            return orgstr
+        return_list = []
+        option_map = getattr(action, "map_long_option", {})
+        if option_map is None:
+            option_map = {}
+        short_long = {}
+        for option in options:
+            if len(option) == 2 or option[2] == " ":
+                continue
+            if not option.startswith("--"):
+                raise ArgumentError(
+                    'long optional argument without "--": [%s]' % (option), self
+                )
+            xxoption = option[2:]
+            if xxoption.split()[0] not in option_map:
+                shortened = xxoption.replace("-", "")
+                if (
+                    shortened not in short_long
+                    or len(short_long[shortened]) < len(xxoption)
+                ):
+                    short_long[shortened] = xxoption
+        # now short_long has been filled out to the longest with dashes
+        # **and** we keep the right option ordering from add_argument
+        for option in options:
+            if len(option) == 2 or option[2] == " ":
+                return_list.append(option)
+            if option[2:] == short_long.get(option.replace("-", "")):
+                return_list.append(option.replace(" ", "=", 1))
+        action._formatted_action_invocation = ", ".join(return_list)
+        return action._formatted_action_invocation
new file mode 100644
--- /dev/null
+++ b/third_party/python/pytest/src/_pytest/config/exceptions.py
@@ -0,0 +1,8 @@
+class UsageError(Exception):
+    """ error in pytest usage or invocation"""
+
+
+class PrintHelp(Exception):
+    """Raised when pytest should print it's help to skip the rest of the
+    argument parsing and validation."""
+    pass
new file mode 100644
--- /dev/null
+++ b/third_party/python/pytest/src/_pytest/config/findpaths.py
@@ -0,0 +1,140 @@
+import py
+import os
+from .exceptions import UsageError
+
+
+def exists(path, ignore=EnvironmentError):
+    try:
+        return path.check()
+    except ignore:
+        return False
+
+
+def getcfg(args, warnfunc=None):
+    """
+    Search the list of arguments for a valid ini-file for pytest,
+    and return a tuple of (rootdir, inifile, cfg-dict).
+
+    note: warnfunc is an optional function used to warn
+        about ini-files that use deprecated features.
+        This parameter should be removed when pytest
+        adopts standard deprecation warnings (#1804).
+    """
+    from _pytest.deprecated import CFG_PYTEST_SECTION
+
+    inibasenames = ["pytest.ini", "tox.ini", "setup.cfg"]
+    args = [x for x in args if not str(x).startswith("-")]
+    if not args:
+        args = [py.path.local()]
+    for arg in args:
+        arg = py.path.local(arg)
+        for base in arg.parts(reverse=True):
+            for inibasename in inibasenames:
+                p = base.join(inibasename)
+                if exists(p):
+                    iniconfig = py.iniconfig.IniConfig(p)
+                    if "pytest" in iniconfig.sections:
+                        if inibasename == "setup.cfg" and warnfunc:
+                            warnfunc(
+                                "C1", CFG_PYTEST_SECTION.format(filename=inibasename)
+                            )
+                        return base, p, iniconfig["pytest"]
+                    if (
+                        inibasename == "setup.cfg"
+                        and "tool:pytest" in iniconfig.sections
+                    ):
+                        return base, p, iniconfig["tool:pytest"]
+                    elif inibasename == "pytest.ini":
+                        # allowed to be empty
+                        return base, p, {}
+    return None, None, None
+
+
+def get_common_ancestor(paths):
+    common_ancestor = None
+    for path in paths:
+        if not path.exists():
+            continue
+        if common_ancestor is None:
+            common_ancestor = path
+        else:
+            if path.relto(common_ancestor) or path == common_ancestor:
+                continue
+            elif common_ancestor.relto(path):
+                common_ancestor = path
+            else:
+                shared = path.common(common_ancestor)
+                if shared is not None:
+                    common_ancestor = shared
+    if common_ancestor is None:
+        common_ancestor = py.path.local()
+    elif common_ancestor.isfile():
+        common_ancestor = common_ancestor.dirpath()
+    return common_ancestor
+
+
+def get_dirs_from_args(args):
+
+    def is_option(x):
+        return str(x).startswith("-")
+
+    def get_file_part_from_node_id(x):
+        return str(x).split("::")[0]
+
+    def get_dir_from_path(path):
+        if path.isdir():
+            return path
+        return py.path.local(path.dirname)
+
+    # These look like paths but may not exist
+    possible_paths = (
+        py.path.local(get_file_part_from_node_id(arg))
+        for arg in args
+        if not is_option(arg)
+    )
+
+    return [get_dir_from_path(path) for path in possible_paths if path.exists()]
+
+
+def determine_setup(inifile, args, warnfunc=None, rootdir_cmd_arg=None):
+    dirs = get_dirs_from_args(args)
+    if inifile:
+        iniconfig = py.iniconfig.IniConfig(inifile)
+        is_cfg_file = str(inifile).endswith(".cfg")
+        # TODO: [pytest] section in *.cfg files is depricated. Need refactoring.
+        sections = ["tool:pytest", "pytest"] if is_cfg_file else ["pytest"]
+        for section in sections:
+            try:
+                inicfg = iniconfig[section]
+                if is_cfg_file and section == "pytest" and warnfunc:
+                    from _pytest.deprecated import CFG_PYTEST_SECTION
+
+                    warnfunc("C1", CFG_PYTEST_SECTION.format(filename=str(inifile)))
+                break
+            except KeyError:
+                inicfg = None
+        rootdir = get_common_ancestor(dirs)
+    else:
+        ancestor = get_common_ancestor(dirs)
+        rootdir, inifile, inicfg = getcfg([ancestor], warnfunc=warnfunc)
+        if rootdir is None:
+            for rootdir in ancestor.parts(reverse=True):
+                if rootdir.join("setup.py").exists():
+                    break
+            else:
+                rootdir, inifile, inicfg = getcfg(dirs, warnfunc=warnfunc)
+                if rootdir is None:
+                    rootdir = get_common_ancestor([py.path.local(), ancestor])
+                    is_fs_root = os.path.splitdrive(str(rootdir))[1] == "/"
+                    if is_fs_root:
+                        rootdir = ancestor
+    if rootdir_cmd_arg:
+        rootdir_abs_path = py.path.local(os.path.expandvars(rootdir_cmd_arg))
+        if not os.path.isdir(str(rootdir_abs_path)):
+            raise UsageError(
+                "Directory '{}' not found. Check your '--rootdir' option.".format(
+                    rootdir_abs_path
+                )
+            )
+        rootdir = rootdir_abs_path
+    return rootdir, inifile, inicfg or {}
new file mode 100644
--- /dev/null
+++ b/third_party/python/pytest/src/_pytest/debugging.py
@@ -0,0 +1,162 @@
+""" interactive debugging with PDB, the Python Debugger. """
+from __future__ import absolute_import, division, print_function
+import pdb
+import sys
+import os
+from doctest import UnexpectedException
+
+try:
+    from builtins import breakpoint  # noqa
+
+    SUPPORTS_BREAKPOINT_BUILTIN = True
+except ImportError:
+    SUPPORTS_BREAKPOINT_BUILTIN = False
+
+
+def pytest_addoption(parser):
+    group = parser.getgroup("general")
+    group._addoption(
+        "--pdb",
+        dest="usepdb",
+        action="store_true",
+        help="start the interactive Python debugger on errors or KeyboardInterrupt.",
+    )
+    group._addoption(
+        "--pdbcls",
+        dest="usepdb_cls",
+        metavar="modulename:classname",
+        help="start a custom interactive Python debugger on errors. "
+        "For example: --pdbcls=IPython.terminal.debugger:TerminalPdb",
+    )
+
+
+def pytest_configure(config):
+    if config.getvalue("usepdb_cls"):
+        modname, classname = config.getvalue("usepdb_cls").split(":")
+        __import__(modname)
+        pdb_cls = getattr(sys.modules[modname], classname)
+    else:
+        pdb_cls = pdb.Pdb
+
+    if config.getvalue("usepdb"):
+        config.pluginmanager.register(PdbInvoke(), "pdbinvoke")
+
+    # Use custom Pdb class set_trace instead of default Pdb on breakpoint() call
+    if SUPPORTS_BREAKPOINT_BUILTIN:
+        _environ_pythonbreakpoint = os.environ.get("PYTHONBREAKPOINT", "")
+        if _environ_pythonbreakpoint == "":
+            sys.breakpointhook = pytestPDB.set_trace
+
+    old = (pdb.set_trace, pytestPDB._pluginmanager)
+
+    def fin():
+        pdb.set_trace, pytestPDB._pluginmanager = old
+        pytestPDB._config = None
+        pytestPDB._pdb_cls = pdb.Pdb
+        if SUPPORTS_BREAKPOINT_BUILTIN:
+            sys.breakpointhook = sys.__breakpointhook__
+
+    pdb.set_trace = pytestPDB.set_trace
+    pytestPDB._pluginmanager = config.pluginmanager
+    pytestPDB._config = config
+    pytestPDB._pdb_cls = pdb_cls
+    config._cleanup.append(fin)
+
+
+class pytestPDB(object):
+    """ Pseudo PDB that defers to the real pdb. """
+    _pluginmanager = None
+    _config = None
+    _pdb_cls = pdb.Pdb
+
+    @classmethod
+    def set_trace(cls):
+        """ invoke PDB set_trace debugging, dropping any IO capturing. """
+        import _pytest.config
+
+        frame = sys._getframe().f_back
+        if cls._pluginmanager is not None:
+            capman = cls._pluginmanager.getplugin("capturemanager")
+            if capman:
+                capman.suspend_global_capture(in_=True)
+            tw = _pytest.config.create_terminal_writer(cls._config)
+            tw.line()
+            tw.sep(">", "PDB set_trace (IO-capturing turned off)")
+            cls._pluginmanager.hook.pytest_enter_pdb(config=cls._config)
+        cls._pdb_cls().set_trace(frame)
+
+
+class PdbInvoke(object):
+
+    def pytest_exception_interact(self, node, call, report):
+        capman = node.config.pluginmanager.getplugin("capturemanager")
+        if capman:
+            out, err = capman.suspend_global_capture(in_=True)
+            sys.stdout.write(out)
+            sys.stdout.write(err)
+        _enter_pdb(node, call.excinfo, report)
+
+    def pytest_internalerror(self, excrepr, excinfo):
+        for line in str(excrepr).split("\n"):
+            sys.stderr.write("INTERNALERROR> %s\n" % line)
+            sys.stderr.flush()
+        tb = _postmortem_traceback(excinfo)
+        post_mortem(tb)
+
+
+def _enter_pdb(node, excinfo, rep):
+    # XXX we re-use the TerminalReporter's terminalwriter
+    # because this seems to avoid some encoding related troubles
+    # for not completely clear reasons.
+    tw = node.config.pluginmanager.getplugin("terminalreporter")._tw
+    tw.line()
+
+    showcapture = node.config.option.showcapture
+
+    for sectionname, content in (
+        ("stdout", rep.capstdout), ("stderr", rep.capstderr), ("log", rep.caplog)
+    ):
+        if showcapture in (sectionname, "all") and content:
+            tw.sep(">", "captured " + sectionname)
+            if content[-1:] == "\n":
+                content = content[:-1]
+            tw.line(content)
+
+    tw.sep(">", "traceback")
+    rep.toterminal(tw)
+    tw.sep(">", "entering PDB")
+    tb = _postmortem_traceback(excinfo)
+    post_mortem(tb)
+    rep._pdbshown = True
+    return rep
+
+
+def _postmortem_traceback(excinfo):
+    if isinstance(excinfo.value, UnexpectedException):
+        # A doctest.UnexpectedException is not useful for post_mortem.
+        # Use the underlying exception instead:
+        return excinfo.value.exc_info[2]
+    else:
+        return excinfo._excinfo[2]
+
+
+def _find_last_non_hidden_frame(stack):
+    i = max(0, len(stack) - 1)
+    while i and stack[i][0].f_locals.get("__tracebackhide__", False):
+        i -= 1
+    return i
+
+
+def post_mortem(t):
+
+    class Pdb(pytestPDB._pdb_cls):
+
+        def get_stack(self, f, t):
+            stack, i = pdb.Pdb.get_stack(self, f, t)
+            if f is None:
+                i = _find_last_non_hidden_frame(stack)
+            return stack, i
+
+    p = Pdb()
+    p.reset()
+    p.interaction(None, t)
new file mode 100644
--- /dev/null
+++ b/third_party/python/pytest/src/_pytest/deprecated.py
@@ -0,0 +1,65 @@
+"""
+This module contains deprecation messages and bits of code used elsewhere in the codebase
+that is planned to be removed in the next pytest release.
+
+Keeping it in a central location makes it easy to track what is deprecated and should
+be removed when the time comes.
+"""
+from __future__ import absolute_import, division, print_function
+
+
+class RemovedInPytest4Warning(DeprecationWarning):
+    """warning class for features removed in pytest 4.0"""
+
+
+MAIN_STR_ARGS = "passing a string to pytest.main() is deprecated, " "pass a list of arguments instead."
+
+YIELD_TESTS = "yield tests are deprecated, and scheduled to be removed in pytest 4.0"
+
+FUNCARG_PREFIX = (
+    '{name}: declaring fixtures using "pytest_funcarg__" prefix is deprecated '
+    "and scheduled to be removed in pytest 4.0.  "
+    "Please remove the prefix and use the @pytest.fixture decorator instead."
+)
+
+CFG_PYTEST_SECTION = "[pytest] section in {filename} files is deprecated, use [tool:pytest] instead."
+
+GETFUNCARGVALUE = "use of getfuncargvalue is deprecated, use getfixturevalue"
+
+RESULT_LOG = (
+    "--result-log is deprecated and scheduled for removal in pytest 4.0.\n"
+    "See https://docs.pytest.org/en/latest/usage.html#creating-resultlog-format-files for more information."
+)
+
+MARK_INFO_ATTRIBUTE = RemovedInPytest4Warning(
+    "MarkInfo objects are deprecated as they contain merged marks which are hard to deal with correctly.\n"
+    "Please use node.get_closest_marker(name) or node.iter_markers(name).\n"
+    "Docs: https://docs.pytest.org/en/latest/mark.html#updating-code"
+)
+
+MARK_PARAMETERSET_UNPACKING = RemovedInPytest4Warning(
+    "Applying marks directly to parameters is deprecated,"
+    " please use pytest.param(..., marks=...) instead.\n"
+    "For more details, see: https://docs.pytest.org/en/latest/parametrize.html"
+)
+
+RECORD_XML_PROPERTY = (
+    'Fixture renamed from "record_xml_property" to "record_property" as user '
+    "properties are now available to all reporters.\n"
+    '"record_xml_property" is now deprecated.'
+)
+
+COLLECTOR_MAKEITEM = RemovedInPytest4Warning(
+    "pycollector makeitem was removed " "as it is an accidentially leaked internal api"
+)
+
+METAFUNC_ADD_CALL = (
+    "Metafunc.addcall is deprecated and scheduled to be removed in pytest 4.0.\n"
+    "Please use Metafunc.parametrize instead."
+)
+
+PYTEST_PLUGINS_FROM_NON_TOP_LEVEL_CONFTEST = RemovedInPytest4Warning(
+    "Defining pytest_plugins in a non-top-level conftest is deprecated, "
+    "because it affects the entire directory tree in a non-explicit way.\n"
+    "Please move it to the top level conftest file instead."
+)
new file mode 100644
--- /dev/null
+++ b/third_party/python/pytest/src/_pytest/doctest.py
@@ -0,0 +1,520 @@
+""" discover and run doctests in modules and test files."""
+from __future__ import absolute_import, division, print_function
+
+import traceback
+import sys
+import platform
+
+import pytest
+from _pytest._code.code import ExceptionInfo, ReprFileLocation, TerminalRepr
+from _pytest.fixtures import FixtureRequest
+
+
+DOCTEST_REPORT_CHOICE_NONE = "none"
+DOCTEST_REPORT_CHOICE_CDIFF = "cdiff"
+DOCTEST_REPORT_CHOICE_NDIFF = "ndiff"
+DOCTEST_REPORT_CHOICE_UDIFF = "udiff"
+DOCTEST_REPORT_CHOICE_ONLY_FIRST_FAILURE = "only_first_failure"
+
+DOCTEST_REPORT_CHOICES = (
+    DOCTEST_REPORT_CHOICE_NONE,
+    DOCTEST_REPORT_CHOICE_CDIFF,
+    DOCTEST_REPORT_CHOICE_NDIFF,
+    DOCTEST_REPORT_CHOICE_UDIFF,
+    DOCTEST_REPORT_CHOICE_ONLY_FIRST_FAILURE,
+)
+
+# Lazy definition of runner class
+RUNNER_CLASS = None
+
+
+def pytest_addoption(parser):
+    parser.addini(
+        "doctest_optionflags",
+        "option flags for doctests",
+        type="args",
+        default=["ELLIPSIS"],
+    )
+    parser.addini(
+        "doctest_encoding", "encoding used for doctest files", default="utf-8"
+    )
+    group = parser.getgroup("collect")
+    group.addoption(
+        "--doctest-modules",
+        action="store_true",
+        default=False,
+        help="run doctests in all .py modules",
+        dest="doctestmodules",
+    )
+    group.addoption(
+        "--doctest-report",
+        type=str.lower,
+        default="udiff",
+        help="choose another output format for diffs on doctest failure",
+        choices=DOCTEST_REPORT_CHOICES,
+        dest="doctestreport",
+    )
+    group.addoption(
+        "--doctest-glob",
+        action="append",
+        default=[],
+        metavar="pat",
+        help="doctests file matching pattern, default: test*.txt",
+        dest="doctestglob",
+    )
+    group.addoption(
+        "--doctest-ignore-import-errors",
+        action="store_true",
+        default=False,
+        help="ignore doctest ImportErrors",
+        dest="doctest_ignore_import_errors",
+    )
+    group.addoption(
+        "--doctest-continue-on-failure",
+        action="store_true",
+        default=False,
+        help="for a given doctest, continue to run after the first failure",
+        dest="doctest_continue_on_failure",
+    )
+
+
+def pytest_collect_file(path, parent):
+    config = parent.config
+    if path.ext == ".py":
+        if config.option.doctestmodules and not _is_setup_py(config, path, parent):
+            return DoctestModule(path, parent)
+    elif _is_doctest(config, path, parent):
+        return DoctestTextfile(path, parent)
+
+
+def _is_setup_py(config, path, parent):
+    if path.basename != "setup.py":
+        return False
+    contents = path.read()
+    return "setuptools" in contents or "distutils" in contents
+
+
+def _is_doctest(config, path, parent):
+    if path.ext in (".txt", ".rst") and parent.session.isinitpath(path):
+        return True
+    globs = config.getoption("doctestglob") or ["test*.txt"]
+    for glob in globs:
+        if path.check(fnmatch=glob):
+            return True
+    return False
+
+
+class ReprFailDoctest(TerminalRepr):
+
+    def __init__(self, reprlocation_lines):
+        # List of (reprlocation, lines) tuples
+        self.reprlocation_lines = reprlocation_lines
+
+    def toterminal(self, tw):
+        for reprlocation, lines in self.reprlocation_lines:
+            for line in lines:
+                tw.line(line)
+            reprlocation.toterminal(tw)
+
+
+class MultipleDoctestFailures(Exception):
+
+    def __init__(self, failures):
+        super(MultipleDoctestFailures, self).__init__()
+        self.failures = failures
+
+
+def _init_runner_class():
+    import doctest
+
+    class PytestDoctestRunner(doctest.DebugRunner):
+        """
+        Runner to collect failures.  Note that the out variable in this case is
+        a list instead of a stdout-like object
+        """
+
+        def __init__(
+            self, checker=None, verbose=None, optionflags=0, continue_on_failure=True
+        ):
+            doctest.DebugRunner.__init__(
+                self, checker=checker, verbose=verbose, optionflags=optionflags
+            )
+            self.continue_on_failure = continue_on_failure
+
+        def report_failure(self, out, test, example, got):
+            failure = doctest.DocTestFailure(test, example, got)
+            if self.continue_on_failure:
+                out.append(failure)
+            else:
+                raise failure
+
+        def report_unexpected_exception(self, out, test, example, exc_info):
+            failure = doctest.UnexpectedException(test, example, exc_info)
+            if self.continue_on_failure:
+                out.append(failure)
+            else:
+                raise failure
+
+    return PytestDoctestRunner
+
+
+def _get_runner(checker=None, verbose=None, optionflags=0, continue_on_failure=True):
+    # We need this in order to do a lazy import on doctest
+    global RUNNER_CLASS
+    if RUNNER_CLASS is None:
+        RUNNER_CLASS = _init_runner_class()
+    return RUNNER_CLASS(
+        checker=checker,
+        verbose=verbose,
+        optionflags=optionflags,
+        continue_on_failure=continue_on_failure,
+    )
+
+
+class DoctestItem(pytest.Item):
+
+    def __init__(self, name, parent, runner=None, dtest=None):
+        super(DoctestItem, self).__init__(name, parent)
+        self.runner = runner
+        self.dtest = dtest
+        self.obj = None
+        self.fixture_request = None
+
+    def setup(self):
+        if self.dtest is not None:
+            self.fixture_request = _setup_fixtures(self)
+            globs = dict(getfixture=self.fixture_request.getfixturevalue)
+            for name, value in self.fixture_request.getfixturevalue(
+                "doctest_namespace"
+            ).items():
+                globs[name] = value
+            self.dtest.globs.update(globs)
+
+    def runtest(self):
+        _check_all_skipped(self.dtest)
+        self._disable_output_capturing_for_darwin()
+        failures = []
+        self.runner.run(self.dtest, out=failures)
+        if failures:
+            raise MultipleDoctestFailures(failures)
+
+    def _disable_output_capturing_for_darwin(self):
+        """
+        Disable output capturing. Otherwise, stdout is lost to doctest (#985)
+        """
+        if platform.system() != "Darwin":
+            return
+        capman = self.config.pluginmanager.getplugin("capturemanager")
+        if capman:
+            out, err = capman.suspend_global_capture(in_=True)
+            sys.stdout.write(out)
+            sys.stderr.write(err)
+
+    def repr_failure(self, excinfo):
+        import doctest
+
+        failures = None
+        if excinfo.errisinstance((doctest.DocTestFailure, doctest.UnexpectedException)):
+            failures = [excinfo.value]
+        elif excinfo.errisinstance(MultipleDoctestFailures):
+            failures = excinfo.value.failures
+
+        if failures is not None:
+            reprlocation_lines = []
+            for failure in failures:
+                example = failure.example
+                test = failure.test
+                filename = test.filename
+                if test.lineno is None:
+                    lineno = None
+                else:
+                    lineno = test.lineno + example.lineno + 1
+                message = type(failure).__name__
+                reprlocation = ReprFileLocation(filename, lineno, message)
+                checker = _get_checker()
+                report_choice = _get_report_choice(
+                    self.config.getoption("doctestreport")
+                )
+                if lineno is not None:
+                    lines = failure.test.docstring.splitlines(False)
+                    # add line numbers to the left of the error message
+                    lines = [
+                        "%03d %s" % (i + test.lineno + 1, x)
+                        for (i, x) in enumerate(lines)
+                    ]
+                    # trim docstring error lines to 10
+                    lines = lines[max(example.lineno - 9, 0):example.lineno + 1]
+                else:
+                    lines = [
+                        "EXAMPLE LOCATION UNKNOWN, not showing all tests of that example"
+                    ]
+                    indent = ">>>"
+                    for line in example.source.splitlines():
+                        lines.append("??? %s %s" % (indent, line))
+                        indent = "..."
+                if isinstance(failure, doctest.DocTestFailure):
+                    lines += checker.output_difference(
+                        example, failure.got, report_choice
+                    ).split(
+                        "\n"
+                    )
+                else:
+                    inner_excinfo = ExceptionInfo(failure.exc_info)
+                    lines += ["UNEXPECTED EXCEPTION: %s" % repr(inner_excinfo.value)]
+                    lines += traceback.format_exception(*failure.exc_info)
+                reprlocation_lines.append((reprlocation, lines))
+            return ReprFailDoctest(reprlocation_lines)
+        else:
+            return super(DoctestItem, self).repr_failure(excinfo)
+
+    def reportinfo(self):
+        return self.fspath, self.dtest.lineno, "[doctest] %s" % self.name
+
+
+def _get_flag_lookup():
+    import doctest
+
+    return dict(
+        DONT_ACCEPT_TRUE_FOR_1=doctest.DONT_ACCEPT_TRUE_FOR_1,
+        DONT_ACCEPT_BLANKLINE=doctest.DONT_ACCEPT_BLANKLINE,
+        NORMALIZE_WHITESPACE=doctest.NORMALIZE_WHITESPACE,
+        ELLIPSIS=doctest.ELLIPSIS,
+        IGNORE_EXCEPTION_DETAIL=doctest.IGNORE_EXCEPTION_DETAIL,
+        COMPARISON_FLAGS=doctest.COMPARISON_FLAGS,
+        ALLOW_UNICODE=_get_allow_unicode_flag(),
+        ALLOW_BYTES=_get_allow_bytes_flag(),
+    )
+
+
+def get_optionflags(parent):
+    optionflags_str = parent.config.getini("doctest_optionflags")
+    flag_lookup_table = _get_flag_lookup()
+    flag_acc = 0
+    for flag in optionflags_str:
+        flag_acc |= flag_lookup_table[flag]
+    return flag_acc
+
+
+def _get_continue_on_failure(config):
+    continue_on_failure = config.getvalue("doctest_continue_on_failure")
+    if continue_on_failure:
+        # We need to turn off this if we use pdb since we should stop at
+        # the first failure
+        if config.getvalue("usepdb"):
+            continue_on_failure = False
+    return continue_on_failure
+
+
+class DoctestTextfile(pytest.Module):
+    obj = None
+
+    def collect(self):
+        import doctest
+
+        # inspired by doctest.testfile; ideally we would use it directly,
+        # but it doesn't support passing a custom checker
+        encoding = self.config.getini("doctest_encoding")
+        text = self.fspath.read_text(encoding)
+        filename = str(self.fspath)
+        name = self.fspath.basename
+        globs = {"__name__": "__main__"}
+
+        optionflags = get_optionflags(self)
+
+        runner = _get_runner(
+            verbose=0,
+            optionflags=optionflags,
+            checker=_get_checker(),
+            continue_on_failure=_get_continue_on_failure(self.config),
+        )
+        _fix_spoof_python2(runner, encoding)
+
+        parser = doctest.DocTestParser()
+        test = parser.get_doctest(text, globs, name, filename, 0)
+        if test.examples:
+            yield DoctestItem(test.name, self, runner, test)
+
+
+def _check_all_skipped(test):
+    """raises pytest.skip() if all examples in the given DocTest have the SKIP
+    option set.
+    """
+    import doctest
+
+    all_skipped = all(x.options.get(doctest.SKIP, False) for x in test.examples)
+    if all_skipped:
+        pytest.skip("all tests skipped by +SKIP option")
+
+
+class DoctestModule(pytest.Module):
+
+    def collect(self):
+        import doctest
+
+        if self.fspath.basename == "conftest.py":
+            module = self.config.pluginmanager._importconftest(self.fspath)
+        else:
+            try:
+                module = self.fspath.pyimport()
+            except ImportError:
+                if self.config.getvalue("doctest_ignore_import_errors"):
+                    pytest.skip("unable to import module %r" % self.fspath)
+                else:
+                    raise
+        # uses internal doctest module parsing mechanism
+        finder = doctest.DocTestFinder()
+        optionflags = get_optionflags(self)
+        runner = _get_runner(
+            verbose=0,
+            optionflags=optionflags,
+            checker=_get_checker(),
+            continue_on_failure=_get_continue_on_failure(self.config),
+        )
+
+        for test in finder.find(module, module.__name__):
+            if test.examples:  # skip empty doctests
+                yield DoctestItem(test.name, self, runner, test)
+
+
+def _setup_fixtures(doctest_item):
+    """
+    Used by DoctestTextfile and DoctestItem to setup fixture information.
+    """
+
+    def func():
+        pass
+
+    doctest_item.funcargs = {}
+    fm = doctest_item.session._fixturemanager
+    doctest_item._fixtureinfo = fm.getfixtureinfo(
+        node=doctest_item, func=func, cls=None, funcargs=False
+    )
+    fixture_request = FixtureRequest(doctest_item)
+    fixture_request._fillfixtures()
+    return fixture_request
+
+
+def _get_checker():
+    """
+    Returns a doctest.OutputChecker subclass that takes in account the
+    ALLOW_UNICODE option to ignore u'' prefixes in strings and ALLOW_BYTES
+    to strip b'' prefixes.
+    Useful when the same doctest should run in Python 2 and Python 3.
+
+    An inner class is used to avoid importing "doctest" at the module
+    level.
+    """
+    if hasattr(_get_checker, "LiteralsOutputChecker"):
+        return _get_checker.LiteralsOutputChecker()
+
+    import doctest
+    import re
+
+    class LiteralsOutputChecker(doctest.OutputChecker):
+        """
+        Copied from doctest_nose_plugin.py from the nltk project:
+            https://github.com/nltk/nltk
+
+        Further extended to also support byte literals.
+        """
+
+        _unicode_literal_re = re.compile(r"(\W|^)[uU]([rR]?[\'\"])", re.UNICODE)
+        _bytes_literal_re = re.compile(r"(\W|^)[bB]([rR]?[\'\"])", re.UNICODE)
+
+        def check_output(self, want, got, optionflags):
+            res = doctest.OutputChecker.check_output(self, want, got, optionflags)
+            if res:
+                return True
+
+            allow_unicode = optionflags & _get_allow_unicode_flag()
+            allow_bytes = optionflags & _get_allow_bytes_flag()
+            if not allow_unicode and not allow_bytes:
+                return False
+
+            else:  # pragma: no cover
+
+                def remove_prefixes(regex, txt):
+                    return re.sub(regex, r"\1\2", txt)
+
+                if allow_unicode:
+                    want = remove_prefixes(self._unicode_literal_re, want)
+                    got = remove_prefixes(self._unicode_literal_re, got)
+                if allow_bytes:
+                    want = remove_prefixes(self._bytes_literal_re, want)
+                    got = remove_prefixes(self._bytes_literal_re, got)
+                res = doctest.OutputChecker.check_output(self, want, got, optionflags)
+                return res
+
+    _get_checker.LiteralsOutputChecker = LiteralsOutputChecker
+    return _get_checker.LiteralsOutputChecker()
+
+
+def _get_allow_unicode_flag():
+    """
+    Registers and returns the ALLOW_UNICODE flag.
+    """
+    import doctest
+
+    return doctest.register_optionflag("ALLOW_UNICODE")
+
+
+def _get_allow_bytes_flag():
+    """
+    Registers and returns the ALLOW_BYTES flag.
+    """
+    import doctest
+
+    return doctest.register_optionflag("ALLOW_BYTES")
+
+
+def _get_report_choice(key):
+    """
+    This function returns the actual `doctest` module flag value, we want to do it as late as possible to avoid
+    importing `doctest` and all its dependencies when parsing options, as it adds overhead and breaks tests.
+    """
+    import doctest
+
+    return {
+        DOCTEST_REPORT_CHOICE_UDIFF: doctest.REPORT_UDIFF,
+        DOCTEST_REPORT_CHOICE_CDIFF: doctest.REPORT_CDIFF,
+        DOCTEST_REPORT_CHOICE_NDIFF: doctest.REPORT_NDIFF,
+        DOCTEST_REPORT_CHOICE_ONLY_FIRST_FAILURE: doctest.REPORT_ONLY_FIRST_FAILURE,
+        DOCTEST_REPORT_CHOICE_NONE: 0,
+    }[
+        key
+    ]
+
+
+def _fix_spoof_python2(runner, encoding):
+    """
+    Installs a "SpoofOut" into the given DebugRunner so it properly deals with unicode output. This
+    should patch only doctests for text files because they don't have a way to declare their
+    encoding. Doctests in docstrings from Python modules don't have the same problem given that
+    Python already decoded the strings.
+
+    This fixes the problem related in issue #2434.
+    """
+    from _pytest.compat import _PY2
+
+    if not _PY2:
+        return
+
+    from doctest import _SpoofOut
+
+    class UnicodeSpoof(_SpoofOut):
+
+        def getvalue(self):
+            result = _SpoofOut.getvalue(self)
+            if encoding and isinstance(result, bytes):
+                result = result.decode(encoding)
+            return result
+
+    runner._fakeout = UnicodeSpoof()
+
+
+@pytest.fixture(scope="session")
+def doctest_namespace():
+    """
+    Fixture that returns a :py:class:`dict` that will be injected into the namespace of doctests.
+    """
+    return dict()
new file mode 100644
--- /dev/null
+++ b/third_party/python/pytest/src/_pytest/fixtures.py
@@ -0,0 +1,1229 @@
+from __future__ import absolute_import, division, print_function
+
+import functools
+import inspect
+import sys
+import warnings
+from collections import OrderedDict, deque, defaultdict
+from more_itertools import flatten
+
+import attr
+import py
+from py._code.code import FormattedExcinfo
+
+import _pytest
+from _pytest import nodes
+from _pytest._code.code import TerminalRepr
+from _pytest.compat import (
+    NOTSET,
+    exc_clear,
+    _format_args,
+    getfslineno,
+    get_real_func,
+    is_generator,
+    isclass,
+    getimfunc,
+    getlocation,
+    getfuncargnames,
+    safe_getattr,
+    FuncargnamesCompatAttr,
+)
+from _pytest.outcomes import fail, TEST_OUTCOME
+
+FIXTURE_MSG = 'fixtures cannot have "pytest_funcarg__" prefix and be decorated with @pytest.fixture:\n{}'
+
+
+@attr.s(frozen=True)
+class PseudoFixtureDef(object):
+    cached_result = attr.ib()
+    scope = attr.ib()
+
+
+def pytest_sessionstart(session):
+    import _pytest.python
+    import _pytest.nodes
+
+    scopename2class.update(
+        {
+            "class": _pytest.python.Class,
+            "module": _pytest.python.Module,
+            "function": _pytest.nodes.Item,
+            "session": _pytest.main.Session,
+        }
+    )
+    session._fixturemanager = FixtureManager(session)
+
+
+scopename2class = {}
+
+
+scope2props = dict(session=())
+scope2props["module"] = ("fspath", "module")
+scope2props["class"] = scope2props["module"] + ("cls",)
+scope2props["instance"] = scope2props["class"] + ("instance",)
+scope2props["function"] = scope2props["instance"] + ("function", "keywords")
+
+
+def scopeproperty(name=None, doc=None):
+
+    def decoratescope(func):
+        scopename = name or func.__name__
+
+        def provide(self):
+            if func.__name__ in scope2props[self.scope]:
+                return func(self)
+            raise AttributeError(
+                "%s not available in %s-scoped context" % (scopename, self.scope)
+            )
+
+        return property(provide, None, None, func.__doc__)
+
+    return decoratescope
+
+
+def get_scope_node(node, scope):
+    cls = scopename2class.get(scope)
+    if cls is None:
+        raise ValueError("unknown scope")
+    return node.getparent(cls)
+
+
+def add_funcarg_pseudo_fixture_def(collector, metafunc, fixturemanager):
+    # this function will transform all collected calls to a functions
+    # if they use direct funcargs (i.e. direct parametrization)
+    # because we want later test execution to be able to rely on
+    # an existing FixtureDef structure for all arguments.
+    # XXX we can probably avoid this algorithm  if we modify CallSpec2
+    # to directly care for creating the fixturedefs within its methods.
+    if not metafunc._calls[0].funcargs:
+        return  # this function call does not have direct parametrization
+    # collect funcargs of all callspecs into a list of values
+    arg2params = {}
+    arg2scope = {}
+    for callspec in metafunc._calls:
+        for argname, argvalue in callspec.funcargs.items():
+            assert argname not in callspec.params
+            callspec.params[argname] = argvalue
+            arg2params_list = arg2params.setdefault(argname, [])
+            callspec.indices[argname] = len(arg2params_list)
+            arg2params_list.append(argvalue)
+            if argname not in arg2scope:
+                scopenum = callspec._arg2scopenum.get(argname, scopenum_function)
+                arg2scope[argname] = scopes[scopenum]
+        callspec.funcargs.clear()
+
+    # register artificial FixtureDef's so that later at test execution
+    # time we can rely on a proper FixtureDef to exist for fixture setup.
+    arg2fixturedefs = metafunc._arg2fixturedefs
+    for argname, valuelist in arg2params.items():
+        # if we have a scope that is higher than function we need
+        # to make sure we only ever create an according fixturedef on
+        # a per-scope basis. We thus store and cache the fixturedef on the
+        # node related to the scope.
+        scope = arg2scope[argname]
+        node = None
+        if scope != "function":
+            node = get_scope_node(collector, scope)
+            if node is None:
+                assert scope == "class" and isinstance(collector, _pytest.python.Module)
+                # use module-level collector for class-scope (for now)
+                node = collector
+        if node and argname in node._name2pseudofixturedef:
+            arg2fixturedefs[argname] = [node._name2pseudofixturedef[argname]]
+        else:
+            fixturedef = FixtureDef(
+                fixturemanager,
+                "",
+                argname,
+                get_direct_param_fixture_func,
+                arg2scope[argname],
+                valuelist,
+                False,
+                False,
+            )
+            arg2fixturedefs[argname] = [fixturedef]
+            if node is not None:
+                node._name2pseudofixturedef[argname] = fixturedef
+
+
+def getfixturemarker(obj):
+    """ return fixturemarker or None if it doesn't exist or raised
+    exceptions."""
+    try:
+        return getattr(obj, "_pytestfixturefunction", None)
+    except TEST_OUTCOME:
+        # some objects raise errors like request (from flask import request)
+        # we don't expect them to be fixture functions
+        return None
+
+
+def get_parametrized_fixture_keys(item, scopenum):
+    """ return list of keys for all parametrized arguments which match
+    the specified scope. """
+    assert scopenum < scopenum_function  # function
+    try:
+        cs = item.callspec
+    except AttributeError:
+        pass
+    else:
+        # cs.indices.items() is random order of argnames.  Need to
+        # sort this so that different calls to
+        # get_parametrized_fixture_keys will be deterministic.
+        for argname, param_index in sorted(cs.indices.items()):
+            if cs._arg2scopenum[argname] != scopenum:
+                continue
+            if scopenum == 0:  # session
+                key = (argname, param_index)
+            elif scopenum == 1:  # module
+                key = (argname, param_index, item.fspath)
+            elif scopenum == 2:  # class
+                key = (argname, param_index, item.fspath, item.cls)
+            yield key
+
+
+# algorithm for sorting on a per-parametrized resource setup basis
+# it is called for scopenum==0 (session) first and performs sorting
+# down to the lower scopes such as to minimize number of "high scope"
+# setups and teardowns
+
+
+def reorder_items(items):
+    argkeys_cache = {}
+    items_by_argkey = {}
+    for scopenum in range(0, scopenum_function):
+        argkeys_cache[scopenum] = d = {}
+        items_by_argkey[scopenum] = item_d = defaultdict(deque)
+        for item in items:
+            keys = OrderedDict.fromkeys(get_parametrized_fixture_keys(item, scopenum))
+            if keys:
+                d[item] = keys
+                for key in keys:
+                    item_d[key].append(item)
+    items = OrderedDict.fromkeys(items)
+    return list(reorder_items_atscope(items, argkeys_cache, items_by_argkey, 0))
+
+
+def fix_cache_order(item, argkeys_cache, items_by_argkey):
+    for scopenum in range(0, scopenum_function):
+        for key in argkeys_cache[scopenum].get(item, []):
+            items_by_argkey[scopenum][key].appendleft(item)
+
+
+def reorder_items_atscope(items, argkeys_cache, items_by_argkey, scopenum):
+    if scopenum >= scopenum_function or len(items) < 3:
+        return items
+    ignore = set()
+    items_deque = deque(items)
+    items_done = OrderedDict()
+    scoped_items_by_argkey = items_by_argkey[scopenum]
+    scoped_argkeys_cache = argkeys_cache[scopenum]
+    while items_deque:
+        no_argkey_group = OrderedDict()
+        slicing_argkey = None
+        while items_deque:
+            item = items_deque.popleft()
+            if item in items_done or item in no_argkey_group:
+                continue
+            argkeys = OrderedDict.fromkeys(
+                k for k in scoped_argkeys_cache.get(item, []) if k not in ignore
+            )
+            if not argkeys:
+                no_argkey_group[item] = None
+            else:
+                slicing_argkey, _ = argkeys.popitem()
+                # we don't have to remove relevant items from later in the deque because they'll just be ignored
+                matching_items = [
+                    i for i in scoped_items_by_argkey[slicing_argkey] if i in items
+                ]
+                for i in reversed(matching_items):
+                    fix_cache_order(i, argkeys_cache, items_by_argkey)
+                    items_deque.appendleft(i)
+                break
+        if no_argkey_group:
+            no_argkey_group = reorder_items_atscope(
+                no_argkey_group, argkeys_cache, items_by_argkey, scopenum + 1
+            )
+            for item in no_argkey_group:
+                items_done[item] = None
+        ignore.add(slicing_argkey)
+    return items_done
+
+
+def fillfixtures(function):
+    """ fill missing funcargs for a test function. """
+    try:
+        request = function._request
+    except AttributeError:
+        # XXX this special code path is only expected to execute
+        # with the oejskit plugin.  It uses classes with funcargs
+        # and we thus have to work a bit to allow this.
+        fm = function.session._fixturemanager
+        fi = fm.getfixtureinfo(function.parent, function.obj, None)
+        function._fixtureinfo = fi
+        request = function._request = FixtureRequest(function)
+        request._fillfixtures()
+        # prune out funcargs for jstests
+        newfuncargs = {}
+        for name in fi.argnames:
+            newfuncargs[name] = function.funcargs[name]
+        function.funcargs = newfuncargs
+    else:
+        request._fillfixtures()
+
+
+def get_direct_param_fixture_func(request):
+    return request.param
+
+
+class FuncFixtureInfo(object):
+
+    def __init__(self, argnames, names_closure, name2fixturedefs):
+        self.argnames = argnames
+        self.names_closure = names_closure
+        self.name2fixturedefs = name2fixturedefs
+
+
+class FixtureRequest(FuncargnamesCompatAttr):
+    """ A request for a fixture from a test or fixture function.
+
+    A request object gives access to the requesting test context
+    and has an optional ``param`` attribute in case
+    the fixture is parametrized indirectly.
+    """
+
+    def __init__(self, pyfuncitem):
+        self._pyfuncitem = pyfuncitem
+        #: fixture for which this request is being performed
+        self.fixturename = None
+        #: Scope string, one of "function", "class", "module", "session"
+        self.scope = "function"
+        self._fixture_defs = {}  # argname -> FixtureDef
+        fixtureinfo = pyfuncitem._fixtureinfo
+        self._arg2fixturedefs = fixtureinfo.name2fixturedefs.copy()
+        self._arg2index = {}
+        self._fixturemanager = pyfuncitem.session._fixturemanager
+
+    @property
+    def fixturenames(self):
+        # backward incompatible note: now a readonly property
+        return list(self._pyfuncitem._fixtureinfo.names_closure)
+
+    @property
+    def node(self):
+        """ underlying collection node (depends on current request scope)"""
+        return self._getscopeitem(self.scope)
+
+    def _getnextfixturedef(self, argname):
+        fixturedefs = self._arg2fixturedefs.get(argname, None)
+        if fixturedefs is None:
+            # we arrive here because of a dynamic call to
+            # getfixturevalue(argname) usage which was naturally
+            # not known at parsing/collection time
+            parentid = self._pyfuncitem.parent.nodeid
+            fixturedefs = self._fixturemanager.getfixturedefs(argname, parentid)
+            self._arg2fixturedefs[argname] = fixturedefs
+        # fixturedefs list is immutable so we maintain a decreasing index
+        index = self._arg2index.get(argname, 0) - 1
+        if fixturedefs is None or (-index > len(fixturedefs)):
+            raise FixtureLookupError(argname, self)
+        self._arg2index[argname] = index
+        return fixturedefs[index]
+
+    @property
+    def config(self):
+        """ the pytest config object associated with this request. """
+        return self._pyfuncitem.config
+
+    @scopeproperty()
+    def function(self):
+        """ test function object if the request has a per-function scope. """
+        return self._pyfuncitem.obj
+
+    @scopeproperty("class")
+    def cls(self):
+        """ class (can be None) where the test function was collected. """
+        clscol = self._pyfuncitem.getparent(_pytest.python.Class)
+        if clscol:
+            return clscol.obj
+
+    @property
+    def instance(self):
+        """ instance (can be None) on which test function was collected. """
+        # unittest support hack, see _pytest.unittest.TestCaseFunction
+        try:
+            return self._pyfuncitem._testcase
+        except AttributeError:
+            function = getattr(self, "function", None)
+            return getattr(function, "__self__", None)
+
+    @scopeproperty()
+    def module(self):
+        """ python module object where the test function was collected. """
+        return self._pyfuncitem.getparent(_pytest.python.Module).obj
+
+    @scopeproperty()
+    def fspath(self):
+        """ the file system path of the test module which collected this test. """
+        return self._pyfuncitem.fspath
+
+    @property
+    def keywords(self):
+        """ keywords/markers dictionary for the underlying node. """
+        return self.node.keywords
+
+    @property
+    def session(self):
+        """ pytest session object. """
+        return self._pyfuncitem.session
+
+    def addfinalizer(self, finalizer):
+        """ add finalizer/teardown function to be called after the
+        last test within the requesting test context finished
+        execution. """
+        # XXX usually this method is shadowed by fixturedef specific ones
+        self._addfinalizer(finalizer, scope=self.scope)
+
+    def _addfinalizer(self, finalizer, scope):
+        colitem = self._getscopeitem(scope)
+        self._pyfuncitem.session._setupstate.addfinalizer(
+            finalizer=finalizer, colitem=colitem
+        )
+
+    def applymarker(self, marker):
+        """ Apply a marker to a single test function invocation.
+        This method is useful if you don't want to have a keyword/marker
+        on all function invocations.
+
+        :arg marker: a :py:class:`_pytest.mark.MarkDecorator` object
+            created by a call to ``pytest.mark.NAME(...)``.
+        """
+        self.node.add_marker(marker)
+
+    def raiseerror(self, msg):
+        """ raise a FixtureLookupError with the given message. """
+        raise self._fixturemanager.FixtureLookupError(None, self, msg)
+
+    def _fillfixtures(self):
+        item = self._pyfuncitem
+        fixturenames = getattr(item, "fixturenames", self.fixturenames)
+        for argname in fixturenames:
+            if argname not in item.funcargs:
+                item.funcargs[argname] = self.getfixturevalue(argname)
+
+    def cached_setup(self, setup, teardown=None, scope="module", extrakey=None):
+        """ (deprecated) Return a testing resource managed by ``setup`` &
+        ``teardown`` calls.  ``scope`` and ``extrakey`` determine when the
+        ``teardown`` function will be called so that subsequent calls to
+        ``setup`` would recreate the resource.  With pytest-2.3 you often
+        do not need ``cached_setup()`` as you can directly declare a scope
+        on a fixture function and register a finalizer through
+        ``request.addfinalizer()``.
+
+        :arg teardown: function receiving a previously setup resource.
+        :arg setup: a no-argument function creating a resource.
+        :arg scope: a string value out of ``function``, ``class``, ``module``
+            or ``session`` indicating the caching lifecycle of the resource.
+        :arg extrakey: added to internal caching key of (funcargname, scope).
+        """
+        if not hasattr(self.config, "_setupcache"):
+            self.config._setupcache = {}  # XXX weakref?
+        cachekey = (self.fixturename, self._getscopeitem(scope), extrakey)
+        cache = self.config._setupcache
+        try:
+            val = cache[cachekey]
+        except KeyError:
+            self._check_scope(self.fixturename, self.scope, scope)
+            val = setup()
+            cache[cachekey] = val
+            if teardown is not None:
+
+                def finalizer():
+                    del cache[cachekey]
+                    teardown(val)
+
+                self._addfinalizer(finalizer, scope=scope)
+        return val
+
+    def getfixturevalue(self, argname):
+        """ Dynamically run a named fixture function.
+
+        Declaring fixtures via function argument is recommended where possible.
+        But if you can only decide whether to use another fixture at test
+        setup time, you may use this function to retrieve it inside a fixture
+        or test function body.
+        """
+        return self._get_active_fixturedef(argname).cached_result[0]
+
+    def getfuncargvalue(self, argname):
+        """ Deprecated, use getfixturevalue. """
+        from _pytest import deprecated
+
+        warnings.warn(deprecated.GETFUNCARGVALUE, DeprecationWarning, stacklevel=2)
+        return self.getfixturevalue(argname)
+
+    def _get_active_fixturedef(self, argname):
+        try:
+            return self._fixture_defs[argname]
+        except KeyError:
+            try:
+                fixturedef = self._getnextfixturedef(argname)
+            except FixtureLookupError:
+                if argname == "request":
+                    cached_result = (self, [0], None)
+                    scope = "function"
+                    return PseudoFixtureDef(cached_result, scope)
+                raise
+        # remove indent to prevent the python3 exception
+        # from leaking into the call
+        self._compute_fixture_value(fixturedef)
+        self._fixture_defs[argname] = fixturedef
+        return fixturedef
+
+    def _get_fixturestack(self):
+        current = self
+        values = []
+        while 1:
+            fixturedef = getattr(current, "_fixturedef", None)
+            if fixturedef is None:
+                values.reverse()
+                return values
+            values.append(fixturedef)
+            current = current._parent_request
+
+    def _compute_fixture_value(self, fixturedef):
+        """
+        Creates a SubRequest based on "self" and calls the execute method of the given fixturedef object. This will
+        force the FixtureDef object to throw away any previous results and compute a new fixture value, which
+        will be stored into the FixtureDef object itself.
+
+        :param FixtureDef fixturedef:
+        """
+        # prepare a subrequest object before calling fixture function
+        # (latter managed by fixturedef)
+        argname = fixturedef.argname
+        funcitem = self._pyfuncitem
+        scope = fixturedef.scope
+        try:
+            param = funcitem.callspec.getparam(argname)
+        except (AttributeError, ValueError):
+            param = NOTSET
+            param_index = 0
+            if fixturedef.params is not None:
+                frame = inspect.stack()[3]
+                frameinfo = inspect.getframeinfo(frame[0])
+                source_path = frameinfo.filename
+                source_lineno = frameinfo.lineno
+                source_path = py.path.local(source_path)
+                if source_path.relto(funcitem.config.rootdir):
+                    source_path = source_path.relto(funcitem.config.rootdir)
+                msg = (
+                    "The requested fixture has no parameter defined for the "
+                    "current test.\n\nRequested fixture '{}' defined in:\n{}"
+                    "\n\nRequested here:\n{}:{}".format(
+                        fixturedef.argname,
+                        getlocation(fixturedef.func, funcitem.config.rootdir),
+                        source_path,
+                        source_lineno,
+                    )
+                )
+                fail(msg)
+        else:
+            # indices might not be set if old-style metafunc.addcall() was used
+            param_index = funcitem.callspec.indices.get(argname, 0)
+            # if a parametrize invocation set a scope it will override
+            # the static scope defined with the fixture function
+            paramscopenum = funcitem.callspec._arg2scopenum.get(argname)
+            if paramscopenum is not None:
+                scope = scopes[paramscopenum]
+
+        subrequest = SubRequest(self, scope, param, param_index, fixturedef)
+
+        # check if a higher-level scoped fixture accesses a lower level one
+        subrequest._check_scope(argname, self.scope, scope)
+
+        # clear sys.exc_info before invoking the fixture (python bug?)
+        # if its not explicitly cleared it will leak into the call
+        exc_clear()
+        try:
+            # call the fixture function
+            fixturedef.execute(request=subrequest)
+        finally:
+            # if fixture function failed it might have registered finalizers
+            self.session._setupstate.addfinalizer(
+                functools.partial(fixturedef.finish, request=subrequest),
+                subrequest.node,
+            )
+
+    def _check_scope(self, argname, invoking_scope, requested_scope):
+        if argname == "request":
+            return
+        if scopemismatch(invoking_scope, requested_scope):
+            # try to report something helpful
+            lines = self._factorytraceback()
+            fail(
+                "ScopeMismatch: You tried to access the %r scoped "
+                "fixture %r with a %r scoped request object, "
+                "involved factories\n%s"
+                % ((requested_scope, argname, invoking_scope, "\n".join(lines))),
+                pytrace=False,
+            )
+
+    def _factorytraceback(self):
+        lines = []
+        for fixturedef in self._get_fixturestack():
+            factory = fixturedef.func
+            fs, lineno = getfslineno(factory)
+            p = self._pyfuncitem.session.fspath.bestrelpath(fs)
+            args = _format_args(factory)
+            lines.append("%s:%d:  def %s%s" % (p, lineno, factory.__name__, args))
+        return lines
+
+    def _getscopeitem(self, scope):
+        if scope == "function":
+            # this might also be a non-function Item despite its attribute name
+            return self._pyfuncitem
+        node = get_scope_node(self._pyfuncitem, scope)
+        if node is None and scope == "class":
+            # fallback to function item itself
+            node = self._pyfuncitem
+        assert node, 'Could not obtain a node for scope "{}" for function {!r}'.format(
+            scope, self._pyfuncitem
+        )
+        return node
+
+    def __repr__(self):
+        return "<FixtureRequest for %r>" % (self.node)
+
+
+class SubRequest(FixtureRequest):
+    """ a sub request for handling getting a fixture from a
+    test function/fixture. """
+
+    def __init__(self, request, scope, param, param_index, fixturedef):
+        self._parent_request = request
+        self.fixturename = fixturedef.argname
+        if param is not NOTSET:
+            self.param = param
+        self.param_index = param_index
+        self.scope = scope
+        self._fixturedef = fixturedef
+        self._pyfuncitem = request._pyfuncitem
+        self._fixture_defs = request._fixture_defs
+        self._arg2fixturedefs = request._arg2fixturedefs
+        self._arg2index = request._arg2index
+        self._fixturemanager = request._fixturemanager
+
+    def __repr__(self):
+        return "<SubRequest %r for %r>" % (self.fixturename, self._pyfuncitem)
+
+    def addfinalizer(self, finalizer):
+        self._fixturedef.addfinalizer(finalizer)
+
+
+class ScopeMismatchError(Exception):
+    """ A fixture function tries to use a different fixture function which
+    which has a lower scope (e.g. a Session one calls a function one)
+    """
+
+
+scopes = "session module class function".split()
+scopenum_function = scopes.index("function")
+
+
+def scopemismatch(currentscope, newscope):
+    return scopes.index(newscope) > scopes.index(currentscope)
+
+
+def scope2index(scope, descr, where=None):
+    """Look up the index of ``scope`` and raise a descriptive value error
+    if not defined.
+    """
+    try:
+        return scopes.index(scope)
+    except ValueError:
+        raise ValueError(
+            "{} {}has an unsupported scope value '{}'".format(
+                descr, "from {} ".format(where) if where else "", scope
+            )
+        )
+
+
+class FixtureLookupError(LookupError):
+    """ could not return a requested Fixture (missing or invalid). """
+
+    def __init__(self, argname, request, msg=None):
+        self.argname = argname
+        self.request = request
+        self.fixturestack = request._get_fixturestack()
+        self.msg = msg
+
+    def formatrepr(self):
+        tblines = []
+        addline = tblines.append
+        stack = [self.request._pyfuncitem.obj]
+        stack.extend(map(lambda x: x.func, self.fixturestack))
+        msg = self.msg
+        if msg is not None:
+            # the last fixture raise an error, let's present
+            # it at the requesting side
+            stack = stack[:-1]
+        for function in stack:
+            fspath, lineno = getfslineno(function)
+            try:
+                lines, _ = inspect.getsourcelines(get_real_func(function))
+            except (IOError, IndexError, TypeError):
+                error_msg = "file %s, line %s: source code not available"
+                addline(error_msg % (fspath, lineno + 1))
+            else:
+                addline("file %s, line %s" % (fspath, lineno + 1))
+                for i, line in enumerate(lines):
+                    line = line.rstrip()
+                    addline("  " + line)
+                    if line.lstrip().startswith("def"):
+                        break
+
+        if msg is None:
+            fm = self.request._fixturemanager
+            available = []
+            parentid = self.request._pyfuncitem.parent.nodeid
+            for name, fixturedefs in fm._arg2fixturedefs.items():
+                faclist = list(fm._matchfactories(fixturedefs, parentid))
+                if faclist and name not in available:
+                    available.append(name)
+            msg = "fixture %r not found" % (self.argname,)
+            msg += "\n available fixtures: %s" % (", ".join(sorted(available)),)
+            msg += "\n use 'pytest --fixtures [testpath]' for help on them."
+
+        return FixtureLookupErrorRepr(fspath, lineno, tblines, msg, self.argname)
+
+
+class FixtureLookupErrorRepr(TerminalRepr):
+
+    def __init__(self, filename, firstlineno, tblines, errorstring, argname):
+        self.tblines = tblines
+        self.errorstring = errorstring
+        self.filename = filename
+        self.firstlineno = firstlineno
+        self.argname = argname
+
+    def toterminal(self, tw):
+        # tw.line("FixtureLookupError: %s" %(self.argname), red=True)
+        for tbline in self.tblines:
+            tw.line(tbline.rstrip())
+        lines = self.errorstring.split("\n")
+        if lines:
+            tw.line(
+                "{}       {}".format(FormattedExcinfo.fail_marker, lines[0].strip()),
+                red=True,
+            )
+            for line in lines[1:]:
+                tw.line(
+                    "{}       {}".format(FormattedExcinfo.flow_marker, line.strip()),
+                    red=True,
+                )
+        tw.line()
+        tw.line("%s:%d" % (self.filename, self.firstlineno + 1))
+
+
+def fail_fixturefunc(fixturefunc, msg):
+    fs, lineno = getfslineno(fixturefunc)
+    location = "%s:%s" % (fs, lineno + 1)
+    source = _pytest._code.Source(fixturefunc)
+    fail(msg + ":\n\n" + str(source.indent()) + "\n" + location, pytrace=False)
+
+
+def call_fixture_func(fixturefunc, request, kwargs):
+    yieldctx = is_generator(fixturefunc)
+    if yieldctx:
+        it = fixturefunc(**kwargs)
+        res = next(it)
+
+        def teardown():
+            try:
+                next(it)
+            except StopIteration:
+                pass
+            else:
+                fail_fixturefunc(
+                    fixturefunc, "yield_fixture function has more than one 'yield'"
+                )
+
+        request.addfinalizer(teardown)
+    else:
+        res = fixturefunc(**kwargs)
+    return res
+
+
+class FixtureDef(object):
+    """ A container for a factory definition. """
+
+    def __init__(
+        self,
+        fixturemanager,
+        baseid,
+        argname,
+        func,
+        scope,
+        params,
+        unittest=False,
+        ids=None,
+    ):
+        self._fixturemanager = fixturemanager
+        self.baseid = baseid or ""
+        self.has_location = baseid is not None
+        self.func = func
+        self.argname = argname
+        self.scope = scope
+        self.scopenum = scope2index(
+            scope or "function", descr="fixture {}".format(func.__name__), where=baseid
+        )
+        self.params = params
+        self.argnames = getfuncargnames(func, is_method=unittest)
+        self.unittest = unittest
+        self.ids = ids
+        self._finalizers = []
+
+    def addfinalizer(self, finalizer):
+        self._finalizers.append(finalizer)
+
+    def finish(self, request):
+        exceptions = []
+        try:
+            while self._finalizers:
+                try:
+                    func = self._finalizers.pop()
+                    func()
+                except:  # noqa
+                    exceptions.append(sys.exc_info())
+            if exceptions:
+                e = exceptions[0]
+                del exceptions  # ensure we don't keep all frames alive because of the traceback
+                py.builtin._reraise(*e)
+
+        finally:
+            hook = self._fixturemanager.session.gethookproxy(request.node.fspath)
+            hook.pytest_fixture_post_finalizer(fixturedef=self, request=request)
+            # even if finalization fails, we invalidate
+            # the cached fixture value and remove
+            # all finalizers because they may be bound methods which will
+            # keep instances alive
+            if hasattr(self, "cached_result"):
+                del self.cached_result
+            self._finalizers = []
+
+    def execute(self, request):
+        # get required arguments and register our own finish()
+        # with their finalization
+        for argname in self.argnames:
+            fixturedef = request._get_active_fixturedef(argname)
+            if argname != "request":
+                fixturedef.addfinalizer(functools.partial(self.finish, request=request))
+
+        my_cache_key = request.param_index
+        cached_result = getattr(self, "cached_result", None)
+        if cached_result is not None:
+            result, cache_key, err = cached_result
+            if my_cache_key == cache_key:
+                if err is not None:
+                    py.builtin._reraise(*err)
+                else:
+                    return result
+            # we have a previous but differently parametrized fixture instance
+            # so we need to tear it down before creating a new one
+            self.finish(request)
+            assert not hasattr(self, "cached_result")
+
+        hook = self._fixturemanager.session.gethookproxy(request.node.fspath)
+        return hook.pytest_fixture_setup(fixturedef=self, request=request)
+
+    def __repr__(self):
+        return (
+            "<FixtureDef name=%r scope=%r baseid=%r >"
+            % (self.argname, self.scope, self.baseid)
+        )
+
+
+def pytest_fixture_setup(fixturedef, request):
+    """ Execution of fixture setup. """
+    kwargs = {}
+    for argname in fixturedef.argnames:
+        fixdef = request._get_active_fixturedef(argname)
+        result, arg_cache_key, exc = fixdef.cached_result
+        request._check_scope(argname, request.scope, fixdef.scope)
+        kwargs[argname] = result
+
+    fixturefunc = fixturedef.func
+    if fixturedef.unittest:
+        if request.instance is not None:
+            # bind the unbound method to the TestCase instance
+            fixturefunc = fixturedef.func.__get__(request.instance)
+    else:
+        # the fixture function needs to be bound to the actual
+        # request.instance so that code working with "fixturedef" behaves
+        # as expected.
+        if request.instance is not None:
+            fixturefunc = getimfunc(fixturedef.func)
+            if fixturefunc != fixturedef.func:
+                fixturefunc = fixturefunc.__get__(request.instance)
+    my_cache_key = request.param_index
+    try:
+        result = call_fixture_func(fixturefunc, request, kwargs)
+    except TEST_OUTCOME:
+        fixturedef.cached_result = (None, my_cache_key, sys.exc_info())
+        raise
+    fixturedef.cached_result = (result, my_cache_key, None)
+    return result
+
+
+def _ensure_immutable_ids(ids):
+    if ids is None:
+        return
+    if callable(ids):
+        return ids
+    return tuple(ids)
+
+
+@attr.s(frozen=True)
+class FixtureFunctionMarker(object):
+    scope = attr.ib()
+    params = attr.ib(converter=attr.converters.optional(tuple))
+    autouse = attr.ib(default=False)
+    ids = attr.ib(default=None, converter=_ensure_immutable_ids)
+    name = attr.ib(default=None)
+
+    def __call__(self, function):
+        if isclass(function):
+            raise ValueError("class fixtures not supported (may be in the future)")
+
+        if getattr(function, "_pytestfixturefunction", False):
+            raise ValueError(
+                "fixture is being applied more than once to the same function"
+            )
+
+        function._pytestfixturefunction = self
+        return function
+
+
+def fixture(scope="function", params=None, autouse=False, ids=None, name=None):
+    """Decorator to mark a fixture factory function.
+
+    This decorator can be used (with or without parameters) to define a
+    fixture function.  The name of the fixture function can later be
+    referenced to cause its invocation ahead of running tests: test
+    modules or classes can use the pytest.mark.usefixtures(fixturename)
+    marker.  Test functions can directly use fixture names as input
+    arguments in which case the fixture instance returned from the fixture
+    function will be injected.
+
+    :arg scope: the scope for which this fixture is shared, one of
+                "function" (default), "class", "module" or "session".
+
+    :arg params: an optional list of parameters which will cause multiple
+                invocations of the fixture function and all of the tests
+                using it.
+
+    :arg autouse: if True, the fixture func is activated for all tests that
+                can see it.  If False (the default) then an explicit
+                reference is needed to activate the fixture.
+
+    :arg ids: list of string ids each corresponding to the params
+                so that they are part of the test id. If no ids are provided
+                they will be generated automatically from the params.
+
+    :arg name: the name of the fixture. This defaults to the name of the
+                decorated function. If a fixture is used in the same module in
+                which it is defined, the function name of the fixture will be
+                shadowed by the function arg that requests the fixture; one way
+                to resolve this is to name the decorated function
+                ``fixture_<fixturename>`` and then use
+                ``@pytest.fixture(name='<fixturename>')``.
+
+    Fixtures can optionally provide their values to test functions using a ``yield`` statement,
+    instead of ``return``. In this case, the code block after the ``yield`` statement is executed
+    as teardown code regardless of the test outcome. A fixture function must yield exactly once.
+    """
+    if callable(scope) and params is None and autouse is False:
+        # direct decoration
+        return FixtureFunctionMarker("function", params, autouse, name=name)(scope)
+    if params is not None and not isinstance(params, (list, tuple)):
+        params = list(params)
+    return FixtureFunctionMarker(scope, params, autouse, ids=ids, name=name)
+
+
+def yield_fixture(scope="function", params=None, autouse=False, ids=None, name=None):
+    """ (return a) decorator to mark a yield-fixture factory function.
+
+    .. deprecated:: 3.0
+        Use :py:func:`pytest.fixture` directly instead.
+    """
+    if callable(scope) and params is None and not autouse:
+        # direct decoration
+        return FixtureFunctionMarker("function", params, autouse, ids=ids, name=name)(
+            scope
+        )
+    else:
+        return FixtureFunctionMarker(scope, params, autouse, ids=ids, name=name)
+
+
+defaultfuncargprefixmarker = fixture()
+
+
+@fixture(scope="session")
+def pytestconfig(request):
+    """Session-scoped fixture that returns the :class:`_pytest.config.Config` object.
+
+    Example::
+
+        def test_foo(pytestconfig):
+            if pytestconfig.getoption("verbose"):
+                ...
+
+    """
+    return request.config
+
+
+class FixtureManager(object):
+    """
+    pytest fixtures definitions and information is stored and managed
+    from this class.
+
+    During collection fm.parsefactories() is called multiple times to parse
+    fixture function definitions into FixtureDef objects and internal
+    data structures.
+
+    During collection of test functions, metafunc-mechanics instantiate
+    a FuncFixtureInfo object which is cached per node/func-name.
+    This FuncFixtureInfo object is later retrieved by Function nodes
+    which themselves offer a fixturenames attribute.
+
+    The FuncFixtureInfo object holds information about fixtures and FixtureDefs
+    relevant for a particular function.  An initial list of fixtures is
+    assembled like this:
+
+    - ini-defined usefixtures
+    - autouse-marked fixtures along the collection chain up from the function
+    - usefixtures markers at module/class/function level
+    - test function funcargs
+
+    Subsequently the funcfixtureinfo.fixturenames attribute is computed
+    as the closure of the fixtures needed to setup the initial fixtures,
+    i. e. fixtures needed by fixture functions themselves are appended
+    to the fixturenames list.
+
+    Upon the test-setup phases all fixturenames are instantiated, retrieved
+    by a lookup of their FuncFixtureInfo.
+    """
+
+    _argprefix = "pytest_funcarg__"
+    FixtureLookupError = FixtureLookupError
+    FixtureLookupErrorRepr = FixtureLookupErrorRepr
+
+    def __init__(self, session):
+        self.session = session
+        self.config = session.config
+        self._arg2fixturedefs = {}
+        self._holderobjseen = set()
+        self._arg2finish = {}
+        self._nodeid_and_autousenames = [("", self.config.getini("usefixtures"))]
+        session.config.pluginmanager.register(self, "funcmanage")
+
+    def getfixtureinfo(self, node, func, cls, funcargs=True):
+        if funcargs and not getattr(node, "nofuncargs", False):
+            argnames = getfuncargnames(func, cls=cls)
+        else:
+            argnames = ()
+        usefixtures = flatten(
+            mark.args for mark in node.iter_markers(name="usefixtures")
+        )
+        initialnames = argnames
+        initialnames = tuple(usefixtures) + initialnames
+        fm = node.session._fixturemanager
+        names_closure, arg2fixturedefs = fm.getfixtureclosure(initialnames, node)
+        return FuncFixtureInfo(argnames, names_closure, arg2fixturedefs)
+
+    def pytest_plugin_registered(self, plugin):
+        nodeid = None
+        try:
+            p = py.path.local(plugin.__file__)
+        except AttributeError:
+            pass
+        else:
+            # construct the base nodeid which is later used to check
+            # what fixtures are visible for particular tests (as denoted
+            # by their test id)
+            if p.basename.startswith("conftest.py"):
+                nodeid = p.dirpath().relto(self.config.rootdir)
+                if p.sep != nodes.SEP:
+                    nodeid = nodeid.replace(p.sep, nodes.SEP)
+        self.parsefactories(plugin, nodeid)
+
+    def _getautousenames(self, nodeid):
+        """ return a tuple of fixture names to be used. """
+        autousenames = []
+        for baseid, basenames in self._nodeid_and_autousenames:
+            if nodeid.startswith(baseid):
+                if baseid:
+                    i = len(baseid)
+                    nextchar = nodeid[i:i + 1]
+                    if nextchar and nextchar not in ":/":
+                        continue
+                autousenames.extend(basenames)
+        return autousenames
+
+    def getfixtureclosure(self, fixturenames, parentnode):
+        # collect the closure of all fixtures , starting with the given
+        # fixturenames as the initial set.  As we have to visit all
+        # factory definitions anyway, we also return an arg2fixturedefs
+        # mapping so that the caller can reuse it and does not have
+        # to re-discover fixturedefs again for each fixturename
+        # (discovering matching fixtures for a given name/node is expensive)
+
+        parentid = parentnode.nodeid
+        fixturenames_closure = self._getautousenames(parentid)
+
+        def merge(otherlist):
+            for arg in otherlist:
+                if arg not in fixturenames_closure:
+                    fixturenames_closure.append(arg)
+
+        merge(fixturenames)
+        arg2fixturedefs = {}
+        lastlen = -1
+        while lastlen != len(fixturenames_closure):
+            lastlen = len(fixturenames_closure)
+            for argname in fixturenames_closure:
+                if argname in arg2fixturedefs:
+                    continue
+                fixturedefs = self.getfixturedefs(argname, parentid)
+                if fixturedefs:
+                    arg2fixturedefs[argname] = fixturedefs
+                    merge(fixturedefs[-1].argnames)
+
+        def sort_by_scope(arg_name):
+            try:
+                fixturedefs = arg2fixturedefs[arg_name]
+            except KeyError:
+                return scopes.index("function")
+            else:
+                return fixturedefs[-1].scopenum
+
+        fixturenames_closure.sort(key=sort_by_scope)
+        return fixturenames_closure, arg2fixturedefs
+
+    def pytest_generate_tests(self, metafunc):
+        for argname in metafunc.fixturenames:
+            faclist = metafunc._arg2fixturedefs.get(argname)
+            if faclist:
+                fixturedef = faclist[-1]
+                if fixturedef.params is not None:
+                    parametrize_func = getattr(metafunc.function, "parametrize", None)
+                    if parametrize_func is not None:
+                        parametrize_func = parametrize_func.combined
+                    func_params = getattr(parametrize_func, "args", [[None]])
+                    func_kwargs = getattr(parametrize_func, "kwargs", {})
+                    # skip directly parametrized arguments
+                    if "argnames" in func_kwargs:
+                        argnames = parametrize_func.kwargs["argnames"]
+                    else:
+                        argnames = func_params[0]
+                    if not isinstance(argnames, (tuple, list)):
+                        argnames = [x.strip() for x in argnames.split(",") if x.strip()]
+                    if argname not in func_params and argname not in argnames:
+                        metafunc.parametrize(
+                            argname,
+                            fixturedef.params,
+                            indirect=True,
+                            scope=fixturedef.scope,
+                            ids=fixturedef.ids,
+                        )
+            else:
+                continue  # will raise FixtureLookupError at setup time
+
+    def pytest_collection_modifyitems(self, items):
+        # separate parametrized setups
+        items[:] = reorder_items(items)
+
+    def parsefactories(self, node_or_obj, nodeid=NOTSET, unittest=False):
+        if nodeid is not NOTSET:
+            holderobj = node_or_obj
+        else:
+            holderobj = node_or_obj.obj
+            nodeid = node_or_obj.nodeid
+        if holderobj in self._holderobjseen:
+            return
+        self._holderobjseen.add(holderobj)
+        autousenames = []
+        for name in dir(holderobj):
+            # The attribute can be an arbitrary descriptor, so the attribute
+            # access below can raise. safe_getatt() ignores such exceptions.
+            obj = safe_getattr(holderobj, name, None)
+            # fixture functions have a pytest_funcarg__ prefix (pre-2.3 style)
+            # or are "@pytest.fixture" marked
+            marker = getfixturemarker(obj)
+            if marker is None:
+                if not name.startswith(self._argprefix):
+                    continue
+                if not callable(obj):
+                    continue
+                marker = defaultfuncargprefixmarker
+                from _pytest import deprecated
+
+                self.config.warn(
+                    "C1", deprecated.FUNCARG_PREFIX.format(name=name), nodeid=nodeid
+                )
+                name = name[len(self._argprefix):]
+            elif not isinstance(marker, FixtureFunctionMarker):
+                # magic globals  with __getattr__ might have got us a wrong
+                # fixture attribute
+                continue
+            else:
+                if marker.name:
+                    name = marker.name
+                assert not name.startswith(self._argprefix), FIXTURE_MSG.format(name)
+
+            fixture_def = FixtureDef(
+                self,
+                nodeid,
+                name,
+                obj,
+                marker.scope,
+                marker.params,
+                unittest=unittest,
+                ids=marker.ids,
+            )
+
+            faclist = self._arg2fixturedefs.setdefault(name, [])
+            if fixture_def.has_location:
+                faclist.append(fixture_def)
+            else:
+                # fixturedefs with no location are at the front
+                # so this inserts the current fixturedef after the
+                # existing fixturedefs from external plugins but
+                # before the fixturedefs provided in conftests.
+                i = len([f for f in faclist if not f.has_location])
+                faclist.insert(i, fixture_def)
+            if marker.autouse:
+                autousenames.append(name)
+
+        if autousenames:
+            self._nodeid_and_autousenames.append((nodeid or "", autousenames))
+
+    def getfixturedefs(self, argname, nodeid):
+        """
+        Gets a list of fixtures which are applicable to the given node id.
+
+        :param str argname: name of the fixture to search for
+        :param str nodeid: full node id of the requesting test.
+        :return: list[FixtureDef]
+        """
+        try:
+            fixturedefs = self._arg2fixturedefs[argname]
+        except KeyError:
+            return None
+        else:
+            return tuple(self._matchfactories(fixturedefs, nodeid))
+
+    def _matchfactories(self, fixturedefs, nodeid):
+        for fixturedef in fixturedefs:
+            if nodes.ischildnode(fixturedef.baseid, nodeid):
+                yield fixturedef
new file mode 100644
--- /dev/null
+++ b/third_party/python/pytest/src/_pytest/freeze_support.py
@@ -0,0 +1,45 @@
+"""
+Provides a function to report all internal modules for using freezing tools
+pytest
+"""
+from __future__ import absolute_import, division, print_function
+
+
+def freeze_includes():
+    """
+    Returns a list of module names used by pytest that should be
+    included by cx_freeze.
+    """
+    import py
+    import _pytest
+
+    result = list(_iter_all_modules(py))
+    result += list(_iter_all_modules(_pytest))
+    return result
+
+
+def _iter_all_modules(package, prefix=""):
+    """
+    Iterates over the names of all modules that can be found in the given
+    package, recursively.
+    Example:
+        _iter_all_modules(_pytest) ->
+            ['_pytest.assertion.newinterpret',
+             '_pytest.capture',
+             '_pytest.core',
+             ...
+            ]
+    """
+    import os
+    import pkgutil
+
+    if type(package) is not str:
+        path, prefix = package.__path__[0], package.__name__ + "."
+    else:
+        path = package
+    for _, name, is_package in pkgutil.iter_modules([path]):
+        if is_package:
+            for m in _iter_all_modules(os.path.join(path, name), prefix=name + "."):
+                yield prefix + m
+        else:
+            yield prefix + name
new file mode 100644
--- /dev/null
+++ b/third_party/python/pytest/src/_pytest/helpconfig.py
@@ -0,0 +1,212 @@
+""" version info, help messages, tracing configuration.  """
+from __future__ import absolute_import, division, print_function
+
+import py
+import pytest
+from _pytest.config import PrintHelp
+import os
+import sys
+from argparse import Action
+
+
+class HelpAction(Action):
+    """This is an argparse Action that will raise an exception in
+    order to skip the rest of the argument parsing when --help is passed.
+    This prevents argparse from quitting due to missing required arguments
+    when any are defined, for example by ``pytest_addoption``.
+    This is similar to the way that the builtin argparse --help option is
+    implemented by raising SystemExit.
+    """
+
+    def __init__(self, option_strings, dest=None, default=False, help=None):
+        super(HelpAction, self).__init__(
+            option_strings=option_strings,
+            dest=dest,
+            const=True,
+            default=default,
+            nargs=0,
+            help=help,
+        )
+
+    def __call__(self, parser, namespace, values, option_string=None):
+        setattr(namespace, self.dest, self.const)
+
+        # We should only skip the rest of the parsing after preparse is done
+        if getattr(parser._parser, "after_preparse", False):
+            raise PrintHelp
+
+
+def pytest_addoption(parser):
+    group = parser.getgroup("debugconfig")
+    group.addoption(
+        "--version",
+        action="store_true",
+        help="display pytest lib version and import information.",
+    )
+    group._addoption(
+        "-h",
+        "--help",
+        action=HelpAction,
+        dest="help",
+        help="show help message and configuration info",
+    )
+    group._addoption(
+        "-p",
+        action="append",
+        dest="plugins",
+        default=[],
+        metavar="name",
+        help="early-load given plugin (multi-allowed). "
+        "To avoid loading of plugins, use the `no:` prefix, e.g. "
+        "`no:doctest`.",
+    )
+    group.addoption(
+        "--traceconfig",
+        "--trace-config",
+        action="store_true",
+        default=False,
+        help="trace considerations of conftest.py files.",
+    ),
+    group.addoption(
+        "--debug",
+        action="store_true",
+        dest="debug",
+        default=False,
+        help="store internal tracing debug information in 'pytestdebug.log'.",
+    )
+    group._addoption(
+        "-o",
+        "--override-ini",
+        dest="override_ini",
+        action="append",
+        help='override ini option with "option=value" style, e.g. `-o xfail_strict=True -o cache_dir=cache`.',
+    )
+
+
+@pytest.hookimpl(hookwrapper=True)
+def pytest_cmdline_parse():
+    outcome = yield
+    config = outcome.get_result()
+    if config.option.debug:
+        path = os.path.abspath("pytestdebug.log")
+        debugfile = open(path, "w")
+        debugfile.write(
+            "versions pytest-%s, py-%s, "
+            "python-%s\ncwd=%s\nargs=%s\n\n"
+            % (
+                pytest.__version__,
+                py.__version__,
+                ".".join(map(str, sys.version_info)),
+                os.getcwd(),
+                config._origargs,
+            )
+        )
+        config.trace.root.setwriter(debugfile.write)
+        undo_tracing = config.pluginmanager.enable_tracing()
+        sys.stderr.write("writing pytestdebug information to %s\n" % path)
+
+        def unset_tracing():
+            debugfile.close()
+            sys.stderr.write("wrote pytestdebug information to %s\n" % debugfile.name)
+            config.trace.root.setwriter(None)
+            undo_tracing()
+
+        config.add_cleanup(unset_tracing)
+
+
+def pytest_cmdline_main(config):
+    if config.option.version:
+        p = py.path.local(pytest.__file__)
+        sys.stderr.write(
+            "This is pytest version %s, imported from %s\n" % (pytest.__version__, p)
+        )
+        plugininfo = getpluginversioninfo(config)
+        if plugininfo:
+            for line in plugininfo:
+                sys.stderr.write(line + "\n")
+        return 0
+    elif config.option.help:
+        config._do_configure()
+        showhelp(config)
+        config._ensure_unconfigure()
+        return 0
+
+
+def showhelp(config):
+    reporter = config.pluginmanager.get_plugin("terminalreporter")
+    tw = reporter._tw
+    tw.write(config._parser.optparser.format_help())
+    tw.line()
+    tw.line()
+    tw.line(
+        "[pytest] ini-options in the first " "pytest.ini|tox.ini|setup.cfg file found:"
+    )
+    tw.line()
+
+    for name in config._parser._ininames:
+        help, type, default = config._parser._inidict[name]
+        if type is None:
+            type = "string"
+        spec = "%s (%s)" % (name, type)
+        line = "  %-24s %s" % (spec, help)
+        tw.line(line[:tw.fullwidth])
+
+    tw.line()
+    tw.line("environment variables:")
+    vars = [
+        ("PYTEST_ADDOPTS", "extra command line options"),
+        ("PYTEST_PLUGINS", "comma-separated plugins to load during startup"),
+        ("PYTEST_DEBUG", "set to enable debug tracing of pytest's internals"),
+    ]
+    for name, help in vars:
+        tw.line("  %-24s %s" % (name, help))
+    tw.line()
+    tw.line()
+
+    tw.line("to see available markers type: pytest --markers")
+    tw.line("to see available fixtures type: pytest --fixtures")
+    tw.line(
+        "(shown according to specified file_or_dir or current dir "
+        "if not specified; fixtures with leading '_' are only shown "
+        "with the '-v' option"
+    )
+
+    for warningreport in reporter.stats.get("warnings", []):
+        tw.line("warning : " + warningreport.message, red=True)
+    return
+
+
+conftest_options = [("pytest_plugins", "list of plugin names to load")]
+
+
+def getpluginversioninfo(config):
+    lines = []
+    plugininfo = config.pluginmanager.list_plugin_distinfo()
+    if plugininfo:
+        lines.append("setuptools registered plugins:")
+        for plugin, dist in plugininfo:
+            loc = getattr(plugin, "__file__", repr(plugin))
+            content = "%s-%s at %s" % (dist.project_name, dist.version, loc)
+            lines.append("  " + content)
+    return lines
+
+
+def pytest_report_header(config):
+    lines = []
+    if config.option.debug or config.option.traceconfig:
+        lines.append("using: pytest-%s pylib-%s" % (pytest.__version__, py.__version__))
+
+        verinfo = getpluginversioninfo(config)
+        if verinfo:
+            lines.extend(verinfo)
+
+    if config.option.traceconfig:
+        lines.append("active plugins:")
+        items = config.pluginmanager.list_name_plugin()
+        for name, plugin in items:
+            if hasattr(plugin, "__file__"):
+                r = plugin.__file__
+            else:
+                r = repr(plugin)
+            lines.append("    %-20s: %s" % (name, r))
+    return lines
new file mode 100644
--- /dev/null
+++ b/third_party/python/pytest/src/_pytest/hookspec.py
@@ -0,0 +1,563 @@
+""" hook specifications for pytest plugins, invoked from main.py and builtin plugins.  """
+
+from pluggy import HookspecMarker
+
+hookspec = HookspecMarker("pytest")
+
+# -------------------------------------------------------------------------
+# Initialization hooks called for every plugin
+# -------------------------------------------------------------------------
+
+
+@hookspec(historic=True)
+def pytest_addhooks(pluginmanager):
+    """called at plugin registration time to allow adding new hooks via a call to
+    ``pluginmanager.add_hookspecs(module_or_class, prefix)``.
+
+
+    :param _pytest.config.PytestPluginManager pluginmanager: pytest plugin manager
+
+    .. note::
+        This hook is incompatible with ``hookwrapper=True``.
+    """
+
+
+@hookspec(historic=True)
+def pytest_namespace():
+    """
+    (**Deprecated**) this hook causes direct monkeypatching on pytest, its use is strongly discouraged
+    return dict of name->object to be made globally available in
+    the pytest namespace.
+
+    This hook is called at plugin registration time.
+
+    .. note::
+        This hook is incompatible with ``hookwrapper=True``.
+    """
+
+
+@hookspec(historic=True)
+def pytest_plugin_registered(plugin, manager):
+    """ a new pytest plugin got registered.
+
+    :param plugin: the plugin module or instance
+    :param _pytest.config.PytestPluginManager manager: pytest plugin manager
+
+    .. note::
+        This hook is incompatible with ``hookwrapper=True``.
+    """
+
+
+@hookspec(historic=True)
+def pytest_addoption(parser):
+    """register argparse-style options and ini-style config values,
+    called once at the beginning of a test run.
+
+    .. note::
+
+        This function should be implemented only in plugins or ``conftest.py``
+        files situated at the tests root directory due to how pytest
+        :ref:`discovers plugins during startup <pluginorder>`.
+
+    :arg _pytest.config.Parser parser: To add command line options, call
+        :py:func:`parser.addoption(...) <_pytest.config.Parser.addoption>`.
+        To add ini-file values call :py:func:`parser.addini(...)
+        <_pytest.config.Parser.addini>`.
+
+    Options can later be accessed through the
+    :py:class:`config <_pytest.config.Config>` object, respectively:
+
+    - :py:func:`config.getoption(name) <_pytest.config.Config.getoption>` to
+      retrieve the value of a command line option.
+
+    - :py:func:`config.getini(name) <_pytest.config.Config.getini>` to retrieve
+      a value read from an ini-style file.
+
+    The config object is passed around on many internal objects via the ``.config``
+    attribute or can be retrieved as the ``pytestconfig`` fixture.
+
+    .. note::
+        This hook is incompatible with ``hookwrapper=True``.
+    """
+
+
+@hookspec(historic=True)
+def pytest_configure(config):
+    """
+    Allows plugins and conftest files to perform initial configuration.
+
+    This hook is called for every plugin and initial conftest file
+    after command line options have been parsed.
+
+    After that, the hook is called for other conftest files as they are
+    imported.
+
+    .. note::
+        This hook is incompatible with ``hookwrapper=True``.
+
+    :arg _pytest.config.Config config: pytest config object
+    """
+
+
+# -------------------------------------------------------------------------
+# Bootstrapping hooks called for plugins registered early enough:
+# internal and 3rd party plugins.
+# -------------------------------------------------------------------------
+
+
+@hookspec(firstresult=True)
+def pytest_cmdline_parse(pluginmanager, args):
+    """return initialized config object, parsing the specified args.
+
+    Stops at first non-None result, see :ref:`firstresult`
+
+    .. note::
+        This hook will not be called for ``conftest.py`` files, only for setuptools plugins.
+
+    :param _pytest.config.PytestPluginManager pluginmanager: pytest plugin manager
+    :param list[str] args: list of arguments passed on the command line
+    """
+
+
+def pytest_cmdline_preparse(config, args):
+    """(**Deprecated**) modify command line arguments before option parsing.
+
+    This hook is considered deprecated and will be removed in a future pytest version. Consider
+    using :func:`pytest_load_initial_conftests` instead.
+
+    .. note::
+        This hook will not be called for ``conftest.py`` files, only for setuptools plugins.
+
+    :param _pytest.config.Config config: pytest config object
+    :param list[str] args: list of arguments passed on the command line
+    """
+
+
+@hookspec(firstresult=True)
+def pytest_cmdline_main(config):
+    """ called for performing the main command line action. The default
+    implementation will invoke the configure hooks and runtest_mainloop.
+
+    .. note::
+        This hook will not be called for ``conftest.py`` files, only for setuptools plugins.
+
+    Stops at first non-None result, see :ref:`firstresult`
+
+    :param _pytest.config.Config config: pytest config object
+    """
+
+
+def pytest_load_initial_conftests(early_config, parser, args):
+    """ implements the loading of initial conftest files ahead
+    of command line option parsing.
+
+    .. note::
+        This hook will not be called for ``conftest.py`` files, only for setuptools plugins.
+
+    :param _pytest.config.Config early_config: pytest config object
+    :param list[str] args: list of arguments passed on the command line
+    :param _pytest.config.Parser parser: to add command line options
+    """
+
+
+# -------------------------------------------------------------------------
+# collection hooks
+# -------------------------------------------------------------------------
+
+
+@hookspec(firstresult=True)
+def pytest_collection(session):
+    """Perform the collection protocol for the given session.
+
+    Stops at first non-None result, see :ref:`firstresult`.
+
+    :param _pytest.main.Session session: the pytest session object
+    """
+
+
+def pytest_collection_modifyitems(session, config, items):
+    """ called after collection has been performed, may filter or re-order
+    the items in-place.
+
+    :param _pytest.main.Session session: the pytest session object
+    :param _pytest.config.Config config: pytest config object
+    :param List[_pytest.nodes.Item] items: list of item objects
+    """
+
+
+def pytest_collection_finish(session):
+    """ called after collection has been performed and modified.
+
+    :param _pytest.main.Session session: the pytest session object
+    """
+
+
+@hookspec(firstresult=True)
+def pytest_ignore_collect(path, config):
+    """ return True to prevent considering this path for collection.
+    This hook is consulted for all files and directories prior to calling
+    more specific hooks.
+
+    Stops at first non-None result, see :ref:`firstresult`
+
+    :param str path: the path to analyze
+    :param _pytest.config.Config config: pytest config object
+    """
+
+
+@hookspec(firstresult=True)
+def pytest_collect_directory(path, parent):
+    """ called before traversing a directory for collection files.
+
+    Stops at first non-None result, see :ref:`firstresult`
+
+    :param str path: the path to analyze
+    """
+
+
+def pytest_collect_file(path, parent):
+    """ return collection Node or None for the given path. Any new node
+    needs to have the specified ``parent`` as a parent.
+
+    :param str path: the path to collect
+    """
+
+
+# logging hooks for collection
+
+
+def pytest_collectstart(collector):
+    """ collector starts collecting. """
+
+
+def pytest_itemcollected(item):
+    """ we just collected a test item. """
+
+
+def pytest_collectreport(report):
+    """ collector finished collecting. """
+
+
+def pytest_deselected(items):
+    """ called for test items deselected by keyword. """
+
+
+@hookspec(firstresult=True)
+def pytest_make_collect_report(collector):
+    """ perform ``collector.collect()`` and return a CollectReport.
+
+    Stops at first non-None result, see :ref:`firstresult` """
+
+
+# -------------------------------------------------------------------------
+# Python test function related hooks
+# -------------------------------------------------------------------------
+
+
+@hookspec(firstresult=True)
+def pytest_pycollect_makemodule(path, parent):
+    """ return a Module collector or None for the given path.
+    This hook will be called for each matching test module path.
+    The pytest_collect_file hook needs to be used if you want to
+    create test modules for files that do not match as a test module.
+
+    Stops at first non-None result, see :ref:`firstresult` """
+
+
+@hookspec(firstresult=True)
+def pytest_pycollect_makeitem(collector, name, obj):
+    """ return custom item/collector for a python object in a module, or None.
+
+    Stops at first non-None result, see :ref:`firstresult` """
+
+
+@hookspec(firstresult=True)
+def pytest_pyfunc_call(pyfuncitem):
+    """ call underlying test function.
+
+    Stops at first non-None result, see :ref:`firstresult` """
+
+
+def pytest_generate_tests(metafunc):
+    """ generate (multiple) parametrized calls to a test function."""
+
+
+@hookspec(firstresult=True)
+def pytest_make_parametrize_id(config, val, argname):
+    """Return a user-friendly string representation of the given ``val`` that will be used
+    by @pytest.mark.parametrize calls. Return None if the hook doesn't know about ``val``.
+    The parameter name is available as ``argname``, if required.
+
+    Stops at first non-None result, see :ref:`firstresult`
+
+    :param _pytest.config.Config config: pytest config object
+    :param val: the parametrized value
+    :param str argname: the automatic parameter name produced by pytest
+    """
+
+
+# -------------------------------------------------------------------------
+# generic runtest related hooks
+# -------------------------------------------------------------------------
+
+
+@hookspec(firstresult=True)
+def pytest_runtestloop(session):
+    """ called for performing the main runtest loop
+    (after collection finished).
+
+    Stops at first non-None result, see :ref:`firstresult`
+
+    :param _pytest.main.Session session: the pytest session object
+    """
+
+
+def pytest_itemstart(item, node):
+    """(**Deprecated**) use pytest_runtest_logstart. """
+
+
+@hookspec(firstresult=True)
+def pytest_runtest_protocol(item, nextitem):
+    """ implements the runtest_setup/call/teardown protocol for
+    the given test item, including capturing exceptions and calling
+    reporting hooks.
+
+    :arg item: test item for which the runtest protocol is performed.
+
+    :arg nextitem: the scheduled-to-be-next test item (or None if this
+                   is the end my friend).  This argument is passed on to
+                   :py:func:`pytest_runtest_teardown`.
+
+    :return boolean: True if no further hook implementations should be invoked.
+
+
+    Stops at first non-None result, see :ref:`firstresult` """
+
+
+def pytest_runtest_logstart(nodeid, location):
+    """ signal the start of running a single test item.
+
+    This hook will be called **before** :func:`pytest_runtest_setup`, :func:`pytest_runtest_call` and
+    :func:`pytest_runtest_teardown` hooks.
+
+    :param str nodeid: full id of the item
+    :param location: a triple of ``(filename, linenum, testname)``
+    """
+
+
+def pytest_runtest_logfinish(nodeid, location):
+    """ signal the complete finish of running a single test item.
+
+    This hook will be called **after** :func:`pytest_runtest_setup`, :func:`pytest_runtest_call` and
+    :func:`pytest_runtest_teardown` hooks.
+
+    :param str nodeid: full id of the item
+    :param location: a triple of ``(filename, linenum, testname)``
+    """
+
+
+def pytest_runtest_setup(item):
+    """ called before ``pytest_runtest_call(item)``. """
+
+
+def pytest_runtest_call(item):
+    """ called to execute the test ``item``. """
+
+
+def pytest_runtest_teardown(item, nextitem):
+    """ called after ``pytest_runtest_call``.
+
+    :arg nextitem: the scheduled-to-be-next test item (None if no further
+                   test item is scheduled).  This argument can be used to
+                   perform exact teardowns, i.e. calling just enough finalizers
+                   so that nextitem only needs to call setup-functions.
+    """
+
+
+@hookspec(firstresult=True)
+def pytest_runtest_makereport(item, call):
+    """ return a :py:class:`_pytest.runner.TestReport` object
+    for the given :py:class:`pytest.Item <_pytest.main.Item>` and
+    :py:class:`_pytest.runner.CallInfo`.
+
+    Stops at first non-None result, see :ref:`firstresult` """
+
+
+def pytest_runtest_logreport(report):
+    """ process a test setup/call/teardown report relating to
+    the respective phase of executing a test. """
+
+
+# -------------------------------------------------------------------------
+# Fixture related hooks
+# -------------------------------------------------------------------------
+
+
+@hookspec(firstresult=True)
+def pytest_fixture_setup(fixturedef, request):
+    """ performs fixture setup execution.
+
+    :return: The return value of the call to the fixture function
+
+    Stops at first non-None result, see :ref:`firstresult`
+
+    .. note::
+        If the fixture function returns None, other implementations of
+        this hook function will continue to be called, according to the
+        behavior of the :ref:`firstresult` option.
+    """
+
+
+def pytest_fixture_post_finalizer(fixturedef, request):
+    """ called after fixture teardown, but before the cache is cleared so
+    the fixture result cache ``fixturedef.cached_result`` can
+    still be accessed."""
+
+
+# -------------------------------------------------------------------------
+# test session related hooks
+# -------------------------------------------------------------------------
+
+
+def pytest_sessionstart(session):
+    """ called after the ``Session`` object has been created and before performing collection
+    and entering the run test loop.
+
+    :param _pytest.main.Session session: the pytest session object
+    """
+
+
+def pytest_sessionfinish(session, exitstatus):
+    """ called after whole test run finished, right before returning the exit status to the system.
+
+    :param _pytest.main.Session session: the pytest session object
+    :param int exitstatus: the status which pytest will return to the system
+    """
+
+
+def pytest_unconfigure(config):
+    """ called before test process is exited.
+
+    :param _pytest.config.Config config: pytest config object
+    """
+
+
+# -------------------------------------------------------------------------
+# hooks for customizing the assert methods
+# -------------------------------------------------------------------------
+
+
+def pytest_assertrepr_compare(config, op, left, right):
+    """return explanation for comparisons in failing assert expressions.
+
+    Return None for no custom explanation, otherwise return a list
+    of strings.  The strings will be joined by newlines but any newlines
+    *in* a string will be escaped.  Note that all but the first line will
+    be indented slightly, the intention is for the first line to be a summary.
+
+    :param _pytest.config.Config config: pytest config object
+    """
+
+
+# -------------------------------------------------------------------------
+# hooks for influencing reporting (invoked from _pytest_terminal)
+# -------------------------------------------------------------------------
+
+
+def pytest_report_header(config, startdir):
+    """ return a string or list of strings to be displayed as header info for terminal reporting.
+
+    :param _pytest.config.Config config: pytest config object
+    :param startdir: py.path object with the starting dir
+
+    .. note::
+
+        This function should be implemented only in plugins or ``conftest.py``
+        files situated at the tests root directory due to how pytest
+        :ref:`discovers plugins during startup <pluginorder>`.
+    """
+
+
+def pytest_report_collectionfinish(config, startdir, items):
+    """
+    .. versionadded:: 3.2
+
+    return a string or list of strings to be displayed after collection has finished successfully.
+
+    This strings will be displayed after the standard "collected X items" message.
+
+    :param _pytest.config.Config config: pytest config object
+    :param startdir: py.path object with the starting dir
+    :param items: list of pytest items that are going to be executed; this list should not be modified.
+    """
+
+
+@hookspec(firstresult=True)
+def pytest_report_teststatus(report):
+    """ return result-category, shortletter and verbose word for reporting.
+
+    Stops at first non-None result, see :ref:`firstresult` """
+
+
+def pytest_terminal_summary(terminalreporter, exitstatus):
+    """Add a section to terminal summary reporting.
+
+    :param _pytest.terminal.TerminalReporter terminalreporter: the internal terminal reporter object
+    :param int exitstatus: the exit status that will be reported back to the OS
+
+    .. versionadded:: 3.5
+        The ``config`` parameter.
+    """
+
+
+@hookspec(historic=True)
+def pytest_logwarning(message, code, nodeid, fslocation):
+    """ process a warning specified by a message, a code string,
+    a nodeid and fslocation (both of which may be None
+    if the warning is not tied to a particular node/location).
+
+    .. note::
+        This hook is incompatible with ``hookwrapper=True``.
+    """
+
+
+# -------------------------------------------------------------------------
+# doctest hooks
+# -------------------------------------------------------------------------
+
+
+@hookspec(firstresult=True)
+def pytest_doctest_prepare_content(content):
+    """ return processed content for a given doctest
+
+    Stops at first non-None result, see :ref:`firstresult` """
+
+
+# -------------------------------------------------------------------------
+# error handling and internal debugging hooks
+# -------------------------------------------------------------------------
+
+
+def pytest_internalerror(excrepr, excinfo):
+    """ called for internal errors. """
+
+
+def pytest_keyboard_interrupt(excinfo):
+    """ called for keyboard interrupt. """
+
+
+def pytest_exception_interact(node, call, report):
+    """called when an exception was raised which can potentially be
+    interactively handled.
+
+    This hook is only called if an exception was raised
+    that is not an internal exception like ``skip.Exception``.
+    """
+
+
+def pytest_enter_pdb(config):
+    """ called upon pdb.set_trace(), can be used by plugins to take special
+    action just before the python debugger enters in interactive mode.
+
+    :param _pytest.config.Config config: pytest config object
+    """
new file mode 100644
--- /dev/null
+++ b/third_party/python/pytest/src/_pytest/junitxml.py
@@ -0,0 +1,569 @@
+"""
+    report test results in JUnit-XML format,
+    for use with Jenkins and build integration servers.
+
+
+Based on initial code from Ross Lawley.
+
+Output conforms to https://github.com/jenkinsci/xunit-plugin/blob/master/
+src/main/resources/org/jenkinsci/plugins/xunit/types/model/xsd/junit-10.xsd
+"""
+from __future__ import absolute_import, division, print_function
+
+import functools
+import py
+import os
+import re
+import sys
+import time
+import pytest
+from _pytest import nodes
+from _pytest.config import filename_arg
+
+# Python 2.X and 3.X compatibility
+if sys.version_info[0] < 3:
+    from codecs import open
+else:
+    unichr = chr
+    unicode = str
+    long = int
+
+
+class Junit(py.xml.Namespace):
+    pass
+
+
+# We need to get the subset of the invalid unicode ranges according to
+# XML 1.0 which are valid in this python build.  Hence we calculate
+# this dynamically instead of hardcoding it.  The spec range of valid
+# chars is: Char ::= #x9 | #xA | #xD | [#x20-#xD7FF] | [#xE000-#xFFFD]
+#                    | [#x10000-#x10FFFF]
+_legal_chars = (0x09, 0x0A, 0x0d)
+_legal_ranges = ((0x20, 0x7E), (0x80, 0xD7FF), (0xE000, 0xFFFD), (0x10000, 0x10FFFF))
+_legal_xml_re = [
+    unicode("%s-%s") % (unichr(low), unichr(high))
+    for (low, high) in _legal_ranges
+    if low < sys.maxunicode
+]
+_legal_xml_re = [unichr(x) for x in _legal_chars] + _legal_xml_re
+illegal_xml_re = re.compile(unicode("[^%s]") % unicode("").join(_legal_xml_re))
+del _legal_chars
+del _legal_ranges
+del _legal_xml_re
+
+_py_ext_re = re.compile(r"\.py$")
+
+
+def bin_xml_escape(arg):
+
+    def repl(matchobj):
+        i = ord(matchobj.group())
+        if i <= 0xFF:
+            return unicode("#x%02X") % i
+        else:
+            return unicode("#x%04X") % i
+
+    return py.xml.raw(illegal_xml_re.sub(repl, py.xml.escape(arg)))
+
+
+class _NodeReporter(object):
+
+    def __init__(self, nodeid, xml):
+
+        self.id = nodeid
+        self.xml = xml
+        self.add_stats = self.xml.add_stats
+        self.duration = 0
+        self.properties = []
+        self.nodes = []
+        self.testcase = None
+        self.attrs = {}
+
+    def append(self, node):
+        self.xml.add_stats(type(node).__name__)
+        self.nodes.append(node)
+
+    def add_property(self, name, value):
+        self.properties.append((str(name), bin_xml_escape(value)))
+
+    def add_attribute(self, name, value):
+        self.attrs[str(name)] = bin_xml_escape(value)
+
+    def make_properties_node(self):
+        """Return a Junit node containing custom properties, if any.
+        """
+        if self.properties:
+            return Junit.properties(
+                [
+                    Junit.property(name=name, value=value)
+                    for name, value in self.properties
+                ]
+            )
+        return ""
+
+    def record_testreport(self, testreport):
+        assert not self.testcase
+        names = mangle_test_address(testreport.nodeid)
+        existing_attrs = self.attrs
+        classnames = names[:-1]
+        if self.xml.prefix:
+            classnames.insert(0, self.xml.prefix)
+        attrs = {
+            "classname": ".".join(classnames),
+            "name": bin_xml_escape(names[-1]),
+            "file": testreport.location[0],
+        }
+        if testreport.location[1] is not None:
+            attrs["line"] = testreport.location[1]
+        if hasattr(testreport, "url"):
+            attrs["url"] = testreport.url
+        self.attrs = attrs
+        self.attrs.update(existing_attrs)  # restore any user-defined attributes
+
+    def to_xml(self):
+        testcase = Junit.testcase(time=self.duration, **self.attrs)
+        testcase.append(self.make_properties_node())
+        for node in self.nodes:
+            testcase.append(node)
+        return testcase
+
+    def _add_simple(self, kind, message, data=None):
+        data = bin_xml_escape(data)
+        node = kind(data, message=message)
+        self.append(node)
+
+    def write_captured_output(self, report):
+        content_out = report.capstdout
+        content_log = report.caplog
+        content_err = report.capstderr
+
+        if content_log or content_out:
+            if content_log and self.xml.logging == "system-out":
+                if content_out:
+                    # syncing stdout and the log-output is not done yet. It's
+                    # probably not worth the effort. Therefore, first the captured
+                    # stdout is shown and then the captured logs.
+                    content = "\n".join(
+                        [
+                            " Captured Stdout ".center(80, "-"),
+                            content_out,
+                            "",
+                            " Captured Log ".center(80, "-"),
+                            content_log,
+                        ]
+                    )
+                else:
+                    content = content_log
+            else:
+                content = content_out
+
+            if content:
+                tag = getattr(Junit, "system-out")
+                self.append(tag(bin_xml_escape(content)))
+
+        if content_log or content_err:
+            if content_log and self.xml.logging == "system-err":
+                if content_err:
+                    content = "\n".join(
+                        [
+                            " Captured Stderr ".center(80, "-"),
+                            content_err,
+                            "",
+                            " Captured Log ".center(80, "-"),
+                            content_log,
+                        ]
+                    )
+                else:
+                    content = content_log
+            else:
+                content = content_err
+
+            if content:
+                tag = getattr(Junit, "system-err")
+                self.append(tag(bin_xml_escape(content)))
+
+    def append_pass(self, report):
+        self.add_stats("passed")
+
+    def append_failure(self, report):
+        # msg = str(report.longrepr.reprtraceback.extraline)
+        if hasattr(report, "wasxfail"):
+            self._add_simple(Junit.skipped, "xfail-marked test passes unexpectedly")
+        else:
+            if hasattr(report.longrepr, "reprcrash"):
+                message = report.longrepr.reprcrash.message
+            elif isinstance(report.longrepr, (unicode, str)):
+                message = report.longrepr
+            else:
+                message = str(report.longrepr)
+            message = bin_xml_escape(message)
+            fail = Junit.failure(message=message)
+            fail.append(bin_xml_escape(report.longrepr))
+            self.append(fail)
+
+    def append_collect_error(self, report):
+        # msg = str(report.longrepr.reprtraceback.extraline)
+        self.append(
+            Junit.error(bin_xml_escape(report.longrepr), message="collection failure")
+        )
+
+    def append_collect_skipped(self, report):
+        self._add_simple(Junit.skipped, "collection skipped", report.longrepr)
+
+    def append_error(self, report):
+        if getattr(report, "when", None) == "teardown":
+            msg = "test teardown failure"
+        else:
+            msg = "test setup failure"
+        self._add_simple(Junit.error, msg, report.longrepr)
+
+    def append_skipped(self, report):
+        if hasattr(report, "wasxfail"):
+            self._add_simple(Junit.skipped, "expected test failure", report.wasxfail)
+        else:
+            filename, lineno, skipreason = report.longrepr
+            if skipreason.startswith("Skipped: "):
+                skipreason = bin_xml_escape(skipreason[9:])
+            self.append(
+                Junit.skipped(
+                    "%s:%s: %s" % (filename, lineno, skipreason),
+                    type="pytest.skip",
+                    message=skipreason,
+                )
+            )
+            self.write_captured_output(report)
+
+    def finalize(self):
+        data = self.to_xml().unicode(indent=0)
+        self.__dict__.clear()
+        self.to_xml = lambda: py.xml.raw(data)
+
+
+@pytest.fixture
+def record_property(request):
+    """Add an extra properties the calling test.
+    User properties become part of the test report and are available to the
+    configured reporters, like JUnit XML.
+    The fixture is callable with ``(name, value)``, with value being automatically
+    xml-encoded.
+
+    Example::
+
+        def test_function(record_property):
+            record_property("example_key", 1)
+    """
+
+    def append_property(name, value):
+        request.node.user_properties.append((name, value))
+
+    return append_property
+
+
+@pytest.fixture
+def record_xml_property(record_property):
+    """(Deprecated) use record_property."""
+    import warnings
+    from _pytest import deprecated
+
+    warnings.warn(deprecated.RECORD_XML_PROPERTY, DeprecationWarning, stacklevel=2)
+
+    return record_property
+
+
+@pytest.fixture
+def record_xml_attribute(request):
+    """Add extra xml attributes to the tag for the calling test.
+    The fixture is callable with ``(name, value)``, with value being
+    automatically xml-encoded
+    """
+    request.node.warn(
+        code="C3", message="record_xml_attribute is an experimental feature"
+    )
+    xml = getattr(request.config, "_xml", None)
+    if xml is not None:
+        node_reporter = xml.node_reporter(request.node.nodeid)
+        return node_reporter.add_attribute
+    else:
+
+        def add_attr_noop(name, value):
+            pass
+
+        return add_attr_noop
+
+
+def pytest_addoption(parser):
+    group = parser.getgroup("terminal reporting")
+    group.addoption(
+        "--junitxml",
+        "--junit-xml",
+        action="store",
+        dest="xmlpath",
+        metavar="path",
+        type=functools.partial(filename_arg, optname="--junitxml"),
+        default=None,
+        help="create junit-xml style report file at given path.",
+    )
+    group.addoption(
+        "--junitprefix",
+        "--junit-prefix",
+        action="store",
+        metavar="str",
+        default=None,
+        help="prepend prefix to classnames in junit-xml output",
+    )
+    parser.addini(
+        "junit_suite_name", "Test suite name for JUnit report", default="pytest"
+    )
+    parser.addini(
+        "junit_logging",
+        "Write captured log messages to JUnit report: "
+        "one of no|system-out|system-err",
+        default="no",
+    )  # choices=['no', 'stdout', 'stderr'])
+
+
+def pytest_configure(config):
+    xmlpath = config.option.xmlpath
+    # prevent opening xmllog on slave nodes (xdist)
+    if xmlpath and not hasattr(config, "slaveinput"):
+        config._xml = LogXML(
+            xmlpath,
+            config.option.junitprefix,
+            config.getini("junit_suite_name"),
+            config.getini("junit_logging"),
+        )
+        config.pluginmanager.register(config._xml)
+
+
+def pytest_unconfigure(config):
+    xml = getattr(config, "_xml", None)
+    if xml:
+        del config._xml
+        config.pluginmanager.unregister(xml)
+
+
+def mangle_test_address(address):
+    path, possible_open_bracket, params = address.partition("[")
+    names = path.split("::")
+    try:
+        names.remove("()")
+    except ValueError:
+        pass
+    # convert file path to dotted path
+    names[0] = names[0].replace(nodes.SEP, ".")
+    names[0] = _py_ext_re.sub("", names[0])
+    # put any params back
+    names[-1] += possible_open_bracket + params
+    return names
+
+
+class LogXML(object):
+
+    def __init__(self, logfile, prefix, suite_name="pytest", logging="no"):
+        logfile = os.path.expanduser(os.path.expandvars(logfile))
+        self.logfile = os.path.normpath(os.path.abspath(logfile))
+        self.prefix = prefix
+        self.suite_name = suite_name
+        self.logging = logging
+        self.stats = dict.fromkeys(["error", "passed", "failure", "skipped"], 0)
+        self.node_reporters = {}  # nodeid -> _NodeReporter
+        self.node_reporters_ordered = []
+        self.global_properties = []
+        # List of reports that failed on call but teardown is pending.
+        self.open_reports = []
+        self.cnt_double_fail_tests = 0
+
+    def finalize(self, report):
+        nodeid = getattr(report, "nodeid", report)
+        # local hack to handle xdist report order
+        slavenode = getattr(report, "node", None)
+        reporter = self.node_reporters.pop((nodeid, slavenode))
+        if reporter is not None:
+            reporter.finalize()
+
+    def node_reporter(self, report):
+        nodeid = getattr(report, "nodeid", report)
+        # local hack to handle xdist report order
+        slavenode = getattr(report, "node", None)
+
+        key = nodeid, slavenode
+
+        if key in self.node_reporters:
+            # TODO: breasks for --dist=each
+            return self.node_reporters[key]
+
+        reporter = _NodeReporter(nodeid, self)
+
+        self.node_reporters[key] = reporter
+        self.node_reporters_ordered.append(reporter)
+
+        return reporter
+
+    def add_stats(self, key):
+        if key in self.stats:
+            self.stats[key] += 1
+
+    def _opentestcase(self, report):
+        reporter = self.node_reporter(report)
+        reporter.record_testreport(report)
+        return reporter
+
+    def pytest_runtest_logreport(self, report):
+        """handle a setup/call/teardown report, generating the appropriate
+        xml tags as necessary.
+
+        note: due to plugins like xdist, this hook may be called in interlaced
+        order with reports from other nodes. for example:
+
+        usual call order:
+            -> setup node1
+            -> call node1
+            -> teardown node1
+            -> setup node2
+            -> call node2
+            -> teardown node2
+
+        possible call order in xdist:
+            -> setup node1
+            -> call node1
+            -> setup node2
+            -> call node2
+            -> teardown node2
+            -> teardown node1
+        """
+        close_report = None
+        if report.passed:
+            if report.when == "call":  # ignore setup/teardown
+                reporter = self._opentestcase(report)
+                reporter.append_pass(report)
+        elif report.failed:
+            if report.when == "teardown":
+                # The following vars are needed when xdist plugin is used
+                report_wid = getattr(report, "worker_id", None)
+                report_ii = getattr(report, "item_index", None)
+                close_report = next(
+                    (
+                        rep
+                        for rep in self.open_reports
+                        if (
+                            rep.nodeid == report.nodeid
+                            and getattr(rep, "item_index", None) == report_ii
+                            and getattr(rep, "worker_id", None) == report_wid
+                        )
+                    ),
+                    None,
+                )
+                if close_report:
+                    # We need to open new testcase in case we have failure in
+                    # call and error in teardown in order to follow junit
+                    # schema
+                    self.finalize(close_report)
+                    self.cnt_double_fail_tests += 1
+            reporter = self._opentestcase(report)
+            if report.when == "call":
+                reporter.append_failure(report)
+                self.open_reports.append(report)
+            else:
+                reporter.append_error(report)
+        elif report.skipped:
+            reporter = self._opentestcase(report)
+            reporter.append_skipped(report)
+        self.update_testcase_duration(report)
+        if report.when == "teardown":
+            reporter = self._opentestcase(report)
+            reporter.write_captured_output(report)
+
+            for propname, propvalue in report.user_properties:
+                reporter.add_property(propname, propvalue)
+
+            self.finalize(report)
+            report_wid = getattr(report, "worker_id", None)
+            report_ii = getattr(report, "item_index", None)
+            close_report = next(
+                (
+                    rep
+                    for rep in self.open_reports
+                    if (
+                        rep.nodeid == report.nodeid
+                        and getattr(rep, "item_index", None) == report_ii
+                        and getattr(rep, "worker_id", None) == report_wid
+                    )
+                ),
+                None,
+            )
+            if close_report:
+                self.open_reports.remove(close_report)
+
+    def update_testcase_duration(self, report):
+        """accumulates total duration for nodeid from given report and updates
+        the Junit.testcase with the new total if already created.
+        """
+        reporter = self.node_reporter(report)
+        reporter.duration += getattr(report, "duration", 0.0)
+
+    def pytest_collectreport(self, report):
+        if not report.passed:
+            reporter = self._opentestcase(report)
+            if report.failed:
+                reporter.append_collect_error(report)
+            else:
+                reporter.append_collect_skipped(report)
+
+    def pytest_internalerror(self, excrepr):
+        reporter = self.node_reporter("internal")
+        reporter.attrs.update(classname="pytest", name="internal")
+        reporter._add_simple(Junit.error, "internal error", excrepr)
+
+    def pytest_sessionstart(self):
+        self.suite_start_time = time.time()
+
+    def pytest_sessionfinish(self):
+        dirname = os.path.dirname(os.path.abspath(self.logfile))
+        if not os.path.isdir(dirname):
+            os.makedirs(dirname)
+        logfile = open(self.logfile, "w", encoding="utf-8")
+        suite_stop_time = time.time()
+        suite_time_delta = suite_stop_time - self.suite_start_time
+
+        numtests = (
+            self.stats["passed"]
+            + self.stats["failure"]
+            + self.stats["skipped"]
+            + self.stats["error"]
+            - self.cnt_double_fail_tests
+        )
+        logfile.write('<?xml version="1.0" encoding="utf-8"?>')
+
+        logfile.write(
+            Junit.testsuite(
+                self._get_global_properties_node(),
+                [x.to_xml() for x in self.node_reporters_ordered],
+                name=self.suite_name,
+                errors=self.stats["error"],
+                failures=self.stats["failure"],
+                skips=self.stats["skipped"],
+                tests=numtests,
+                time="%.3f" % suite_time_delta,
+            ).unicode(
+                indent=0
+            )
+        )
+        logfile.close()
+
+    def pytest_terminal_summary(self, terminalreporter):
+        terminalreporter.write_sep("-", "generated xml file: %s" % (self.logfile))
+
+    def add_global_property(self, name, value):
+        self.global_properties.append((str(name), bin_xml_escape(value)))
+
+    def _get_global_properties_node(self):
+        """Return a Junit node containing custom properties, if any.
+        """
+        if self.global_properties:
+            return Junit.properties(
+                [
+                    Junit.property(name=name, value=value)
+                    for name, value in self.global_properties
+                ]
+            )
+        return ""
new file mode 100644
--- /dev/null
+++ b/third_party/python/pytest/src/_pytest/logging.py
@@ -0,0 +1,575 @@
+""" Access and control log capturing. """
+from __future__ import absolute_import, division, print_function
+
+import logging
+from contextlib import closing, contextmanager
+import re
+import six
+
+from _pytest.config import create_terminal_writer
+import pytest
+import py
+
+
+DEFAULT_LOG_FORMAT = "%(filename)-25s %(lineno)4d %(levelname)-8s %(message)s"
+DEFAULT_LOG_DATE_FORMAT = "%H:%M:%S"
+
+
+class ColoredLevelFormatter(logging.Formatter):
+    """
+    Colorize the %(levelname)..s part of the log format passed to __init__.
+    """
+
+    LOGLEVEL_COLOROPTS = {
+        logging.CRITICAL: {"red"},
+        logging.ERROR: {"red", "bold"},
+        logging.WARNING: {"yellow"},
+        logging.WARN: {"yellow"},
+        logging.INFO: {"green"},
+        logging.DEBUG: {"purple"},
+        logging.NOTSET: set(),
+    }
+    LEVELNAME_FMT_REGEX = re.compile(r"%\(levelname\)([+-]?\d*s)")
+
+    def __init__(self, terminalwriter, *args, **kwargs):
+        super(ColoredLevelFormatter, self).__init__(*args, **kwargs)
+        if six.PY2:
+            self._original_fmt = self._fmt
+        else:
+            self._original_fmt = self._style._fmt
+        self._level_to_fmt_mapping = {}
+
+        levelname_fmt_match = self.LEVELNAME_FMT_REGEX.search(self._fmt)
+        if not levelname_fmt_match:
+            return
+        levelname_fmt = levelname_fmt_match.group()
+
+        for level, color_opts in self.LOGLEVEL_COLOROPTS.items():
+            formatted_levelname = levelname_fmt % {
+                "levelname": logging.getLevelName(level)
+            }
+
+            # add ANSI escape sequences around the formatted levelname
+            color_kwargs = {name: True for name in color_opts}
+            colorized_formatted_levelname = terminalwriter.markup(
+                formatted_levelname, **color_kwargs
+            )
+            self._level_to_fmt_mapping[level] = self.LEVELNAME_FMT_REGEX.sub(
+                colorized_formatted_levelname, self._fmt
+            )
+
+    def format(self, record):
+        fmt = self._level_to_fmt_mapping.get(record.levelno, self._original_fmt)
+        if six.PY2:
+            self._fmt = fmt
+        else:
+            self._style._fmt = fmt
+        return super(ColoredLevelFormatter, self).format(record)
+
+
+def get_option_ini(config, *names):
+    for name in names:
+        ret = config.getoption(name)  # 'default' arg won't work as expected
+        if ret is None:
+            ret = config.getini(name)
+        if ret:
+            return ret
+
+
+def pytest_addoption(parser):
+    """Add options to control log capturing."""
+    group = parser.getgroup("logging")
+
+    def add_option_ini(option, dest, default=None, type=None, **kwargs):
+        parser.addini(
+            dest, default=default, type=type, help="default value for " + option
+        )
+        group.addoption(option, dest=dest, **kwargs)
+
+    add_option_ini(
+        "--no-print-logs",
+        dest="log_print",
+        action="store_const",
+        const=False,
+        default=True,
+        type="bool",
+        help="disable printing caught logs on failed tests.",
+    )
+    add_option_ini(
+        "--log-level",
+        dest="log_level",
+        default=None,
+        help="logging level used by the logging module",
+    )
+    add_option_ini(
+        "--log-format",
+        dest="log_format",
+        default=DEFAULT_LOG_FORMAT,
+        help="log format as used by the logging module.",
+    )
+    add_option_ini(
+        "--log-date-format",
+        dest="log_date_format",
+        default=DEFAULT_LOG_DATE_FORMAT,
+        help="log date format as used by the logging module.",
+    )
+    parser.addini(
+        "log_cli",
+        default=False,
+        type="bool",
+        help='enable log display during test run (also known as "live logging").',
+    )
+    add_option_ini(
+        "--log-cli-level", dest="log_cli_level", default=None, help="cli logging level."
+    )
+    add_option_ini(
+        "--log-cli-format",
+        dest="log_cli_format",
+        default=None,
+        help="log format as used by the logging module.",
+    )
+    add_option_ini(
+        "--log-cli-date-format",
+        dest="log_cli_date_format",
+        default=None,
+        help="log date format as used by the logging module.",
+    )
+    add_option_ini(
+        "--log-file",
+        dest="log_file",
+        default=None,
+        help="path to a file when logging will be written to.",
+    )
+    add_option_ini(
+        "--log-file-level",
+        dest="log_file_level",
+        default=None,
+        help="log file logging level.",
+    )
+    add_option_ini(
+        "--log-file-format",
+        dest="log_file_format",
+        default=DEFAULT_LOG_FORMAT,
+        help="log format as used by the logging module.",
+    )
+    add_option_ini(
+        "--log-file-date-format",
+        dest="log_file_date_format",
+        default=DEFAULT_LOG_DATE_FORMAT,
+        help="log date format as used by the logging module.",
+    )
+
+
+@contextmanager
+def catching_logs(handler, formatter=None, level=None):
+    """Context manager that prepares the whole logging machinery properly."""
+    root_logger = logging.getLogger()
+
+    if formatter is not None:
+        handler.setFormatter(formatter)
+    if level is not None:
+        handler.setLevel(level)
+
+    # Adding the same handler twice would confuse logging system.
+    # Just don't do that.
+    add_new_handler = handler not in root_logger.handlers
+
+    if add_new_handler:
+        root_logger.addHandler(handler)
+    if level is not None:
+        orig_level = root_logger.level
+        root_logger.setLevel(min(orig_level, level))
+    try:
+        yield handler
+    finally:
+        if level is not None:
+            root_logger.setLevel(orig_level)
+        if add_new_handler:
+            root_logger.removeHandler(handler)
+
+
+class LogCaptureHandler(logging.StreamHandler):
+    """A logging handler that stores log records and the log text."""
+
+    def __init__(self):
+        """Creates a new log handler."""
+        logging.StreamHandler.__init__(self, py.io.TextIO())
+        self.records = []
+
+    def emit(self, record):
+        """Keep the log records in a list in addition to the log text."""
+        self.records.append(record)
+        logging.StreamHandler.emit(self, record)
+
+    def reset(self):
+        self.records = []
+        self.stream = py.io.TextIO()
+
+
+class LogCaptureFixture(object):
+    """Provides access and control of log capturing."""
+
+    def __init__(self, item):
+        """Creates a new funcarg."""
+        self._item = item
+        self._initial_log_levels = {}  # type: Dict[str, int] # dict of log name -> log level
+
+    def _finalize(self):
+        """Finalizes the fixture.
+
+        This restores the log levels changed by :meth:`set_level`.
+        """
+        # restore log levels
+        for logger_name, level in self._initial_log_levels.items():
+            logger = logging.getLogger(logger_name)
+            logger.setLevel(level)
+
+    @property
+    def handler(self):
+        """
+        :rtype: LogCaptureHandler
+        """
+        return self._item.catch_log_handler
+
+    def get_records(self, when):
+        """
+        Get the logging records for one of the possible test phases.
+
+        :param str when:
+            Which test phase to obtain the records from. Valid values are: "setup", "call" and "teardown".
+
+        :rtype: List[logging.LogRecord]
+        :return: the list of captured records at the given stage
+
+        .. versionadded:: 3.4
+        """
+        handler = self._item.catch_log_handlers.get(when)
+        if handler:
+            return handler.records
+        else:
+            return []
+
+    @property
+    def text(self):
+        """Returns the log text."""
+        return self.handler.stream.getvalue()
+
+    @property
+    def records(self):
+        """Returns the list of log records."""
+        return self.handler.records
+
+    @property
+    def record_tuples(self):
+        """Returns a list of a striped down version of log records intended
+        for use in assertion comparison.
+
+        The format of the tuple is:
+
+            (logger_name, log_level, message)
+        """
+        return [(r.name, r.levelno, r.getMessage()) for r in self.records]
+
+    def clear(self):
+        """Reset the list of log records and the captured log text."""
+        self.handler.reset()
+
+    def set_level(self, level, logger=None):
+        """Sets the level for capturing of logs. The level will be restored to its previous value at the end of
+        the test.
+
+        :param int level: the logger to level.
+        :param str logger: the logger to update the level. If not given, the root logger level is updated.
+
+        .. versionchanged:: 3.4
+            The levels of the loggers changed by this function will be restored to their initial values at the
+            end of the test.
+        """
+        logger_name = logger
+        logger = logging.getLogger(logger_name)
+        # save the original log-level to restore it during teardown
+        self._initial_log_levels.setdefault(logger_name, logger.level)
+        logger.setLevel(level)
+
+    @contextmanager
+    def at_level(self, level, logger=None):
+        """Context manager that sets the level for capturing of logs. After the end of the 'with' statement the
+        level is restored to its original value.
+
+        :param int level: the logger to level.
+        :param str logger: the logger to update the level. If not given, the root logger level is updated.
+        """
+        logger = logging.getLogger(logger)
+        orig_level = logger.level
+        logger.setLevel(level)
+        try:
+            yield
+        finally:
+            logger.setLevel(orig_level)
+
+
+@pytest.fixture
+def caplog(request):
+    """Access and control log capturing.
+
+    Captured logs are available through the following methods::
+
+    * caplog.text            -> string containing formatted log output
+    * caplog.records         -> list of logging.LogRecord instances
+    * caplog.record_tuples   -> list of (logger_name, level, message) tuples
+    * caplog.clear()         -> clear captured records and formatted log output string
+    """
+    result = LogCaptureFixture(request.node)
+    yield result
+    result._finalize()
+
+
+def get_actual_log_level(config, *setting_names):
+    """Return the actual logging level."""
+
+    for setting_name in setting_names:
+        log_level = config.getoption(setting_name)
+        if log_level is None:
+            log_level = config.getini(setting_name)
+        if log_level:
+            break
+    else:
+        return
+
+    if isinstance(log_level, six.string_types):
+        log_level = log_level.upper()
+    try:
+        return int(getattr(logging, log_level, log_level))
+    except ValueError:
+        # Python logging does not recognise this as a logging level
+        raise pytest.UsageError(
+            "'{}' is not recognized as a logging level name for "
+            "'{}'. Please consider passing the "
+            "logging level num instead.".format(log_level, setting_name)
+        )
+
+
+def pytest_configure(config):
+    config.pluginmanager.register(LoggingPlugin(config), "logging-plugin")
+
+
+@contextmanager
+def _dummy_context_manager():
+    yield
+
+
+class LoggingPlugin(object):
+    """Attaches to the logging module and captures log messages for each test.
+    """
+
+    def __init__(self, config):
+        """Creates a new plugin to capture log messages.
+
+        The formatter can be safely shared across all handlers so
+        create a single one for the entire test session here.
+        """
+        self._config = config
+
+        # enable verbose output automatically if live logging is enabled
+        if self._log_cli_enabled() and not config.getoption("verbose"):
+            # sanity check: terminal reporter should not have been loaded at this point
+            assert self._config.pluginmanager.get_plugin("terminalreporter") is None
+            config.option.verbose = 1
+
+        self.print_logs = get_option_ini(config, "log_print")
+        self.formatter = logging.Formatter(
+            get_option_ini(config, "log_format"),
+            get_option_ini(config, "log_date_format"),
+        )
+        self.log_level = get_actual_log_level(config, "log_level")
+
+        log_file = get_option_ini(config, "log_file")
+        if log_file:
+            self.log_file_level = get_actual_log_level(config, "log_file_level")
+
+            log_file_format = get_option_ini(config, "log_file_format", "log_format")
+            log_file_date_format = get_option_ini(
+                config, "log_file_date_format", "log_date_format"
+            )
+            # Each pytest runtests session will write to a clean logfile
+            self.log_file_handler = logging.FileHandler(log_file, mode="w")
+            log_file_formatter = logging.Formatter(
+                log_file_format, datefmt=log_file_date_format
+            )
+            self.log_file_handler.setFormatter(log_file_formatter)
+        else:
+            self.log_file_handler = None
+
+        # initialized during pytest_runtestloop
+        self.log_cli_handler = None
+
+    def _log_cli_enabled(self):
+        """Return True if log_cli should be considered enabled, either explicitly
+        or because --log-cli-level was given in the command-line.
+        """
+        return self._config.getoption(
+            "--log-cli-level"
+        ) is not None or self._config.getini(
+            "log_cli"
+        )
+
+    @contextmanager
+    def _runtest_for(self, item, when):
+        """Implements the internals of pytest_runtest_xxx() hook."""
+        with catching_logs(
+            LogCaptureHandler(), formatter=self.formatter, level=self.log_level
+        ) as log_handler:
+            if self.log_cli_handler:
+                self.log_cli_handler.set_when(when)
+
+            if item is None:
+                yield  # run the test
+                return
+
+            if not hasattr(item, "catch_log_handlers"):
+                item.catch_log_handlers = {}
+            item.catch_log_handlers[when] = log_handler
+            item.catch_log_handler = log_handler
+            try:
+                yield  # run test
+            finally:
+                del item.catch_log_handler
+                if when == "teardown":
+                    del item.catch_log_handlers
+
+            if self.print_logs:
+                # Add a captured log section to the report.
+                log = log_handler.stream.getvalue().strip()
+                item.add_report_section(when, "log", log)
+
+    @pytest.hookimpl(hookwrapper=True)
+    def pytest_runtest_setup(self, item):
+        with self._runtest_for(item, "setup"):
+            yield
+
+    @pytest.hookimpl(hookwrapper=True)
+    def pytest_runtest_call(self, item):
+        with self._runtest_for(item, "call"):
+            yield
+
+    @pytest.hookimpl(hookwrapper=True)
+    def pytest_runtest_teardown(self, item):
+        with self._runtest_for(item, "teardown"):
+            yield
+
+    @pytest.hookimpl(hookwrapper=True)
+    def pytest_runtest_logstart(self):
+        if self.log_cli_handler:
+            self.log_cli_handler.reset()
+        with self._runtest_for(None, "start"):
+            yield
+
+    @pytest.hookimpl(hookwrapper=True)
+    def pytest_runtest_logfinish(self):
+        with self._runtest_for(None, "finish"):
+            yield
+
+    @pytest.hookimpl(hookwrapper=True)
+    def pytest_runtestloop(self, session):
+        """Runs all collected test items."""
+        self._setup_cli_logging()
+        with self.live_logs_context:
+            if self.log_file_handler is not None:
+                with closing(self.log_file_handler):
+                    with catching_logs(
+                        self.log_file_handler, level=self.log_file_level
+                    ):
+                        yield  # run all the tests
+            else:
+                yield  # run all the tests
+
+    def _setup_cli_logging(self):
+        """Sets up the handler and logger for the Live Logs feature, if enabled.
+
+        This must be done right before starting the loop so we can access the terminal reporter plugin.
+        """
+        terminal_reporter = self._config.pluginmanager.get_plugin("terminalreporter")
+        if self._log_cli_enabled() and terminal_reporter is not None:
+            capture_manager = self._config.pluginmanager.get_plugin("capturemanager")
+            log_cli_handler = _LiveLoggingStreamHandler(
+                terminal_reporter, capture_manager
+            )
+            log_cli_format = get_option_ini(
+                self._config, "log_cli_format", "log_format"
+            )
+            log_cli_date_format = get_option_ini(
+                self._config, "log_cli_date_format", "log_date_format"
+            )
+            if (
+                self._config.option.color != "no"
+                and ColoredLevelFormatter.LEVELNAME_FMT_REGEX.search(log_cli_format)
+            ):
+                log_cli_formatter = ColoredLevelFormatter(
+                    create_terminal_writer(self._config),
+                    log_cli_format,
+                    datefmt=log_cli_date_format,
+                )
+            else:
+                log_cli_formatter = logging.Formatter(
+                    log_cli_format, datefmt=log_cli_date_format
+                )
+            log_cli_level = get_actual_log_level(
+                self._config, "log_cli_level", "log_level"
+            )
+            self.log_cli_handler = log_cli_handler
+            self.live_logs_context = catching_logs(
+                log_cli_handler, formatter=log_cli_formatter, level=log_cli_level
+            )
+        else:
+            self.live_logs_context = _dummy_context_manager()
+
+
+class _LiveLoggingStreamHandler(logging.StreamHandler):
+    """
+    Custom StreamHandler used by the live logging feature: it will write a newline before the first log message
+    in each test.
+
+    During live logging we must also explicitly disable stdout/stderr capturing otherwise it will get captured
+    and won't appear in the terminal.
+    """
+
+    def __init__(self, terminal_reporter, capture_manager):
+        """
+        :param _pytest.terminal.TerminalReporter terminal_reporter:
+        :param _pytest.capture.CaptureManager capture_manager:
+        """
+        logging.StreamHandler.__init__(self, stream=terminal_reporter)
+        self.capture_manager = capture_manager
+        self.reset()
+        self.set_when(None)
+        self._test_outcome_written = False
+
+    def reset(self):
+        """Reset the handler; should be called before the start of each test"""
+        self._first_record_emitted = False
+
+    def set_when(self, when):
+        """Prepares for the given test phase (setup/call/teardown)"""
+        self._when = when
+        self._section_name_shown = False
+        if when == "start":
+            self._test_outcome_written = False
+
+    def emit(self, record):
+        if self.capture_manager is not None:
+            self.capture_manager.suspend_global_capture()
+        try:
+            if not self._first_record_emitted:
+                self.stream.write("\n")
+                self._first_record_emitted = True
+            elif self._when in ("teardown", "finish"):
+                if not self._test_outcome_written:
+                    self._test_outcome_written = True
+                    self.stream.write("\n")
+            if not self._section_name_shown and self._when:
+                self.stream.section("live log " + self._when, sep="-", bold=True)
+                self._section_name_shown = True
+            logging.StreamHandler.emit(self, record)
+        finally:
+            if self.capture_manager is not None:
+                self.capture_manager.resume_global_capture()
new file mode 100644
--- /dev/null
+++ b/third_party/python/pytest/src/_pytest/main.py
@@ -0,0 +1,611 @@
+""" core implementation of testing process: init, session, runtest loop. """
+from __future__ import absolute_import, division, print_function
+
+import contextlib
+import functools
+import os
+import pkgutil
+import six
+import sys
+
+import _pytest
+from _pytest import nodes
+import _pytest._code
+import py
+
+from _pytest.config import directory_arg, UsageError, hookimpl
+from _pytest.outcomes import exit
+from _pytest.runner import collect_one_node
+
+
+# exitcodes for the command line
+EXIT_OK = 0
+EXIT_TESTSFAILED = 1
+EXIT_INTERRUPTED = 2
+EXIT_INTERNALERROR = 3
+EXIT_USAGEERROR = 4
+EXIT_NOTESTSCOLLECTED = 5
+
+
+def pytest_addoption(parser):
+    parser.addini(
+        "norecursedirs",
+        "directory patterns to avoid for recursion",
+        type="args",
+        default=[".*", "build", "dist", "CVS", "_darcs", "{arch}", "*.egg", "venv"],
+    )
+    parser.addini(
+        "testpaths",
+        "directories to search for tests when no files or directories are given in the "
+        "command line.",
+        type="args",
+        default=[],
+    )
+    # parser.addini("dirpatterns",
+    #    "patterns specifying possible locations of test files",
+    #    type="linelist", default=["**/test_*.txt",
+    #            "**/test_*.py", "**/*_test.py"]
+    # )
+    group = parser.getgroup("general", "running and selection options")
+    group._addoption(
+        "-x",
+        "--exitfirst",
+        action="store_const",
+        dest="maxfail",
+        const=1,
+        help="exit instantly on first error or failed test.",
+    ),
+    group._addoption(
+        "--maxfail",
+        metavar="num",
+        action="store",
+        type=int,
+        dest="maxfail",
+        default=0,
+        help="exit after first num failures or errors.",
+    )
+    group._addoption(
+        "--strict",
+        action="store_true",
+        help="marks not registered in configuration file raise errors.",
+    )
+    group._addoption(
+        "-c",
+        metavar="file",
+        type=str,
+        dest="inifilename",
+        help="load configuration from `file` instead of trying to locate one of the implicit "
+        "configuration files.",
+    )
+    group._addoption(
+        "--continue-on-collection-errors",
+        action="store_true",
+        default=False,
+        dest="continue_on_collection_errors",
+        help="Force test execution even if collection errors occur.",
+    )
+    group._addoption(
+        "--rootdir",
+        action="store",
+        dest="rootdir",
+        help="Define root directory for tests. Can be relative path: 'root_dir', './root_dir', "
+        "'root_dir/another_dir/'; absolute path: '/home/user/root_dir'; path with variables: "
+        "'$HOME/root_dir'.",
+    )
+
+    group = parser.getgroup("collect", "collection")
+    group.addoption(
+        "--collectonly",
+        "--collect-only",
+        action="store_true",
+        help="only collect tests, don't execute them.",
+    ),
+    group.addoption(
+        "--pyargs",
+        action="store_true",
+        help="try to interpret all arguments as python packages.",
+    )
+    group.addoption(
+        "--ignore",
+        action="append",
+        metavar="path",
+        help="ignore path during collection (multi-allowed).",
+    )
+    group.addoption(
+        "--deselect",
+        action="append",
+        metavar="nodeid_prefix",
+        help="deselect item during collection (multi-allowed).",
+    )
+    # when changing this to --conf-cut-dir, config.py Conftest.setinitial
+    # needs upgrading as well
+    group.addoption(
+        "--confcutdir",
+        dest="confcutdir",
+        default=None,
+        metavar="dir",
+        type=functools.partial(directory_arg, optname="--confcutdir"),
+        help="only load conftest.py's relative to specified dir.",
+    )
+    group.addoption(
+        "--noconftest",
+        action="store_true",
+        dest="noconftest",
+        default=False,
+        help="Don't load any conftest.py files.",
+    )
+    group.addoption(
+        "--keepduplicates",
+        "--keep-duplicates",
+        action="store_true",
+        dest="keepduplicates",
+        default=False,
+        help="Keep duplicate tests.",
+    )
+    group.addoption(
+        "--collect-in-virtualenv",
+        action="store_true",
+        dest="collect_in_virtualenv",
+        default=False,
+        help="Don't ignore tests in a local virtualenv directory",
+    )
+
+    group = parser.getgroup("debugconfig", "test session debugging and configuration")
+    group.addoption(
+        "--basetemp",
+        dest="basetemp",
+        default=None,
+        metavar="dir",
+        help="base temporary directory for this test run.",
+    )
+
+
+def pytest_configure(config):
+    __import__("pytest").config = config  # compatibility
+
+
+def wrap_session(config, doit):
+    """Skeleton command line program"""
+    session = Session(config)
+    session.exitstatus = EXIT_OK
+    initstate = 0
+    try:
+        try:
+            config._do_configure()
+            initstate = 1
+            config.hook.pytest_sessionstart(session=session)
+            initstate = 2
+            session.exitstatus = doit(config, session) or 0
+        except UsageError:
+            raise
+        except Failed:
+            session.exitstatus = EXIT_TESTSFAILED
+        except KeyboardInterrupt:
+            excinfo = _pytest._code.ExceptionInfo()
+            if initstate < 2 and isinstance(excinfo.value, exit.Exception):
+                sys.stderr.write("{}: {}\n".format(excinfo.typename, excinfo.value.msg))
+            config.hook.pytest_keyboard_interrupt(excinfo=excinfo)
+            session.exitstatus = EXIT_INTERRUPTED
+        except:  # noqa
+            excinfo = _pytest._code.ExceptionInfo()
+            config.notify_exception(excinfo, config.option)
+            session.exitstatus = EXIT_INTERNALERROR
+            if excinfo.errisinstance(SystemExit):
+                sys.stderr.write("mainloop: caught Spurious SystemExit!\n")
+
+    finally:
+        excinfo = None  # Explicitly break reference cycle.
+        session.startdir.chdir()
+        if initstate >= 2:
+            config.hook.pytest_sessionfinish(
+                session=session, exitstatus=session.exitstatus
+            )
+        config._ensure_unconfigure()
+    return session.exitstatus
+
+
+def pytest_cmdline_main(config):
+    return wrap_session(config, _main)
+
+
+def _main(config, session):
+    """ default command line protocol for initialization, session,
+    running tests and reporting. """
+    config.hook.pytest_collection(session=session)
+    config.hook.pytest_runtestloop(session=session)
+
+    if session.testsfailed:
+        return EXIT_TESTSFAILED
+    elif session.testscollected == 0:
+        return EXIT_NOTESTSCOLLECTED
+
+
+def pytest_collection(session):
+    return session.perform_collect()
+
+
+def pytest_runtestloop(session):
+    if session.testsfailed and not session.config.option.continue_on_collection_errors:
+        raise session.Interrupted("%d errors during collection" % session.testsfailed)
+
+    if session.config.option.collectonly:
+        return True
+
+    for i, item in enumerate(session.items):
+        nextitem = session.items[i + 1] if i + 1 < len(session.items) else None
+        item.config.hook.pytest_runtest_protocol(item=item, nextitem=nextitem)
+        if session.shouldfail:
+            raise session.Failed(session.shouldfail)
+        if session.shouldstop:
+            raise session.Interrupted(session.shouldstop)
+    return True
+
+
+def _in_venv(path):
+    """Attempts to detect if ``path`` is the root of a Virtual Environment by
+    checking for the existence of the appropriate activate script"""
+    bindir = path.join("Scripts" if sys.platform.startswith("win") else "bin")
+    if not bindir.isdir():
+        return False
+    activates = (
+        "activate",
+        "activate.csh",
+        "activate.fish",
+        "Activate",
+        "Activate.bat",
+        "Activate.ps1",
+    )
+    return any([fname.basename in activates for fname in bindir.listdir()])
+
+
+def pytest_ignore_collect(path, config):
+    ignore_paths = config._getconftest_pathlist("collect_ignore", path=path.dirpath())
+    ignore_paths = ignore_paths or []
+    excludeopt = config.getoption("ignore")
+    if excludeopt:
+        ignore_paths.extend([py.path.local(x) for x in excludeopt])
+
+    if py.path.local(path) in ignore_paths:
+        return True
+
+    allow_in_venv = config.getoption("collect_in_virtualenv")
+    if _in_venv(path) and not allow_in_venv:
+        return True
+
+    # Skip duplicate paths.
+    keepduplicates = config.getoption("keepduplicates")
+    duplicate_paths = config.pluginmanager._duplicatepaths
+    if not keepduplicates:
+        if path in duplicate_paths:
+            return True
+        else:
+            duplicate_paths.add(path)
+
+    return False
+
+
+def pytest_collection_modifyitems(items, config):
+    deselect_prefixes = tuple(config.getoption("deselect") or [])
+    if not deselect_prefixes:
+        return
+
+    remaining = []
+    deselected = []
+    for colitem in items:
+        if colitem.nodeid.startswith(deselect_prefixes):
+            deselected.append(colitem)
+        else:
+            remaining.append(colitem)
+
+    if deselected:
+        config.hook.pytest_deselected(items=deselected)
+        items[:] = remaining
+
+
+@contextlib.contextmanager
+def _patched_find_module():
+    """Patch bug in pkgutil.ImpImporter.find_module
+
+    When using pkgutil.find_loader on python<3.4 it removes symlinks
+    from the path due to a call to os.path.realpath. This is not consistent
+    with actually doing the import (in these versions, pkgutil and __import__
+    did not share the same underlying code). This can break conftest
+    discovery for pytest where symlinks are involved.
+
+    The only supported python<3.4 by pytest is python 2.7.
+    """
+    if six.PY2:  # python 3.4+ uses importlib instead
+
+        def find_module_patched(self, fullname, path=None):
+            # Note: we ignore 'path' argument since it is only used via meta_path
+            subname = fullname.split(".")[-1]
+            if subname != fullname and self.path is None:
+                return None
+            if self.path is None:
+                path = None
+            else:
+                # original: path = [os.path.realpath(self.path)]
+                path = [self.path]
+            try:
+                file, filename, etc = pkgutil.imp.find_module(subname, path)
+            except ImportError:
+                return None
+            return pkgutil.ImpLoader(fullname, file, filename, etc)
+
+        old_find_module = pkgutil.ImpImporter.find_module
+        pkgutil.ImpImporter.find_module = find_module_patched
+        try:
+            yield
+        finally:
+            pkgutil.ImpImporter.find_module = old_find_module
+    else:
+        yield
+
+
+class FSHookProxy(object):
+
+    def __init__(self, fspath, pm, remove_mods):
+        self.fspath = fspath
+        self.pm = pm
+        self.remove_mods = remove_mods
+
+    def __getattr__(self, name):
+        x = self.pm.subset_hook_caller(name, remove_plugins=self.remove_mods)
+        self.__dict__[name] = x
+        return x
+
+
+class NoMatch(Exception):
+    """ raised if matching cannot locate a matching names. """
+
+
+class Interrupted(KeyboardInterrupt):
+    """ signals an interrupted test run. """
+    __module__ = "builtins"  # for py3
+
+
+class Failed(Exception):
+    """ signals a stop as failed test run. """
+
+
+class Session(nodes.FSCollector):
+    Interrupted = Interrupted
+    Failed = Failed
+
+    def __init__(self, config):
+        nodes.FSCollector.__init__(
+            self, config.rootdir, parent=None, config=config, session=self, nodeid=""
+        )
+        self.testsfailed = 0
+        self.testscollected = 0
+        self.shouldstop = False
+        self.shouldfail = False
+        self.trace = config.trace.root.get("collection")
+        self._norecursepatterns = config.getini("norecursedirs")
+        self.startdir = py.path.local()
+
+        self.config.pluginmanager.register(self, name="session")
+
+    @hookimpl(tryfirst=True)
+    def pytest_collectstart(self):
+        if self.shouldfail:
+            raise self.Failed(self.shouldfail)
+        if self.shouldstop:
+            raise self.Interrupted(self.shouldstop)
+
+    @hookimpl(tryfirst=True)
+    def pytest_runtest_logreport(self, report):
+        if report.failed and not hasattr(report, "wasxfail"):
+            self.testsfailed += 1
+            maxfail = self.config.getvalue("maxfail")
+            if maxfail and self.testsfailed >= maxfail:
+                self.shouldfail = "stopping after %d failures" % (self.testsfailed)
+
+    pytest_collectreport = pytest_runtest_logreport
+
+    def isinitpath(self, path):
+        return path in self._initialpaths
+
+    def gethookproxy(self, fspath):
+        # check if we have the common case of running
+        # hooks with all conftest.py files
+        pm = self.config.pluginmanager
+        my_conftestmodules = pm._getconftestmodules(fspath)
+        remove_mods = pm._conftest_plugins.difference(my_conftestmodules)
+        if remove_mods:
+            # one or more conftests are not in use at this fspath
+            proxy = FSHookProxy(fspath, pm, remove_mods)
+        else:
+            # all plugis are active for this fspath
+            proxy = self.config.hook
+        return proxy
+
+    def perform_collect(self, args=None, genitems=True):
+        hook = self.config.hook
+        try:
+            items = self._perform_collect(args, genitems)
+            self.config.pluginmanager.check_pending()
+            hook.pytest_collection_modifyitems(
+                session=self, config=self.config, items=items
+            )
+        finally:
+            hook.pytest_collection_finish(session=self)
+        self.testscollected = len(items)
+        return items
+
+    def _perform_collect(self, args, genitems):
+        if args is None:
+            args = self.config.args
+        self.trace("perform_collect", self, args)
+        self.trace.root.indent += 1
+        self._notfound = []
+        self._initialpaths = set()
+        self._initialparts = []
+        self.items = items = []
+        for arg in args:
+            parts = self._parsearg(arg)
+            self._initialparts.append(parts)
+            self._initialpaths.add(parts[0])
+        rep = collect_one_node(self)
+        self.ihook.pytest_collectreport(report=rep)
+        self.trace.root.indent -= 1
+        if self._notfound:
+            errors = []
+            for arg, exc in self._notfound:
+                line = "(no name %r in any of %r)" % (arg, exc.args[0])
+                errors.append("not found: %s\n%s" % (arg, line))
+                # XXX: test this
+            raise UsageError(*errors)
+        if not genitems:
+            return rep.result
+        else:
+            if rep.passed:
+                for node in rep.result:
+                    self.items.extend(self.genitems(node))
+            return items
+
+    def collect(self):
+        for parts in self._initialparts:
+            arg = "::".join(map(str, parts))
+            self.trace("processing argument", arg)
+            self.trace.root.indent += 1
+            try:
+                for x in self._collect(arg):
+                    yield x
+            except NoMatch:
+                # we are inside a make_report hook so
+                # we cannot directly pass through the exception
+                self._notfound.append((arg, sys.exc_info()[1]))
+
+            self.trace.root.indent -= 1
+
+    def _collect(self, arg):
+        names = self._parsearg(arg)
+        path = names.pop(0)
+        if path.check(dir=1):
+            assert not names, "invalid arg %r" % (arg,)
+            for path in path.visit(
+                fil=lambda x: x.check(file=1), rec=self._recurse, bf=True, sort=True
+            ):
+                for x in self._collectfile(path):
+                    yield x
+        else:
+            assert path.check(file=1)
+            for x in self.matchnodes(self._collectfile(path), names):
+                yield x
+
+    def _collectfile(self, path):
+        ihook = self.gethookproxy(path)
+        if not self.isinitpath(path):
+            if ihook.pytest_ignore_collect(path=path, config=self.config):
+                return ()
+        return ihook.pytest_collect_file(path=path, parent=self)
+
+    def _recurse(self, path):
+        ihook = self.gethookproxy(path.dirpath())
+        if ihook.pytest_ignore_collect(path=path, config=self.config):
+            return
+        for pat in self._norecursepatterns:
+            if path.check(fnmatch=pat):
+                return False
+        ihook = self.gethookproxy(path)
+        ihook.pytest_collect_directory(path=path, parent=self)
+        return True
+
+    def _tryconvertpyarg(self, x):
+        """Convert a dotted module name to path.
+
+        """
+
+        try:
+            with _patched_find_module():
+                loader = pkgutil.find_loader(x)
+        except ImportError:
+            return x
+        if loader is None:
+            return x
+        # This method is sometimes invoked when AssertionRewritingHook, which
+        # does not define a get_filename method, is already in place:
+        try:
+            with _patched_find_module():
+                path = loader.get_filename(x)
+        except AttributeError:
+            # Retrieve path from AssertionRewritingHook:
+            path = loader.modules[x][0].co_filename
+        if loader.is_package(x):
+            path = os.path.dirname(path)
+        return path
+
+    def _parsearg(self, arg):
+        """ return (fspath, names) tuple after checking the file exists. """
+        parts = str(arg).split("::")
+        if self.config.option.pyargs:
+            parts[0] = self._tryconvertpyarg(parts[0])
+        relpath = parts[0].replace("/", os.sep)
+        path = self.config.invocation_dir.join(relpath, abs=True)
+        if not path.check():
+            if self.config.option.pyargs:
+                raise UsageError(
+                    "file or package not found: " + arg + " (missing __init__.py?)"
+                )
+            else:
+                raise UsageError("file not found: " + arg)
+        parts[0] = path
+        return parts
+
+    def matchnodes(self, matching, names):
+        self.trace("matchnodes", matching, names)
+        self.trace.root.indent += 1
+        nodes = self._matchnodes(matching, names)
+        num = len(nodes)
+        self.trace("matchnodes finished -> ", num, "nodes")
+        self.trace.root.indent -= 1
+        if num == 0:
+            raise NoMatch(matching, names[:1])
+        return nodes
+
+    def _matchnodes(self, matching, names):
+        if not matching or not names:
+            return matching
+        name = names[0]
+        assert name
+        nextnames = names[1:]
+        resultnodes = []
+        for node in matching:
+            if isinstance(node, nodes.Item):
+                if not names:
+                    resultnodes.append(node)
+                continue
+            assert isinstance(node, nodes.Collector)
+            rep = collect_one_node(node)
+            if rep.passed:
+                has_matched = False
+                for x in rep.result:
+                    # TODO: remove parametrized workaround once collection structure contains parametrization
+                    if x.name == name or x.name.split("[")[0] == name:
+                        resultnodes.extend(self.matchnodes([x], nextnames))
+                        has_matched = True
+                # XXX accept IDs that don't have "()" for class instances
+                if not has_matched and len(rep.result) == 1 and x.name == "()":
+                    nextnames.insert(0, name)
+                    resultnodes.extend(self.matchnodes([x], nextnames))
+            else:
+                # report collection failures here to avoid failing to run some test
+                # specified in the command line because the module could not be
+                # imported (#134)
+                node.ihook.pytest_collectreport(report=rep)
+        return resultnodes
+
+    def genitems(self, node):
+        self.trace("genitems", node)
+        if isinstance(node, nodes.Item):
+            node.ihook.pytest_itemcollected(item=node)
+            yield node
+        else:
+            assert isinstance(node, nodes.Collector)
+            rep = collect_one_node(node)
+            if rep.passed:
+                for subnode in rep.result:
+                    for x in self.genitems(subnode):
+                        yield x
+            node.ihook.pytest_collectreport(report=rep)
new file mode 100644
--- /dev/null
+++ b/third_party/python/pytest/src/_pytest/mark/__init__.py
@@ -0,0 +1,174 @@
+""" generic mechanism for marking and selecting python functions. """
+from __future__ import absolute_import, division, print_function
+from _pytest.config import UsageError
+from .structures import (
+    ParameterSet,
+    EMPTY_PARAMETERSET_OPTION,
+    MARK_GEN,
+    Mark,
+    MarkInfo,
+    MarkDecorator,
+    MarkGenerator,
+    transfer_markers,
+    get_empty_parameterset_mark,
+)
+from .legacy import matchkeyword, matchmark
+
+__all__ = [
+    "Mark",
+    "MarkInfo",
+    "MarkDecorator",
+    "MarkGenerator",
+    "transfer_markers",
+    "get_empty_parameterset_mark",
+]
+
+
+class MarkerError(Exception):
+
+    """Error in use of a pytest marker/attribute."""
+
+
+def param(*values, **kw):
+    """Specify a parameter in `pytest.mark.parametrize`_ calls or
+    :ref:`parametrized fixtures <fixture-parametrize-marks>`.
+
+    .. code-block:: python
+
+        @pytest.mark.parametrize("test_input,expected", [
+            ("3+5", 8),
+            pytest.param("6*9", 42, marks=pytest.mark.xfail),
+        ])
+        def test_eval(test_input, expected):
+            assert eval(test_input) == expected
+
+    :param values: variable args of the values of the parameter set, in order.
+    :keyword marks: a single mark or a list of marks to be applied to this parameter set.
+    :keyword str id: the id to attribute to this parameter set.
+    """
+    return ParameterSet.param(*values, **kw)
+
+
+def pytest_addoption(parser):
+    group = parser.getgroup("general")
+    group._addoption(
+        "-k",
+        action="store",
+        dest="keyword",
+        default="",
+        metavar="EXPRESSION",
+        help="only run tests which match the given substring expression. "
+        "An expression is a python evaluatable expression "
+        "where all names are substring-matched against test names "
+        "and their parent classes. Example: -k 'test_method or test_"
+        "other' matches all test functions and classes whose name "
+        "contains 'test_method' or 'test_other', while -k 'not test_method' "
+        "matches those that don't contain 'test_method' in their names. "
+        "Additionally keywords are matched to classes and functions "
+        "containing extra names in their 'extra_keyword_matches' set, "
+        "as well as functions which have names assigned directly to them.",
+    )
+
+    group._addoption(
+        "-m",
+        action="store",
+        dest="markexpr",
+        default="",
+        metavar="MARKEXPR",
+        help="only run tests matching given mark expression.  "
+        "example: -m 'mark1 and not mark2'.",
+    )
+
+    group.addoption(
+        "--markers",
+        action="store_true",
+        help="show markers (builtin, plugin and per-project ones).",
+    )
+
+    parser.addini("markers", "markers for test functions", "linelist")
+    parser.addini(EMPTY_PARAMETERSET_OPTION, "default marker for empty parametersets")
+
+
+def pytest_cmdline_main(config):
+    import _pytest.config
+
+    if config.option.markers:
+        config._do_configure()
+        tw = _pytest.config.create_terminal_writer(config)
+        for line in config.getini("markers"):
+            parts = line.split(":", 1)
+            name = parts[0]
+            rest = parts[1] if len(parts) == 2 else ""
+            tw.write("@pytest.mark.%s:" % name, bold=True)
+            tw.line(rest)
+            tw.line()
+        config._ensure_unconfigure()
+        return 0
+
+
+pytest_cmdline_main.tryfirst = True
+
+
+def deselect_by_keyword(items, config):
+    keywordexpr = config.option.keyword.lstrip()
+    if keywordexpr.startswith("-"):
+        keywordexpr = "not " + keywordexpr[1:]
+    selectuntil = False
+    if keywordexpr[-1:] == ":":
+        selectuntil = True
+        keywordexpr = keywordexpr[:-1]
+
+    remaining = []
+    deselected = []
+    for colitem in items:
+        if keywordexpr and not matchkeyword(colitem, keywordexpr):
+            deselected.append(colitem)
+        else:
+            if selectuntil:
+                keywordexpr = None
+            remaining.append(colitem)
+
+    if deselected:
+        config.hook.pytest_deselected(items=deselected)
+        items[:] = remaining
+
+
+def deselect_by_mark(items, config):
+    matchexpr = config.option.markexpr
+    if not matchexpr:
+        return
+
+    remaining = []
+    deselected = []
+    for item in items:
+        if matchmark(item, matchexpr):
+            remaining.append(item)
+        else:
+            deselected.append(item)
+
+    if deselected:
+        config.hook.pytest_deselected(items=deselected)
+        items[:] = remaining
+
+
+def pytest_collection_modifyitems(items, config):
+    deselect_by_keyword(items, config)
+    deselect_by_mark(items, config)
+
+
+def pytest_configure(config):
+    config._old_mark_config = MARK_GEN._config
+    if config.option.strict:
+        MARK_GEN._config = config
+
+    empty_parameterset = config.getini(EMPTY_PARAMETERSET_OPTION)
+
+    if empty_parameterset not in ("skip", "xfail", None, ""):
+        raise UsageError(
+            "{!s} must be one of skip and xfail,"
+            " but it is {!r}".format(EMPTY_PARAMETERSET_OPTION, empty_parameterset)
+        )
+
+
+def pytest_unconfigure(config):
+    MARK_GEN._config = getattr(config, "_old_mark_config", None)
new file mode 100644
--- /dev/null
+++ b/third_party/python/pytest/src/_pytest/mark/evaluate.py
@@ -0,0 +1,121 @@
+import os
+import six
+import sys
+import platform
+import traceback
+
+from ..outcomes import fail, TEST_OUTCOME
+
+
+def cached_eval(config, expr, d):
+    if not hasattr(config, "_evalcache"):
+        config._evalcache = {}
+    try:
+        return config._evalcache[expr]
+    except KeyError:
+        import _pytest._code
+
+        exprcode = _pytest._code.compile(expr, mode="eval")
+        config._evalcache[expr] = x = eval(exprcode, d)
+        return x
+
+
+class MarkEvaluator(object):
+
+    def __init__(self, item, name):
+        self.item = item
+        self._marks = None
+        self._mark = None
+        self._mark_name = name
+
+    def __bool__(self):
+        # dont cache here to prevent staleness
+        return bool(self._get_marks())
+
+    __nonzero__ = __bool__
+
+    def wasvalid(self):
+        return not hasattr(self, "exc")
+
+    def _get_marks(self):
+        return list(self.item.iter_markers(name=self._mark_name))
+
+    def invalidraise(self, exc):
+        raises = self.get("raises")
+        if not raises:
+            return
+        return not isinstance(exc, raises)
+
+    def istrue(self):
+        try:
+            return self._istrue()
+        except TEST_OUTCOME:
+            self.exc = sys.exc_info()
+            if isinstance(self.exc[1], SyntaxError):
+                msg = [" " * (self.exc[1].offset + 4) + "^"]
+                msg.append("SyntaxError: invalid syntax")
+            else:
+                msg = traceback.format_exception_only(*self.exc[:2])
+            fail(
+                "Error evaluating %r expression\n"
+                "    %s\n"
+                "%s" % (self._mark_name, self.expr, "\n".join(msg)),
+                pytrace=False,
+            )
+
+    def _getglobals(self):
+        d = {"os": os, "sys": sys, "platform": platform, "config": self.item.config}
+        if hasattr(self.item, "obj"):
+            d.update(self.item.obj.__globals__)
+        return d
+
+    def _istrue(self):
+        if hasattr(self, "result"):
+            return self.result
+        self._marks = self._get_marks()
+
+        if self._marks:
+            self.result = False
+            for mark in self._marks:
+                self._mark = mark
+                if "condition" in mark.kwargs:
+                    args = (mark.kwargs["condition"],)
+                else:
+                    args = mark.args
+
+                for expr in args:
+                    self.expr = expr
+                    if isinstance(expr, six.string_types):
+                        d = self._getglobals()
+                        result = cached_eval(self.item.config, expr, d)
+                    else:
+                        if "reason" not in mark.kwargs:
+                            # XXX better be checked at collection time
+                            msg = "you need to specify reason=STRING " "when using booleans as conditions."
+                            fail(msg)
+                        result = bool(expr)
+                    if result:
+                        self.result = True
+                        self.reason = mark.kwargs.get("reason", None)
+                        self.expr = expr
+                        return self.result
+
+                if not args:
+                    self.result = True
+                    self.reason = mark.kwargs.get("reason", None)
+                    return self.result
+        return False
+
+    def get(self, attr, default=None):
+        if self._mark is None:
+            return default
+        return self._mark.kwargs.get(attr, default)
+
+    def getexplanation(self):
+        expl = getattr(self, "reason", None) or self.get("reason", None)
+        if not expl:
+            if not hasattr(self, "expr"):
+                return ""
+            else:
+                return "condition: " + str(self.expr)
+        return expl
new file mode 100644
--- /dev/null
+++ b/third_party/python/pytest/src/_pytest/mark/legacy.py
@@ -0,0 +1,97 @@
+"""
+this is a place where we put datastructures used by legacy apis
+we hope ot remove
+"""
+import attr
+import keyword
+
+from _pytest.config import UsageError
+
+
+@attr.s
+class MarkMapping(object):
+    """Provides a local mapping for markers where item access
+    resolves to True if the marker is present. """
+
+    own_mark_names = attr.ib()
+
+    @classmethod
+    def from_item(cls, item):
+        mark_names = {mark.name for mark in item.iter_markers()}
+        return cls(mark_names)
+
+    def __getitem__(self, name):
+        return name in self.own_mark_names
+
+
+class KeywordMapping(object):
+    """Provides a local mapping for keywords.
+    Given a list of names, map any substring of one of these names to True.
+    """
+
+    def __init__(self, names):
+        self._names = names
+
+    @classmethod
+    def from_item(cls, item):
+        mapped_names = set()
+
+        # Add the names of the current item and any parent items
+        import pytest
+
+        for item in item.listchain():
+            if not isinstance(item, pytest.Instance):
+                mapped_names.add(item.name)
+
+        # Add the names added as extra keywords to current or parent items
+        for name in item.listextrakeywords():
+            mapped_names.add(name)
+
+        # Add the names attached to the current function through direct assignment
+        if hasattr(item, "function"):
+            for name in item.function.__dict__:
+                mapped_names.add(name)
+
+        return cls(mapped_names)
+
+    def __getitem__(self, subname):
+        for name in self._names:
+            if subname in name:
+                return True
+        return False
+
+
+python_keywords_allowed_list = ["or", "and", "not"]
+
+
+def matchmark(colitem, markexpr):
+    """Tries to match on any marker names, attached to the given colitem."""
+    return eval(markexpr, {}, MarkMapping.from_item(colitem))
+
+
+def matchkeyword(colitem, keywordexpr):
+    """Tries to match given keyword expression to given collector item.
+
+    Will match on the name of colitem, including the names of its parents.
+    Only matches names of items which are either a :class:`Class` or a
+    :class:`Function`.
+    Additionally, matches on names in the 'extra_keyword_matches' set of
+    any item, as well as names directly assigned to test functions.
+    """
+    mapping = KeywordMapping.from_item(colitem)
+    if " " not in keywordexpr:
+        # special case to allow for simple "-k pass" and "-k 1.3"
+        return mapping[keywordexpr]
+    elif keywordexpr.startswith("not ") and " " not in keywordexpr[4:]:
+        return not mapping[keywordexpr[4:]]
+    for kwd in keywordexpr.split():
+        if keyword.iskeyword(kwd) and kwd not in python_keywords_allowed_list:
+            raise UsageError(
+                "Python keyword '{}' not accepted in expressions passed to '-k'".format(
+                    kwd
+                )
+            )
+    try:
+        return eval(keywordexpr, {}, mapping)
+    except SyntaxError:
+        raise UsageError("Wrong expression passed to '-k': {}".format(keywordexpr))
new file mode 100644
--- /dev/null
+++ b/third_party/python/pytest/src/_pytest/mark/structures.py
@@ -0,0 +1,428 @@
+import inspect
+import warnings
+from collections import namedtuple
+from operator import attrgetter
+
+import attr
+
+from ..deprecated import MARK_PARAMETERSET_UNPACKING, MARK_INFO_ATTRIBUTE
+from ..compat import NOTSET, getfslineno, MappingMixin
+from six.moves import map, reduce
+
+
+EMPTY_PARAMETERSET_OPTION = "empty_parameter_set_mark"
+
+
+def alias(name, warning=None):
+    getter = attrgetter(name)
+
+    def warned(self):
+        warnings.warn(warning, stacklevel=2)
+        return getter(self)
+
+    return property(getter if warning is None else warned, doc="alias for " + name)
+
+
+def istestfunc(func):
+    return hasattr(func, "__call__") and getattr(
+        func, "__name__", "<lambda>"
+    ) != "<lambda>"
+
+
+def get_empty_parameterset_mark(config, argnames, func):
+    requested_mark = config.getini(EMPTY_PARAMETERSET_OPTION)
+    if requested_mark in ("", None, "skip"):
+        mark = MARK_GEN.skip
+    elif requested_mark == "xfail":
+        mark = MARK_GEN.xfail(run=False)
+    else:
+        raise LookupError(requested_mark)
+    fs, lineno = getfslineno(func)
+    reason = "got empty parameter set %r, function %s at %s:%d" % (
+        argnames, func.__name__, fs, lineno
+    )
+    return mark(reason=reason)
+
+
+class ParameterSet(namedtuple("ParameterSet", "values, marks, id")):
+
+    @classmethod
+    def param(cls, *values, **kw):
+        marks = kw.pop("marks", ())
+        if isinstance(marks, MarkDecorator):
+            marks = marks,
+        else:
+            assert isinstance(marks, (tuple, list, set))
+
+        def param_extract_id(id=None):
+            return id
+
+        id_ = param_extract_id(**kw)
+        return cls(values, marks, id_)
+
+    @classmethod
+    def extract_from(cls, parameterset, legacy_force_tuple=False):
+        """
+        :param parameterset:
+            a legacy style parameterset that may or may not be a tuple,
+            and may or may not be wrapped into a mess of mark objects
+
+        :param legacy_force_tuple:
+            enforce tuple wrapping so single argument tuple values
+            don't get decomposed and break tests
+
+        """
+
+        if isinstance(parameterset, cls):
+            return parameterset
+        if not isinstance(parameterset, MarkDecorator) and legacy_force_tuple:
+            return cls.param(parameterset)
+
+        newmarks = []
+        argval = parameterset
+        while isinstance(argval, MarkDecorator):
+            newmarks.append(
+                MarkDecorator(Mark(argval.markname, argval.args[:-1], argval.kwargs))
+            )
+            argval = argval.args[-1]
+        assert not isinstance(argval, ParameterSet)
+        if legacy_force_tuple:
+            argval = argval,
+
+        if newmarks:
+            warnings.warn(MARK_PARAMETERSET_UNPACKING)
+
+        return cls(argval, marks=newmarks, id=None)
+
+    @classmethod
+    def _for_parametrize(cls, argnames, argvalues, func, config):
+        if not isinstance(argnames, (tuple, list)):
+            argnames = [x.strip() for x in argnames.split(",") if x.strip()]
+            force_tuple = len(argnames) == 1
+        else:
+            force_tuple = False
+        parameters = [
+            ParameterSet.extract_from(x, legacy_force_tuple=force_tuple)
+            for x in argvalues
+        ]
+        del argvalues
+
+        if not parameters:
+            mark = get_empty_parameterset_mark(config, argnames, func)
+            parameters.append(
+                ParameterSet(values=(NOTSET,) * len(argnames), marks=[mark], id=None)
+            )
+        return argnames, parameters
+
+
+@attr.s(frozen=True)
+class Mark(object):
+    #: name of the mark
+    name = attr.ib(type=str)
+    #: positional arguments of the mark decorator
+    args = attr.ib(type="List[object]")
+    #: keyword arguments of the mark decorator
+    kwargs = attr.ib(type="Dict[str, object]")
+
+    def combined_with(self, other):
+        """
+        :param other: the mark to combine with
+        :type other: Mark
+        :rtype: Mark
+
+        combines by appending aargs and merging the mappings
+        """
+        assert self.name == other.name
+        return Mark(
+            self.name, self.args + other.args, dict(self.kwargs, **other.kwargs)
+        )
+
+
+@attr.s
+class MarkDecorator(object):
+    """ A decorator for test functions and test classes.  When applied
+    it will create :class:`MarkInfo` objects which may be
+    :ref:`retrieved by hooks as item keywords <excontrolskip>`.
+    MarkDecorator instances are often created like this::
+
+        mark1 = pytest.mark.NAME              # simple MarkDecorator
+        mark2 = pytest.mark.NAME(name1=value) # parametrized MarkDecorator
+
+    and can then be applied as decorators to test functions::
+
+        @mark2
+        def test_function():
+            pass
+
+    When a MarkDecorator instance is called it does the following:
+      1. If called with a single class as its only positional argument and no
+         additional keyword arguments, it attaches itself to the class so it
+         gets applied automatically to all test cases found in that class.
+      2. If called with a single function as its only positional argument and
+         no additional keyword arguments, it attaches a MarkInfo object to the
+         function, containing all the arguments already stored internally in
+         the MarkDecorator.
+      3. When called in any other case, it performs a 'fake construction' call,
+         i.e. it returns a new MarkDecorator instance with the original
+         MarkDecorator's content updated with the arguments passed to this
+         call.
+
+    Note: The rules above prevent MarkDecorator objects from storing only a
+    single function or class reference as their positional argument with no
+    additional keyword or positional arguments.
+
+    """
+
+    mark = attr.ib(validator=attr.validators.instance_of(Mark))
+
+    name = alias("mark.name")
+    args = alias("mark.args")
+    kwargs = alias("mark.kwargs")
+
+    @property
+    def markname(self):
+        return self.name  # for backward-compat (2.4.1 had this attr)
+
+    def __eq__(self, other):
+        return self.mark == other.mark if isinstance(other, MarkDecorator) else False
+
+    def __repr__(self):
+        return "<MarkDecorator %r>" % (self.mark,)
+
+    def with_args(self, *args, **kwargs):
+        """ return a MarkDecorator with extra arguments added
+
+        unlike call this can be used even if the sole argument is a callable/class
+
+        :return: MarkDecorator
+        """
+
+        mark = Mark(self.name, args, kwargs)
+        return self.__class__(self.mark.combined_with(mark))
+
+    def __call__(self, *args, **kwargs):
+        """ if passed a single callable argument: decorate it with mark info.
+            otherwise add *args/**kwargs in-place to mark information. """
+        if args and not kwargs:
+            func = args[0]
+            is_class = inspect.isclass(func)
+            if len(args) == 1 and (istestfunc(func) or is_class):
+                if is_class:
+                    store_mark(func, self.mark)
+                else:
+                    store_legacy_markinfo(func, self.mark)
+                    store_mark(func, self.mark)
+                return func
+        return self.with_args(*args, **kwargs)
+
+
+def get_unpacked_marks(obj):
+    """
+    obtain the unpacked marks that are stored on an object
+    """
+    mark_list = getattr(obj, "pytestmark", [])
+
+    if not isinstance(mark_list, list):
+        mark_list = [mark_list]
+    return [getattr(mark, "mark", mark) for mark in mark_list]  # unpack MarkDecorator
+
+
+def store_mark(obj, mark):
+    """store a Mark on an object
+    this is used to implement the Mark declarations/decorators correctly
+    """
+    assert isinstance(mark, Mark), mark
+    # always reassign name to avoid updating pytestmark
+    # in a reference that was only borrowed
+    obj.pytestmark = get_unpacked_marks(obj) + [mark]
+
+
+def store_legacy_markinfo(func, mark):
+    """create the legacy MarkInfo objects and put them onto the function
+    """
+    if not isinstance(mark, Mark):
+        raise TypeError("got {mark!r} instead of a Mark".format(mark=mark))
+    holder = getattr(func, mark.name, None)
+    if holder is None:
+        holder = MarkInfo.for_mark(mark)
+        setattr(func, mark.name, holder)
+    else:
+        holder.add_mark(mark)
+
+
+def transfer_markers(funcobj, cls, mod):
+    """
+    this function transfers class level markers and module level markers
+    into function level markinfo objects
+
+    this is the main reason why marks are so broken
+    the resolution will involve phasing out function level MarkInfo objects
+
+    """
+    for obj in (cls, mod):
+        for mark in get_unpacked_marks(obj):
+            if not _marked(funcobj, mark):
+                store_legacy_markinfo(funcobj, mark)
+
+
+def _marked(func, mark):
+    """ Returns True if :func: is already marked with :mark:, False otherwise.
+    This can happen if marker is applied to class and the test file is
+    invoked more than once.
+    """
+    try:
+        func_mark = getattr(func, getattr(mark, "combined", mark).name)
+    except AttributeError:
+        return False
+    return any(mark == info.combined for info in func_mark)
+
+
+@attr.s
+class MarkInfo(object):
+    """ Marking object created by :class:`MarkDecorator` instances. """
+
+    _marks = attr.ib(convert=list)
+
+    @_marks.validator
+    def validate_marks(self, attribute, value):
+        for item in value:
+            if not isinstance(item, Mark):
+                raise ValueError(
+                    "MarkInfo expects Mark instances, got {!r} ({!r})".format(
+                        item, type(item)
+                    )
+                )
+
+    combined = attr.ib(
+        repr=False,
+        default=attr.Factory(
+            lambda self: reduce(Mark.combined_with, self._marks), takes_self=True
+        ),
+    )
+
+    name = alias("combined.name", warning=MARK_INFO_ATTRIBUTE)
+    args = alias("combined.args", warning=MARK_INFO_ATTRIBUTE)
+    kwargs = alias("combined.kwargs", warning=MARK_INFO_ATTRIBUTE)
+
+    @classmethod
+    def for_mark(cls, mark):
+        return cls([mark])
+
+    def __repr__(self):
+        return "<MarkInfo {!r}>".format(self.combined)
+
+    def add_mark(self, mark):
+        """ add a MarkInfo with the given args and kwargs. """
+        self._marks.append(mark)
+        self.combined = self.combined.combined_with(mark)
+
+    def __iter__(self):
+        """ yield MarkInfo objects each relating to a marking-call. """
+        return map(MarkInfo.for_mark, self._marks)
+
+
+class MarkGenerator(object):
+    """ Factory for :class:`MarkDecorator` objects - exposed as
+    a ``pytest.mark`` singleton instance.  Example::
+
+         import pytest
+         @pytest.mark.slowtest
+         def test_function():
+            pass
+
+    will set a 'slowtest' :class:`MarkInfo` object
+    on the ``test_function`` object. """
+    _config = None
+
+    def __getattr__(self, name):
+        if name[0] == "_":
+            raise AttributeError("Marker name must NOT start with underscore")
+        if self._config is not None:
+            self._check(name)
+        return MarkDecorator(Mark(name, (), {}))
+
+    def _check(self, name):
+        try:
+            if name in self._markers:
+                return
+        except AttributeError:
+            pass
+        self._markers = values = set()
+        for line in self._config.getini("markers"):
+            marker = line.split(":", 1)[0]
+            marker = marker.rstrip()
+            x = marker.split("(", 1)[0]
+            values.add(x)
+        if name not in self._markers:
+            raise AttributeError("%r not a registered marker" % (name,))
+
+
+MARK_GEN = MarkGenerator()
+
+
+class NodeKeywords(MappingMixin):
+
+    def __init__(self, node):
+        self.node = node
+        self.parent = node.parent
+        self._markers = {node.name: True}
+
+    def __getitem__(self, key):
+        try:
+            return self._markers[key]
+        except KeyError:
+            if self.parent is None:
+                raise
+            return self.parent.keywords[key]
+
+    def __setitem__(self, key, value):
+        self._markers[key] = value
+
+    def __delitem__(self, key):
+        raise ValueError("cannot delete key in keywords dict")
+
+    def __iter__(self):
+        seen = self._seen()
+        return iter(seen)
+
+    def _seen(self):
+        seen = set(self._markers)
+        if self.parent is not None:
+            seen.update(self.parent.keywords)
+        return seen
+
+    def __len__(self):
+        return len(self._seen())
+
+    def __repr__(self):
+        return "<NodeKeywords for node %s>" % (self.node,)
+
+
+@attr.s(cmp=False, hash=False)
+class NodeMarkers(object):
+    """
+    internal strucutre for storing marks belongong to a node
+
+    ..warning::
+
+        unstable api
+
+    """
+    own_markers = attr.ib(default=attr.Factory(list))
+
+    def update(self, add_markers):
+        """update the own markers
+        """
+        self.own_markers.extend(add_markers)
+
+    def find(self, name):
+        """
+        find markers in own nodes or parent nodes
+        needs a better place
+        """
+        for mark in self.own_markers:
+            if mark.name == name:
+                yield mark
+
+    def __iter__(self):
+        return iter(self.own_markers)
new file mode 100644
--- /dev/null
+++ b/third_party/python/pytest/src/_pytest/monkeypatch.py
@@ -0,0 +1,283 @@
+""" monkeypatching and mocking functionality.  """
+from __future__ import absolute_import, division, print_function
+
+import os
+import sys
+import re
+from contextlib import contextmanager
+
+import six
+from _pytest.fixtures import fixture
+
+RE_IMPORT_ERROR_NAME = re.compile("^No module named (.*)$")
+
+
+@fixture
+def monkeypatch():
+    """The returned ``monkeypatch`` fixture provides these
+    helper methods to modify objects, dictionaries or os.environ::
+
+        monkeypatch.setattr(obj, name, value, raising=True)
+        monkeypatch.delattr(obj, name, raising=True)
+        monkeypatch.setitem(mapping, name, value)
+        monkeypatch.delitem(obj, name, raising=True)
+        monkeypatch.setenv(name, value, prepend=False)
+        monkeypatch.delenv(name, value, raising=True)
+        monkeypatch.syspath_prepend(path)
+        monkeypatch.chdir(path)
+
+    All modifications will be undone after the requesting
+    test function or fixture has finished. The ``raising``
+    parameter determines if a KeyError or AttributeError
+    will be raised if the set/deletion operation has no target.
+    """
+    mpatch = MonkeyPatch()
+    yield mpatch
+    mpatch.undo()
+
+
+def resolve(name):
+    # simplified from zope.dottedname
+    parts = name.split(".")
+
+    used = parts.pop(0)
+    found = __import__(used)
+    for part in parts:
+        used += "." + part
+        try:
+            found = getattr(found, part)
+        except AttributeError:
+            pass
+        else:
+            continue
+        # we use explicit un-nesting of the handling block in order
+        # to avoid nested exceptions on python 3
+        try:
+            __import__(used)
+        except ImportError as ex:
+            # str is used for py2 vs py3
+            expected = str(ex).split()[-1]
+            if expected == used:
+                raise
+            else:
+                raise ImportError("import error in %s: %s" % (used, ex))
+        found = annotated_getattr(found, part, used)
+    return found
+
+
+def annotated_getattr(obj, name, ann):
+    try:
+        obj = getattr(obj, name)
+    except AttributeError:
+        raise AttributeError(
+            "%r object at %s has no attribute %r" % (type(obj).__name__, ann, name)
+        )
+    return obj
+
+
+def derive_importpath(import_path, raising):
+    if not isinstance(import_path, six.string_types) or "." not in import_path:
+        raise TypeError("must be absolute import path string, not %r" % (import_path,))
+    module, attr = import_path.rsplit(".", 1)
+    target = resolve(module)
+    if raising:
+        annotated_getattr(target, attr, ann=module)
+    return attr, target
+
+
+class Notset(object):
+
+    def __repr__(self):
+        return "<notset>"
+
+
+notset = Notset()
+
+
+class MonkeyPatch(object):
+    """ Object returned by the ``monkeypatch`` fixture keeping a record of setattr/item/env/syspath changes.
+    """
+
+    def __init__(self):
+        self._setattr = []
+        self._setitem = []
+        self._cwd = None
+        self._savesyspath = None
+
+    @contextmanager
+    def context(self):
+        """
+        Context manager that returns a new :class:`MonkeyPatch` object which
+        undoes any patching done inside the ``with`` block upon exit:
+
+        .. code-block:: python
+
+            import functools
+            def test_partial(monkeypatch):
+                with monkeypatch.context() as m:
+                    m.setattr(functools, "partial", 3)
+
+        Useful in situations where it is desired to undo some patches before the test ends,
+        such as mocking ``stdlib`` functions that might break pytest itself if mocked (for examples
+        of this see `#3290 <https://github.com/pytest-dev/pytest/issues/3290>`_.
+        """
+        m = MonkeyPatch()
+        try:
+            yield m
+        finally:
+            m.undo()
+
+    def setattr(self, target, name, value=notset, raising=True):
+        """ Set attribute value on target, memorizing the old value.
+        By default raise AttributeError if the attribute did not exist.
+
+        For convenience you can specify a string as ``target`` which
+        will be interpreted as a dotted import path, with the last part
+        being the attribute name.  Example:
+        ``monkeypatch.setattr("os.getcwd", lambda: "/")``
+        would set the ``getcwd`` function of the ``os`` module.
+
+        The ``raising`` value determines if the setattr should fail
+        if the attribute is not already present (defaults to True
+        which means it will raise).
+        """
+        __tracebackhide__ = True
+        import inspect
+
+        if value is notset:
+            if not isinstance(target, six.string_types):
+                raise TypeError(
+                    "use setattr(target, name, value) or "
+                    "setattr(target, value) with target being a dotted "
+                    "import string"
+                )
+            value = name
+            name, target = derive_importpath(target, raising)
+
+        oldval = getattr(target, name, notset)
+        if raising and oldval is notset:
+            raise AttributeError("%r has no attribute %r" % (target, name))
+
+        # avoid class descriptors like staticmethod/classmethod
+        if inspect.isclass(target):
+            oldval = target.__dict__.get(name, notset)
+        self._setattr.append((target, name, oldval))
+        setattr(target, name, value)
+
+    def delattr(self, target, name=notset, raising=True):
+        """ Delete attribute ``name`` from ``target``, by default raise
+        AttributeError it the attribute did not previously exist.
+
+        If no ``name`` is specified and ``target`` is a string
+        it will be interpreted as a dotted import path with the
+        last part being the attribute name.
+
+        If ``raising`` is set to False, no exception will be raised if the
+        attribute is missing.
+        """
+        __tracebackhide__ = True
+        if name is notset:
+            if not isinstance(target, six.string_types):
+                raise TypeError(
+                    "use delattr(target, name) or "
+                    "delattr(target) with target being a dotted "
+                    "import string"
+                )
+            name, target = derive_importpath(target, raising)
+
+        if not hasattr(target, name):
+            if raising:
+                raise AttributeError(name)
+        else:
+            self._setattr.append((target, name, getattr(target, name, notset)))
+            delattr(target, name)
+
+    def setitem(self, dic, name, value):
+        """ Set dictionary entry ``name`` to value. """
+        self._setitem.append((dic, name, dic.get(name, notset)))
+        dic[name] = value
+
+    def delitem(self, dic, name, raising=True):
+        """ Delete ``name`` from dict. Raise KeyError if it doesn't exist.
+
+        If ``raising`` is set to False, no exception will be raised if the
+        key is missing.
+        """
+        if name not in dic:
+            if raising:
+                raise KeyError(name)
+        else:
+            self._setitem.append((dic, name, dic.get(name, notset)))
+            del dic[name]
+
+    def setenv(self, name, value, prepend=None):
+        """ Set environment variable ``name`` to ``value``.  If ``prepend``
+        is a character, read the current environment variable value
+        and prepend the ``value`` adjoined with the ``prepend`` character."""
+        value = str(value)
+        if prepend and name in os.environ:
+            value = value + prepend + os.environ[name]
+        self.setitem(os.environ, name, value)
+
+    def delenv(self, name, raising=True):
+        """ Delete ``name`` from the environment. Raise KeyError it does not
+        exist.
+
+        If ``raising`` is set to False, no exception will be raised if the
+        environment variable is missing.
+        """
+        self.delitem(os.environ, name, raising=raising)
+
+    def syspath_prepend(self, path):
+        """ Prepend ``path`` to ``sys.path`` list of import locations. """
+        if self._savesyspath is None:
+            self._savesyspath = sys.path[:]
+        sys.path.insert(0, str(path))
+
+    def chdir(self, path):
+        """ Change the current working directory to the specified path.
+        Path can be a string or a py.path.local object.
+        """
+        if self._cwd is None:
+            self._cwd = os.getcwd()
+        if hasattr(path, "chdir"):
+            path.chdir()
+        else:
+            os.chdir(path)
+
+    def undo(self):
+        """ Undo previous changes.  This call consumes the
+        undo stack. Calling it a second time has no effect unless
+        you do more monkeypatching after the undo call.
+
+        There is generally no need to call `undo()`, since it is
+        called automatically during tear-down.
+
+        Note that the same `monkeypatch` fixture is used across a
+        single test function invocation. If `monkeypatch` is used both by
+        the test function itself and one of the test fixtures,
+        calling `undo()` will undo all of the changes made in
+        both functions.
+        """
+        for obj, name, value in reversed(self._setattr):
+            if value is not notset:
+                setattr(obj, name, value)
+            else:
+                delattr(obj, name)
+        self._setattr[:] = []
+        for dictionary, name, value in reversed(self._setitem):
+            if value is notset:
+                try:
+                    del dictionary[name]
+                except KeyError:
+                    pass  # was already deleted, so we have the desired state
+            else:
+                dictionary[name] = value
+        self._setitem[:] = []
+        if self._savesyspath is not None:
+            sys.path[:] = self._savesyspath
+            self._savesyspath = None
+
+        if self._cwd is not None:
+            os.chdir(self._cwd)
+            self._cwd = None
new file mode 100644
--- /dev/null
+++ b/third_party/python/pytest/src/_pytest/nodes.py
@@ -0,0 +1,419 @@
+from __future__ import absolute_import, division, print_function
+import os
+
+import six
+import py
+import attr
+
+import _pytest
+import _pytest._code
+
+from _pytest.mark.structures import NodeKeywords, MarkInfo
+
+SEP = "/"
+
+tracebackcutdir = py.path.local(_pytest.__file__).dirpath()
+
+
+def _splitnode(nodeid):
+    """Split a nodeid into constituent 'parts'.
+
+    Node IDs are strings, and can be things like:
+        ''
+        'testing/code'
+        'testing/code/test_excinfo.py'
+        'testing/code/test_excinfo.py::TestFormattedExcinfo::()'
+
+    Return values are lists e.g.
+        []
+        ['testing', 'code']
+        ['testing', 'code', 'test_excinfo.py']
+        ['testing', 'code', 'test_excinfo.py', 'TestFormattedExcinfo', '()']
+    """
+    if nodeid == "":
+        # If there is no root node at all, return an empty list so the caller's logic can remain sane
+        return []
+    parts = nodeid.split(SEP)
+    # Replace single last element 'test_foo.py::Bar::()' with multiple elements 'test_foo.py', 'Bar', '()'
+    parts[-1:] = parts[-1].split("::")
+    return parts
+
+
+def ischildnode(baseid, nodeid):
+    """Return True if the nodeid is a child node of the baseid.
+
+    E.g. 'foo/bar::Baz::()' is a child of 'foo', 'foo/bar' and 'foo/bar::Baz', but not of 'foo/blorp'
+    """
+    base_parts = _splitnode(baseid)
+    node_parts = _splitnode(nodeid)
+    if len(node_parts) < len(base_parts):
+        return False
+    return node_parts[:len(base_parts)] == base_parts
+
+
+@attr.s
+class _CompatProperty(object):
+    name = attr.ib()
+
+    def __get__(self, obj, owner):
+        if obj is None:
+            return self
+
+        # TODO: reenable in the features branch
+        # warnings.warn(
+        #     "usage of {owner!r}.{name} is deprecated, please use pytest.{name} instead".format(
+        #         name=self.name, owner=type(owner).__name__),
+        #     PendingDeprecationWarning, stacklevel=2)
+        return getattr(__import__("pytest"), self.name)
+
+
+class Node(object):
+    """ base class for Collector and Item the test collection tree.
+    Collector subclasses have children, Items are terminal nodes."""
+
+    def __init__(
+        self, name, parent=None, config=None, session=None, fspath=None, nodeid=None
+    ):
+        #: a unique name within the scope of the parent node
+        self.name = name
+
+        #: the parent collector node.
+        self.parent = parent
+
+        #: the pytest config object
+        self.config = config or parent.config
+
+        #: the session this node is part of
+        self.session = session or parent.session
+
+        #: filesystem path where this node was collected from (can be None)
+        self.fspath = fspath or getattr(parent, "fspath", None)
+
+        #: keywords/markers collected from all scopes
+        self.keywords = NodeKeywords(self)
+
+        #: the marker objects belonging to this node
+        self.own_markers = []
+
+        #: allow adding of extra keywords to use for matching
+        self.extra_keyword_matches = set()
+
+        # used for storing artificial fixturedefs for direct parametrization
+        self._name2pseudofixturedef = {}
+
+        if nodeid is not None:
+            self._nodeid = nodeid
+        else:
+            assert parent is not None
+            self._nodeid = self.parent.nodeid + "::" + self.name
+
+    @property
+    def ihook(self):
+        """ fspath sensitive hook proxy used to call pytest hooks"""
+        return self.session.gethookproxy(self.fspath)
+
+    Module = _CompatProperty("Module")
+    Class = _CompatProperty("Class")
+    Instance = _CompatProperty("Instance")
+    Function = _CompatProperty("Function")
+    File = _CompatProperty("File")
+    Item = _CompatProperty("Item")
+
+    def _getcustomclass(self, name):
+        maybe_compatprop = getattr(type(self), name)
+        if isinstance(maybe_compatprop, _CompatProperty):
+            return getattr(__import__("pytest"), name)
+        else:
+            cls = getattr(self, name)
+            # TODO: reenable in the features branch
+            # warnings.warn("use of node.%s is deprecated, "
+            #    "use pytest_pycollect_makeitem(...) to create custom "
+            #    "collection nodes" % name, category=DeprecationWarning)
+        return cls
+
+    def __repr__(self):
+        return "<%s %r>" % (self.__class__.__name__, getattr(self, "name", None))
+
+    def warn(self, code, message):
+        """ generate a warning with the given code and message for this
+        item. """
+        assert isinstance(code, str)
+        fslocation = getattr(self, "location", None)
+        if fslocation is None:
+            fslocation = getattr(self, "fspath", None)
+        self.ihook.pytest_logwarning.call_historic(
+            kwargs=dict(
+                code=code, message=message, nodeid=self.nodeid, fslocation=fslocation
+            )
+        )
+
+    # methods for ordering nodes
+    @property
+    def nodeid(self):
+        """ a ::-separated string denoting its collection tree address. """
+        return self._nodeid
+
+    def __hash__(self):
+        return hash(self.nodeid)
+
+    def setup(self):
+        pass
+
+    def teardown(self):
+        pass
+
+    def listchain(self):
+        """ return list of all parent collectors up to self,
+            starting from root of collection tree. """
+        chain = []
+        item = self
+        while item is not None:
+            chain.append(item)
+            item = item.parent
+        chain.reverse()
+        return chain
+
+    def add_marker(self, marker):
+        """dynamically add a marker object to the node.
+
+        :type marker: str or pytest.mark.*
+        """
+        from _pytest.mark import MarkDecorator, MARK_GEN
+
+        if isinstance(marker, six.string_types):
+            marker = getattr(MARK_GEN, marker)
+        elif not isinstance(marker, MarkDecorator):
+            raise ValueError("is not a string or pytest.mark.* Marker")
+        self.keywords[marker.name] = marker
+        self.own_markers.append(marker.mark)
+
+    def iter_markers(self, name=None):
+        """
+        :param name: if given, filter the results by the name attribute
+
+        iterate over all markers of the node
+        """
+        return (x[1] for x in self.iter_markers_with_node(name=name))
+
+    def iter_markers_with_node(self, name=None):
+        """
+        :param name: if given, filter the results by the name attribute
+
+        iterate over all markers of the node
+        returns sequence of tuples (node, mark)
+        """
+        for node in reversed(self.listchain()):
+            for mark in node.own_markers:
+                if name is None or getattr(mark, "name", None) == name:
+                    yield node, mark
+
+    def get_closest_marker(self, name, default=None):
+        """return the first marker matching the name, from closest (for example function) to farther level (for example
+        module level).
+
+        :param default: fallback return value of no marker was found
+        :param name: name to filter by
+        """
+        return next(self.iter_markers(name=name), default)
+
+    def get_marker(self, name):
+        """ get a marker object from this node or None if
+        the node doesn't have a marker with that name.
+
+        .. deprecated:: 3.6
+            This function has been deprecated in favor of
+            :meth:`Node.get_closest_marker <_pytest.nodes.Node.get_closest_marker>` and
+            :meth:`Node.iter_markers <_pytest.nodes.Node.iter_markers>`, see :ref:`update marker code`
+            for more details.
+        """
+        markers = list(self.iter_markers(name=name))
+        if markers:
+            return MarkInfo(markers)
+
+    def listextrakeywords(self):
+        """ Return a set of all extra keywords in self and any parents."""
+        extra_keywords = set()
+        for item in self.listchain():
+            extra_keywords.update(item.extra_keyword_matches)
+        return extra_keywords
+
+    def listnames(self):
+        return [x.name for x in self.listchain()]
+
+    def addfinalizer(self, fin):
+        """ register a function to be called when this node is finalized.
+
+        This method can only be called when this node is active
+        in a setup chain, for example during self.setup().
+        """
+        self.session._setupstate.addfinalizer(fin, self)
+
+    def getparent(self, cls):
+        """ get the next parent node (including ourself)
+        which is an instance of the given class"""
+        current = self
+        while current and not isinstance(current, cls):
+            current = current.parent
+        return current
+
+    def _prunetraceback(self, excinfo):
+        pass
+
+    def _repr_failure_py(self, excinfo, style=None):
+        fm = self.session._fixturemanager
+        if excinfo.errisinstance(fm.FixtureLookupError):
+            return excinfo.value.formatrepr()
+        tbfilter = True
+        if self.config.option.fulltrace:
+            style = "long"
+        else:
+            tb = _pytest._code.Traceback([excinfo.traceback[-1]])
+            self._prunetraceback(excinfo)
+            if len(excinfo.traceback) == 0:
+                excinfo.traceback = tb
+            tbfilter = False  # prunetraceback already does it
+            if style == "auto":
+                style = "long"
+        # XXX should excinfo.getrepr record all data and toterminal() process it?
+        if style is None:
+            if self.config.option.tbstyle == "short":
+                style = "short"
+            else:
+                style = "long"
+
+        try:
+            os.getcwd()
+            abspath = False
+        except OSError:
+            abspath = True
+
+        return excinfo.getrepr(
+            funcargs=True,
+            abspath=abspath,
+            showlocals=self.config.option.showlocals,
+            style=style,
+            tbfilter=tbfilter,
+        )
+
+    repr_failure = _repr_failure_py
+
+
+class Collector(Node):
+    """ Collector instances create children through collect()
+        and thus iteratively build a tree.
+    """
+
+    class CollectError(Exception):
+        """ an error during collection, contains a custom message. """
+
+    def collect(self):
+        """ returns a list of children (items and collectors)
+            for this collection node.
+        """
+        raise NotImplementedError("abstract")
+
+    def repr_failure(self, excinfo):
+        """ represent a collection failure. """
+        if excinfo.errisinstance(self.CollectError):
+            exc = excinfo.value
+            return str(exc.args[0])
+        return self._repr_failure_py(excinfo, style="short")
+
+    def _prunetraceback(self, excinfo):
+        if hasattr(self, "fspath"):
+            traceback = excinfo.traceback
+            ntraceback = traceback.cut(path=self.fspath)
+            if ntraceback == traceback:
+                ntraceback = ntraceback.cut(excludepath=tracebackcutdir)
+            excinfo.traceback = ntraceback.filter()
+
+
+def _check_initialpaths_for_relpath(session, fspath):
+    for initial_path in session._initialpaths:
+        if fspath.common(initial_path) == initial_path:
+            return fspath.relto(initial_path.dirname)
+
+
+class FSCollector(Collector):
+
+    def __init__(self, fspath, parent=None, config=None, session=None, nodeid=None):
+        fspath = py.path.local(fspath)  # xxx only for test_resultlog.py?
+        name = fspath.basename
+        if parent is not None:
+            rel = fspath.relto(parent.fspath)
+            if rel:
+                name = rel
+            name = name.replace(os.sep, SEP)
+        self.fspath = fspath
+
+        session = session or parent.session
+
+        if nodeid is None:
+            nodeid = self.fspath.relto(session.config.rootdir)
+
+            if not nodeid:
+                nodeid = _check_initialpaths_for_relpath(session, fspath)
+            if os.sep != SEP:
+                nodeid = nodeid.replace(os.sep, SEP)
+
+        super(FSCollector, self).__init__(
+            name, parent, config, session, nodeid=nodeid, fspath=fspath
+        )
+
+
+class File(FSCollector):
+    """ base class for collecting tests from a file. """
+
+
+class Item(Node):
+    """ a basic test invocation item. Note that for a single function
+    there might be multiple test invocation items.
+    """
+    nextitem = None
+
+    def __init__(self, name, parent=None, config=None, session=None, nodeid=None):
+        super(Item, self).__init__(name, parent, config, session, nodeid=nodeid)
+        self._report_sections = []
+
+        #: user properties is a list of tuples (name, value) that holds user
+        #: defined properties for this test.
+        self.user_properties = []
+
+    def add_report_section(self, when, key, content):
+        """
+        Adds a new report section, similar to what's done internally to add stdout and
+        stderr captured output::
+
+            item.add_report_section("call", "stdout", "report section contents")
+
+        :param str when:
+            One of the possible capture states, ``"setup"``, ``"call"``, ``"teardown"``.
+        :param str key:
+            Name of the section, can be customized at will. Pytest uses ``"stdout"`` and
+            ``"stderr"`` internally.
+
+        :param str content:
+            The full contents as a string.
+        """
+        if content:
+            self._report_sections.append((when, key, content))
+
+    def reportinfo(self):
+        return self.fspath, None, ""
+
+    @property
+    def location(self):
+        try:
+            return self._location
+        except AttributeError:
+            location = self.reportinfo()
+            # bestrelpath is a quite slow function
+            cache = self.config.__dict__.setdefault("_bestrelpathcache", {})
+            try:
+                fspath = cache[location[0]]
+            except KeyError:
+                fspath = self.session.fspath.bestrelpath(location[0])
+                cache[location[0]] = fspath
+            location = (fspath, location[1], str(location[2]))
+            self._location = location
+            return location
new file mode 100644
--- /dev/null
+++ b/third_party/python/pytest/src/_pytest/nose.py
@@ -0,0 +1,72 @@
+""" run test suites written for nose. """
+from __future__ import absolute_import, division, print_function
+
+import sys
+
+from _pytest import unittest, runner, python
+from _pytest.config import hookimpl
+
+
+def get_skip_exceptions():
+    skip_classes = set()
+    for module_name in ("unittest", "unittest2", "nose"):
+        mod = sys.modules.get(module_name)
+        if hasattr(mod, "SkipTest"):
+            skip_classes.add(mod.SkipTest)
+    return tuple(skip_classes)
+
+
+def pytest_runtest_makereport(item, call):
+    if call.excinfo and call.excinfo.errisinstance(get_skip_exceptions()):
+        # let's substitute the excinfo with a pytest.skip one
+        call2 = call.__class__(lambda: runner.skip(str(call.excinfo.value)), call.when)
+        call.excinfo = call2.excinfo
+
+
+@hookimpl(trylast=True)
+def pytest_runtest_setup(item):
+    if is_potential_nosetest(item):
+        if isinstance(item.parent, python.Generator):
+            gen = item.parent
+            if not hasattr(gen, "_nosegensetup"):
+                call_optional(gen.obj, "setup")
+                if isinstance(gen.parent, python.Instance):
+                    call_optional(gen.parent.obj, "setup")
+                gen._nosegensetup = True
+        if not call_optional(item.obj, "setup"):
+            # call module level setup if there is no object level one
+            call_optional(item.parent.obj, "setup")
+        # XXX this implies we only call teardown when setup worked
+        item.session._setupstate.addfinalizer((lambda: teardown_nose(item)), item)
+
+
+def teardown_nose(item):
+    if is_potential_nosetest(item):
+        if not call_optional(item.obj, "teardown"):
+            call_optional(item.parent.obj, "teardown")
+        # if hasattr(item.parent, '_nosegensetup'):
+        #    #call_optional(item._nosegensetup, 'teardown')
+        #    del item.parent._nosegensetup
+
+
+def pytest_make_collect_report(collector):
+    if isinstance(collector, python.Generator):
+        call_optional(collector.obj, "setup")
+
+
+def is_potential_nosetest(item):
+    # extra check needed since we do not do nose style setup/teardown
+    # on direct unittest style classes
+    return isinstance(item, python.Function) and not isinstance(
+        item, unittest.TestCaseFunction
+    )
+
+
+def call_optional(obj, name):
+    method = getattr(obj, name, None)
+    isfixture = hasattr(method, "_pytestfixturefunction")
+    if method is not None and not isfixture and callable(method):
+        # If there's any problems allow the exception to raise rather than
+        # silently ignoring them
+        method()
+        return True
new file mode 100644
--- /dev/null
+++ b/third_party/python/pytest/src/_pytest/outcomes.py
@@ -0,0 +1,157 @@
+"""
+exception classes and constants handling test outcomes
+as well as functions creating them
+"""
+from __future__ import absolute_import, division, print_function
+import py
+import sys
+
+
+class OutcomeException(BaseException):
+    """ OutcomeException and its subclass instances indicate and
+        contain info about test and collection outcomes.
+    """
+
+    def __init__(self, msg=None, pytrace=True):
+        BaseException.__init__(self, msg)
+        self.msg = msg
+        self.pytrace = pytrace
+
+    def __repr__(self):
+        if self.msg:
+            val = self.msg
+            if isinstance(val, bytes):
+                val = py._builtin._totext(val, errors="replace")
+            return val
+        return "<%s instance>" % (self.__class__.__name__,)
+
+    __str__ = __repr__
+
+
+TEST_OUTCOME = (OutcomeException, Exception)
+
+
+class Skipped(OutcomeException):
+    # XXX hackish: on 3k we fake to live in the builtins
+    # in order to have Skipped exception printing shorter/nicer
+    __module__ = "builtins"
+
+    def __init__(self, msg=None, pytrace=True, allow_module_level=False):
+        OutcomeException.__init__(self, msg=msg, pytrace=pytrace)
+        self.allow_module_level = allow_module_level
+
+
+class Failed(OutcomeException):
+    """ raised from an explicit call to pytest.fail() """
+    __module__ = "builtins"
+
+
+class Exit(KeyboardInterrupt):
+    """ raised for immediate program exits (no tracebacks/summaries)"""
+
+    def __init__(self, msg="unknown reason"):
+        self.msg = msg
+        KeyboardInterrupt.__init__(self, msg)
+
+
+# exposed helper methods
+
+
+def exit(msg):
+    """ exit testing process as if KeyboardInterrupt was triggered. """
+    __tracebackhide__ = True
+    raise Exit(msg)
+
+
+exit.Exception = Exit
+
+
+def skip(msg="", **kwargs):
+    """ skip an executing test with the given message.  Note: it's usually
+    better to use the pytest.mark.skipif marker to declare a test to be
+    skipped under certain conditions like mismatching platforms or
+    dependencies.  See the pytest_skipping plugin for details.
+
+    :kwarg bool allow_module_level: allows this function to be called at
+        module level, skipping the rest of the module. Default to False.
+    """
+    __tracebackhide__ = True
+    allow_module_level = kwargs.pop("allow_module_level", False)
+    if kwargs:
+        keys = [k for k in kwargs.keys()]
+        raise TypeError("unexpected keyword arguments: {}".format(keys))
+    raise Skipped(msg=msg, allow_module_level=allow_module_level)
+
+
+skip.Exception = Skipped
+
+
+def fail(msg="", pytrace=True):
+    """ explicitly fail a currently-executing test with the given Message.
+
+    :arg pytrace: if false the msg represents the full failure information
+                  and no python traceback will be reported.
+    """
+    __tracebackhide__ = True
+    raise Failed(msg=msg, pytrace=pytrace)
+
+
+fail.Exception = Failed
+
+
+class XFailed(fail.Exception):
+    """ raised from an explicit call to pytest.xfail() """
+
+
+def xfail(reason=""):
+    """ xfail an executing test or setup functions with the given reason."""
+    __tracebackhide__ = True
+    raise XFailed(reason)
+
+
+xfail.Exception = XFailed
+
+
+def importorskip(modname, minversion=None):
+    """ return imported module if it has at least "minversion" as its
+    __version__ attribute.  If no minversion is specified the a skip
+    is only triggered if the module can not be imported.
+    """
+    import warnings
+
+    __tracebackhide__ = True
+    compile(modname, "", "eval")  # to catch syntaxerrors
+    should_skip = False
+
+    with warnings.catch_warnings():
+        # make sure to ignore ImportWarnings that might happen because
+        # of existing directories with the same name we're trying to
+        # import but without a __init__.py file
+        warnings.simplefilter("ignore")
+        try:
+            __import__(modname)
+        except ImportError:
+            # Do not raise chained exception here(#1485)
+            should_skip = True
+    if should_skip:
+        raise Skipped("could not import %r" % (modname,), allow_module_level=True)
+    mod = sys.modules[modname]
+    if minversion is None:
+        return mod
+    verattr = getattr(mod, "__version__", None)
+    if minversion is not None:
+        try:
+            from pkg_resources import parse_version as pv
+        except ImportError:
+            raise Skipped(
+                "we have a required version for %r but can not import "
+                "pkg_resources to parse version strings." % (modname,),
+                allow_module_level=True,
+            )
+        if verattr is None or pv(verattr) < pv(minversion):
+            raise Skipped(
+                "module %r has __version__ %r, required is: %r"
+                % (modname, verattr, minversion),
+                allow_module_level=True,
+            )
+    return mod
new file mode 100644
--- /dev/null
+++ b/third_party/python/pytest/src/_pytest/pastebin.py
@@ -0,0 +1,109 @@
+""" submit failure or test session information to a pastebin service. """
+from __future__ import absolute_import, division, print_function
+
+import pytest
+import six
+import sys
+import tempfile
+
+
+def pytest_addoption(parser):
+    group = parser.getgroup("terminal reporting")
+    group._addoption(
+        "--pastebin",
+        metavar="mode",
+        action="store",
+        dest="pastebin",
+        default=None,
+        choices=["failed", "all"],
+        help="send failed|all info to bpaste.net pastebin service.",
+    )
+
+
+@pytest.hookimpl(trylast=True)
+def pytest_configure(config):
+    if config.option.pastebin == "all":
+        tr = config.pluginmanager.getplugin("terminalreporter")
+        # if no terminal reporter plugin is present, nothing we can do here;
+        # this can happen when this function executes in a slave node
+        # when using pytest-xdist, for example
+        if tr is not None:
+            # pastebin file will be utf-8 encoded binary file
+            config._pastebinfile = tempfile.TemporaryFile("w+b")
+            oldwrite = tr._tw.write
+
+            def tee_write(s, **kwargs):
+                oldwrite(s, **kwargs)
+                if isinstance(s, six.text_type):
+                    s = s.encode("utf-8")
+                config._pastebinfile.write(s)
+
+            tr._tw.write = tee_write
+
+
+def pytest_unconfigure(config):
+    if hasattr(config, "_pastebinfile"):
+        # get terminal contents and delete file
+        config._pastebinfile.seek(0)
+        sessionlog = config._pastebinfile.read()
+        config._pastebinfile.close()
+        del config._pastebinfile
+        # undo our patching in the terminal reporter
+        tr = config.pluginmanager.getplugin("terminalreporter")
+        del tr._tw.__dict__["write"]
+        # write summary
+        tr.write_sep("=", "Sending information to Paste Service")
+        pastebinurl = create_new_paste(sessionlog)
+        tr.write_line("pastebin session-log: %s\n" % pastebinurl)
+
+
+def create_new_paste(contents):
+    """
+    Creates a new paste using bpaste.net service.
+
+    :contents: paste contents as utf-8 encoded bytes
+    :returns: url to the pasted contents
+    """
+    import re
+
+    if sys.version_info < (3, 0):
+        from urllib import urlopen, urlencode
+    else:
+        from urllib.request import urlopen
+        from urllib.parse import urlencode
+
+    params = {
+        "code": contents,
+        "lexer": "python3" if sys.version_info[0] == 3 else "python",
+        "expiry": "1week",
+    }
+    url = "https://bpaste.net"
+    response = urlopen(url, data=urlencode(params).encode("ascii")).read()
+    m = re.search(r'href="/raw/(\w+)"', response.decode("utf-8"))
+    if m:
+        return "%s/show/%s" % (url, m.group(1))
+    else:
+        return "bad response: " + response
+
+
+def pytest_terminal_summary(terminalreporter):
+    import _pytest.config
+
+    if terminalreporter.config.option.pastebin != "failed":
+        return
+    tr = terminalreporter
+    if "failed" in tr.stats:
+        terminalreporter.write_sep("=", "Sending information to Paste Service")
+        for rep in terminalreporter.stats.get("failed"):
+            try:
+                msg = rep.longrepr.reprtraceback.reprentries[-1].reprfileloc
+            except AttributeError:
+                msg = tr._getfailureheadline(rep)
+            tw = _pytest.config.create_terminal_writer(
+                terminalreporter.config, stringio=True
+            )
+            rep.toterminal(tw)
+            s = tw.stringio.getvalue()
+            assert len(s)
+            pastebinurl = create_new_paste(s)
+            tr.write_line("%s --> %s" % (msg, pastebinurl))
new file mode 100644
--- /dev/null
+++ b/third_party/python/pytest/src/_pytest/pytester.py
@@ -0,0 +1,1272 @@
+"""(disabled by default) support for testing pytest and pytest plugins."""
+from __future__ import absolute_import, division, print_function
+
+import codecs
+import gc
+import os
+import platform
+import re
+import subprocess
+import six
+import sys
+import time
+import traceback
+from fnmatch import fnmatch
+
+from weakref import WeakKeyDictionary
+
+from _pytest.capture import MultiCapture, SysCapture
+from _pytest._code import Source
+import py
+import pytest
+from _pytest.main import Session, EXIT_OK
+from _pytest.assertion.rewrite import AssertionRewritingHook
+
+
+PYTEST_FULLPATH = os.path.abspath(pytest.__file__.rstrip("oc")).replace(
+    "$py.class", ".py"
+)
+
+
+IGNORE_PAM = [  # filenames added when obtaining details about the current user
+    u"/var/lib/sss/mc/passwd"
+]
+
+
+def pytest_addoption(parser):
+    parser.addoption(
+        "--lsof",
+        action="store_true",
+        dest="lsof",
+        default=False,
+        help=("run FD checks if lsof is available"),
+    )
+
+    parser.addoption(
+        "--runpytest",
+        default="inprocess",
+        dest="runpytest",
+        choices=("inprocess", "subprocess"),
+        help=(
+            "run pytest sub runs in tests using an 'inprocess' "
+            "or 'subprocess' (python -m main) method"
+        ),
+    )
+
+
+def pytest_configure(config):
+    if config.getvalue("lsof"):
+        checker = LsofFdLeakChecker()
+        if checker.matching_platform():
+            config.pluginmanager.register(checker)
+
+
+class LsofFdLeakChecker(object):
+
+    def get_open_files(self):
+        out = self._exec_lsof()
+        open_files = self._parse_lsof_output(out)
+        return open_files
+
+    def _exec_lsof(self):
+        pid = os.getpid()
+        return py.process.cmdexec("lsof -Ffn0 -p %d" % pid)
+
+    def _parse_lsof_output(self, out):
+
+        def isopen(line):
+            return line.startswith("f") and (
+                "deleted" not in line
+                and "mem" not in line
+                and "txt" not in line
+                and "cwd" not in line
+            )
+
+        open_files = []
+
+        for line in out.split("\n"):
+            if isopen(line):
+                fields = line.split("\0")
+                fd = fields[0][1:]
+                filename = fields[1][1:]
+                if filename in IGNORE_PAM:
+                    continue
+                if filename.startswith("/"):
+                    open_files.append((fd, filename))
+
+        return open_files
+
+    def matching_platform(self):
+        try:
+            py.process.cmdexec("lsof -v")
+        except (py.process.cmdexec.Error, UnicodeDecodeError):
+            # cmdexec may raise UnicodeDecodeError on Windows systems with
+            # locale other than English:
+            # https://bitbucket.org/pytest-dev/py/issues/66
+            return False
+        else:
+            return True
+
+    @pytest.hookimpl(hookwrapper=True, tryfirst=True)
+    def pytest_runtest_protocol(self, item):
+        lines1 = self.get_open_files()
+        yield
+        if hasattr(sys, "pypy_version_info"):
+            gc.collect()
+        lines2 = self.get_open_files()
+
+        new_fds = {t[0] for t in lines2} - {t[0] for t in lines1}
+        leaked_files = [t for t in lines2 if t[0] in new_fds]
+        if leaked_files:
+            error = []
+            error.append("***** %s FD leakage detected" % len(leaked_files))
+            error.extend([str(f) for f in leaked_files])
+            error.append("*** Before:")
+            error.extend([str(f) for f in lines1])
+            error.append("*** After:")
+            error.extend([str(f) for f in lines2])
+            error.append(error[0])
+            error.append("*** function %s:%s: %s " % item.location)
+            error.append("See issue #2366")
+            item.warn("", "\n".join(error))
+
+
+# XXX copied from execnet's conftest.py - needs to be merged
+winpymap = {
+    "python2.7": r"C:\Python27\python.exe",
+    "python3.4": r"C:\Python34\python.exe",
+    "python3.5": r"C:\Python35\python.exe",
+    "python3.6": r"C:\Python36\python.exe",
+}
+
+
+def getexecutable(name, cache={}):
+    try:
+        return cache[name]
+    except KeyError:
+        executable = py.path.local.sysfind(name)
+        if executable:
+            import subprocess
+
+            popen = subprocess.Popen(
+                [str(executable), "--version"],
+                universal_newlines=True,
+                stderr=subprocess.PIPE,
+            )
+            out, err = popen.communicate()
+            if name == "jython":
+                if not err or "2.5" not in err:
+                    executable = None
+                if "2.5.2" in err:
+                    executable = None  # http://bugs.jython.org/issue1790
+            elif popen.returncode != 0:
+                # handle pyenv's 127
+                executable = None
+        cache[name] = executable
+        return executable
+
+
+@pytest.fixture(params=["python2.7", "python3.4", "pypy", "pypy3"])
+def anypython(request):
+    name = request.param
+    executable = getexecutable(name)
+    if executable is None:
+        if sys.platform == "win32":
+            executable = winpymap.get(name, None)
+            if executable:
+                executable = py.path.local(executable)
+                if executable.check():
+                    return executable
+        pytest.skip("no suitable %s found" % (name,))
+    return executable
+
+
+# used at least by pytest-xdist plugin
+
+
+@pytest.fixture
+def _pytest(request):
+    """Return a helper which offers a gethookrecorder(hook) method which
+    returns a HookRecorder instance which helps to make assertions about called
+    hooks.
+
+    """
+    return PytestArg(request)
+
+
+class PytestArg(object):
+
+    def __init__(self, request):
+        self.request = request
+
+    def gethookrecorder(self, hook):
+        hookrecorder = HookRecorder(hook._pm)
+        self.request.addfinalizer(hookrecorder.finish_recording)
+        return hookrecorder
+
+
+def get_public_names(values):
+    """Only return names from iterator values without a leading underscore."""
+    return [x for x in values if x[0] != "_"]
+
+
+class ParsedCall(object):
+
+    def __init__(self, name, kwargs):
+        self.__dict__.update(kwargs)
+        self._name = name
+
+    def __repr__(self):
+        d = self.__dict__.copy()
+        del d["_name"]
+        return "<ParsedCall %r(**%r)>" % (self._name, d)
+
+
+class HookRecorder(object):
+    """Record all hooks called in a plugin manager.
+
+    This wraps all the hook calls in the plugin manager, recording each call
+    before propagating the normal calls.
+
+    """
+
+    def __init__(self, pluginmanager):
+        self._pluginmanager = pluginmanager
+        self.calls = []
+
+        def before(hook_name, hook_impls, kwargs):
+            self.calls.append(ParsedCall(hook_name, kwargs))
+
+        def after(outcome, hook_name, hook_impls, kwargs):
+            pass
+
+        self._undo_wrapping = pluginmanager.add_hookcall_monitoring(before, after)
+
+    def finish_recording(self):
+        self._undo_wrapping()
+
+    def getcalls(self, names):
+        if isinstance(names, str):
+            names = names.split()
+        return [call for call in self.calls if call._name in names]
+
+    def assert_contains(self, entries):
+        __tracebackhide__ = True
+        i = 0
+        entries = list(entries)
+        backlocals = sys._getframe(1).f_locals
+        while entries:
+            name, check = entries.pop(0)
+            for ind, call in enumerate(self.calls[i:]):
+                if call._name == name:
+                    print("NAMEMATCH", name, call)
+                    if eval(check, backlocals, call.__dict__):
+                        print("CHECKERMATCH", repr(check), "->", call)
+                    else:
+                        print("NOCHECKERMATCH", repr(check), "-", call)
+                        continue
+                    i += ind + 1
+                    break
+                print("NONAMEMATCH", name, "with", call)
+            else:
+                pytest.fail("could not find %r check %r" % (name, check))
+
+    def popcall(self, name):
+        __tracebackhide__ = True
+        for i, call in enumerate(self.calls):
+            if call._name == name:
+                del self.calls[i]
+                return call
+        lines = ["could not find call %r, in:" % (name,)]
+        lines.extend(["  %s" % str(x) for x in self.calls])
+        pytest.fail("\n".join(lines))
+
+    def getcall(self, name):
+        values = self.getcalls(name)
+        assert len(values) == 1, (name, values)
+        return values[0]
+
+    # functionality for test reports
+
+    def getreports(self, names="pytest_runtest_logreport pytest_collectreport"):
+        return [x.report for x in self.getcalls(names)]
+
+    def matchreport(
+        self,
+        inamepart="",
+        names="pytest_runtest_logreport pytest_collectreport",
+        when=None,
+    ):
+        """return a testreport whose dotted import path matches"""
+        values = []
+        for rep in self.getreports(names=names):
+            try:
+                if not when and rep.when != "call" and rep.passed:
+                    # setup/teardown passing reports - let's ignore those
+                    continue
+            except AttributeError:
+                pass
+            if when and getattr(rep, "when", None) != when:
+                continue
+            if not inamepart or inamepart in rep.nodeid.split("::"):
+                values.append(rep)
+        if not values:
+            raise ValueError(
+                "could not find test report matching %r: "
+                "no test reports at all!" % (inamepart,)
+            )
+        if len(values) > 1:
+            raise ValueError(
+                "found 2 or more testreports matching %r: %s" % (inamepart, values)
+            )
+        return values[0]
+
+    def getfailures(self, names="pytest_runtest_logreport pytest_collectreport"):
+        return [rep for rep in self.getreports(names) if rep.failed]
+
+    def getfailedcollections(self):
+        return self.getfailures("pytest_collectreport")
+
+    def listoutcomes(self):
+        passed = []
+        skipped = []
+        failed = []
+        for rep in self.getreports("pytest_collectreport pytest_runtest_logreport"):
+            if rep.passed:
+                if getattr(rep, "when", None) == "call":
+                    passed.append(rep)
+            elif rep.skipped:
+                skipped.append(rep)
+            elif rep.failed:
+                failed.append(rep)
+        return passed, skipped, failed
+
+    def countoutcomes(self):
+        return [len(x) for x in self.listoutcomes()]
+
+    def assertoutcome(self, passed=0, skipped=0, failed=0):
+        realpassed, realskipped, realfailed = self.listoutcomes()
+        assert passed == len(realpassed)
+        assert skipped == len(realskipped)
+        assert failed == len(realfailed)
+
+    def clear(self):
+        self.calls[:] = []
+
+
+@pytest.fixture
+def linecomp(request):
+    return LineComp()
+
+
+@pytest.fixture(name="LineMatcher")
+def LineMatcher_fixture(request):
+    return LineMatcher
+
+
+@pytest.fixture
+def testdir(request, tmpdir_factory):
+    return Testdir(request, tmpdir_factory)
+
+
+rex_outcome = re.compile(r"(\d+) ([\w-]+)")
+
+
+class RunResult(object):
+    """The result of running a command.
+
+    Attributes:
+
+    :ret: the return value
+    :outlines: list of lines captured from stdout
+    :errlines: list of lines captures from stderr
+    :stdout: :py:class:`LineMatcher` of stdout, use ``stdout.str()`` to
+       reconstruct stdout or the commonly used ``stdout.fnmatch_lines()``
+       method
+    :stderr: :py:class:`LineMatcher` of stderr
+    :duration: duration in seconds
+
+    """
+
+    def __init__(self, ret, outlines, errlines, duration):
+        self.ret = ret
+        self.outlines = outlines
+        self.errlines = errlines
+        self.stdout = LineMatcher(outlines)
+        self.stderr = LineMatcher(errlines)
+        self.duration = duration
+
+    def parseoutcomes(self):
+        """Return a dictionary of outcomestring->num from parsing the terminal
+        output that the test process produced.
+
+        """
+        for line in reversed(self.outlines):
+            if "seconds" in line:
+                outcomes = rex_outcome.findall(line)
+                if outcomes:
+                    d = {}
+                    for num, cat in outcomes:
+                        d[cat] = int(num)
+                    return d
+        raise ValueError("Pytest terminal report not found")
+
+    def assert_outcomes(self, passed=0, skipped=0, failed=0, error=0):
+        """Assert that the specified outcomes appear with the respective
+        numbers (0 means it didn't occur) in the text output from a test run.
+
+        """
+        d = self.parseoutcomes()
+        obtained = {
+            "passed": d.get("passed", 0),
+            "skipped": d.get("skipped", 0),
+            "failed": d.get("failed", 0),
+            "error": d.get("error", 0),
+        }
+        assert (
+            obtained == dict(passed=passed, skipped=skipped, failed=failed, error=error)
+        )
+
+
+class CwdSnapshot(object):
+
+    def __init__(self):
+        self.__saved = os.getcwd()
+
+    def restore(self):
+        os.chdir(self.__saved)
+
+
+class SysModulesSnapshot(object):
+
+    def __init__(self, preserve=None):
+        self.__preserve = preserve
+        self.__saved = dict(sys.modules)
+
+    def restore(self):
+        if self.__preserve:
+            self.__saved.update(
+                (k, m) for k, m in sys.modules.items() if self.__preserve(k)
+            )
+        sys.modules.clear()
+        sys.modules.update(self.__saved)
+
+
+class SysPathsSnapshot(object):
+
+    def __init__(self):
+        self.__saved = list(sys.path), list(sys.meta_path)
+
+    def restore(self):
+        sys.path[:], sys.meta_path[:] = self.__saved
+
+
+class Testdir(object):
+    """Temporary test directory with tools to test/run pytest itself.
+
+    This is based on the ``tmpdir`` fixture but provides a number of methods
+    which aid with testing pytest itself.  Unless :py:meth:`chdir` is used all
+    methods will use :py:attr:`tmpdir` as their current working directory.
+
+    Attributes:
+
+    :tmpdir: The :py:class:`py.path.local` instance of the temporary directory.
+
+    :plugins: A list of plugins to use with :py:meth:`parseconfig` and
+       :py:meth:`runpytest`.  Initially this is an empty list but plugins can
+       be added to the list.  The type of items to add to the list depends on
+       the method using them so refer to them for details.
+
+    """
+
+    def __init__(self, request, tmpdir_factory):
+        self.request = request
+        self._mod_collections = WeakKeyDictionary()
+        name = request.function.__name__
+        self.tmpdir = tmpdir_factory.mktemp(name, numbered=True)
+        self.plugins = []
+        self._cwd_snapshot = CwdSnapshot()
+        self._sys_path_snapshot = SysPathsSnapshot()
+        self._sys_modules_snapshot = self.__take_sys_modules_snapshot()
+        self.chdir()
+        self.request.addfinalizer(self.finalize)
+        method = self.request.config.getoption("--runpytest")
+        if method == "inprocess":
+            self._runpytest_method = self.runpytest_inprocess
+        elif method == "subprocess":
+            self._runpytest_method = self.runpytest_subprocess
+
+    def __repr__(self):
+        return "<Testdir %r>" % (self.tmpdir,)
+
+    def finalize(self):
+        """Clean up global state artifacts.
+
+        Some methods modify the global interpreter state and this tries to
+        clean this up.  It does not remove the temporary directory however so
+        it can be looked at after the test run has finished.
+
+        """
+        self._sys_modules_snapshot.restore()
+        self._sys_path_snapshot.restore()
+        self._cwd_snapshot.restore()
+
+    def __take_sys_modules_snapshot(self):
+        # some zope modules used by twisted-related tests keep internal state
+        # and can't be deleted; we had some trouble in the past with
+        # `zope.interface` for example
+        def preserve_module(name):
+            return name.startswith("zope")
+
+        return SysModulesSnapshot(preserve=preserve_module)
+
+    def make_hook_recorder(self, pluginmanager):
+        """Create a new :py:class:`HookRecorder` for a PluginManager."""
+        assert not hasattr(pluginmanager, "reprec")
+        pluginmanager.reprec = reprec = HookRecorder(pluginmanager)
+        self.request.addfinalizer(reprec.finish_recording)
+        return reprec
+
+    def chdir(self):
+        """Cd into the temporary directory.
+
+        This is done automatically upon instantiation.
+
+        """
+        self.tmpdir.chdir()
+
+    def _makefile(self, ext, args, kwargs, encoding="utf-8"):
+        items = list(kwargs.items())
+
+        def to_text(s):
+            return s.decode(encoding) if isinstance(s, bytes) else six.text_type(s)
+
+        if args:
+            source = u"\n".join(to_text(x) for x in args)
+            basename = self.request.function.__name__
+            items.insert(0, (basename, source))
+
+        ret = None
+        for basename, value in items:
+            p = self.tmpdir.join(basename).new(ext=ext)
+            p.dirpath().ensure_dir()
+            source = Source(value)
+            source = u"\n".join(to_text(line) for line in source.lines)
+            p.write(source.strip().encode(encoding), "wb")
+            if ret is None:
+                ret = p
+        return ret
+
+    def makefile(self, ext, *args, **kwargs):
+        """Create a new file in the testdir.
+
+        ext: The extension the file should use, including the dot, e.g. `.py`.
+
+        args: All args will be treated as strings and joined using newlines.
+           The result will be written as contents to the file.  The name of the
+           file will be based on the test function requesting this fixture.
+           E.g. "testdir.makefile('.txt', 'line1', 'line2')"
+
+        kwargs: Each keyword is the name of a file, while the value of it will
+           be written as contents of the file.
+           E.g. "testdir.makefile('.ini', pytest='[pytest]\naddopts=-rs\n')"
+
+        """
+        return self._makefile(ext, args, kwargs)
+
+    def makeconftest(self, source):
+        """Write a contest.py file with 'source' as contents."""
+        return self.makepyfile(conftest=source)
+
+    def makeini(self, source):
+        """Write a tox.ini file with 'source' as contents."""
+        return self.makefile(".ini", tox=source)
+
+    def getinicfg(self, source):
+        """Return the pytest section from the tox.ini config file."""
+        p = self.makeini(source)
+        return py.iniconfig.IniConfig(p)["pytest"]
+
+    def makepyfile(self, *args, **kwargs):
+        """Shortcut for .makefile() with a .py extension."""
+        return self._makefile(".py", args, kwargs)
+
+    def maketxtfile(self, *args, **kwargs):
+        """Shortcut for .makefile() with a .txt extension."""
+        return self._makefile(".txt", args, kwargs)
+
+    def syspathinsert(self, path=None):
+        """Prepend a directory to sys.path, defaults to :py:attr:`tmpdir`.
+
+        This is undone automatically when this object dies at the end of each
+        test.
+
+        """
+        if path is None:
+            path = self.tmpdir
+        sys.path.insert(0, str(path))
+        # a call to syspathinsert() usually means that the caller wants to
+        # import some dynamically created files, thus with python3 we
+        # invalidate its import caches
+        self._possibly_invalidate_import_caches()
+
+    def _possibly_invalidate_import_caches(self):
+        # invalidate caches if we can (py33 and above)
+        try:
+            import importlib
+        except ImportError:
+            pass
+        else:
+            if hasattr(importlib, "invalidate_caches"):
+                importlib.invalidate_caches()
+
+    def mkdir(self, name):
+        """Create a new (sub)directory."""
+        return self.tmpdir.mkdir(name)
+
+    def mkpydir(self, name):
+        """Create a new python package.
+
+        This creates a (sub)directory with an empty ``__init__.py`` file so it
+        gets recognised as a python package.
+
+        """
+        p = self.mkdir(name)
+        p.ensure("__init__.py")
+        return p
+
+    Session = Session
+
+    def getnode(self, config, arg):
+        """Return the collection node of a file.
+
+        :param config: :py:class:`_pytest.config.Config` instance, see
+           :py:meth:`parseconfig` and :py:meth:`parseconfigure` to create the
+           configuration
+
+        :param arg: a :py:class:`py.path.local` instance of the file
+
+        """
+        session = Session(config)
+        assert "::" not in str(arg)
+        p = py.path.local(arg)
+        config.hook.pytest_sessionstart(session=session)
+        res = session.perform_collect([str(p)], genitems=False)[0]
+        config.hook.pytest_sessionfinish(session=session, exitstatus=EXIT_OK)
+        return res
+
+    def getpathnode(self, path):
+        """Return the collection node of a file.
+
+        This is like :py:meth:`getnode` but uses :py:meth:`parseconfigure` to
+        create the (configured) pytest Config instance.
+
+        :param path: a :py:class:`py.path.local` instance of the file
+
+        """
+        config = self.parseconfigure(path)
+        session = Session(config)
+        x = session.fspath.bestrelpath(path)
+        config.hook.pytest_sessionstart(session=session)
+        res = session.perform_collect([x], genitems=False)[0]
+        config.hook.pytest_sessionfinish(session=session, exitstatus=EXIT_OK)
+        return res
+
+    def genitems(self, colitems):
+        """Generate all test items from a collection node.
+
+        This recurses into the collection node and returns a list of all the
+        test items contained within.
+
+        """
+        session = colitems[0].session
+        result = []
+        for colitem in colitems:
+            result.extend(session.genitems(colitem))
+        return result
+
+    def runitem(self, source):
+        """Run the "test_func" Item.
+
+        The calling test instance (class containing the test method) must
+        provide a ``.getrunner()`` method which should return a runner which
+        can run the test protocol for a single item, e.g.
+        :py:func:`_pytest.runner.runtestprotocol`.
+
+        """
+        # used from runner functional tests
+        item = self.getitem(source)
+        # the test class where we are called from wants to provide the runner
+        testclassinstance = self.request.instance
+        runner = testclassinstance.getrunner()
+        return runner(item)
+
+    def inline_runsource(self, source, *cmdlineargs):
+        """Run a test module in process using ``pytest.main()``.
+
+        This run writes "source" into a temporary file and runs
+        ``pytest.main()`` on it, returning a :py:class:`HookRecorder` instance
+        for the result.
+
+        :param source: the source code of the test module
+
+        :param cmdlineargs: any extra command line arguments to use
+
+        :return: :py:class:`HookRecorder` instance of the result
+
+        """
+        p = self.makepyfile(source)
+        values = list(cmdlineargs) + [p]
+        return self.inline_run(*values)
+
+    def inline_genitems(self, *args):
+        """Run ``pytest.main(['--collectonly'])`` in-process.
+
+        Runs the :py:func:`pytest.main` function to run all of pytest inside
+        the test process itself like :py:meth:`inline_run`, but returns a
+        tuple of the collected items and a :py:class:`HookRecorder` instance.
+
+        """
+        rec = self.inline_run("--collect-only", *args)
+        items = [x.item for x in rec.getcalls("pytest_itemcollected")]
+        return items, rec
+
+    def inline_run(self, *args, **kwargs):
+        """Run ``pytest.main()`` in-process, returning a HookRecorder.
+
+        Runs the :py:func:`pytest.main` function to run all of pytest inside
+        the test process itself.  This means it can return a
+        :py:class:`HookRecorder` instance which gives more detailed results
+        from that run than can be done by matching stdout/stderr from
+        :py:meth:`runpytest`.
+
+        :param args: command line arguments to pass to :py:func:`pytest.main`
+
+        :param plugin: (keyword-only) extra plugin instances the
+           ``pytest.main()`` instance should use
+
+        :return: a :py:class:`HookRecorder` instance
+
+        """
+        finalizers = []
+        try:
+            # When running pytest inline any plugins active in the main test
+            # process are already imported.  So this disables the warning which
+            # will trigger to say they can no longer be rewritten, which is
+            # fine as they have already been rewritten.
+            orig_warn = AssertionRewritingHook._warn_already_imported
+
+            def revert_warn_already_imported():
+                AssertionRewritingHook._warn_already_imported = orig_warn
+
+            finalizers.append(revert_warn_already_imported)
+            AssertionRewritingHook._warn_already_imported = lambda *a: None
+
+            # Any sys.module or sys.path changes done while running pytest
+            # inline should be reverted after the test run completes to avoid
+            # clashing with later inline tests run within the same pytest test,
+            # e.g. just because they use matching test module names.
+            finalizers.append(self.__take_sys_modules_snapshot().restore)
+            finalizers.append(SysPathsSnapshot().restore)
+
+            # Important note:
+            # - our tests should not leave any other references/registrations
+            #   laying around other than possibly loaded test modules
+            #   referenced from sys.modules, as nothing will clean those up
+            #   automatically
+
+            rec = []
+
+            class Collect(object):
+
+                def pytest_configure(x, config):
+                    rec.append(self.make_hook_recorder(config.pluginmanager))
+
+            plugins = kwargs.get("plugins") or []
+            plugins.append(Collect())
+            ret = pytest.main(list(args), plugins=plugins)
+            if len(rec) == 1:
+                reprec = rec.pop()
+            else:
+
+                class reprec(object):
+                    pass
+
+            reprec.ret = ret
+
+            # typically we reraise keyboard interrupts from the child run
+            # because it's our user requesting interruption of the testing
+            if ret == 2 and not kwargs.get("no_reraise_ctrlc"):
+                calls = reprec.getcalls("pytest_keyboard_interrupt")
+                if calls and calls[-1].excinfo.type == KeyboardInterrupt:
+                    raise KeyboardInterrupt()
+            return reprec
+        finally:
+            for finalizer in finalizers:
+                finalizer()
+
+    def runpytest_inprocess(self, *args, **kwargs):
+        """Return result of running pytest in-process, providing a similar
+        interface to what self.runpytest() provides.
+
+        """
+        if kwargs.get("syspathinsert"):
+            self.syspathinsert()
+        now = time.time()
+        capture = MultiCapture(Capture=SysCapture)
+        capture.start_capturing()
+        try:
+            try:
+                reprec = self.inline_run(*args, **kwargs)
+            except SystemExit as e:
+
+                class reprec(object):
+                    ret = e.args[0]
+
+            except Exception:
+                traceback.print_exc()
+
+                class reprec(object):
+                    ret = 3
+
+        finally:
+            out, err = capture.readouterr()
+            capture.stop_capturing()
+            sys.stdout.write(out)
+            sys.stderr.write(err)
+
+        res = RunResult(reprec.ret, out.split("\n"), err.split("\n"), time.time() - now)
+        res.reprec = reprec
+        return res
+
+    def runpytest(self, *args, **kwargs):
+        """Run pytest inline or in a subprocess, depending on the command line
+        option "--runpytest" and return a :py:class:`RunResult`.
+
+        """
+        args = self._ensure_basetemp(args)
+        return self._runpytest_method(*args, **kwargs)
+
+    def _ensure_basetemp(self, args):
+        args = [str(x) for x in args]
+        for x in args:
+            if str(x).startswith("--basetemp"):
+                # print("basedtemp exists: %s" %(args,))
+                break
+        else:
+            args.append("--basetemp=%s" % self.tmpdir.dirpath("basetemp"))
+            # print("added basetemp: %s" %(args,))
+        return args
+
+    def parseconfig(self, *args):
+        """Return a new pytest Config instance from given commandline args.
+
+        This invokes the pytest bootstrapping code in _pytest.config to create
+        a new :py:class:`_pytest.core.PluginManager` and call the
+        pytest_cmdline_parse hook to create a new
+        :py:class:`_pytest.config.Config` instance.
+
+        If :py:attr:`plugins` has been populated they should be plugin modules
+        to be registered with the PluginManager.
+
+        """
+        args = self._ensure_basetemp(args)
+
+        import _pytest.config
+
+        config = _pytest.config._prepareconfig(args, self.plugins)
+        # we don't know what the test will do with this half-setup config
+        # object and thus we make sure it gets unconfigured properly in any
+        # case (otherwise capturing could still be active, for example)
+        self.request.addfinalizer(config._ensure_unconfigure)
+        return config
+
+    def parseconfigure(self, *args):
+        """Return a new pytest configured Config instance.
+
+        This returns a new :py:class:`_pytest.config.Config` instance like
+        :py:meth:`parseconfig`, but also calls the pytest_configure hook.
+
+        """
+        config = self.parseconfig(*args)
+        config._do_configure()
+        self.request.addfinalizer(config._ensure_unconfigure)
+        return config
+
+    def getitem(self, source, funcname="test_func"):
+        """Return the test item for a test function.
+
+        This writes the source to a python file and runs pytest's collection on
+        the resulting module, returning the test item for the requested
+        function name.
+
+        :param source: the module source
+
+        :param funcname: the name of the test function for which to return a
+            test item
+
+        """
+        items = self.getitems(source)
+        for item in items:
+            if item.name == funcname:
+                return item
+        assert 0, (
+            "%r item not found in module:\n%s\nitems: %s" % (funcname, source, items)
+        )
+
+    def getitems(self, source):
+        """Return all test items collected from the module.
+
+        This writes the source to a python file and runs pytest's collection on
+        the resulting module, returning all test items contained within.
+
+        """
+        modcol = self.getmodulecol(source)
+        return self.genitems([modcol])
+
+    def getmodulecol(self, source, configargs=(), withinit=False):
+        """Return the module collection node for ``source``.
+
+        This writes ``source`` to a file using :py:meth:`makepyfile` and then
+        runs the pytest collection on it, returning the collection node for the
+        test module.
+
+        :param source: the source code of the module to collect
+
+        :param configargs: any extra arguments to pass to
+            :py:meth:`parseconfigure`
+
+        :param withinit: whether to also write an ``__init__.py`` file to the
+            same directory to ensure it is a package
+
+        """
+        kw = {self.request.function.__name__: Source(source).strip()}
+        path = self.makepyfile(**kw)
+        if withinit:
+            self.makepyfile(__init__="#")
+        self.config = config = self.parseconfigure(path, *configargs)
+        node = self.getnode(config, path)
+
+        return node
+
+    def collect_by_name(self, modcol, name):
+        """Return the collection node for name from the module collection.
+
+        This will search a module collection node for a collection node
+        matching the given name.
+
+        :param modcol: a module collection node; see :py:meth:`getmodulecol`
+
+        :param name: the name of the node to return
+
+        """
+        if modcol not in self._mod_collections:
+            self._mod_collections[modcol] = list(modcol.collect())
+        for colitem in self._mod_collections[modcol]:
+            if colitem.name == name:
+                return colitem
+
+    def popen(self, cmdargs, stdout, stderr, **kw):
+        """Invoke subprocess.Popen.
+
+        This calls subprocess.Popen making sure the current working directory
+        is in the PYTHONPATH.
+
+        You probably want to use :py:meth:`run` instead.
+
+        """
+        env = os.environ.copy()
+        env["PYTHONPATH"] = os.pathsep.join(
+            filter(None, [str(os.getcwd()), env.get("PYTHONPATH", "")])
+        )
+        kw["env"] = env
+
+        popen = subprocess.Popen(
+            cmdargs, stdin=subprocess.PIPE, stdout=stdout, stderr=stderr, **kw
+        )
+        popen.stdin.close()
+
+        return popen
+
+    def run(self, *cmdargs):
+        """Run a command with arguments.
+
+        Run a process using subprocess.Popen saving the stdout and stderr.
+
+        Returns a :py:class:`RunResult`.
+
+        """
+        return self._run(*cmdargs)
+
+    def _run(self, *cmdargs):
+        cmdargs = [str(x) for x in cmdargs]
+        p1 = self.tmpdir.join("stdout")
+        p2 = self.tmpdir.join("stderr")
+        print("running:", " ".join(cmdargs))
+        print("     in:", str(py.path.local()))
+        f1 = codecs.open(str(p1), "w", encoding="utf8")
+        f2 = codecs.open(str(p2), "w", encoding="utf8")
+        try:
+            now = time.time()
+            popen = self.popen(
+                cmdargs, stdout=f1, stderr=f2, close_fds=(sys.platform != "win32")
+            )
+            ret = popen.wait()
+        finally:
+            f1.close()
+            f2.close()
+        f1 = codecs.open(str(p1), "r", encoding="utf8")
+        f2 = codecs.open(str(p2), "r", encoding="utf8")
+        try:
+            out = f1.read().splitlines()
+            err = f2.read().splitlines()
+        finally:
+            f1.close()
+            f2.close()
+        self._dump_lines(out, sys.stdout)
+        self._dump_lines(err, sys.stderr)
+        return RunResult(ret, out, err, time.time() - now)
+
+    def _dump_lines(self, lines, fp):
+        try:
+            for line in lines:
+                print(line, file=fp)
+        except UnicodeEncodeError:
+            print("couldn't print to %s because of encoding" % (fp,))
+
+    def _getpytestargs(self):
+        # we cannot use `(sys.executable, script)` because on Windows the
+        # script is e.g. `pytest.exe`
+        return (sys.executable, PYTEST_FULLPATH)  # noqa
+
+    def runpython(self, script):
+        """Run a python script using sys.executable as interpreter.
+
+        Returns a :py:class:`RunResult`.
+
+        """
+        return self.run(sys.executable, script)
+
+    def runpython_c(self, command):
+        """Run python -c "command", return a :py:class:`RunResult`."""
+        return self.run(sys.executable, "-c", command)
+
+    def runpytest_subprocess(self, *args, **kwargs):
+        """Run pytest as a subprocess with given arguments.
+
+        Any plugins added to the :py:attr:`plugins` list will added using the
+        ``-p`` command line option.  Additionally ``--basetemp`` is used put
+        any temporary files and directories in a numbered directory prefixed
+        with "runpytest-" so they do not conflict with the normal numbered
+        pytest location for temporary files and directories.
+
+        Returns a :py:class:`RunResult`.
+
+        """
+        p = py.path.local.make_numbered_dir(
+            prefix="runpytest-", keep=None, rootdir=self.tmpdir
+        )
+        args = ("--basetemp=%s" % p,) + args
+        plugins = [x for x in self.plugins if isinstance(x, str)]
+        if plugins:
+            args = ("-p", plugins[0]) + args
+        args = self._getpytestargs() + args
+        return self.run(*args)
+
+    def spawn_pytest(self, string, expect_timeout=10.0):
+        """Run pytest using pexpect.
+
+        This makes sure to use the right pytest and sets up the temporary
+        directory locations.
+
+        The pexpect child is returned.
+
+        """
+        basetemp = self.tmpdir.mkdir("temp-pexpect")
+        invoke = " ".join(map(str, self._getpytestargs()))
+        cmd = "%s --basetemp=%s %s" % (invoke, basetemp, string)
+        return self.spawn(cmd, expect_timeout=expect_timeout)
+
+    def spawn(self, cmd, expect_timeout=10.0):
+        """Run a command using pexpect.
+
+        The pexpect child is returned.
+
+        """
+        pexpect = pytest.importorskip("pexpect", "3.0")
+        if hasattr(sys, "pypy_version_info") and "64" in platform.machine():
+            pytest.skip("pypy-64 bit not supported")
+        if sys.platform.startswith("freebsd"):
+            pytest.xfail("pexpect does not work reliably on freebsd")
+        logfile = self.tmpdir.join("spawn.out").open("wb")
+        child = pexpect.spawn(cmd, logfile=logfile)
+        self.request.addfinalizer(logfile.close)
+        child.timeout = expect_timeout
+        return child
+
+
+def getdecoded(out):
+    try:
+        return out.decode("utf-8")
+    except UnicodeDecodeError:
+        return "INTERNAL not-utf8-decodeable, truncated string:\n%s" % (
+            py.io.saferepr(out),
+        )
+
+
+class LineComp(object):
+
+    def __init__(self):
+        self.stringio = py.io.TextIO()
+
+    def assert_contains_lines(self, lines2):
+        """Assert that lines2 are contained (linearly) in lines1.
+
+        Return a list of extralines found.
+
+        """
+        __tracebackhide__ = True
+        val = self.stringio.getvalue()
+        self.stringio.truncate(0)
+        self.stringio.seek(0)
+        lines1 = val.split("\n")
+        return LineMatcher(lines1).fnmatch_lines(lines2)
+
+
+class LineMatcher(object):
+    """Flexible matching of text.
+
+    This is a convenience class to test large texts like the output of
+    commands.
+
+    The constructor takes a list of lines without their trailing newlines, i.e.
+    ``text.splitlines()``.
+
+    """
+
+    def __init__(self, lines):
+        self.lines = lines
+        self._log_output = []
+
+    def str(self):
+        """Return the entire original text."""
+        return "\n".join(self.lines)
+
+    def _getlines(self, lines2):
+        if isinstance(lines2, str):
+            lines2 = Source(lines2)
+        if isinstance(lines2, Source):
+            lines2 = lines2.strip().lines
+        return lines2
+
+    def fnmatch_lines_random(self, lines2):
+        """Check lines exist in the output using in any order.
+
+        Lines are checked using ``fnmatch.fnmatch``. The argument is a list of
+        lines which have to occur in the output, in any order.
+
+        """
+        self._match_lines_random(lines2, fnmatch)
+
+    def re_match_lines_random(self, lines2):
+        """Check lines exist in the output using ``re.match``, in any order.
+
+        The argument is a list of lines which have to occur in the output, in
+        any order.
+
+        """
+        self._match_lines_random(lines2, lambda name, pat: re.match(pat, name))
+
+    def _match_lines_random(self, lines2, match_func):
+        """Check lines exist in the output.
+
+        The argument is a list of lines which have to occur in the output, in
+        any order.  Each line can contain glob whildcards.
+
+        """
+        lines2 = self._getlines(lines2)
+        for line in lines2:
+            for x in self.lines:
+                if line == x or match_func(x, line):
+                    self._log("matched: ", repr(line))
+                    break
+            else:
+                self._log("line %r not found in output" % line)
+                raise ValueError(self._log_text)
+
+    def get_lines_after(self, fnline):
+        """Return all lines following the given line in the text.
+
+        The given line can contain glob wildcards.
+
+        """
+        for i, line in enumerate(self.lines):
+            if fnline == line or fnmatch(line, fnline):
+                return self.lines[i + 1:]
+        raise ValueError("line %r not found in output" % fnline)
+
+    def _log(self, *args):
+        self._log_output.append(" ".join((str(x) for x in args)))
+
+    @property
+    def _log_text(self):
+        return "\n".join(self._log_output)
+
+    def fnmatch_lines(self, lines2):
+        """Search captured text for matching lines using ``fnmatch.fnmatch``.
+
+        The argument is a list of lines which have to match and can use glob
+        wildcards.  If they do not match a pytest.fail() is called.  The
+        matches and non-matches are also printed on stdout.
+
+        """
+        self._match_lines(lines2, fnmatch, "fnmatch")
+
+    def re_match_lines(self, lines2):
+        """Search captured text for matching lines using ``re.match``.
+
+        The argument is a list of lines which have to match using ``re.match``.
+        If they do not match a pytest.fail() is called.
+
+        The matches and non-matches are also printed on stdout.
+
+        """
+        self._match_lines(lines2, lambda name, pat: re.match(pat, name), "re.match")
+
+    def _match_lines(self, lines2, match_func, match_nickname):
+        """Underlying implementation of ``fnmatch_lines`` and ``re_match_lines``.
+
+        :param list[str] lines2: list of string patterns to match. The actual
+            format depends on ``match_func``
+        :param match_func: a callable ``match_func(line, pattern)`` where line
+            is the captured line from stdout/stderr and pattern is the matching
+            pattern
+        :param str match_nickname: the nickname for the match function that
+            will be logged to stdout when a match occurs
+
+        """
+        lines2 = self._getlines(lines2)
+        lines1 = self.lines[:]
+        nextline = None
+        extralines = []
+        __tracebackhide__ = True
+        for line in lines2:
+            nomatchprinted = False
+            while lines1:
+                nextline = lines1.pop(0)
+                if line == nextline:
+                    self._log("exact match:", repr(line))
+                    break
+                elif match_func(nextline, line):
+                    self._log("%s:" % match_nickname, repr(line))
+                    self._log("   with:", repr(nextline))
+                    break
+                else:
+                    if not nomatchprinted:
+                        self._log("nomatch:", repr(line))
+                        nomatchprinted = True
+                    self._log("    and:", repr(nextline))
+                extralines.append(nextline)
+            else:
+                self._log("remains unmatched: %r" % (line,))
+                pytest.fail(self._log_text)
new file mode 100644
--- /dev/null
+++ b/third_party/python/pytest/src/_pytest/python.py
@@ -0,0 +1,1331 @@
+""" Python test discovery, setup and run of test functions. """
+from __future__ import absolute_import, division, print_function
+
+import fnmatch
+import inspect
+import sys
+import os
+import collections
+import warnings
+from textwrap import dedent
+from itertools import count
+
+
+import py
+import six
+from _pytest.mark import MarkerError
+from _pytest.config import hookimpl
+
+import _pytest
+import pluggy
+from _pytest import fixtures
+from _pytest import nodes
+from _pytest import deprecated
+from _pytest.compat import (
+    isclass,
+    isfunction,
+    is_generator,
+    ascii_escaped,
+    REGEX_TYPE,
+    STRING_TYPES,
+    NoneType,
+    NOTSET,
+    get_real_func,
+    getfslineno,
+    safe_getattr,
+    safe_str,
+    getlocation,
+    enum,
+    get_default_arg_names,
+)
+from _pytest.outcomes import fail
+from _pytest.mark.structures import transfer_markers, get_unpacked_marks
+
+
+# relative paths that we use to filter traceback entries from appearing to the user;
+# see filter_traceback
+# note: if we need to add more paths than what we have now we should probably use a list
+# for better maintenance
+_pluggy_dir = py.path.local(pluggy.__file__.rstrip("oc"))
+# pluggy is either a package or a single module depending on the version
+if _pluggy_dir.basename == "__init__.py":
+    _pluggy_dir = _pluggy_dir.dirpath()
+_pytest_dir = py.path.local(_pytest.__file__).dirpath()
+_py_dir = py.path.local(py.__file__).dirpath()
+
+
+def filter_traceback(entry):
+    """Return True if a TracebackEntry instance should be removed from tracebacks:
+    * dynamically generated code (no code to show up for it);
+    * internal traceback from pytest or its internal libraries, py and pluggy.
+    """
+    # entry.path might sometimes return a str object when the entry
+    # points to dynamically generated code
+    # see https://bitbucket.org/pytest-dev/py/issues/71
+    raw_filename = entry.frame.code.raw.co_filename
+    is_generated = "<" in raw_filename and ">" in raw_filename
+    if is_generated:
+        return False
+    # entry.path might point to a non-existing file, in which case it will
+    # also return a str object. see #1133
+    p = py.path.local(entry.path)
+    return not p.relto(_pluggy_dir) and not p.relto(_pytest_dir) and not p.relto(
+        _py_dir
+    )
+
+
+def pyobj_property(name):
+
+    def get(self):
+        node = self.getparent(getattr(__import__("pytest"), name))
+        if node is not None:
+            return node.obj
+
+    doc = "python %s object this node was collected from (can be None)." % (
+        name.lower(),
+    )
+    return property(get, None, None, doc)
+
+
+def pytest_addoption(parser):
+    group = parser.getgroup("general")
+    group.addoption(
+        "--fixtures",
+        "--funcargs",
+        action="store_true",
+        dest="showfixtures",
+        default=False,
+        help="show available fixtures, sorted by plugin appearance "
+        "(fixtures with leading '_' are only shown with '-v')",
+    )
+    group.addoption(
+        "--fixtures-per-test",
+        action="store_true",
+        dest="show_fixtures_per_test",
+        default=False,
+        help="show fixtures per test",
+    )
+    parser.addini(
+        "usefixtures",
+        type="args",
+        default=[],
+        help="list of default fixtures to be used with this project",
+    )
+    parser.addini(
+        "python_files",
+        type="args",
+        default=["test_*.py", "*_test.py"],
+        help="glob-style file patterns for Python test module discovery",
+    )
+    parser.addini(
+        "python_classes",
+        type="args",
+        default=["Test"],
+        help="prefixes or glob names for Python test class discovery",
+    )
+    parser.addini(
+        "python_functions",
+        type="args",
+        default=["test"],
+        help="prefixes or glob names for Python test function and " "method discovery",
+    )
+
+    group.addoption(
+        "--import-mode",
+        default="prepend",
+        choices=["prepend", "append"],
+        dest="importmode",
+        help="prepend/append to sys.path when importing test modules, "
+        "default is to prepend.",
+    )
+
+
+def pytest_cmdline_main(config):
+    if config.option.showfixtures:
+        showfixtures(config)
+        return 0
+    if config.option.show_fixtures_per_test:
+        show_fixtures_per_test(config)
+        return 0
+
+
+def pytest_generate_tests(metafunc):
+    # those alternative spellings are common - raise a specific error to alert
+    # the user
+    alt_spellings = ["parameterize", "parametrise", "parameterise"]
+    for attr in alt_spellings:
+        if hasattr(metafunc.function, attr):
+            msg = "{0} has '{1}', spelling should be 'parametrize'"
+            raise MarkerError(msg.format(metafunc.function.__name__, attr))
+    for marker in metafunc.definition.iter_markers(name="parametrize"):
+        metafunc.parametrize(*marker.args, **marker.kwargs)
+
+
+def pytest_configure(config):
+    config.addinivalue_line(
+        "markers",
+        "parametrize(argnames, argvalues): call a test function multiple "
+        "times passing in different arguments in turn. argvalues generally "
+        "needs to be a list of values if argnames specifies only one name "
+        "or a list of tuples of values if argnames specifies multiple names. "
+        "Example: @parametrize('arg1', [1,2]) would lead to two calls of the "
+        "decorated test function, one with arg1=1 and another with arg1=2."
+        "see http://pytest.org/latest/parametrize.html for more info and "
+        "examples.",
+    )
+    config.addinivalue_line(
+        "markers",
+        "usefixtures(fixturename1, fixturename2, ...): mark tests as needing "
+        "all of the specified fixtures. see http://pytest.org/latest/fixture.html#usefixtures ",
+    )
+
+
+@hookimpl(trylast=True)
+def pytest_pyfunc_call(pyfuncitem):
+    testfunction = pyfuncitem.obj
+    if pyfuncitem._isyieldedfunction():
+        testfunction(*pyfuncitem._args)
+    else:
+        funcargs = pyfuncitem.funcargs
+        testargs = {}
+        for arg in pyfuncitem._fixtureinfo.argnames:
+            testargs[arg] = funcargs[arg]
+        testfunction(**testargs)
+    return True
+
+
+def pytest_collect_file(path, parent):
+    ext = path.ext
+    if ext == ".py":
+        if not parent.session.isinitpath(path):
+            for pat in parent.config.getini("python_files"):
+                if path.fnmatch(pat):
+                    break
+            else:
+                return
+        ihook = parent.session.gethookproxy(path)
+        return ihook.pytest_pycollect_makemodule(path=path, parent=parent)
+
+
+def pytest_pycollect_makemodule(path, parent):
+    return Module(path, parent)
+
+
+@hookimpl(hookwrapper=True)
+def pytest_pycollect_makeitem(collector, name, obj):
+    outcome = yield
+    res = outcome.get_result()
+    if res is not None:
+        return
+    # nothing was collected elsewhere, let's do it here
+    if isclass(obj):
+        if collector.istestclass(obj, name):
+            Class = collector._getcustomclass("Class")
+            outcome.force_result(Class(name, parent=collector))
+    elif collector.istestfunction(obj, name):
+        # mock seems to store unbound methods (issue473), normalize it
+        obj = getattr(obj, "__func__", obj)
+        # We need to try and unwrap the function if it's a functools.partial
+        # or a funtools.wrapped.
+        # We musn't if it's been wrapped with mock.patch (python 2 only)
+        if not (isfunction(obj) or isfunction(get_real_func(obj))):
+            collector.warn(
+                code="C2",
+                message="cannot collect %r because it is not a function." % name,
+            )
+        elif getattr(obj, "__test__", True):
+            if is_generator(obj):
+                res = Generator(name, parent=collector)
+            else:
+                res = list(collector._genfunctions(name, obj))
+            outcome.force_result(res)
+
+
+def pytest_make_parametrize_id(config, val, argname=None):
+    return None
+
+
+class PyobjContext(object):
+    module = pyobj_property("Module")
+    cls = pyobj_property("Class")
+    instance = pyobj_property("Instance")
+
+
+class PyobjMixin(PyobjContext):
+    _ALLOW_MARKERS = True
+
+    def __init__(self, *k, **kw):
+        super(PyobjMixin, self).__init__(*k, **kw)
+
+    def obj():
+
+        def fget(self):
+            obj = getattr(self, "_obj", None)
+            if obj is None:
+                self._obj = obj = self._getobj()
+                # XXX evil hack
+                # used to avoid Instance collector marker duplication
+                if self._ALLOW_MARKERS:
+                    self.own_markers.extend(get_unpacked_marks(self.obj))
+            return obj
+
+        def fset(self, value):
+            self._obj = value
+
+        return property(fget, fset, None, "underlying python object")
+
+    obj = obj()
+
+    def _getobj(self):
+        return getattr(self.parent.obj, self.name)
+
+    def getmodpath(self, stopatmodule=True, includemodule=False):
+        """ return python path relative to the containing module. """
+        chain = self.listchain()
+        chain.reverse()
+        parts = []
+        for node in chain:
+            if isinstance(node, Instance):
+                continue
+            name = node.name
+            if isinstance(node, Module):
+                name = os.path.splitext(name)[0]
+                if stopatmodule:
+                    if includemodule:
+                        parts.append(name)
+                    break
+            parts.append(name)
+        parts.reverse()
+        s = ".".join(parts)
+        return s.replace(".[", "[")
+
+    def _getfslineno(self):
+        return getfslineno(self.obj)
+
+    def reportinfo(self):
+        # XXX caching?
+        obj = self.obj
+        compat_co_firstlineno = getattr(obj, "compat_co_firstlineno", None)
+        if isinstance(compat_co_firstlineno, int):
+            # nose compatibility
+            fspath = sys.modules[obj.__module__].__file__
+            if fspath.endswith(".pyc"):
+                fspath = fspath[:-1]
+            lineno = compat_co_firstlineno
+        else:
+            fspath, lineno = getfslineno(obj)
+        modpath = self.getmodpath()
+        assert isinstance(lineno, int)
+        return fspath, lineno, modpath
+
+
+class PyCollector(PyobjMixin, nodes.Collector):
+
+    def funcnamefilter(self, name):
+        return self._matches_prefix_or_glob_option("python_functions", name)
+
+    def isnosetest(self, obj):
+        """ Look for the __test__ attribute, which is applied by the
+        @nose.tools.istest decorator
+        """
+        # We explicitly check for "is True" here to not mistakenly treat
+        # classes with a custom __getattr__ returning something truthy (like a
+        # function) as test classes.
+        return safe_getattr(obj, "__test__", False) is True
+
+    def classnamefilter(self, name):
+        return self._matches_prefix_or_glob_option("python_classes", name)
+
+    def istestfunction(self, obj, name):
+        if self.funcnamefilter(name) or self.isnosetest(obj):
+            if isinstance(obj, staticmethod):
+                # static methods need to be unwrapped
+                obj = safe_getattr(obj, "__func__", False)
+                if obj is False:
+                    # Python 2.6 wraps in a different way that we won't try to handle
+                    msg = "cannot collect static method %r because it is not a function"
+                    self.warn(code="C2", message=msg % name)
+                    return False
+            return (
+                safe_getattr(obj, "__call__", False)
+                and fixtures.getfixturemarker(obj) is None
+            )
+        else:
+            return False
+
+    def istestclass(self, obj, name):
+        return self.classnamefilter(name) or self.isnosetest(obj)
+
+    def _matches_prefix_or_glob_option(self, option_name, name):
+        """
+        checks if the given name matches the prefix or glob-pattern defined
+        in ini configuration.
+        """
+        for option in self.config.getini(option_name):
+            if name.startswith(option):
+                return True
+            # check that name looks like a glob-string before calling fnmatch
+            # because this is called for every name in each collected module,
+            # and fnmatch is somewhat expensive to call
+            elif ("*" in option or "?" in option or "[" in option) and fnmatch.fnmatch(
+                name, option
+            ):
+                return True
+        return False
+
+    def collect(self):
+        if not getattr(self.obj, "__test__", True):
+            return []
+
+        # NB. we avoid random getattrs and peek in the __dict__ instead
+        # (XXX originally introduced from a PyPy need, still true?)
+        dicts = [getattr(self.obj, "__dict__", {})]
+        for basecls in inspect.getmro(self.obj.__class__):
+            dicts.append(basecls.__dict__)
+        seen = {}
+        values = []
+        for dic in dicts:
+            for name, obj in list(dic.items()):
+                if name in seen:
+                    continue
+                seen[name] = True
+                res = self._makeitem(name, obj)
+                if res is None:
+                    continue
+                if not isinstance(res, list):
+                    res = [res]
+                values.extend(res)
+        values.sort(key=lambda item: item.reportinfo()[:2])
+        return values
+
+    def makeitem(self, name, obj):
+        warnings.warn(deprecated.COLLECTOR_MAKEITEM, stacklevel=2)
+        self._makeitem(name, obj)
+
+    def _makeitem(self, name, obj):
+        # assert self.ihook.fspath == self.fspath, self
+        return self.ihook.pytest_pycollect_makeitem(collector=self, name=name, obj=obj)
+
+    def _genfunctions(self, name, funcobj):
+        module = self.getparent(Module).obj
+        clscol = self.getparent(Class)
+        cls = clscol and clscol.obj or None
+        transfer_markers(funcobj, cls, module)
+        fm = self.session._fixturemanager
+
+        definition = FunctionDefinition(name=name, parent=self, callobj=funcobj)
+        fixtureinfo = fm.getfixtureinfo(definition, funcobj, cls)
+
+        metafunc = Metafunc(
+            definition, fixtureinfo, self.config, cls=cls, module=module
+        )
+        methods = []
+        if hasattr(module, "pytest_generate_tests"):
+            methods.append(module.pytest_generate_tests)
+        if hasattr(cls, "pytest_generate_tests"):
+            methods.append(cls().pytest_generate_tests)
+        if methods:
+            self.ihook.pytest_generate_tests.call_extra(
+                methods, dict(metafunc=metafunc)
+            )
+        else:
+            self.ihook.pytest_generate_tests(metafunc=metafunc)
+
+        Function = self._getcustomclass("Function")
+        if not metafunc._calls:
+            yield Function(name, parent=self, fixtureinfo=fixtureinfo)
+        else:
+            # add funcargs() as fixturedefs to fixtureinfo.arg2fixturedefs
+            fixtures.add_funcarg_pseudo_fixture_def(self, metafunc, fm)
+
+            for callspec in metafunc._calls:
+                subname = "%s[%s]" % (name, callspec.id)
+                yield Function(
+                    name=subname,
+                    parent=self,
+                    callspec=callspec,
+                    callobj=funcobj,
+                    fixtureinfo=fixtureinfo,
+                    keywords={callspec.id: True},
+                    originalname=name,
+                )
+
+
+class Module(nodes.File, PyCollector):
+    """ Collector for test classes and functions. """
+
+    def _getobj(self):
+        return self._importtestmodule()
+
+    def collect(self):
+        self.session._fixturemanager.parsefactories(self)
+        return super(Module, self).collect()
+
+    def _importtestmodule(self):
+        # we assume we are only called once per module
+        importmode = self.config.getoption("--import-mode")
+        try:
+            mod = self.fspath.pyimport(ensuresyspath=importmode)
+        except SyntaxError:
+            raise self.CollectError(
+                _pytest._code.ExceptionInfo().getrepr(style="short")
+            )
+        except self.fspath.ImportMismatchError:
+            e = sys.exc_info()[1]
+            raise self.CollectError(
+                "import file mismatch:\n"
+                "imported module %r has this __file__ attribute:\n"
+                "  %s\n"
+                "which is not the same as the test file we want to collect:\n"
+                "  %s\n"
+                "HINT: remove __pycache__ / .pyc files and/or use a "
+                "unique basename for your test file modules" % e.args
+            )
+        except ImportError:
+            from _pytest._code.code import ExceptionInfo
+
+            exc_info = ExceptionInfo()
+            if self.config.getoption("verbose") < 2:
+                exc_info.traceback = exc_info.traceback.filter(filter_traceback)
+            exc_repr = exc_info.getrepr(
+                style="short"
+            ) if exc_info.traceback else exc_info.exconly()
+            formatted_tb = safe_str(exc_repr)
+            raise self.CollectError(
+                "ImportError while importing test module '{fspath}'.\n"
+                "Hint: make sure your test modules/packages have valid Python names.\n"
+                "Traceback:\n"
+                "{traceback}".format(fspath=self.fspath, traceback=formatted_tb)
+            )
+        except _pytest.runner.Skipped as e:
+            if e.allow_module_level:
+                raise
+            raise self.CollectError(
+                "Using pytest.skip outside of a test is not allowed. "
+                "To decorate a test function, use the @pytest.mark.skip "
+                "or @pytest.mark.skipif decorators instead, and to skip a "
+                "module use `pytestmark = pytest.mark.{skip,skipif}."
+            )
+        self.config.pluginmanager.consider_module(mod)
+        return mod
+
+    def setup(self):
+        setup_module = _get_xunit_setup_teardown(self.obj, "setUpModule")
+        if setup_module is None:
+            setup_module = _get_xunit_setup_teardown(self.obj, "setup_module")
+        if setup_module is not None:
+            setup_module()
+
+        teardown_module = _get_xunit_setup_teardown(self.obj, "tearDownModule")
+        if teardown_module is None:
+            teardown_module = _get_xunit_setup_teardown(self.obj, "teardown_module")
+        if teardown_module is not None:
+            self.addfinalizer(teardown_module)
+
+
+def _get_xunit_setup_teardown(holder, attr_name, param_obj=None):
+    """
+    Return a callable to perform xunit-style setup or teardown if
+    the function exists in the ``holder`` object.
+    The ``param_obj`` parameter is the parameter which will be passed to the function
+    when the callable is called without arguments, defaults to the ``holder`` object.
+    Return ``None`` if a suitable callable is not found.
+    """
+    param_obj = param_obj if param_obj is not None else holder
+    result = _get_xunit_func(holder, attr_name)
+    if result is not None:
+        arg_count = result.__code__.co_argcount
+        if inspect.ismethod(result):
+            arg_count -= 1
+        if arg_count:
+            return lambda: result(param_obj)
+        else:
+            return result
+
+
+def _get_xunit_func(obj, name):
+    """Return the attribute from the given object to be used as a setup/teardown
+    xunit-style function, but only if not marked as a fixture to
+    avoid calling it twice.
+    """
+    meth = getattr(obj, name, None)
+    if fixtures.getfixturemarker(meth) is None:
+        return meth
+
+
+class Class(PyCollector):
+    """ Collector for test methods. """
+
+    def collect(self):
+        if not safe_getattr(self.obj, "__test__", True):
+            return []
+        if hasinit(self.obj):
+            self.warn(
+                "C1",
+                "cannot collect test class %r because it has a "
+                "__init__ constructor" % self.obj.__name__,
+            )
+            return []
+        elif hasnew(self.obj):
+            self.warn(
+                "C1",
+                "cannot collect test class %r because it has a "
+                "__new__ constructor" % self.obj.__name__,
+            )
+            return []
+        return [self._getcustomclass("Instance")(name="()", parent=self)]
+
+    def setup(self):
+        setup_class = _get_xunit_func(self.obj, "setup_class")
+        if setup_class is not None:
+            setup_class = getattr(setup_class, "im_func", setup_class)
+            setup_class = getattr(setup_class, "__func__", setup_class)
+            setup_class(self.obj)
+
+        fin_class = getattr(self.obj, "teardown_class", None)
+        if fin_class is not None:
+            fin_class = getattr(fin_class, "im_func", fin_class)
+            fin_class = getattr(fin_class, "__func__", fin_class)
+            self.addfinalizer(lambda: fin_class(self.obj))
+
+
+class Instance(PyCollector):
+    _ALLOW_MARKERS = False  # hack, destroy later
+    # instances share the object with their parents in a way
+    # that duplicates markers instances if not taken out
+    # can be removed at node strucutre reorganization time
+
+    def _getobj(self):
+        return self.parent.obj()
+
+    def collect(self):
+        self.session._fixturemanager.parsefactories(self)
+        return super(Instance, self).collect()
+
+    def newinstance(self):
+        self.obj = self._getobj()
+        return self.obj
+
+
+class FunctionMixin(PyobjMixin):
+    """ mixin for the code common to Function and Generator.
+    """
+
+    def setup(self):
+        """ perform setup for this test function. """
+        if hasattr(self, "_preservedparent"):
+            obj = self._preservedparent
+        elif isinstance(self.parent, Instance):
+            obj = self.parent.newinstance()
+            self.obj = self._getobj()
+        else:
+            obj = self.parent.obj
+        if inspect.ismethod(self.obj):
+            setup_name = "setup_method"
+            teardown_name = "teardown_method"
+        else:
+            setup_name = "setup_function"
+            teardown_name = "teardown_function"
+        setup_func_or_method = _get_xunit_setup_teardown(
+            obj, setup_name, param_obj=self.obj
+        )
+        if setup_func_or_method is not None:
+            setup_func_or_method()
+        teardown_func_or_method = _get_xunit_setup_teardown(
+            obj, teardown_name, param_obj=self.obj
+        )
+        if teardown_func_or_method is not None:
+            self.addfinalizer(teardown_func_or_method)
+
+    def _prunetraceback(self, excinfo):
+        if hasattr(self, "_obj") and not self.config.option.fulltrace:
+            code = _pytest._code.Code(get_real_func(self.obj))
+            path, firstlineno = code.path, code.firstlineno
+            traceback = excinfo.traceback
+            ntraceback = traceback.cut(path=path, firstlineno=firstlineno)
+            if ntraceback == traceback:
+                ntraceback = ntraceback.cut(path=path)
+                if ntraceback == traceback:
+                    ntraceback = ntraceback.filter(filter_traceback)
+                    if not ntraceback:
+                        ntraceback = traceback
+
+            excinfo.traceback = ntraceback.filter()
+            # issue364: mark all but first and last frames to
+            # only show a single-line message for each frame
+            if self.config.option.tbstyle == "auto":
+                if len(excinfo.traceback) > 2:
+                    for entry in excinfo.traceback[1:-1]:
+                        entry.set_repr_style("short")
+
+    def _repr_failure_py(self, excinfo, style="long"):
+        if excinfo.errisinstance(fail.Exception):
+            if not excinfo.value.pytrace:
+                return py._builtin._totext(excinfo.value)
+        return super(FunctionMixin, self)._repr_failure_py(excinfo, style=style)
+
+    def repr_failure(self, excinfo, outerr=None):
+        assert outerr is None, "XXX outerr usage is deprecated"
+        style = self.config.option.tbstyle
+        if style == "auto":
+            style = "long"
+        return self._repr_failure_py(excinfo, style=style)
+
+
+class Generator(FunctionMixin, PyCollector):
+
+    def collect(self):
+        # test generators are seen as collectors but they also
+        # invoke setup/teardown on popular request
+        # (induced by the common "test_*" naming shared with normal tests)
+        from _pytest import deprecated
+
+        self.session._setupstate.prepare(self)
+        # see FunctionMixin.setup and test_setupstate_is_preserved_134
+        self._preservedparent = self.parent.obj
+        values = []
+        seen = {}
+        for i, x in enumerate(self.obj()):
+            name, call, args = self.getcallargs(x)
+            if not callable(call):
+                raise TypeError("%r yielded non callable test %r" % (self.obj, call))
+            if name is None:
+                name = "[%d]" % i
+            else:
+                name = "['%s']" % name
+            if name in seen:
+                raise ValueError(
+                    "%r generated tests with non-unique name %r" % (self, name)
+                )
+            seen[name] = True
+            values.append(self.Function(name, self, args=args, callobj=call))
+        self.warn("C1", deprecated.YIELD_TESTS)
+        return values
+
+    def getcallargs(self, obj):
+        if not isinstance(obj, (tuple, list)):
+            obj = (obj,)
+        # explicit naming
+        if isinstance(obj[0], six.string_types):
+            name = obj[0]
+            obj = obj[1:]
+        else:
+            name = None
+        call, args = obj[0], obj[1:]
+        return name, call, args
+
+
+def hasinit(obj):
+    init = getattr(obj, "__init__", None)
+    if init:
+        return init != object.__init__
+
+
+def hasnew(obj):
+    new = getattr(obj, "__new__", None)
+    if new:
+        return new != object.__new__
+
+
+class CallSpec2(object):
+
+    def __init__(self, metafunc):
+        self.metafunc = metafunc
+        self.funcargs = {}
+        self._idlist = []
+        self.params = {}
+        self._globalid = NOTSET
+        self._globalid_args = set()
+        self._globalparam = NOTSET
+        self._arg2scopenum = {}  # used for sorting parametrized resources
+        self.marks = []
+        self.indices = {}
+
+    def copy(self, metafunc):
+        cs = CallSpec2(self.metafunc)
+        cs.funcargs.update(self.funcargs)
+        cs.params.update(self.params)
+        cs.marks.extend(self.marks)
+        cs.indices.update(self.indices)
+        cs._arg2scopenum.update(self._arg2scopenum)
+        cs._idlist = list(self._idlist)
+        cs._globalid = self._globalid
+        cs._globalid_args = self._globalid_args
+        cs._globalparam = self._globalparam
+        return cs
+
+    def _checkargnotcontained(self, arg):
+        if arg in self.params or arg in self.funcargs:
+            raise ValueError("duplicate %r" % (arg,))
+
+    def getparam(self, name):
+        try:
+            return self.params[name]
+        except KeyError:
+            if self._globalparam is NOTSET:
+                raise ValueError(name)
+            return self._globalparam
+
+    @property
+    def id(self):
+        return "-".join(map(str, filter(None, self._idlist)))
+
+    def setmulti2(self, valtypes, argnames, valset, id, marks, scopenum, param_index):
+        for arg, val in zip(argnames, valset):
+            self._checkargnotcontained(arg)
+            valtype_for_arg = valtypes[arg]
+            getattr(self, valtype_for_arg)[arg] = val
+            self.indices[arg] = param_index
+            self._arg2scopenum[arg] = scopenum
+        self._idlist.append(id)
+        self.marks.extend(marks)
+
+    def setall(self, funcargs, id, param):
+        for x in funcargs:
+            self._checkargnotcontained(x)
+        self.funcargs.update(funcargs)
+        if id is not NOTSET:
+            self._idlist.append(id)
+        if param is not NOTSET:
+            assert self._globalparam is NOTSET
+            self._globalparam = param
+        for arg in funcargs:
+            self._arg2scopenum[arg] = fixtures.scopenum_function
+
+
+class Metafunc(fixtures.FuncargnamesCompatAttr):
+    """
+    Metafunc objects are passed to the :func:`pytest_generate_tests <_pytest.hookspec.pytest_generate_tests>` hook.
+    They help to inspect a test function and to generate tests according to
+    test configuration or values specified in the class or module where a
+    test function is defined.
+    """
+
+    def __init__(self, definition, fixtureinfo, config, cls=None, module=None):
+        #: access to the :class:`_pytest.config.Config` object for the test session
+        assert (
+            isinstance(definition, FunctionDefinition)
+            or type(definition).__name__ == "DefinitionMock"
+        )
+        self.definition = definition
+        self.config = config
+
+        #: the module object where the test function is defined in.
+        self.module = module
+
+        #: underlying python test function
+        self.function = definition.obj
+
+        #: set of fixture names required by the test function
+        self.fixturenames = fixtureinfo.names_closure
+
+        #: class object where the test function is defined in or ``None``.
+        self.cls = cls
+
+        self._calls = []
+        self._ids = set()
+        self._arg2fixturedefs = fixtureinfo.name2fixturedefs
+
+    def parametrize(self, argnames, argvalues, indirect=False, ids=None, scope=None):
+        """ Add new invocations to the underlying test function using the list
+        of argvalues for the given argnames.  Parametrization is performed
+        during the collection phase.  If you need to setup expensive resources
+        see about setting indirect to do it rather at test setup time.
+
+        :arg argnames: a comma-separated string denoting one or more argument
+                       names, or a list/tuple of argument strings.
+
+        :arg argvalues: The list of argvalues determines how often a
+            test is invoked with different argument values.  If only one
+            argname was specified argvalues is a list of values.  If N
+            argnames were specified, argvalues must be a list of N-tuples,
+            where each tuple-element specifies a value for its respective
+            argname.
+
+        :arg indirect: The list of argnames or boolean. A list of arguments'
+            names (subset of argnames). If True the list contains all names from
+            the argnames. Each argvalue corresponding to an argname in this list will
+            be passed as request.param to its respective argname fixture
+            function so that it can perform more expensive setups during the
+            setup phase of a test rather than at collection time.
+
+        :arg ids: list of string ids, or a callable.
+            If strings, each is corresponding to the argvalues so that they are
+            part of the test id. If None is given as id of specific test, the
+            automatically generated id for that argument will be used.
+            If callable, it should take one argument (a single argvalue) and return
+            a string or return None. If None, the automatically generated id for that
+            argument will be used.
+            If no ids are provided they will be generated automatically from
+            the argvalues.
+
+        :arg scope: if specified it denotes the scope of the parameters.
+            The scope is used for grouping tests by parameter instances.
+            It will also override any fixture-function defined scope, allowing
+            to set a dynamic scope using test context or configuration.
+        """
+        from _pytest.fixtures import scope2index
+        from _pytest.mark import ParameterSet
+        from py.io import saferepr
+
+        argnames, parameters = ParameterSet._for_parametrize(
+            argnames, argvalues, self.function, self.config
+        )
+        del argvalues
+        default_arg_names = set(get_default_arg_names(self.function))
+
+        if scope is None:
+            scope = _find_parametrized_scope(argnames, self._arg2fixturedefs, indirect)
+
+        scopenum = scope2index(scope, descr="call to {}".format(self.parametrize))
+        valtypes = {}
+        for arg in argnames:
+            if arg not in self.fixturenames:
+                if arg in default_arg_names:
+                    raise ValueError(
+                        "%r already takes an argument %r with a default value"
+                        % (self.function, arg)
+                    )
+                else:
+                    if isinstance(indirect, (tuple, list)):
+                        name = "fixture" if arg in indirect else "argument"
+                    else:
+                        name = "fixture" if indirect else "argument"
+                    raise ValueError("%r uses no %s %r" % (self.function, name, arg))
+
+        if indirect is True:
+            valtypes = dict.fromkeys(argnames, "params")
+        elif indirect is False:
+            valtypes = dict.fromkeys(argnames, "funcargs")
+        elif isinstance(indirect, (tuple, list)):
+            valtypes = dict.fromkeys(argnames, "funcargs")
+            for arg in indirect:
+                if arg not in argnames:
+                    raise ValueError(
+                        "indirect given to %r: fixture %r doesn't exist"
+                        % (self.function, arg)
+                    )
+                valtypes[arg] = "params"
+        idfn = None
+        if callable(ids):
+            idfn = ids
+            ids = None
+        if ids:
+            if len(ids) != len(parameters):
+                raise ValueError(
+                    "%d tests specified with %d ids" % (len(parameters), len(ids))
+                )
+            for id_value in ids:
+                if id_value is not None and not isinstance(id_value, six.string_types):
+                    msg = "ids must be list of strings, found: %s (type: %s)"
+                    raise ValueError(
+                        msg % (saferepr(id_value), type(id_value).__name__)
+                    )
+        ids = idmaker(argnames, parameters, idfn, ids, self.config)
+        newcalls = []
+        for callspec in self._calls or [CallSpec2(self)]:
+            elements = zip(ids, parameters, count())
+            for a_id, param, param_index in elements:
+                if len(param.values) != len(argnames):
+                    raise ValueError(
+                        'In "parametrize" the number of values ({}) must be '
+                        "equal to the number of names ({})".format(
+                            param.values, argnames
+                        )
+                    )
+                newcallspec = callspec.copy(self)
+                newcallspec.setmulti2(
+                    valtypes,
+                    argnames,
+                    param.values,
+                    a_id,
+                    param.marks,
+                    scopenum,
+                    param_index,
+                )
+                newcalls.append(newcallspec)
+        self._calls = newcalls
+
+    def addcall(self, funcargs=None, id=NOTSET, param=NOTSET):
+        """ Add a new call to the underlying test function during the collection phase of a test run.
+
+        .. deprecated:: 3.3
+
+            Use :meth:`parametrize` instead.
+
+        Note that request.addcall() is called during the test collection phase prior and
+        independently to actual test execution.  You should only use addcall()
+        if you need to specify multiple arguments of a test function.
+
+        :arg funcargs: argument keyword dictionary used when invoking
+            the test function.
+
+        :arg id: used for reporting and identification purposes.  If you
+            don't supply an `id` an automatic unique id will be generated.
+
+        :arg param: a parameter which will be exposed to a later fixture function
+            invocation through the ``request.param`` attribute.
+        """
+        if self.config:
+            self.config.warn(
+                "C1", message=deprecated.METAFUNC_ADD_CALL, fslocation=None
+            )
+        assert funcargs is None or isinstance(funcargs, dict)
+        if funcargs is not None:
+            for name in funcargs:
+                if name not in self.fixturenames:
+                    fail("funcarg %r not used in this function." % name)
+        else:
+            funcargs = {}
+        if id is None:
+            raise ValueError("id=None not allowed")
+        if id is NOTSET:
+            id = len(self._calls)
+        id = str(id)
+        if id in self._ids:
+            raise ValueError("duplicate id %r" % id)
+        self._ids.add(id)
+
+        cs = CallSpec2(self)
+        cs.setall(funcargs, id, param)
+        self._calls.append(cs)
+
+
+def _find_parametrized_scope(argnames, arg2fixturedefs, indirect):
+    """Find the most appropriate scope for a parametrized call based on its arguments.
+
+    When there's at least one direct argument, always use "function" scope.
+
+    When a test function is parametrized and all its arguments are indirect
+    (e.g. fixtures), return the most narrow scope based on the fixtures used.
+
+    Related to issue #1832, based on code posted by @Kingdread.
+    """
+    from _pytest.fixtures import scopes
+
+    indirect_as_list = isinstance(indirect, (list, tuple))
+    all_arguments_are_fixtures = indirect is True or indirect_as_list and len(
+        indirect
+    ) == argnames
+    if all_arguments_are_fixtures:
+        fixturedefs = arg2fixturedefs or {}
+        used_scopes = [fixturedef[0].scope for name, fixturedef in fixturedefs.items()]
+        if used_scopes:
+            # Takes the most narrow scope from used fixtures
+            for scope in reversed(scopes):
+                if scope in used_scopes:
+                    return scope
+
+    return "function"
+
+
+def _idval(val, argname, idx, idfn, config=None):
+    if idfn:
+        s = None
+        try:
+            s = idfn(val)
+        except Exception:
+            # See issue https://github.com/pytest-dev/pytest/issues/2169
+            import warnings
+
+            msg = "Raised while trying to determine id of parameter %s at position %d." % (
+                argname, idx
+            )
+            msg += "\nUpdate your code as this will raise an error in pytest-4.0."
+            warnings.warn(msg, DeprecationWarning)
+        if s:
+            return ascii_escaped(s)
+
+    if config:
+        hook_id = config.hook.pytest_make_parametrize_id(
+            config=config, val=val, argname=argname
+        )
+        if hook_id:
+            return hook_id
+
+    if isinstance(val, STRING_TYPES):
+        return ascii_escaped(val)
+    elif isinstance(val, (float, int, bool, NoneType)):
+        return str(val)
+    elif isinstance(val, REGEX_TYPE):
+        return ascii_escaped(val.pattern)
+    elif enum is not None and isinstance(val, enum.Enum):
+        return str(val)
+    elif (isclass(val) or isfunction(val)) and hasattr(val, "__name__"):
+        return val.__name__
+    return str(argname) + str(idx)
+
+
+def _idvalset(idx, parameterset, argnames, idfn, ids, config=None):
+    if parameterset.id is not None:
+        return parameterset.id
+    if ids is None or (idx >= len(ids) or ids[idx] is None):
+        this_id = [
+            _idval(val, argname, idx, idfn, config)
+            for val, argname in zip(parameterset.values, argnames)
+        ]
+        return "-".join(this_id)
+    else:
+        return ascii_escaped(ids[idx])
+
+
+def idmaker(argnames, parametersets, idfn=None, ids=None, config=None):
+    ids = [
+        _idvalset(valindex, parameterset, argnames, idfn, ids, config)
+        for valindex, parameterset in enumerate(parametersets)
+    ]
+    if len(set(ids)) != len(ids):
+        # The ids are not unique
+        duplicates = [testid for testid in ids if ids.count(testid) > 1]
+        counters = collections.defaultdict(lambda: 0)
+        for index, testid in enumerate(ids):
+            if testid in duplicates:
+                ids[index] = testid + str(counters[testid])
+                counters[testid] += 1
+    return ids
+
+
+def show_fixtures_per_test(config):
+    from _pytest.main import wrap_session
+
+    return wrap_session(config, _show_fixtures_per_test)
+
+
+def _show_fixtures_per_test(config, session):
+    import _pytest.config
+
+    session.perform_collect()
+    curdir = py.path.local()
+    tw = _pytest.config.create_terminal_writer(config)
+    verbose = config.getvalue("verbose")
+
+    def get_best_relpath(func):
+        loc = getlocation(func, curdir)
+        return curdir.bestrelpath(loc)
+
+    def write_fixture(fixture_def):
+        argname = fixture_def.argname
+        if verbose <= 0 and argname.startswith("_"):
+            return
+        if verbose > 0:
+            bestrel = get_best_relpath(fixture_def.func)
+            funcargspec = "{} -- {}".format(argname, bestrel)
+        else:
+            funcargspec = argname
+        tw.line(funcargspec, green=True)
+        fixture_doc = fixture_def.func.__doc__
+        if fixture_doc:
+            write_docstring(tw, fixture_doc)
+        else:
+            tw.line("    no docstring available", red=True)
+
+    def write_item(item):
+        try:
+            info = item._fixtureinfo
+        except AttributeError:
+            # doctests items have no _fixtureinfo attribute
+            return
+        if not info.name2fixturedefs:
+            # this test item does not use any fixtures
+            return
+        tw.line()
+        tw.sep("-", "fixtures used by {}".format(item.name))
+        tw.sep("-", "({})".format(get_best_relpath(item.function)))
+        # dict key not used in loop but needed for sorting
+        for _, fixturedefs in sorted(info.name2fixturedefs.items()):
+            assert fixturedefs is not None
+            if not fixturedefs:
+                continue
+            # last item is expected to be the one used by the test item
+            write_fixture(fixturedefs[-1])
+
+    for session_item in session.items:
+        write_item(session_item)
+
+
+def showfixtures(config):
+    from _pytest.main import wrap_session
+
+    return wrap_session(config, _showfixtures_main)
+
+
+def _showfixtures_main(config, session):
+    import _pytest.config
+
+    session.perform_collect()
+    curdir = py.path.local()
+    tw = _pytest.config.create_terminal_writer(config)
+    verbose = config.getvalue("verbose")
+
+    fm = session._fixturemanager
+
+    available = []
+    seen = set()
+
+    for argname, fixturedefs in fm._arg2fixturedefs.items():
+        assert fixturedefs is not None
+        if not fixturedefs:
+            continue
+        for fixturedef in fixturedefs:
+            loc = getlocation(fixturedef.func, curdir)
+            if (fixturedef.argname, loc) in seen:
+                continue
+            seen.add((fixturedef.argname, loc))
+            available.append(
+                (
+                    len(fixturedef.baseid),
+                    fixturedef.func.__module__,
+                    curdir.bestrelpath(loc),
+                    fixturedef.argname,
+                    fixturedef,
+                )
+            )
+
+    available.sort()
+    currentmodule = None
+    for baseid, module, bestrel, argname, fixturedef in available:
+        if currentmodule != module:
+            if not module.startswith("_pytest."):
+                tw.line()
+                tw.sep("-", "fixtures defined from %s" % (module,))
+                currentmodule = module
+        if verbose <= 0 and argname[0] == "_":
+            continue
+        if verbose > 0:
+            funcargspec = "%s -- %s" % (argname, bestrel)
+        else:
+            funcargspec = argname
+        tw.line(funcargspec, green=True)
+        loc = getlocation(fixturedef.func, curdir)
+        doc = fixturedef.func.__doc__ or ""
+        if doc:
+            write_docstring(tw, doc)
+        else:
+            tw.line("    %s: no docstring available" % (loc,), red=True)
+
+
+def write_docstring(tw, doc):
+    INDENT = "    "
+    doc = doc.rstrip()
+    if "\n" in doc:
+        firstline, rest = doc.split("\n", 1)
+    else:
+        firstline, rest = doc, ""
+
+    if firstline.strip():
+        tw.line(INDENT + firstline.strip())
+
+    if rest:
+        for line in dedent(rest).split("\n"):
+            tw.write(INDENT + line + "\n")
+
+
+class Function(FunctionMixin, nodes.Item, fixtures.FuncargnamesCompatAttr):
+    """ a Function Item is responsible for setting up and executing a
+    Python test function.
+    """
+    _genid = None
+    # disable since functions handle it themselfes
+    _ALLOW_MARKERS = False
+
+    def __init__(
+        self,
+        name,
+        parent,
+        args=None,
+        config=None,
+        callspec=None,
+        callobj=NOTSET,
+        keywords=None,
+        session=None,
+        fixtureinfo=None,
+        originalname=None,
+    ):
+        super(Function, self).__init__(name, parent, config=config, session=session)
+        self._args = args
+        if callobj is not NOTSET:
+            self.obj = callobj
+
+        self.keywords.update(self.obj.__dict__)
+        self.own_markers.extend(get_unpacked_marks(self.obj))
+        if callspec:
+            self.callspec = callspec
+            # this is total hostile and a mess
+            # keywords are broken by design by now
+            # this will be redeemed later
+            for mark in callspec.marks:
+                # feel free to cry, this was broken for years before
+                # and keywords cant fix it per design
+                self.keywords[mark.name] = mark
+            self.own_markers.extend(callspec.marks)
+        if keywords:
+            self.keywords.update(keywords)
+
+        if fixtureinfo is None:
+            fixtureinfo = self.session._fixturemanager.getfixtureinfo(
+                self, self.obj, self.cls, funcargs=not self._isyieldedfunction()
+            )
+        self._fixtureinfo = fixtureinfo
+        self.fixturenames = fixtureinfo.names_closure
+        self._initrequest()
+
+        #: original function name, without any decorations (for example
+        #: parametrization adds a ``"[...]"`` suffix to function names).
+        #:
+        #: .. versionadded:: 3.0
+        self.originalname = originalname
+
+    def _initrequest(self):
+        self.funcargs = {}
+        if self._isyieldedfunction():
+            assert not hasattr(
+                self, "callspec"
+            ), "yielded functions (deprecated) cannot have funcargs"
+        else:
+            if hasattr(self, "callspec"):
+                callspec = self.callspec
+                assert not callspec.funcargs
+                self._genid = callspec.id
+                if hasattr(callspec, "param"):
+                    self.param = callspec.param
+        self._request = fixtures.FixtureRequest(self)
+
+    @property
+    def function(self):
+        "underlying python 'function' object"
+        return getattr(self.obj, "im_func", self.obj)
+
+    def _getobj(self):
+        name = self.name
+        i = name.find("[")  # parametrization
+        if i != -1:
+            name = name[:i]
+        return getattr(self.parent.obj, name)
+
+    @property
+    def _pyfuncitem(self):
+        "(compatonly) for code expecting pytest-2.2 style request objects"
+        return self
+
+    def _isyieldedfunction(self):
+        return getattr(self, "_args", None) is not None
+
+    def runtest(self):
+        """ execute the underlying test function. """
+        self.ihook.pytest_pyfunc_call(pyfuncitem=self)
+
+    def setup(self):
+        super(Function, self).setup()
+        fixtures.fillfixtures(self)
+
+
+class FunctionDefinition(Function):
+    """
+    internal hack until we get actual definition nodes instead of the
+    crappy metafunc hack
+    """
+
+    def runtest(self):
+        raise RuntimeError("function definitions are not supposed to be used")
+
+    setup = runtest
new file mode 100644
--- /dev/null
+++ b/third_party/python/pytest/src/_pytest/python_api.py
@@ -0,0 +1,674 @@
+import math
+import sys
+
+import py
+from six.moves import zip, filterfalse
+from more_itertools.more import always_iterable
+
+from _pytest.compat import isclass
+
+from _pytest.compat import Mapping, Sequence
+from _pytest.compat import STRING_TYPES
+
+from _pytest.outcomes import fail
+import _pytest._code
+
+BASE_TYPE = (type, STRING_TYPES)
+
+
+def _cmp_raises_type_error(self, other):
+    """__cmp__ implementation which raises TypeError. Used
+    by Approx base classes to implement only == and != and raise a
+    TypeError for other comparisons.
+
+    Needed in Python 2 only, Python 3 all it takes is not implementing the
+    other operators at all.
+    """
+    __tracebackhide__ = True
+    raise TypeError(
+        "Comparison operators other than == and != not supported by approx objects"
+    )
+
+
+# builtin pytest.approx helper
+
+
+class ApproxBase(object):
+    """
+    Provide shared utilities for making approximate comparisons between numbers
+    or sequences of numbers.
+    """
+
+    # Tell numpy to use our `__eq__` operator instead of its
+    __array_ufunc__ = None
+    __array_priority__ = 100
+
+    def __init__(self, expected, rel=None, abs=None, nan_ok=False):
+        self.expected = expected
+        self.abs = abs
+        self.rel = rel
+        self.nan_ok = nan_ok
+
+    def __repr__(self):
+        raise NotImplementedError
+
+    def __eq__(self, actual):
+        return all(
+            a == self._approx_scalar(x) for a, x in self._yield_comparisons(actual)
+        )
+
+    __hash__ = None
+
+    def __ne__(self, actual):
+        return not (actual == self)
+
+    if sys.version_info[0] == 2:
+        __cmp__ = _cmp_raises_type_error
+
+    def _approx_scalar(self, x):
+        return ApproxScalar(x, rel=self.rel, abs=self.abs, nan_ok=self.nan_ok)
+
+    def _yield_comparisons(self, actual):
+        """
+        Yield all the pairs of numbers to be compared.  This is used to
+        implement the `__eq__` method.
+        """
+        raise NotImplementedError
+
+
+class ApproxNumpy(ApproxBase):
+    """
+    Perform approximate comparisons for numpy arrays.
+    """
+
+    def __repr__(self):
+        # It might be nice to rewrite this function to account for the
+        # shape of the array...
+        import numpy as np
+
+        return "approx({!r})".format(
+            list(self._approx_scalar(x) for x in np.asarray(self.expected))
+        )
+
+    if sys.version_info[0] == 2:
+        __cmp__ = _cmp_raises_type_error
+
+    def __eq__(self, actual):
+        import numpy as np
+
+        # self.expected is supposed to always be an array here
+
+        if not np.isscalar(actual):
+            try:
+                actual = np.asarray(actual)
+            except:  # noqa
+                raise TypeError("cannot compare '{}' to numpy.ndarray".format(actual))
+
+        if not np.isscalar(actual) and actual.shape != self.expected.shape:
+            return False
+
+        return ApproxBase.__eq__(self, actual)
+
+    def _yield_comparisons(self, actual):
+        import numpy as np
+
+        # `actual` can either be a numpy array or a scalar, it is treated in
+        # `__eq__` before being passed to `ApproxBase.__eq__`, which is the
+        # only method that calls this one.
+
+        if np.isscalar(actual):
+            for i in np.ndindex(self.expected.shape):
+                yield actual, np.asscalar(self.expected[i])
+        else:
+            for i in np.ndindex(self.expected.shape):
+                yield np.asscalar(actual[i]), np.asscalar(self.expected[i])
+
+
+class ApproxMapping(ApproxBase):
+    """
+    Perform approximate comparisons for mappings where the values are numbers
+    (the keys can be anything).
+    """
+
+    def __repr__(self):
+        return "approx({!r})".format(
+            {k: self._approx_scalar(v) for k, v in self.expected.items()}
+        )
+
+    def __eq__(self, actual):
+        if set(actual.keys()) != set(self.expected.keys()):
+            return False
+
+        return ApproxBase.__eq__(self, actual)
+
+    def _yield_comparisons(self, actual):
+        for k in self.expected.keys():
+            yield actual[k], self.expected[k]
+
+
+class ApproxSequence(ApproxBase):
+    """
+    Perform approximate comparisons for sequences of numbers.
+    """
+
+    def __repr__(self):
+        seq_type = type(self.expected)
+        if seq_type not in (tuple, list, set):
+            seq_type = list
+        return "approx({!r})".format(
+            seq_type(self._approx_scalar(x) for x in self.expected)
+        )
+
+    def __eq__(self, actual):
+        if len(actual) != len(self.expected):
+            return False
+        return ApproxBase.__eq__(self, actual)
+
+    def _yield_comparisons(self, actual):
+        return zip(actual, self.expected)
+
+
+class ApproxScalar(ApproxBase):
+    """
+    Perform approximate comparisons for single numbers only.
+    """
+    DEFAULT_ABSOLUTE_TOLERANCE = 1e-12
+    DEFAULT_RELATIVE_TOLERANCE = 1e-6
+
+    def __repr__(self):
+        """
+        Return a string communicating both the expected value and the tolerance
+        for the comparison being made, e.g. '1.0 +- 1e-6'.  Use the unicode
+        plus/minus symbol if this is python3 (it's too hard to get right for
+        python2).
+        """
+        if isinstance(self.expected, complex):
+            return str(self.expected)
+
+        # Infinities aren't compared using tolerances, so don't show a
+        # tolerance.
+        if math.isinf(self.expected):
+            return str(self.expected)
+
+        # If a sensible tolerance can't be calculated, self.tolerance will
+        # raise a ValueError.  In this case, display '???'.
+        try:
+            vetted_tolerance = "{:.1e}".format(self.tolerance)
+        except ValueError:
+            vetted_tolerance = "???"
+
+        if sys.version_info[0] == 2:
+            return "{} +- {}".format(self.expected, vetted_tolerance)
+        else:
+            return u"{} \u00b1 {}".format(self.expected, vetted_tolerance)
+
+    def __eq__(self, actual):
+        """
+        Return true if the given value is equal to the expected value within
+        the pre-specified tolerance.
+        """
+        if _is_numpy_array(actual):
+            return ApproxNumpy(actual, self.abs, self.rel, self.nan_ok) == self.expected
+
+        # Short-circuit exact equality.
+        if actual == self.expected:
+            return True
+
+        # Allow the user to control whether NaNs are considered equal to each
+        # other or not.  The abs() calls are for compatibility with complex
+        # numbers.
+        if math.isnan(abs(self.expected)):
+            return self.nan_ok and math.isnan(abs(actual))
+
+        # Infinity shouldn't be approximately equal to anything but itself, but
+        # if there's a relative tolerance, it will be infinite and infinity
+        # will seem approximately equal to everything.  The equal-to-itself
+        # case would have been short circuited above, so here we can just
+        # return false if the expected value is infinite.  The abs() call is
+        # for compatibility with complex numbers.
+        if math.isinf(abs(self.expected)):
+            return False
+
+        # Return true if the two numbers are within the tolerance.
+        return abs(self.expected - actual) <= self.tolerance
+
+    __hash__ = None
+
+    @property
+    def tolerance(self):
+        """
+        Return the tolerance for the comparison.  This could be either an
+        absolute tolerance or a relative tolerance, depending on what the user
+        specified or which would be larger.
+        """
+
+        def set_default(x, default):
+            return x if x is not None else default
+
+        # Figure out what the absolute tolerance should be.  ``self.abs`` is
+        # either None or a value specified by the user.
+        absolute_tolerance = set_default(self.abs, self.DEFAULT_ABSOLUTE_TOLERANCE)
+
+        if absolute_tolerance < 0:
+            raise ValueError(
+                "absolute tolerance can't be negative: {}".format(absolute_tolerance)
+            )
+        if math.isnan(absolute_tolerance):
+            raise ValueError("absolute tolerance can't be NaN.")
+
+        # If the user specified an absolute tolerance but not a relative one,
+        # just return the absolute tolerance.
+        if self.rel is None:
+            if self.abs is not None:
+                return absolute_tolerance
+
+        # Figure out what the relative tolerance should be.  ``self.rel`` is
+        # either None or a value specified by the user.  This is done after
+        # we've made sure the user didn't ask for an absolute tolerance only,
+        # because we don't want to raise errors about the relative tolerance if
+        # we aren't even going to use it.
+        relative_tolerance = set_default(
+            self.rel, self.DEFAULT_RELATIVE_TOLERANCE
+        ) * abs(
+            self.expected
+        )
+
+        if relative_tolerance < 0:
+            raise ValueError(
+                "relative tolerance can't be negative: {}".format(absolute_tolerance)
+            )
+        if math.isnan(relative_tolerance):
+            raise ValueError("relative tolerance can't be NaN.")
+
+        # Return the larger of the relative and absolute tolerances.
+        return max(relative_tolerance, absolute_tolerance)
+
+
+class ApproxDecimal(ApproxScalar):
+    from decimal import Decimal
+
+    DEFAULT_ABSOLUTE_TOLERANCE = Decimal("1e-12")
+    DEFAULT_RELATIVE_TOLERANCE = Decimal("1e-6")
+
+
+def approx(expected, rel=None, abs=None, nan_ok=False):
+    """
+    Assert that two numbers (or two sets of numbers) are equal to each other
+    within some tolerance.
+
+    Due to the `intricacies of floating-point arithmetic`__, numbers that we
+    would intuitively expect to be equal are not always so::
+
+        >>> 0.1 + 0.2 == 0.3
+        False
+
+    __ https://docs.python.org/3/tutorial/floatingpoint.html
+
+    This problem is commonly encountered when writing tests, e.g. when making
+    sure that floating-point values are what you expect them to be.  One way to
+    deal with this problem is to assert that two floating-point numbers are
+    equal to within some appropriate tolerance::
+
+        >>> abs((0.1 + 0.2) - 0.3) < 1e-6
+        True
+
+    However, comparisons like this are tedious to write and difficult to
+    understand.  Furthermore, absolute comparisons like the one above are
+    usually discouraged because there's no tolerance that works well for all
+    situations.  ``1e-6`` is good for numbers around ``1``, but too small for
+    very big numbers and too big for very small ones.  It's better to express
+    the tolerance as a fraction of the expected value, but relative comparisons
+    like that are even more difficult to write correctly and concisely.
+
+    The ``approx`` class performs floating-point comparisons using a syntax
+    that's as intuitive as possible::
+
+        >>> from pytest import approx
+        >>> 0.1 + 0.2 == approx(0.3)
+        True
+
+    The same syntax also works for sequences of numbers::
+
+        >>> (0.1 + 0.2, 0.2 + 0.4) == approx((0.3, 0.6))
+        True
+
+    Dictionary *values*::
+
+        >>> {'a': 0.1 + 0.2, 'b': 0.2 + 0.4} == approx({'a': 0.3, 'b': 0.6})
+        True
+
+    ``numpy`` arrays::
+
+        >>> import numpy as np                                                          # doctest: +SKIP
+        >>> np.array([0.1, 0.2]) + np.array([0.2, 0.4]) == approx(np.array([0.3, 0.6])) # doctest: +SKIP
+        True
+
+    And for a ``numpy`` array against a scalar::
+
+        >>> import numpy as np                                         # doctest: +SKIP
+        >>> np.array([0.1, 0.2]) + np.array([0.2, 0.1]) == approx(0.3) # doctest: +SKIP
+        True
+
+    By default, ``approx`` considers numbers within a relative tolerance of
+    ``1e-6`` (i.e. one part in a million) of its expected value to be equal.
+    This treatment would lead to surprising results if the expected value was
+    ``0.0``, because nothing but ``0.0`` itself is relatively close to ``0.0``.
+    To handle this case less surprisingly, ``approx`` also considers numbers
+    within an absolute tolerance of ``1e-12`` of its expected value to be
+    equal.  Infinity and NaN are special cases.  Infinity is only considered
+    equal to itself, regardless of the relative tolerance.  NaN is not
+    considered equal to anything by default, but you can make it be equal to
+    itself by setting the ``nan_ok`` argument to True.  (This is meant to
+    facilitate comparing arrays that use NaN to mean "no data".)
+
+    Both the relative and absolute tolerances can be changed by passing
+    arguments to the ``approx`` constructor::
+
+        >>> 1.0001 == approx(1)
+        False
+        >>> 1.0001 == approx(1, rel=1e-3)
+        True
+        >>> 1.0001 == approx(1, abs=1e-3)
+        True
+
+    If you specify ``abs`` but not ``rel``, the comparison will not consider
+    the relative tolerance at all.  In other words, two numbers that are within
+    the default relative tolerance of ``1e-6`` will still be considered unequal
+    if they exceed the specified absolute tolerance.  If you specify both
+    ``abs`` and ``rel``, the numbers will be considered equal if either
+    tolerance is met::
+
+        >>> 1 + 1e-8 == approx(1)
+        True
+        >>> 1 + 1e-8 == approx(1, abs=1e-12)
+        False
+        >>> 1 + 1e-8 == approx(1, rel=1e-6, abs=1e-12)
+        True
+
+    If you're thinking about using ``approx``, then you might want to know how
+    it compares to other good ways of comparing floating-point numbers.  All of
+    these algorithms are based on relative and absolute tolerances and should
+    agree for the most part, but they do have meaningful differences:
+
+    - ``math.isclose(a, b, rel_tol=1e-9, abs_tol=0.0)``:  True if the relative
+      tolerance is met w.r.t. either ``a`` or ``b`` or if the absolute
+      tolerance is met.  Because the relative tolerance is calculated w.r.t.
+      both ``a`` and ``b``, this test is symmetric (i.e.  neither ``a`` nor
+      ``b`` is a "reference value").  You have to specify an absolute tolerance
+      if you want to compare to ``0.0`` because there is no tolerance by
+      default.  Only available in python>=3.5.  `More information...`__
+
+      __ https://docs.python.org/3/library/math.html#math.isclose
+
+    - ``numpy.isclose(a, b, rtol=1e-5, atol=1e-8)``: True if the difference
+      between ``a`` and ``b`` is less that the sum of the relative tolerance
+      w.r.t. ``b`` and the absolute tolerance.  Because the relative tolerance
+      is only calculated w.r.t. ``b``, this test is asymmetric and you can
+      think of ``b`` as the reference value.  Support for comparing sequences
+      is provided by ``numpy.allclose``.  `More information...`__
+
+      __ http://docs.scipy.org/doc/numpy-1.10.0/reference/generated/numpy.isclose.html
+
+    - ``unittest.TestCase.assertAlmostEqual(a, b)``: True if ``a`` and ``b``
+      are within an absolute tolerance of ``1e-7``.  No relative tolerance is
+      considered and the absolute tolerance cannot be changed, so this function
+      is not appropriate for very large or very small numbers.  Also, it's only
+      available in subclasses of ``unittest.TestCase`` and it's ugly because it
+      doesn't follow PEP8.  `More information...`__
+
+      __ https://docs.python.org/3/library/unittest.html#unittest.TestCase.assertAlmostEqual
+
+    - ``a == pytest.approx(b, rel=1e-6, abs=1e-12)``: True if the relative
+      tolerance is met w.r.t. ``b`` or if the absolute tolerance is met.
+      Because the relative tolerance is only calculated w.r.t. ``b``, this test
+      is asymmetric and you can think of ``b`` as the reference value.  In the
+      special case that you explicitly specify an absolute tolerance but not a
+      relative tolerance, only the absolute tolerance is considered.
+
+    .. warning::
+
+       .. versionchanged:: 3.2
+
+       In order to avoid inconsistent behavior, ``TypeError`` is
+       raised for ``>``, ``>=``, ``<`` and ``<=`` comparisons.
+       The example below illustrates the problem::
+
+           assert approx(0.1) > 0.1 + 1e-10  # calls approx(0.1).__gt__(0.1 + 1e-10)
+           assert 0.1 + 1e-10 > approx(0.1)  # calls approx(0.1).__lt__(0.1 + 1e-10)
+
+       In the second example one expects ``approx(0.1).__le__(0.1 + 1e-10)``
+       to be called. But instead, ``approx(0.1).__lt__(0.1 + 1e-10)`` is used to
+       comparison. This is because the call hierarchy of rich comparisons
+       follows a fixed behavior. `More information...`__
+
+       __ https://docs.python.org/3/reference/datamodel.html#object.__ge__
+    """
+
+    from decimal import Decimal
+
+    # Delegate the comparison to a class that knows how to deal with the type
+    # of the expected value (e.g. int, float, list, dict, numpy.array, etc).
+    #
+    # This architecture is really driven by the need to support numpy arrays.
+    # The only way to override `==` for arrays without requiring that approx be
+    # the left operand is to inherit the approx object from `numpy.ndarray`.
+    # But that can't be a general solution, because it requires (1) numpy to be
+    # installed and (2) the expected value to be a numpy array.  So the general
+    # solution is to delegate each type of expected value to a different class.
+    #
+    # This has the advantage that it made it easy to support mapping types
+    # (i.e. dict).  The old code accepted mapping types, but would only compare
+    # their keys, which is probably not what most people would expect.
+
+    if _is_numpy_array(expected):
+        cls = ApproxNumpy
+    elif isinstance(expected, Mapping):
+        cls = ApproxMapping
+    elif isinstance(expected, Sequence) and not isinstance(expected, STRING_TYPES):
+        cls = ApproxSequence
+    elif isinstance(expected, Decimal):
+        cls = ApproxDecimal
+    else:
+        cls = ApproxScalar
+
+    return cls(expected, rel, abs, nan_ok)
+
+
+def _is_numpy_array(obj):
+    """
+    Return true if the given object is a numpy array.  Make a special effort to
+    avoid importing numpy unless it's really necessary.
+    """
+    import inspect
+
+    for cls in inspect.getmro(type(obj)):
+        if cls.__module__ == "numpy":
+            try:
+                import numpy as np
+
+                return isinstance(obj, np.ndarray)
+            except ImportError:
+                pass
+
+    return False
+
+
+# builtin pytest.raises helper
+
+
+def raises(expected_exception, *args, **kwargs):
+    r"""
+    Assert that a code block/function call raises ``expected_exception``
+    and raise a failure exception otherwise.
+
+    :arg message: if specified, provides a custom failure message if the
+        exception is not raised
+    :arg match: if specified, asserts that the exception matches a text or regex
+
+    This helper produces a ``ExceptionInfo()`` object (see below).
+
+    You may use this function as a context manager::
+
+        >>> with raises(ZeroDivisionError):
+        ...    1/0
+
+    .. versionchanged:: 2.10
+
+    In the context manager form you may use the keyword argument
+    ``message`` to specify a custom failure message::
+
+        >>> with raises(ZeroDivisionError, message="Expecting ZeroDivisionError"):
+        ...    pass
+        Traceback (most recent call last):
+          ...
+        Failed: Expecting ZeroDivisionError
+
+    .. note::
+
+       When using ``pytest.raises`` as a context manager, it's worthwhile to
+       note that normal context manager rules apply and that the exception
+       raised *must* be the final line in the scope of the context manager.
+       Lines of code after that, within the scope of the context manager will
+       not be executed. For example::
+
+           >>> value = 15
+           >>> with raises(ValueError) as exc_info:
+           ...     if value > 10:
+           ...         raise ValueError("value must be <= 10")
+           ...     assert exc_info.type == ValueError  # this will not execute
+
+       Instead, the following approach must be taken (note the difference in
+       scope)::
+
+           >>> with raises(ValueError) as exc_info:
+           ...     if value > 10:
+           ...         raise ValueError("value must be <= 10")
+           ...
+           >>> assert exc_info.type == ValueError
+
+
+    Since version ``3.1`` you can use the keyword argument ``match`` to assert that the
+    exception matches a text or regex::
+
+        >>> with raises(ValueError, match='must be 0 or None'):
+        ...     raise ValueError("value must be 0 or None")
+
+        >>> with raises(ValueError, match=r'must be \d+$'):
+        ...     raise ValueError("value must be 42")
+
+    **Legacy forms**
+
+    The forms below are fully supported but are discouraged for new code because the
+    context manager form is regarded as more readable and less error-prone.
+
+    It is possible to specify a callable by passing a to-be-called lambda::
+
+        >>> raises(ZeroDivisionError, lambda: 1/0)
+        <ExceptionInfo ...>
+
+    or you can specify an arbitrary callable with arguments::
+
+        >>> def f(x): return 1/x
+        ...
+        >>> raises(ZeroDivisionError, f, 0)
+        <ExceptionInfo ...>
+        >>> raises(ZeroDivisionError, f, x=0)
+        <ExceptionInfo ...>
+
+    It is also possible to pass a string to be evaluated at runtime::
+
+        >>> raises(ZeroDivisionError, "f(0)")
+        <ExceptionInfo ...>
+
+    The string will be evaluated using the same ``locals()`` and ``globals()``
+    at the moment of the ``raises`` call.
+
+    .. currentmodule:: _pytest._code
+
+    Consult the API of ``excinfo`` objects: :class:`ExceptionInfo`.
+
+    .. note::
+        Similar to caught exception objects in Python, explicitly clearing
+        local references to returned ``ExceptionInfo`` objects can
+        help the Python interpreter speed up its garbage collection.
+
+        Clearing those references breaks a reference cycle
+        (``ExceptionInfo`` --> caught exception --> frame stack raising
+        the exception --> current frame stack --> local variables -->
+        ``ExceptionInfo``) which makes Python keep all objects referenced
+        from that cycle (including all local variables in the current
+        frame) alive until the next cyclic garbage collection run. See the
+        official Python ``try`` statement documentation for more detailed
+        information.
+
+    """
+    __tracebackhide__ = True
+    for exc in filterfalse(isclass, always_iterable(expected_exception, BASE_TYPE)):
+        msg = (
+            "exceptions must be old-style classes or"
+            " derived from BaseException, not %s"
+        )
+        raise TypeError(msg % type(exc))
+
+    message = "DID NOT RAISE {}".format(expected_exception)
+    match_expr = None
+
+    if not args:
+        if "message" in kwargs:
+            message = kwargs.pop("message")
+        if "match" in kwargs:
+            match_expr = kwargs.pop("match")
+        if kwargs:
+            msg = "Unexpected keyword arguments passed to pytest.raises: "
+            msg += ", ".join(kwargs.keys())
+            raise TypeError(msg)
+        return RaisesContext(expected_exception, message, match_expr)
+    elif isinstance(args[0], str):
+        code, = args
+        assert isinstance(code, str)
+        frame = sys._getframe(1)
+        loc = frame.f_locals.copy()
+        loc.update(kwargs)
+        # print "raises frame scope: %r" % frame.f_locals
+        try:
+            code = _pytest._code.Source(code).compile()
+            py.builtin.exec_(code, frame.f_globals, loc)
+            # XXX didn'T mean f_globals == f_locals something special?
+            #     this is destroyed here ...
+        except expected_exception:
+            return _pytest._code.ExceptionInfo()
+    else:
+        func = args[0]
+        try:
+            func(*args[1:], **kwargs)
+        except expected_exception:
+            return _pytest._code.ExceptionInfo()
+    fail(message)
+
+
+raises.Exception = fail.Exception
+
+
+class RaisesContext(object):
+
+    def __init__(self, expected_exception, message, match_expr):
+        self.expected_exception = expected_exception
+        self.message = message
+        self.match_expr = match_expr
+        self.excinfo = None
+
+    def __enter__(self):
+        self.excinfo = object.__new__(_pytest._code.ExceptionInfo)
+        return self.excinfo
+
+    def __exit__(self, *tp):
+        __tracebackhide__ = True
+        if tp[0] is None:
+            fail(self.message)
+        self.excinfo.__init__(tp)
+        suppress_exception = issubclass(self.excinfo.type, self.expected_exception)
+        if sys.version_info[0] == 2 and suppress_exception:
+            sys.exc_clear()
+        if self.match_expr and suppress_exception:
+            self.excinfo.match(self.match_expr)
+        return suppress_exception
new file mode 100644
--- /dev/null
+++ b/third_party/python/pytest/src/_pytest/recwarn.py
@@ -0,0 +1,243 @@
+""" recording warnings during test function execution. """
+from __future__ import absolute_import, division, print_function
+
+import inspect
+
+import _pytest._code
+import py
+import sys
+import warnings
+
+import re
+
+from _pytest.fixtures import yield_fixture
+from _pytest.outcomes import fail
+
+
+@yield_fixture
+def recwarn():
+    """Return a :class:`WarningsRecorder` instance that records all warnings emitted by test functions.
+
+    See http://docs.python.org/library/warnings.html for information
+    on warning categories.
+    """
+    wrec = WarningsRecorder()
+    with wrec:
+        warnings.simplefilter("default")
+        yield wrec
+
+
+def deprecated_call(func=None, *args, **kwargs):
+    """context manager that can be used to ensure a block of code triggers a
+    ``DeprecationWarning`` or ``PendingDeprecationWarning``::
+
+        >>> import warnings
+        >>> def api_call_v2():
+        ...     warnings.warn('use v3 of this api', DeprecationWarning)
+        ...     return 200
+
+        >>> with deprecated_call():
+        ...    assert api_call_v2() == 200
+
+    ``deprecated_call`` can also be used by passing a function and ``*args`` and ``*kwargs``,
+    in which case it will ensure calling ``func(*args, **kwargs)`` produces one of the warnings
+    types above.
+    """
+    if not func:
+        return _DeprecatedCallContext()
+    else:
+        __tracebackhide__ = True
+        with _DeprecatedCallContext():
+            return func(*args, **kwargs)
+
+
+class _DeprecatedCallContext(object):
+    """Implements the logic to capture deprecation warnings as a context manager."""
+
+    def __enter__(self):
+        self._captured_categories = []
+        self._old_warn = warnings.warn
+        self._old_warn_explicit = warnings.warn_explicit
+        warnings.warn_explicit = self._warn_explicit
+        warnings.warn = self._warn
+
+    def _warn_explicit(self, message, category, *args, **kwargs):
+        self._captured_categories.append(category)
+
+    def _warn(self, message, category=None, *args, **kwargs):
+        if isinstance(message, Warning):
+            self._captured_categories.append(message.__class__)
+        else:
+            self._captured_categories.append(category)
+
+    def __exit__(self, exc_type, exc_val, exc_tb):
+        warnings.warn_explicit = self._old_warn_explicit
+        warnings.warn = self._old_warn
+
+        if exc_type is None:
+            deprecation_categories = (DeprecationWarning, PendingDeprecationWarning)
+            if not any(
+                issubclass(c, deprecation_categories) for c in self._captured_categories
+            ):
+                __tracebackhide__ = True
+                msg = "Did not produce DeprecationWarning or PendingDeprecationWarning"
+                raise AssertionError(msg)
+
+
+def warns(expected_warning, *args, **kwargs):
+    r"""Assert that code raises a particular class of warning.
+
+    Specifically, the parameter ``expected_warning`` can be a warning class or
+    sequence of warning classes, and the inside the ``with`` block must issue a warning of that class or
+    classes.
+
+    This helper produces a list of :class:`warnings.WarningMessage` objects,
+    one for each warning raised.
+
+    This function can be used as a context manager, or any of the other ways
+    ``pytest.raises`` can be used::
+
+        >>> with warns(RuntimeWarning):
+        ...    warnings.warn("my warning", RuntimeWarning)
+
+    In the context manager form you may use the keyword argument ``match`` to assert
+    that the exception matches a text or regex::
+
+        >>> with warns(UserWarning, match='must be 0 or None'):
+        ...     warnings.warn("value must be 0 or None", UserWarning)
+
+        >>> with warns(UserWarning, match=r'must be \d+$'):
+        ...     warnings.warn("value must be 42", UserWarning)
+
+        >>> with warns(UserWarning, match=r'must be \d+$'):
+        ...     warnings.warn("this is not here", UserWarning)
+        Traceback (most recent call last):
+          ...
+        Failed: DID NOT WARN. No warnings of type ...UserWarning... was emitted...
+
+    """
+    match_expr = None
+    if not args:
+        if "match" in kwargs:
+            match_expr = kwargs.pop("match")
+        return WarningsChecker(expected_warning, match_expr=match_expr)
+    elif isinstance(args[0], str):
+        code, = args
+        assert isinstance(code, str)
+        frame = sys._getframe(1)
+        loc = frame.f_locals.copy()
+        loc.update(kwargs)
+
+        with WarningsChecker(expected_warning, match_expr=match_expr):
+            code = _pytest._code.Source(code).compile()
+            py.builtin.exec_(code, frame.f_globals, loc)
+    else:
+        func = args[0]
+        with WarningsChecker(expected_warning, match_expr=match_expr):
+            return func(*args[1:], **kwargs)
+
+
+class WarningsRecorder(warnings.catch_warnings):
+    """A context manager to record raised warnings.
+
+    Adapted from `warnings.catch_warnings`.
+    """
+
+    def __init__(self):
+        super(WarningsRecorder, self).__init__(record=True)
+        self._entered = False
+        self._list = []
+
+    @property
+    def list(self):
+        """The list of recorded warnings."""
+        return self._list
+
+    def __getitem__(self, i):
+        """Get a recorded warning by index."""
+        return self._list[i]
+
+    def __iter__(self):
+        """Iterate through the recorded warnings."""
+        return iter(self._list)
+
+    def __len__(self):
+        """The number of recorded warnings."""
+        return len(self._list)
+
+    def pop(self, cls=Warning):
+        """Pop the first recorded warning, raise exception if not exists."""
+        for i, w in enumerate(self._list):
+            if issubclass(w.category, cls):
+                return self._list.pop(i)
+        __tracebackhide__ = True
+        raise AssertionError("%r not found in warning list" % cls)
+
+    def clear(self):
+        """Clear the list of recorded warnings."""
+        self._list[:] = []
+
+    def __enter__(self):
+        if self._entered:
+            __tracebackhide__ = True
+            raise RuntimeError("Cannot enter %r twice" % self)
+        self._list = super(WarningsRecorder, self).__enter__()
+        warnings.simplefilter("always")
+        return self
+
+    def __exit__(self, *exc_info):
+        if not self._entered:
+            __tracebackhide__ = True
+            raise RuntimeError("Cannot exit %r without entering first" % self)
+        super(WarningsRecorder, self).__exit__(*exc_info)
+
+
+class WarningsChecker(WarningsRecorder):
+
+    def __init__(self, expected_warning=None, match_expr=None):
+        super(WarningsChecker, self).__init__()
+
+        msg = (
+            "exceptions must be old-style classes or " "derived from Warning, not %s"
+        )
+        if isinstance(expected_warning, tuple):
+            for exc in expected_warning:
+                if not inspect.isclass(exc):
+                    raise TypeError(msg % type(exc))
+        elif inspect.isclass(expected_warning):
+            expected_warning = (expected_warning,)
+        elif expected_warning is not None:
+            raise TypeError(msg % type(expected_warning))
+
+        self.expected_warning = expected_warning
+        self.match_expr = match_expr
+
+    def __exit__(self, *exc_info):
+        super(WarningsChecker, self).__exit__(*exc_info)
+
+        # only check if we're not currently handling an exception
+        if all(a is None for a in exc_info):
+            if self.expected_warning is not None:
+                if not any(issubclass(r.category, self.expected_warning) for r in self):
+                    __tracebackhide__ = True
+                    fail(
+                        "DID NOT WARN. No warnings of type {} was emitted. "
+                        "The list of emitted warnings is: {}.".format(
+                            self.expected_warning, [each.message for each in self]
+                        )
+                    )
+                elif self.match_expr is not None:
+                    for r in self:
+                        if issubclass(r.category, self.expected_warning):
+                            if re.compile(self.match_expr).search(str(r.message)):
+                                break
+                    else:
+                        fail(
+                            "DID NOT WARN. No warnings of type {} matching"
+                            " ('{}') was emitted. The list of emitted warnings"
+                            " is: {}.".format(
+                                self.expected_warning,
+                                self.match_expr,
+                                [each.message for each in self],
+                            )
+                        )
new file mode 100644
--- /dev/null
+++ b/third_party/python/pytest/src/_pytest/resultlog.py
@@ -0,0 +1,120 @@
+""" log machine-parseable test session result information in a plain
+text file.
+"""
+from __future__ import absolute_import, division, print_function
+
+import py
+import os
+
+
+def pytest_addoption(parser):
+    group = parser.getgroup("terminal reporting", "resultlog plugin options")
+    group.addoption(
+        "--resultlog",
+        "--result-log",
+        action="store",
+        metavar="path",
+        default=None,
+        help="DEPRECATED path for machine-readable result log.",
+    )
+
+
+def pytest_configure(config):
+    resultlog = config.option.resultlog
+    # prevent opening resultlog on slave nodes (xdist)
+    if resultlog and not hasattr(config, "slaveinput"):
+        dirname = os.path.dirname(os.path.abspath(resultlog))
+        if not os.path.isdir(dirname):
+            os.makedirs(dirname)
+        logfile = open(resultlog, "w", 1)  # line buffered
+        config._resultlog = ResultLog(config, logfile)
+        config.pluginmanager.register(config._resultlog)
+
+        from _pytest.deprecated import RESULT_LOG
+
+        config.warn("C1", RESULT_LOG)
+
+
+def pytest_unconfigure(config):
+    resultlog = getattr(config, "_resultlog", None)
+    if resultlog:
+        resultlog.logfile.close()
+        del config._resultlog
+        config.pluginmanager.unregister(resultlog)
+
+
+def generic_path(item):
+    chain = item.listchain()
+    gpath = [chain[0].name]
+    fspath = chain[0].fspath
+    fspart = False
+    for node in chain[1:]:
+        newfspath = node.fspath
+        if newfspath == fspath:
+            if fspart:
+                gpath.append(":")
+                fspart = False
+            else:
+                gpath.append(".")
+        else:
+            gpath.append("/")
+            fspart = True
+        name = node.name
+        if name[0] in "([":
+            gpath.pop()
+        gpath.append(name)
+        fspath = newfspath
+    return "".join(gpath)
+
+
+class ResultLog(object):
+
+    def __init__(self, config, logfile):
+        self.config = config
+        self.logfile = logfile  # preferably line buffered
+
+    def write_log_entry(self, testpath, lettercode, longrepr):
+        print("%s %s" % (lettercode, testpath), file=self.logfile)
+        for line in longrepr.splitlines():
+            print(" %s" % line, file=self.logfile)
+
+    def log_outcome(self, report, lettercode, longrepr):
+        testpath = getattr(report, "nodeid", None)
+        if testpath is None:
+            testpath = report.fspath
+        self.write_log_entry(testpath, lettercode, longrepr)
+
+    def pytest_runtest_logreport(self, report):
+        if report.when != "call" and report.passed:
+            return
+        res = self.config.hook.pytest_report_teststatus(report=report)
+        code = res[1]
+        if code == "x":
+            longrepr = str(report.longrepr)
+        elif code == "X":
+            longrepr = ""
+        elif report.passed:
+            longrepr = ""
+        elif report.failed:
+            longrepr = str(report.longrepr)
+        elif report.skipped:
+            longrepr = str(report.longrepr[2])
+        self.log_outcome(report, code, longrepr)
+
+    def pytest_collectreport(self, report):
+        if not report.passed:
+            if report.failed:
+                code = "F"
+                longrepr = str(report.longrepr)
+            else:
+                assert report.skipped
+                code = "S"
+                longrepr = "%s:%d: %s" % report.longrepr
+            self.log_outcome(report, code, longrepr)
+
+    def pytest_internalerror(self, excrepr):
+        reprcrash = getattr(excrepr, "reprcrash", None)
+        path = getattr(reprcrash, "path", None)
+        if path is None:
+            path = "cwd:%s" % py.path.local()
+        self.write_log_entry(path, "!", str(excrepr))
new file mode 100644
--- /dev/null
+++ b/third_party/python/pytest/src/_pytest/runner.py
@@ -0,0 +1,570 @@
+""" basic collect and runtest protocol implementations """
+from __future__ import absolute_import, division, print_function
+
+import bdb
+import os
+import sys
+from time import time
+
+import py
+from _pytest._code.code import TerminalRepr, ExceptionInfo
+from _pytest.outcomes import skip, Skipped, TEST_OUTCOME
+
+#
+# pytest plugin hooks
+
+
+def pytest_addoption(parser):
+    group = parser.getgroup("terminal reporting", "reporting", after="general")
+    group.addoption(
+        "--durations",
+        action="store",
+        type=int,
+        default=None,
+        metavar="N",
+        help="show N slowest setup/test durations (N=0 for all).",
+    ),
+
+
+def pytest_terminal_summary(terminalreporter):
+    durations = terminalreporter.config.option.durations
+    if durations is None:
+        return
+    tr = terminalreporter
+    dlist = []
+    for replist in tr.stats.values():
+        for rep in replist:
+            if hasattr(rep, "duration"):
+                dlist.append(rep)
+    if not dlist:
+        return
+    dlist.sort(key=lambda x: x.duration)
+    dlist.reverse()
+    if not durations:
+        tr.write_sep("=", "slowest test durations")
+    else:
+        tr.write_sep("=", "slowest %s test durations" % durations)
+        dlist = dlist[:durations]
+
+    for rep in dlist:
+        nodeid = rep.nodeid.replace("::()::", "::")
+        tr.write_line("%02.2fs %-8s %s" % (rep.duration, rep.when, nodeid))
+
+
+def pytest_sessionstart(session):
+    session._setupstate = SetupState()
+
+
+def pytest_sessionfinish(session):
+    session._setupstate.teardown_all()
+
+
+def pytest_runtest_protocol(item, nextitem):
+    item.ihook.pytest_runtest_logstart(nodeid=item.nodeid, location=item.location)
+    runtestprotocol(item, nextitem=nextitem)
+    item.ihook.pytest_runtest_logfinish(nodeid=item.nodeid, location=item.location)
+    return True
+
+
+def runtestprotocol(item, log=True, nextitem=None):
+    hasrequest = hasattr(item, "_request")
+    if hasrequest and not item._request:
+        item._initrequest()
+    rep = call_and_report(item, "setup", log)
+    reports = [rep]
+    if rep.passed:
+        if item.config.option.setupshow:
+            show_test_item(item)
+        if not item.config.option.setuponly:
+            reports.append(call_and_report(item, "call", log))
+    reports.append(call_and_report(item, "teardown", log, nextitem=nextitem))
+    # after all teardown hooks have been called
+    # want funcargs and request info to go away
+    if hasrequest:
+        item._request = False
+        item.funcargs = None
+    return reports
+
+
+def show_test_item(item):
+    """Show test function, parameters and the fixtures of the test item."""
+    tw = item.config.get_terminal_writer()
+    tw.line()
+    tw.write(" " * 8)
+    tw.write(item._nodeid)
+    used_fixtures = sorted(item._fixtureinfo.name2fixturedefs.keys())
+    if used_fixtures:
+        tw.write(" (fixtures used: {})".format(", ".join(used_fixtures)))
+
+
+def pytest_runtest_setup(item):
+    _update_current_test_var(item, "setup")
+    item.session._setupstate.prepare(item)
+
+
+def pytest_runtest_call(item):
+    _update_current_test_var(item, "call")
+    sys.last_type, sys.last_value, sys.last_traceback = (None, None, None)
+    try:
+        item.runtest()
+    except Exception:
+        # Store trace info to allow postmortem debugging
+        type, value, tb = sys.exc_info()
+        tb = tb.tb_next  # Skip *this* frame
+        sys.last_type = type
+        sys.last_value = value
+        sys.last_traceback = tb
+        del type, value, tb  # Get rid of these in this frame
+        raise
+
+
+def pytest_runtest_teardown(item, nextitem):
+    _update_current_test_var(item, "teardown")
+    item.session._setupstate.teardown_exact(item, nextitem)
+    _update_current_test_var(item, None)
+
+
+def _update_current_test_var(item, when):
+    """
+    Update PYTEST_CURRENT_TEST to reflect the current item and stage.
+
+    If ``when`` is None, delete PYTEST_CURRENT_TEST from the environment.
+    """
+    var_name = "PYTEST_CURRENT_TEST"
+    if when:
+        value = "{} ({})".format(item.nodeid, when)
+        # don't allow null bytes on environment variables (see #2644, #2957)
+        value = value.replace("\x00", "(null)")
+        os.environ[var_name] = value
+    else:
+        os.environ.pop(var_name)
+
+
+def pytest_report_teststatus(report):
+    if report.when in ("setup", "teardown"):
+        if report.failed:
+            #      category, shortletter, verbose-word
+            return "error", "E", "ERROR"
+        elif report.skipped:
+            return "skipped", "s", "SKIPPED"
+        else:
+            return "", "", ""
+
+
+#
+# Implementation
+
+
+def call_and_report(item, when, log=True, **kwds):
+    call = call_runtest_hook(item, when, **kwds)
+    hook = item.ihook
+    report = hook.pytest_runtest_makereport(item=item, call=call)
+    if log:
+        hook.pytest_runtest_logreport(report=report)
+    if check_interactive_exception(call, report):
+        hook.pytest_exception_interact(node=item, call=call, report=report)
+    return report
+
+
+def check_interactive_exception(call, report):
+    return call.excinfo and not (
+        hasattr(report, "wasxfail")
+        or call.excinfo.errisinstance(skip.Exception)
+        or call.excinfo.errisinstance(bdb.BdbQuit)
+    )
+
+
+def call_runtest_hook(item, when, **kwds):
+    hookname = "pytest_runtest_" + when
+    ihook = getattr(item.ihook, hookname)
+    return CallInfo(
+        lambda: ihook(item=item, **kwds),
+        when=when,
+        treat_keyboard_interrupt_as_exception=item.config.getvalue("usepdb"),
+    )
+
+
+class CallInfo(object):
+    """ Result/Exception info a function invocation. """
+    #: None or ExceptionInfo object.
+    excinfo = None
+
+    def __init__(self, func, when, treat_keyboard_interrupt_as_exception=False):
+        #: context of invocation: one of "setup", "call",
+        #: "teardown", "memocollect"
+        self.when = when
+        self.start = time()
+        try:
+            self.result = func()
+        except KeyboardInterrupt:
+            if treat_keyboard_interrupt_as_exception:
+                self.excinfo = ExceptionInfo()
+            else:
+                self.stop = time()
+                raise
+        except:  # noqa
+            self.excinfo = ExceptionInfo()
+        self.stop = time()
+
+    def __repr__(self):
+        if self.excinfo:
+            status = "exception: %s" % str(self.excinfo.value)
+        else:
+            status = "result: %r" % (self.result,)
+        return "<CallInfo when=%r %s>" % (self.when, status)
+
+
+def getslaveinfoline(node):
+    try:
+        return node._slaveinfocache
+    except AttributeError:
+        d = node.slaveinfo
+        ver = "%s.%s.%s" % d["version_info"][:3]
+        node._slaveinfocache = s = "[%s] %s -- Python %s %s" % (
+            d["id"], d["sysplatform"], ver, d["executable"]
+        )
+        return s
+
+
+class BaseReport(object):
+
+    def __init__(self, **kw):
+        self.__dict__.update(kw)
+
+    def toterminal(self, out):
+        if hasattr(self, "node"):
+            out.line(getslaveinfoline(self.node))
+
+        longrepr = self.longrepr
+        if longrepr is None:
+            return
+
+        if hasattr(longrepr, "toterminal"):
+            longrepr.toterminal(out)
+        else:
+            try:
+                out.line(longrepr)
+            except UnicodeEncodeError:
+                out.line("<unprintable longrepr>")
+
+    def get_sections(self, prefix):
+        for name, content in self.sections:
+            if name.startswith(prefix):
+                yield prefix, content
+
+    @property
+    def longreprtext(self):
+        """
+        Read-only property that returns the full string representation
+        of ``longrepr``.
+
+        .. versionadded:: 3.0
+        """
+        tw = py.io.TerminalWriter(stringio=True)
+        tw.hasmarkup = False
+        self.toterminal(tw)
+        exc = tw.stringio.getvalue()
+        return exc.strip()
+
+    @property
+    def caplog(self):
+        """Return captured log lines, if log capturing is enabled
+
+        .. versionadded:: 3.5
+        """
+        return "\n".join(
+            content for (prefix, content) in self.get_sections("Captured log")
+        )
+
+    @property
+    def capstdout(self):
+        """Return captured text from stdout, if capturing is enabled
+
+        .. versionadded:: 3.0
+        """
+        return "".join(
+            content for (prefix, content) in self.get_sections("Captured stdout")
+        )
+
+    @property
+    def capstderr(self):
+        """Return captured text from stderr, if capturing is enabled
+
+        .. versionadded:: 3.0
+        """
+        return "".join(
+            content for (prefix, content) in self.get_sections("Captured stderr")
+        )
+
+    passed = property(lambda x: x.outcome == "passed")
+    failed = property(lambda x: x.outcome == "failed")
+    skipped = property(lambda x: x.outcome == "skipped")
+
+    @property
+    def fspath(self):
+        return self.nodeid.split("::")[0]
+
+
+def pytest_runtest_makereport(item, call):
+    when = call.when
+    duration = call.stop - call.start
+    keywords = {x: 1 for x in item.keywords}
+    excinfo = call.excinfo
+    sections = []
+    if not call.excinfo:
+        outcome = "passed"
+        longrepr = None
+    else:
+        if not isinstance(excinfo, ExceptionInfo):
+            outcome = "failed"
+            longrepr = excinfo
+        elif excinfo.errisinstance(skip.Exception):
+            outcome = "skipped"
+            r = excinfo._getreprcrash()
+            longrepr = (str(r.path), r.lineno, r.message)
+        else:
+            outcome = "failed"
+            if call.when == "call":
+                longrepr = item.repr_failure(excinfo)
+            else:  # exception in setup or teardown
+                longrepr = item._repr_failure_py(
+                    excinfo, style=item.config.option.tbstyle
+                )
+    for rwhen, key, content in item._report_sections:
+        sections.append(("Captured %s %s" % (key, rwhen), content))
+    return TestReport(
+        item.nodeid,
+        item.location,
+        keywords,
+        outcome,
+        longrepr,
+        when,
+        sections,
+        duration,
+        user_properties=item.user_properties,
+    )
+
+
+class TestReport(BaseReport):
+    """ Basic test report object (also used for setup and teardown calls if
+    they fail).
+    """
+
+    def __init__(
+        self,
+        nodeid,
+        location,
+        keywords,
+        outcome,
+        longrepr,
+        when,
+        sections=(),
+        duration=0,
+        user_properties=(),
+        **extra
+    ):
+        #: normalized collection node id
+        self.nodeid = nodeid
+
+        #: a (filesystempath, lineno, domaininfo) tuple indicating the
+        #: actual location of a test item - it might be different from the
+        #: collected one e.g. if a method is inherited from a different module.
+        self.location = location
+
+        #: a name -> value dictionary containing all keywords and
+        #: markers associated with a test invocation.
+        self.keywords = keywords
+
+        #: test outcome, always one of "passed", "failed", "skipped".
+        self.outcome = outcome
+
+        #: None or a failure representation.
+        self.longrepr = longrepr
+
+        #: one of 'setup', 'call', 'teardown' to indicate runtest phase.
+        self.when = when
+
+        #: user properties is a list of tuples (name, value) that holds user
+        #: defined properties of the test
+        self.user_properties = user_properties
+
+        #: list of pairs ``(str, str)`` of extra information which needs to
+        #: marshallable. Used by pytest to add captured text
+        #: from ``stdout`` and ``stderr``, but may be used by other plugins
+        #: to add arbitrary information to reports.
+        self.sections = list(sections)
+
+        #: time it took to run just the test
+        self.duration = duration
+
+        self.__dict__.update(extra)
+
+    def __repr__(self):
+        return "<TestReport %r when=%r outcome=%r>" % (
+            self.nodeid, self.when, self.outcome
+        )
+
+
+class TeardownErrorReport(BaseReport):
+    outcome = "failed"
+    when = "teardown"
+
+    def __init__(self, longrepr, **extra):
+        self.longrepr = longrepr
+        self.sections = []
+        self.__dict__.update(extra)
+
+
+def pytest_make_collect_report(collector):
+    call = CallInfo(lambda: list(collector.collect()), "collect")
+    longrepr = None
+    if not call.excinfo:
+        outcome = "passed"
+    else:
+        from _pytest import nose
+
+        skip_exceptions = (Skipped,) + nose.get_skip_exceptions()
+        if call.excinfo.errisinstance(skip_exceptions):
+            outcome = "skipped"
+            r = collector._repr_failure_py(call.excinfo, "line").reprcrash
+            longrepr = (str(r.path), r.lineno, r.message)
+        else:
+            outcome = "failed"
+            errorinfo = collector.repr_failure(call.excinfo)
+            if not hasattr(errorinfo, "toterminal"):
+                errorinfo = CollectErrorRepr(errorinfo)
+            longrepr = errorinfo
+    rep = CollectReport(
+        collector.nodeid, outcome, longrepr, getattr(call, "result", None)
+    )
+    rep.call = call  # see collect_one_node
+    return rep
+
+
+class CollectReport(BaseReport):
+
+    def __init__(self, nodeid, outcome, longrepr, result, sections=(), **extra):
+        self.nodeid = nodeid
+        self.outcome = outcome
+        self.longrepr = longrepr
+        self.result = result or []
+        self.sections = list(sections)
+        self.__dict__.update(extra)
+
+    @property
+    def location(self):
+        return (self.fspath, None, self.fspath)
+
+    def __repr__(self):
+        return "<CollectReport %r lenresult=%s outcome=%r>" % (
+            self.nodeid, len(self.result), self.outcome
+        )
+
+
+class CollectErrorRepr(TerminalRepr):
+
+    def __init__(self, msg):
+        self.longrepr = msg
+
+    def toterminal(self, out):
+        out.line(self.longrepr, red=True)
+
+
+class SetupState(object):
+    """ shared state for setting up/tearing down test items or collectors. """
+
+    def __init__(self):
+        self.stack = []
+        self._finalizers = {}
+
+    def addfinalizer(self, finalizer, colitem):
+        """ attach a finalizer to the given colitem.
+        if colitem is None, this will add a finalizer that
+        is called at the end of teardown_all().
+        """
+        assert colitem and not isinstance(colitem, tuple)
+        assert callable(finalizer)
+        # assert colitem in self.stack  # some unit tests don't setup stack :/
+        self._finalizers.setdefault(colitem, []).append(finalizer)
+
+    def _pop_and_teardown(self):
+        colitem = self.stack.pop()
+        self._teardown_with_finalization(colitem)
+
+    def _callfinalizers(self, colitem):
+        finalizers = self._finalizers.pop(colitem, None)
+        exc = None
+        while finalizers:
+            fin = finalizers.pop()
+            try:
+                fin()
+            except TEST_OUTCOME:
+                # XXX Only first exception will be seen by user,
+                #     ideally all should be reported.
+                if exc is None:
+                    exc = sys.exc_info()
+        if exc:
+            py.builtin._reraise(*exc)
+
+    def _teardown_with_finalization(self, colitem):
+        self._callfinalizers(colitem)
+        if hasattr(colitem, "teardown"):
+            colitem.teardown()
+        for colitem in self._finalizers:
+            assert (
+                colitem is None or colitem in self.stack or isinstance(colitem, tuple)
+            )
+
+    def teardown_all(self):
+        while self.stack:
+            self._pop_and_teardown()
+        for key in list(self._finalizers):
+            self._teardown_with_finalization(key)
+        assert not self._finalizers
+
+    def teardown_exact(self, item, nextitem):
+        needed_collectors = nextitem and nextitem.listchain() or []
+        self._teardown_towards(needed_collectors)
+
+    def _teardown_towards(self, needed_collectors):
+        exc = None
+        while self.stack:
+            if self.stack == needed_collectors[:len(self.stack)]:
+                break
+            try:
+                self._pop_and_teardown()
+            except TEST_OUTCOME:
+                # XXX Only first exception will be seen by user,
+                #     ideally all should be reported.
+                if exc is None:
+                    exc = sys.exc_info()
+        if exc:
+            py.builtin._reraise(*exc)
+
+    def prepare(self, colitem):
+        """ setup objects along the collector chain to the test-method
+            and teardown previously setup objects."""
+        needed_collectors = colitem.listchain()
+        self._teardown_towards(needed_collectors)
+
+        # check if the last collection node has raised an error
+        for col in self.stack:
+            if hasattr(col, "_prepare_exc"):
+                py.builtin._reraise(*col._prepare_exc)
+        for col in needed_collectors[len(self.stack):]:
+            self.stack.append(col)
+            try:
+                col.setup()
+            except TEST_OUTCOME:
+                col._prepare_exc = sys.exc_info()
+                raise
+
+
+def collect_one_node(collector):
+    ihook = collector.ihook
+    ihook.pytest_collectstart(collector=collector)
+    rep = ihook.pytest_make_collect_report(collector=collector)
+    call = rep.__dict__.pop("call", None)
+    if call and check_interactive_exception(call, rep):
+        ihook.pytest_exception_interact(node=collector, call=call, report=rep)
+    return rep
new file mode 100644
--- /dev/null
+++ b/third_party/python/pytest/src/_pytest/setuponly.py
@@ -0,0 +1,84 @@
+from __future__ import absolute_import, division, print_function
+
+import pytest
+import sys
+
+
+def pytest_addoption(parser):
+    group = parser.getgroup("debugconfig")
+    group.addoption(
+        "--setuponly",
+        "--setup-only",
+        action="store_true",
+        help="only setup fixtures, do not execute tests.",
+    )
+    group.addoption(
+        "--setupshow",
+        "--setup-show",
+        action="store_true",
+        help="show setup of fixtures while executing tests.",
+    )
+
+
+@pytest.hookimpl(hookwrapper=True)
+def pytest_fixture_setup(fixturedef, request):
+    yield
+    config = request.config
+    if config.option.setupshow:
+        if hasattr(request, "param"):
+            # Save the fixture parameter so ._show_fixture_action() can
+            # display it now and during the teardown (in .finish()).
+            if fixturedef.ids:
+                if callable(fixturedef.ids):
+                    fixturedef.cached_param = fixturedef.ids(request.param)
+                else:
+                    fixturedef.cached_param = fixturedef.ids[request.param_index]
+            else:
+                fixturedef.cached_param = request.param
+        _show_fixture_action(fixturedef, "SETUP")
+
+
+def pytest_fixture_post_finalizer(fixturedef):
+    if hasattr(fixturedef, "cached_result"):
+        config = fixturedef._fixturemanager.config
+        if config.option.setupshow:
+            _show_fixture_action(fixturedef, "TEARDOWN")
+            if hasattr(fixturedef, "cached_param"):
+                del fixturedef.cached_param
+
+
+def _show_fixture_action(fixturedef, msg):
+    config = fixturedef._fixturemanager.config
+    capman = config.pluginmanager.getplugin("capturemanager")
+    if capman:
+        out, err = capman.suspend_global_capture()
+
+    tw = config.get_terminal_writer()
+    tw.line()
+    tw.write(" " * 2 * fixturedef.scopenum)
+    tw.write(
+        "{step} {scope} {fixture}".format(
+            step=msg.ljust(8),  # align the output to TEARDOWN
+            scope=fixturedef.scope[0].upper(),
+            fixture=fixturedef.argname,
+        )
+    )
+
+    if msg == "SETUP":
+        deps = sorted(arg for arg in fixturedef.argnames if arg != "request")
+        if deps:
+            tw.write(" (fixtures used: {})".format(", ".join(deps)))
+
+    if hasattr(fixturedef, "cached_param"):
+        tw.write("[{}]".format(fixturedef.cached_param))
+
+    if capman:
+        capman.resume_global_capture()
+        sys.stdout.write(out)
+        sys.stderr.write(err)
+
+
+@pytest.hookimpl(tryfirst=True)
+def pytest_cmdline_main(config):
+    if config.option.setuponly:
+        config.option.setupshow = True
new file mode 100644
--- /dev/null
+++ b/third_party/python/pytest/src/_pytest/setupplan.py
@@ -0,0 +1,29 @@
+from __future__ import absolute_import, division, print_function
+
+import pytest
+
+
+def pytest_addoption(parser):
+    group = parser.getgroup("debugconfig")
+    group.addoption(
+        "--setupplan",
+        "--setup-plan",
+        action="store_true",
+        help="show what fixtures and tests would be executed but "
+        "don't execute anything.",
+    )
+
+
+@pytest.hookimpl(tryfirst=True)
+def pytest_fixture_setup(fixturedef, request):
+    # Will return a dummy fixture if the setuponly option is provided.
+    if request.config.option.setupplan:
+        fixturedef.cached_result = (None, None, None)
+        return fixturedef.cached_result
+
+
+@pytest.hookimpl(tryfirst=True)
+def pytest_cmdline_main(config):
+    if config.option.setupplan:
+        config.option.setuponly = True
+        config.option.setupshow = True
new file mode 100644
--- /dev/null
+++ b/third_party/python/pytest/src/_pytest/skipping.py
@@ -0,0 +1,293 @@
+""" support for skip/xfail functions and markers. """
+from __future__ import absolute_import, division, print_function
+
+from _pytest.config import hookimpl
+from _pytest.mark.evaluate import MarkEvaluator
+from _pytest.outcomes import fail, skip, xfail
+
+
+def pytest_addoption(parser):
+    group = parser.getgroup("general")
+    group.addoption(
+        "--runxfail",
+        action="store_true",
+        dest="runxfail",
+        default=False,
+        help="run tests even if they are marked xfail",
+    )
+
+    parser.addini(
+        "xfail_strict",
+        "default for the strict parameter of xfail "
+        "markers when not given explicitly (default: False)",
+        default=False,
+        type="bool",
+    )
+
+
+def pytest_configure(config):
+    if config.option.runxfail:
+        # yay a hack
+        import pytest
+
+        old = pytest.xfail
+        config._cleanup.append(lambda: setattr(pytest, "xfail", old))
+
+        def nop(*args, **kwargs):
+            pass
+
+        nop.Exception = xfail.Exception
+        setattr(pytest, "xfail", nop)
+
+    config.addinivalue_line(
+        "markers",
+        "skip(reason=None): skip the given test function with an optional reason. "
+        'Example: skip(reason="no way of currently testing this") skips the '
+        "test.",
+    )
+    config.addinivalue_line(
+        "markers",
+        "skipif(condition): skip the given test function if eval(condition) "
+        "results in a True value.  Evaluation happens within the "
+        "module global context. Example: skipif('sys.platform == \"win32\"') "
+        "skips the test if we are on the win32 platform. see "
+        "http://pytest.org/latest/skipping.html",
+    )
+    config.addinivalue_line(
+        "markers",
+        "xfail(condition, reason=None, run=True, raises=None, strict=False): "
+        "mark the test function as an expected failure if eval(condition) "
+        "has a True value. Optionally specify a reason for better reporting "
+        "and run=False if you don't even want to execute the test function. "
+        "If only specific exception(s) are expected, you can list them in "
+        "raises, and if the test fails in other ways, it will be reported as "
+        "a true failure. See http://pytest.org/latest/skipping.html",
+    )
+
+
+@hookimpl(tryfirst=True)
+def pytest_runtest_setup(item):
+    # Check if skip or skipif are specified as pytest marks
+    item._skipped_by_mark = False
+    eval_skipif = MarkEvaluator(item, "skipif")
+    if eval_skipif.istrue():
+        item._skipped_by_mark = True
+        skip(eval_skipif.getexplanation())
+
+    for skip_info in item.iter_markers(name="skip"):
+        item._skipped_by_mark = True
+        if "reason" in skip_info.kwargs:
+            skip(skip_info.kwargs["reason"])
+        elif skip_info.args:
+            skip(skip_info.args[0])
+        else:
+            skip("unconditional skip")
+
+    item._evalxfail = MarkEvaluator(item, "xfail")
+    check_xfail_no_run(item)
+
+
+@hookimpl(hookwrapper=True)
+def pytest_pyfunc_call(pyfuncitem):
+    check_xfail_no_run(pyfuncitem)
+    outcome = yield
+    passed = outcome.excinfo is None
+    if passed:
+        check_strict_xfail(pyfuncitem)
+
+
+def check_xfail_no_run(item):
+    """check xfail(run=False)"""
+    if not item.config.option.runxfail:
+        evalxfail = item._evalxfail
+        if evalxfail.istrue():
+            if not evalxfail.get("run", True):
+                xfail("[NOTRUN] " + evalxfail.getexplanation())
+
+
+def check_strict_xfail(pyfuncitem):
+    """check xfail(strict=True) for the given PASSING test"""
+    evalxfail = pyfuncitem._evalxfail
+    if evalxfail.istrue():
+        strict_default = pyfuncitem.config.getini("xfail_strict")
+        is_strict_xfail = evalxfail.get("strict", strict_default)
+        if is_strict_xfail:
+            del pyfuncitem._evalxfail
+            explanation = evalxfail.getexplanation()
+            fail("[XPASS(strict)] " + explanation, pytrace=False)
+
+
+@hookimpl(hookwrapper=True)
+def pytest_runtest_makereport(item, call):
+    outcome = yield
+    rep = outcome.get_result()
+    evalxfail = getattr(item, "_evalxfail", None)
+    # unitttest special case, see setting of _unexpectedsuccess
+    if hasattr(item, "_unexpectedsuccess") and rep.when == "call":
+        from _pytest.compat import _is_unittest_unexpected_success_a_failure
+
+        if item._unexpectedsuccess:
+            rep.longrepr = "Unexpected success: {}".format(item._unexpectedsuccess)
+        else:
+            rep.longrepr = "Unexpected success"
+        if _is_unittest_unexpected_success_a_failure():
+            rep.outcome = "failed"
+        else:
+            rep.outcome = "passed"
+            rep.wasxfail = rep.longrepr
+    elif item.config.option.runxfail:
+        pass  # don't interefere
+    elif call.excinfo and call.excinfo.errisinstance(xfail.Exception):
+        rep.wasxfail = "reason: " + call.excinfo.value.msg
+        rep.outcome = "skipped"
+    elif evalxfail and not rep.skipped and evalxfail.wasvalid() and evalxfail.istrue():
+        if call.excinfo:
+            if evalxfail.invalidraise(call.excinfo.value):
+                rep.outcome = "failed"
+            else:
+                rep.outcome = "skipped"
+                rep.wasxfail = evalxfail.getexplanation()
+        elif call.when == "call":
+            strict_default = item.config.getini("xfail_strict")
+            is_strict_xfail = evalxfail.get("strict", strict_default)
+            explanation = evalxfail.getexplanation()
+            if is_strict_xfail:
+                rep.outcome = "failed"
+                rep.longrepr = "[XPASS(strict)] {}".format(explanation)
+            else:
+                rep.outcome = "passed"
+                rep.wasxfail = explanation
+    elif getattr(item, "_skipped_by_mark", False) and rep.skipped and type(
+        rep.longrepr
+    ) is tuple:
+        # skipped by mark.skipif; change the location of the failure
+        # to point to the item definition, otherwise it will display
+        # the location of where the skip exception was raised within pytest
+        filename, line, reason = rep.longrepr
+        filename, line = item.location[:2]
+        rep.longrepr = filename, line, reason
+
+
+# called by terminalreporter progress reporting
+
+
+def pytest_report_teststatus(report):
+    if hasattr(report, "wasxfail"):
+        if report.skipped:
+            return "xfailed", "x", "xfail"
+        elif report.passed:
+            return "xpassed", "X", ("XPASS", {"yellow": True})
+
+
+# called by the terminalreporter instance/plugin
+
+
+def pytest_terminal_summary(terminalreporter):
+    tr = terminalreporter
+    if not tr.reportchars:
+        # for name in "xfailed skipped failed xpassed":
+        #    if not tr.stats.get(name, 0):
+        #        tr.write_line("HINT: use '-r' option to see extra "
+        #              "summary info about tests")
+        #        break
+        return
+
+    lines = []
+    for char in tr.reportchars:
+        action = REPORTCHAR_ACTIONS.get(char, lambda tr, lines: None)
+        action(terminalreporter, lines)
+
+    if lines:
+        tr._tw.sep("=", "short test summary info")
+        for line in lines:
+            tr._tw.line(line)
+
+
+def show_simple(terminalreporter, lines, stat, format):
+    failed = terminalreporter.stats.get(stat)
+    if failed:
+        for rep in failed:
+            pos = terminalreporter.config.cwd_relative_nodeid(rep.nodeid)
+            lines.append(format % (pos,))
+
+
+def show_xfailed(terminalreporter, lines):
+    xfailed = terminalreporter.stats.get("xfailed")
+    if xfailed:
+        for rep in xfailed:
+            pos = terminalreporter.config.cwd_relative_nodeid(rep.nodeid)
+            reason = rep.wasxfail
+            lines.append("XFAIL %s" % (pos,))
+            if reason:
+                lines.append("  " + str(reason))
+
+
+def show_xpassed(terminalreporter, lines):
+    xpassed = terminalreporter.stats.get("xpassed")
+    if xpassed:
+        for rep in xpassed:
+            pos = terminalreporter.config.cwd_relative_nodeid(rep.nodeid)
+            reason = rep.wasxfail
+            lines.append("XPASS %s %s" % (pos, reason))
+
+
+def folded_skips(skipped):
+    d = {}
+    for event in skipped:
+        key = event.longrepr
+        assert len(key) == 3, (event, key)
+        keywords = getattr(event, "keywords", {})
+        # folding reports with global pytestmark variable
+        # this is workaround, because for now we cannot identify the scope of a skip marker
+        # TODO: revisit after marks scope would be fixed
+        when = getattr(event, "when", None)
+        if when == "setup" and "skip" in keywords and "pytestmark" not in keywords:
+            key = (key[0], None, key[2])
+        d.setdefault(key, []).append(event)
+    values = []
+    for key, events in d.items():
+        values.append((len(events),) + key)
+    return values
+
+
+def show_skipped(terminalreporter, lines):
+    tr = terminalreporter
+    skipped = tr.stats.get("skipped", [])
+    if skipped:
+        # if not tr.hasopt('skipped'):
+        #    tr.write_line(
+        #        "%d skipped tests, specify -rs for more info" %
+        #        len(skipped))
+        #    return
+        fskips = folded_skips(skipped)
+        if fskips:
+            # tr.write_sep("_", "skipped test summary")
+            for num, fspath, lineno, reason in fskips:
+                if reason.startswith("Skipped: "):
+                    reason = reason[9:]
+                if lineno is not None:
+                    lines.append(
+                        "SKIP [%d] %s:%d: %s" % (num, fspath, lineno + 1, reason)
+                    )
+                else:
+                    lines.append("SKIP [%d] %s: %s" % (num, fspath, reason))
+
+
+def shower(stat, format):
+
+    def show_(terminalreporter, lines):
+        return show_simple(terminalreporter, lines, stat, format)
+
+    return show_
+
+
+REPORTCHAR_ACTIONS = {
+    "x": show_xfailed,
+    "X": show_xpassed,
+    "f": shower("failed", "FAIL %s"),
+    "F": shower("failed", "FAIL %s"),
+    "s": show_skipped,
+    "S": show_skipped,
+    "p": shower("passed", "PASSED %s"),
+    "E": shower("error", "ERROR %s"),
+}
new file mode 100644
--- /dev/null
+++ b/third_party/python/pytest/src/_pytest/terminal.py
@@ -0,0 +1,829 @@
+""" terminal reporting of the full testing process.
+
+This is a good source for looking at the various reporting hooks.
+"""
+from __future__ import absolute_import, division, print_function
+
+import itertools
+import platform
+import sys
+import time
+
+import pluggy
+import py
+import six
+from more_itertools import collapse
+
+import pytest
+from _pytest import nodes
+from _pytest.main import (
+    EXIT_OK,
+    EXIT_TESTSFAILED,
+    EXIT_INTERRUPTED,
+    EXIT_USAGEERROR,
+    EXIT_NOTESTSCOLLECTED,
+)
+
+
+import argparse
+
+
+class MoreQuietAction(argparse.Action):
+    """
+    a modified copy of the argparse count action which counts down and updates
+    the legacy quiet attribute at the same time
+
+    used to unify verbosity handling
+    """
+
+    def __init__(self, option_strings, dest, default=None, required=False, help=None):
+        super(MoreQuietAction, self).__init__(
+            option_strings=option_strings,
+            dest=dest,
+            nargs=0,
+            default=default,
+            required=required,
+            help=help,
+        )
+
+    def __call__(self, parser, namespace, values, option_string=None):
+        new_count = getattr(namespace, self.dest, 0) - 1
+        setattr(namespace, self.dest, new_count)
+        # todo Deprecate config.quiet
+        namespace.quiet = getattr(namespace, "quiet", 0) + 1
+
+
+def pytest_addoption(parser):
+    group = parser.getgroup("terminal reporting", "reporting", after="general")
+    group._addoption(
+        "-v",
+        "--verbose",
+        action="count",
+        default=0,
+        dest="verbose",
+        help="increase verbosity.",
+    ),
+    group._addoption(
+        "-q",
+        "--quiet",
+        action=MoreQuietAction,
+        default=0,
+        dest="verbose",
+        help="decrease verbosity.",
+    ),
+    group._addoption(
+        "--verbosity", dest="verbose", type=int, default=0, help="set verbosity"
+    )
+    group._addoption(
+        "-r",
+        action="store",
+        dest="reportchars",
+        default="",
+        metavar="chars",
+        help="show extra test summary info as specified by chars (f)ailed, "
+        "(E)error, (s)skipped, (x)failed, (X)passed, "
+        "(p)passed, (P)passed with output, (a)all except pP. "
+        "Warnings are displayed at all times except when "
+        "--disable-warnings is set",
+    )
+    group._addoption(
+        "--disable-warnings",
+        "--disable-pytest-warnings",
+        default=False,
+        dest="disable_warnings",
+        action="store_true",
+        help="disable warnings summary",
+    )
+    group._addoption(
+        "-l",
+        "--showlocals",
+        action="store_true",
+        dest="showlocals",
+        default=False,
+        help="show locals in tracebacks (disabled by default).",
+    )
+    group._addoption(
+        "--tb",
+        metavar="style",
+        action="store",
+        dest="tbstyle",
+        default="auto",
+        choices=["auto", "long", "short", "no", "line", "native"],
+        help="traceback print mode (auto/long/short/line/native/no).",
+    )
+    group._addoption(
+        "--show-capture",
+        action="store",
+        dest="showcapture",
+        choices=["no", "stdout", "stderr", "log", "all"],
+        default="all",
+        help="Controls how captured stdout/stderr/log is shown on failed tests. "
+        "Default is 'all'.",
+    )
+    group._addoption(
+        "--fulltrace",
+        "--full-trace",
+        action="store_true",
+        default=False,
+        help="don't cut any tracebacks (default is to cut).",
+    )
+    group._addoption(
+        "--color",
+        metavar="color",
+        action="store",
+        dest="color",
+        default="auto",
+        choices=["yes", "no", "auto"],
+        help="color terminal output (yes/no/auto).",
+    )
+
+    parser.addini(
+        "console_output_style",
+        help="console output: classic or with additional progress information (classic|progress).",
+        default="progress",
+    )
+
+
+def pytest_configure(config):
+    reporter = TerminalReporter(config, sys.stdout)
+    config.pluginmanager.register(reporter, "terminalreporter")
+    if config.option.debug or config.option.traceconfig:
+
+        def mywriter(tags, args):
+            msg = " ".join(map(str, args))
+            reporter.write_line("[traceconfig] " + msg)
+
+        config.trace.root.setprocessor("pytest:config", mywriter)
+
+
+def getreportopt(config):
+    reportopts = ""
+    reportchars = config.option.reportchars
+    if not config.option.disable_warnings and "w" not in reportchars:
+        reportchars += "w"
+    elif config.option.disable_warnings and "w" in reportchars:
+        reportchars = reportchars.replace("w", "")
+    if reportchars:
+        for char in reportchars:
+            if char not in reportopts and char != "a":
+                reportopts += char
+            elif char == "a":
+                reportopts = "fEsxXw"
+    return reportopts
+
+
+def pytest_report_teststatus(report):
+    if report.passed:
+        letter = "."
+    elif report.skipped:
+        letter = "s"
+    elif report.failed:
+        letter = "F"
+        if report.when != "call":
+            letter = "f"
+    return report.outcome, letter, report.outcome.upper()
+
+
+class WarningReport(object):
+    """
+    Simple structure to hold warnings information captured by ``pytest_logwarning``.
+    """
+
+    def __init__(self, code, message, nodeid=None, fslocation=None):
+        """
+        :param code: unused
+        :param str message: user friendly message about the warning
+        :param str|None nodeid: node id that generated the warning (see ``get_location``).
+        :param tuple|py.path.local fslocation:
+            file system location of the source of the warning (see ``get_location``).
+        """
+        self.code = code
+        self.message = message
+        self.nodeid = nodeid
+        self.fslocation = fslocation
+
+    def get_location(self, config):
+        """
+        Returns the more user-friendly information about the location
+        of a warning, or None.
+        """
+        if self.nodeid:
+            return self.nodeid
+        if self.fslocation:
+            if isinstance(self.fslocation, tuple) and len(self.fslocation) >= 2:
+                filename, linenum = self.fslocation[:2]
+                relpath = py.path.local(filename).relto(config.invocation_dir)
+                return "%s:%s" % (relpath, linenum)
+            else:
+                return str(self.fslocation)
+        return None
+
+
+class TerminalReporter(object):
+
+    def __init__(self, config, file=None):
+        import _pytest.config
+
+        self.config = config
+        self.verbosity = self.config.option.verbose
+        self.showheader = self.verbosity >= 0
+        self.showfspath = self.verbosity >= 0
+        self.showlongtestinfo = self.verbosity > 0
+        self._numcollected = 0
+        self._session = None
+
+        self.stats = {}
+        self.startdir = py.path.local()
+        if file is None:
+            file = sys.stdout
+        self._tw = _pytest.config.create_terminal_writer(config, file)
+        # self.writer will be deprecated in pytest-3.4
+        self.writer = self._tw
+        self._screen_width = self._tw.fullwidth
+        self.currentfspath = None
+        self.reportchars = getreportopt(config)
+        self.hasmarkup = self._tw.hasmarkup
+        self.isatty = file.isatty()
+        self._progress_nodeids_reported = set()
+        self._show_progress_info = self._determine_show_progress_info()
+
+    def _determine_show_progress_info(self):
+        """Return True if we should display progress information based on the current config"""
+        # do not show progress if we are not capturing output (#3038)
+        if self.config.getoption("capture") == "no":
+            return False
+        # do not show progress if we are showing fixture setup/teardown
+        if self.config.getoption("setupshow"):
+            return False
+        return self.config.getini("console_output_style") == "progress"
+
+    def hasopt(self, char):
+        char = {"xfailed": "x", "skipped": "s"}.get(char, char)
+        return char in self.reportchars
+
+    def write_fspath_result(self, nodeid, res):
+        fspath = self.config.rootdir.join(nodeid.split("::")[0])
+        if fspath != self.currentfspath:
+            if self.currentfspath is not None:
+                self._write_progress_information_filling_space()
+            self.currentfspath = fspath
+            fspath = self.startdir.bestrelpath(fspath)
+            self._tw.line()
+            self._tw.write(fspath + " ")
+        self._tw.write(res)
+
+    def write_ensure_prefix(self, prefix, extra="", **kwargs):
+        if self.currentfspath != prefix:
+            self._tw.line()
+            self.currentfspath = prefix
+            self._tw.write(prefix)
+        if extra:
+            self._tw.write(extra, **kwargs)
+            self.currentfspath = -2
+
+    def ensure_newline(self):
+        if self.currentfspath:
+            self._tw.line()
+            self.currentfspath = None
+
+    def write(self, content, **markup):
+        self._tw.write(content, **markup)
+
+    def write_line(self, line, **markup):
+        if not isinstance(line, six.text_type):
+            line = six.text_type(line, errors="replace")
+        self.ensure_newline()
+        self._tw.line(line, **markup)
+
+    def rewrite(self, line, **markup):
+        """
+        Rewinds the terminal cursor to the beginning and writes the given line.
+
+        :kwarg erase: if True, will also add spaces until the full terminal width to ensure
+            previous lines are properly erased.
+
+        The rest of the keyword arguments are markup instructions.
+        """
+        erase = markup.pop("erase", False)
+        if erase:
+            fill_count = self._tw.fullwidth - len(line) - 1
+            fill = " " * fill_count
+        else:
+            fill = ""
+        line = str(line)
+        self._tw.write("\r" + line + fill, **markup)
+
+    def write_sep(self, sep, title=None, **markup):
+        self.ensure_newline()
+        self._tw.sep(sep, title, **markup)
+
+    def section(self, title, sep="=", **kw):
+        self._tw.sep(sep, title, **kw)
+
+    def line(self, msg, **kw):
+        self._tw.line(msg, **kw)
+
+    def pytest_internalerror(self, excrepr):
+        for line in six.text_type(excrepr).split("\n"):
+            self.write_line("INTERNALERROR> " + line)
+        return 1
+
+    def pytest_logwarning(self, code, fslocation, message, nodeid):
+        warnings = self.stats.setdefault("warnings", [])
+        warning = WarningReport(
+            code=code, fslocation=fslocation, message=message, nodeid=nodeid
+        )
+        warnings.append(warning)
+
+    def pytest_plugin_registered(self, plugin):
+        if self.config.option.traceconfig:
+            msg = "PLUGIN registered: %s" % (plugin,)
+            # XXX this event may happen during setup/teardown time
+            #     which unfortunately captures our output here
+            #     which garbles our output if we use self.write_line
+            self.write_line(msg)
+
+    def pytest_deselected(self, items):
+        self.stats.setdefault("deselected", []).extend(items)
+
+    def pytest_runtest_logstart(self, nodeid, location):
+        # ensure that the path is printed before the
+        # 1st test of a module starts running
+        if self.showlongtestinfo:
+            line = self._locationline(nodeid, *location)
+            self.write_ensure_prefix(line, "")
+        elif self.showfspath:
+            fsid = nodeid.split("::")[0]
+            self.write_fspath_result(fsid, "")
+
+    def pytest_runtest_logreport(self, report):
+        rep = report
+        res = self.config.hook.pytest_report_teststatus(report=rep)
+        cat, letter, word = res
+        if isinstance(word, tuple):
+            word, markup = word
+        else:
+            markup = None
+        self.stats.setdefault(cat, []).append(rep)
+        self._tests_ran = True
+        if not letter and not word:
+            # probably passed setup/teardown
+            return
+        running_xdist = hasattr(rep, "node")
+        if self.verbosity <= 0:
+            if not running_xdist and self.showfspath:
+                self.write_fspath_result(rep.nodeid, letter)
+            else:
+                self._tw.write(letter)
+        else:
+            self._progress_nodeids_reported.add(rep.nodeid)
+            if markup is None:
+                if rep.passed:
+                    markup = {"green": True}
+                elif rep.failed:
+                    markup = {"red": True}
+                elif rep.skipped:
+                    markup = {"yellow": True}
+                else:
+                    markup = {}
+            line = self._locationline(rep.nodeid, *rep.location)
+            if not running_xdist:
+                self.write_ensure_prefix(line, word, **markup)
+                if self._show_progress_info:
+                    self._write_progress_information_filling_space()
+            else:
+                self.ensure_newline()
+                self._tw.write("[%s]" % rep.node.gateway.id)
+                if self._show_progress_info:
+                    self._tw.write(
+                        self._get_progress_information_message() + " ", cyan=True
+                    )
+                else:
+                    self._tw.write(" ")
+                self._tw.write(word, **markup)
+                self._tw.write(" " + line)
+                self.currentfspath = -2
+
+    def pytest_runtest_logfinish(self, nodeid):
+        if self.verbosity <= 0 and self._show_progress_info:
+            self._progress_nodeids_reported.add(nodeid)
+            last_item = len(
+                self._progress_nodeids_reported
+            ) == self._session.testscollected
+            if last_item:
+                self._write_progress_information_filling_space()
+            else:
+                past_edge = self._tw.chars_on_current_line + self._PROGRESS_LENGTH + 1 >= self._screen_width
+                if past_edge:
+                    msg = self._get_progress_information_message()
+                    self._tw.write(msg + "\n", cyan=True)
+
+    _PROGRESS_LENGTH = len(" [100%]")
+
+    def _get_progress_information_message(self):
+        if self.config.getoption("capture") == "no":
+            return ""
+        collected = self._session.testscollected
+        if collected:
+            progress = len(self._progress_nodeids_reported) * 100 // collected
+            return " [{:3d}%]".format(progress)
+        return " [100%]"
+
+    def _write_progress_information_filling_space(self):
+        msg = self._get_progress_information_message()
+        fill = " " * (
+            self._tw.fullwidth - self._tw.chars_on_current_line - len(msg) - 1
+        )
+        self.write(fill + msg, cyan=True)
+
+    def pytest_collection(self):
+        if not self.isatty and self.config.option.verbose >= 1:
+            self.write("collecting ... ", bold=True)
+
+    def pytest_collectreport(self, report):
+        if report.failed:
+            self.stats.setdefault("error", []).append(report)
+        elif report.skipped:
+            self.stats.setdefault("skipped", []).append(report)
+        items = [x for x in report.result if isinstance(x, pytest.Item)]
+        self._numcollected += len(items)
+        if self.isatty:
+            # self.write_fspath_result(report.nodeid, 'E')
+            self.report_collect()
+
+    def report_collect(self, final=False):
+        if self.config.option.verbose < 0:
+            return
+
+        errors = len(self.stats.get("error", []))
+        skipped = len(self.stats.get("skipped", []))
+        deselected = len(self.stats.get("deselected", []))
+        if final:
+            line = "collected "
+        else:
+            line = "collecting "
+        line += str(self._numcollected) + " item" + (
+            "" if self._numcollected == 1 else "s"
+        )
+        if errors:
+            line += " / %d errors" % errors
+        if deselected:
+            line += " / %d deselected" % deselected
+        if skipped:
+            line += " / %d skipped" % skipped
+        if self.isatty:
+            self.rewrite(line, bold=True, erase=True)
+            if final:
+                self.write("\n")
+        else:
+            self.write_line(line)
+
+    @pytest.hookimpl(trylast=True)
+    def pytest_collection_modifyitems(self):
+        self.report_collect(True)
+
+    @pytest.hookimpl(trylast=True)
+    def pytest_sessionstart(self, session):
+        self._session = session
+        self._sessionstarttime = time.time()
+        if not self.showheader:
+            return
+        self.write_sep("=", "test session starts", bold=True)
+        verinfo = platform.python_version()
+        msg = "platform %s -- Python %s" % (sys.platform, verinfo)
+        if hasattr(sys, "pypy_version_info"):
+            verinfo = ".".join(map(str, sys.pypy_version_info[:3]))
+            msg += "[pypy-%s-%s]" % (verinfo, sys.pypy_version_info[3])
+        msg += ", pytest-%s, py-%s, pluggy-%s" % (
+            pytest.__version__, py.__version__, pluggy.__version__
+        )
+        if (
+            self.verbosity > 0
+            or self.config.option.debug
+            or getattr(self.config.option, "pastebin", None)
+        ):
+            msg += " -- " + str(sys.executable)
+        self.write_line(msg)
+        lines = self.config.hook.pytest_report_header(
+            config=self.config, startdir=self.startdir
+        )
+        self._write_report_lines_from_hooks(lines)
+
+    def _write_report_lines_from_hooks(self, lines):
+        lines.reverse()
+        for line in collapse(lines):
+            self.write_line(line)
+
+    def pytest_report_header(self, config):
+        inifile = ""
+        if config.inifile:
+            inifile = " " + config.rootdir.bestrelpath(config.inifile)
+        lines = ["rootdir: %s, inifile:%s" % (config.rootdir, inifile)]
+
+        plugininfo = config.pluginmanager.list_plugin_distinfo()
+        if plugininfo:
+
+            lines.append("plugins: %s" % ", ".join(_plugin_nameversions(plugininfo)))
+        return lines
+
+    def pytest_collection_finish(self, session):
+        if self.config.option.collectonly:
+            self._printcollecteditems(session.items)
+            if self.stats.get("failed"):
+                self._tw.sep("!", "collection failures")
+                for rep in self.stats.get("failed"):
+                    rep.toterminal(self._tw)
+                return 1
+            return 0
+        lines = self.config.hook.pytest_report_collectionfinish(
+            config=self.config, startdir=self.startdir, items=session.items
+        )
+        self._write_report_lines_from_hooks(lines)
+
+    def _printcollecteditems(self, items):
+        # to print out items and their parent collectors
+        # we take care to leave out Instances aka ()
+        # because later versions are going to get rid of them anyway
+        if self.config.option.verbose < 0:
+            if self.config.option.verbose < -1:
+                counts = {}
+                for item in items:
+                    name = item.nodeid.split("::", 1)[0]
+                    counts[name] = counts.get(name, 0) + 1
+                for name, count in sorted(counts.items()):
+                    self._tw.line("%s: %d" % (name, count))
+            else:
+                for item in items:
+                    nodeid = item.nodeid
+                    nodeid = nodeid.replace("::()::", "::")
+                    self._tw.line(nodeid)
+            return
+        stack = []
+        indent = ""
+        for item in items:
+            needed_collectors = item.listchain()[1:]  # strip root node
+            while stack:
+                if stack == needed_collectors[:len(stack)]:
+                    break
+                stack.pop()
+            for col in needed_collectors[len(stack):]:
+                stack.append(col)
+                # if col.name == "()":
+                #    continue
+                indent = (len(stack) - 1) * "  "
+                self._tw.line("%s%s" % (indent, col))
+
+    @pytest.hookimpl(hookwrapper=True)
+    def pytest_sessionfinish(self, exitstatus):
+        outcome = yield
+        outcome.get_result()
+        self._tw.line("")
+        summary_exit_codes = (
+            EXIT_OK,
+            EXIT_TESTSFAILED,
+            EXIT_INTERRUPTED,
+            EXIT_USAGEERROR,
+            EXIT_NOTESTSCOLLECTED,
+        )
+        if exitstatus in summary_exit_codes:
+            self.config.hook.pytest_terminal_summary(
+                terminalreporter=self, exitstatus=exitstatus
+            )
+        if exitstatus == EXIT_INTERRUPTED:
+            self._report_keyboardinterrupt()
+            del self._keyboardinterrupt_memo
+        self.summary_stats()
+
+    @pytest.hookimpl(hookwrapper=True)
+    def pytest_terminal_summary(self):
+        self.summary_errors()
+        self.summary_failures()
+        yield
+        self.summary_warnings()
+        self.summary_passes()
+
+    def pytest_keyboard_interrupt(self, excinfo):
+        self._keyboardinterrupt_memo = excinfo.getrepr(funcargs=True)
+
+    def pytest_unconfigure(self):
+        if hasattr(self, "_keyboardinterrupt_memo"):
+            self._report_keyboardinterrupt()
+
+    def _report_keyboardinterrupt(self):
+        excrepr = self._keyboardinterrupt_memo
+        msg = excrepr.reprcrash.message
+        self.write_sep("!", msg)
+        if "KeyboardInterrupt" in msg:
+            if self.config.option.fulltrace:
+                excrepr.toterminal(self._tw)
+            else:
+                excrepr.reprcrash.toterminal(self._tw)
+                self._tw.line(
+                    "(to show a full traceback on KeyboardInterrupt use --fulltrace)",
+                    yellow=True,
+                )
+
+    def _locationline(self, nodeid, fspath, lineno, domain):
+
+        def mkrel(nodeid):
+            line = self.config.cwd_relative_nodeid(nodeid)
+            if domain and line.endswith(domain):
+                line = line[:-len(domain)]
+                values = domain.split("[")
+                values[0] = values[0].replace(".", "::")  # don't replace '.' in params
+                line += "[".join(values)
+            return line
+
+        # collect_fspath comes from testid which has a "/"-normalized path
+
+        if fspath:
+            res = mkrel(nodeid).replace("::()", "")  # parens-normalization
+            if nodeid.split("::")[0] != fspath.replace("\\", nodes.SEP):
+                res += " <- " + self.startdir.bestrelpath(fspath)
+        else:
+            res = "[location]"
+        return res + " "
+
+    def _getfailureheadline(self, rep):
+        if hasattr(rep, "location"):
+            fspath, lineno, domain = rep.location
+            return domain
+        else:
+            return "test session"  # XXX?
+
+    def _getcrashline(self, rep):
+        try:
+            return str(rep.longrepr.reprcrash)
+        except AttributeError:
+            try:
+                return str(rep.longrepr)[:50]
+            except AttributeError:
+                return ""
+
+    #
+    # summaries for sessionfinish
+    #
+    def getreports(self, name):
+        values = []
+        for x in self.stats.get(name, []):
+            if not hasattr(x, "_pdbshown"):
+                values.append(x)
+        return values
+
+    def summary_warnings(self):
+        if self.hasopt("w"):
+            all_warnings = self.stats.get("warnings")
+            if not all_warnings:
+                return
+
+            grouped = itertools.groupby(
+                all_warnings, key=lambda wr: wr.get_location(self.config)
+            )
+
+            self.write_sep("=", "warnings summary", yellow=True, bold=False)
+            for location, warning_records in grouped:
+                self._tw.line(str(location) if location else "<undetermined location>")
+                for w in warning_records:
+                    lines = w.message.splitlines()
+                    indented = "\n".join("  " + x for x in lines)
+                    self._tw.line(indented)
+                self._tw.line()
+            self._tw.line("-- Docs: http://doc.pytest.org/en/latest/warnings.html")
+
+    def summary_passes(self):
+        if self.config.option.tbstyle != "no":
+            if self.hasopt("P"):
+                reports = self.getreports("passed")
+                if not reports:
+                    return
+                self.write_sep("=", "PASSES")
+                for rep in reports:
+                    msg = self._getfailureheadline(rep)
+                    self.write_sep("_", msg)
+                    self._outrep_summary(rep)
+
+    def print_teardown_sections(self, rep):
+        for secname, content in rep.sections:
+            if "teardown" in secname:
+                self._tw.sep("-", secname)
+                if content[-1:] == "\n":
+                    content = content[:-1]
+                self._tw.line(content)
+
+    def summary_failures(self):
+        if self.config.option.tbstyle != "no":
+            reports = self.getreports("failed")
+            if not reports:
+                return
+            self.write_sep("=", "FAILURES")
+            for rep in reports:
+                if self.config.option.tbstyle == "line":
+                    line = self._getcrashline(rep)
+                    self.write_line(line)
+                else:
+                    msg = self._getfailureheadline(rep)
+                    markup = {"red": True, "bold": True}
+                    self.write_sep("_", msg, **markup)
+                    self._outrep_summary(rep)
+                    for report in self.getreports(""):
+                        if report.nodeid == rep.nodeid and report.when == "teardown":
+                            self.print_teardown_sections(report)
+
+    def summary_errors(self):
+        if self.config.option.tbstyle != "no":
+            reports = self.getreports("error")
+            if not reports:
+                return
+            self.write_sep("=", "ERRORS")
+            for rep in self.stats["error"]:
+                msg = self._getfailureheadline(rep)
+                if not hasattr(rep, "when"):
+                    # collect
+                    msg = "ERROR collecting " + msg
+                elif rep.when == "setup":
+                    msg = "ERROR at setup of " + msg
+                elif rep.when == "teardown":
+                    msg = "ERROR at teardown of " + msg
+                self.write_sep("_", msg)
+                self._outrep_summary(rep)
+
+    def _outrep_summary(self, rep):
+        rep.toterminal(self._tw)
+        showcapture = self.config.option.showcapture
+        if showcapture == "no":
+            return
+        for secname, content in rep.sections:
+            if showcapture != "all" and showcapture not in secname:
+                continue
+            self._tw.sep("-", secname)
+            if content[-1:] == "\n":
+                content = content[:-1]
+            self._tw.line(content)
+
+    def summary_stats(self):
+        session_duration = time.time() - self._sessionstarttime
+        (line, color) = build_summary_stats_line(self.stats)
+        msg = "%s in %.2f seconds" % (line, session_duration)
+        markup = {color: True, "bold": True}
+
+        if self.verbosity >= 0:
+            self.write_sep("=", msg, **markup)
+        if self.verbosity == -1:
+            self.write_line(msg, **markup)
+
+
+def repr_pythonversion(v=None):
+    if v is None:
+        v = sys.version_info
+    try:
+        return "%s.%s.%s-%s-%s" % v
+    except (TypeError, ValueError):
+        return str(v)
+
+
+def build_summary_stats_line(stats):
+    keys = (
+        "failed passed skipped deselected " "xfailed xpassed warnings error"
+    ).split()
+    unknown_key_seen = False
+    for key in stats.keys():
+        if key not in keys:
+            if key:  # setup/teardown reports have an empty key, ignore them
+                keys.append(key)
+                unknown_key_seen = True
+    parts = []
+    for key in keys:
+        val = stats.get(key, None)
+        if val:
+            parts.append("%d %s" % (len(val), key))
+
+    if parts:
+        line = ", ".join(parts)
+    else:
+        line = "no tests ran"
+
+    if "failed" in stats or "error" in stats:
+        color = "red"
+    elif "warnings" in stats or unknown_key_seen:
+        color = "yellow"
+    elif "passed" in stats:
+        color = "green"
+    else:
+        color = "yellow"
+
+    return (line, color)
+
+
+def _plugin_nameversions(plugininfo):
+    values = []
+    for plugin, dist in plugininfo:
+        # gets us name and version!
+        name = "{dist.project_name}-{dist.version}".format(dist=dist)
+        # questionable convenience, but it keeps things short
+        if name.startswith("pytest-"):
+            name = name[7:]
+        # we decided to print python package names
+        # they can have more than one plugin
+        if name not in values:
+            values.append(name)
+    return values
new file mode 100644
--- /dev/null
+++ b/third_party/python/pytest/src/_pytest/tmpdir.py
@@ -0,0 +1,131 @@
+""" support for providing temporary directories to test functions.  """
+from __future__ import absolute_import, division, print_function
+
+import re
+
+import pytest
+import py
+from _pytest.monkeypatch import MonkeyPatch
+
+
+class TempdirFactory(object):
+    """Factory for temporary directories under the common base temp directory.
+
+    The base directory can be configured using the ``--basetemp`` option.
+    """
+
+    def __init__(self, config):
+        self.config = config
+        self.trace = config.trace.get("tmpdir")
+
+    def ensuretemp(self, string, dir=1):
+        """ (deprecated) return temporary directory path with
+            the given string as the trailing part.  It is usually
+            better to use the 'tmpdir' function argument which
+            provides an empty unique-per-test-invocation directory
+            and is guaranteed to be empty.
+        """
+        # py.log._apiwarn(">1.1", "use tmpdir function argument")
+        return self.getbasetemp().ensure(string, dir=dir)
+
+    def mktemp(self, basename, numbered=True):
+        """Create a subdirectory of the base temporary directory and return it.
+        If ``numbered``, ensure the directory is unique by adding a number
+        prefix greater than any existing one.
+        """
+        basetemp = self.getbasetemp()
+        if not numbered:
+            p = basetemp.mkdir(basename)
+        else:
+            p = py.path.local.make_numbered_dir(
+                prefix=basename, keep=0, rootdir=basetemp, lock_timeout=None
+            )
+        self.trace("mktemp", p)
+        return p
+
+    def getbasetemp(self):
+        """ return base temporary directory. """
+        try:
+            return self._basetemp
+        except AttributeError:
+            basetemp = self.config.option.basetemp
+            if basetemp:
+                basetemp = py.path.local(basetemp)
+                if basetemp.check():
+                    basetemp.remove()
+                basetemp.mkdir()
+            else:
+                temproot = py.path.local.get_temproot()
+                user = get_user()
+                if user:
+                    # use a sub-directory in the temproot to speed-up
+                    # make_numbered_dir() call
+                    rootdir = temproot.join("pytest-of-%s" % user)
+                else:
+                    rootdir = temproot
+                rootdir.ensure(dir=1)
+                basetemp = py.path.local.make_numbered_dir(
+                    prefix="pytest-", rootdir=rootdir
+                )
+            self._basetemp = t = basetemp.realpath()
+            self.trace("new basetemp", t)
+            return t
+
+    def finish(self):
+        self.trace("finish")
+
+
+def get_user():
+    """Return the current user name, or None if getuser() does not work
+    in the current environment (see #1010).
+    """
+    import getpass
+
+    try:
+        return getpass.getuser()
+    except (ImportError, KeyError):
+        return None
+
+
+# backward compatibility
+TempdirHandler = TempdirFactory
+
+
+def pytest_configure(config):
+    """Create a TempdirFactory and attach it to the config object.
+
+    This is to comply with existing plugins which expect the handler to be
+    available at pytest_configure time, but ideally should be moved entirely
+    to the tmpdir_factory session fixture.
+    """
+    mp = MonkeyPatch()
+    t = TempdirFactory(config)
+    config._cleanup.extend([mp.undo, t.finish])
+    mp.setattr(config, "_tmpdirhandler", t, raising=False)
+    mp.setattr(pytest, "ensuretemp", t.ensuretemp, raising=False)
+
+
+@pytest.fixture(scope="session")
+def tmpdir_factory(request):
+    """Return a TempdirFactory instance for the test session.
+    """
+    return request.config._tmpdirhandler
+
+
+@pytest.fixture
+def tmpdir(request, tmpdir_factory):
+    """Return a temporary directory path object
+    which is unique to each test function invocation,
+    created as a sub directory of the base temporary
+    directory.  The returned object is a `py.path.local`_
+    path object.
+
+    .. _`py.path.local`: https://py.readthedocs.io/en/latest/path.html
+    """
+    name = request.node.name
+    name = re.sub(r"[\W]", "_", name)
+    MAXVAL = 30
+    if len(name) > MAXVAL:
+        name = name[:MAXVAL]
+    x = tmpdir_factory.mktemp(name, numbered=True)
+    return x
new file mode 100644
--- /dev/null
+++ b/third_party/python/pytest/src/_pytest/unittest.py
@@ -0,0 +1,253 @@
+""" discovery and running of std-library "unittest" style tests. """
+from __future__ import absolute_import, division, print_function
+
+import sys
+import traceback
+
+# for transferring markers
+import _pytest._code
+from _pytest.config import hookimpl
+from _pytest.outcomes import fail, skip, xfail
+from _pytest.python import transfer_markers, Class, Module, Function
+
+
+def pytest_pycollect_makeitem(collector, name, obj):
+    # has unittest been imported and is obj a subclass of its TestCase?
+    try:
+        if not issubclass(obj, sys.modules["unittest"].TestCase):
+            return
+    except Exception:
+        return
+    # yes, so let's collect it
+    return UnitTestCase(name, parent=collector)
+
+
+class UnitTestCase(Class):
+    # marker for fixturemanger.getfixtureinfo()
+    # to declare that our children do not support funcargs
+    nofuncargs = True
+
+    def setup(self):
+        cls = self.obj
+        if getattr(cls, "__unittest_skip__", False):
+            return  # skipped
+        setup = getattr(cls, "setUpClass", None)
+        if setup is not None:
+            setup()
+        teardown = getattr(cls, "tearDownClass", None)
+        if teardown is not None:
+            self.addfinalizer(teardown)
+        super(UnitTestCase, self).setup()
+
+    def collect(self):
+        from unittest import TestLoader
+
+        cls = self.obj
+        if not getattr(cls, "__test__", True):
+            return
+        self.session._fixturemanager.parsefactories(self, unittest=True)
+        loader = TestLoader()
+        module = self.getparent(Module).obj
+        foundsomething = False
+        for name in loader.getTestCaseNames(self.obj):
+            x = getattr(self.obj, name)
+            if not getattr(x, "__test__", True):
+                continue
+            funcobj = getattr(x, "im_func", x)
+            transfer_markers(funcobj, cls, module)
+            yield TestCaseFunction(name, parent=self, callobj=funcobj)
+            foundsomething = True
+
+        if not foundsomething:
+            runtest = getattr(self.obj, "runTest", None)
+            if runtest is not None:
+                ut = sys.modules.get("twisted.trial.unittest", None)
+                if ut is None or runtest != ut.TestCase.runTest:
+                    yield TestCaseFunction("runTest", parent=self)
+
+
+class TestCaseFunction(Function):
+    nofuncargs = True
+    _excinfo = None
+
+    def setup(self):
+        self._testcase = self.parent.obj(self.name)
+        self._fix_unittest_skip_decorator()
+        self._obj = getattr(self._testcase, self.name)
+        if hasattr(self._testcase, "setup_method"):
+            self._testcase.setup_method(self._obj)
+        if hasattr(self, "_request"):
+            self._request._fillfixtures()
+
+    def _fix_unittest_skip_decorator(self):
+        """
+        The @unittest.skip decorator calls functools.wraps(self._testcase)
+        The call to functools.wraps() fails unless self._testcase
+        has a __name__ attribute. This is usually automatically supplied
+        if the test is a function or method, but we need to add manually
+        here.
+
+        See issue #1169
+        """
+        if sys.version_info[0] == 2:
+            setattr(self._testcase, "__name__", self.name)
+
+    def teardown(self):
+        if hasattr(self._testcase, "teardown_method"):
+            self._testcase.teardown_method(self._obj)
+        # Allow garbage collection on TestCase instance attributes.
+        self._testcase = None
+        self._obj = None
+
+    def startTest(self, testcase):
+        pass
+
+    def _addexcinfo(self, rawexcinfo):
+        # unwrap potential exception info (see twisted trial support below)
+        rawexcinfo = getattr(rawexcinfo, "_rawexcinfo", rawexcinfo)
+        try:
+            excinfo = _pytest._code.ExceptionInfo(rawexcinfo)
+        except TypeError:
+            try:
+                try:
+                    values = traceback.format_exception(*rawexcinfo)
+                    values.insert(
+                        0,
+                        "NOTE: Incompatible Exception Representation, "
+                        "displaying natively:\n\n",
+                    )
+                    fail("".join(values), pytrace=False)
+                except (fail.Exception, KeyboardInterrupt):
+                    raise
+                except:  # noqa
+                    fail(
+                        "ERROR: Unknown Incompatible Exception "
+                        "representation:\n%r" % (rawexcinfo,),
+                        pytrace=False,
+                    )
+            except KeyboardInterrupt:
+                raise
+            except fail.Exception:
+                excinfo = _pytest._code.ExceptionInfo()
+        self.__dict__.setdefault("_excinfo", []).append(excinfo)
+
+    def addError(self, testcase, rawexcinfo):
+        self._addexcinfo(rawexcinfo)
+
+    def addFailure(self, testcase, rawexcinfo):
+        self._addexcinfo(rawexcinfo)
+
+    def addSkip(self, testcase, reason):
+        try:
+            skip(reason)
+        except skip.Exception:
+            self._skipped_by_mark = True
+            self._addexcinfo(sys.exc_info())
+
+    def addExpectedFailure(self, testcase, rawexcinfo, reason=""):
+        try:
+            xfail(str(reason))
+        except xfail.Exception:
+            self._addexcinfo(sys.exc_info())
+
+    def addUnexpectedSuccess(self, testcase, reason=""):
+        self._unexpectedsuccess = reason
+
+    def addSuccess(self, testcase):
+        pass
+
+    def stopTest(self, testcase):
+        pass
+
+    def _handle_skip(self):
+        # implements the skipping machinery (see #2137)
+        # analog to pythons Lib/unittest/case.py:run
+        testMethod = getattr(self._testcase, self._testcase._testMethodName)
+        if (
+            getattr(self._testcase.__class__, "__unittest_skip__", False)
+            or getattr(testMethod, "__unittest_skip__", False)
+        ):
+            # If the class or method was skipped.
+            skip_why = (
+                getattr(self._testcase.__class__, "__unittest_skip_why__", "")
+                or getattr(testMethod, "__unittest_skip_why__", "")
+            )
+            try:  # PY3, unittest2 on PY2
+                self._testcase._addSkip(self, self._testcase, skip_why)
+            except TypeError:  # PY2
+                if sys.version_info[0] != 2:
+                    raise
+                self._testcase._addSkip(self, skip_why)
+            return True
+        return False
+
+    def runtest(self):
+        if self.config.pluginmanager.get_plugin("pdbinvoke") is None:
+            self._testcase(result=self)
+        else:
+            # disables tearDown and cleanups for post mortem debugging (see #1890)
+            if self._handle_skip():
+                return
+            self._testcase.debug()
+
+    def _prunetraceback(self, excinfo):
+        Function._prunetraceback(self, excinfo)
+        traceback = excinfo.traceback.filter(
+            lambda x: not x.frame.f_globals.get("__unittest")
+        )
+        if traceback:
+            excinfo.traceback = traceback
+
+
+@hookimpl(tryfirst=True)
+def pytest_runtest_makereport(item, call):
+    if isinstance(item, TestCaseFunction):
+        if item._excinfo:
+            call.excinfo = item._excinfo.pop(0)
+            try:
+                del call.result
+            except AttributeError:
+                pass
+
+
+# twisted trial support
+
+
+@hookimpl(hookwrapper=True)
+def pytest_runtest_protocol(item):
+    if isinstance(item, TestCaseFunction) and "twisted.trial.unittest" in sys.modules:
+        ut = sys.modules["twisted.python.failure"]
+        Failure__init__ = ut.Failure.__init__
+        check_testcase_implements_trial_reporter()
+
+        def excstore(
+            self, exc_value=None, exc_type=None, exc_tb=None, captureVars=None
+        ):
+            if exc_value is None:
+                self._rawexcinfo = sys.exc_info()
+            else:
+                if exc_type is None:
+                    exc_type = type(exc_value)
+                self._rawexcinfo = (exc_type, exc_value, exc_tb)
+            try:
+                Failure__init__(
+                    self, exc_value, exc_type, exc_tb, captureVars=captureVars
+                )
+            except TypeError:
+                Failure__init__(self, exc_value, exc_type, exc_tb)
+
+        ut.Failure.__init__ = excstore
+        yield
+        ut.Failure.__init__ = Failure__init__
+    else:
+        yield
+
+
+def check_testcase_implements_trial_reporter(done=[]):
+    if done:
+        return
+    from zope.interface import classImplements
+    from twisted.trial.itrial import IReporter
+
+    classImplements(TestCaseFunction, IReporter)
+    done.append(1)
new file mode 100644
--- /dev/null
+++ b/third_party/python/pytest/src/_pytest/warnings.py
@@ -0,0 +1,112 @@
+from __future__ import absolute_import, division, print_function
+
+import warnings
+from contextlib import contextmanager
+
+import pytest
+
+from _pytest import compat
+
+
+def _setoption(wmod, arg):
+    """
+    Copy of the warning._setoption function but does not escape arguments.
+    """
+    parts = arg.split(":")
+    if len(parts) > 5:
+        raise wmod._OptionError("too many fields (max 5): %r" % (arg,))
+    while len(parts) < 5:
+        parts.append("")
+    action, message, category, module, lineno = [s.strip() for s in parts]
+    action = wmod._getaction(action)
+    category = wmod._getcategory(category)
+    if lineno:
+        try:
+            lineno = int(lineno)
+            if lineno < 0:
+                raise ValueError
+        except (ValueError, OverflowError):
+            raise wmod._OptionError("invalid lineno %r" % (lineno,))
+    else:
+        lineno = 0
+    wmod.filterwarnings(action, message, category, module, lineno)
+
+
+def pytest_addoption(parser):
+    group = parser.getgroup("pytest-warnings")
+    group.addoption(
+        "-W",
+        "--pythonwarnings",
+        action="append",
+        help="set which warnings to report, see -W option of python itself.",
+    )
+    parser.addini(
+        "filterwarnings",
+        type="linelist",
+        help="Each line specifies a pattern for "
+        "warnings.filterwarnings. "
+        "Processed after -W and --pythonwarnings.",
+    )
+
+
+@contextmanager
+def catch_warnings_for_item(item):
+    """
+    catches the warnings generated during setup/call/teardown execution
+    of the given item and after it is done posts them as warnings to this
+    item.
+    """
+    args = item.config.getoption("pythonwarnings") or []
+    inifilters = item.config.getini("filterwarnings")
+    with warnings.catch_warnings(record=True) as log:
+        for arg in args:
+            warnings._setoption(arg)
+
+        for arg in inifilters:
+            _setoption(warnings, arg)
+
+        for mark in item.iter_markers(name="filterwarnings"):
+            for arg in mark.args:
+                warnings._setoption(arg)
+
+        yield
+
+        for warning in log:
+            warn_msg = warning.message
+            unicode_warning = False
+
+            if (
+                compat._PY2
+                and any(isinstance(m, compat.UNICODE_TYPES) for m in warn_msg.args)
+            ):
+                new_args = []
+                for m in warn_msg.args:
+                    new_args.append(
+                        compat.ascii_escaped(m)
+                        if isinstance(m, compat.UNICODE_TYPES)
+                        else m
+                    )
+                unicode_warning = list(warn_msg.args) != new_args
+                warn_msg.args = new_args
+
+            msg = warnings.formatwarning(
+                warn_msg,
+                warning.category,
+                warning.filename,
+                warning.lineno,
+                warning.line,
+            )
+            item.warn("unused", msg)
+
+            if unicode_warning:
+                warnings.warn(
+                    "Warning is using unicode non convertible to ascii, "
+                    "converting to a safe representation:\n  %s" % msg,
+                    UnicodeWarning,
+                )
+
+
+@pytest.hookimpl(hookwrapper=True)
+def pytest_runtest_protocol(item):
+    with catch_warnings_for_item(item):
+        yield
new file mode 100644
--- /dev/null
+++ b/third_party/python/pytest/src/pytest.py
@@ -0,0 +1,72 @@
+# PYTHON_ARGCOMPLETE_OK
+"""
+pytest: unit and functional testing with Python.
+"""
+
+
+# else we are imported
+
+from _pytest.config import main, UsageError, cmdline, hookspec, hookimpl
+from _pytest.fixtures import fixture, yield_fixture
+from _pytest.assertion import register_assert_rewrite
+from _pytest.freeze_support import freeze_includes
+from _pytest import __version__
+from _pytest.debugging import pytestPDB as __pytestPDB
+from _pytest.recwarn import warns, deprecated_call
+from _pytest.outcomes import fail, skip, importorskip, exit, xfail
+from _pytest.mark import MARK_GEN as mark, param
+from _pytest.main import Session
+from _pytest.nodes import Item, Collector, File
+from _pytest.fixtures import fillfixtures as _fillfuncargs
+from _pytest.python import Module, Class, Instance, Function, Generator
+
+from _pytest.python_api import approx, raises
+
+set_trace = __pytestPDB.set_trace
+
+__all__ = [
+    "main",
+    "UsageError",
+    "cmdline",
+    "hookspec",
+    "hookimpl",
+    "__version__",
+    "register_assert_rewrite",
+    "freeze_includes",
+    "set_trace",
+    "warns",
+    "deprecated_call",
+    "fixture",
+    "yield_fixture",
+    "fail",
+    "skip",
+    "xfail",
+    "importorskip",
+    "exit",
+    "mark",
+    "param",
+    "approx",
+    "_fillfuncargs",
+    "Item",
+    "File",
+    "Collector",
+    "Session",
+    "Module",
+    "Class",
+    "Instance",
+    "Function",
+    "Generator",
+    "raises",
+]
+
+if __name__ == "__main__":
+    # if run as a script or by 'python -m pytest'
+    # we trigger the below "else" condition by the following import
+    import pytest
+
+    raise SystemExit(pytest.main())
+else:
+
+    from _pytest.compat import _setup_collect_fakemodule
+
+    _setup_collect_fakemodule()
--- a/third_party/python/pytest/tasks/__init__.py
+++ b/third_party/python/pytest/tasks/__init__.py
@@ -1,13 +1,10 @@
 """
 Invoke tasks to help with pytest development and release process.
 """
 
 import invoke
 
-from . import generate, vendoring
+from . import generate
 
 
-ns = invoke.Collection(
-    generate,
-    vendoring
-)
+ns = invoke.Collection(generate)
--- a/third_party/python/pytest/tasks/generate.py
+++ b/third_party/python/pytest/tasks/generate.py
@@ -1,162 +1,118 @@
-import os
+"""
+Invoke development tasks.
+"""
 from pathlib import Path
 from subprocess import check_output, check_call
 
 import invoke
 
 
-@invoke.task(help={
-    'version': 'version being released',
-})
+@invoke.task(help={"version": "version being released"})
 def announce(ctx, version):
     """Generates a new release announcement entry in the docs."""
     # Get our list of authors
-    stdout = check_output(["git", "describe", "--abbrev=0", '--tags'])
-    stdout = stdout.decode('utf-8')
+    stdout = check_output(["git", "describe", "--abbrev=0", "--tags"])
+    stdout = stdout.decode("utf-8")
     last_version = stdout.strip()
 
-    stdout = check_output(["git", "log", "{}..HEAD".format(last_version), "--format=%aN"])
-    stdout = stdout.decode('utf-8')
+    stdout = check_output(
+        ["git", "log", "{}..HEAD".format(last_version), "--format=%aN"]
+    )
+    stdout = stdout.decode("utf-8")
 
     contributors = set(stdout.splitlines())
 
-    template_name = 'release.minor.rst' if version.endswith('.0') else 'release.patch.rst'
-    template_text = Path(__file__).parent.joinpath(template_name).read_text(encoding='UTF-8')
+    template_name = "release.minor.rst" if version.endswith(
+        ".0"
+    ) else "release.patch.rst"
+    template_text = Path(__file__).parent.joinpath(template_name).read_text(
+        encoding="UTF-8"
+    )
 
-    contributors_text = '\n'.join('* {}'.format(name) for name in sorted(contributors)) + '\n'
+    contributors_text = "\n".join(
+        "* {}".format(name) for name in sorted(contributors)
+    ) + "\n"
     text = template_text.format(version=version, contributors=contributors_text)
 
-    target = Path(__file__).parent.joinpath('../doc/en/announce/release-{}.rst'.format(version))
-    target.write_text(text, encoding='UTF-8')
+    target = Path(__file__).parent.joinpath(
+        "../doc/en/announce/release-{}.rst".format(version)
+    )
+    target.write_text(text, encoding="UTF-8")
     print("[generate.announce] Generated {}".format(target.name))
 
     # Update index with the new release entry
-    index_path = Path(__file__).parent.joinpath('../doc/en/announce/index.rst')
-    lines = index_path.read_text(encoding='UTF-8').splitlines()
-    indent = '   '
+    index_path = Path(__file__).parent.joinpath("../doc/en/announce/index.rst")
+    lines = index_path.read_text(encoding="UTF-8").splitlines()
+    indent = "   "
     for index, line in enumerate(lines):
-        if line.startswith('{}release-'.format(indent)):
+        if line.startswith("{}release-".format(indent)):
             new_line = indent + target.stem
             if line != new_line:
                 lines.insert(index, new_line)
-                index_path.write_text('\n'.join(lines) + '\n', encoding='UTF-8')
+                index_path.write_text("\n".join(lines) + "\n", encoding="UTF-8")
                 print("[generate.announce] Updated {}".format(index_path.name))
             else:
-                print("[generate.announce] Skip {} (already contains release)".format(index_path.name))
+                print(
+                    "[generate.announce] Skip {} (already contains release)".format(
+                        index_path.name
+                    )
+                )
             break
 
-    check_call(['git', 'add', str(target)])
+    check_call(["git", "add", str(target)])
 
 
 @invoke.task()
 def regen(ctx):
     """Call regendoc tool to update examples and pytest output in the docs."""
     print("[generate.regen] Updating docs")
-    check_call(['tox', '-e', 'regen'])
+    check_call(["tox", "-e", "regen"])
 
 
 @invoke.task()
 def make_tag(ctx, version):
-    """Create a new (local) tag for the release, only if the repository is clean."""
+    """Create a new, local tag for the release, only if the repository is clean."""
     from git import Repo
 
-    repo = Repo('.')
+    repo = Repo(".")
     if repo.is_dirty():
-        print('Current repository is dirty. Please commit any changes and try again.')
+        print("Current repository is dirty. Please commit any changes and try again.")
         raise invoke.Exit(code=2)
 
     tag_names = [x.name for x in repo.tags]
     if version in tag_names:
         print("[generate.make_tag] Delete existing tag {}".format(version))
         repo.delete_tag(version)
 
     print("[generate.make_tag] Create tag {}".format(version))
     repo.create_tag(version)
 
 
-@invoke.task()
-def devpi_upload(ctx, version, user, password=None):
-    """Creates and uploads a package to devpi for testing."""
-    if password:
-        print("[generate.devpi_upload] devpi login {}".format(user))
-        check_call(['devpi', 'login', user, '--password', password])
-
-    check_call(['devpi', 'use', 'https://devpi.net/{}/dev'.format(user)])
-    
-    env = os.environ.copy()
-    env['SETUPTOOLS_SCM_PRETEND_VERSION'] = version
-    check_call(['devpi', 'upload', '--formats', 'sdist,bdist_wheel'], env=env)
-    print("[generate.devpi_upload] package uploaded")
-
-
-@invoke.task(help={
-    'version': 'version being released',
-    'user': 'name of the user on devpi to stage the generated package',
-    'password': 'user password on devpi to stage the generated package '
-                '(if not given assumed logged in)',
-})
-def pre_release(ctx, version, user, password=None):
-    """Generates new docs, release announcements and uploads a new release to devpi for testing."""
+@invoke.task(help={"version": "version being released"})
+def pre_release(ctx, version):
+    """Generates new docs, release announcements and creates a local tag."""
     announce(ctx, version)
     regen(ctx)
     changelog(ctx, version, write_out=True)
 
-    msg = 'Preparing release version {}'.format(version)
-    check_call(['git', 'commit', '-a', '-m', msg])
-    
+    msg = "Preparing release version {}".format(version)
+    check_call(["git", "commit", "-a", "-m", msg])
+
     make_tag(ctx, version)
 
-    devpi_upload(ctx, version=version, user=user, password=password)
-    
     print()
-    print('[generate.pre_release] Please push your branch and open a PR.')
+    print("[generate.pre_release] Please push your branch and open a PR.")
 
 
-@invoke.task(help={
-    'version': 'version being released',
-    'user': 'name of the user on devpi to stage the generated package',
-    'pypi_name': 'name of the pypi configuration section in your ~/.pypirc',
-})
-def publish_release(ctx, version, user, pypi_name):
-    """Publishes a package previously created by the 'pre_release' command."""
-    from git import Repo
-    repo = Repo('.')
-    tag_names = [x.name for x in repo.tags]
-    if version not in tag_names:
-        print('Could not find tag for version {}, exiting...'.format(version))
-        raise invoke.Exit(code=2)
-
-    check_call(['devpi', 'use', 'https://devpi.net/{}/dev'.format(user)])
-    check_call(['devpi', 'push', 'pytest=={}'.format(version), 'pypi:{}'.format(pypi_name)])
-    check_call(['git', 'push', 'git@github.com:pytest-dev/pytest.git', version])
-
-    emails = [
-        'pytest-dev@python.org',
-        'python-announce-list@python.org'
-    ]
-    if version.endswith('.0'):
-        emails.append('testing-in-python@lists.idyll.org')
-    print('Version {} has been published to PyPI!'.format(version))
-    print()
-    print('Please send an email announcement with the contents from:')
-    print()
-    print('  doc/en/announce/release-{}.rst'.format(version))
-    print()
-    print('To the following mail lists:')
-    print()
-    print(' ', ','.join(emails))
-    print()
-    print('And announce it on twitter adding the #pytest hash tag.')
-
-
-@invoke.task(help={
-    'version': 'version being released',
-    'write_out': 'write changes to the actial changelog'
-})
+@invoke.task(
+    help={
+        "version": "version being released",
+        "write_out": "write changes to the actual changelog",
+    }
+)
 def changelog(ctx, version, write_out=False):
     if write_out:
         addopts = []
     else:
-        addopts = ['--draft']
-    check_call(['towncrier', '--version', version] + addopts)
-
+        addopts = ["--draft"]
+    check_call(["towncrier", "--yes", "--version", version] + addopts)
--- a/third_party/python/pytest/tasks/release.minor.rst
+++ b/third_party/python/pytest/tasks/release.minor.rst
@@ -1,14 +1,14 @@
 pytest-{version}
 =======================================
 
 The pytest team is proud to announce the {version} release!
 
-pytest is a mature Python testing tool with more than a 1600 tests
+pytest is a mature Python testing tool with more than a 2000 tests
 against itself, passing on many different interpreters and platforms.
 
 This release contains a number of bugs fixes and improvements, so users are encouraged
 to take a look at the CHANGELOG:
 
     http://doc.pytest.org/en/latest/changelog.html
 
 For complete documentation, please visit:
--- a/third_party/python/pytest/tasks/release.patch.rst
+++ b/third_party/python/pytest/tasks/release.patch.rst
@@ -1,17 +1,17 @@
 pytest-{version}
 =======================================
 
 pytest {version} has just been released to PyPI.
 
 This is a bug-fix release, being a drop-in replacement. To upgrade::
 
   pip install --upgrade pytest
-  
+
 The full changelog is available at http://doc.pytest.org/en/latest/changelog.html.
 
 Thanks to all who contributed to this release, among them:
 
 {contributors}
 
 Happy testing,
 The pytest Development Team
--- a/third_party/python/pytest/tasks/requirements.txt
+++ b/third_party/python/pytest/tasks/requirements.txt
@@ -1,5 +1,6 @@
-invoke
-tox
+-e .
 gitpython
+invoke
 towncrier
+tox
 wheel
deleted file mode 100644
--- a/third_party/python/pytest/tasks/vendoring.py
+++ /dev/null
@@ -1,23 +0,0 @@
-from __future__ import absolute_import, print_function
-import py
-import invoke
-
-VENDOR_TARGET = py.path.local("_pytest/vendored_packages")
-GOOD_FILES = 'README.md', '__init__.py'
-
-@invoke.task()
-def remove_libs(ctx):
-    print("removing vendored libs")
-    for path in VENDOR_TARGET.listdir():
-        if path.basename not in GOOD_FILES:
-            print(" ", path)
-            path.remove()
-
-@invoke.task(pre=[remove_libs])
-def update_libs(ctx):
-    print("installing libs")
-    ctx.run("pip install -t {target} pluggy".format(target=VENDOR_TARGET))
-    ctx.run("git add {target}".format(target=VENDOR_TARGET))
-    print("Please commit to finish the update after running the tests:")
-    print()
-    print('    git commit -am "Updated vendored libs"')
--- a/third_party/python/pytest/testing/acceptance_test.py
+++ b/third_party/python/pytest/testing/acceptance_test.py
@@ -1,511 +1,548 @@
 # -*- coding: utf-8 -*-
 from __future__ import absolute_import, division, print_function
 import os
 import sys
+import types
+
+import six
 
 import _pytest._code
 import py
 import pytest
 from _pytest.main import EXIT_NOTESTSCOLLECTED, EXIT_USAGEERROR
 
 
 class TestGeneralUsage(object):
+
     def test_config_error(self, testdir):
-        testdir.makeconftest("""
+        testdir.makeconftest(
+            """
             def pytest_configure(config):
                 import pytest
                 raise pytest.UsageError("hello")
-        """)
+        """
+        )
         result = testdir.runpytest(testdir.tmpdir)
         assert result.ret != 0
-        result.stderr.fnmatch_lines([
-            '*ERROR: hello'
-        ])
+        result.stderr.fnmatch_lines(["*ERROR: hello"])
 
     def test_root_conftest_syntax_error(self, testdir):
         testdir.makepyfile(conftest="raise SyntaxError\n")
         result = testdir.runpytest()
         result.stderr.fnmatch_lines(["*raise SyntaxError*"])
         assert result.ret != 0
 
     def test_early_hook_error_issue38_1(self, testdir):
-        testdir.makeconftest("""
+        testdir.makeconftest(
+            """
             def pytest_sessionstart():
                 0 / 0
-        """)
+        """
+        )
         result = testdir.runpytest(testdir.tmpdir)
         assert result.ret != 0
         # tracestyle is native by default for hook failures
-        result.stdout.fnmatch_lines([
-            '*INTERNALERROR*File*conftest.py*line 2*',
-            '*0 / 0*',
-        ])
+        result.stdout.fnmatch_lines(
+            ["*INTERNALERROR*File*conftest.py*line 2*", "*0 / 0*"]
+        )
         result = testdir.runpytest(testdir.tmpdir, "--fulltrace")
         assert result.ret != 0
         # tracestyle is native by default for hook failures
-        result.stdout.fnmatch_lines([
-            '*INTERNALERROR*def pytest_sessionstart():*',
-            '*INTERNALERROR*0 / 0*',
-        ])
+        result.stdout.fnmatch_lines(
+            ["*INTERNALERROR*def pytest_sessionstart():*", "*INTERNALERROR*0 / 0*"]
+        )
 
     def test_early_hook_configure_error_issue38(self, testdir):
-        testdir.makeconftest("""
+        testdir.makeconftest(
+            """
             def pytest_configure():
                 0 / 0
-        """)
+        """
+        )
         result = testdir.runpytest(testdir.tmpdir)
         assert result.ret != 0
         # here we get it on stderr
-        result.stderr.fnmatch_lines([
-            '*INTERNALERROR*File*conftest.py*line 2*',
-            '*0 / 0*',
-        ])
+        result.stderr.fnmatch_lines(
+            ["*INTERNALERROR*File*conftest.py*line 2*", "*0 / 0*"]
+        )
 
     def test_file_not_found(self, testdir):
         result = testdir.runpytest("asd")
         assert result.ret != 0
         result.stderr.fnmatch_lines(["ERROR: file not found*asd"])
 
     def test_file_not_found_unconfigure_issue143(self, testdir):
-        testdir.makeconftest("""
+        testdir.makeconftest(
+            """
             def pytest_configure():
                 print("---configure")
             def pytest_unconfigure():
                 print("---unconfigure")
-        """)
+        """
+        )
         result = testdir.runpytest("-s", "asd")
         assert result.ret == 4  # EXIT_USAGEERROR
         result.stderr.fnmatch_lines(["ERROR: file not found*asd"])
-        result.stdout.fnmatch_lines([
-            "*---configure",
-            "*---unconfigure",
-        ])
+        result.stdout.fnmatch_lines(["*---configure", "*---unconfigure"])
 
     def test_config_preparse_plugin_option(self, testdir):
-        testdir.makepyfile(pytest_xyz="""
+        testdir.makepyfile(
+            pytest_xyz="""
             def pytest_addoption(parser):
                 parser.addoption("--xyz", dest="xyz", action="store")
-        """)
-        testdir.makepyfile(test_one="""
+        """
+        )
+        testdir.makepyfile(
+            test_one="""
             def test_option(pytestconfig):
                 assert pytestconfig.option.xyz == "123"
-        """)
+        """
+        )
         result = testdir.runpytest("-p", "pytest_xyz", "--xyz=123", syspathinsert=True)
         assert result.ret == 0
-        result.stdout.fnmatch_lines([
-            '*1 passed*',
-        ])
+        result.stdout.fnmatch_lines(["*1 passed*"])
 
     def test_assertion_magic(self, testdir):
-        p = testdir.makepyfile("""
+        p = testdir.makepyfile(
+            """
             def test_this():
                 x = 0
                 assert x
-        """)
+        """
+        )
         result = testdir.runpytest(p)
-        result.stdout.fnmatch_lines([
-            ">       assert x",
-            "E       assert 0",
-        ])
+        result.stdout.fnmatch_lines([">       assert x", "E       assert 0"])
         assert result.ret == 1
 
     def test_nested_import_error(self, testdir):
-        p = testdir.makepyfile("""
+        p = testdir.makepyfile(
+            """
                 import import_fails
                 def test_this():
                     assert import_fails.a == 1
-        """)
+        """
+        )
         testdir.makepyfile(import_fails="import does_not_work")
         result = testdir.runpytest(p)
-        result.stdout.fnmatch_lines([
-            # XXX on jython this fails:  ">   import import_fails",
-            "ImportError while importing test module*",
-            "*No module named *does_not_work*",
-        ])
+        result.stdout.fnmatch_lines(
+            [
+                # XXX on jython this fails:  ">   import import_fails",
+                "ImportError while importing test module*",
+                "*No module named *does_not_work*",
+            ]
+        )
         assert result.ret == 2
 
     def test_not_collectable_arguments(self, testdir):
         p1 = testdir.makepyfile("")
         p2 = testdir.makefile(".pyc", "123")
         result = testdir.runpytest(p1, p2)
         assert result.ret
-        result.stderr.fnmatch_lines([
-            "*ERROR: not found:*%s" % (p2.basename,)
-        ])
+        result.stderr.fnmatch_lines(["*ERROR: not found:*%s" % (p2.basename,)])
 
     def test_issue486_better_reporting_on_conftest_load_failure(self, testdir):
         testdir.makepyfile("")
         testdir.makeconftest("import qwerty")
         result = testdir.runpytest("--help")
-        result.stdout.fnmatch_lines("""
+        result.stdout.fnmatch_lines(
+            """
             *--version*
             *warning*conftest.py*
-        """)
+        """
+        )
         result = testdir.runpytest()
-        result.stderr.fnmatch_lines("""
+        result.stderr.fnmatch_lines(
+            """
             *ERROR*could not load*conftest.py*
-        """)
+        """
+        )
 
     def test_early_skip(self, testdir):
         testdir.mkdir("xyz")
-        testdir.makeconftest("""
+        testdir.makeconftest(
+            """
             import pytest
             def pytest_collect_directory():
                 pytest.skip("early")
-        """)
+        """
+        )
         result = testdir.runpytest()
         assert result.ret == EXIT_NOTESTSCOLLECTED
-        result.stdout.fnmatch_lines([
-            "*1 skip*"
-        ])
+        result.stdout.fnmatch_lines(["*1 skip*"])
 
     def test_issue88_initial_file_multinodes(self, testdir):
-        testdir.makeconftest("""
+        testdir.makeconftest(
+            """
             import pytest
             class MyFile(pytest.File):
                 def collect(self):
                     return [MyItem("hello", parent=self)]
             def pytest_collect_file(path, parent):
                 return MyFile(path, parent)
             class MyItem(pytest.Item):
                 pass
-        """)
+        """
+        )
         p = testdir.makepyfile("def test_hello(): pass")
         result = testdir.runpytest(p, "--collect-only")
-        result.stdout.fnmatch_lines([
-            "*MyFile*test_issue88*",
-            "*Module*test_issue88*",
-        ])
+        result.stdout.fnmatch_lines(["*MyFile*test_issue88*", "*Module*test_issue88*"])
 
     def test_issue93_initialnode_importing_capturing(self, testdir):
-        testdir.makeconftest("""
+        testdir.makeconftest(
+            """
             import sys
             print ("should not be seen")
             sys.stderr.write("stder42\\n")
-        """)
+        """
+        )
         result = testdir.runpytest()
         assert result.ret == EXIT_NOTESTSCOLLECTED
         assert "should not be seen" not in result.stdout.str()
         assert "stderr42" not in result.stderr.str()
 
     def test_conftest_printing_shows_if_error(self, testdir):
-        testdir.makeconftest("""
+        testdir.makeconftest(
+            """
             print ("should be seen")
             assert 0
-        """)
+        """
+        )
         result = testdir.runpytest()
         assert result.ret != 0
         assert "should be seen" in result.stdout.str()
 
-    @pytest.mark.skipif(not hasattr(py.path.local, 'mksymlinkto'),
-                        reason="symlink not available on this platform")
+    @pytest.mark.skipif(
+        not hasattr(py.path.local, "mksymlinkto"),
+        reason="symlink not available on this platform",
+    )
     def test_chdir(self, testdir):
         testdir.tmpdir.join("py").mksymlinkto(py._pydir)
         p = testdir.tmpdir.join("main.py")
-        p.write(_pytest._code.Source("""
+        p.write(
+            _pytest._code.Source(
+                """
             import sys, os
             sys.path.insert(0, '')
             import py
             print (py.__file__)
             print (py.__path__)
             os.chdir(os.path.dirname(os.getcwd()))
             print (py.log)
-        """))
+        """
+            )
+        )
         result = testdir.runpython(p)
         assert not result.ret
 
     def test_issue109_sibling_conftests_not_loaded(self, testdir):
-        sub1 = testdir.tmpdir.mkdir("sub1")
-        sub2 = testdir.tmpdir.mkdir("sub2")
+        sub1 = testdir.mkdir("sub1")
+        sub2 = testdir.mkdir("sub2")
         sub1.join("conftest.py").write("assert 0")
         result = testdir.runpytest(sub2)
         assert result.ret == EXIT_NOTESTSCOLLECTED
         sub2.ensure("__init__.py")
         p = sub2.ensure("test_hello.py")
         result = testdir.runpytest(p)
         assert result.ret == EXIT_NOTESTSCOLLECTED
         result = testdir.runpytest(sub1)
         assert result.ret == EXIT_USAGEERROR
 
     def test_directory_skipped(self, testdir):
-        testdir.makeconftest("""
+        testdir.makeconftest(
+            """
             import pytest
             def pytest_ignore_collect():
                 pytest.skip("intentional")
-        """)
+        """
+        )
         testdir.makepyfile("def test_hello(): pass")
         result = testdir.runpytest()
         assert result.ret == EXIT_NOTESTSCOLLECTED
-        result.stdout.fnmatch_lines([
-            "*1 skipped*"
-        ])
+        result.stdout.fnmatch_lines(["*1 skipped*"])
 
     def test_multiple_items_per_collector_byid(self, testdir):
-        c = testdir.makeconftest("""
+        c = testdir.makeconftest(
+            """
             import pytest
             class MyItem(pytest.Item):
                 def runtest(self):
                     pass
             class MyCollector(pytest.File):
                 def collect(self):
                     return [MyItem(name="xyz", parent=self)]
             def pytest_collect_file(path, parent):
                 if path.basename.startswith("conftest"):
                     return MyCollector(path, parent)
-        """)
+        """
+        )
         result = testdir.runpytest(c.basename + "::" + "xyz")
         assert result.ret == 0
-        result.stdout.fnmatch_lines([
-            "*1 pass*",
-        ])
+        result.stdout.fnmatch_lines(["*1 pass*"])
 
     def test_skip_on_generated_funcarg_id(self, testdir):
-        testdir.makeconftest("""
+        testdir.makeconftest(
+            """
             import pytest
             def pytest_generate_tests(metafunc):
                 metafunc.addcall({'x': 3}, id='hello-123')
             def pytest_runtest_setup(item):
                 print (item.keywords)
                 if 'hello-123' in item.keywords:
                     pytest.skip("hello")
                 assert 0
-        """)
+        """
+        )
         p = testdir.makepyfile("""def test_func(x): pass""")
         res = testdir.runpytest(p)
         assert res.ret == 0
         res.stdout.fnmatch_lines(["*1 skipped*"])
 
     def test_direct_addressing_selects(self, testdir):
-        p = testdir.makepyfile("""
+        p = testdir.makepyfile(
+            """
             def pytest_generate_tests(metafunc):
                 metafunc.addcall({'i': 1}, id="1")
                 metafunc.addcall({'i': 2}, id="2")
             def test_func(i):
                 pass
-        """)
+        """
+        )
         res = testdir.runpytest(p.basename + "::" + "test_func[1]")
         assert res.ret == 0
         res.stdout.fnmatch_lines(["*1 passed*"])
 
     def test_direct_addressing_notfound(self, testdir):
-        p = testdir.makepyfile("""
+        p = testdir.makepyfile(
+            """
             def test_func():
                 pass
-        """)
+        """
+        )
         res = testdir.runpytest(p.basename + "::" + "test_notfound")
         assert res.ret
         res.stderr.fnmatch_lines(["*ERROR*not found*"])
 
     def test_docstring_on_hookspec(self):
         from _pytest import hookspec
+
         for name, value in vars(hookspec).items():
             if name.startswith("pytest_"):
                 assert value.__doc__, "no docstring for %s" % name
 
     def test_initialization_error_issue49(self, testdir):
-        testdir.makeconftest("""
+        testdir.makeconftest(
+            """
             def pytest_configure():
                 x
-        """)
+        """
+        )
         result = testdir.runpytest()
         assert result.ret == 3  # internal error
-        result.stderr.fnmatch_lines([
-            "INTERNAL*pytest_configure*",
-            "INTERNAL*x*",
-        ])
-        assert 'sessionstarttime' not in result.stderr.str()
+        result.stderr.fnmatch_lines(["INTERNAL*pytest_configure*", "INTERNAL*x*"])
+        assert "sessionstarttime" not in result.stderr.str()
 
-    @pytest.mark.parametrize('lookfor', ['test_fun.py::test_a'])
+    @pytest.mark.parametrize("lookfor", ["test_fun.py::test_a"])
     def test_issue134_report_error_when_collecting_member(self, testdir, lookfor):
-        testdir.makepyfile(test_fun="""
+        testdir.makepyfile(
+            test_fun="""
             def test_a():
                 pass
-            def""")
+            def"""
+        )
         result = testdir.runpytest(lookfor)
-        result.stdout.fnmatch_lines(['*SyntaxError*'])
-        if '::' in lookfor:
-            result.stderr.fnmatch_lines([
-                '*ERROR*',
-            ])
+        result.stdout.fnmatch_lines(["*SyntaxError*"])
+        if "::" in lookfor:
+            result.stderr.fnmatch_lines(["*ERROR*"])
             assert result.ret == 4  # usage error only if item not found
 
     def test_report_all_failed_collections_initargs(self, testdir):
         testdir.makepyfile(test_a="def", test_b="def")
         result = testdir.runpytest("test_a.py::a", "test_b.py::b")
-        result.stderr.fnmatch_lines([
-            "*ERROR*test_a.py::a*",
-            "*ERROR*test_b.py::b*",
-        ])
+        result.stderr.fnmatch_lines(["*ERROR*test_a.py::a*", "*ERROR*test_b.py::b*"])
 
-    @pytest.mark.usefixtures('recwarn')
+    @pytest.mark.usefixtures("recwarn")
     def test_namespace_import_doesnt_confuse_import_hook(self, testdir):
         """
         Ref #383. Python 3.3's namespace package messed with our import hooks
         Importing a module that didn't exist, even if the ImportError was
         gracefully handled, would make our test crash.
 
-        Use recwarn here to silence this warning in Python 2.6 and 2.7:
+        Use recwarn here to silence this warning in Python 2.7:
             ImportWarning: Not importing directory '...\not_a_package': missing __init__.py
         """
-        testdir.mkdir('not_a_package')
-        p = testdir.makepyfile("""
+        testdir.mkdir("not_a_package")
+        p = testdir.makepyfile(
+            """
             try:
                 from not_a_package import doesnt_exist
             except ImportError:
                 # We handle the import error gracefully here
                 pass
 
             def test_whatever():
                 pass
-        """)
+        """
+        )
         res = testdir.runpytest(p.basename)
         assert res.ret == 0
 
     def test_unknown_option(self, testdir):
         result = testdir.runpytest("--qwlkej")
-        result.stderr.fnmatch_lines("""
+        result.stderr.fnmatch_lines(
+            """
             *unrecognized*
-        """)
+        """
+        )
 
     def test_getsourcelines_error_issue553(self, testdir, monkeypatch):
         monkeypatch.setattr("inspect.getsourcelines", None)
-        p = testdir.makepyfile("""
+        p = testdir.makepyfile(
+            """
             def raise_error(obj):
                 raise IOError('source code not available')
 
             import inspect
             inspect.getsourcelines = raise_error
 
             def test_foo(invalid_fixture):
                 pass
-        """)
+        """
+        )
         res = testdir.runpytest(p)
-        res.stdout.fnmatch_lines([
-            "*source code not available*",
-            "E*fixture 'invalid_fixture' not found",
-        ])
+        res.stdout.fnmatch_lines(
+            ["*source code not available*", "E*fixture 'invalid_fixture' not found"]
+        )
 
     def test_plugins_given_as_strings(self, tmpdir, monkeypatch):
         """test that str values passed to main() as `plugins` arg
         are interpreted as module names to be imported and registered.
         #855.
         """
         with pytest.raises(ImportError) as excinfo:
-            pytest.main([str(tmpdir)], plugins=['invalid.module'])
-        assert 'invalid' in str(excinfo.value)
+            pytest.main([str(tmpdir)], plugins=["invalid.module"])
+        assert "invalid" in str(excinfo.value)
 
-        p = tmpdir.join('test_test_plugins_given_as_strings.py')
-        p.write('def test_foo(): pass')
-        mod = py.std.types.ModuleType("myplugin")
-        monkeypatch.setitem(sys.modules, 'myplugin', mod)
-        assert pytest.main(args=[str(tmpdir)], plugins=['myplugin']) == 0
+        p = tmpdir.join("test_test_plugins_given_as_strings.py")
+        p.write("def test_foo(): pass")
+        mod = types.ModuleType("myplugin")
+        monkeypatch.setitem(sys.modules, "myplugin", mod)
+        assert pytest.main(args=[str(tmpdir)], plugins=["myplugin"]) == 0
 
     def test_parametrized_with_bytes_regex(self, testdir):
-        p = testdir.makepyfile("""
+        p = testdir.makepyfile(
+            """
             import re
             import pytest
             @pytest.mark.parametrize('r', [re.compile(b'foo')])
             def test_stuff(r):
                 pass
         """
-                               )
+        )
         res = testdir.runpytest(p)
-        res.stdout.fnmatch_lines([
-            '*1 passed*'
-        ])
+        res.stdout.fnmatch_lines(["*1 passed*"])
 
     def test_parametrized_with_null_bytes(self, testdir):
-        """Test parametrization with values that contain null bytes and unicode characters (#2644)"""
-        p = testdir.makepyfile(u"""
+        """Test parametrization with values that contain null bytes and unicode characters (#2644, #2957)"""
+        p = testdir.makepyfile(
+            u"""
             # encoding: UTF-8
             import pytest
 
-            @pytest.mark.parametrize("data", ["\\x00", u'ação'])
+            @pytest.mark.parametrize("data", [b"\\x00", "\\x00", u'ação'])
             def test_foo(data):
                 assert data
-        """)
+        """
+        )
         res = testdir.runpytest(p)
-        res.assert_outcomes(passed=2)
+        res.assert_outcomes(passed=3)
 
 
 class TestInvocationVariants(object):
+
     def test_earlyinit(self, testdir):
-        p = testdir.makepyfile("""
+        p = testdir.makepyfile(
+            """
             import pytest
             assert hasattr(pytest, 'mark')
-        """)
+        """
+        )
         result = testdir.runpython(p)
         assert result.ret == 0
 
     @pytest.mark.xfail("sys.platform.startswith('java')")
     def test_pydoc(self, testdir):
-        for name in ('py.test', 'pytest'):
+        for name in ("py.test", "pytest"):
             result = testdir.runpython_c("import %s;help(%s)" % (name, name))
             assert result.ret == 0
             s = result.stdout.str()
-            assert 'MarkGenerator' in s
+            assert "MarkGenerator" in s
 
     def test_import_star_py_dot_test(self, testdir):
-        p = testdir.makepyfile("""
+        p = testdir.makepyfile(
+            """
             from py.test import *
             #collect
             #cmdline
             #Item
             # assert collect.Item is Item
             # assert collect.Collector is Collector
             main
             skip
             xfail
-        """)
+        """
+        )
         result = testdir.runpython(p)
         assert result.ret == 0
 
     def test_import_star_pytest(self, testdir):
-        p = testdir.makepyfile("""
+        p = testdir.makepyfile(
+            """
             from pytest import *
             #Item
             #File
             main
             skip
             xfail
-        """)
+        """
+        )
         result = testdir.runpython(p)
         assert result.ret == 0
 
     def test_double_pytestcmdline(self, testdir):
-        p = testdir.makepyfile(run="""
+        p = testdir.makepyfile(
+            run="""
             import pytest
             pytest.main()
             pytest.main()
-        """)
-        testdir.makepyfile("""
+        """
+        )
+        testdir.makepyfile(
+            """
             def test_hello():
                 pass
-        """)
+        """
+        )
         result = testdir.runpython(p)
-        result.stdout.fnmatch_lines([
-            "*1 passed*",
-            "*1 passed*",
-        ])
+        result.stdout.fnmatch_lines(["*1 passed*", "*1 passed*"])
 
     def test_python_minus_m_invocation_ok(self, testdir):
         p1 = testdir.makepyfile("def test_hello(): pass")
-        res = testdir.run(py.std.sys.executable, "-m", "pytest", str(p1))
+        res = testdir.run(sys.executable, "-m", "pytest", str(p1))
         assert res.ret == 0
 
     def test_python_minus_m_invocation_fail(self, testdir):
         p1 = testdir.makepyfile("def test_fail(): 0/0")
-        res = testdir.run(py.std.sys.executable, "-m", "pytest", str(p1))
+        res = testdir.run(sys.executable, "-m", "pytest", str(p1))
         assert res.ret == 1
 
     def test_python_pytest_package(self, testdir):
         p1 = testdir.makepyfile("def test_pass(): pass")
-        res = testdir.run(py.std.sys.executable, "-m", "pytest", str(p1))
+        res = testdir.run(sys.executable, "-m", "pytest", str(p1))
         assert res.ret == 0
         res.stdout.fnmatch_lines(["*1 passed*"])
 
     def test_equivalence_pytest_pytest(self):
         assert pytest.main == py.test.cmdline.main
 
     def test_invoke_with_string(self, capsys):
         retcode = pytest.main("-h")
@@ -515,188 +552,264 @@ class TestInvocationVariants(object):
         pytest.raises(ValueError, lambda: pytest.main(0))
 
     def test_invoke_with_path(self, tmpdir, capsys):
         retcode = pytest.main(tmpdir)
         assert retcode == EXIT_NOTESTSCOLLECTED
         out, err = capsys.readouterr()
 
     def test_invoke_plugin_api(self, testdir, capsys):
+
         class MyPlugin(object):
+
             def pytest_addoption(self, parser):
                 parser.addoption("--myopt")
 
         pytest.main(["-h"], plugins=[MyPlugin()])
         out, err = capsys.readouterr()
         assert "--myopt" in out
 
     def test_pyargs_importerror(self, testdir, monkeypatch):
-        monkeypatch.delenv('PYTHONDONTWRITEBYTECODE', False)
+        monkeypatch.delenv("PYTHONDONTWRITEBYTECODE", False)
         path = testdir.mkpydir("tpkg")
-        path.join("test_hello.py").write('raise ImportError')
+        path.join("test_hello.py").write("raise ImportError")
 
-        result = testdir.runpytest_subprocess("--pyargs", "tpkg.test_hello")
+        result = testdir.runpytest("--pyargs", "tpkg.test_hello", syspathinsert=True)
         assert result.ret != 0
 
-        result.stdout.fnmatch_lines([
-            "collected*0*items*/*1*errors"
-        ])
+        result.stdout.fnmatch_lines(["collected*0*items*/*1*errors"])
 
     def test_cmdline_python_package(self, testdir, monkeypatch):
         import warnings
-        monkeypatch.delenv('PYTHONDONTWRITEBYTECODE', False)
+
+        monkeypatch.delenv("PYTHONDONTWRITEBYTECODE", False)
         path = testdir.mkpydir("tpkg")
         path.join("test_hello.py").write("def test_hello(): pass")
         path.join("test_world.py").write("def test_world(): pass")
         result = testdir.runpytest("--pyargs", "tpkg")
         assert result.ret == 0
-        result.stdout.fnmatch_lines([
-            "*2 passed*"
-        ])
-        result = testdir.runpytest("--pyargs", "tpkg.test_hello")
+        result.stdout.fnmatch_lines(["*2 passed*"])
+        result = testdir.runpytest("--pyargs", "tpkg.test_hello", syspathinsert=True)
         assert result.ret == 0
-        result.stdout.fnmatch_lines([
-            "*1 passed*"
-        ])
+        result.stdout.fnmatch_lines(["*1 passed*"])
 
         def join_pythonpath(what):
-            cur = py.std.os.environ.get('PYTHONPATH')
+            cur = os.environ.get("PYTHONPATH")
             if cur:
                 return str(what) + os.pathsep + cur
             return what
+
         empty_package = testdir.mkpydir("empty_package")
-        monkeypatch.setenv('PYTHONPATH', join_pythonpath(empty_package))
+        monkeypatch.setenv("PYTHONPATH", join_pythonpath(empty_package))
         # the path which is not a package raises a warning on pypy;
         # no idea why only pypy and not normal python warn about it here
         with warnings.catch_warnings():
-            warnings.simplefilter('ignore', ImportWarning)
+            warnings.simplefilter("ignore", ImportWarning)
             result = testdir.runpytest("--pyargs", ".")
         assert result.ret == 0
-        result.stdout.fnmatch_lines([
-            "*2 passed*"
-        ])
+        result.stdout.fnmatch_lines(["*2 passed*"])
 
-        monkeypatch.setenv('PYTHONPATH', join_pythonpath(testdir))
-        result = testdir.runpytest("--pyargs", "tpkg.test_missing")
+        monkeypatch.setenv("PYTHONPATH", join_pythonpath(testdir))
+        result = testdir.runpytest("--pyargs", "tpkg.test_missing", syspathinsert=True)
         assert result.ret != 0
-        result.stderr.fnmatch_lines([
-            "*not*found*test_missing*",
-        ])
+        result.stderr.fnmatch_lines(["*not*found*test_missing*"])
 
     def test_cmdline_python_namespace_package(self, testdir, monkeypatch):
         """
         test --pyargs option with namespace packages (#1567)
         """
-        monkeypatch.delenv('PYTHONDONTWRITEBYTECODE', raising=False)
+        monkeypatch.delenv("PYTHONDONTWRITEBYTECODE", raising=False)
 
         search_path = []
         for dirname in "hello", "world":
             d = testdir.mkdir(dirname)
             search_path.append(d)
             ns = d.mkdir("ns_pkg")
             ns.join("__init__.py").write(
-                "__import__('pkg_resources').declare_namespace(__name__)")
+                "__import__('pkg_resources').declare_namespace(__name__)"
+            )
             lib = ns.mkdir(dirname)
             lib.ensure("__init__.py")
-            lib.join("test_{0}.py".format(dirname)). \
-                write("def test_{0}(): pass\n"
-                      "def test_other():pass".format(dirname))
+            lib.join("test_{}.py".format(dirname)).write(
+                "def test_{}(): pass\n" "def test_other():pass".format(dirname)
+            )
 
         # The structure of the test directory is now:
         # .
         # ├── hello
-        # │   └── ns_pkg
-        # │       ├── __init__.py
-        # │       └── hello
-        # │           ├── __init__.py
-        # │           └── test_hello.py
+        # │   └── ns_pkg
+        # │       ├── __init__.py
+        # │       └── hello
+        # │           ├── __init__.py
+        # │           └── test_hello.py
         # └── world
         #     └── ns_pkg
         #         ├── __init__.py
         #         └── world
         #             ├── __init__.py
         #             └── test_world.py
 
         def join_pythonpath(*dirs):
-            cur = py.std.os.environ.get('PYTHONPATH')
+            cur = os.environ.get("PYTHONPATH")
             if cur:
                 dirs += (cur,)
             return os.pathsep.join(str(p) for p in dirs)
-        monkeypatch.setenv('PYTHONPATH', join_pythonpath(*search_path))
+
+        monkeypatch.setenv("PYTHONPATH", join_pythonpath(*search_path))
         for p in search_path:
             monkeypatch.syspath_prepend(p)
 
-        os.chdir('world')
         # mixed module and filenames:
+        os.chdir("world")
         result = testdir.runpytest("--pyargs", "-v", "ns_pkg.hello", "ns_pkg/world")
+        assert result.ret == 0
+        result.stdout.fnmatch_lines(
+            [
+                "*test_hello.py::test_hello*PASSED*",
+                "*test_hello.py::test_other*PASSED*",
+                "*test_world.py::test_world*PASSED*",
+                "*test_world.py::test_other*PASSED*",
+                "*4 passed*",
+            ]
+        )
+
+        # specify tests within a module
+        testdir.chdir()
+        result = testdir.runpytest(
+            "--pyargs", "-v", "ns_pkg.world.test_world::test_other"
+        )
+        assert result.ret == 0
+        result.stdout.fnmatch_lines(
+            ["*test_world.py::test_other*PASSED*", "*1 passed*"]
+        )
+
+    @pytest.mark.skipif(not hasattr(os, "symlink"), reason="requires symlinks")
+    def test_cmdline_python_package_symlink(self, testdir, monkeypatch):
+        """
+        test --pyargs option with packages with path containing symlink can
+        have conftest.py in their package (#2985)
+        """
+        # dummy check that we can actually create symlinks: on Windows `os.symlink` is available,
+        # but normal users require special admin privileges to create symlinks.
+        if sys.platform == "win32":
+            try:
+                os.symlink(
+                    str(testdir.tmpdir.ensure("tmpfile")),
+                    str(testdir.tmpdir.join("tmpfile2")),
+                )
+            except OSError as e:
+                pytest.skip(six.text_type(e.args[0]))
+        monkeypatch.delenv("PYTHONDONTWRITEBYTECODE", raising=False)
+
+        search_path = ["lib", os.path.join("local", "lib")]
+
+        dirname = "lib"
+        d = testdir.mkdir(dirname)
+        foo = d.mkdir("foo")
+        foo.ensure("__init__.py")
+        lib = foo.mkdir("bar")
+        lib.ensure("__init__.py")
+        lib.join("test_bar.py").write(
+            "def test_bar(): pass\n" "def test_other(a_fixture):pass"
+        )
+        lib.join("conftest.py").write(
+            "import pytest\n" "@pytest.fixture\n" "def a_fixture():pass"
+        )
+
+        d_local = testdir.mkdir("local")
+        symlink_location = os.path.join(str(d_local), "lib")
+        if six.PY2:
+            os.symlink(str(d), symlink_location)
+        else:
+            os.symlink(str(d), symlink_location, target_is_directory=True)
+
+        # The structure of the test directory is now:
+        # .
+        # ├── local
+        # │   └── lib -> ../lib
+        # └── lib
+        #     └── foo
+        #         ├── __init__.py
+        #         └── bar
+        #             ├── __init__.py
+        #             ├── conftest.py
+        #             └── test_bar.py
+
+        def join_pythonpath(*dirs):
+            cur = os.getenv("PYTHONPATH")
+            if cur:
+                dirs += (cur,)
+            return os.pathsep.join(str(p) for p in dirs)
+
+        monkeypatch.setenv("PYTHONPATH", join_pythonpath(*search_path))
+        for p in search_path:
+            monkeypatch.syspath_prepend(p)
+
+        # module picked up in symlink-ed directory:
+        result = testdir.runpytest("--pyargs", "-v", "foo.bar")
         testdir.chdir()
         assert result.ret == 0
-        result.stdout.fnmatch_lines([
-            "*test_hello.py::test_hello*PASSED",
-            "*test_hello.py::test_other*PASSED",
-            "*test_world.py::test_world*PASSED",
-            "*test_world.py::test_other*PASSED",
-            "*4 passed*"
-        ])
-
-        # specify tests within a module
-        result = testdir.runpytest("--pyargs", "-v", "ns_pkg.world.test_world::test_other")
-        assert result.ret == 0
-        result.stdout.fnmatch_lines([
-            "*test_world.py::test_other*PASSED",
-            "*1 passed*"
-        ])
+        result.stdout.fnmatch_lines(
+            [
+                "*lib/foo/bar/test_bar.py::test_bar*PASSED*",
+                "*lib/foo/bar/test_bar.py::test_other*PASSED*",
+                "*2 passed*",
+            ]
+        )
 
     def test_cmdline_python_package_not_exists(self, testdir):
         result = testdir.runpytest("--pyargs", "tpkgwhatv")
         assert result.ret
-        result.stderr.fnmatch_lines([
-            "ERROR*file*or*package*not*found*",
-        ])
+        result.stderr.fnmatch_lines(["ERROR*file*or*package*not*found*"])
 
     @pytest.mark.xfail(reason="decide: feature or bug")
     def test_noclass_discovery_if_not_testcase(self, testdir):
-        testpath = testdir.makepyfile("""
+        testpath = testdir.makepyfile(
+            """
             import unittest
             class TestHello(object):
                 def test_hello(self):
                     assert self.attr
 
             class RealTest(unittest.TestCase, TestHello):
                 attr = 42
-        """)
+        """
+        )
         reprec = testdir.inline_run(testpath)
         reprec.assertoutcome(passed=1)
 
     def test_doctest_id(self, testdir):
-        testdir.makefile('.txt', """
+        testdir.makefile(
+            ".txt",
+            """
             >>> x=3
             >>> x
             4
-        """)
+        """,
+        )
         result = testdir.runpytest("-rf")
         lines = result.stdout.str().splitlines()
         for line in lines:
             if line.startswith("FAIL "):
                 testid = line[5:].strip()
                 break
-        result = testdir.runpytest(testid, '-rf')
-        result.stdout.fnmatch_lines([
-            line,
-            "*1 failed*",
-        ])
+        result = testdir.runpytest(testid, "-rf")
+        result.stdout.fnmatch_lines([line, "*1 failed*"])
 
     def test_core_backward_compatibility(self):
         """Test backward compatibility for get_plugin_manager function. See #787."""
         import _pytest.config
-        assert type(_pytest.config.get_plugin_manager()) is _pytest.config.PytestPluginManager
+
+        assert type(
+            _pytest.config.get_plugin_manager()
+        ) is _pytest.config.PytestPluginManager
 
     def test_has_plugin(self, request):
         """Test hasplugin function of the plugin manager (#932)."""
-        assert request.config.pluginmanager.hasplugin('python')
+        assert request.config.pluginmanager.hasplugin("python")
 
 
 class TestDurations(object):
     source = """
         import time
         frag = 0.002
         def test_something():
             pass
@@ -707,59 +820,51 @@ class TestDurations(object):
         def test_3():
             time.sleep(frag*10)
     """
 
     def test_calls(self, testdir):
         testdir.makepyfile(self.source)
         result = testdir.runpytest("--durations=10")
         assert result.ret == 0
-        result.stdout.fnmatch_lines_random([
-            "*durations*",
-            "*call*test_3*",
-            "*call*test_2*",
-            "*call*test_1*",
-        ])
+        result.stdout.fnmatch_lines_random(
+            ["*durations*", "*call*test_3*", "*call*test_2*", "*call*test_1*"]
+        )
 
     def test_calls_show_2(self, testdir):
         testdir.makepyfile(self.source)
         result = testdir.runpytest("--durations=2")
         assert result.ret == 0
         lines = result.stdout.get_lines_after("*slowest*durations*")
         assert "4 passed" in lines[2]
 
     def test_calls_showall(self, testdir):
         testdir.makepyfile(self.source)
         result = testdir.runpytest("--durations=0")
         assert result.ret == 0
         for x in "123":
-            for y in 'call', :  # 'setup', 'call', 'teardown':
+            for y in ("call",):  # 'setup', 'call', 'teardown':
                 for line in result.stdout.lines:
                     if ("test_%s" % x) in line and y in line:
                         break
                 else:
                     raise AssertionError("not found %s %s" % (x, y))
 
     def test_with_deselected(self, testdir):
         testdir.makepyfile(self.source)
         result = testdir.runpytest("--durations=2", "-k test_1")
         assert result.ret == 0
-        result.stdout.fnmatch_lines([
-            "*durations*",
-            "*call*test_1*",
-        ])
+        result.stdout.fnmatch_lines(["*durations*", "*call*test_1*"])
 
     def test_with_failing_collection(self, testdir):
         testdir.makepyfile(self.source)
         testdir.makepyfile(test_collecterror="""xyz""")
         result = testdir.runpytest("--durations=2", "-k test_1")
         assert result.ret == 2
-        result.stdout.fnmatch_lines([
-            "*Interrupted: 1 errors during collection*",
-        ])
+        result.stdout.fnmatch_lines(["*Interrupted: 1 errors during collection*"])
         # Collection errors abort test execution, therefore no duration is
         # output
         assert "duration" not in result.stdout.str()
 
     def test_with_not(self, testdir):
         testdir.makepyfile(self.source)
         result = testdir.runpytest("-k not 1")
         assert result.ret == 0
@@ -777,74 +882,185 @@ class TestDurationWithFixture(object):
             time.sleep(frag)
     """
 
     def test_setup_function(self, testdir):
         testdir.makepyfile(self.source)
         result = testdir.runpytest("--durations=10")
         assert result.ret == 0
 
-        result.stdout.fnmatch_lines_random("""
+        result.stdout.fnmatch_lines_random(
+            """
             *durations*
             * setup *test_1*
             * call *test_1*
-        """)
+        """
+        )
 
 
 def test_zipimport_hook(testdir, tmpdir):
     """Test package loader is being used correctly (see #1837)."""
-    zipapp = pytest.importorskip('zipapp')
-    testdir.tmpdir.join('app').ensure(dir=1)
-    testdir.makepyfile(**{
-        'app/foo.py': """
+    zipapp = pytest.importorskip("zipapp")
+    testdir.tmpdir.join("app").ensure(dir=1)
+    testdir.makepyfile(
+        **{
+            "app/foo.py": """
             import pytest
             def main():
                 pytest.main(['--pyarg', 'foo'])
-        """,
-    })
-    target = tmpdir.join('foo.zip')
-    zipapp.create_archive(str(testdir.tmpdir.join('app')), str(target), main='foo:main')
+        """
+        }
+    )
+    target = tmpdir.join("foo.zip")
+    zipapp.create_archive(str(testdir.tmpdir.join("app")), str(target), main="foo:main")
     result = testdir.runpython(target)
     assert result.ret == 0
-    result.stderr.fnmatch_lines(['*not found*foo*'])
-    assert 'INTERNALERROR>' not in result.stdout.str()
+    result.stderr.fnmatch_lines(["*not found*foo*"])
+    assert "INTERNALERROR>" not in result.stdout.str()
 
 
 def test_import_plugin_unicode_name(testdir):
+    testdir.makepyfile(myplugin="")
     testdir.makepyfile(
-        myplugin='',
-    )
-    testdir.makepyfile("""
+        """
         def test(): pass
-    """)
-    testdir.makeconftest("""
+    """
+    )
+    testdir.makeconftest(
+        """
         pytest_plugins = [u'myplugin']
-    """)
+    """
+    )
     r = testdir.runpytest()
     assert r.ret == 0
 
 
 def test_deferred_hook_checking(testdir):
     """
     Check hooks as late as possible (#1821).
     """
     testdir.syspathinsert()
-    testdir.makepyfile(**{
-        'plugin.py': """
-        class Hooks:
+    testdir.makepyfile(
+        **{
+            "plugin.py": """
+        class Hooks(object):
             def pytest_my_hook(self, config):
                 pass
 
         def pytest_configure(config):
             config.pluginmanager.add_hookspecs(Hooks)
         """,
-        'conftest.py': """
+            "conftest.py": """
             pytest_plugins = ['plugin']
             def pytest_my_hook(config):
                 return 40
         """,
-        'test_foo.py': """
+            "test_foo.py": """
             def test(request):
                 assert request.config.hook.pytest_my_hook(config=request.config) == [40]
+        """,
+        }
+    )
+    result = testdir.runpytest()
+    result.stdout.fnmatch_lines(["* 1 passed *"])
+
+
+def test_fixture_values_leak(testdir):
+    """Ensure that fixture objects are properly destroyed by the garbage collector at the end of their expected
+    life-times (#2981).
+    """
+    testdir.makepyfile(
         """
-    })
+        import attr
+        import gc
+        import pytest
+        import weakref
+
+        @attr.s
+        class SomeObj(object):
+            name = attr.ib()
+
+        fix_of_test1_ref = None
+        session_ref = None
+
+        @pytest.fixture(scope='session')
+        def session_fix():
+            global session_ref
+            obj = SomeObj(name='session-fixture')
+            session_ref = weakref.ref(obj)
+            return obj
+
+        @pytest.fixture
+        def fix(session_fix):
+            global fix_of_test1_ref
+            obj = SomeObj(name='local-fixture')
+            fix_of_test1_ref = weakref.ref(obj)
+            return obj
+
+        def test1(fix):
+            assert fix_of_test1_ref() is fix
+
+        def test2():
+            gc.collect()
+            # fixture "fix" created during test1 must have been destroyed by now
+            assert fix_of_test1_ref() is None
+    """
+    )
     result = testdir.runpytest()
-    result.stdout.fnmatch_lines(['* 1 passed *'])
+    result.stdout.fnmatch_lines(["* 2 passed *"])
+
+
+def test_fixture_order_respects_scope(testdir):
+    """Ensure that fixtures are created according to scope order, regression test for #2405
+    """
+    testdir.makepyfile(
+        """
+        import pytest
+
+        data = {}
+
+        @pytest.fixture(scope='module')
+        def clean_data():
+            data.clear()
+
+        @pytest.fixture(autouse=True)
+        def add_data():
+            data.update(value=True)
+
+        @pytest.mark.usefixtures('clean_data')
+        def test_value():
+            assert data.get('value')
+    """
+    )
+    result = testdir.runpytest()
+    assert result.ret == 0
+
+
+def test_frame_leak_on_failing_test(testdir):
+    """pytest would leak garbage referencing the frames of tests that failed that could never be reclaimed (#2798)
+
+    Unfortunately it was not possible to remove the actual circles because most of them
+    are made of traceback objects which cannot be weakly referenced. Those objects at least
+    can be eventually claimed by the garbage collector.
+    """
+    testdir.makepyfile(
+        """
+        import gc
+        import weakref
+
+        class Obj:
+            pass
+
+        ref = None
+
+        def test1():
+            obj = Obj()
+            global ref
+            ref = weakref.ref(obj)
+            assert 0
+
+        def test2():
+            gc.collect()
+            assert ref() is None
+    """
+    )
+    result = testdir.runpytest_subprocess()
+    result.stdout.fnmatch_lines(["*1 failed, 1 passed in*"])
--- a/third_party/python/pytest/testing/code/test_code.py
+++ b/third_party/python/pytest/testing/code/test_code.py
@@ -1,71 +1,79 @@
 # coding: utf-8
 from __future__ import absolute_import, division, print_function
 import sys
 
 import _pytest._code
 import py
 import pytest
 from test_excinfo import TWMock
+from six import text_type
 
 
 def test_ne():
-    code1 = _pytest._code.Code(compile('foo = "bar"', '', 'exec'))
+    code1 = _pytest._code.Code(compile('foo = "bar"', "", "exec"))
     assert code1 == code1
-    code2 = _pytest._code.Code(compile('foo = "baz"', '', 'exec'))
+    code2 = _pytest._code.Code(compile('foo = "baz"', "", "exec"))
     assert code2 != code1
 
 
 def test_code_gives_back_name_for_not_existing_file():
-    name = 'abc-123'
-    co_code = compile("pass\n", name, 'exec')
+    name = "abc-123"
+    co_code = compile("pass\n", name, "exec")
     assert co_code.co_filename == name
     code = _pytest._code.Code(co_code)
     assert str(code.path) == name
     assert code.fullsource is None
 
 
 def test_code_with_class():
+
     class A(object):
         pass
+
     pytest.raises(TypeError, "_pytest._code.Code(A)")
 
 
 if True:
+
     def x():
         pass
 
 
 def test_code_fullsource():
     code = _pytest._code.Code(x)
     full = code.fullsource
-    assert 'test_code_fullsource()' in str(full)
+    assert "test_code_fullsource()" in str(full)
 
 
 def test_code_source():
     code = _pytest._code.Code(x)
     src = code.source()
     expected = """def x():
     pass"""
     assert str(src) == expected
 
 
 def test_frame_getsourcelineno_myself():
+
     def func():
         return sys._getframe(0)
+
     f = func()
     f = _pytest._code.Frame(f)
     source, lineno = f.code.fullsource, f.lineno
     assert source[lineno].startswith("        return sys._getframe(0)")
 
 
 def test_getstatement_empty_fullsource():
+
     def func():
         return sys._getframe(0)
+
     f = func()
     f = _pytest._code.Frame(f)
     prop = f.code.__class__.fullsource
     try:
         f.code.__class__.fullsource = None
         assert f.statement == _pytest._code.Source("")
     finally:
         f.code.__class__.fullsource = prop
@@ -73,83 +81,92 @@ def test_getstatement_empty_fullsource()
 
 def test_code_from_func():
     co = _pytest._code.Code(test_frame_getsourcelineno_myself)
     assert co.firstlineno
     assert co.path
 
 
 def test_unicode_handling():
-    value = py.builtin._totext('\xc4\x85\xc4\x87\n', 'utf-8').encode('utf8')
+    value = py.builtin._totext("\xc4\x85\xc4\x87\n", "utf-8").encode("utf8")
 
     def f():
         raise Exception(value)
 
     excinfo = pytest.raises(Exception, f)
     str(excinfo)
     if sys.version_info[0] < 3:
-        unicode(excinfo)
+        text_type(excinfo)
 
 
-@pytest.mark.skipif(sys.version_info[0] >= 3, reason='python 2 only issue')
+@pytest.mark.skipif(sys.version_info[0] >= 3, reason="python 2 only issue")
 def test_unicode_handling_syntax_error():
-    value = py.builtin._totext('\xc4\x85\xc4\x87\n', 'utf-8').encode('utf8')
+    value = py.builtin._totext("\xc4\x85\xc4\x87\n", "utf-8").encode("utf8")
 
     def f():
-        raise SyntaxError('invalid syntax', (None, 1, 3, value))
+        raise SyntaxError("invalid syntax", (None, 1, 3, value))
 
     excinfo = pytest.raises(Exception, f)
     str(excinfo)
     if sys.version_info[0] < 3:
-        unicode(excinfo)
+        text_type(excinfo)
 
 
 def test_code_getargs():
+
     def f1(x):
         pass
+
     c1 = _pytest._code.Code(f1)
-    assert c1.getargs(var=True) == ('x',)
+    assert c1.getargs(var=True) == ("x",)
 
     def f2(x, *y):
         pass
+
     c2 = _pytest._code.Code(f2)
-    assert c2.getargs(var=True) == ('x', 'y')
+    assert c2.getargs(var=True) == ("x", "y")
 
     def f3(x, **z):
         pass
+
     c3 = _pytest._code.Code(f3)
-    assert c3.getargs(var=True) == ('x', 'z')
+    assert c3.getargs(var=True) == ("x", "z")
 
     def f4(x, *y, **z):
         pass
+
     c4 = _pytest._code.Code(f4)
-    assert c4.getargs(var=True) == ('x', 'y', 'z')
+    assert c4.getargs(var=True) == ("x", "y", "z")
 
 
 def test_frame_getargs():
+
     def f1(x):
         return sys._getframe(0)
-    fr1 = _pytest._code.Frame(f1('a'))
-    assert fr1.getargs(var=True) == [('x', 'a')]
+
+    fr1 = _pytest._code.Frame(f1("a"))
+    assert fr1.getargs(var=True) == [("x", "a")]
 
     def f2(x, *y):
         return sys._getframe(0)
-    fr2 = _pytest._code.Frame(f2('a', 'b', 'c'))
-    assert fr2.getargs(var=True) == [('x', 'a'), ('y', ('b', 'c'))]
+
+    fr2 = _pytest._code.Frame(f2("a", "b", "c"))
+    assert fr2.getargs(var=True) == [("x", "a"), ("y", ("b", "c"))]
 
     def f3(x, **z):
         return sys._getframe(0)
-    fr3 = _pytest._code.Frame(f3('a', b='c'))
-    assert fr3.getargs(var=True) == [('x', 'a'), ('z', {'b': 'c'})]
+
+    fr3 = _pytest._code.Frame(f3("a", b="c"))
+    assert fr3.getargs(var=True) == [("x", "a"), ("z", {"b": "c"})]
 
     def f4(x, *y, **z):
         return sys._getframe(0)
-    fr4 = _pytest._code.Frame(f4('a', 'b', c='d'))
-    assert fr4.getargs(var=True) == [('x', 'a'), ('y', ('b',)),
-                                     ('z', {'c': 'd'})]
+
+    fr4 = _pytest._code.Frame(f4("a", "b", c="d"))
+    assert fr4.getargs(var=True) == [("x", "a"), ("y", ("b",)), ("z", {"c": "d"})]
 
 
 class TestExceptionInfo(object):
 
     def test_bad_getsource(self):
         try:
             if False:
                 pass
@@ -168,29 +185,26 @@ class TestTracebackEntry(object):
                 pass
             else:
                 assert False
         except AssertionError:
             exci = _pytest._code.ExceptionInfo()
         entry = exci.traceback[0]
         source = entry.getsource()
         assert len(source) == 6
-        assert 'assert False' in source[5]
+        assert "assert False" in source[5]
 
 
 class TestReprFuncArgs(object):
 
     def test_not_raise_exception_with_mixed_encoding(self):
         from _pytest._code.code import ReprFuncArgs
 
         tw = TWMock()
 
-        args = [
-            ('unicode_string', u"São Paulo"),
-            ('utf8_string', 'S\xc3\xa3o Paulo'),
-        ]
+        args = [("unicode_string", u"São Paulo"), ("utf8_string", "S\xc3\xa3o Paulo")]
 
         r = ReprFuncArgs(args)
         r.toterminal(tw)
         if sys.version_info[0] >= 3:
-            assert tw.lines[0] == 'unicode_string = São Paulo, utf8_string = São Paulo'
+            assert tw.lines[0] == "unicode_string = São Paulo, utf8_string = São Paulo"
         else:
-            assert tw.lines[0] == 'unicode_string = São Paulo, utf8_string = São Paulo'
+            assert tw.lines[0] == "unicode_string = São Paulo, utf8_string = São Paulo"
--- a/third_party/python/pytest/testing/code/test_excinfo.py
+++ b/third_party/python/pytest/testing/code/test_excinfo.py
@@ -1,33 +1,34 @@
 # -*- coding: utf-8 -*-
 from __future__ import absolute_import, division, print_function
 
+import operator
+import os
 import sys
-import operator
 import _pytest
 import py
 import pytest
 from _pytest._code.code import (
     ExceptionInfo,
     FormattedExcinfo,
     ReprExceptionInfo,
-    ExceptionChainRepr)
+    ExceptionChainRepr,
+)
+from six.moves import queue
 
 from test_source import astonly
 
 try:
     import importlib
 except ImportError:
     invalidate_import_caches = None
 else:
     invalidate_import_caches = getattr(importlib, "invalidate_caches", None)
 
-queue = py.builtin._tryimport('queue', 'Queue')
-
 failsonjython = pytest.mark.xfail("sys.platform.startswith('java')")
 
 pytest_version_info = tuple(map(int, pytest.__version__.split(".")[:3]))
 
 
 class TWMock(object):
     WRITE = object()
 
@@ -59,36 +60,40 @@ def test_excinfo_simple():
     try:
         raise ValueError
     except ValueError:
         info = _pytest._code.ExceptionInfo()
     assert info.type == ValueError
 
 
 def test_excinfo_getstatement():
+
     def g():
         raise ValueError
 
     def f():
         g()
 
     try:
         f()
     except ValueError:
         excinfo = _pytest._code.ExceptionInfo()
-    linenumbers = [_pytest._code.getrawcode(f).co_firstlineno - 1 + 4,
-                   _pytest._code.getrawcode(f).co_firstlineno - 1 + 1,
-                   _pytest._code.getrawcode(g).co_firstlineno - 1 + 1, ]
+    linenumbers = [
+        _pytest._code.getrawcode(f).co_firstlineno - 1 + 4,
+        _pytest._code.getrawcode(f).co_firstlineno - 1 + 1,
+        _pytest._code.getrawcode(g).co_firstlineno - 1 + 1,
+    ]
     values = list(excinfo.traceback)
     foundlinenumbers = [x.lineno for x in values]
     assert foundlinenumbers == linenumbers
     # for x in info:
     #    print "%s:%d  %s" %(x.path.relto(root), x.lineno, x.statement)
     # xxx
 
+
 # testchain for getentries test below
 
 
 def f():
     #
     raise ValueError
     #
 
@@ -102,52 +107,55 @@ def g():
 
 def h():
     #
     g()
     #
 
 
 class TestTraceback_f_g_h(object):
+
     def setup_method(self, method):
         try:
             h()
         except ValueError:
             self.excinfo = _pytest._code.ExceptionInfo()
 
     def test_traceback_entries(self):
         tb = self.excinfo.traceback
         entries = list(tb)
         assert len(tb) == 4  # maybe fragile test
         assert len(entries) == 4  # maybe fragile test
-        names = ['f', 'g', 'h']
+        names = ["f", "g", "h"]
         for entry in entries:
             try:
                 names.remove(entry.frame.code.name)
             except ValueError:
                 pass
         assert not names
 
     def test_traceback_entry_getsource(self):
         tb = self.excinfo.traceback
         s = str(tb[-1].getsource())
         assert s.startswith("def f():")
         assert s.endswith("raise ValueError")
 
     @astonly
     @failsonjython
     def test_traceback_entry_getsource_in_construct(self):
-        source = _pytest._code.Source("""\
+        source = _pytest._code.Source(
+            """\
             def xyz():
                 try:
                     raise ValueError
                 except somenoname:
                     pass
             xyz()
-        """)
+        """
+        )
         try:
             exec(source.compile())
         except NameError:
             tb = _pytest._code.ExceptionInfo().traceback
             print(tb[-1].getsource())
             s = str(tb[-1].getsource())
             assert s.startswith("def xyz():\n    try:")
             assert s.strip().endswith("except somenoname:")
@@ -162,32 +170,36 @@ class TestTraceback_f_g_h(object):
         assert len(newtraceback) == 1
 
     def test_traceback_cut_excludepath(self, testdir):
         p = testdir.makepyfile("def f(): raise ValueError")
         excinfo = pytest.raises(ValueError, "p.pyimport().f()")
         basedir = py.path.local(pytest.__file__).dirpath()
         newtraceback = excinfo.traceback.cut(excludepath=basedir)
         for x in newtraceback:
-            if hasattr(x, 'path'):
+            if hasattr(x, "path"):
                 assert not py.path.local(x.path).relto(basedir)
         assert newtraceback[-1].frame.code.path == p
 
     def test_traceback_filter(self):
         traceback = self.excinfo.traceback
         ntraceback = traceback.filter()
         assert len(ntraceback) == len(traceback) - 1
 
-    @pytest.mark.parametrize('tracebackhide, matching', [
-        (lambda info: True, True),
-        (lambda info: False, False),
-        (operator.methodcaller('errisinstance', ValueError), True),
-        (operator.methodcaller('errisinstance', IndexError), False),
-    ])
+    @pytest.mark.parametrize(
+        "tracebackhide, matching",
+        [
+            (lambda info: True, True),
+            (lambda info: False, False),
+            (operator.methodcaller("errisinstance", ValueError), True),
+            (operator.methodcaller("errisinstance", IndexError), False),
+        ],
+    )
     def test_traceback_filter_selective(self, tracebackhide, matching):
+
         def f():
             #
             raise ValueError
             #
 
         def g():
             #
             __tracebackhide__ = tracebackhide
@@ -197,84 +209,91 @@ class TestTraceback_f_g_h(object):
         def h():
             #
             g()
             #
 
         excinfo = pytest.raises(ValueError, h)
         traceback = excinfo.traceback
         ntraceback = traceback.filter()
-        print('old: {0!r}'.format(traceback))
-        print('new: {0!r}'.format(ntraceback))
+        print("old: {!r}".format(traceback))
+        print("new: {!r}".format(ntraceback))
 
         if matching:
             assert len(ntraceback) == len(traceback) - 2
         else:
             # -1 because of the __tracebackhide__ in pytest.raises
             assert len(ntraceback) == len(traceback) - 1
 
     def test_traceback_recursion_index(self):
+
         def f(n):
             if n < 10:
                 n += 1
             f(n)
+
         excinfo = pytest.raises(RuntimeError, f, 8)
         traceback = excinfo.traceback
         recindex = traceback.recursionindex()
         assert recindex == 3
 
     def test_traceback_only_specific_recursion_errors(self, monkeypatch):
+
         def f(n):
             if n == 0:
                 raise RuntimeError("hello")
             f(n - 1)
 
         excinfo = pytest.raises(RuntimeError, f, 100)
         monkeypatch.delattr(excinfo.traceback.__class__, "recursionindex")
         repr = excinfo.getrepr()
         assert "RuntimeError: hello" in str(repr.reprcrash)
 
     def test_traceback_no_recursion_index(self):
+
         def do_stuff():
             raise RuntimeError
 
         def reraise_me():
             import sys
+
             exc, val, tb = sys.exc_info()
             py.builtin._reraise(exc, val, tb)
 
         def f(n):
             try:
                 do_stuff()
             except:  # noqa
                 reraise_me()
 
         excinfo = pytest.raises(RuntimeError, f, 8)
         traceback = excinfo.traceback
         recindex = traceback.recursionindex()
         assert recindex is None
 
     def test_traceback_messy_recursion(self):
         # XXX: simplified locally testable version
-        decorator = pytest.importorskip('decorator').decorator
+        decorator = pytest.importorskip("decorator").decorator
 
         def log(f, *k, **kw):
-            print('%s %s' % (k, kw))
+            print("%s %s" % (k, kw))
             f(*k, **kw)
+
         log = decorator(log)
 
         def fail():
-            raise ValueError('')
+            raise ValueError("")
 
         fail = log(log(fail))
 
         excinfo = pytest.raises(ValueError, fail)
         assert excinfo.traceback.recursionindex() is None
 
     def test_traceback_getcrashentry(self):
+
         def i():
             __tracebackhide__ = True
             raise ValueError
 
         def h():
             i()
 
         def g():
@@ -285,43 +304,43 @@ class TestTraceback_f_g_h(object):
             g()
 
         excinfo = pytest.raises(ValueError, f)
         tb = excinfo.traceback
         entry = tb.getcrashentry()
         co = _pytest._code.Code(h)
         assert entry.frame.code.path == co.path
         assert entry.lineno == co.firstlineno + 1
-        assert entry.frame.code.name == 'h'
+        assert entry.frame.code.name == "h"
 
     def test_traceback_getcrashentry_empty(self):
+
         def g():
             __tracebackhide__ = True
             raise ValueError
 
         def f():
             __tracebackhide__ = True
             g()
 
         excinfo = pytest.raises(ValueError, f)
         tb = excinfo.traceback
         entry = tb.getcrashentry()
         co = _pytest._code.Code(g)
         assert entry.frame.code.path == co.path
         assert entry.lineno == co.firstlineno + 2
-        assert entry.frame.code.name == 'g'
+        assert entry.frame.code.name == "g"
 
 
 def test_excinfo_exconly():
     excinfo = pytest.raises(ValueError, h)
-    assert excinfo.exconly().startswith('ValueError')
-    excinfo = pytest.raises(ValueError,
-                            "raise ValueError('hello\\nworld')")
+    assert excinfo.exconly().startswith("ValueError")
+    excinfo = pytest.raises(ValueError, "raise ValueError('hello\\nworld')")
     msg = excinfo.exconly(tryshort=True)
-    assert msg.startswith('ValueError')
+    assert msg.startswith("ValueError")
     assert msg.endswith("world")
 
 
 def test_excinfo_repr():
     excinfo = pytest.raises(ValueError, h)
     s = repr(excinfo)
     assert s == "<ExceptionInfo ValueError tblen=4>"
 
@@ -340,37 +359,33 @@ def test_excinfo_errisinstance():
 
 
 def test_excinfo_no_sourcecode():
     try:
         exec("raise ValueError()")
     except ValueError:
         excinfo = _pytest._code.ExceptionInfo()
     s = str(excinfo.traceback[-1])
-    if py.std.sys.version_info < (2, 5):
-        assert s == "  File '<string>':1 in ?\n  ???\n"
-    else:
-        assert s == "  File '<string>':1 in <module>\n  ???\n"
+    assert s == "  File '<string>':1 in <module>\n  ???\n"
 
 
 def test_excinfo_no_python_sourcecode(tmpdir):
     # XXX: simplified locally testable version
-    tmpdir.join('test.txt').write("{{ h()}}:")
+    tmpdir.join("test.txt").write("{{ h()}}:")
 
-    jinja2 = pytest.importorskip('jinja2')
+    jinja2 = pytest.importorskip("jinja2")
     loader = jinja2.FileSystemLoader(str(tmpdir))
     env = jinja2.Environment(loader=loader)
-    template = env.get_template('test.txt')
-    excinfo = pytest.raises(ValueError,
-                            template.render, h=h)
+    template = env.get_template("test.txt")
+    excinfo = pytest.raises(ValueError, template.render, h=h)
     for item in excinfo.traceback:
         print(item)  # XXX: for some reason jinja.Template.render is printed in full
         item.source  # shouldnt fail
-        if item.path.basename == 'test.txt':
-            assert str(item.source) == '{{ h()}}:'
+        if item.path.basename == "test.txt":
+            assert str(item.source) == "{{ h()}}:"
 
 
 def test_entrysource_Queue_example():
     try:
         queue.Queue().get(timeout=0.001)
     except queue.Empty:
         excinfo = _pytest._code.ExceptionInfo()
     entry = excinfo.traceback[-1]
@@ -390,136 +405,144 @@ def test_codepath_Queue_example():
     assert isinstance(path, py.path.local)
     assert path.basename.lower() == "queue.py"
     assert path.check()
 
 
 def test_match_succeeds():
     with pytest.raises(ZeroDivisionError) as excinfo:
         0 // 0
-    excinfo.match(r'.*zero.*')
+    excinfo.match(r".*zero.*")
 
 
 def test_match_raises_error(testdir):
-    testdir.makepyfile("""
+    testdir.makepyfile(
+        """
         import pytest
         def test_division_zero():
             with pytest.raises(ZeroDivisionError) as excinfo:
                 0 / 0
             excinfo.match(r'[123]+')
-    """)
+    """
+    )
     result = testdir.runpytest()
     assert result.ret != 0
-    result.stdout.fnmatch_lines([
-        "*AssertionError*Pattern*[123]*not found*",
-    ])
+    result.stdout.fnmatch_lines(["*AssertionError*Pattern*[123]*not found*"])
 
 
 class TestFormattedExcinfo(object):
 
     @pytest.fixture
     def importasmod(self, request):
+
         def importasmod(source):
             source = _pytest._code.Source(source)
             tmpdir = request.getfixturevalue("tmpdir")
             modpath = tmpdir.join("mod.py")
             tmpdir.ensure("__init__.py")
             modpath.write(source)
             if invalidate_import_caches is not None:
                 invalidate_import_caches()
             return modpath.pyimport()
+
         return importasmod
 
     def excinfo_from_exec(self, source):
         source = _pytest._code.Source(source).strip()
         try:
             exec(source.compile())
         except KeyboardInterrupt:
             raise
         except:  # noqa
             return _pytest._code.ExceptionInfo()
         assert 0, "did not raise"
 
     def test_repr_source(self):
         pr = FormattedExcinfo()
-        source = _pytest._code.Source("""
+        source = _pytest._code.Source(
+            """
             def f(x):
                 pass
-        """).strip()
+        """
+        ).strip()
         pr.flow_marker = "|"
         lines = pr.get_source(source, 0)
         assert len(lines) == 2
         assert lines[0] == "|   def f(x):"
         assert lines[1] == "        pass"
 
     def test_repr_source_excinfo(self):
         """ check if indentation is right """
         pr = FormattedExcinfo()
-        excinfo = self.excinfo_from_exec("""
+        excinfo = self.excinfo_from_exec(
+            """
                 def f():
                     assert 0
                 f()
-        """)
+        """
+        )
         pr = FormattedExcinfo()
         source = pr._getentrysource(excinfo.traceback[-1])
         lines = pr.get_source(source, 1, excinfo)
-        assert lines == [
-            '    def f():',
-            '>       assert 0',
-            'E       AssertionError'
-        ]
+        assert lines == ["    def f():", ">       assert 0", "E       AssertionError"]
 
     def test_repr_source_not_existing(self):
         pr = FormattedExcinfo()
         co = compile("raise ValueError()", "", "exec")
         try:
             exec(co)
         except ValueError:
             excinfo = _pytest._code.ExceptionInfo()
         repr = pr.repr_excinfo(excinfo)
         assert repr.reprtraceback.reprentries[1].lines[0] == ">   ???"
-        if py.std.sys.version_info[0] >= 3:
+        if sys.version_info[0] >= 3:
             assert repr.chain[0][0].reprentries[1].lines[0] == ">   ???"
 
     def test_repr_many_line_source_not_existing(self):
         pr = FormattedExcinfo()
-        co = compile("""
+        co = compile(
+            """
 a = 1
 raise ValueError()
-""", "", "exec")
+""",
+            "",
+            "exec",
+        )
         try:
             exec(co)
         except ValueError:
             excinfo = _pytest._code.ExceptionInfo()
         repr = pr.repr_excinfo(excinfo)
         assert repr.reprtraceback.reprentries[1].lines[0] == ">   ???"
-        if py.std.sys.version_info[0] >= 3:
+        if sys.version_info[0] >= 3:
             assert repr.chain[0][0].reprentries[1].lines[0] == ">   ???"
 
     def test_repr_source_failing_fullsource(self):
         pr = FormattedExcinfo()
 
         class FakeCode(object):
+
             class raw(object):
-                co_filename = '?'
+                co_filename = "?"
 
-            path = '?'
+            path = "?"
             firstlineno = 5
 
             def fullsource(self):
                 return None
 
             fullsource = property(fullsource)
 
         class FakeFrame(object):
             code = FakeCode()
             f_locals = {}
             f_globals = {}
 
         class FakeTracebackEntry(_pytest._code.Traceback.Entry):
+
             def __init__(self, tb, excinfo=None):
                 self.lineno = 5 + 3
 
             @property
             def frame(self):
                 return FakeFrame()
 
         class Traceback(_pytest._code.Traceback):
@@ -541,315 +564,345 @@ raise ValueError()
         excinfo = FakeExcinfo()
 
         class FakeRawTB(object):
             tb_next = None
 
         tb = FakeRawTB()
         excinfo.traceback = Traceback(tb)
 
-        fail = IOError()  # noqa
+        fail = IOError()
         repr = pr.repr_excinfo(excinfo)
         assert repr.reprtraceback.reprentries[0].lines[0] == ">   ???"
-        if py.std.sys.version_info[0] >= 3:
+        if sys.version_info[0] >= 3:
             assert repr.chain[0][0].reprentries[0].lines[0] == ">   ???"
 
         fail = py.error.ENOENT  # noqa
         repr = pr.repr_excinfo(excinfo)
         assert repr.reprtraceback.reprentries[0].lines[0] == ">   ???"
-        if py.std.sys.version_info[0] >= 3:
+        if sys.version_info[0] >= 3:
             assert repr.chain[0][0].reprentries[0].lines[0] == ">   ???"
 
     def test_repr_local(self):
         p = FormattedExcinfo(showlocals=True)
-        loc = {'y': 5, 'z': 7, 'x': 3, '@x': 2, '__builtins__': {}}
+        loc = {"y": 5, "z": 7, "x": 3, "@x": 2, "__builtins__": {}}
         reprlocals = p.repr_locals(loc)
         assert reprlocals.lines
-        assert reprlocals.lines[0] == '__builtins__ = <builtins>'
-        assert reprlocals.lines[1] == 'x          = 3'
-        assert reprlocals.lines[2] == 'y          = 5'
-        assert reprlocals.lines[3] == 'z          = 7'
+        assert reprlocals.lines[0] == "__builtins__ = <builtins>"
+        assert reprlocals.lines[1] == "x          = 3"
+        assert reprlocals.lines[2] == "y          = 5"
+        assert reprlocals.lines[3] == "z          = 7"
 
     def test_repr_tracebackentry_lines(self, importasmod):
-        mod = importasmod("""
+        mod = importasmod(
+            """
             def func1():
                 raise ValueError("hello\\nworld")
-        """)
+        """
+        )
         excinfo = pytest.raises(ValueError, mod.func1)
         excinfo.traceback = excinfo.traceback.filter()
         p = FormattedExcinfo()
         reprtb = p.repr_traceback_entry(excinfo.traceback[-1])
 
         # test as intermittent entry
         lines = reprtb.lines
-        assert lines[0] == '    def func1():'
+        assert lines[0] == "    def func1():"
         assert lines[1] == '>       raise ValueError("hello\\nworld")'
 
         # test as last entry
         p = FormattedExcinfo(showlocals=True)
         repr_entry = p.repr_traceback_entry(excinfo.traceback[-1], excinfo)
         lines = repr_entry.lines
-        assert lines[0] == '    def func1():'
+        assert lines[0] == "    def func1():"
         assert lines[1] == '>       raise ValueError("hello\\nworld")'
-        assert lines[2] == 'E       ValueError: hello'
-        assert lines[3] == 'E       world'
+        assert lines[2] == "E       ValueError: hello"
+        assert lines[3] == "E       world"
         assert not lines[4:]
 
         loc = repr_entry.reprlocals is not None
         loc = repr_entry.reprfileloc
         assert loc.path == mod.__file__
         assert loc.lineno == 3
         # assert loc.message == "ValueError: hello"
 
     def test_repr_tracebackentry_lines2(self, importasmod):
-        mod = importasmod("""
+        mod = importasmod(
+            """
             def func1(m, x, y, z):
                 raise ValueError("hello\\nworld")
-        """)
+        """
+        )
         excinfo = pytest.raises(ValueError, mod.func1, "m" * 90, 5, 13, "z" * 120)
         excinfo.traceback = excinfo.traceback.filter()
         entry = excinfo.traceback[-1]
         p = FormattedExcinfo(funcargs=True)
         reprfuncargs = p.repr_args(entry)
-        assert reprfuncargs.args[0] == ('m', repr("m" * 90))
-        assert reprfuncargs.args[1] == ('x', '5')
-        assert reprfuncargs.args[2] == ('y', '13')
-        assert reprfuncargs.args[3] == ('z', repr("z" * 120))
+        assert reprfuncargs.args[0] == ("m", repr("m" * 90))
+        assert reprfuncargs.args[1] == ("x", "5")
+        assert reprfuncargs.args[2] == ("y", "13")
+        assert reprfuncargs.args[3] == ("z", repr("z" * 120))
 
         p = FormattedExcinfo(funcargs=True)
         repr_entry = p.repr_traceback_entry(entry)
         assert repr_entry.reprfuncargs.args == reprfuncargs.args
         tw = TWMock()
         repr_entry.toterminal(tw)
-        assert tw.lines[0] == "m = " + repr('m' * 90)
+        assert tw.lines[0] == "m = " + repr("m" * 90)
         assert tw.lines[1] == "x = 5, y = 13"
-        assert tw.lines[2] == "z = " + repr('z' * 120)
+        assert tw.lines[2] == "z = " + repr("z" * 120)
 
     def test_repr_tracebackentry_lines_var_kw_args(self, importasmod):
-        mod = importasmod("""
+        mod = importasmod(
+            """
             def func1(x, *y, **z):
                 raise ValueError("hello\\nworld")
-        """)
-        excinfo = pytest.raises(ValueError, mod.func1, 'a', 'b', c='d')
+        """
+        )
+        excinfo = pytest.raises(ValueError, mod.func1, "a", "b", c="d")
         excinfo.traceback = excinfo.traceback.filter()
         entry = excinfo.traceback[-1]
         p = FormattedExcinfo(funcargs=True)
         reprfuncargs = p.repr_args(entry)
-        assert reprfuncargs.args[0] == ('x', repr('a'))
-        assert reprfuncargs.args[1] == ('y', repr(('b',)))
-        assert reprfuncargs.args[2] == ('z', repr({'c': 'd'}))
+        assert reprfuncargs.args[0] == ("x", repr("a"))
+        assert reprfuncargs.args[1] == ("y", repr(("b",)))
+        assert reprfuncargs.args[2] == ("z", repr({"c": "d"}))
 
         p = FormattedExcinfo(funcargs=True)
         repr_entry = p.repr_traceback_entry(entry)
         assert repr_entry.reprfuncargs.args == reprfuncargs.args
         tw = TWMock()
         repr_entry.toterminal(tw)
         assert tw.lines[0] == "x = 'a', y = ('b',), z = {'c': 'd'}"
 
     def test_repr_tracebackentry_short(self, importasmod):
-        mod = importasmod("""
+        mod = importasmod(
+            """
             def func1():
                 raise ValueError("hello")
             def entry():
                 func1()
-        """)
+        """
+        )
         excinfo = pytest.raises(ValueError, mod.entry)
         p = FormattedExcinfo(style="short")
         reprtb = p.repr_traceback_entry(excinfo.traceback[-2])
         lines = reprtb.lines
         basename = py.path.local(mod.__file__).basename
-        assert lines[0] == '    func1()'
+        assert lines[0] == "    func1()"
         assert basename in str(reprtb.reprfileloc.path)
         assert reprtb.reprfileloc.lineno == 5
 
         # test last entry
         p = FormattedExcinfo(style="short")
         reprtb = p.repr_traceback_entry(excinfo.traceback[-1], excinfo)
         lines = reprtb.lines
         assert lines[0] == '    raise ValueError("hello")'
-        assert lines[1] == 'E   ValueError: hello'
+        assert lines[1] == "E   ValueError: hello"
         assert basename in str(reprtb.reprfileloc.path)
         assert reprtb.reprfileloc.lineno == 3
 
     def test_repr_tracebackentry_no(self, importasmod):
-        mod = importasmod("""
+        mod = importasmod(
+            """
             def func1():
                 raise ValueError("hello")
             def entry():
                 func1()
-        """)
+        """
+        )
         excinfo = pytest.raises(ValueError, mod.entry)
         p = FormattedExcinfo(style="no")
         p.repr_traceback_entry(excinfo.traceback[-2])
 
         p = FormattedExcinfo(style="no")
         reprentry = p.repr_traceback_entry(excinfo.traceback[-1], excinfo)
         lines = reprentry.lines
-        assert lines[0] == 'E   ValueError: hello'
+        assert lines[0] == "E   ValueError: hello"
         assert not lines[1:]
 
     def test_repr_traceback_tbfilter(self, importasmod):
-        mod = importasmod("""
+        mod = importasmod(
+            """
             def f(x):
                 raise ValueError(x)
             def entry():
                 f(0)
-        """)
+        """
+        )
         excinfo = pytest.raises(ValueError, mod.entry)
         p = FormattedExcinfo(tbfilter=True)
         reprtb = p.repr_traceback(excinfo)
         assert len(reprtb.reprentries) == 2
         p = FormattedExcinfo(tbfilter=False)
         reprtb = p.repr_traceback(excinfo)
         assert len(reprtb.reprentries) == 3
 
     def test_traceback_short_no_source(self, importasmod, monkeypatch):
-        mod = importasmod("""
+        mod = importasmod(
+            """
             def func1():
                 raise ValueError("hello")
             def entry():
                 func1()
-        """)
+        """
+        )
         excinfo = pytest.raises(ValueError, mod.entry)
         from _pytest._code.code import Code
-        monkeypatch.setattr(Code, 'path', 'bogus')
+
+        monkeypatch.setattr(Code, "path", "bogus")
         excinfo.traceback[0].frame.code.path = "bogus"
         p = FormattedExcinfo(style="short")
         reprtb = p.repr_traceback_entry(excinfo.traceback[-2])
         lines = reprtb.lines
         last_p = FormattedExcinfo(style="short")
         last_reprtb = last_p.repr_traceback_entry(excinfo.traceback[-1], excinfo)
         last_lines = last_reprtb.lines
         monkeypatch.undo()
-        assert lines[0] == '    func1()'
+        assert lines[0] == "    func1()"
 
         assert last_lines[0] == '    raise ValueError("hello")'
-        assert last_lines[1] == 'E   ValueError: hello'
+        assert last_lines[1] == "E   ValueError: hello"
 
     def test_repr_traceback_and_excinfo(self, importasmod):
-        mod = importasmod("""
+        mod = importasmod(
+            """
             def f(x):
                 raise ValueError(x)
             def entry():
                 f(0)
-        """)
+        """
+        )
         excinfo = pytest.raises(ValueError, mod.entry)
 
         for style in ("long", "short"):
             p = FormattedExcinfo(style=style)
             reprtb = p.repr_traceback(excinfo)
             assert len(reprtb.reprentries) == 2
             assert reprtb.style == style
             assert not reprtb.extraline
             repr = p.repr_excinfo(excinfo)
             assert repr.reprtraceback
             assert len(repr.reprtraceback.reprentries) == len(reprtb.reprentries)
-            if py.std.sys.version_info[0] >= 3:
+            if sys.version_info[0] >= 3:
                 assert repr.chain[0][0]
                 assert len(repr.chain[0][0].reprentries) == len(reprtb.reprentries)
             assert repr.reprcrash.path.endswith("mod.py")
             assert repr.reprcrash.message == "ValueError: 0"
 
     def test_repr_traceback_with_invalid_cwd(self, importasmod, monkeypatch):
-        mod = importasmod("""
+        mod = importasmod(
+            """
             def f(x):
                 raise ValueError(x)
             def entry():
                 f(0)
-        """)
+        """
+        )
         excinfo = pytest.raises(ValueError, mod.entry)
 
         p = FormattedExcinfo()
 
         def raiseos():
             raise OSError(2)
 
-        monkeypatch.setattr(py.std.os, 'getcwd', raiseos)
+        monkeypatch.setattr(os, "getcwd", raiseos)
         assert p._makepath(__file__) == __file__
         p.repr_traceback(excinfo)
 
     def test_repr_excinfo_addouterr(self, importasmod):
-        mod = importasmod("""
+        mod = importasmod(
+            """
             def entry():
                 raise ValueError()
-        """)
+        """
+        )
         excinfo = pytest.raises(ValueError, mod.entry)
         repr = excinfo.getrepr()
         repr.addsection("title", "content")
         twmock = TWMock()
         repr.toterminal(twmock)
         assert twmock.lines[-1] == "content"
         assert twmock.lines[-2] == ("-", "title")
 
     def test_repr_excinfo_reprcrash(self, importasmod):
-        mod = importasmod("""
+        mod = importasmod(
+            """
             def entry():
                 raise ValueError()
-        """)
+        """
+        )
         excinfo = pytest.raises(ValueError, mod.entry)
         repr = excinfo.getrepr()
         assert repr.reprcrash.path.endswith("mod.py")
         assert repr.reprcrash.lineno == 3
         assert repr.reprcrash.message == "ValueError"
         assert str(repr.reprcrash).endswith("mod.py:3: ValueError")
 
     def test_repr_traceback_recursion(self, importasmod):
-        mod = importasmod("""
+        mod = importasmod(
+            """
             def rec2(x):
                 return rec1(x+1)
             def rec1(x):
                 return rec2(x-1)
             def entry():
                 rec1(42)
-        """)
+        """
+        )
         excinfo = pytest.raises(RuntimeError, mod.entry)
 
         for style in ("short", "long", "no"):
             p = FormattedExcinfo(style="short")
             reprtb = p.repr_traceback(excinfo)
             assert reprtb.extraline == "!!! Recursion detected (same locals & position)"
             assert str(reprtb)
 
     def test_reprexcinfo_getrepr(self, importasmod):
-        mod = importasmod("""
+        mod = importasmod(
+            """
             def f(x):
                 raise ValueError(x)
             def entry():
                 f(0)
-        """)
+        """
+        )
         excinfo = pytest.raises(ValueError, mod.entry)
 
         for style in ("short", "long", "no"):
             for showlocals in (True, False):
                 repr = excinfo.getrepr(style=style, showlocals=showlocals)
-                if py.std.sys.version_info[0] < 3:
+                if sys.version_info[0] < 3:
                     assert isinstance(repr, ReprExceptionInfo)
                 assert repr.reprtraceback.style == style
-                if py.std.sys.version_info[0] >= 3:
+                if sys.version_info[0] >= 3:
                     assert isinstance(repr, ExceptionChainRepr)
                     for repr in repr.chain:
                         assert repr[0].style == style
 
     def test_reprexcinfo_unicode(self):
         from _pytest._code.code import TerminalRepr
 
         class MyRepr(TerminalRepr):
+
             def toterminal(self, tw):
                 tw.line(py.builtin._totext("я", "utf-8"))
 
         x = py.builtin._totext(MyRepr())
         assert x == py.builtin._totext("я", "utf-8")
 
     def test_toterminal_long(self, importasmod):
-        mod = importasmod("""
+        mod = importasmod(
+            """
             def g(x):
                 raise ValueError(x)
             def f():
                 g(3)
-        """)
+        """
+        )
         excinfo = pytest.raises(ValueError, mod.f)
         excinfo.traceback = excinfo.traceback.filter()
         repr = excinfo.getrepr()
         tw = TWMock()
         repr.toterminal(tw)
         assert tw.lines[0] == ""
         tw.lines.pop(0)
         assert tw.lines[0] == "    def f():"
@@ -864,24 +917,26 @@ raise ValueError()
         assert tw.lines[8] == ">       raise ValueError(x)"
         assert tw.lines[9] == "E       ValueError: 3"
         assert tw.lines[10] == ""
         line = tw.get_write_msg(11)
         assert line.endswith("mod.py")
         assert tw.lines[12] == ":3: ValueError"
 
     def test_toterminal_long_missing_source(self, importasmod, tmpdir):
-        mod = importasmod("""
+        mod = importasmod(
+            """
             def g(x):
                 raise ValueError(x)
             def f():
                 g(3)
-        """)
+        """
+        )
         excinfo = pytest.raises(ValueError, mod.f)
-        tmpdir.join('mod.py').remove()
+        tmpdir.join("mod.py").remove()
         excinfo.traceback = excinfo.traceback.filter()
         repr = excinfo.getrepr()
         tw = TWMock()
         repr.toterminal(tw)
         assert tw.lines[0] == ""
         tw.lines.pop(0)
         assert tw.lines[0] == ">   ???"
         assert tw.lines[1] == ""
@@ -893,24 +948,26 @@ raise ValueError()
         assert tw.lines[6] == ">   ???"
         assert tw.lines[7] == "E   ValueError: 3"
         assert tw.lines[8] == ""
         line = tw.get_write_msg(9)
         assert line.endswith("mod.py")
         assert tw.lines[10] == ":3: ValueError"
 
     def test_toterminal_long_incomplete_source(self, importasmod, tmpdir):
-        mod = importasmod("""
+        mod = importasmod(
+            """
             def g(x):
                 raise ValueError(x)
             def f():
                 g(3)
-        """)
+        """
+        )
         excinfo = pytest.raises(ValueError, mod.f)
-        tmpdir.join('mod.py').write('asdf')
+        tmpdir.join("mod.py").write("asdf")
         excinfo.traceback = excinfo.traceback.filter()
         repr = excinfo.getrepr()
         tw = TWMock()
         repr.toterminal(tw)
         assert tw.lines[0] == ""
         tw.lines.pop(0)
         assert tw.lines[0] == ">   ???"
         assert tw.lines[1] == ""
@@ -922,20 +979,22 @@ raise ValueError()
         assert tw.lines[6] == ">   ???"
         assert tw.lines[7] == "E   ValueError: 3"
         assert tw.lines[8] == ""
         line = tw.get_write_msg(9)
         assert line.endswith("mod.py")
         assert tw.lines[10] == ":3: ValueError"
 
     def test_toterminal_long_filenames(self, importasmod):
-        mod = importasmod("""
+        mod = importasmod(
+            """
             def f():
                 raise ValueError()
-        """)
+        """
+        )
         excinfo = pytest.raises(ValueError, mod.f)
         tw = TWMock()
         path = py.path.local(mod.__file__)
         old = path.dirpath().chdir()
         try:
             repr = excinfo.getrepr(abspath=False)
             repr.toterminal(tw)
             x = py.path.local().bestrelpath(path)
@@ -948,47 +1007,59 @@ raise ValueError()
             repr.toterminal(tw)
             msg = tw.get_write_msg(-2)
             assert msg == path
             line = tw.lines[-1]
             assert line == ":3: ValueError"
         finally:
             old.chdir()
 
-    @pytest.mark.parametrize('reproptions', [
-        {'style': style, 'showlocals': showlocals,
-         'funcargs': funcargs, 'tbfilter': tbfilter
-         } for style in ("long", "short", "no")
-        for showlocals in (True, False)
-        for tbfilter in (True, False)
-        for funcargs in (True, False)])
+    @pytest.mark.parametrize(
+        "reproptions",
+        [
+            {
+                "style": style,
+                "showlocals": showlocals,
+                "funcargs": funcargs,
+                "tbfilter": tbfilter,
+            }
+            for style in ("long", "short", "no")
+            for showlocals in (True, False)
+            for tbfilter in (True, False)
+            for funcargs in (True, False)
+        ],
+    )
     def test_format_excinfo(self, importasmod, reproptions):
-        mod = importasmod("""
+        mod = importasmod(
+            """
             def g(x):
                 raise ValueError(x)
             def f():
                 g(3)
-        """)
+        """
+        )
         excinfo = pytest.raises(ValueError, mod.f)
         tw = py.io.TerminalWriter(stringio=True)
         repr = excinfo.getrepr(**reproptions)
         repr.toterminal(tw)
         assert tw.stringio.getvalue()
 
     def test_traceback_repr_style(self, importasmod):
-        mod = importasmod("""
+        mod = importasmod(
+            """
             def f():
                 g()
             def g():
                 h()
             def h():
                 i()
             def i():
                 raise ValueError()
-        """)
+        """
+        )
         excinfo = pytest.raises(ValueError, mod.f)
         excinfo.traceback = excinfo.traceback.filter()
         excinfo.traceback[1].set_repr_style("short")
         excinfo.traceback[2].set_repr_style("short")
         r = excinfo.getrepr(style="long")
         tw = TWMock()
         r.toterminal(tw)
         for line in tw.lines:
@@ -1014,239 +1085,273 @@ raise ValueError()
         assert tw.lines[17] == "E       ValueError"
         assert tw.lines[18] == ""
         msg = tw.get_write_msg(19)
         msg.endswith("mod.py")
         assert tw.lines[20] == ":9: ValueError"
 
     @pytest.mark.skipif("sys.version_info[0] < 3")
     def test_exc_chain_repr(self, importasmod):
-        mod = importasmod("""
+        mod = importasmod(
+            """
             class Err(Exception):
                 pass
             def f():
                 try:
                     g()
                 except Exception as e:
                     raise Err() from e
                 finally:
                     h()
             def g():
                 raise ValueError()
 
             def h():
                 raise AttributeError()
-        """)
+        """
+        )
         excinfo = pytest.raises(AttributeError, mod.f)
         r = excinfo.getrepr(style="long")
         tw = TWMock()
         r.toterminal(tw)
         for line in tw.lines:
             print(line)
         assert tw.lines[0] == ""
         assert tw.lines[1] == "    def f():"
         assert tw.lines[2] == "        try:"
         assert tw.lines[3] == ">           g()"
         assert tw.lines[4] == ""
         line = tw.get_write_msg(5)
-        assert line.endswith('mod.py')
-        assert tw.lines[6] == ':6: '
+        assert line.endswith("mod.py")
+        assert tw.lines[6] == ":6: "
         assert tw.lines[7] == ("_ ", None)
         assert tw.lines[8] == ""
         assert tw.lines[9] == "    def g():"
         assert tw.lines[10] == ">       raise ValueError()"
         assert tw.lines[11] == "E       ValueError"
         assert tw.lines[12] == ""
         line = tw.get_write_msg(13)
-        assert line.endswith('mod.py')
-        assert tw.lines[14] == ':12: ValueError'
+        assert line.endswith("mod.py")
+        assert tw.lines[14] == ":12: ValueError"
         assert tw.lines[15] == ""
-        assert tw.lines[16] == "The above exception was the direct cause of the following exception:"
+        assert (
+            tw.lines[16]
+            == "The above exception was the direct cause of the following exception:"
+        )
         assert tw.lines[17] == ""
         assert tw.lines[18] == "    def f():"
         assert tw.lines[19] == "        try:"
         assert tw.lines[20] == "            g()"
         assert tw.lines[21] == "        except Exception as e:"
         assert tw.lines[22] == ">           raise Err() from e"
         assert tw.lines[23] == "E           test_exc_chain_repr0.mod.Err"
         assert tw.lines[24] == ""
         line = tw.get_write_msg(25)
-        assert line.endswith('mod.py')
+        assert line.endswith("mod.py")
         assert tw.lines[26] == ":8: Err"
         assert tw.lines[27] == ""
-        assert tw.lines[28] == "During handling of the above exception, another exception occurred:"
+        assert (
+            tw.lines[28]
+            == "During handling of the above exception, another exception occurred:"
+        )
         assert tw.lines[29] == ""
         assert tw.lines[30] == "    def f():"
         assert tw.lines[31] == "        try:"
         assert tw.lines[32] == "            g()"
         assert tw.lines[33] == "        except Exception as e:"
         assert tw.lines[34] == "            raise Err() from e"
         assert tw.lines[35] == "        finally:"
         assert tw.lines[36] == ">           h()"
         assert tw.lines[37] == ""
         line = tw.get_write_msg(38)
-        assert line.endswith('mod.py')
+        assert line.endswith("mod.py")
         assert tw.lines[39] == ":10: "
-        assert tw.lines[40] == ('_ ', None)
+        assert tw.lines[40] == ("_ ", None)
         assert tw.lines[41] == ""
         assert tw.lines[42] == "    def h():"
         assert tw.lines[43] == ">       raise AttributeError()"
         assert tw.lines[44] == "E       AttributeError"
         assert tw.lines[45] == ""
         line = tw.get_write_msg(46)
-        assert line.endswith('mod.py')
+        assert line.endswith("mod.py")
         assert tw.lines[47] == ":15: AttributeError"
 
     @pytest.mark.skipif("sys.version_info[0] < 3")
     def test_exc_repr_with_raise_from_none_chain_suppression(self, importasmod):
-        mod = importasmod("""
+        mod = importasmod(
+            """
             def f():
                 try:
                     g()
                 except Exception:
                     raise AttributeError() from None
             def g():
                 raise ValueError()
-        """)
+        """
+        )
         excinfo = pytest.raises(AttributeError, mod.f)
         r = excinfo.getrepr(style="long")
         tw = TWMock()
         r.toterminal(tw)
         for line in tw.lines:
             print(line)
         assert tw.lines[0] == ""
         assert tw.lines[1] == "    def f():"
         assert tw.lines[2] == "        try:"
         assert tw.lines[3] == "            g()"
         assert tw.lines[4] == "        except Exception:"
         assert tw.lines[5] == ">           raise AttributeError() from None"
         assert tw.lines[6] == "E           AttributeError"
         assert tw.lines[7] == ""
         line = tw.get_write_msg(8)
-        assert line.endswith('mod.py')
+        assert line.endswith("mod.py")
         assert tw.lines[9] == ":6: AttributeError"
         assert len(tw.lines) == 10
 
     @pytest.mark.skipif("sys.version_info[0] < 3")
-    @pytest.mark.parametrize('reason, description', [
-        ('cause', 'The above exception was the direct cause of the following exception:'),
-        ('context', 'During handling of the above exception, another exception occurred:'),
-    ])
+    @pytest.mark.parametrize(
+        "reason, description",
+        [
+            (
+                "cause",
+                "The above exception was the direct cause of the following exception:",
+            ),
+            (
+                "context",
+                "During handling of the above exception, another exception occurred:",
+            ),
+        ],
+    )
     def test_exc_chain_repr_without_traceback(self, importasmod, reason, description):
         """
         Handle representation of exception chains where one of the exceptions doesn't have a
         real traceback, such as those raised in a subprocess submitted by the multiprocessing
         module (#1984).
         """
         from _pytest.pytester import LineMatcher
-        exc_handling_code = ' from e' if reason == 'cause' else ''
-        mod = importasmod("""
+
+        exc_handling_code = " from e" if reason == "cause" else ""
+        mod = importasmod(
+            """
             def f():
                 try:
                     g()
                 except Exception as e:
                     raise RuntimeError('runtime problem'){exc_handling_code}
             def g():
                 raise ValueError('invalid value')
-        """.format(exc_handling_code=exc_handling_code))
+        """.format(
+                exc_handling_code=exc_handling_code
+            )
+        )
 
         with pytest.raises(RuntimeError) as excinfo:
             mod.f()
 
         # emulate the issue described in #1984
-        attr = '__%s__' % reason
+        attr = "__%s__" % reason
         getattr(excinfo.value, attr).__traceback__ = None
 
         r = excinfo.getrepr()
         tw = py.io.TerminalWriter(stringio=True)
         tw.hasmarkup = False
         r.toterminal(tw)
 
         matcher = LineMatcher(tw.stringio.getvalue().splitlines())
-        matcher.fnmatch_lines([
-            "ValueError: invalid value",
-            description,
-            "* except Exception as e:",
-            "> * raise RuntimeError('runtime problem')" + exc_handling_code,
-            "E *RuntimeError: runtime problem",
-        ])
+        matcher.fnmatch_lines(
+            [
+                "ValueError: invalid value",
+                description,
+                "* except Exception as e:",
+                "> * raise RuntimeError('runtime problem')" + exc_handling_code,
+                "E *RuntimeError: runtime problem",
+            ]
+        )
 
 
 @pytest.mark.parametrize("style", ["short", "long"])
 @pytest.mark.parametrize("encoding", [None, "utf8", "utf16"])
 def test_repr_traceback_with_unicode(style, encoding):
-    msg = u'☹'
+    msg = u"☹"
     if encoding is not None:
         msg = msg.encode(encoding)
     try:
         raise RuntimeError(msg)
     except RuntimeError:
         e_info = ExceptionInfo()
     formatter = FormattedExcinfo(style=style)
     repr_traceback = formatter.repr_traceback(e_info)
     assert repr_traceback is not None
 
 
 def test_cwd_deleted(testdir):
-    testdir.makepyfile("""
+    testdir.makepyfile(
+        """
         def test(tmpdir):
             tmpdir.chdir()
             tmpdir.remove()
             assert False
-    """)
+    """
+    )
     result = testdir.runpytest()
-    result.stdout.fnmatch_lines(['* 1 failed in *'])
-    assert 'INTERNALERROR' not in result.stdout.str() + result.stderr.str()
+    result.stdout.fnmatch_lines(["* 1 failed in *"])
+    assert "INTERNALERROR" not in result.stdout.str() + result.stderr.str()
 
 
 def test_exception_repr_extraction_error_on_recursion():
     """
     Ensure we can properly detect a recursion error even
-    if some locals raise error on comparision (#2459).
+    if some locals raise error on comparison (#2459).
     """
+
     class numpy_like(object):
 
         def __eq__(self, other):
             if type(other) is numpy_like:
-                raise ValueError('The truth value of an array '
-                                 'with more than one element is ambiguous.')
+                raise ValueError(
+                    "The truth value of an array "
+                    "with more than one element is ambiguous."
+                )
 
     def a(x):
         return b(numpy_like())
 
     def b(x):
         return a(numpy_like())
 
     try:
         a(numpy_like())
     except:  # noqa
         from _pytest._code.code import ExceptionInfo
         from _pytest.pytester import LineMatcher
+
         exc_info = ExceptionInfo()
 
         matcher = LineMatcher(str(exc_info.getrepr()).splitlines())
-        matcher.fnmatch_lines([
-            '!!! Recursion error detected, but an error occurred locating the origin of recursion.',
-            '*The following exception happened*',
-            '*ValueError: The truth value of an array*',
-        ])
+        matcher.fnmatch_lines(
+            [
+                "!!! Recursion error detected, but an error occurred locating the origin of recursion.",
+                "*The following exception happened*",
+                "*ValueError: The truth value of an array*",
+            ]
+        )
 
 
 def test_no_recursion_index_on_recursion_error():
     """
     Ensure that we don't break in case we can't find the recursion index
     during a recursion error (#2486).
     """
     try:
+
         class RecursionDepthError(object):
+
             def __getattr__(self, attr):
-                return getattr(self, '_' + attr)
+                return getattr(self, "_" + attr)
 
         RecursionDepthError().trigger
     except:  # noqa
         from _pytest._code.code import ExceptionInfo
+
         exc_info = ExceptionInfo()
-        if sys.version_info[:2] == (2, 6):
-            assert "'RecursionDepthError' object has no attribute '___" in str(exc_info.getrepr())
-        else:
-            assert 'maximum recursion' in str(exc_info.getrepr())
+        assert "maximum recursion" in str(exc_info.getrepr())
     else:
         assert 0
--- a/third_party/python/pytest/testing/code/test_source.py
+++ b/third_party/python/pytest/testing/code/test_source.py
@@ -1,150 +1,167 @@
 # flake8: noqa
 # disable flake check on this file because some constructs are strange
 # or redundant on purpose and can't be disable on a line-by-line basis
 from __future__ import absolute_import, division, print_function
+import inspect
 import sys
 
 import _pytest._code
 import py
 import pytest
 from _pytest._code import Source
-from _pytest._code.source import _ast
+from _pytest._code.source import ast
 
-if _ast is not None:
-    astonly = pytest.mark.nothing
-else:
-    astonly = pytest.mark.xfail("True", reason="only works with AST-compile")
 
+astonly = pytest.mark.nothing
 failsonjython = pytest.mark.xfail("sys.platform.startswith('java')")
 
 
 def test_source_str_function():
     x = Source("3")
     assert str(x) == "3"
 
     x = Source("   3")
     assert str(x) == "3"
 
-    x = Source("""
+    x = Source(
+        """
         3
-    """, rstrip=False)
+    """,
+        rstrip=False,
+    )
     assert str(x) == "\n3\n    "
 
-    x = Source("""
+    x = Source(
+        """
         3
-    """, rstrip=True)
+    """,
+        rstrip=True,
+    )
     assert str(x) == "\n3"
 
 
 def test_unicode():
     try:
         unicode
     except NameError:
         return
     x = Source(unicode("4"))
     assert str(x) == "4"
-    co = _pytest._code.compile(unicode('u"\xc3\xa5"', 'utf8'), mode='eval')
+    co = _pytest._code.compile(unicode('u"\xc3\xa5"', "utf8"), mode="eval")
     val = eval(co)
     assert isinstance(val, unicode)
 
 
 def test_source_from_function():
     source = _pytest._code.Source(test_source_str_function)
-    assert str(source).startswith('def test_source_str_function():')
+    assert str(source).startswith("def test_source_str_function():")
 
 
 def test_source_from_method():
+
     class TestClass(object):
+
         def test_method(self):
             pass
+
     source = _pytest._code.Source(TestClass().test_method)
-    assert source.lines == ["def test_method(self):",
-                            "    pass"]
+    assert source.lines == ["def test_method(self):", "    pass"]
 
 
 def test_source_from_lines():
     lines = ["a \n", "b\n", "c"]
     source = _pytest._code.Source(lines)
-    assert source.lines == ['a ', 'b', 'c']
+    assert source.lines == ["a ", "b", "c"]
 
 
 def test_source_from_inner_function():
+
     def f():
         pass
+
     source = _pytest._code.Source(f, deindent=False)
-    assert str(source).startswith('    def f():')
+    assert str(source).startswith("    def f():")
     source = _pytest._code.Source(f)
-    assert str(source).startswith('def f():')
+    assert str(source).startswith("def f():")
 
 
 def test_source_putaround_simple():
     source = Source("raise ValueError")
     source = source.putaround(
-        "try:", """\
+        "try:",
+        """\
         except ValueError:
             x = 42
         else:
-            x = 23""")
-    assert str(source) == """\
+            x = 23""",
+    )
+    assert (
+        str(source)
+        == """\
 try:
     raise ValueError
 except ValueError:
     x = 42
 else:
     x = 23"""
+    )
 
 
 def test_source_putaround():
     source = Source()
-    source = source.putaround("""
+    source = source.putaround(
+        """
         if 1:
             x=1
-    """)
+    """
+    )
     assert str(source).strip() == "if 1:\n    x=1"
 
 
 def test_source_strips():
     source = Source("")
     assert source == Source()
-    assert str(source) == ''
+    assert str(source) == ""
     assert source.strip() == source
 
 
 def test_source_strip_multiline():
     source = Source()
     source.lines = ["", " hello", "  "]
     source2 = source.strip()
     assert source2.lines == [" hello"]
 
 
 def test_syntaxerror_rerepresentation():
-    ex = pytest.raises(SyntaxError, _pytest._code.compile, 'xyz xyz')
+    ex = pytest.raises(SyntaxError, _pytest._code.compile, "xyz xyz")
     assert ex.value.lineno == 1
     assert ex.value.offset in (4, 7)  # XXX pypy/jython versus cpython?
-    assert ex.value.text.strip(), 'x x'
+    assert ex.value.text.strip(), "x x"
 
 
 def test_isparseable():
     assert Source("hello").isparseable()
     assert Source("if 1:\n  pass").isparseable()
     assert Source(" \nif 1:\n  pass").isparseable()
     assert not Source("if 1:\n").isparseable()
     assert not Source(" \nif 1:\npass").isparseable()
     assert not Source(chr(0)).isparseable()
 
 
 class TestAccesses(object):
-    source = Source("""\
+    source = Source(
+        """\
         def f(x):
             pass
         def g(x):
             pass
-    """)
+    """
+    )
 
     def test_getrange(self):
         x = self.source[0:2]
         assert x.isparseable()
         assert len(x.lines) == 2
         assert str(x) == "def f(x):\n    pass"
 
     def test_getline(self):
@@ -155,303 +172,344 @@ class TestAccesses(object):
         assert len(self.source) == 4
 
     def test_iter(self):
         values = [x for x in self.source]
         assert len(values) == 4
 
 
 class TestSourceParsingAndCompiling(object):
-    source = Source("""\
+    source = Source(
+        """\
         def f(x):
             assert (x ==
                     3 +
                     4)
-    """).strip()
+    """
+    ).strip()
 
     def test_compile(self):
         co = _pytest._code.compile("x=3")
         d = {}
         exec(co, d)
-        assert d['x'] == 3
+        assert d["x"] == 3
 
     def test_compile_and_getsource_simple(self):
         co = _pytest._code.compile("x=3")
         exec(co)
         source = _pytest._code.Source(co)
         assert str(source) == "x=3"
 
     def test_compile_and_getsource_through_same_function(self):
+
         def gensource(source):
             return _pytest._code.compile(source)
-        co1 = gensource("""
+
+        co1 = gensource(
+            """
             def f():
                 raise KeyError()
-        """)
-        co2 = gensource("""
+        """
+        )
+        co2 = gensource(
+            """
             def f():
                 raise ValueError()
-        """)
-        source1 = py.std.inspect.getsource(co1)
-        assert 'KeyError' in source1
-        source2 = py.std.inspect.getsource(co2)
-        assert 'ValueError' in source2
+        """
+        )
+        source1 = inspect.getsource(co1)
+        assert "KeyError" in source1
+        source2 = inspect.getsource(co2)
+        assert "ValueError" in source2
 
     def test_getstatement(self):
         # print str(self.source)
         ass = str(self.source[1:])
         for i in range(1, 4):
             # print "trying start in line %r" % self.source[i]
             s = self.source.getstatement(i)
-            #x = s.deindent()
+            # x = s.deindent()
             assert str(s) == ass
 
     def test_getstatementrange_triple_quoted(self):
         # print str(self.source)
-        source = Source("""hello('''
-        ''')""")
+        source = Source(
+            """hello('''
+        ''')"""
+        )
         s = source.getstatement(0)
         assert s == str(source)
         s = source.getstatement(1)
         assert s == str(source)
 
     @astonly
     def test_getstatementrange_within_constructs(self):
-        source = Source("""\
+        source = Source(
+            """\
             try:
                 try:
                     raise ValueError
                 except SomeThing:
                     pass
             finally:
                 42
-        """)
+        """
+        )
         assert len(source) == 7
         # check all lineno's that could occur in a traceback
         # assert source.getstatementrange(0) == (0, 7)
         # assert source.getstatementrange(1) == (1, 5)
         assert source.getstatementrange(2) == (2, 3)
         assert source.getstatementrange(3) == (3, 4)
         assert source.getstatementrange(4) == (4, 5)
         # assert source.getstatementrange(5) == (0, 7)
         assert source.getstatementrange(6) == (6, 7)
 
     def test_getstatementrange_bug(self):
-        source = Source("""\
+        source = Source(
+            """\
             try:
                 x = (
                    y +
                    z)
             except:
                 pass
-        """)
+        """
+        )
         assert len(source) == 6
         assert source.getstatementrange(2) == (1, 4)
 
     def test_getstatementrange_bug2(self):
-        source = Source("""\
+        source = Source(
+            """\
             assert (
                 33
                 ==
                 [
                   X(3,
                       b=1, c=2
                    ),
                 ]
               )
-        """)
+        """
+        )
         assert len(source) == 9
         assert source.getstatementrange(5) == (0, 9)
 
     def test_getstatementrange_ast_issue58(self):
-        source = Source("""\
+        source = Source(
+            """\
 
             def test_some():
                 for a in [a for a in
                     CAUSE_ERROR]: pass
 
             x = 3
-        """)
+        """
+        )
         assert getstatement(2, source).lines == source.lines[2:3]
         assert getstatement(3, source).lines == source.lines[3:4]
 
-    @pytest.mark.skipif("sys.version_info < (2,6)")
     def test_getstatementrange_out_of_bounds_py3(self):
         source = Source("if xxx:\n   from .collections import something")
         r = source.getstatementrange(1)
         assert r == (1, 2)
 
     def test_getstatementrange_with_syntaxerror_issue7(self):
         source = Source(":")
         pytest.raises(SyntaxError, lambda: source.getstatementrange(0))
 
-    @pytest.mark.skipif("sys.version_info < (2,6)")
     def test_compile_to_ast(self):
         import ast
+
         source = Source("x = 4")
         mod = source.compile(flag=ast.PyCF_ONLY_AST)
         assert isinstance(mod, ast.Module)
         compile(mod, "<filename>", "exec")
 
     def test_compile_and_getsource(self):
         co = self.source.compile()
         py.builtin.exec_(co, globals())
         f(7)
         excinfo = pytest.raises(AssertionError, "f(6)")
         frame = excinfo.traceback[-1].frame
         stmt = frame.code.fullsource.getstatement(frame.lineno)
         # print "block", str(block)
-        assert str(stmt).strip().startswith('assert')
+        assert str(stmt).strip().startswith("assert")
 
-    @pytest.mark.parametrize('name', ['', None, 'my'])
+    @pytest.mark.parametrize("name", ["", None, "my"])
     def test_compilefuncs_and_path_sanity(self, name):
+
         def check(comp, name):
             co = comp(self.source, name)
             if not name:
-                expected = "codegen %s:%d>" % (mypath, mylineno + 2 + 2)
+                expected = "codegen %s:%d>" % (mypath, mylineno + 2 + 3)
             else:
-                expected = "codegen %r %s:%d>" % (name, mypath, mylineno + 2 + 2)
+                expected = "codegen %r %s:%d>" % (name, mypath, mylineno + 2 + 3)
             fn = co.co_filename
             assert fn.endswith(expected)
 
         mycode = _pytest._code.Code(self.test_compilefuncs_and_path_sanity)
         mylineno = mycode.firstlineno
         mypath = mycode.path
 
         for comp in _pytest._code.compile, _pytest._code.Source.compile:
             check(comp, name)
 
     def test_offsetless_synerr(self):
-        pytest.raises(SyntaxError, _pytest._code.compile, "lambda a,a: 0", mode='eval')
+        pytest.raises(SyntaxError, _pytest._code.compile, "lambda a,a: 0", mode="eval")
 
 
 def test_getstartingblock_singleline():
+
     class A(object):
+
         def __init__(self, *args):
             frame = sys._getframe(1)
             self.source = _pytest._code.Frame(frame).statement
 
-    x = A('x', 'y')
+    x = A("x", "y")
 
     values = [i for i in x.source.lines if i.strip()]
     assert len(values) == 1
 
 
 def test_getline_finally():
-    def c(): pass
-    excinfo = pytest.raises(TypeError, """
+
+    def c():
+        pass
+
+    excinfo = pytest.raises(
+        TypeError,
+        """
            teardown = None
            try:
                 c(1)
            finally:
                 if teardown:
                     teardown()
-    """)
+    """,
+    )
     source = excinfo.traceback[-1].statement
-    assert str(source).strip() == 'c(1)'
+    assert str(source).strip() == "c(1)"
 
 
 def test_getfuncsource_dynamic():
     source = """
         def f():
             raise ValueError
 
         def g(): pass
     """
     co = _pytest._code.compile(source)
     py.builtin.exec_(co, globals())
-    assert str(_pytest._code.Source(f)).strip() == 'def f():\n    raise ValueError'
-    assert str(_pytest._code.Source(g)).strip() == 'def g(): pass'
+    assert str(_pytest._code.Source(f)).strip() == "def f():\n    raise ValueError"
+    assert str(_pytest._code.Source(g)).strip() == "def g(): pass"
 
 
 def test_getfuncsource_with_multine_string():
+
     def f():
-        c = '''while True:
+        c = """while True:
     pass
-'''
-    assert str(_pytest._code.Source(f)).strip() == "def f():\n    c = '''while True:\n    pass\n'''"
+"""
+
+    assert (
+        str(_pytest._code.Source(f)).strip()
+        == 'def f():\n    c = """while True:\n    pass\n"""'
+    )
 
 
 def test_deindent():
     from _pytest._code.source import deindent as deindent
-    assert deindent(['\tfoo', '\tbar', ]) == ['foo', 'bar']
+
+    assert deindent(["\tfoo", "\tbar"]) == ["foo", "bar"]
 
     def f():
-        c = '''while True:
+        c = """while True:
     pass
-'''
-    import inspect
+"""
+
     lines = deindent(inspect.getsource(f).splitlines())
-    assert lines == ["def f():", "    c = '''while True:", "    pass", "'''"]
+    assert lines == ["def f():", '    c = """while True:', "    pass", '"""']
 
     source = """
         def f():
             def g():
                 pass
     """
     lines = deindent(source.splitlines())
-    assert lines == ['', 'def f():', '    def g():', '        pass', '    ']
+    assert lines == ["", "def f():", "    def g():", "        pass", "    "]
 
 
 def test_source_of_class_at_eof_without_newline(tmpdir):
     # this test fails because the implicit inspect.getsource(A) below
     # does not return the "x = 1" last line.
-    source = _pytest._code.Source('''
+    source = _pytest._code.Source(
+        """
         class A(object):
             def method(self):
                 x = 1
-    ''')
+    """
+    )
     path = tmpdir.join("a.py")
     path.write(source)
     s2 = _pytest._code.Source(tmpdir.join("a.py").pyimport().A)
     assert str(source).strip() == str(s2).strip()
 
 
 if True:
+
     def x():
         pass
 
 
 def test_getsource_fallback():
     from _pytest._code.source import getsource
+
     expected = """def x():
     pass"""
     src = getsource(x)
     assert src == expected
 
 
 def test_idem_compile_and_getsource():
     from _pytest._code.source import getsource
+
     expected = "def x(): pass"
     co = _pytest._code.compile(expected)
     src = getsource(co)
     assert src == expected
 
 
 def test_findsource_fallback():
     from _pytest._code.source import findsource
+
     src, lineno = findsource(x)
-    assert 'test_findsource_simple' in str(src)
-    assert src[lineno] == '    def x():'
+    assert "test_findsource_simple" in str(src)
+    assert src[lineno] == "    def x():"
 
 
 def test_findsource():
     from _pytest._code.source import findsource
-    co = _pytest._code.compile("""if 1:
+
+    co = _pytest._code.compile(
+        """if 1:
     def x():
         pass
-""")
+"""
+    )
 
     src, lineno = findsource(co)
-    assert 'if 1:' in str(src)
+    assert "if 1:" in str(src)
 
     d = {}
     eval(co, d)
-    src, lineno = findsource(d['x'])
-    assert 'if 1:' in str(src)
+    src, lineno = findsource(d["x"])
+    assert "if 1:" in str(src)
     assert src[lineno] == "    def x():"
 
 
 def test_getfslineno():
     from _pytest._code import getfslineno
 
     def f(x):
         pass
@@ -461,128 +519,146 @@ def test_getfslineno():
     assert fspath.basename == "test_source.py"
     assert lineno == _pytest._code.getrawcode(f).co_firstlineno - 1  # see findsource
 
     class A(object):
         pass
 
     fspath, lineno = getfslineno(A)
 
-    _, A_lineno = py.std.inspect.findsource(A)
+    _, A_lineno = inspect.findsource(A)
     assert fspath.basename == "test_source.py"
     assert lineno == A_lineno
 
     assert getfslineno(3) == ("", -1)
 
     class B(object):
         pass
+
     B.__name__ = "B2"
     assert getfslineno(B)[1] == -1
 
 
 def test_code_of_object_instance_with_call():
+
     class A(object):
         pass
+
     pytest.raises(TypeError, lambda: _pytest._code.Source(A()))
 
     class WithCall(object):
+
         def __call__(self):
             pass
 
     code = _pytest._code.Code(WithCall())
-    assert 'pass' in str(code.source())
+    assert "pass" in str(code.source())
 
     class Hello(object):
+
         def __call__(self):
             pass
+
     pytest.raises(TypeError, lambda: _pytest._code.Code(Hello))
 
 
 def getstatement(lineno, source):
     from _pytest._code.source import getstatementrange_ast
+
     source = _pytest._code.Source(source, deindent=False)
     ast, start, end = getstatementrange_ast(lineno, source)
     return source[start:end]
 
 
 def test_oneline():
     source = getstatement(0, "raise ValueError")
     assert str(source) == "raise ValueError"
 
 
 def test_comment_and_no_newline_at_end():
     from _pytest._code.source import getstatementrange_ast
-    source = Source(['def test_basic_complex():',
-                     '    assert 1 == 2',
-                     '# vim: filetype=pyopencl:fdm=marker'])
+
+    source = Source(
+        [
+            "def test_basic_complex():",
+            "    assert 1 == 2",
+            "# vim: filetype=pyopencl:fdm=marker",
+        ]
+    )
     ast, start, end = getstatementrange_ast(1, source)
     assert end == 2
 
 
 def test_oneline_and_comment():
     source = getstatement(0, "raise ValueError\n#hello")
     assert str(source) == "raise ValueError"
 
 
-@pytest.mark.xfail(hasattr(sys, "pypy_version_info"),
-                   reason='does not work on pypy')
+@pytest.mark.xfail(hasattr(sys, "pypy_version_info"), reason="does not work on pypy")
 def test_comments():
     source = '''def test():
     "comment 1"
     x = 1
       # comment 2
     # comment 3
 
     assert False
 
 """
 comment 4
 """
 '''
     for line in range(2, 6):
-        assert str(getstatement(line, source)) == '    x = 1'
+        assert str(getstatement(line, source)) == "    x = 1"
     for line in range(6, 10):
-        assert str(getstatement(line, source)) == '    assert False'
+        assert str(getstatement(line, source)) == "    assert False"
     assert str(getstatement(10, source)) == '"""'
 
 
 def test_comment_in_statement():
-    source = '''test(foo=1,
+    source = """test(foo=1,
     # comment 1
     bar=2)
-'''
+"""
     for line in range(1, 3):
-        assert str(getstatement(line, source)) == \
-            'test(foo=1,\n    # comment 1\n    bar=2)'
+        assert (
+            str(getstatement(line, source))
+            == "test(foo=1,\n    # comment 1\n    bar=2)"
+        )
 
 
 def test_single_line_else():
     source = getstatement(1, "if False: 2\nelse: 3")
     assert str(source) == "else: 3"
 
 
 def test_single_line_finally():
     source = getstatement(1, "try: 1\nfinally: 3")
     assert str(source) == "finally: 3"
 
 
 def test_issue55():
-    source = ('def round_trip(dinp):\n  assert 1 == dinp\n'
-              'def test_rt():\n  round_trip("""\n""")\n')
+    source = (
+        "def round_trip(dinp):\n  assert 1 == dinp\n"
+        'def test_rt():\n  round_trip("""\n""")\n'
+    )
     s = getstatement(3, source)
     assert str(s) == '  round_trip("""\n""")'
 
 
 def XXXtest_multiline():
-    source = getstatement(0, """\
+    source = getstatement(
+        0,
+        """\
 raise ValueError(
     23
 )
 x = 3
-""")
+""",
+    )
     assert str(source) == "raise ValueError(\n    23\n)"
 
 
 class TestTry(object):
     pytestmark = astonly
     source = """\
 try:
     raise ValueError
--- a/third_party/python/pytest/testing/code/test_source_multiline_block.py
+++ b/third_party/python/pytest/testing/code/test_source_multiline_block.py
@@ -7,20 +7,23 @@ import _pytest._code
 def test_getstartingblock_multiline():
     """
     This test was originally found in test_source.py, but it depends on the weird
     formatting of the ``x = A`` construct seen here and our autopep8 tool can only exclude entire
     files (it does not support excluding lines/blocks using the traditional #noqa comment yet,
     see hhatto/autopep8#307). It was considered better to just move this single test to its own
     file and exclude it from autopep8 than try to complicate things.
     """
+
     class A(object):
+
         def __init__(self, *args):
             frame = sys._getframe(1)
             self.source = _pytest._code.Frame(frame).statement
 
+    # fmt: off
     x = A('x',
           'y'
           ,
           'z')
-
+    # fmt: on
     values = [i for i in x.source.lines if i.strip()]
     assert len(values) == 4
--- a/third_party/python/pytest/testing/deprecated_test.py
+++ b/third_party/python/pytest/testing/deprecated_test.py
@@ -1,84 +1,265 @@
 from __future__ import absolute_import, division, print_function
 import pytest
 
 
 def test_yield_tests_deprecation(testdir):
-    testdir.makepyfile("""
+    testdir.makepyfile(
+        """
         def func1(arg, arg2):
             assert arg == arg2
         def test_gen():
             yield "m1", func1, 15, 3*5
             yield "m2", func1, 42, 6*7
         def test_gen2():
             for k in range(10):
                 yield func1, 1, 1
-    """)
-    result = testdir.runpytest('-ra')
-    result.stdout.fnmatch_lines([
-        '*yield tests are deprecated, and scheduled to be removed in pytest 4.0*',
-        '*2 passed*',
-    ])
-    assert result.stdout.str().count('yield tests are deprecated') == 2
+    """
+    )
+    result = testdir.runpytest("-ra")
+    result.stdout.fnmatch_lines(
+        [
+            "*yield tests are deprecated, and scheduled to be removed in pytest 4.0*",
+            "*2 passed*",
+        ]
+    )
+    assert result.stdout.str().count("yield tests are deprecated") == 2
 
 
 def test_funcarg_prefix_deprecation(testdir):
-    testdir.makepyfile("""
+    testdir.makepyfile(
+        """
         def pytest_funcarg__value():
             return 10
 
         def test_funcarg_prefix(value):
             assert value == 10
-    """)
-    result = testdir.runpytest('-ra')
-    result.stdout.fnmatch_lines([
-        ('*pytest_funcarg__value: '
-         'declaring fixtures using "pytest_funcarg__" prefix is deprecated '
-         'and scheduled to be removed in pytest 4.0.  '
-         'Please remove the prefix and use the @pytest.fixture decorator instead.'),
-        '*1 passed*',
-    ])
+    """
+    )
+    result = testdir.runpytest("-ra")
+    result.stdout.fnmatch_lines(
+        [
+            (
+                "*pytest_funcarg__value: "
+                'declaring fixtures using "pytest_funcarg__" prefix is deprecated '
+                "and scheduled to be removed in pytest 4.0.  "
+                "Please remove the prefix and use the @pytest.fixture decorator instead."
+            ),
+            "*1 passed*",
+        ]
+    )
 
 
 def test_pytest_setup_cfg_deprecated(testdir):
-    testdir.makefile('.cfg', setup='''
+    testdir.makefile(
+        ".cfg",
+        setup="""
         [pytest]
         addopts = --verbose
-    ''')
+    """,
+    )
     result = testdir.runpytest()
-    result.stdout.fnmatch_lines(['*pytest*section in setup.cfg files is deprecated*use*tool:pytest*instead*'])
+    result.stdout.fnmatch_lines(
+        ["*pytest*section in setup.cfg files is deprecated*use*tool:pytest*instead*"]
+    )
+
+
+def test_pytest_custom_cfg_deprecated(testdir):
+    testdir.makefile(
+        ".cfg",
+        custom="""
+        [pytest]
+        addopts = --verbose
+    """,
+    )
+    result = testdir.runpytest("-c", "custom.cfg")
+    result.stdout.fnmatch_lines(
+        ["*pytest*section in custom.cfg files is deprecated*use*tool:pytest*instead*"]
+    )
 
 
 def test_str_args_deprecated(tmpdir, testdir):
     """Deprecate passing strings to pytest.main(). Scheduled for removal in pytest-4.0."""
     from _pytest.main import EXIT_NOTESTSCOLLECTED
+
     warnings = []
 
     class Collect(object):
+
         def pytest_logwarning(self, message):
             warnings.append(message)
 
     ret = pytest.main("%s -x" % tmpdir, plugins=[Collect()])
-    testdir.delete_loaded_modules()
-    msg = ('passing a string to pytest.main() is deprecated, '
-           'pass a list of arguments instead.')
+    msg = (
+        "passing a string to pytest.main() is deprecated, "
+        "pass a list of arguments instead."
+    )
     assert msg in warnings
     assert ret == EXIT_NOTESTSCOLLECTED
 
 
 def test_getfuncargvalue_is_deprecated(request):
-    pytest.deprecated_call(request.getfuncargvalue, 'tmpdir')
+    pytest.deprecated_call(request.getfuncargvalue, "tmpdir")
 
 
 def test_resultlog_is_deprecated(testdir):
-    result = testdir.runpytest('--help')
-    result.stdout.fnmatch_lines(['*DEPRECATED path for machine-readable result log*'])
+    result = testdir.runpytest("--help")
+    result.stdout.fnmatch_lines(["*DEPRECATED path for machine-readable result log*"])
 
-    testdir.makepyfile('''
+    testdir.makepyfile(
+        """
         def test():
             pass
-    ''')
-    result = testdir.runpytest('--result-log=%s' % testdir.tmpdir.join('result.log'))
-    result.stdout.fnmatch_lines([
-        '*--result-log is deprecated and scheduled for removal in pytest 4.0*',
-        '*See https://docs.pytest.org/*/usage.html#creating-resultlog-format-files for more information*',
-    ])
+    """
+    )
+    result = testdir.runpytest("--result-log=%s" % testdir.tmpdir.join("result.log"))
+    result.stdout.fnmatch_lines(
+        [
+            "*--result-log is deprecated and scheduled for removal in pytest 4.0*",
+            "*See https://docs.pytest.org/*/usage.html#creating-resultlog-format-files for more information*",
+        ]
+    )
+
+
+@pytest.mark.filterwarnings("always:Metafunc.addcall is deprecated")
+def test_metafunc_addcall_deprecated(testdir):
+    testdir.makepyfile(
+        """
+        def pytest_generate_tests(metafunc):
+            metafunc.addcall({'i': 1})
+            metafunc.addcall({'i': 2})
+        def test_func(i):
+            pass
+    """
+    )
+    res = testdir.runpytest("-s")
+    assert res.ret == 0
+    res.stdout.fnmatch_lines(
+        ["*Metafunc.addcall is deprecated*", "*2 passed, 2 warnings*"]
+    )
+
+
+def test_terminal_reporter_writer_attr(pytestconfig):
+    """Check that TerminalReporter._tw is also available as 'writer' (#2984)
+    This attribute is planned to be deprecated in 3.4.
+    """
+    try:
+        import xdist  # noqa
+
+        pytest.skip("xdist workers disable the terminal reporter plugin")
+    except ImportError:
+        pass
+    terminal_reporter = pytestconfig.pluginmanager.get_plugin("terminalreporter")
+    assert terminal_reporter.writer is terminal_reporter._tw
+
+
+@pytest.mark.parametrize("plugin", ["catchlog", "capturelog"])
+def test_pytest_catchlog_deprecated(testdir, plugin):
+    testdir.makepyfile(
+        """
+        def test_func(pytestconfig):
+            pytestconfig.pluginmanager.register(None, 'pytest_{}')
+    """.format(
+            plugin
+        )
+    )
+    res = testdir.runpytest()
+    assert res.ret == 0
+    res.stdout.fnmatch_lines(
+        ["*pytest-*log plugin has been merged into the core*", "*1 passed, 1 warnings*"]
+    )
+
+
+def test_pytest_plugins_in_non_top_level_conftest_deprecated(testdir):
+    from _pytest.deprecated import PYTEST_PLUGINS_FROM_NON_TOP_LEVEL_CONFTEST
+
+    subdirectory = testdir.tmpdir.join("subdirectory")
+    subdirectory.mkdir()
+    # create the inner conftest with makeconftest and then move it to the subdirectory
+    testdir.makeconftest(
+        """
+        pytest_plugins=['capture']
+    """
+    )
+    testdir.tmpdir.join("conftest.py").move(subdirectory.join("conftest.py"))
+    # make the top level conftest
+    testdir.makeconftest(
+        """
+        import warnings
+        warnings.filterwarnings('always', category=DeprecationWarning)
+    """
+    )
+    testdir.makepyfile(
+        """
+        def test_func():
+            pass
+    """
+    )
+    res = testdir.runpytest_subprocess()
+    assert res.ret == 0
+    res.stderr.fnmatch_lines(
+        "*" + str(PYTEST_PLUGINS_FROM_NON_TOP_LEVEL_CONFTEST).splitlines()[0]
+    )
+
+
+def test_pytest_plugins_in_non_top_level_conftest_deprecated_no_top_level_conftest(
+    testdir
+):
+    from _pytest.deprecated import PYTEST_PLUGINS_FROM_NON_TOP_LEVEL_CONFTEST
+
+    subdirectory = testdir.tmpdir.join("subdirectory")
+    subdirectory.mkdir()
+    testdir.makeconftest(
+        """
+        import warnings
+        warnings.filterwarnings('always', category=DeprecationWarning)
+        pytest_plugins=['capture']
+    """
+    )
+    testdir.tmpdir.join("conftest.py").move(subdirectory.join("conftest.py"))
+
+    testdir.makepyfile(
+        """
+        def test_func():
+            pass
+    """
+    )
+
+    res = testdir.runpytest_subprocess()
+    assert res.ret == 0
+    res.stderr.fnmatch_lines(
+        "*" + str(PYTEST_PLUGINS_FROM_NON_TOP_LEVEL_CONFTEST).splitlines()[0]
+    )
+
+
+def test_pytest_plugins_in_non_top_level_conftest_deprecated_no_false_positives(
+    testdir
+):
+    from _pytest.deprecated import PYTEST_PLUGINS_FROM_NON_TOP_LEVEL_CONFTEST
+
+    subdirectory = testdir.tmpdir.join("subdirectory")
+    subdirectory.mkdir()
+    testdir.makeconftest(
+        """
+        pass
+    """
+    )
+    testdir.tmpdir.join("conftest.py").move(subdirectory.join("conftest.py"))
+
+    testdir.makeconftest(
+        """
+        import warnings
+        warnings.filterwarnings('always', category=DeprecationWarning)
+        pytest_plugins=['capture']
+    """
+    )
+    testdir.makepyfile(
+        """
+        def test_func():
+            pass
+    """
+    )
+    res = testdir.runpytest_subprocess()
+    assert res.ret == 0
+    assert str(PYTEST_PLUGINS_FROM_NON_TOP_LEVEL_CONFTEST).splitlines()[
+        0
+    ] not in res.stderr.str()
--- a/third_party/python/pytest/testing/freeze/.gitignore
+++ b/third_party/python/pytest/testing/freeze/.gitignore
@@ -1,3 +1,3 @@
 build/
 dist/
-*.spec
\ No newline at end of file
+*.spec
--- a/third_party/python/pytest/testing/freeze/create_executable.py
+++ b/third_party/python/pytest/testing/freeze/create_executable.py
@@ -1,12 +1,12 @@
 """
 Generates an executable with pytest runner embedded using PyInstaller.
 """
-if __name__ == '__main__':
+if __name__ == "__main__":
     import pytest
     import subprocess
 
     hidden = []
     for x in pytest.freeze_includes():
-        hidden.extend(['--hidden-import', x])
-    args = ['pyinstaller', '--noconfirm'] + hidden + ['runtests_script.py']
-    subprocess.check_call(' '.join(args), shell=True)
+        hidden.extend(["--hidden-import", x])
+    args = ["pyinstaller", "--noconfirm"] + hidden + ["runtests_script.py"]
+    subprocess.check_call(" ".join(args), shell=True)
--- a/third_party/python/pytest/testing/freeze/runtests_script.py
+++ b/third_party/python/pytest/testing/freeze/runtests_script.py
@@ -1,9 +1,10 @@
 """
 This is the script that is actually frozen into an executable: simply executes
 py.test main().
 """
 
-if __name__ == '__main__':
+if __name__ == "__main__":
     import sys
     import pytest
+
     sys.exit(pytest.main())
--- a/third_party/python/pytest/testing/freeze/tests/test_trivial.py
+++ b/third_party/python/pytest/testing/freeze/tests/test_trivial.py
@@ -1,7 +1,6 @@
-
 def test_upper():
-    assert 'foo'.upper() == 'FOO'
+    assert "foo".upper() == "FOO"
 
 
 def test_lower():
-    assert 'FOO'.lower() == 'foo'
+    assert "FOO".lower() == "foo"
--- a/third_party/python/pytest/testing/freeze/tox_run.py
+++ b/third_party/python/pytest/testing/freeze/tox_run.py
@@ -1,12 +1,12 @@
 """
 Called by tox.ini: uses the generated executable to run the tests in ./tests/
 directory.
 """
-if __name__ == '__main__':
+if __name__ == "__main__":
     import os
     import sys
 
-    executable = os.path.join(os.getcwd(), 'dist', 'runtests_script', 'runtests_script')
-    if sys.platform.startswith('win'):
-        executable += '.exe'
-    sys.exit(os.system('%s tests' % executable))
+    executable = os.path.join(os.getcwd(), "dist", "runtests_script", "runtests_script")
+    if sys.platform.startswith("win"):
+        executable += ".exe"
+    sys.exit(os.system("%s tests" % executable))
new file mode 100644
--- /dev/null
+++ b/third_party/python/pytest/testing/logging/test_fixture.py
@@ -0,0 +1,119 @@
+# -*- coding: utf-8 -*-
+import logging
+
+import pytest
+
+logger = logging.getLogger(__name__)
+sublogger = logging.getLogger(__name__ + ".baz")
+
+
+def test_fixture_help(testdir):
+    result = testdir.runpytest("--fixtures")
+    result.stdout.fnmatch_lines(["*caplog*"])
+
+
+def test_change_level(caplog):
+    caplog.set_level(logging.INFO)
+    logger.debug("handler DEBUG level")
+    logger.info("handler INFO level")
+
+    caplog.set_level(logging.CRITICAL, logger=sublogger.name)
+    sublogger.warning("logger WARNING level")
+    sublogger.critical("logger CRITICAL level")
+
+    assert "DEBUG" not in caplog.text
+    assert "INFO" in caplog.text
+    assert "WARNING" not in caplog.text
+    assert "CRITICAL" in caplog.text
+
+
+def test_change_level_undo(testdir):
+    """Ensure that 'set_level' is undone after the end of the test"""
+    testdir.makepyfile(
+        """
+        import logging
+
+        def test1(caplog):
+            caplog.set_level(logging.INFO)
+            # using + operator here so fnmatch_lines doesn't match the code in the traceback
+            logging.info('log from ' + 'test1')
+            assert 0
+
+        def test2(caplog):
+            # using + operator here so fnmatch_lines doesn't match the code in the traceback
+            logging.info('log from ' + 'test2')
+            assert 0
+    """
+    )
+    result = testdir.runpytest_subprocess()
+    result.stdout.fnmatch_lines(["*log from test1*", "*2 failed in *"])
+    assert "log from test2" not in result.stdout.str()
+
+
+def test_with_statement(caplog):
+    with caplog.at_level(logging.INFO):
+        logger.debug("handler DEBUG level")
+        logger.info("handler INFO level")
+
+        with caplog.at_level(logging.CRITICAL, logger=sublogger.name):
+            sublogger.warning("logger WARNING level")
+            sublogger.critical("logger CRITICAL level")
+
+    assert "DEBUG" not in caplog.text
+    assert "INFO" in caplog.text
+    assert "WARNING" not in caplog.text
+    assert "CRITICAL" in caplog.text
+
+
+def test_log_access(caplog):
+    caplog.set_level(logging.INFO)
+    logger.info("boo %s", "arg")
+    assert caplog.records[0].levelname == "INFO"
+    assert caplog.records[0].msg == "boo %s"
+    assert "boo arg" in caplog.text
+
+
+def test_record_tuples(caplog):
+    caplog.set_level(logging.INFO)
+    logger.info("boo %s", "arg")
+
+    assert caplog.record_tuples == [(__name__, logging.INFO, "boo arg")]
+
+
+def test_unicode(caplog):
+    caplog.set_level(logging.INFO)
+    logger.info(u"bū")
+    assert caplog.records[0].levelname == "INFO"
+    assert caplog.records[0].msg == u"bū"
+    assert u"bū" in caplog.text
+
+
+def test_clear(caplog):
+    caplog.set_level(logging.INFO)
+    logger.info(u"bū")
+    assert len(caplog.records)
+    assert caplog.text
+    caplog.clear()
+    assert not len(caplog.records)
+    assert not caplog.text
+
+
+@pytest.fixture
+def logging_during_setup_and_teardown(caplog):
+    caplog.set_level("INFO")
+    logger.info("a_setup_log")
+    yield
+    logger.info("a_teardown_log")
+    assert [x.message for x in caplog.get_records("teardown")] == ["a_teardown_log"]
+
+
+def test_caplog_captures_for_all_stages(caplog, logging_during_setup_and_teardown):
+    assert not caplog.records
+    assert not caplog.get_records("call")
+    logger.info("a_call_log")
+    assert [x.message for x in caplog.get_records("call")] == ["a_call_log"]
+
+    assert [x.message for x in caplog.get_records("setup")] == ["a_setup_log"]
+
+    # This reachers into private API, don't use this type of thing in real tests!
+    assert set(caplog._item.catch_log_handlers.keys()) == {"setup", "call"}
new file mode 100644
--- /dev/null
+++ b/third_party/python/pytest/testing/logging/test_formatter.py
@@ -0,0 +1,37 @@
+import logging
+
+import py.io
+from _pytest.logging import ColoredLevelFormatter
+
+
+def test_coloredlogformatter():
+    logfmt = "%(filename)-25s %(lineno)4d %(levelname)-8s %(message)s"
+
+    record = logging.LogRecord(
+        name="dummy",
+        level=logging.INFO,
+        pathname="dummypath",
+        lineno=10,
+        msg="Test Message",
+        args=(),
+        exc_info=False,
+    )
+
+    class ColorConfig(object):
+
+        class option(object):
+            pass
+
+    tw = py.io.TerminalWriter()
+    tw.hasmarkup = True
+    formatter = ColoredLevelFormatter(tw, logfmt)
+    output = formatter.format(record)
+    assert (
+        output
+        == ("dummypath                   10 " "\x1b[32mINFO    \x1b[0m Test Message")
+    )
+
+    tw.hasmarkup = False
+    formatter = ColoredLevelFormatter(tw, logfmt)
+    output = formatter.format(record)
+    assert output == ("dummypath                   10 " "INFO     Test Message")
new file mode 100644
--- /dev/null
+++ b/third_party/python/pytest/testing/logging/test_reporting.py
@@ -0,0 +1,874 @@
+# -*- coding: utf-8 -*-
+import re
+import os
+
+import six
+
+import pytest
+
+
+def test_nothing_logged(testdir):
+    testdir.makepyfile(
+        """
+        import sys
+
+        def test_foo():
+            sys.stdout.write('text going to stdout')
+            sys.stderr.write('text going to stderr')
+            assert False
+        """
+    )
+    result = testdir.runpytest()
+    assert result.ret == 1
+    result.stdout.fnmatch_lines(["*- Captured stdout call -*", "text going to stdout"])
+    result.stdout.fnmatch_lines(["*- Captured stderr call -*", "text going to stderr"])
+    with pytest.raises(pytest.fail.Exception):
+        result.stdout.fnmatch_lines(["*- Captured *log call -*"])
+
+
+def test_messages_logged(testdir):
+    testdir.makepyfile(
+        """
+        import sys
+        import logging
+
+        logger = logging.getLogger(__name__)
+
+        def test_foo():
+            sys.stdout.write('text going to stdout')
+            sys.stderr.write('text going to stderr')
+            logger.info('text going to logger')
+            assert False
+        """
+    )
+    result = testdir.runpytest("--log-level=INFO")
+    assert result.ret == 1
+    result.stdout.fnmatch_lines(["*- Captured *log call -*", "*text going to logger*"])
+    result.stdout.fnmatch_lines(["*- Captured stdout call -*", "text going to stdout"])
+    result.stdout.fnmatch_lines(["*- Captured stderr call -*", "text going to stderr"])
+
+
+def test_root_logger_affected(testdir):
+    testdir.makepyfile(
+        """
+        import logging
+        logger = logging.getLogger()
+        def test_foo():
+            logger.info('info text ' + 'going to logger')
+            logger.warning('warning text ' + 'going to logger')
+            logger.error('error text ' + 'going to logger')
+
+            assert 0
+    """
+    )
+    log_file = testdir.tmpdir.join("pytest.log").strpath
+    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
+    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*"])
+
+    # 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)
+    with open(log_file) as rfh:
+        contents = rfh.read()
+        assert "info text going to logger" not in contents
+        assert "warning text going to logger" in contents
+        assert "error text going to logger" in contents
+
+
+def test_log_cli_level_log_level_interaction(testdir):
+    testdir.makepyfile(
+        """
+        import logging
+        logger = logging.getLogger()
+
+        def test_foo():
+            logger.debug('debug text ' + 'going to logger')
+            logger.info('info text ' + 'going to logger')
+            logger.warning('warning text ' + 'going to logger')
+            logger.error('error text ' + 'going to logger')
+            assert 0
+    """
+    )
+
+    result = testdir.runpytest("--log-cli-level=INFO", "--log-level=ERROR")
+    assert result.ret == 1
+
+    result.stdout.fnmatch_lines(
+        [
+            "*-- live log call --*",
+            "*INFO*info text going to logger",
+            "*WARNING*warning text going to logger",
+            "*ERROR*error text going to logger",
+            "=* 1 failed in *=",
+        ]
+    )
+    assert "DEBUG" not in result.stdout.str()
+
+
+def test_setup_logging(testdir):
+    testdir.makepyfile(
+        """
+        import logging
+
+        logger = logging.getLogger(__name__)
+
+        def setup_function(function):
+            logger.info('text going to logger from setup')
+
+        def test_foo():
+            logger.info('text going to logger from call')
+            assert False
+    """
+    )
+    result = testdir.runpytest("--log-level=INFO")
+    assert result.ret == 1
+    result.stdout.fnmatch_lines(
+        [
+            "*- Captured *log setup -*",
+            "*text going to logger from setup*",
+            "*- Captured *log call -*",
+            "*text going to logger from call*",
+        ]
+    )
+
+
+def test_teardown_logging(testdir):
+    testdir.makepyfile(
+        """
+        import logging
+
+        logger = logging.getLogger(__name__)
+
+        def test_foo():
+            logger.info('text going to logger from call')
+
+        def teardown_function(function):
+            logger.info('text going to logger from teardown')
+            assert False
+        """
+    )
+    result = testdir.runpytest("--log-level=INFO")
+    assert result.ret == 1
+    result.stdout.fnmatch_lines(
+        [
+            "*- Captured *log call -*",
+            "*text going to logger from call*",
+            "*- Captured *log teardown -*",
+            "*text going to logger from teardown*",
+        ]
+    )
+
+
+def test_disable_log_capturing(testdir):
+    testdir.makepyfile(
+        """
+        import sys
+        import logging
+
+        logger = logging.getLogger(__name__)
+
+        def test_foo():
+            sys.stdout.write('text going to stdout')
+            logger.warning('catch me if you can!')
+            sys.stderr.write('text going to stderr')
+            assert False
+        """
+    )
+    result = testdir.runpytest("--no-print-logs")
+    print(result.stdout)
+    assert result.ret == 1
+    result.stdout.fnmatch_lines(["*- Captured stdout call -*", "text going to stdout"])
+    result.stdout.fnmatch_lines(["*- Captured stderr call -*", "text going to stderr"])
+    with pytest.raises(pytest.fail.Exception):
+        result.stdout.fnmatch_lines(["*- Captured *log call -*"])
+
+
+def test_disable_log_capturing_ini(testdir):
+    testdir.makeini(
+        """
+        [pytest]
+        log_print=False
+        """
+    )
+    testdir.makepyfile(
+        """
+        import sys
+        import logging
+
+        logger = logging.getLogger(__name__)
+
+        def test_foo():
+            sys.stdout.write('text going to stdout')
+            logger.warning('catch me if you can!')
+            sys.stderr.write('text going to stderr')
+            assert False
+        """
+    )
+    result = testdir.runpytest()
+    print(result.stdout)
+    assert result.ret == 1
+    result.stdout.fnmatch_lines(["*- Captured stdout call -*", "text going to stdout"])
+    result.stdout.fnmatch_lines(["*- Captured stderr call -*", "text going to stderr"])
+    with pytest.raises(pytest.fail.Exception):
+        result.stdout.fnmatch_lines(["*- Captured *log call -*"])
+
+
+@pytest.mark.parametrize("enabled", [True, False])
+def test_log_cli_enabled_disabled(testdir, enabled):
+    msg = "critical message logged by test"
+    testdir.makepyfile(
+        """
+        import logging
+        def test_log_cli():
+            logging.critical("{}")
+    """.format(
+            msg
+        )
+    )
+    if enabled:
+        testdir.makeini(
+            """
+            [pytest]
+            log_cli=true
+        """
+        )
+    result = testdir.runpytest()
+    if enabled:
+        result.stdout.fnmatch_lines(
+            [
+                "test_log_cli_enabled_disabled.py::test_log_cli ",
+                "*-- live log call --*",
+                "test_log_cli_enabled_disabled.py* CRITICAL critical message logged by test",
+                "PASSED*",
+            ]
+        )
+    else:
+        assert msg not in result.stdout.str()
+
+
+def test_log_cli_default_level(testdir):
+    # Default log file level
+    testdir.makepyfile(
+        """
+        import pytest
+        import logging
+        def test_log_cli(request):
+            plugin = request.config.pluginmanager.getplugin('logging-plugin')
+            assert plugin.log_cli_handler.level == logging.NOTSET
+            logging.getLogger('catchlog').info("INFO message won't be shown")
+            logging.getLogger('catchlog').warning("WARNING message will be shown")
+    """
+    )
+    testdir.makeini(
+        """
+        [pytest]
+        log_cli=true
+    """
+    )
+
+    result = testdir.runpytest()
+
+    # fnmatch_lines does an assertion internally
+    result.stdout.fnmatch_lines(
+        [
+            "test_log_cli_default_level.py::test_log_cli ",
+            "test_log_cli_default_level.py*WARNING message will be shown*",
+        ]
+    )
+    assert "INFO message won't be shown" not in result.stdout.str()
+    # make sure that that we get a '0' exit code for the testsuite
+    assert result.ret == 0
+
+
+def test_log_cli_default_level_multiple_tests(testdir, request):
+    """Ensure we reset the first newline added by the live logger between tests"""
+    filename = request.node.name + ".py"
+    testdir.makepyfile(
+        """
+        import logging
+
+        def test_log_1():
+            logging.warning("log message from test_log_1")
+
+        def test_log_2():
+            logging.warning("log message from test_log_2")
+    """
+    )
+    testdir.makeini(
+        """
+        [pytest]
+        log_cli=true
+    """
+    )
+
+    result = testdir.runpytest()
+    result.stdout.fnmatch_lines(
+        [
+            "{}::test_log_1 ".format(filename),
+            "*WARNING*log message from test_log_1*",
+            "PASSED *50%*",
+            "{}::test_log_2 ".format(filename),
+            "*WARNING*log message from test_log_2*",
+            "PASSED *100%*",
+            "=* 2 passed in *=",
+        ]
+    )
+
+
+def test_log_cli_default_level_sections(testdir, request):
+    """Check that with live logging enable we are printing the correct headers during
+    start/setup/call/teardown/finish."""
+    filename = request.node.name + ".py"
+    testdir.makeconftest(
+        """
+        import pytest
+        import logging
+
+        def pytest_runtest_logstart():
+            logging.warning('>>>>> START >>>>>')
+
+        def pytest_runtest_logfinish():
+            logging.warning('<<<<< END <<<<<<<')
+    """
+    )
+
+    testdir.makepyfile(
+        """
+        import pytest
+        import logging
+
+        @pytest.fixture
+        def fix(request):
+            logging.warning("log message from setup of {}".format(request.node.name))
+            yield
+            logging.warning("log message from teardown of {}".format(request.node.name))
+
+        def test_log_1(fix):
+            logging.warning("log message from test_log_1")
+
+        def test_log_2(fix):
+            logging.warning("log message from test_log_2")
+    """
+    )
+    testdir.makeini(
+        """
+        [pytest]
+        log_cli=true
+    """
+    )
+
+    result = testdir.runpytest()
+    result.stdout.fnmatch_lines(
+        [
+            "{}::test_log_1 ".format(filename),
+            "*-- live log start --*",
+            "*WARNING* >>>>> START >>>>>*",
+            "*-- live log setup --*",
+            "*WARNING*log message from setup of test_log_1*",
+            "*-- live log call --*",
+            "*WARNING*log message from test_log_1*",
+            "PASSED *50%*",
+            "*-- live log teardown --*",
+            "*WARNING*log message from teardown of test_log_1*",
+            "*-- live log finish --*",
+            "*WARNING* <<<<< END <<<<<<<*",
+            "{}::test_log_2 ".format(filename),
+            "*-- live log start --*",
+            "*WARNING* >>>>> START >>>>>*",
+            "*-- live log setup --*",
+            "*WARNING*log message from setup of test_log_2*",
+            "*-- live log call --*",
+            "*WARNING*log message from test_log_2*",
+            "PASSED *100%*",
+            "*-- live log teardown --*",
+            "*WARNING*log message from teardown of test_log_2*",
+            "*-- live log finish --*",
+            "*WARNING* <<<<< END <<<<<<<*",
+            "=* 2 passed in *=",
+        ]
+    )
+
+
+def test_live_logs_unknown_sections(testdir, request):
+    """Check that with live logging enable we are printing the correct headers during
+    start/setup/call/teardown/finish."""
+    filename = request.node.name + ".py"
+    testdir.makeconftest(
+        """
+        import pytest
+        import logging
+
+        def pytest_runtest_protocol(item, nextitem):
+            logging.warning('Unknown Section!')
+
+        def pytest_runtest_logstart():
+            logging.warning('>>>>> START >>>>>')
+
+        def pytest_runtest_logfinish():
+            logging.warning('<<<<< END <<<<<<<')
+    """
+    )
+
+    testdir.makepyfile(
+        """
+        import pytest
+        import logging
+
+        @pytest.fixture
+        def fix(request):
+            logging.warning("log message from setup of {}".format(request.node.name))
+            yield
+            logging.warning("log message from teardown of {}".format(request.node.name))
+
+        def test_log_1(fix):
+            logging.warning("log message from test_log_1")
+
+    """
+    )
+    testdir.makeini(
+        """
+        [pytest]
+        log_cli=true
+    """
+    )
+
+    result = testdir.runpytest()
+    result.stdout.fnmatch_lines(
+        [
+            "*WARNING*Unknown Section*",
+            "{}::test_log_1 ".format(filename),
+            "*WARNING* >>>>> START >>>>>*",
+            "*-- live log setup --*",
+            "*WARNING*log message from setup of test_log_1*",
+            "*-- live log call --*",
+            "*WARNING*log message from test_log_1*",
+            "PASSED *100%*",
+            "*-- live log teardown --*",
+            "*WARNING*log message from teardown of test_log_1*",
+            "*WARNING* <<<<< END <<<<<<<*",
+            "=* 1 passed in *=",
+        ]
+    )
+
+
+def test_sections_single_new_line_after_test_outcome(testdir, request):
+    """Check that only a single new line is written between log messages during
+    teardown/finish."""
+    filename = request.node.name + ".py"
+    testdir.makeconftest(
+        """
+        import pytest
+        import logging
+
+        def pytest_runtest_logstart():
+            logging.warning('>>>>> START >>>>>')
+
+        def pytest_runtest_logfinish():
+            logging.warning('<<<<< END <<<<<<<')
+            logging.warning('<<<<< END <<<<<<<')
+    """
+    )
+
+    testdir.makepyfile(
+        """
+        import pytest
+        import logging
+
+        @pytest.fixture
+        def fix(request):
+            logging.warning("log message from setup of {}".format(request.node.name))
+            yield
+            logging.warning("log message from teardown of {}".format(request.node.name))
+            logging.warning("log message from teardown of {}".format(request.node.name))
+
+        def test_log_1(fix):
+            logging.warning("log message from test_log_1")
+    """
+    )
+    testdir.makeini(
+        """
+        [pytest]
+        log_cli=true
+    """
+    )
+
+    result = testdir.runpytest()
+    result.stdout.fnmatch_lines(
+        [
+            "{}::test_log_1 ".format(filename),
+            "*-- live log start --*",
+            "*WARNING* >>>>> START >>>>>*",
+            "*-- live log setup --*",
+            "*WARNING*log message from setup of test_log_1*",
+            "*-- live log call --*",
+            "*WARNING*log message from test_log_1*",
+            "PASSED *100%*",
+            "*-- live log teardown --*",
+            "*WARNING*log message from teardown of test_log_1*",
+            "*-- live log finish --*",
+            "*WARNING* <<<<< END <<<<<<<*",
+            "*WARNING* <<<<< END <<<<<<<*",
+            "=* 1 passed in *=",
+        ]
+    )
+    assert re.search(
+        r"(.+)live log teardown(.+)\n(.+)WARNING(.+)\n(.+)WARNING(.+)",
+        result.stdout.str(),
+        re.MULTILINE,
+    ) is not None
+    assert re.search(
+        r"(.+)live log finish(.+)\n(.+)WARNING(.+)\n(.+)WARNING(.+)",
+        result.stdout.str(),
+        re.MULTILINE,
+    ) is not None
+
+
+def test_log_cli_level(testdir):
+    # Default log file level
+    testdir.makepyfile(
+        """
+        import pytest
+        import logging
+        def test_log_cli(request):
+            plugin = request.config.pluginmanager.getplugin('logging-plugin')
+            assert plugin.log_cli_handler.level == logging.INFO
+            logging.getLogger('catchlog').debug("This log message won't be shown")
+            logging.getLogger('catchlog').info("This log message will be shown")
+            print('PASSED')
+    """
+    )
+    testdir.makeini(
+        """
+        [pytest]
+        log_cli=true
+    """
+    )
+
+    result = testdir.runpytest("-s", "--log-cli-level=INFO")
+
+    # fnmatch_lines does an assertion internally
+    result.stdout.fnmatch_lines(
+        [
+            "test_log_cli_level.py*This log message will be shown",
+            "PASSED",  # 'PASSED' on its own line because the log message prints a new line
+        ]
+    )
+    assert "This log message won't be shown" not in result.stdout.str()
+
+    # make sure that that we get a '0' exit code for the testsuite
+    assert result.ret == 0
+
+    result = testdir.runpytest("-s", "--log-level=INFO")
+
+    # fnmatch_lines does an assertion internally
+    result.stdout.fnmatch_lines(
+        [
+            "test_log_cli_level.py* This log message will be shown",
+            "PASSED",  # 'PASSED' on its own line because the log message prints a new line
+        ]
+    )
+    assert "This log message won't be shown" not in result.stdout.str()
+
+    # make sure that that we get a '0' exit code for the testsuite
+    assert result.ret == 0
+
+
+def test_log_cli_ini_level(testdir):
+    testdir.makeini(
+        """
+        [pytest]
+        log_cli=true
+        log_cli_level = INFO
+        """
+    )
+    testdir.makepyfile(
+        """
+        import pytest
+        import logging
+        def test_log_cli(request):
+            plugin = request.config.pluginmanager.getplugin('logging-plugin')
+            assert plugin.log_cli_handler.level == logging.INFO
+            logging.getLogger('catchlog').debug("This log message won't be shown")
+            logging.getLogger('catchlog').info("This log message will be shown")
+            print('PASSED')
+    """
+    )
+
+    result = testdir.runpytest("-s")
+
+    # fnmatch_lines does an assertion internally
+    result.stdout.fnmatch_lines(
+        [
+            "test_log_cli_ini_level.py* This log message will be shown",
+            "PASSED",  # 'PASSED' on its own line because the log message prints a new line
+        ]
+    )
+    assert "This log message won't be shown" not in result.stdout.str()
+
+    # make sure that that we get a '0' exit code for the testsuite
+    assert result.ret == 0
+
+
+@pytest.mark.parametrize(
+    "cli_args",
+    ["", "--log-level=WARNING", "--log-file-level=WARNING", "--log-cli-level=WARNING"],
+)
+def test_log_cli_auto_enable(testdir, request, cli_args):
+    """Check that live logs are enabled if --log-level or --log-cli-level is passed on the CLI.
+    It should not be auto enabled if the same configs are set on the INI file.
+    """
+    testdir.makepyfile(
+        """
+        import pytest
+        import logging
+
+        def test_log_1():
+            logging.info("log message from test_log_1 not to be shown")
+            logging.warning("log message from test_log_1")
+
+    """
+    )
+    testdir.makeini(
+        """
+        [pytest]
+        log_level=INFO
+        log_cli_level=INFO
+    """
+    )
+
+    result = testdir.runpytest(cli_args)
+    if cli_args == "--log-cli-level=WARNING":
+        result.stdout.fnmatch_lines(
+            [
+                "*::test_log_1 ",
+                "*-- live log call --*",
+                "*WARNING*log message from test_log_1*",
+                "PASSED *100%*",
+                "=* 1 passed in *=",
+            ]
+        )
+        assert "INFO" not in result.stdout.str()
+    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()
+
+
+def test_log_file_cli(testdir):
+    # Default log file level
+    testdir.makepyfile(
+        """
+        import pytest
+        import logging
+        def test_log_file(request):
+            plugin = request.config.pluginmanager.getplugin('logging-plugin')
+            assert plugin.log_file_handler.level == logging.WARNING
+            logging.getLogger('catchlog').info("This log message won't be shown")
+            logging.getLogger('catchlog').warning("This log message will be shown")
+            print('PASSED')
+    """
+    )
+
+    log_file = testdir.tmpdir.join("pytest.log").strpath
+
+    result = testdir.runpytest(
+        "-s", "--log-file={}".format(log_file), "--log-file-level=WARNING"
+    )
+
+    # fnmatch_lines does an assertion internally
+    result.stdout.fnmatch_lines(["test_log_file_cli.py PASSED"])
+
+    # make sure that that we get a '0' exit code for the testsuite
+    assert result.ret == 0
+    assert os.path.isfile(log_file)
+    with open(log_file) as rfh:
+        contents = rfh.read()
+        assert "This log message will be shown" in contents
+        assert "This log message won't be shown" not in contents
+
+
+def test_log_file_cli_level(testdir):
+    # Default log file level
+    testdir.makepyfile(
+        """
+        import pytest
+        import logging
+        def test_log_file(request):
+            plugin = request.config.pluginmanager.getplugin('logging-plugin')
+            assert plugin.log_file_handler.level == logging.INFO
+            logging.getLogger('catchlog').debug("This log message won't be shown")
+            logging.getLogger('catchlog').info("This log message will be shown")
+            print('PASSED')
+    """
+    )
+
+    log_file = testdir.tmpdir.join("pytest.log").strpath
+
+    result = testdir.runpytest(
+        "-s", "--log-file={}".format(log_file), "--log-file-level=INFO"
+    )
+
+    # fnmatch_lines does an assertion internally
+    result.stdout.fnmatch_lines(["test_log_file_cli_level.py PASSED"])
+
+    # make sure that that we get a '0' exit code for the testsuite
+    assert result.ret == 0
+    assert os.path.isfile(log_file)
+    with open(log_file) as rfh:
+        contents = rfh.read()
+        assert "This log message will be shown" in contents
+        assert "This log message won't be shown" not in contents
+
+
+def test_log_level_not_changed_by_default(testdir):
+    testdir.makepyfile(
+        """
+        import logging
+        def test_log_file():
+            assert logging.getLogger().level == logging.WARNING
+    """
+    )
+    result = testdir.runpytest("-s")
+    result.stdout.fnmatch_lines("* 1 passed in *")
+
+
+def test_log_file_ini(testdir):
+    log_file = testdir.tmpdir.join("pytest.log").strpath
+
+    testdir.makeini(
+        """
+        [pytest]
+        log_file={}
+        log_file_level=WARNING
+        """.format(
+            log_file
+        )
+    )
+    testdir.makepyfile(
+        """
+        import pytest
+        import logging
+        def test_log_file(request):
+            plugin = request.config.pluginmanager.getplugin('logging-plugin')
+            assert plugin.log_file_handler.level == logging.WARNING
+            logging.getLogger('catchlog').info("This log message won't be shown")
+            logging.getLogger('catchlog').warning("This log message will be shown")
+            print('PASSED')
+    """
+    )
+
+    result = testdir.runpytest("-s")
+
+    # fnmatch_lines does an assertion internally
+    result.stdout.fnmatch_lines(["test_log_file_ini.py PASSED"])
+
+    # make sure that that we get a '0' exit code for the testsuite
+    assert result.ret == 0
+    assert os.path.isfile(log_file)
+    with open(log_file) as rfh:
+        contents = rfh.read()
+        assert "This log message will be shown" in contents
+        assert "This log message won't be shown" not in contents
+
+
+def test_log_file_ini_level(testdir):
+    log_file = testdir.tmpdir.join("pytest.log").strpath
+
+    testdir.makeini(
+        """
+        [pytest]
+        log_file={}
+        log_file_level = INFO
+        """.format(
+            log_file
+        )
+    )
+    testdir.makepyfile(
+        """
+        import pytest
+        import logging
+        def test_log_file(request):
+            plugin = request.config.pluginmanager.getplugin('logging-plugin')
+            assert plugin.log_file_handler.level == logging.INFO
+            logging.getLogger('catchlog').debug("This log message won't be shown")
+            logging.getLogger('catchlog').info("This log message will be shown")
+            print('PASSED')
+    """
+    )
+
+    result = testdir.runpytest("-s")
+
+    # fnmatch_lines does an assertion internally
+    result.stdout.fnmatch_lines(["test_log_file_ini_level.py PASSED"])
+
+    # make sure that that we get a '0' exit code for the testsuite
+    assert result.ret == 0
+    assert os.path.isfile(log_file)
+    with open(log_file) as rfh:
+        contents = rfh.read()
+        assert "This log message will be shown" in contents
+        assert "This log message won't be shown" not in contents
+
+
+@pytest.mark.parametrize("has_capture_manager", [True, False])
+def test_live_logging_suspends_capture(has_capture_manager, request):
+    """Test that capture manager is suspended when we emitting messages for live logging.
+
+    This tests the implementation calls instead of behavior because it is difficult/impossible to do it using
+    ``testdir`` facilities because they do their own capturing.
+
+    We parametrize the test to also make sure _LiveLoggingStreamHandler works correctly if no capture manager plugin
+    is installed.
+    """
+    import logging
+    from functools import partial
+    from _pytest.capture import CaptureManager
+    from _pytest.logging import _LiveLoggingStreamHandler
+
+    class MockCaptureManager:
+        calls = []
+
+        def suspend_global_capture(self):
+            self.calls.append("suspend_global_capture")
+
+        def resume_global_capture(self):
+            self.calls.append("resume_global_capture")
+
+    # sanity check
+    assert CaptureManager.suspend_capture_item
+    assert CaptureManager.resume_global_capture
+
+    class DummyTerminal(six.StringIO):
+
+        def section(self, *args, **kwargs):
+            pass
+
+    out_file = DummyTerminal()
+    capture_manager = MockCaptureManager() if has_capture_manager else None
+    handler = _LiveLoggingStreamHandler(out_file, capture_manager)
+    handler.set_when("call")
+
+    logger = logging.getLogger(__name__ + ".test_live_logging_suspends_capture")
+    logger.addHandler(handler)
+    request.addfinalizer(partial(logger.removeHandler, handler))
+
+    logger.critical("some message")
+    if has_capture_manager:
+        assert (
+            MockCaptureManager.calls
+            == ["suspend_global_capture", "resume_global_capture"]
+        )
+    else:
+        assert MockCaptureManager.calls == []
+    assert out_file.getvalue() == "\nsome message\n"
--- a/third_party/python/pytest/testing/python/approx.py
+++ b/third_party/python/pytest/testing/python/approx.py
@@ -3,86 +3,96 @@ import operator
 import sys
 import pytest
 import doctest
 
 from pytest import approx
 from operator import eq, ne
 from decimal import Decimal
 from fractions import Fraction
-inf, nan = float('inf'), float('nan')
+
+inf, nan = float("inf"), float("nan")
 
 
 class MyDocTestRunner(doctest.DocTestRunner):
 
     def __init__(self):
         doctest.DocTestRunner.__init__(self)
 
     def report_failure(self, out, test, example, got):
-        raise AssertionError("'{}' evaluates to '{}', not '{}'".format(
-            example.source.strip(), got.strip(), example.want.strip()))
+        raise AssertionError(
+            "'{}' evaluates to '{}', not '{}'".format(
+                example.source.strip(), got.strip(), example.want.strip()
+            )
+        )
 
 
 class TestApprox(object):
 
     def test_repr_string(self):
-        # for some reason in Python 2.6 it is not displaying the tolerance representation correctly
-        plus_minus = u'\u00b1' if sys.version_info[0] > 2 else u'+-'
-        tol1, tol2, infr = '1.0e-06', '2.0e-06', 'inf'
-        if sys.version_info[:2] == (2, 6):
-            tol1, tol2, infr = '???', '???', '???'
-        assert repr(approx(1.0)) == '1.0 {pm} {tol1}'.format(pm=plus_minus, tol1=tol1)
-        assert repr(approx([1.0, 2.0])) == 'approx([1.0 {pm} {tol1}, 2.0 {pm} {tol2}])'.format(
-            pm=plus_minus, tol1=tol1, tol2=tol2)
-        assert repr(approx((1.0, 2.0))) == 'approx((1.0 {pm} {tol1}, 2.0 {pm} {tol2}))'.format(
-            pm=plus_minus, tol1=tol1, tol2=tol2)
-        assert repr(approx(inf)) == 'inf'
-        assert repr(approx(1.0, rel=nan)) == '1.0 {pm} ???'.format(pm=plus_minus)
-        assert repr(approx(1.0, rel=inf)) == '1.0 {pm} {infr}'.format(pm=plus_minus, infr=infr)
-        assert repr(approx(1.0j, rel=inf)) == '1j'
+        plus_minus = u"\u00b1" if sys.version_info[0] > 2 else u"+-"
+        tol1, tol2, infr = "1.0e-06", "2.0e-06", "inf"
+        assert repr(approx(1.0)) == "1.0 {pm} {tol1}".format(pm=plus_minus, tol1=tol1)
+        assert (
+            repr(approx([1.0, 2.0]))
+            == "approx([1.0 {pm} {tol1}, 2.0 {pm} {tol2}])".format(
+                pm=plus_minus, tol1=tol1, tol2=tol2
+            )
+        )
+        assert (
+            repr(approx((1.0, 2.0)))
+            == "approx((1.0 {pm} {tol1}, 2.0 {pm} {tol2}))".format(
+                pm=plus_minus, tol1=tol1, tol2=tol2
+            )
+        )
+        assert repr(approx(inf)) == "inf"
+        assert repr(approx(1.0, rel=nan)) == "1.0 {pm} ???".format(pm=plus_minus)
+        assert (
+            repr(approx(1.0, rel=inf))
+            == "1.0 {pm} {infr}".format(pm=plus_minus, infr=infr)
+        )
+        assert repr(approx(1.0j, rel=inf)) == "1j"
 
         # Dictionaries aren't ordered, so we need to check both orders.
-        assert repr(approx({'a': 1.0, 'b': 2.0})) in (
-            "approx({{'a': 1.0 {pm} {tol1}, 'b': 2.0 {pm} {tol2}}})".format(pm=plus_minus, tol1=tol1, tol2=tol2),
-            "approx({{'b': 2.0 {pm} {tol2}, 'a': 1.0 {pm} {tol1}}})".format(pm=plus_minus, tol1=tol1, tol2=tol2),
+        assert repr(approx({"a": 1.0, "b": 2.0})) in (
+            "approx({{'a': 1.0 {pm} {tol1}, 'b': 2.0 {pm} {tol2}}})".format(
+                pm=plus_minus, tol1=tol1, tol2=tol2
+            ),
+            "approx({{'b': 2.0 {pm} {tol2}, 'a': 1.0 {pm} {tol1}}})".format(
+                pm=plus_minus, tol1=tol1, tol2=tol2
+            ),
         )
 
     def test_operator_overloading(self):
         assert 1 == approx(1, rel=1e-6, abs=1e-12)
         assert not (1 != approx(1, rel=1e-6, abs=1e-12))
         assert 10 != approx(1, rel=1e-6, abs=1e-12)
         assert not (10 == approx(1, rel=1e-6, abs=1e-12))
 
     def test_exactly_equal(self):
         examples = [
             (2.0, 2.0),
             (0.1e200, 0.1e200),
             (1.123e-300, 1.123e-300),
             (12345, 12345.0),
             (0.0, -0.0),
             (345678, 345678),
-            (Decimal('1.0001'), Decimal('1.0001')),
+            (Decimal("1.0001"), Decimal("1.0001")),
             (Fraction(1, 3), Fraction(-1, -3)),
         ]
         for a, x in examples:
             assert a == approx(x)
 
     def test_opposite_sign(self):
-        examples = [
-            (eq, 1e-100, -1e-100),
-            (ne, 1e100, -1e100),
-        ]
+        examples = [(eq, 1e-100, -1e-100), (ne, 1e100, -1e100)]
         for op, a, x in examples:
             assert op(a, approx(x))
 
     def test_zero_tolerance(self):
-        within_1e10 = [
-            (1.1e-100, 1e-100),
-            (-1.1e-100, -1e-100),
-        ]
+        within_1e10 = [(1.1e-100, 1e-100), (-1.1e-100, -1e-100)]
         for a, x in within_1e10:
             assert x == approx(x, rel=0.0, abs=0.0)
             assert a != approx(x, rel=0.0, abs=0.0)
             assert a == approx(x, rel=0.0, abs=5e-101)
             assert a != approx(x, rel=0.0, abs=5e-102)
             assert a == approx(x, rel=5e-1, abs=0.0)
             assert a != approx(x, rel=5e-2, abs=0.0)
 
@@ -96,45 +106,33 @@ class TestApprox(object):
             dict(rel=-1e100, abs=-1e100),
         ]
         for kwargs in illegal_kwargs:
             with pytest.raises(ValueError):
                 1.1 == approx(1, **kwargs)
 
     def test_inf_tolerance(self):
         # Everything should be equal if the tolerance is infinite.
-        large_diffs = [
-            (1, 1000),
-            (1e-50, 1e50),
-            (-1.0, -1e300),
-            (0.0, 10),
-        ]
+        large_diffs = [(1, 1000), (1e-50, 1e50), (-1.0, -1e300), (0.0, 10)]
         for a, x in large_diffs:
             assert a != approx(x, rel=0.0, abs=0.0)
             assert a == approx(x, rel=inf, abs=0.0)
             assert a == approx(x, rel=0.0, abs=inf)
             assert a == approx(x, rel=inf, abs=inf)
 
     def test_inf_tolerance_expecting_zero(self):
         # If the relative tolerance is zero but the expected value is infinite,
         # the actual tolerance is a NaN, which should be an error.
-        illegal_kwargs = [
-            dict(rel=inf, abs=0.0),
-            dict(rel=inf, abs=inf),
-        ]
+        illegal_kwargs = [dict(rel=inf, abs=0.0), dict(rel=inf, abs=inf)]
         for kwargs in illegal_kwargs:
             with pytest.raises(ValueError):
                 1 == approx(0, **kwargs)
 
     def test_nan_tolerance(self):
-        illegal_kwargs = [
-            dict(rel=nan),
-            dict(abs=nan),
-            dict(rel=nan, abs=nan),
-        ]
+        illegal_kwargs = [dict(rel=nan), dict(abs=nan), dict(rel=nan, abs=nan)]
         for kwargs in illegal_kwargs:
             with pytest.raises(ValueError):
                 1.1 == approx(1, **kwargs)
 
     def test_reasonable_defaults(self):
         # Whatever the defaults are, they should work for numbers close to 1
         # than have a small amount of floating-point error.
         assert 0.1 + 0.2 == approx(0.3)
@@ -146,18 +144,18 @@ class TestApprox(object):
         # the choice of defaults.
         examples = [
             # Relative tolerance used.
             (eq, 1e100 + 1e94, 1e100),
             (ne, 1e100 + 2e94, 1e100),
             (eq, 1e0 + 1e-6, 1e0),
             (ne, 1e0 + 2e-6, 1e0),
             # Absolute tolerance used.
-            (eq, 1e-100, + 1e-106),
-            (eq, 1e-100, + 2e-106),
+            (eq, 1e-100, +1e-106),
+            (eq, 1e-100, +2e-106),
             (eq, 1e-100, 0),
         ]
         for op, a, x in examples:
             assert op(a, approx(x))
 
     def test_custom_tolerances(self):
         assert 1e8 + 1e0 == approx(1e8, rel=5e-8, abs=5e0)
         assert 1e8 + 1e0 == approx(1e8, rel=5e-9, abs=5e0)
@@ -170,31 +168,23 @@ class TestApprox(object):
         assert 1e0 + 1e-8 != approx(1e0, rel=5e-9, abs=5e-9)
 
         assert 1e-8 + 1e-16 == approx(1e-8, rel=5e-8, abs=5e-16)
         assert 1e-8 + 1e-16 == approx(1e-8, rel=5e-9, abs=5e-16)
         assert 1e-8 + 1e-16 == approx(1e-8, rel=5e-8, abs=5e-17)
         assert 1e-8 + 1e-16 != approx(1e-8, rel=5e-9, abs=5e-17)
 
     def test_relative_tolerance(self):
-        within_1e8_rel = [
-            (1e8 + 1e0, 1e8),
-            (1e0 + 1e-8, 1e0),
-            (1e-8 + 1e-16, 1e-8),
-        ]
+        within_1e8_rel = [(1e8 + 1e0, 1e8), (1e0 + 1e-8, 1e0), (1e-8 + 1e-16, 1e-8)]
         for a, x in within_1e8_rel:
             assert a == approx(x, rel=5e-8, abs=0.0)
             assert a != approx(x, rel=5e-9, abs=0.0)
 
     def test_absolute_tolerance(self):
-        within_1e8_abs = [
-            (1e8 + 9e-9, 1e8),
-            (1e0 + 9e-9, 1e0),
-            (1e-8 + 9e-9, 1e-8),
-        ]
+        within_1e8_abs = [(1e8 + 9e-9, 1e8), (1e0 + 9e-9, 1e0), (1e-8 + 9e-9, 1e-8)]
         for a, x in within_1e8_abs:
             assert a == approx(x, rel=0, abs=5e-8)
             assert a != approx(x, rel=0, abs=5e-9)
 
     def test_expecting_zero(self):
         examples = [
             (ne, 1e-6, 0.0),
             (ne, -1e-6, 0.0),
@@ -231,36 +221,34 @@ class TestApprox(object):
         for op, a, x in examples:
             # Nothing is equal to NaN by default.
             assert a != approx(x)
 
             # If ``nan_ok=True``, then NaN is equal to NaN.
             assert op(a, approx(x, nan_ok=True))
 
     def test_int(self):
-        within_1e6 = [
-            (1000001, 1000000),
-            (-1000001, -1000000),
-        ]
+        within_1e6 = [(1000001, 1000000), (-1000001, -1000000)]
         for a, x in within_1e6:
             assert a == approx(x, rel=5e-6, abs=0)
             assert a != approx(x, rel=5e-7, abs=0)
             assert approx(x, rel=5e-6, abs=0) == a
             assert approx(x, rel=5e-7, abs=0) != a
 
     def test_decimal(self):
         within_1e6 = [
-            (Decimal('1.000001'), Decimal('1.0')),
-            (Decimal('-1.000001'), Decimal('-1.0')),
+            (Decimal("1.000001"), Decimal("1.0")),
+            (Decimal("-1.000001"), Decimal("-1.0")),
         ]
         for a, x in within_1e6:
-            assert a == approx(x, rel=Decimal('5e-6'), abs=0)
-            assert a != approx(x, rel=Decimal('5e-7'), abs=0)
-            assert approx(x, rel=Decimal('5e-6'), abs=0) == a
-            assert approx(x, rel=Decimal('5e-7'), abs=0) != a
+            assert a == approx(x)
+            assert a == approx(x, rel=Decimal("5e-6"), abs=0)
+            assert a != approx(x, rel=Decimal("5e-7"), abs=0)
+            assert approx(x, rel=Decimal("5e-6"), abs=0) == a
+            assert approx(x, rel=Decimal("5e-7"), abs=0) != a
 
     def test_fraction(self):
         within_1e6 = [
             (1 + Fraction(1, 1000000), Fraction(1)),
             (-1 - Fraction(-1, 1000000), Fraction(-1)),
         ]
         for a, x in within_1e6:
             assert a == approx(x, rel=5e-6, abs=0)
@@ -305,34 +293,34 @@ class TestApprox(object):
         assert approx(expected, rel=5e-7, abs=0) == actual
         assert approx(expected, rel=5e-8, abs=0) != actual
 
     def test_tuple_wrong_len(self):
         assert (1, 2) != approx((1,))
         assert (1, 2) != approx((1, 2, 3))
 
     def test_dict(self):
-        actual = {'a': 1 + 1e-7, 'b': 2 + 1e-8}
+        actual = {"a": 1 + 1e-7, "b": 2 + 1e-8}
         # Dictionaries became ordered in python3.6, so switch up the order here
         # to make sure it doesn't matter.
-        expected = {'b': 2, 'a': 1}
+        expected = {"b": 2, "a": 1}
 
         # Return false if any element is outside the tolerance.
         assert actual == approx(expected, rel=5e-7, abs=0)
         assert actual != approx(expected, rel=5e-8, abs=0)
         assert approx(expected, rel=5e-7, abs=0) == actual
         assert approx(expected, rel=5e-8, abs=0) != actual
 
     def test_dict_wrong_len(self):
-        assert {'a': 1, 'b': 2} != approx({'a': 1})
-        assert {'a': 1, 'b': 2} != approx({'a': 1, 'c': 2})
-        assert {'a': 1, 'b': 2} != approx({'a': 1, 'b': 2, 'c': 3})
+        assert {"a": 1, "b": 2} != approx({"a": 1})
+        assert {"a": 1, "b": 2} != approx({"a": 1, "c": 2})
+        assert {"a": 1, "b": 2} != approx({"a": 1, "b": 2, "c": 3})
 
     def test_numpy_array(self):
-        np = pytest.importorskip('numpy')
+        np = pytest.importorskip("numpy")
 
         actual = np.array([1 + 1e-7, 2 + 1e-8])
         expected = np.array([1, 2])
 
         # Return false if any element is outside the tolerance.
         assert actual == approx(expected, rel=5e-7, abs=0)
         assert actual != approx(expected, rel=5e-8, abs=0)
         assert approx(expected, rel=5e-7, abs=0) == expected
@@ -340,59 +328,79 @@ class TestApprox(object):
 
         # Should be able to compare lists with numpy arrays.
         assert list(actual) == approx(expected, rel=5e-7, abs=0)
         assert list(actual) != approx(expected, rel=5e-8, abs=0)
         assert actual == approx(list(expected), rel=5e-7, abs=0)
         assert actual != approx(list(expected), rel=5e-8, abs=0)
 
     def test_numpy_array_wrong_shape(self):
-        np = pytest.importorskip('numpy')
+        np = pytest.importorskip("numpy")
 
         a12 = np.array([[1, 2]])
         a21 = np.array([[1], [2]])
 
         assert a12 != approx(a21)
         assert a21 != approx(a12)
 
     def test_doctests(self):
         parser = doctest.DocTestParser()
         test = parser.get_doctest(
-            approx.__doc__,
-            {'approx': approx},
-            approx.__name__,
-            None, None,
+            approx.__doc__, {"approx": approx}, approx.__name__, None, None
         )
         runner = MyDocTestRunner()
         runner.run(test)
 
     def test_unicode_plus_minus(self, testdir):
         """
         Comparing approx instances inside lists should not produce an error in the detailed diff.
         Integration test for issue #2111.
         """
-        testdir.makepyfile("""
+        testdir.makepyfile(
+            """
             import pytest
             def test_foo():
                 assert [3] == [pytest.approx(4)]
-        """)
-        expected = '4.0e-06'
-        # for some reason in Python 2.6 it is not displaying the tolerance representation correctly
-        if sys.version_info[:2] == (2, 6):
-            expected = '???'
+        """
+        )
+        expected = "4.0e-06"
         result = testdir.runpytest()
-        result.stdout.fnmatch_lines([
-            '*At index 0 diff: 3 != 4 * {0}'.format(expected),
-            '=* 1 failed in *=',
-        ])
+        result.stdout.fnmatch_lines(
+            ["*At index 0 diff: 3 != 4 * {}".format(expected), "=* 1 failed in *="]
+        )
 
-    @pytest.mark.parametrize('op', [
-        pytest.param(operator.le, id='<='),
-        pytest.param(operator.lt, id='<'),
-        pytest.param(operator.ge, id='>='),
-        pytest.param(operator.gt, id='>'),
-    ])
+    @pytest.mark.parametrize(
+        "op",
+        [
+            pytest.param(operator.le, id="<="),
+            pytest.param(operator.lt, id="<"),
+            pytest.param(operator.ge, id=">="),
+            pytest.param(operator.gt, id=">"),
+        ],
+    )
     def test_comparison_operator_type_error(self, op):
         """
         pytest.approx should raise TypeError for operators other than == and != (#2003).
         """
         with pytest.raises(TypeError):
             op(1, approx(1, rel=1e-6, abs=1e-12))
+
+    def test_numpy_array_with_scalar(self):
+        np = pytest.importorskip("numpy")
+
+        actual = np.array([1 + 1e-7, 1 - 1e-8])
+        expected = 1.0
+
+        assert actual == approx(expected, rel=5e-7, abs=0)
+        assert actual != approx(expected, rel=5e-8, abs=0)
+        assert approx(expected, rel=5e-7, abs=0) == actual
+        assert approx(expected, rel=5e-8, abs=0) != actual
+
+    def test_numpy_scalar_with_array(self):
+        np = pytest.importorskip("numpy")
+
+        actual = 1.0
+        expected = np.array([1 + 1e-7, 1 - 1e-8])
+
+        assert actual == approx(expected, rel=5e-7, abs=0)
+        assert actual != approx(expected, rel=5e-8, abs=0)
+        assert approx(expected, rel=5e-7, abs=0) == actual
+        assert approx(expected, rel=5e-8, abs=0) != actual
--- a/third_party/python/pytest/testing/python/collect.py
+++ b/third_party/python/pytest/testing/python/collect.py
@@ -1,333 +1,364 @@
 # -*- coding: utf-8 -*-
 import os
 import sys
 from textwrap import dedent
 
 import _pytest._code
-import py
 import pytest
-from _pytest.main import (
-    Collector,
-    EXIT_NOTESTSCOLLECTED
+from _pytest.main import EXIT_NOTESTSCOLLECTED
+from _pytest.nodes import Collector
+
+ignore_parametrized_marks = pytest.mark.filterwarnings(
+    "ignore:Applying marks directly to parameters"
 )
 
 
-ignore_parametrized_marks = pytest.mark.filterwarnings('ignore:Applying marks directly to parameters')
+class TestModule(object):
 
-
-class TestModule(object):
     def test_failing_import(self, testdir):
         modcol = testdir.getmodulecol("import alksdjalskdjalkjals")
         pytest.raises(Collector.CollectError, modcol.collect)
 
     def test_import_duplicate(self, testdir):
         a = testdir.mkdir("a")
         b = testdir.mkdir("b")
         p = a.ensure("test_whatever.py")
         p.pyimport()
-        del py.std.sys.modules['test_whatever']
+        del sys.modules["test_whatever"]
         b.ensure("test_whatever.py")
         result = testdir.runpytest()
-        result.stdout.fnmatch_lines([
-            "*import*mismatch*",
-            "*imported*test_whatever*",
-            "*%s*" % a.join("test_whatever.py"),
-            "*not the same*",
-            "*%s*" % b.join("test_whatever.py"),
-            "*HINT*",
-        ])
+        result.stdout.fnmatch_lines(
+            [
+                "*import*mismatch*",
+                "*imported*test_whatever*",
+                "*%s*" % a.join("test_whatever.py"),
+                "*not the same*",
+                "*%s*" % b.join("test_whatever.py"),
+                "*HINT*",
+            ]
+        )
 
     def test_import_prepend_append(self, testdir, monkeypatch):
         syspath = list(sys.path)
         monkeypatch.setattr(sys, "path", syspath)
         root1 = testdir.mkdir("root1")
         root2 = testdir.mkdir("root2")
         root1.ensure("x456.py")
         root2.ensure("x456.py")
         p = root2.join("test_x456.py")
         monkeypatch.syspath_prepend(str(root1))
-        p.write(dedent("""\
+        p.write(
+            dedent(
+                """\
             import x456
             def test():
                 assert x456.__file__.startswith(%r)
-        """ % str(root2)))
+        """
+                % str(root2)
+            )
+        )
         with root2.as_cwd():
             reprec = testdir.inline_run("--import-mode=append")
             reprec.assertoutcome(passed=0, failed=1)
             reprec = testdir.inline_run()
             reprec.assertoutcome(passed=1)
 
     def test_syntax_error_in_module(self, testdir):
         modcol = testdir.getmodulecol("this is a syntax error")
         pytest.raises(modcol.CollectError, modcol.collect)
         pytest.raises(modcol.CollectError, modcol.collect)
 
     def test_module_considers_pluginmanager_at_import(self, testdir):
         modcol = testdir.getmodulecol("pytest_plugins='xasdlkj',")
         pytest.raises(ImportError, lambda: modcol.obj)
 
     def test_invalid_test_module_name(self, testdir):
-        a = testdir.mkdir('a')
-        a.ensure('test_one.part1.py')
+        a = testdir.mkdir("a")
+        a.ensure("test_one.part1.py")
         result = testdir.runpytest("-rw")
-        result.stdout.fnmatch_lines([
-            "ImportError while importing test module*test_one.part1*",
-            "Hint: make sure your test modules/packages have valid Python names.",
-        ])
+        result.stdout.fnmatch_lines(
+            [
+                "ImportError while importing test module*test_one.part1*",
+                "Hint: make sure your test modules/packages have valid Python names.",
+            ]
+        )
 
-    @pytest.mark.parametrize('verbose', [0, 1, 2])
+    @pytest.mark.parametrize("verbose", [0, 1, 2])
     def test_show_traceback_import_error(self, testdir, verbose):
         """Import errors when collecting modules should display the traceback (#1976).
 
         With low verbosity we omit pytest and internal modules, otherwise show all traceback entries.
         """
         testdir.makepyfile(
             foo_traceback_import_error="""
                from bar_traceback_import_error import NOT_AVAILABLE
            """,
             bar_traceback_import_error="",
         )
-        testdir.makepyfile("""
+        testdir.makepyfile(
+            """
                import foo_traceback_import_error
-        """)
-        args = ('-v',) * verbose
+        """
+        )
+        args = ("-v",) * verbose
         result = testdir.runpytest(*args)
-        result.stdout.fnmatch_lines([
-            "ImportError while importing test module*",
-            "Traceback:",
-            "*from bar_traceback_import_error import NOT_AVAILABLE",
-            "*cannot import name *NOT_AVAILABLE*",
-        ])
+        result.stdout.fnmatch_lines(
+            [
+                "ImportError while importing test module*",
+                "Traceback:",
+                "*from bar_traceback_import_error import NOT_AVAILABLE",
+                "*cannot import name *NOT_AVAILABLE*",
+            ]
+        )
         assert result.ret == 2
 
         stdout = result.stdout.str()
-        for name in ('_pytest', os.path.join('py', '_path')):
+        for name in ("_pytest", os.path.join("py", "_path")):
             if verbose == 2:
                 assert name in stdout
             else:
                 assert name not in stdout
 
     def test_show_traceback_import_error_unicode(self, testdir):
         """Check test modules collected which raise ImportError with unicode messages
         are handled properly (#2336).
         """
-        testdir.makepyfile(u"""
+        testdir.makepyfile(
+            u"""
             # -*- coding: utf-8 -*-
             raise ImportError(u'Something bad happened ☺')
-        """)
+        """
+        )
         result = testdir.runpytest()
-        result.stdout.fnmatch_lines([
-            "ImportError while importing test module*",
-            "Traceback:",
-            "*raise ImportError*Something bad happened*",
-        ])
+        result.stdout.fnmatch_lines(
+            [
+                "ImportError while importing test module*",
+                "Traceback:",
+                "*raise ImportError*Something bad happened*",
+            ]
+        )
         assert result.ret == 2
 
 
 class TestClass(object):
+
     def test_class_with_init_warning(self, testdir):
-        testdir.makepyfile("""
+        testdir.makepyfile(
+            """
             class TestClass1(object):
                 def __init__(self):
                     pass
-        """)
+        """
+        )
         result = testdir.runpytest("-rw")
-        result.stdout.fnmatch_lines([
-            "*cannot collect test class 'TestClass1' because it has a __init__ constructor",
-        ])
+        result.stdout.fnmatch_lines(
+            [
+                "*cannot collect test class 'TestClass1' because it has a __init__ constructor"
+            ]
+        )
 
     def test_class_subclassobject(self, testdir):
-        testdir.getmodulecol("""
+        testdir.getmodulecol(
+            """
             class test(object):
                 pass
-        """)
+        """
+        )
         result = testdir.runpytest()
-        result.stdout.fnmatch_lines([
-            "*collected 0*",
-        ])
+        result.stdout.fnmatch_lines(["*collected 0*"])
 
     def test_static_method(self, testdir):
         """Support for collecting staticmethod tests (#2528, #2699)"""
-        testdir.getmodulecol("""
+        testdir.getmodulecol(
+            """
             import pytest
             class Test(object):
                 @staticmethod
                 def test_something():
                     pass
 
                 @pytest.fixture
                 def fix(self):
                     return 1
 
                 @staticmethod
                 def test_fix(fix):
                     assert fix == 1
-        """)
+        """
+        )
         result = testdir.runpytest()
-        if sys.version_info < (2, 7):
-            # in 2.6, the code to handle static methods doesn't work
-            result.stdout.fnmatch_lines([
-                "*collected 0 items*",
-                "*cannot collect static method*",
-            ])
-        else:
-            result.stdout.fnmatch_lines([
-                "*collected 2 items*",
-                "*2 passed in*",
-            ])
+        result.stdout.fnmatch_lines(["*collected 2 items*", "*2 passed in*"])
 
     def test_setup_teardown_class_as_classmethod(self, testdir):
-        testdir.makepyfile(test_mod1="""
+        testdir.makepyfile(
+            test_mod1="""
             class TestClassMethod(object):
                 @classmethod
                 def setup_class(cls):
                     pass
                 def test_1(self):
                     pass
                 @classmethod
                 def teardown_class(cls):
                     pass
-        """)
+        """
+        )
         result = testdir.runpytest()
-        result.stdout.fnmatch_lines([
-            "*1 passed*",
-        ])
+        result.stdout.fnmatch_lines(["*1 passed*"])
 
     def test_issue1035_obj_has_getattr(self, testdir):
-        modcol = testdir.getmodulecol("""
+        modcol = testdir.getmodulecol(
+            """
             class Chameleon(object):
                 def __getattr__(self, name):
                     return True
             chameleon = Chameleon()
-        """)
+        """
+        )
         colitems = modcol.collect()
         assert len(colitems) == 0
 
     def test_issue1579_namedtuple(self, testdir):
-        testdir.makepyfile("""
+        testdir.makepyfile(
+            """
             import collections
 
             TestCase = collections.namedtuple('TestCase', ['a'])
-        """)
-        result = testdir.runpytest('-rw')
+        """
+        )
+        result = testdir.runpytest("-rw")
         result.stdout.fnmatch_lines(
             "*cannot collect test class 'TestCase' "
             "because it has a __new__ constructor*"
         )
 
     def test_issue2234_property(self, testdir):
-        testdir.makepyfile("""
+        testdir.makepyfile(
+            """
             class TestCase(object):
                 @property
                 def prop(self):
                     raise NotImplementedError()
-        """)
+        """
+        )
         result = testdir.runpytest()
         assert result.ret == EXIT_NOTESTSCOLLECTED
 
 
 class TestGenerator(object):
+
     def test_generative_functions(self, testdir):
-        modcol = testdir.getmodulecol("""
+        modcol = testdir.getmodulecol(
+            """
             def func1(arg, arg2):
                 assert arg == arg2
 
             def test_gen():
                 yield func1, 17, 3*5
                 yield func1, 42, 6*7
-        """)
+        """
+        )
         colitems = modcol.collect()
         assert len(colitems) == 1
         gencol = colitems[0]
         assert isinstance(gencol, pytest.Generator)
         gencolitems = gencol.collect()
         assert len(gencolitems) == 2
         assert isinstance(gencolitems[0], pytest.Function)
         assert isinstance(gencolitems[1], pytest.Function)
-        assert gencolitems[0].name == '[0]'
-        assert gencolitems[0].obj.__name__ == 'func1'
+        assert gencolitems[0].name == "[0]"
+        assert gencolitems[0].obj.__name__ == "func1"
 
     def test_generative_methods(self, testdir):
-        modcol = testdir.getmodulecol("""
+        modcol = testdir.getmodulecol(
+            """
             def func1(arg, arg2):
                 assert arg == arg2
             class TestGenMethods(object):
                 def test_gen(self):
                     yield func1, 17, 3*5
                     yield func1, 42, 6*7
-        """)
+        """
+        )
         gencol = modcol.collect()[0].collect()[0].collect()[0]
         assert isinstance(gencol, pytest.Generator)
         gencolitems = gencol.collect()
         assert len(gencolitems) == 2
         assert isinstance(gencolitems[0], pytest.Function)
         assert isinstance(gencolitems[1], pytest.Function)
-        assert gencolitems[0].name == '[0]'
-        assert gencolitems[0].obj.__name__ == 'func1'
+        assert gencolitems[0].name == "[0]"
+        assert gencolitems[0].obj.__name__ == "func1"
 
     def test_generative_functions_with_explicit_names(self, testdir):
-        modcol = testdir.getmodulecol("""
+        modcol = testdir.getmodulecol(
+            """
             def func1(arg, arg2):
                 assert arg == arg2
 
             def test_gen():
                 yield "seventeen", func1, 17, 3*5
                 yield "fortytwo", func1, 42, 6*7
-        """)
+        """
+        )
         colitems = modcol.collect()
         assert len(colitems) == 1
         gencol = colitems[0]
         assert isinstance(gencol, pytest.Generator)
         gencolitems = gencol.collect()
         assert len(gencolitems) == 2
         assert isinstance(gencolitems[0], pytest.Function)
         assert isinstance(gencolitems[1], pytest.Function)
         assert gencolitems[0].name == "['seventeen']"
-        assert gencolitems[0].obj.__name__ == 'func1'
+        assert gencolitems[0].obj.__name__ == "func1"
         assert gencolitems[1].name == "['fortytwo']"
-        assert gencolitems[1].obj.__name__ == 'func1'
+        assert gencolitems[1].obj.__name__ == "func1"
 
     def test_generative_functions_unique_explicit_names(self, testdir):
         # generative
-        modcol = testdir.getmodulecol("""
+        modcol = testdir.getmodulecol(
+            """
             def func(): pass
             def test_gen():
                 yield "name", func
                 yield "name", func
-        """)
+        """
+        )
         colitems = modcol.collect()
         assert len(colitems) == 1
         gencol = colitems[0]
         assert isinstance(gencol, pytest.Generator)
         pytest.raises(ValueError, "gencol.collect()")
 
     def test_generative_methods_with_explicit_names(self, testdir):
-        modcol = testdir.getmodulecol("""
+        modcol = testdir.getmodulecol(
+            """
             def func1(arg, arg2):
                 assert arg == arg2
             class TestGenMethods(object):
                 def test_gen(self):
                     yield "m1", func1, 17, 3*5
                     yield "m2", func1, 42, 6*7
-        """)
+        """
+        )
         gencol = modcol.collect()[0].collect()[0].collect()[0]
         assert isinstance(gencol, pytest.Generator)
         gencolitems = gencol.collect()
         assert len(gencolitems) == 2
         assert isinstance(gencolitems[0], pytest.Function)
         assert isinstance(gencolitems[1], pytest.Function)
         assert gencolitems[0].name == "['m1']"
-        assert gencolitems[0].obj.__name__ == 'func1'
+        assert gencolitems[0].obj.__name__ == "func1"
         assert gencolitems[1].name == "['m2']"
-        assert gencolitems[1].obj.__name__ == 'func1'
+        assert gencolitems[1].obj.__name__ == "func1"
 
     def test_order_of_execution_generator_same_codeline(self, testdir, tmpdir):
-        o = testdir.makepyfile("""
+        o = testdir.makepyfile(
+            """
             from __future__ import print_function
             def test_generative_order_of_execution():
                 import py, pytest
                 test_list = []
                 expected_list = list(range(6))
 
                 def list_append(item):
                     test_list.append(item)
@@ -335,24 +366,26 @@ class TestGenerator(object):
                 def assert_order_of_execution():
                     print('expected order', expected_list)
                     print('but got       ', test_list)
                     assert test_list == expected_list
 
                 for i in expected_list:
                     yield list_append, i
                 yield assert_order_of_execution
-        """)
+        """
+        )
         reprec = testdir.inline_run(o)
         passed, skipped, failed = reprec.countoutcomes()
         assert passed == 7
         assert not skipped and not failed
 
     def test_order_of_execution_generator_different_codeline(self, testdir):
-        o = testdir.makepyfile("""
+        o = testdir.makepyfile(
+            """
             from __future__ import print_function
             def test_generative_tests_different_codeline():
                 import py, pytest
                 test_list = []
                 expected_list = list(range(3))
 
                 def list_append_2():
                     test_list.append(2)
@@ -367,30 +400,32 @@ class TestGenerator(object):
                     print('expected order', expected_list)
                     print('but got       ', test_list)
                     assert test_list == expected_list
 
                 yield list_append_0
                 yield list_append_1
                 yield list_append_2
                 yield assert_order_of_execution
-        """)
+        """
+        )
         reprec = testdir.inline_run(o)
         passed, skipped, failed = reprec.countoutcomes()
         assert passed == 4
         assert not skipped and not failed
 
     def test_setupstate_is_preserved_134(self, testdir):
         # yield-based tests are messy wrt to setupstate because
         # during collection they already invoke setup functions
         # and then again when they are run.  For now, we want to make sure
         # that the old 1.3.4 behaviour is preserved such that all
         # yielded functions all share the same "self" instance that
         # has been used during collection.
-        o = testdir.makepyfile("""
+        o = testdir.makepyfile(
+            """
             setuplist = []
             class TestClass(object):
                 def setup_method(self, func):
                     #print "setup_method", self, func
                     setuplist.append(self)
                     self.init = 42
 
                 def teardown_method(self, func):
@@ -409,114 +444,128 @@ class TestGenerator(object):
             def test_setuplist():
                 # once for test_func2 during collection
                 # once for test_func1 during test run
                 # once for test_func2 during test run
                 #print setuplist
                 assert len(setuplist) == 3, len(setuplist)
                 assert setuplist[0] == setuplist[2], setuplist
                 assert setuplist[1] != setuplist[2], setuplist
-        """)
-        reprec = testdir.inline_run(o, '-v')
+        """
+        )
+        reprec = testdir.inline_run(o, "-v")
         passed, skipped, failed = reprec.countoutcomes()
         assert passed == 4
         assert not skipped and not failed
 
 
 class TestFunction(object):
+
     def test_getmodulecollector(self, testdir):
         item = testdir.getitem("def test_func(): pass")
         modcol = item.getparent(pytest.Module)
         assert isinstance(modcol, pytest.Module)
-        assert hasattr(modcol.obj, 'test_func')
+        assert hasattr(modcol.obj, "test_func")
 
     def test_function_as_object_instance_ignored(self, testdir):
-        testdir.makepyfile("""
+        testdir.makepyfile(
+            """
             class A(object):
                 def __call__(self, tmpdir):
                     0/0
 
             test_a = A()
-        """)
+        """
+        )
         reprec = testdir.inline_run()
         reprec.assertoutcome()
 
     def test_function_equality(self, testdir, tmpdir):
         from _pytest.fixtures import FixtureManager
+
         config = testdir.parseconfigure()
         session = testdir.Session(config)
         session._fixturemanager = FixtureManager(session)
 
         def func1():
             pass
 
         def func2():
             pass
 
-        f1 = pytest.Function(name="name", parent=session, config=config,
-                             args=(1,), callobj=func1)
+        f1 = pytest.Function(
+            name="name", parent=session, config=config, args=(1,), callobj=func1
+        )
         assert f1 == f1
-        f2 = pytest.Function(name="name", config=config,
-                             callobj=func2, parent=session)
+        f2 = pytest.Function(name="name", config=config, callobj=func2, parent=session)
         assert f1 != f2
 
     def test_issue197_parametrize_emptyset(self, testdir):
-        testdir.makepyfile("""
+        testdir.makepyfile(
+            """
             import pytest
             @pytest.mark.parametrize('arg', [])
             def test_function(arg):
                 pass
-        """)
+        """
+        )
         reprec = testdir.inline_run()
         reprec.assertoutcome(skipped=1)
 
     def test_single_tuple_unwraps_values(self, testdir):
-        testdir.makepyfile("""
+        testdir.makepyfile(
+            """
             import pytest
             @pytest.mark.parametrize(('arg',), [(1,)])
             def test_function(arg):
                 assert arg == 1
-        """)
+        """
+        )
         reprec = testdir.inline_run()
         reprec.assertoutcome(passed=1)
 
     def test_issue213_parametrize_value_no_equal(self, testdir):
-        testdir.makepyfile("""
+        testdir.makepyfile(
+            """
             import pytest
             class A(object):
                 def __eq__(self, other):
                     raise ValueError("not possible")
             @pytest.mark.parametrize('arg', [A()])
             def test_function(arg):
                 assert arg.__class__.__name__ == "A"
-        """)
+        """
+        )
         reprec = testdir.inline_run("--fulltrace")
         reprec.assertoutcome(passed=1)
 
     def test_parametrize_with_non_hashable_values(self, testdir):
         """Test parametrization with non-hashable values."""
-        testdir.makepyfile("""
+        testdir.makepyfile(
+            """
             archival_mapping = {
                 '1.0': {'tag': '1.0'},
                 '1.2.2a1': {'tag': 'release-1.2.2a1'},
             }
 
             import pytest
             @pytest.mark.parametrize('key value'.split(),
                                      archival_mapping.items())
             def test_archival_to_version(key, value):
                 assert key in archival_mapping
                 assert value == archival_mapping[key]
-        """)
+        """
+        )
         rec = testdir.inline_run()
         rec.assertoutcome(passed=2)
 
     def test_parametrize_with_non_hashable_values_indirect(self, testdir):
         """Test parametrization with non-hashable values with indirect parametrization."""
-        testdir.makepyfile("""
+        testdir.makepyfile(
+            """
             archival_mapping = {
                 '1.0': {'tag': '1.0'},
                 '1.2.2a1': {'tag': 'release-1.2.2a1'},
             }
 
             import pytest
 
             @pytest.fixture
@@ -527,23 +576,25 @@ class TestFunction(object):
             def value(request):
                 return request.param
 
             @pytest.mark.parametrize('key value'.split(),
                                      archival_mapping.items(), indirect=True)
             def test_archival_to_version(key, value):
                 assert key in archival_mapping
                 assert value == archival_mapping[key]
-        """)
+        """
+        )
         rec = testdir.inline_run()
         rec.assertoutcome(passed=2)
 
     def test_parametrize_overrides_fixture(self, testdir):
         """Test parametrization when parameter overrides existing fixture with same name."""
-        testdir.makepyfile("""
+        testdir.makepyfile(
+            """
             import pytest
 
             @pytest.fixture
             def value():
                 return 'value'
 
             @pytest.mark.parametrize('value',
                                      ['overridden'])
@@ -554,567 +605,645 @@ class TestFunction(object):
             def test_not_overridden(value, somevalue):
                 assert value == 'value'
                 assert somevalue == 'overridden'
 
             @pytest.mark.parametrize('other,value', [('foo', 'overridden')])
             def test_overridden_via_multiparam(other, value):
                 assert other == 'foo'
                 assert value == 'overridden'
-        """)
+        """
+        )
         rec = testdir.inline_run()
         rec.assertoutcome(passed=3)
 
     def test_parametrize_overrides_parametrized_fixture(self, testdir):
         """Test parametrization when parameter overrides existing parametrized fixture with same name."""
-        testdir.makepyfile("""
+        testdir.makepyfile(
+            """
             import pytest
 
             @pytest.fixture(params=[1, 2])
             def value(request):
                 return request.param
 
             @pytest.mark.parametrize('value',
                                      ['overridden'])
             def test_overridden_via_param(value):
                 assert value == 'overridden'
-        """)
+        """
+        )
         rec = testdir.inline_run()
         rec.assertoutcome(passed=1)
 
     @ignore_parametrized_marks
     def test_parametrize_with_mark(self, testdir):
-        items = testdir.getitems("""
+        items = testdir.getitems(
+            """
             import pytest
             @pytest.mark.foo
             @pytest.mark.parametrize('arg', [
                 1,
                 pytest.mark.bar(pytest.mark.baz(2))
             ])
             def test_function(arg):
                 pass
-        """)
+        """
+        )
         keywords = [item.keywords for item in items]
-        assert 'foo' in keywords[0] and 'bar' not in keywords[0] and 'baz' not in keywords[0]
-        assert 'foo' in keywords[1] and 'bar' in keywords[1] and 'baz' in keywords[1]
+        assert (
+            "foo" in keywords[0]
+            and "bar" not in keywords[0]
+            and "baz" not in keywords[0]
+        )
+        assert "foo" in keywords[1] and "bar" in keywords[1] and "baz" in keywords[1]
 
     def test_function_equality_with_callspec(self, testdir, tmpdir):
-        items = testdir.getitems("""
+        items = testdir.getitems(
+            """
             import pytest
             @pytest.mark.parametrize('arg', [1,2])
             def test_function(arg):
                 pass
-        """)
+        """
+        )
         assert items[0] != items[1]
         assert not (items[0] == items[1])
 
     def test_pyfunc_call(self, testdir):
         item = testdir.getitem("def test_func(): raise ValueError")
         config = item.config
 
         class MyPlugin1(object):
+
             def pytest_pyfunc_call(self, pyfuncitem):
                 raise ValueError
 
         class MyPlugin2(object):
+
             def pytest_pyfunc_call(self, pyfuncitem):
                 return True
 
         config.pluginmanager.register(MyPlugin1())
         config.pluginmanager.register(MyPlugin2())
         config.hook.pytest_runtest_setup(item=item)
         config.hook.pytest_pyfunc_call(pyfuncitem=item)
 
     def test_multiple_parametrize(self, testdir):
-        modcol = testdir.getmodulecol("""
+        modcol = testdir.getmodulecol(
+            """
             import pytest
             @pytest.mark.parametrize('x', [0, 1])
             @pytest.mark.parametrize('y', [2, 3])
             def test1(x, y):
                 pass
-        """)
+        """
+        )
         colitems = modcol.collect()
-        assert colitems[0].name == 'test1[2-0]'
-        assert colitems[1].name == 'test1[2-1]'
-        assert colitems[2].name == 'test1[3-0]'
-        assert colitems[3].name == 'test1[3-1]'
+        assert colitems[0].name == "test1[2-0]"
+        assert colitems[1].name == "test1[2-1]"
+        assert colitems[2].name == "test1[3-0]"
+        assert colitems[3].name == "test1[3-1]"
 
     def test_issue751_multiple_parametrize_with_ids(self, testdir):
-        modcol = testdir.getmodulecol("""
+        modcol = testdir.getmodulecol(
+            """
             import pytest
             @pytest.mark.parametrize('x', [0], ids=['c'])
             @pytest.mark.parametrize('y', [0, 1], ids=['a', 'b'])
             class Test(object):
                 def test1(self, x, y):
                     pass
                 def test2(self, x, y):
                     pass
-        """)
+        """
+        )
         colitems = modcol.collect()[0].collect()[0].collect()
-        assert colitems[0].name == 'test1[a-c]'
-        assert colitems[1].name == 'test1[b-c]'
-        assert colitems[2].name == 'test2[a-c]'
-        assert colitems[3].name == 'test2[b-c]'
+        assert colitems[0].name == "test1[a-c]"
+        assert colitems[1].name == "test1[b-c]"
+        assert colitems[2].name == "test2[a-c]"
+        assert colitems[3].name == "test2[b-c]"
 
     @ignore_parametrized_marks
     def test_parametrize_skipif(self, testdir):
-        testdir.makepyfile("""
+        testdir.makepyfile(
+            """
             import pytest
 
             m = pytest.mark.skipif('True')
 
             @pytest.mark.parametrize('x', [0, 1, m(2)])
             def test_skip_if(x):
                 assert x < 2
-        """)
+        """
+        )
         result = testdir.runpytest()
-        result.stdout.fnmatch_lines('* 2 passed, 1 skipped in *')
+        result.stdout.fnmatch_lines("* 2 passed, 1 skipped in *")
 
     @ignore_parametrized_marks
     def test_parametrize_skip(self, testdir):
-        testdir.makepyfile("""
+        testdir.makepyfile(
+            """
             import pytest
 
             m = pytest.mark.skip('')
 
             @pytest.mark.parametrize('x', [0, 1, m(2)])
             def test_skip(x):
                 assert x < 2
-        """)
+        """
+        )
         result = testdir.runpytest()
-        result.stdout.fnmatch_lines('* 2 passed, 1 skipped in *')
+        result.stdout.fnmatch_lines("* 2 passed, 1 skipped in *")
 
     @ignore_parametrized_marks
     def test_parametrize_skipif_no_skip(self, testdir):
-        testdir.makepyfile("""
+        testdir.makepyfile(
+            """
             import pytest
 
             m = pytest.mark.skipif('False')
 
             @pytest.mark.parametrize('x', [0, 1, m(2)])
             def test_skipif_no_skip(x):
                 assert x < 2
-        """)
+        """
+        )
         result = testdir.runpytest()
-        result.stdout.fnmatch_lines('* 1 failed, 2 passed in *')
+        result.stdout.fnmatch_lines("* 1 failed, 2 passed in *")
 
     @ignore_parametrized_marks
     def test_parametrize_xfail(self, testdir):
-        testdir.makepyfile("""
+        testdir.makepyfile(
+            """
             import pytest
 
             m = pytest.mark.xfail('True')
 
             @pytest.mark.parametrize('x', [0, 1, m(2)])
             def test_xfail(x):
                 assert x < 2
-        """)
+        """
+        )
         result = testdir.runpytest()
-        result.stdout.fnmatch_lines('* 2 passed, 1 xfailed in *')
+        result.stdout.fnmatch_lines("* 2 passed, 1 xfailed in *")
 
     @ignore_parametrized_marks
     def test_parametrize_passed(self, testdir):
-        testdir.makepyfile("""
+        testdir.makepyfile(
+            """
             import pytest
 
             m = pytest.mark.xfail('True')
 
             @pytest.mark.parametrize('x', [0, 1, m(2)])
             def test_xfail(x):
                 pass
-        """)
+        """
+        )
         result = testdir.runpytest()
-        result.stdout.fnmatch_lines('* 2 passed, 1 xpassed in *')
+        result.stdout.fnmatch_lines("* 2 passed, 1 xpassed in *")
 
     @ignore_parametrized_marks
     def test_parametrize_xfail_passed(self, testdir):
-        testdir.makepyfile("""
+        testdir.makepyfile(
+            """
             import pytest
 
             m = pytest.mark.xfail('False')
 
             @pytest.mark.parametrize('x', [0, 1, m(2)])
             def test_passed(x):
                 pass
-        """)
+        """
+        )
         result = testdir.runpytest()
-        result.stdout.fnmatch_lines('* 3 passed in *')
+        result.stdout.fnmatch_lines("* 3 passed in *")
 
     def test_function_original_name(self, testdir):
-        items = testdir.getitems("""
+        items = testdir.getitems(
+            """
             import pytest
             @pytest.mark.parametrize('arg', [1,2])
             def test_func(arg):
                 pass
-        """)
-        assert [x.originalname for x in items] == ['test_func', 'test_func']
+        """
+        )
+        assert [x.originalname for x in items] == ["test_func", "test_func"]
 
 
 class TestSorting(object):
+
     def test_check_equality(self, testdir):
-        modcol = testdir.getmodulecol("""
+        modcol = testdir.getmodulecol(
+            """
             def test_pass(): pass
             def test_fail(): assert 0
-        """)
+        """
+        )
         fn1 = testdir.collect_by_name(modcol, "test_pass")
         assert isinstance(fn1, pytest.Function)
         fn2 = testdir.collect_by_name(modcol, "test_pass")
         assert isinstance(fn2, pytest.Function)
 
         assert fn1 == fn2
         assert fn1 != modcol
-        if py.std.sys.version_info < (3, 0):
-            assert cmp(fn1, fn2) == 0
+        if sys.version_info < (3, 0):
+            assert cmp(fn1, fn2) == 0  # NOQA
         assert hash(fn1) == hash(fn2)
 
         fn3 = testdir.collect_by_name(modcol, "test_fail")
         assert isinstance(fn3, pytest.Function)
         assert not (fn1 == fn3)
         assert fn1 != fn3
 
         for fn in fn1, fn2, fn3:
             assert fn != 3
             assert fn != modcol
             assert fn != [1, 2, 3]
             assert [1, 2, 3] != fn
             assert modcol != fn
 
     def test_allow_sane_sorting_for_decorators(self, testdir):
-        modcol = testdir.getmodulecol("""
+        modcol = testdir.getmodulecol(
+            """
             def dec(f):
                 g = lambda: f(2)
                 g.place_as = f
                 return g
 
 
             def test_b(y):
                 pass
             test_b = dec(test_b)
 
             def test_a(y):
                 pass
             test_a = dec(test_a)
-        """)
+        """
+        )
         colitems = modcol.collect()
         assert len(colitems) == 2
-        assert [item.name for item in colitems] == ['test_b', 'test_a']
+        assert [item.name for item in colitems] == ["test_b", "test_a"]
 
 
 class TestConftestCustomization(object):
+
     def test_pytest_pycollect_module(self, testdir):
-        testdir.makeconftest("""
+        testdir.makeconftest(
+            """
             import pytest
             class MyModule(pytest.Module):
                 pass
             def pytest_pycollect_makemodule(path, parent):
                 if path.basename == "test_xyz.py":
                     return MyModule(path, parent)
-        """)
+        """
+        )
         testdir.makepyfile("def test_some(): pass")
         testdir.makepyfile(test_xyz="def test_func(): pass")
         result = testdir.runpytest("--collect-only")
-        result.stdout.fnmatch_lines([
-            "*<Module*test_pytest*",
-            "*<MyModule*xyz*",
-        ])
+        result.stdout.fnmatch_lines(["*<Module*test_pytest*", "*<MyModule*xyz*"])
 
     def test_customized_pymakemodule_issue205_subdir(self, testdir):
         b = testdir.mkdir("a").mkdir("b")
-        b.join("conftest.py").write(_pytest._code.Source("""
-            def pytest_pycollect_makemodule(__multicall__):
-                mod = __multicall__.execute()
+        b.join("conftest.py").write(
+            _pytest._code.Source(
+                """
+            import pytest
+            @pytest.hookimpl(hookwrapper=True)
+            def pytest_pycollect_makemodule():
+                outcome = yield
+                mod = outcome.get_result()
                 mod.obj.hello = "world"
-                return mod
-        """))
-        b.join("test_module.py").write(_pytest._code.Source("""
+        """
+            )
+        )
+        b.join("test_module.py").write(
+            _pytest._code.Source(
+                """
             def test_hello():
                 assert hello == "world"
-        """))
+        """
+            )
+        )
         reprec = testdir.inline_run()
         reprec.assertoutcome(passed=1)
 
     def test_customized_pymakeitem(self, testdir):
         b = testdir.mkdir("a").mkdir("b")
-        b.join("conftest.py").write(_pytest._code.Source("""
+        b.join("conftest.py").write(
+            _pytest._code.Source(
+                """
             import pytest
             @pytest.hookimpl(hookwrapper=True)
             def pytest_pycollect_makeitem():
                 outcome = yield
                 if outcome.excinfo is None:
-                    result = outcome.result
+                    result = outcome.get_result()
                     if result:
                         for func in result:
                             func._some123 = "world"
-        """))
-        b.join("test_module.py").write(_pytest._code.Source("""
+        """
+            )
+        )
+        b.join("test_module.py").write(
+            _pytest._code.Source(
+                """
             import pytest
 
             @pytest.fixture()
             def obj(request):
                 return request.node._some123
             def test_hello(obj):
                 assert obj == "world"
-        """))
+        """
+            )
+        )
         reprec = testdir.inline_run()
         reprec.assertoutcome(passed=1)
 
     def test_pytest_pycollect_makeitem(self, testdir):
-        testdir.makeconftest("""
+        testdir.makeconftest(
+            """
             import pytest
             class MyFunction(pytest.Function):
                 pass
             def pytest_pycollect_makeitem(collector, name, obj):
                 if name == "some":
                     return MyFunction(name, collector)
-        """)
+        """
+        )
         testdir.makepyfile("def some(): pass")
         result = testdir.runpytest("--collect-only")
-        result.stdout.fnmatch_lines([
-            "*MyFunction*some*",
-        ])
+        result.stdout.fnmatch_lines(["*MyFunction*some*"])
 
     def test_makeitem_non_underscore(self, testdir, monkeypatch):
         modcol = testdir.getmodulecol("def _hello(): pass")
         values = []
-        monkeypatch.setattr(pytest.Module, 'makeitem',
-                            lambda self, name, obj: values.append(name))
+        monkeypatch.setattr(
+            pytest.Module, "makeitem", lambda self, name, obj: values.append(name)
+        )
         values = modcol.collect()
-        assert '_hello' not in values
+        assert "_hello" not in values
 
     def test_issue2369_collect_module_fileext(self, testdir):
         """Ensure we can collect files with weird file extensions as Python
         modules (#2369)"""
         # We'll implement a little finder and loader to import files containing
         # Python source code whose file extension is ".narf".
-        testdir.makeconftest("""
+        testdir.makeconftest(
+            """
             import sys, os, imp
             from _pytest.python import Module
 
-            class Loader:
+            class Loader(object):
                 def load_module(self, name):
                     return imp.load_source(name, name + ".narf")
-            class Finder:
+            class Finder(object):
                 def find_module(self, name, path=None):
                     if os.path.exists(name + ".narf"):
                         return Loader()
             sys.meta_path.append(Finder())
 
             def pytest_collect_file(path, parent):
                 if path.ext == ".narf":
-                    return Module(path, parent)""")
-        testdir.makefile(".narf", """
+                    return Module(path, parent)"""
+        )
+        testdir.makefile(
+            ".narf",
+            """
             def test_something():
-                assert 1 + 1 == 2""")
+                assert 1 + 1 == 2""",
+        )
         # Use runpytest_subprocess, since we're futzing with sys.meta_path.
         result = testdir.runpytest_subprocess()
-        result.stdout.fnmatch_lines('*1 passed*')
+        result.stdout.fnmatch_lines("*1 passed*")
 
 
 def test_setup_only_available_in_subdir(testdir):
     sub1 = testdir.mkpydir("sub1")
     sub2 = testdir.mkpydir("sub2")
-    sub1.join("conftest.py").write(_pytest._code.Source("""
+    sub1.join("conftest.py").write(
+        _pytest._code.Source(
+            """
         import pytest
         def pytest_runtest_setup(item):
             assert item.fspath.purebasename == "test_in_sub1"
         def pytest_runtest_call(item):
             assert item.fspath.purebasename == "test_in_sub1"
         def pytest_runtest_teardown(item):
             assert item.fspath.purebasename == "test_in_sub1"
-    """))
-    sub2.join("conftest.py").write(_pytest._code.Source("""
+    """
+        )
+    )
+    sub2.join("conftest.py").write(
+        _pytest._code.Source(
+            """
         import pytest
         def pytest_runtest_setup(item):
             assert item.fspath.purebasename == "test_in_sub2"
         def pytest_runtest_call(item):
             assert item.fspath.purebasename == "test_in_sub2"
         def pytest_runtest_teardown(item):
             assert item.fspath.purebasename == "test_in_sub2"
-    """))
+    """
+        )
+    )
     sub1.join("test_in_sub1.py").write("def test_1(): pass")
     sub2.join("test_in_sub2.py").write("def test_2(): pass")
     result = testdir.runpytest("-v", "-s")
     result.assert_outcomes(passed=2)
 
 
 def test_modulecol_roundtrip(testdir):
     modcol = testdir.getmodulecol("pass", withinit=True)
     trail = modcol.nodeid
     newcol = modcol.session.perform_collect([trail], genitems=0)[0]
     assert modcol.name == newcol.name
 
 
 class TestTracebackCutting(object):
+
     def test_skip_simple(self):
         excinfo = pytest.raises(pytest.skip.Exception, 'pytest.skip("xxx")')
         assert excinfo.traceback[-1].frame.code.name == "skip"
         assert excinfo.traceback[-1].ishidden()
 
     def test_traceback_argsetup(self, testdir):
-        testdir.makeconftest("""
+        testdir.makeconftest(
+            """
             import pytest
 
             @pytest.fixture
             def hello(request):
                 raise ValueError("xyz")
-        """)
+        """
+        )
         p = testdir.makepyfile("def test(hello): pass")
         result = testdir.runpytest(p)
         assert result.ret != 0
         out = result.stdout.str()
         assert "xyz" in out
         assert "conftest.py:5: ValueError" in out
         numentries = out.count("_ _ _")  # separator for traceback entries
         assert numentries == 0
 
         result = testdir.runpytest("--fulltrace", p)
         out = result.stdout.str()
         assert "conftest.py:5: ValueError" in out
         numentries = out.count("_ _ _ _")  # separator for traceback entries
         assert numentries > 3
 
     def test_traceback_error_during_import(self, testdir):
-        testdir.makepyfile("""
+        testdir.makepyfile(
+            """
             x = 1
             x = 2
             x = 17
             asd
-        """)
+        """
+        )
         result = testdir.runpytest()
         assert result.ret != 0
         out = result.stdout.str()
         assert "x = 1" not in out
         assert "x = 2" not in out
-        result.stdout.fnmatch_lines([
-            " *asd*",
-            "E*NameError*",
-        ])
+        result.stdout.fnmatch_lines([" *asd*", "E*NameError*"])
         result = testdir.runpytest("--fulltrace")
         out = result.stdout.str()
         assert "x = 1" in out
         assert "x = 2" in out
-        result.stdout.fnmatch_lines([
-            ">*asd*",
-            "E*NameError*",
-        ])
+        result.stdout.fnmatch_lines([">*asd*", "E*NameError*"])
 
     def test_traceback_filter_error_during_fixture_collection(self, testdir):
         """integration test for issue #995.
         """
-        testdir.makepyfile("""
+        testdir.makepyfile(
+            """
             import pytest
 
             def fail_me(func):
                 ns = {}
                 exec('def w(): raise ValueError("fail me")', ns)
                 return ns['w']
 
             @pytest.fixture(scope='class')
             @fail_me
             def fail_fixture():
                 pass
 
             def test_failing_fixture(fail_fixture):
                pass
-        """)
+        """
+        )
         result = testdir.runpytest()
         assert result.ret != 0
         out = result.stdout.str()
         assert "INTERNALERROR>" not in out
-        result.stdout.fnmatch_lines([
-            "*ValueError: fail me*",
-            "* 1 error in *",
-        ])
+        result.stdout.fnmatch_lines(["*ValueError: fail me*", "* 1 error in *"])
 
     def test_filter_traceback_generated_code(self):
         """test that filter_traceback() works with the fact that
         py.code.Code.path attribute might return an str object.
         In this case, one of the entries on the traceback was produced by
         dynamically generated code.
         See: https://bitbucket.org/pytest-dev/py/issues/71
         This fixes #995.
         """
         from _pytest.python import filter_traceback
+
         try:
             ns = {}
-            exec('def foo(): raise ValueError', ns)
-            ns['foo']()
+            exec("def foo(): raise ValueError", ns)
+            ns["foo"]()
         except ValueError:
             _, _, tb = sys.exc_info()
 
         tb = _pytest._code.Traceback(tb)
         assert isinstance(tb[-1].path, str)
         assert not filter_traceback(tb[-1])
 
     def test_filter_traceback_path_no_longer_valid(self, testdir):
         """test that filter_traceback() works with the fact that
         py.code.Code.path attribute might return an str object.
         In this case, one of the files in the traceback no longer exists.
         This fixes #1133.
         """
         from _pytest.python import filter_traceback
+
         testdir.syspathinsert()
-        testdir.makepyfile(filter_traceback_entry_as_str='''
+        testdir.makepyfile(
+            filter_traceback_entry_as_str="""
             def foo():
                 raise ValueError
-        ''')
+        """
+        )
         try:
             import filter_traceback_entry_as_str
+
             filter_traceback_entry_as_str.foo()
         except ValueError:
             _, _, tb = sys.exc_info()
 
-        testdir.tmpdir.join('filter_traceback_entry_as_str.py').remove()
+        testdir.tmpdir.join("filter_traceback_entry_as_str.py").remove()
         tb = _pytest._code.Traceback(tb)
         assert isinstance(tb[-1].path, str)
         assert filter_traceback(tb[-1])
 
 
 class TestReportInfo(object):
+
     def test_itemreport_reportinfo(self, testdir, linecomp):
-        testdir.makeconftest("""
+        testdir.makeconftest(
+            """
             import pytest
             class MyFunction(pytest.Function):
                 def reportinfo(self):
                     return "ABCDE", 42, "custom"
             def pytest_pycollect_makeitem(collector, name, obj):
                 if name == "test_func":
                     return MyFunction(name, parent=collector)
-        """)
+        """
+        )
         item = testdir.getitem("def test_func(): pass")
         item.config.pluginmanager.getplugin("runner")
         assert item.location == ("ABCDE", 42, "custom")
 
     def test_func_reportinfo(self, testdir):
         item = testdir.getitem("def test_func(): pass")
         fspath, lineno, modpath = item.reportinfo()
         assert fspath == item.fspath
         assert lineno == 0
         assert modpath == "test_func"
 
     def test_class_reportinfo(self, testdir):
-        modcol = testdir.getmodulecol("""
+        modcol = testdir.getmodulecol(
+            """
             # lineno 0
             class TestClass(object):
                 def test_hello(self): pass
-        """)
+        """
+        )
         classcol = testdir.collect_by_name(modcol, "TestClass")
         fspath, lineno, msg = classcol.reportinfo()
         assert fspath == modcol.fspath
         assert lineno == 1
         assert msg == "TestClass"
 
     def test_generator_reportinfo(self, testdir):
-        modcol = testdir.getmodulecol("""
+        modcol = testdir.getmodulecol(
+            """
             # lineno 0
             def test_gen():
                 def check(x):
                     assert x
                 yield check, 3
-        """)
+        """
+        )
         gencol = testdir.collect_by_name(modcol, "test_gen")
         fspath, lineno, modpath = gencol.reportinfo()
         assert fspath == modcol.fspath
         assert lineno == 1
         assert modpath == "test_gen"
 
         genitem = gencol.collect()[0]
         fspath, lineno, modpath = genitem.reportinfo()
@@ -1130,151 +1259,159 @@ class TestReportInfo(object):
                 yield check, 3
             class TestClass(object):
                 def test_method(self):
                     pass
        """
 
     def test_reportinfo_with_nasty_getattr(self, testdir):
         # https://github.com/pytest-dev/pytest/issues/1204
-        modcol = testdir.getmodulecol("""
+        modcol = testdir.getmodulecol(
+            """
             # lineno 0
             class TestClass(object):
                 def __getattr__(self, name):
                     return "this is not an int"
 
                 def test_foo(self):
                     pass
-        """)
+        """
+        )
         classcol = testdir.collect_by_name(modcol, "TestClass")
         instance = classcol.collect()[0]
         fspath, lineno, msg = instance.reportinfo()
 
 
 def test_customized_python_discovery(testdir):
-    testdir.makeini("""
+    testdir.makeini(
+        """
         [pytest]
         python_files=check_*.py
         python_classes=Check
         python_functions=check
-    """)
-    p = testdir.makepyfile("""
+    """
+    )
+    p = testdir.makepyfile(
+        """
         def check_simple():
             pass
         class CheckMyApp(object):
             def check_meth(self):
                 pass
-    """)
+    """
+    )
     p2 = p.new(basename=p.basename.replace("test", "check"))
     p.move(p2)
     result = testdir.runpytest("--collect-only", "-s")
-    result.stdout.fnmatch_lines([
-        "*check_customized*",
-        "*check_simple*",
-        "*CheckMyApp*",
-        "*check_meth*",
-    ])
+    result.stdout.fnmatch_lines(
+        ["*check_customized*", "*check_simple*", "*CheckMyApp*", "*check_meth*"]
+    )
 
     result = testdir.runpytest()
     assert result.ret == 0
-    result.stdout.fnmatch_lines([
-        "*2 passed*",
-    ])
+    result.stdout.fnmatch_lines(["*2 passed*"])
 
 
 def test_customized_python_discovery_functions(testdir):
-    testdir.makeini("""
+    testdir.makeini(
+        """
         [pytest]
         python_functions=_test
-    """)
-    testdir.makepyfile("""
+    """
+    )
+    testdir.makepyfile(
+        """
         def _test_underscore():
             pass
-    """)
+    """
+    )
     result = testdir.runpytest("--collect-only", "-s")
-    result.stdout.fnmatch_lines([
-        "*_test_underscore*",
-    ])
+    result.stdout.fnmatch_lines(["*_test_underscore*"])
 
     result = testdir.runpytest()
     assert result.ret == 0
-    result.stdout.fnmatch_lines([
-        "*1 passed*",
-    ])
+    result.stdout.fnmatch_lines(["*1 passed*"])
 
 
 def test_collector_attributes(testdir):
-    testdir.makeconftest("""
+    testdir.makeconftest(
+        """
         import pytest
         def pytest_pycollect_makeitem(collector):
             assert collector.Function == pytest.Function
             assert collector.Class == pytest.Class
             assert collector.Instance == pytest.Instance
             assert collector.Module == pytest.Module
-    """)
-    testdir.makepyfile("""
+    """
+    )
+    testdir.makepyfile(
+        """
          def test_hello():
             pass
-    """)
+    """
+    )
     result = testdir.runpytest()
-    result.stdout.fnmatch_lines([
-        "*1 passed*",
-    ])
+    result.stdout.fnmatch_lines(["*1 passed*"])
 
 
 def test_customize_through_attributes(testdir):
-    testdir.makeconftest("""
+    testdir.makeconftest(
+        """
         import pytest
         class MyFunction(pytest.Function):
             pass
         class MyInstance(pytest.Instance):
             Function = MyFunction
         class MyClass(pytest.Class):
             Instance = MyInstance
 
         def pytest_pycollect_makeitem(collector, name, obj):
             if name.startswith("MyTestClass"):
                 return MyClass(name, parent=collector)
-    """)
-    testdir.makepyfile("""
+    """
+    )
+    testdir.makepyfile(
+        """
          class MyTestClass(object):
             def test_hello(self):
                 pass
-    """)
+    """
+    )
     result = testdir.runpytest("--collect-only")
-    result.stdout.fnmatch_lines([
-        "*MyClass*",
-        "*MyInstance*",
-        "*MyFunction*test_hello*",
-    ])
+    result.stdout.fnmatch_lines(
+        ["*MyClass*", "*MyInstance*", "*MyFunction*test_hello*"]
+    )
 
 
 def test_unorderable_types(testdir):
-    testdir.makepyfile("""
+    testdir.makepyfile(
+        """
         class TestJoinEmpty(object):
             pass
 
         def make_test():
             class Test(object):
                 pass
             Test.__name__ = "TestFoo"
             return Test
         TestFoo = make_test()
-    """)
+    """
+    )
     result = testdir.runpytest()
     assert "TypeError" not in result.stdout.str()
     assert result.ret == EXIT_NOTESTSCOLLECTED
 
 
 def test_collect_functools_partial(testdir):
     """
     Test that collection of functools.partial object works, and arguments
     to the wrapped functions are dealt correctly (see #811).
     """
-    testdir.makepyfile("""
+    testdir.makepyfile(
+        """
         import functools
         import pytest
 
         @pytest.fixture
         def fix1():
             return 'fix1'
 
         @pytest.fixture
@@ -1298,110 +1435,121 @@ def test_collect_functools_partial(testd
         test_ok_2 = functools.partial(check1, i=2, fix1='fix1')
         test_ok_3 = functools.partial(check1, 2)
         test_ok_4 = functools.partial(check2, i=2)
         test_ok_5 = functools.partial(check3, i=2)
         test_ok_6 = functools.partial(check3, i=2, fix1='fix1')
 
         test_fail_1 = functools.partial(check2, 2)
         test_fail_2 = functools.partial(check3, 2)
-    """)
+    """
+    )
     result = testdir.inline_run()
     result.assertoutcome(passed=6, failed=2)
 
 
 def test_dont_collect_non_function_callable(testdir):
     """Test for issue https://github.com/pytest-dev/pytest/issues/331
 
     In this case an INTERNALERROR occurred trying to report the failure of
     a test like this one because py test failed to get the source lines.
     """
-    testdir.makepyfile("""
+    testdir.makepyfile(
+        """
         class Oh(object):
             def __call__(self):
                 pass
 
         test_a = Oh()
 
         def test_real():
             pass
-    """)
-    result = testdir.runpytest('-rw')
-    result.stdout.fnmatch_lines([
-        '*collected 1 item*',
-        "*cannot collect 'test_a' because it is not a function*",
-        '*1 passed, 1 warnings in *',
-    ])
+    """
+    )
+    result = testdir.runpytest("-rw")
+    result.stdout.fnmatch_lines(
+        [
+            "*collected 1 item*",
+            "*cannot collect 'test_a' because it is not a function*",
+            "*1 passed, 1 warnings in *",
+        ]
+    )
 
 
 def test_class_injection_does_not_break_collection(testdir):
     """Tests whether injection during collection time will terminate testing.
 
     In this case the error should not occur if the TestClass itself
     is modified during collection time, and the original method list
     is still used for collection.
     """
-    testdir.makeconftest("""
+    testdir.makeconftest(
+        """
         from test_inject import TestClass
         def pytest_generate_tests(metafunc):
             TestClass.changed_var = {}
-    """)
-    testdir.makepyfile(test_inject='''
+    """
+    )
+    testdir.makepyfile(
+        test_inject='''
          class TestClass(object):
             def test_injection(self):
                 """Test being parametrized."""
                 pass
-    ''')
+    '''
+    )
     result = testdir.runpytest()
     assert "RuntimeError: dictionary changed size during iteration" not in result.stdout.str()
-    result.stdout.fnmatch_lines(['*1 passed*'])
+    result.stdout.fnmatch_lines(["*1 passed*"])
 
 
 def test_syntax_error_with_non_ascii_chars(testdir):
     """Fix decoding issue while formatting SyntaxErrors during collection (#578)
     """
-    testdir.makepyfile(u"""
+    testdir.makepyfile(
+        u"""
     # -*- coding: UTF-8 -*-
 

-    """)
+    """
+    )
     result = testdir.runpytest()
-    result.stdout.fnmatch_lines([
-        '*ERROR collecting*',
-        '*SyntaxError*',
-        '*1 error in*',
-    ])
+    result.stdout.fnmatch_lines(["*ERROR collecting*", "*SyntaxError*", "*1 error in*"])
 
 
 def test_skip_duplicates_by_default(testdir):
     """Test for issue https://github.com/pytest-dev/pytest/issues/1609 (#1609)
 
     Ignore duplicate directories.
     """
     a = testdir.mkdir("a")
     fh = a.join("test_a.py")
-    fh.write(_pytest._code.Source("""
+    fh.write(
+        _pytest._code.Source(
+            """
         import pytest
         def test_real():
             pass
-    """))
+    """
+        )
+    )
     result = testdir.runpytest(a.strpath, a.strpath)
-    result.stdout.fnmatch_lines([
-        '*collected 1 item*',
-    ])
+    result.stdout.fnmatch_lines(["*collected 1 item*"])
 
 
 def test_keep_duplicates(testdir):
     """Test for issue https://github.com/pytest-dev/pytest/issues/1609 (#1609)
 
     Use --keep-duplicates to collect tests from duplicate directories.
     """
     a = testdir.mkdir("a")
     fh = a.join("test_a.py")
-    fh.write(_pytest._code.Source("""
+    fh.write(
+        _pytest._code.Source(
+            """
         import pytest
         def test_real():
             pass
-    """))
+    """
+        )
+    )
     result = testdir.runpytest("--keep-duplicates", a.strpath, a.strpath)
-    result.stdout.fnmatch_lines([
-        '*collected 2 item*',
-    ])
+    result.stdout.fnmatch_lines(["*collected 2 item*"])
--- a/third_party/python/pytest/testing/python/fixture.py
+++ b/third_party/python/pytest/testing/python/fixture.py
@@ -1,568 +1,714 @@
 from textwrap import dedent
 
 import _pytest._code
 import pytest
-import sys
 from _pytest.pytester import get_public_names
-from _pytest.fixtures import FixtureLookupError
+from _pytest.fixtures import FixtureLookupError, FixtureRequest
 from _pytest import fixtures
 
 
 def test_getfuncargnames():
+
     def f():
         pass
+
     assert not fixtures.getfuncargnames(f)
 
     def g(arg):
         pass
-    assert fixtures.getfuncargnames(g) == ('arg',)
+
+    assert fixtures.getfuncargnames(g) == ("arg",)
 
     def h(arg1, arg2="hello"):
         pass
-    assert fixtures.getfuncargnames(h) == ('arg1',)
+
+    assert fixtures.getfuncargnames(h) == ("arg1",)
 
     def h(arg1, arg2, arg3="hello"):
         pass
-    assert fixtures.getfuncargnames(h) == ('arg1', 'arg2')
+
+    assert fixtures.getfuncargnames(h) == ("arg1", "arg2")
 
     class A(object):
+
         def f(self, arg1, arg2="hello"):
             pass
 
         @staticmethod
         def static(arg1, arg2):
             pass
 
-    assert fixtures.getfuncargnames(A().f) == ('arg1',)
-    if sys.version_info < (3, 0):
-        assert fixtures.getfuncargnames(A.f) == ('arg1',)
-
-    assert fixtures.getfuncargnames(A.static, cls=A) == ('arg1', 'arg2')
+    assert fixtures.getfuncargnames(A().f) == ("arg1",)
+    assert fixtures.getfuncargnames(A.static, cls=A) == ("arg1", "arg2")
 
 
 class TestFillFixtures(object):
+
     def test_fillfuncargs_exposed(self):
         # used by oejskit, kept for compatibility
         assert pytest._fillfuncargs == fixtures.fillfixtures
 
     def test_funcarg_lookupfails(self, testdir):
-        testdir.makepyfile("""
+        testdir.makepyfile(
+            """
             import pytest
 
             @pytest.fixture
             def xyzsomething(request):
                 return 42
 
             def test_func(some):
                 pass
-        """)
+        """
+        )
         result = testdir.runpytest()  # "--collect-only")
         assert result.ret != 0
-        result.stdout.fnmatch_lines([
-            "*def test_func(some)*",
-            "*fixture*some*not found*",
-            "*xyzsomething*",
-        ])
+        result.stdout.fnmatch_lines(
+            ["*def test_func(some)*", "*fixture*some*not found*", "*xyzsomething*"]
+        )
 
     def test_funcarg_basic(self, testdir):
-        item = testdir.getitem("""
+        item = testdir.getitem(
+            """
             import pytest
 
             @pytest.fixture
             def some(request):
                 return request.function.__name__
             @pytest.fixture
             def other(request):
                 return 42
             def test_func(some, other):
                 pass
-        """)
+        """
+        )
         fixtures.fillfixtures(item)
         del item.funcargs["request"]
         assert len(get_public_names(item.funcargs)) == 2
-        assert item.funcargs['some'] == "test_func"
-        assert item.funcargs['other'] == 42
+        assert item.funcargs["some"] == "test_func"
+        assert item.funcargs["other"] == 42
 
     def test_funcarg_lookup_modulelevel(self, testdir):
-        testdir.makepyfile("""
+        testdir.makepyfile(
+            """
             import pytest
 
             @pytest.fixture
             def something(request):
                 return request.function.__name__
 
             class TestClass(object):
                 def test_method(self, something):
                     assert something == "test_method"
             def test_func(something):
                 assert something == "test_func"
-        """)
+        """
+        )
         reprec = testdir.inline_run()
         reprec.assertoutcome(passed=2)
 
     def test_funcarg_lookup_classlevel(self, testdir):
-        p = testdir.makepyfile("""
+        p = testdir.makepyfile(
+            """
             import pytest
             class TestClass(object):
 
                 @pytest.fixture
                 def something(self, request):
                     return request.instance
 
                 def test_method(self, something):
                     assert something is self
-        """)
+        """
+        )
         result = testdir.runpytest(p)
-        result.stdout.fnmatch_lines([
-            "*1 passed*"
-        ])
+        result.stdout.fnmatch_lines(["*1 passed*"])
 
     def test_conftest_funcargs_only_available_in_subdir(self, testdir):
         sub1 = testdir.mkpydir("sub1")
         sub2 = testdir.mkpydir("sub2")
-        sub1.join("conftest.py").write(_pytest._code.Source("""
+        sub1.join("conftest.py").write(
+            _pytest._code.Source(
+                """
             import pytest
             @pytest.fixture
             def arg1(request):
                 pytest.raises(Exception, "request.getfixturevalue('arg2')")
-        """))
-        sub2.join("conftest.py").write(_pytest._code.Source("""
+        """
+            )
+        )
+        sub2.join("conftest.py").write(
+            _pytest._code.Source(
+                """
             import pytest
             @pytest.fixture
             def arg2(request):
                 pytest.raises(Exception, "request.getfixturevalue('arg1')")
-        """))
+        """
+            )
+        )
 
         sub1.join("test_in_sub1.py").write("def test_1(arg1): pass")
         sub2.join("test_in_sub2.py").write("def test_2(arg2): pass")
         result = testdir.runpytest("-v")
         result.assert_outcomes(passed=2)
 
     def test_extend_fixture_module_class(self, testdir):
-        testfile = testdir.makepyfile("""
+        testfile = testdir.makepyfile(
+            """
             import pytest
 
             @pytest.fixture
             def spam():
                 return 'spam'
 
             class TestSpam(object):
 
                  @pytest.fixture
                  def spam(self, spam):
                      return spam * 2
 
                  def test_spam(self, spam):
                      assert spam == 'spamspam'
-        """)
+        """
+        )
         result = testdir.runpytest()
         result.stdout.fnmatch_lines(["*1 passed*"])
         result = testdir.runpytest(testfile)
         result.stdout.fnmatch_lines(["*1 passed*"])
 
     def test_extend_fixture_conftest_module(self, testdir):
-        testdir.makeconftest("""
+        testdir.makeconftest(
+            """
             import pytest
 
             @pytest.fixture
             def spam():
                 return 'spam'
-        """)
-        testfile = testdir.makepyfile("""
+        """
+        )
+        testfile = testdir.makepyfile(
+            """
             import pytest
 
             @pytest.fixture
             def spam(spam):
                 return spam * 2
 
             def test_spam(spam):
                 assert spam == 'spamspam'
-        """)
+        """
+        )
         result = testdir.runpytest()
         result.stdout.fnmatch_lines(["*1 passed*"])
         result = testdir.runpytest(testfile)
         result.stdout.fnmatch_lines(["*1 passed*"])
 
     def test_extend_fixture_conftest_conftest(self, testdir):
-        testdir.makeconftest("""
+        testdir.makeconftest(
+            """
             import pytest
 
             @pytest.fixture
             def spam():
                 return 'spam'
-        """)
+        """
+        )
         pkg = testdir.mkpydir("pkg")
-        pkg.join("conftest.py").write(_pytest._code.Source("""
+        pkg.join("conftest.py").write(
+            _pytest._code.Source(
+                """
             import pytest
 
             @pytest.fixture
             def spam(spam):
                 return spam * 2
-        """))
+        """
+            )
+        )
         testfile = pkg.join("test_spam.py")
-        testfile.write(_pytest._code.Source("""
+        testfile.write(
+            _pytest._code.Source(
+                """
             def test_spam(spam):
                 assert spam == "spamspam"
-        """))
+        """
+            )
+        )
         result = testdir.runpytest()
         result.stdout.fnmatch_lines(["*1 passed*"])
         result = testdir.runpytest(testfile)
         result.stdout.fnmatch_lines(["*1 passed*"])
 
     def test_extend_fixture_conftest_plugin(self, testdir):
-        testdir.makepyfile(testplugin="""
+        testdir.makepyfile(
+            testplugin="""
             import pytest
 
             @pytest.fixture
             def foo():
                 return 7
-        """)
+        """
+        )
         testdir.syspathinsert()
-        testdir.makeconftest("""
+        testdir.makeconftest(
+            """
             import pytest
 
             pytest_plugins = 'testplugin'
 
             @pytest.fixture
             def foo(foo):
                 return foo + 7
-        """)
-        testdir.makepyfile("""
+        """
+        )
+        testdir.makepyfile(
+            """
             def test_foo(foo):
                 assert foo == 14
-        """)
-        result = testdir.runpytest('-s')
+        """
+        )
+        result = testdir.runpytest("-s")
         assert result.ret == 0
 
     def test_extend_fixture_plugin_plugin(self, testdir):
         # Two plugins should extend each order in loading order
-        testdir.makepyfile(testplugin0="""
+        testdir.makepyfile(
+            testplugin0="""
             import pytest
 
             @pytest.fixture
             def foo():
                 return 7
-        """)
-        testdir.makepyfile(testplugin1="""
+        """
+        )
+        testdir.makepyfile(
+            testplugin1="""
             import pytest
 
             @pytest.fixture
             def foo(foo):
                 return foo + 7
-        """)
+        """
+        )
         testdir.syspathinsert()
-        testdir.makepyfile("""
+        testdir.makepyfile(
+            """
             pytest_plugins = ['testplugin0', 'testplugin1']
 
             def test_foo(foo):
                 assert foo == 14
-        """)
+        """
+        )
         result = testdir.runpytest()
         assert result.ret == 0
 
     def test_override_parametrized_fixture_conftest_module(self, testdir):
         """Test override of the parametrized fixture with non-parametrized one on the test module level."""
-        testdir.makeconftest("""
+        testdir.makeconftest(
+            """
             import pytest
 
             @pytest.fixture(params=[1, 2, 3])
             def spam(request):
                 return request.param
-        """)
-        testfile = testdir.makepyfile("""
+        """
+        )
+        testfile = testdir.makepyfile(
+            """
             import pytest
 
             @pytest.fixture
             def spam():
                 return 'spam'
 
             def test_spam(spam):
                 assert spam == 'spam'
-        """)
+        """
+        )
         result = testdir.runpytest()
         result.stdout.fnmatch_lines(["*1 passed*"])
         result = testdir.runpytest(testfile)
         result.stdout.fnmatch_lines(["*1 passed*"])
 
     def test_override_parametrized_fixture_conftest_conftest(self, testdir):
         """Test override of the parametrized fixture with non-parametrized one on the conftest level."""
-        testdir.makeconftest("""
+        testdir.makeconftest(
+            """
             import pytest
 
             @pytest.fixture(params=[1, 2, 3])
             def spam(request):
                 return request.param
-        """)
-        subdir = testdir.mkpydir('subdir')
-        subdir.join("conftest.py").write(_pytest._code.Source("""
+        """
+        )
+        subdir = testdir.mkpydir("subdir")
+        subdir.join("conftest.py").write(
+            _pytest._code.Source(
+                """
             import pytest
 
             @pytest.fixture
             def spam():
                 return 'spam'
-        """))
+        """
+            )
+        )
         testfile = subdir.join("test_spam.py")
-        testfile.write(_pytest._code.Source("""
+        testfile.write(
+            _pytest._code.Source(
+                """
             def test_spam(spam):
                 assert spam == "spam"
-        """))
+        """
+            )
+        )
         result = testdir.runpytest()
         result.stdout.fnmatch_lines(["*1 passed*"])
         result = testdir.runpytest(testfile)
         result.stdout.fnmatch_lines(["*1 passed*"])
 
     def test_override_non_parametrized_fixture_conftest_module(self, testdir):
         """Test override of the non-parametrized fixture with parametrized one on the test module level."""
-        testdir.makeconftest("""
+        testdir.makeconftest(
+            """
             import pytest
 
             @pytest.fixture
             def spam():
                 return 'spam'
-        """)
-        testfile = testdir.makepyfile("""
+        """
+        )
+        testfile = testdir.makepyfile(
+            """
             import pytest
 
             @pytest.fixture(params=[1, 2, 3])
             def spam(request):
                 return request.param
 
             params = {'spam': 1}
 
             def test_spam(spam):
                 assert spam == params['spam']
                 params['spam'] += 1
-        """)
+        """
+        )
         result = testdir.runpytest()
         result.stdout.fnmatch_lines(["*3 passed*"])
         result = testdir.runpytest(testfile)
         result.stdout.fnmatch_lines(["*3 passed*"])
 
     def test_override_non_parametrized_fixture_conftest_conftest(self, testdir):
         """Test override of the non-parametrized fixture with parametrized one on the conftest level."""
-        testdir.makeconftest("""
+        testdir.makeconftest(
+            """
             import pytest
 
             @pytest.fixture
             def spam():
                 return 'spam'
-        """)
-        subdir = testdir.mkpydir('subdir')
-        subdir.join("conftest.py").write(_pytest._code.Source("""
+        """
+        )
+        subdir = testdir.mkpydir("subdir")
+        subdir.join("conftest.py").write(
+            _pytest._code.Source(
+                """
             import pytest
 
             @pytest.fixture(params=[1, 2, 3])
             def spam(request):
                 return request.param
-        """))
+        """
+            )
+        )
         testfile = subdir.join("test_spam.py")
-        testfile.write(_pytest._code.Source("""
+        testfile.write(
+            _pytest._code.Source(
+                """
             params = {'spam': 1}
 
             def test_spam(spam):
                 assert spam == params['spam']
                 params['spam'] += 1
-        """))
+        """
+            )
+        )
         result = testdir.runpytest()
         result.stdout.fnmatch_lines(["*3 passed*"])
         result = testdir.runpytest(testfile)
         result.stdout.fnmatch_lines(["*3 passed*"])
 
-    def test_override_autouse_fixture_with_parametrized_fixture_conftest_conftest(self, testdir):
+    def test_override_autouse_fixture_with_parametrized_fixture_conftest_conftest(
+        self, testdir
+    ):
         """Test override of the autouse fixture with parametrized one on the conftest level.
         This test covers the issue explained in issue 1601
         """
-        testdir.makeconftest("""
+        testdir.makeconftest(
+            """
             import pytest
 
             @pytest.fixture(autouse=True)
             def spam():
                 return 'spam'
-        """)
-        subdir = testdir.mkpydir('subdir')
-        subdir.join("conftest.py").write(_pytest._code.Source("""
+        """
+        )
+        subdir = testdir.mkpydir("subdir")
+        subdir.join("conftest.py").write(
+            _pytest._code.Source(
+                """
             import pytest
 
             @pytest.fixture(params=[1, 2, 3])
             def spam(request):
                 return request.param
-        """))
+        """
+            )
+        )
         testfile = subdir.join("test_spam.py")
-        testfile.write(_pytest._code.Source("""
+        testfile.write(
+            _pytest._code.Source(
+                """
             params = {'spam': 1}
 
             def test_spam(spam):
                 assert spam == params['spam']
                 params['spam'] += 1
-        """))
+        """
+            )
+        )
         result = testdir.runpytest()
         result.stdout.fnmatch_lines(["*3 passed*"])
         result = testdir.runpytest(testfile)
         result.stdout.fnmatch_lines(["*3 passed*"])
 
     def test_autouse_fixture_plugin(self, testdir):
         # A fixture from a plugin has no baseid set, which screwed up
         # the autouse fixture handling.
-        testdir.makepyfile(testplugin="""
+        testdir.makepyfile(
+            testplugin="""
             import pytest
 
             @pytest.fixture(autouse=True)
             def foo(request):
                 request.function.foo = 7
-        """)
+        """
+        )
         testdir.syspathinsert()
-        testdir.makepyfile("""
+        testdir.makepyfile(
+            """
             pytest_plugins = 'testplugin'
 
             def test_foo(request):
                 assert request.function.foo == 7
-        """)
+        """
+        )
         result = testdir.runpytest()
         assert result.ret == 0
 
     def test_funcarg_lookup_error(self, testdir):
-        testdir.makeconftest("""
+        testdir.makeconftest(
+            """
             import pytest
 
             @pytest.fixture
             def a_fixture(): pass
 
             @pytest.fixture
             def b_fixture(): pass
 
             @pytest.fixture
             def c_fixture(): pass
 
             @pytest.fixture
             def d_fixture(): pass
-        """)
-        testdir.makepyfile("""
+        """
+        )
+        testdir.makepyfile(
+            """
             def test_lookup_error(unknown):
                 pass
-        """)
+        """
+        )
         result = testdir.runpytest()
-        result.stdout.fnmatch_lines([
-            "*ERROR at setup of test_lookup_error*",
-            "  def test_lookup_error(unknown):*",
-            "E       fixture 'unknown' not found",
-            ">       available fixtures:*a_fixture,*b_fixture,*c_fixture,*d_fixture*monkeypatch,*",  # sorted
-            ">       use 'py*test --fixtures *' for help on them.",
-            "*1 error*",
-        ])
+        result.stdout.fnmatch_lines(
+            [
+                "*ERROR at setup of test_lookup_error*",
+                "  def test_lookup_error(unknown):*",
+                "E       fixture 'unknown' not found",
+                ">       available fixtures:*a_fixture,*b_fixture,*c_fixture,*d_fixture*monkeypatch,*",  # sorted
+                ">       use 'py*test --fixtures *' for help on them.",
+                "*1 error*",
+            ]
+        )
         assert "INTERNAL" not in result.stdout.str()
 
     def test_fixture_excinfo_leak(self, testdir):
         # on python2 sys.excinfo would leak into fixture executions
-        testdir.makepyfile("""
+        testdir.makepyfile(
+            """
             import sys
             import traceback
             import pytest
 
             @pytest.fixture
             def leak():
                 if sys.exc_info()[0]:  # python3 bug :)
                     traceback.print_exc()
                 #fails
                 assert sys.exc_info() == (None, None, None)
 
             def test_leak(leak):
                 if sys.exc_info()[0]:  # python3 bug :)
                     traceback.print_exc()
                 assert sys.exc_info() == (None, None, None)
-        """)
+        """
+        )
         result = testdir.runpytest()
         assert result.ret == 0
 
 
 class TestRequestBasic(object):
+
     def test_request_attributes(self, testdir):
-        item = testdir.getitem("""
+        item = testdir.getitem(
+            """
             import pytest
 
             @pytest.fixture
             def something(request): pass
             def test_func(something): pass
-        """)
+        """
+        )
         req = fixtures.FixtureRequest(item)
         assert req.function == item.obj
         assert req.keywords == item.keywords
-        assert hasattr(req.module, 'test_func')
+        assert hasattr(req.module, "test_func")
         assert req.cls is None
         assert req.function.__name__ == "test_func"
         assert req.config == item.config
         assert repr(req).find(req.function.__name__) != -1
 
     def test_request_attributes_method(self, testdir):
-        item, = testdir.getitems("""
+        item, = testdir.getitems(
+            """
             import pytest
             class TestB(object):
 
                 @pytest.fixture
                 def something(self, request):
                     return 1
                 def test_func(self, something):
                     pass
-        """)
+        """
+        )
         req = item._request
         assert req.cls.__name__ == "TestB"
         assert req.instance.__class__ == req.cls
 
     def test_request_contains_funcarg_arg2fixturedefs(self, testdir):
-        modcol = testdir.getmodulecol("""
+        modcol = testdir.getmodulecol(
+            """
             import pytest
             @pytest.fixture
             def something(request):
                 pass
             class TestClass(object):
                 def test_method(self, something):
                     pass
-        """)
+        """
+        )
         item1, = testdir.genitems([modcol])
         assert item1.name == "test_method"
         arg2fixturedefs = fixtures.FixtureRequest(item1)._arg2fixturedefs
         assert len(arg2fixturedefs) == 1
-        assert arg2fixturedefs['something'][0].argname == "something"
+        assert arg2fixturedefs["something"][0].argname == "something"
+
+    def test_request_garbage(self, testdir):
+        testdir.makepyfile(
+            """
+            import sys
+            import pytest
+            from _pytest.fixtures import PseudoFixtureDef
+            import gc
+
+            @pytest.fixture(autouse=True)
+            def something(request):
+                # this method of test doesn't work on pypy
+                if hasattr(sys, "pypy_version_info"):
+                    yield
+                else:
+                    original = gc.get_debug()
+                    gc.set_debug(gc.DEBUG_SAVEALL)
+                    gc.collect()
+
+                    yield
+
+                    gc.collect()
+                    leaked_types = sum(1 for _ in gc.garbage
+                                       if isinstance(_, PseudoFixtureDef))
+
+                    gc.garbage[:] = []
+
+                    try:
+                        assert leaked_types == 0
+                    finally:
+                        gc.set_debug(original)
+
+            def test_func():
+                pass
+        """
+        )
+        reprec = testdir.inline_run()
+        reprec.assertoutcome(passed=1)
 
     def test_getfixturevalue_recursive(self, testdir):
-        testdir.makeconftest("""
+        testdir.makeconftest(
+            """
             import pytest
 
             @pytest.fixture
             def something(request):
                 return 1
-        """)
-        testdir.makepyfile("""
+        """
+        )
+        testdir.makepyfile(
+            """
             import pytest
 
             @pytest.fixture
             def something(request):
                 return request.getfixturevalue("something") + 1
             def test_func(something):
                 assert something == 2
-        """)
+        """
+        )
         reprec = testdir.inline_run()
         reprec.assertoutcome(passed=1)
 
-    @pytest.mark.parametrize(
-        'getfixmethod', ('getfixturevalue', 'getfuncargvalue'))
+    @pytest.mark.parametrize("getfixmethod", ("getfixturevalue", "getfuncargvalue"))
     def test_getfixturevalue(self, testdir, getfixmethod):
-        item = testdir.getitem("""
+        item = testdir.getitem(
+            """
             import pytest
             values = [2]
             @pytest.fixture
             def something(request): return 1
             @pytest.fixture
             def other(request):
                 return values.pop()
             def test_func(something): pass
-        """)
+        """
+        )
         import contextlib
-        if getfixmethod == 'getfuncargvalue':
+
+        if getfixmethod == "getfuncargvalue":
             warning_expectation = pytest.warns(DeprecationWarning)
         else:
             # see #1830 for a cleaner way to accomplish this
             @contextlib.contextmanager
             def expecting_no_warning():
                 yield
 
             warning_expectation = expecting_no_warning()
@@ -581,104 +727,117 @@ class TestRequestBasic(object):
             val2 = fixture_fetcher("other")  # see about caching
             assert val2 == 2
             pytest._fillfuncargs(item)
             assert item.funcargs["something"] == 1
             assert len(get_public_names(item.funcargs)) == 2
             assert "request" in item.funcargs
 
     def test_request_addfinalizer(self, testdir):
-        item = testdir.getitem("""
+        item = testdir.getitem(
+            """
             import pytest
             teardownlist = []
             @pytest.fixture
             def something(request):
                 request.addfinalizer(lambda: teardownlist.append(1))
             def test_func(something): pass
-        """)
+        """
+        )
         item.session._setupstate.prepare(item)
         pytest._fillfuncargs(item)
         # successively check finalization calls
         teardownlist = item.getparent(pytest.Module).obj.teardownlist
         ss = item.session._setupstate
         assert not teardownlist
         ss.teardown_exact(item, None)
         print(ss.stack)
         assert teardownlist == [1]
 
     def test_mark_as_fixture_with_prefix_and_decorator_fails(self, testdir):
-        testdir.makeconftest("""
+        testdir.makeconftest(
+            """
             import pytest
 
             @pytest.fixture
             def pytest_funcarg__marked_with_prefix_and_decorator():
                 pass
-        """)
+        """
+        )
         result = testdir.runpytest_subprocess()
         assert result.ret != 0
-        result.stdout.fnmatch_lines([
-            "*AssertionError: fixtures cannot have*@pytest.fixture*",
-            "*pytest_funcarg__marked_with_prefix_and_decorator*"
-        ])
+        result.stdout.fnmatch_lines(
+            [
+                "*AssertionError: fixtures cannot have*@pytest.fixture*",
+                "*pytest_funcarg__marked_with_prefix_and_decorator*",
+            ]
+        )
 
     def test_request_addfinalizer_failing_setup(self, testdir):
-        testdir.makepyfile("""
+        testdir.makepyfile(
+            """
             import pytest
             values = [1]
             @pytest.fixture
             def myfix(request):
                 request.addfinalizer(values.pop)
                 assert 0
             def test_fix(myfix):
                 pass
             def test_finalizer_ran():
                 assert not values
-        """)
+        """
+        )
         reprec = testdir.inline_run("-s")
         reprec.assertoutcome(failed=1, passed=1)
 
     def test_request_addfinalizer_failing_setup_module(self, testdir):
-        testdir.makepyfile("""
+        testdir.makepyfile(
+            """
             import pytest
             values = [1, 2]
             @pytest.fixture(scope="module")
             def myfix(request):
                 request.addfinalizer(values.pop)
                 request.addfinalizer(values.pop)
                 assert 0
             def test_fix(myfix):
                 pass
-        """)
+        """
+        )
         reprec = testdir.inline_run("-s")
         mod = reprec.getcalls("pytest_runtest_setup")[0].item.module
         assert not mod.values
 
     def test_request_addfinalizer_partial_setup_failure(self, testdir):
-        p = testdir.makepyfile("""
+        p = testdir.makepyfile(
+            """
             import pytest
             values = []
             @pytest.fixture
             def something(request):
                 request.addfinalizer(lambda: values.append(None))
             def test_func(something, missingarg):
                 pass
             def test_second():
                 assert len(values) == 1
-        """)
+        """
+        )
         result = testdir.runpytest(p)
-        result.stdout.fnmatch_lines([
-            "*1 error*"  # XXX the whole module collection fails
-        ])
+        result.stdout.fnmatch_lines(
+            ["*1 error*"]  # XXX the whole module collection fails
+        )
 
     def test_request_subrequest_addfinalizer_exceptions(self, testdir):
         """
         Ensure exceptions raised during teardown by a finalizer are suppressed
         until all finalizers are called, re-raising the first exception (#2440)
         """
-        testdir.makepyfile("""
+        testdir.makepyfile(
+            """
             import pytest
             values = []
             def _excepts(where):
                 raise Exception('Error in %s fixture' % where)
             @pytest.fixture
             def subrequest(request):
                 return request
             @pytest.fixture
@@ -689,69 +848,74 @@ class TestRequestBasic(object):
             @pytest.fixture
             def excepts(subrequest):
                 subrequest.addfinalizer(lambda: _excepts('excepts'))
                 subrequest.addfinalizer(lambda: values.append(3))
             def test_first(something, excepts):
                 pass
             def test_second():
                 assert values == [3, 2, 1]
-        """)
+        """
+        )
         result = testdir.runpytest()
-        result.stdout.fnmatch_lines([
-            '*Exception: Error in excepts fixture',
-            '* 2 passed, 1 error in *',
-        ])
+        result.stdout.fnmatch_lines(
+            ["*Exception: Error in excepts fixture", "* 2 passed, 1 error in *"]
+        )
 
     def test_request_getmodulepath(self, testdir):
         modcol = testdir.getmodulecol("def test_somefunc(): pass")
         item, = testdir.genitems([modcol])
         req = fixtures.FixtureRequest(item)
         assert req.fspath == modcol.fspath
 
     def test_request_fixturenames(self, testdir):
-        testdir.makepyfile("""
+        testdir.makepyfile(
+            """
             import pytest
             from _pytest.pytester import get_public_names
             @pytest.fixture()
             def arg1():
                 pass
             @pytest.fixture()
             def farg(arg1):
                 pass
             @pytest.fixture(autouse=True)
             def sarg(tmpdir):
                 pass
             def test_function(request, farg):
                 assert set(get_public_names(request.fixturenames)) == \
                        set(["tmpdir", "sarg", "arg1", "request", "farg",
                             "tmpdir_factory"])
-        """)
+        """
+        )
         reprec = testdir.inline_run()
         reprec.assertoutcome(passed=1)
 
     def test_funcargnames_compatattr(self, testdir):
-        testdir.makepyfile("""
+        testdir.makepyfile(
+            """
             import pytest
             def pytest_generate_tests(metafunc):
                 assert metafunc.funcargnames == metafunc.fixturenames
             @pytest.fixture
             def fn(request):
                 assert request._pyfuncitem.funcargnames == \
                        request._pyfuncitem.fixturenames
                 return request.funcargnames, request.fixturenames
 
             def test_hello(fn):
                 assert fn[0] == fn[1]
-        """)
+        """
+        )
         reprec = testdir.inline_run()
         reprec.assertoutcome(passed=1)
 
     def test_setupdecorator_and_xunit(self, testdir):
-        testdir.makepyfile("""
+        testdir.makepyfile(
+            """
             import pytest
             values = []
             @pytest.fixture(scope='module', autouse=True)
             def setup_module():
                 values.append("module")
             @pytest.fixture(autouse=True)
             def setup_function():
                 values.append("function")
@@ -766,170 +930,195 @@ class TestRequestBasic(object):
                 @pytest.fixture(autouse=True)
                 def setup_method(self):
                     values.append("method")
                 def test_method(self):
                     pass
             def test_all():
                 assert values == ["module", "function", "class",
                              "function", "method", "function"]
-        """)
+        """
+        )
         reprec = testdir.inline_run("-v")
         reprec.assertoutcome(passed=3)
 
     def test_fixtures_sub_subdir_normalize_sep(self, testdir):
         # this tests that normalization of nodeids takes place
         b = testdir.mkdir("tests").mkdir("unit")
-        b.join("conftest.py").write(_pytest._code.Source("""
+        b.join("conftest.py").write(
+            _pytest._code.Source(
+                """
             import pytest
             @pytest.fixture
             def arg1():
                 pass
-        """))
+        """
+            )
+        )
         p = b.join("test_module.py")
         p.write("def test_func(arg1): pass")
         result = testdir.runpytest(p, "--fixtures")
         assert result.ret == 0
-        result.stdout.fnmatch_lines("""
+        result.stdout.fnmatch_lines(
+            """
             *fixtures defined*conftest*
             *arg1*
-        """)
+        """
+        )
 
     def test_show_fixtures_color_yes(self, testdir):
         testdir.makepyfile("def test_this(): assert 1")
-        result = testdir.runpytest('--color=yes', '--fixtures')
-        assert '\x1b[32mtmpdir' in result.stdout.str()
+        result = testdir.runpytest("--color=yes", "--fixtures")
+        assert "\x1b[32mtmpdir" in result.stdout.str()
 
     def test_newstyle_with_request(self, testdir):
-        testdir.makepyfile("""
+        testdir.makepyfile(
+            """
             import pytest
             @pytest.fixture()
             def arg(request):
                 pass
             def test_1(arg):
                 pass
-        """)
+        """
+        )
         reprec = testdir.inline_run()
         reprec.assertoutcome(passed=1)
 
     def test_setupcontext_no_param(self, testdir):
-        testdir.makepyfile("""
+        testdir.makepyfile(
+            """
             import pytest
             @pytest.fixture(params=[1,2])
             def arg(request):
                 return request.param
 
             @pytest.fixture(autouse=True)
             def mysetup(request, arg):
                 assert not hasattr(request, "param")
             def test_1(arg):
                 assert arg in (1,2)
-        """)
+        """
+        )
         reprec = testdir.inline_run()
         reprec.assertoutcome(passed=2)
 
 
 class TestRequestMarking(object):
+
     def test_applymarker(self, testdir):
-        item1, item2 = testdir.getitems("""
+        item1, item2 = testdir.getitems(
+            """
             import pytest
 
             @pytest.fixture
             def something(request):
                 pass
             class TestClass(object):
                 def test_func1(self, something):
                     pass
                 def test_func2(self, something):
                     pass
-        """)
+        """
+        )
         req1 = fixtures.FixtureRequest(item1)
-        assert 'xfail' not in item1.keywords
+        assert "xfail" not in item1.keywords
         req1.applymarker(pytest.mark.xfail)
-        assert 'xfail' in item1.keywords
-        assert 'skipif' not in item1.keywords
+        assert "xfail" in item1.keywords
+        assert "skipif" not in item1.keywords
         req1.applymarker(pytest.mark.skipif)
-        assert 'skipif' in item1.keywords
+        assert "skipif" in item1.keywords
         pytest.raises(ValueError, "req1.applymarker(42)")
 
     def test_accesskeywords(self, testdir):
-        testdir.makepyfile("""
+        testdir.makepyfile(
+            """
             import pytest
             @pytest.fixture()
             def keywords(request):
                 return request.keywords
             @pytest.mark.XYZ
             def test_function(keywords):
                 assert keywords["XYZ"]
                 assert "abc" not in keywords
-        """)
+        """
+        )
         reprec = testdir.inline_run()
         reprec.assertoutcome(passed=1)
 
     def test_accessmarker_dynamic(self, testdir):
-        testdir.makeconftest("""
+        testdir.makeconftest(
+            """
             import pytest
             @pytest.fixture()
             def keywords(request):
                 return request.keywords
 
             @pytest.fixture(scope="class", autouse=True)
             def marking(request):
                 request.applymarker(pytest.mark.XYZ("hello"))
-        """)
-        testdir.makepyfile("""
+        """
+        )
+        testdir.makepyfile(
+            """
             import pytest
             def test_fun1(keywords):
                 assert keywords["XYZ"] is not None
                 assert "abc" not in keywords
             def test_fun2(keywords):
                 assert keywords["XYZ"] is not None
                 assert "abc" not in keywords
-        """)
+        """
+        )
         reprec = testdir.inline_run()
         reprec.assertoutcome(passed=2)
 
 
 class TestRequestCachedSetup(object):
+
     def test_request_cachedsetup_defaultmodule(self, testdir):
-        reprec = testdir.inline_runsource("""
+        reprec = testdir.inline_runsource(
+            """
             mysetup = ["hello",].pop
 
             import pytest
 
             @pytest.fixture
             def something(request):
                 return request.cached_setup(mysetup, scope="module")
 
             def test_func1(something):
                 assert something == "hello"
             class TestClass(object):
                 def test_func1a(self, something):
                     assert something == "hello"
-        """)
+        """
+        )
         reprec.assertoutcome(passed=2)
 
     def test_request_cachedsetup_class(self, testdir):
-        reprec = testdir.inline_runsource("""
+        reprec = testdir.inline_runsource(
+            """
             mysetup = ["hello", "hello2", "hello3"].pop
 
             import pytest
             @pytest.fixture
             def something(request):
                 return request.cached_setup(mysetup, scope="class")
             def test_func1(something):
                 assert something == "hello3"
             def test_func2(something):
                 assert something == "hello2"
             class TestClass(object):
                 def test_func1a(self, something):
                     assert something == "hello"
                 def test_func2b(self, something):
                     assert something == "hello"
-        """)
+        """
+        )
         reprec.assertoutcome(passed=4)
 
     def test_request_cachedsetup_extrakey(self, testdir):
         item1 = testdir.getitem("def test_func(): pass")
         req1 = fixtures.FixtureRequest(item1)
         values = ["hello", "world"]
 
         def setup():
@@ -951,281 +1140,304 @@ class TestRequestCachedSetup(object):
 
         def setup():
             values.append("setup")
 
         def teardown(val):
             values.append("teardown")
 
         req1.cached_setup(setup, teardown, scope="function")
-        assert values == ['setup']
+        assert values == ["setup"]
         # artificial call of finalizer
         setupstate = req1._pyfuncitem.session._setupstate
         setupstate._callfinalizers(item1)
         assert values == ["setup", "teardown"]
         req1.cached_setup(setup, teardown, scope="function")
         assert values == ["setup", "teardown", "setup"]
         setupstate._callfinalizers(item1)
         assert values == ["setup", "teardown", "setup", "teardown"]
 
     def test_request_cached_setup_two_args(self, testdir):
-        testdir.makepyfile("""
+        testdir.makepyfile(
+            """
             import pytest
 
             @pytest.fixture
             def arg1(request):
                 return request.cached_setup(lambda: 42)
             @pytest.fixture
             def arg2(request):
                 return request.cached_setup(lambda: 17)
             def test_two_different_setups(arg1, arg2):
                 assert arg1 != arg2
-        """)
+        """
+        )
         result = testdir.runpytest("-v")
-        result.stdout.fnmatch_lines([
-            "*1 passed*"
-        ])
+        result.stdout.fnmatch_lines(["*1 passed*"])
 
     def test_request_cached_setup_getfixturevalue(self, testdir):
-        testdir.makepyfile("""
+        testdir.makepyfile(
+            """
             import pytest
 
             @pytest.fixture
             def arg1(request):
                 arg1 = request.getfixturevalue("arg2")
                 return request.cached_setup(lambda: arg1 + 1)
             @pytest.fixture
             def arg2(request):
                 return request.cached_setup(lambda: 10)
             def test_two_funcarg(arg1):
                 assert arg1 == 11
-        """)
+        """
+        )
         result = testdir.runpytest("-v")
-        result.stdout.fnmatch_lines([
-            "*1 passed*"
-        ])
+        result.stdout.fnmatch_lines(["*1 passed*"])
 
     def test_request_cached_setup_functional(self, testdir):
-        testdir.makepyfile(test_0="""
+        testdir.makepyfile(
+            test_0="""
             import pytest
             values = []
             @pytest.fixture
             def something(request):
                 val = request.cached_setup(fsetup, fteardown)
                 return val
             def fsetup(mycache=[1]):
                 values.append(mycache.pop())
                 return values
             def fteardown(something):
                 values.remove(something[0])
                 values.append(2)
             def test_list_once(something):
                 assert something == [1]
             def test_list_twice(something):
                 assert something == [1]
-        """)
-        testdir.makepyfile(test_1="""
+        """
+        )
+        testdir.makepyfile(
+            test_1="""
             import test_0 # should have run already
             def test_check_test0_has_teardown_correct():
                 assert test_0.values == [2]
-        """)
+        """
+        )
         result = testdir.runpytest("-v")
-        result.stdout.fnmatch_lines([
-            "*3 passed*"
-        ])
+        result.stdout.fnmatch_lines(["*3 passed*"])
 
     def test_issue117_sessionscopeteardown(self, testdir):
-        testdir.makepyfile("""
+        testdir.makepyfile(
+            """
             import pytest
 
             @pytest.fixture
             def app(request):
                 app = request.cached_setup(
                     scope='session',
                     setup=lambda: 0,
                     teardown=lambda x: 3/x)
                 return app
             def test_func(app):
                 pass
-        """)
+        """
+        )
         result = testdir.runpytest()
         assert result.ret != 0
-        result.stdout.fnmatch_lines([
-            "*3/x*",
-            "*ZeroDivisionError*",
-        ])
+        result.stdout.fnmatch_lines(["*3/x*", "*ZeroDivisionError*"])
 
 
 class TestFixtureUsages(object):
+
     def test_noargfixturedec(self, testdir):
-        testdir.makepyfile("""
+        testdir.makepyfile(
+            """
             import pytest
             @pytest.fixture
             def arg1():
                 return 1
 
             def test_func(arg1):
                 assert arg1 == 1
-        """)
+        """
+        )
         reprec = testdir.inline_run()
         reprec.assertoutcome(passed=1)
 
     def test_receives_funcargs(self, testdir):
-        testdir.makepyfile("""
+        testdir.makepyfile(
+            """
             import pytest
             @pytest.fixture()
             def arg1():
                 return 1
 
             @pytest.fixture()
             def arg2(arg1):
                 return arg1 + 1
 
             def test_add(arg2):
                 assert arg2 == 2
             def test_all(arg1, arg2):
                 assert arg1 == 1
                 assert arg2 == 2
-        """)
+        """
+        )
         reprec = testdir.inline_run()
         reprec.assertoutcome(passed=2)
 
     def test_receives_funcargs_scope_mismatch(self, testdir):
-        testdir.makepyfile("""
+        testdir.makepyfile(
+            """
             import pytest
             @pytest.fixture(scope="function")
             def arg1():
                 return 1
 
             @pytest.fixture(scope="module")
             def arg2(arg1):
                 return arg1 + 1
 
             def test_add(arg2):
                 assert arg2 == 2
-        """)
+        """
+        )
         result = testdir.runpytest()
-        result.stdout.fnmatch_lines([
-            "*ScopeMismatch*involved factories*",
-            "* def arg2*",
-            "* def arg1*",
-            "*1 error*"
-        ])
+        result.stdout.fnmatch_lines(
+            [
+                "*ScopeMismatch*involved factories*",
+                "* def arg2*",
+                "* def arg1*",
+                "*1 error*",
+            ]
+        )
 
     def test_receives_funcargs_scope_mismatch_issue660(self, testdir):
-        testdir.makepyfile("""
+        testdir.makepyfile(
+            """
             import pytest
             @pytest.fixture(scope="function")
             def arg1():
                 return 1
 
             @pytest.fixture(scope="module")
             def arg2(arg1):
                 return arg1 + 1
 
             def test_add(arg1, arg2):
                 assert arg2 == 2
-        """)
+        """
+        )
         result = testdir.runpytest()
-        result.stdout.fnmatch_lines([
-            "*ScopeMismatch*involved factories*",
-            "* def arg2*",
-            "*1 error*"
-        ])
+        result.stdout.fnmatch_lines(
+            ["*ScopeMismatch*involved factories*", "* def arg2*", "*1 error*"]
+        )
 
     def test_invalid_scope(self, testdir):
-        testdir.makepyfile("""
+        testdir.makepyfile(
+            """
             import pytest
             @pytest.fixture(scope="functions")
             def badscope():
                 pass
 
             def test_nothing(badscope):
                 pass
-        """)
+        """
+        )
         result = testdir.runpytest_inprocess()
         result.stdout.fnmatch_lines(
-            ("*ValueError: fixture badscope from test_invalid_scope.py has an unsupported"
-             " scope value 'functions'")
+            (
+                "*ValueError: fixture badscope from test_invalid_scope.py has an unsupported"
+                " scope value 'functions'"
+            )
         )
 
     def test_funcarg_parametrized_and_used_twice(self, testdir):
-        testdir.makepyfile("""
+        testdir.makepyfile(
+            """
             import pytest
             values = []
             @pytest.fixture(params=[1,2])
             def arg1(request):
                 values.append(1)
                 return request.param
 
             @pytest.fixture()
             def arg2(arg1):
                 return arg1 + 1
 
             def test_add(arg1, arg2):
                 assert arg2 == arg1 + 1
                 assert len(values) == arg1
-        """)
+        """
+        )
         result = testdir.runpytest()
-        result.stdout.fnmatch_lines([
-            "*2 passed*"
-        ])
+        result.stdout.fnmatch_lines(["*2 passed*"])
 
     def test_factory_uses_unknown_funcarg_as_dependency_error(self, testdir):
-        testdir.makepyfile("""
+        testdir.makepyfile(
+            """
             import pytest
 
             @pytest.fixture()
             def fail(missing):
                 return
 
             @pytest.fixture()
             def call_fail(fail):
                 return
 
             def test_missing(call_fail):
                 pass
-            """)
+            """
+        )
         result = testdir.runpytest()
-        result.stdout.fnmatch_lines("""
+        result.stdout.fnmatch_lines(
+            """
             *pytest.fixture()*
             *def call_fail(fail)*
             *pytest.fixture()*
             *def fail*
             *fixture*'missing'*not found*
-        """)
+        """
+        )
 
     def test_factory_setup_as_classes_fails(self, testdir):
-        testdir.makepyfile("""
+        testdir.makepyfile(
+            """
             import pytest
             class arg1(object):
                 def __init__(self, request):
                     self.x = 1
             arg1 = pytest.fixture()(arg1)
 
-        """)
+        """
+        )
         reprec = testdir.inline_run()
         values = reprec.getfailedcollections()
         assert len(values) == 1
 
     def test_request_can_be_overridden(self, testdir):
-        testdir.makepyfile("""
+        testdir.makepyfile(
+            """
             import pytest
             @pytest.fixture()
             def request(request):
                 request.a = 1
                 return request
             def test_request(request):
                 assert request.a == 1
-        """)
+        """
+        )
         reprec = testdir.inline_run()
         reprec.assertoutcome(passed=1)
 
     def test_usefixtures_marker(self, testdir):
-        testdir.makepyfile("""
+        testdir.makepyfile(
+            """
             import pytest
 
             values = []
 
             @pytest.fixture(scope="class")
             def myfix(request):
                 request.cls.hello = "world"
                 values.append(1)
@@ -1233,66 +1445,78 @@ class TestFixtureUsages(object):
             class TestClass(object):
                 def test_one(self):
                     assert self.hello == "world"
                     assert len(values) == 1
                 def test_two(self):
                     assert self.hello == "world"
                     assert len(values) == 1
             pytest.mark.usefixtures("myfix")(TestClass)
-        """)
+        """
+        )
         reprec = testdir.inline_run()
         reprec.assertoutcome(passed=2)
 
     def test_usefixtures_ini(self, testdir):
-        testdir.makeini("""
+        testdir.makeini(
+            """
             [pytest]
             usefixtures = myfix
-        """)
-        testdir.makeconftest("""
+        """
+        )
+        testdir.makeconftest(
+            """
             import pytest
 
             @pytest.fixture(scope="class")
             def myfix(request):
                 request.cls.hello = "world"
 
-        """)
-        testdir.makepyfile("""
+        """
+        )
+        testdir.makepyfile(
+            """
             class TestClass(object):
                 def test_one(self):
                     assert self.hello == "world"
                 def test_two(self):
                     assert self.hello == "world"
-        """)
+        """
+        )
         reprec = testdir.inline_run()
         reprec.assertoutcome(passed=2)
 
     def test_usefixtures_seen_in_showmarkers(self, testdir):
         result = testdir.runpytest("--markers")
-        result.stdout.fnmatch_lines("""
+        result.stdout.fnmatch_lines(
+            """
             *usefixtures(fixturename1*mark tests*fixtures*
-        """)
+        """
+        )
 
     def test_request_instance_issue203(self, testdir):
-        testdir.makepyfile("""
+        testdir.makepyfile(
+            """
             import pytest
 
             class TestClass(object):
                 @pytest.fixture
                 def setup1(self, request):
                     assert self == request.instance
                     self.arg1 = 1
                 def test_hello(self, setup1):
                     assert self.arg1 == 1
-        """)
+        """
+        )
         reprec = testdir.inline_run()
         reprec.assertoutcome(passed=1)
 
     def test_fixture_parametrized_with_iterator(self, testdir):
-        testdir.makepyfile("""
+        testdir.makepyfile(
+            """
             import pytest
 
             values = []
             def f():
                 yield 1
                 yield 2
             dec = pytest.fixture(scope="module", params=f())
 
@@ -1302,132 +1526,158 @@ class TestFixtureUsages(object):
             @dec
             def arg2(request):
                 return request.param
 
             def test_1(arg):
                 values.append(arg)
             def test_2(arg2):
                 values.append(arg2*10)
-        """)
+        """
+        )
         reprec = testdir.inline_run("-v")
         reprec.assertoutcome(passed=4)
         values = reprec.getcalls("pytest_runtest_call")[0].item.module.values
         assert values == [1, 2, 10, 20]
 
 
 class TestFixtureManagerParseFactories(object):
 
     @pytest.fixture
     def testdir(self, request):
         testdir = request.getfixturevalue("testdir")
-        testdir.makeconftest("""
+        testdir.makeconftest(
+            """
             import pytest
 
             @pytest.fixture
             def hello(request):
                 return "conftest"
 
             @pytest.fixture
             def fm(request):
                 return request._fixturemanager
 
             @pytest.fixture
             def item(request):
                 return request._pyfuncitem
-        """)
+        """
+        )
         return testdir
 
     def test_parsefactories_evil_objects_issue214(self, testdir):
-        testdir.makepyfile("""
+        testdir.makepyfile(
+            """
             class A(object):
                 def __call__(self):
                     pass
                 def __getattr__(self, name):
                     raise RuntimeError()
             a = A()
             def test_hello():
                 pass
-        """)
+        """
+        )
         reprec = testdir.inline_run()
         reprec.assertoutcome(passed=1, failed=0)
 
     def test_parsefactories_conftest(self, testdir):
-        testdir.makepyfile("""
+        testdir.makepyfile(
+            """
             def test_hello(item, fm):
                 for name in ("fm", "hello", "item"):
                     faclist = fm.getfixturedefs(name, item.nodeid)
                     assert len(faclist) == 1
                     fac = faclist[0]
                     assert fac.func.__name__ == name
-        """)
+        """
+        )
         reprec = testdir.inline_run("-s")
         reprec.assertoutcome(passed=1)
 
     def test_parsefactories_conftest_and_module_and_class(self, testdir):
-        testdir.makepyfile("""
+        testdir.makepyfile(
+            """
             import pytest
 
             @pytest.fixture
             def hello(request):
                 return "module"
             class TestClass(object):
                 @pytest.fixture
                 def hello(self, request):
                     return "class"
                 def test_hello(self, item, fm):
                     faclist = fm.getfixturedefs("hello", item.nodeid)
                     print (faclist)
                     assert len(faclist) == 3
                     assert faclist[0].func(item._request) == "conftest"
                     assert faclist[1].func(item._request) == "module"
                     assert faclist[2].func(item._request) == "class"
-        """)
+        """
+        )
         reprec = testdir.inline_run("-s")
         reprec.assertoutcome(passed=1)
 
     def test_parsefactories_relative_node_ids(self, testdir):
         # example mostly taken from:
         # https://mail.python.org/pipermail/pytest-dev/2014-September/002617.html
         runner = testdir.mkdir("runner")
         package = testdir.mkdir("package")
-        package.join("conftest.py").write(dedent("""\
+        package.join("conftest.py").write(
+            dedent(
+                """\
             import pytest
             @pytest.fixture
             def one():
                 return 1
-        """))
-        package.join("test_x.py").write(dedent("""\
+        """
+            )
+        )
+        package.join("test_x.py").write(
+            dedent(
+                """\
             def test_x(one):
                 assert one == 1
-        """))
+        """
+            )
+        )
         sub = package.mkdir("sub")
         sub.join("__init__.py").ensure()
-        sub.join("conftest.py").write(dedent("""\
+        sub.join("conftest.py").write(
+            dedent(
+                """\
             import pytest
             @pytest.fixture
             def one():
                 return 2
-        """))
-        sub.join("test_y.py").write(dedent("""\
+        """
+            )
+        )
+        sub.join("test_y.py").write(
+            dedent(
+                """\
             def test_x(one):
                 assert one == 2
-        """))
+        """
+            )
+        )
         reprec = testdir.inline_run()
         reprec.assertoutcome(passed=2)
         with runner.as_cwd():
             reprec = testdir.inline_run("..")
             reprec.assertoutcome(passed=2)
 
 
 class TestAutouseDiscovery(object):
 
     @pytest.fixture
     def testdir(self, testdir):
-        testdir.makeconftest("""
+        testdir.makeconftest(
+            """
             import pytest
             @pytest.fixture(autouse=True)
             def perfunction(request, tmpdir):
                 pass
 
             @pytest.fixture()
             def arg1(tmpdir):
                 pass
@@ -1437,70 +1687,78 @@ class TestAutouseDiscovery(object):
 
             @pytest.fixture
             def fm(request):
                 return request._fixturemanager
 
             @pytest.fixture
             def item(request):
                 return request._pyfuncitem
-        """)
+        """
+        )
         return testdir
 
     def test_parsefactories_conftest(self, testdir):
-        testdir.makepyfile("""
+        testdir.makepyfile(
+            """
             from _pytest.pytester import get_public_names
             def test_check_setup(item, fm):
                 autousenames = fm._getautousenames(item.nodeid)
                 assert len(get_public_names(autousenames)) == 2
                 assert "perfunction2" in autousenames
                 assert "perfunction" in autousenames
-        """)
+        """
+        )
         reprec = testdir.inline_run("-s")
         reprec.assertoutcome(passed=1)
 
     def test_two_classes_separated_autouse(self, testdir):
-        testdir.makepyfile("""
+        testdir.makepyfile(
+            """
             import pytest
             class TestA(object):
                 values = []
                 @pytest.fixture(autouse=True)
                 def setup1(self):
                     self.values.append(1)
                 def test_setup1(self):
                     assert self.values == [1]
             class TestB(object):
                 values = []
                 @pytest.fixture(autouse=True)
                 def setup2(self):
                     self.values.append(1)
                 def test_setup2(self):
                     assert self.values == [1]
-        """)
+        """
+        )
         reprec = testdir.inline_run()
         reprec.assertoutcome(passed=2)
 
     def test_setup_at_classlevel(self, testdir):
-        testdir.makepyfile("""
+        testdir.makepyfile(
+            """
             import pytest
             class TestClass(object):
                 @pytest.fixture(autouse=True)
                 def permethod(self, request):
                     request.instance.funcname = request.function.__name__
                 def test_method1(self):
                     assert self.funcname == "test_method1"
                 def test_method2(self):
                     assert self.funcname == "test_method2"
-        """)
+        """
+        )
         reprec = testdir.inline_run("-s")
         reprec.assertoutcome(passed=2)
 
     @pytest.mark.xfail(reason="'enabled' feature not implemented")
     def test_setup_enabled_functionnode(self, testdir):
-        testdir.makepyfile("""
+        testdir.makepyfile(
+            """
             import pytest
 
             def enabled(parentnode, markers):
                 return "needsdb" in markers
 
             @pytest.fixture(params=[1,2])
             def db(request):
                 return request.param
@@ -1510,56 +1768,64 @@ class TestAutouseDiscovery(object):
                 pass
 
             def test_func1(request):
                 assert "db" not in request.fixturenames
 
             @pytest.mark.needsdb
             def test_func2(request):
                 assert "db" in request.fixturenames
-        """)
+        """
+        )
         reprec = testdir.inline_run("-s")
         reprec.assertoutcome(passed=2)
 
     def test_callables_nocode(self, testdir):
         """
-        a imported mock.call would break setup/factory discovery
+        an imported mock.call would break setup/factory discovery
         due to it being callable and __code__ not being a code object
         """
-        testdir.makepyfile("""
+        testdir.makepyfile(
+            """
            class _call(tuple):
                def __call__(self, *k, **kw):
                    pass
                def __getattr__(self, k):
                    return self
 
            call = _call()
-        """)
+        """
+        )
         reprec = testdir.inline_run("-s")
         reprec.assertoutcome(failed=0, passed=0)
 
     def test_autouse_in_conftests(self, testdir):
         a = testdir.mkdir("a")
         b = testdir.mkdir("a1")
-        conftest = testdir.makeconftest("""
+        conftest = testdir.makeconftest(
+            """
             import pytest
             @pytest.fixture(autouse=True)
             def hello():
                 xxx
-        """)
+        """
+        )
         conftest.move(a.join(conftest.basename))
         a.join("test_something.py").write("def test_func(): pass")
         b.join("test_otherthing.py").write("def test_func(): pass")
         result = testdir.runpytest()
-        result.stdout.fnmatch_lines("""
+        result.stdout.fnmatch_lines(
+            """
             *1 passed*1 error*
-        """)
+        """
+        )
 
     def test_autouse_in_module_and_two_classes(self, testdir):
-        testdir.makepyfile("""
+        testdir.makepyfile(
+            """
             import pytest
             values = []
             @pytest.fixture(autouse=True)
             def append1():
                 values.append("module")
             def test_x():
                 assert values == ["module"]
 
@@ -1567,58 +1833,71 @@ class TestAutouseDiscovery(object):
                 @pytest.fixture(autouse=True)
                 def append2(self):
                     values.append("A")
                 def test_hello(self):
                     assert values == ["module", "module", "A"], values
             class TestA2(object):
                 def test_world(self):
                     assert values == ["module", "module", "A", "module"], values
-        """)
+        """
+        )
         reprec = testdir.inline_run()
         reprec.assertoutcome(passed=3)
 
 
 class TestAutouseManagement(object):
+
     def test_autouse_conftest_mid_directory(self, testdir):
         pkgdir = testdir.mkpydir("xyz123")
-        pkgdir.join("conftest.py").write(_pytest._code.Source("""
+        pkgdir.join("conftest.py").write(
+            _pytest._code.Source(
+                """
             import pytest
             @pytest.fixture(autouse=True)
             def app():
                 import sys
                 sys._myapp = "hello"
-        """))
+        """
+            )
+        )
         t = pkgdir.ensure("tests", "test_app.py")
-        t.write(_pytest._code.Source("""
+        t.write(
+            _pytest._code.Source(
+                """
             import sys
             def test_app():
                 assert sys._myapp == "hello"
-        """))
+        """
+            )
+        )
         reprec = testdir.inline_run("-s")
         reprec.assertoutcome(passed=1)
 
     def test_autouse_honored_for_yield(self, testdir):
-        testdir.makepyfile("""
+        testdir.makepyfile(
+            """
             import pytest
             @pytest.fixture(autouse=True)
             def tst():
                 global x
                 x = 3
             def test_gen():
                 def f(hello):
                     assert x == abs(hello)
                 yield f, 3
                 yield f, -3
-        """)
+        """
+        )
         reprec = testdir.inline_run()
         reprec.assertoutcome(passed=2)
 
     def test_funcarg_and_setup(self, testdir):
-        testdir.makepyfile("""
+        testdir.makepyfile(
+            """
             import pytest
             values = []
             @pytest.fixture(scope="module")
             def arg():
                 values.append(1)
                 return 0
             @pytest.fixture(scope="module", autouse=True)
             def something(arg):
@@ -1628,22 +1907,24 @@ class TestAutouseManagement(object):
                 assert len(values) == 2
                 assert values == [1,2]
                 assert arg == 0
 
             def test_hello2(arg):
                 assert len(values) == 2
                 assert values == [1,2]
                 assert arg == 0
-        """)
+        """
+        )
         reprec = testdir.inline_run()
         reprec.assertoutcome(passed=2)
 
     def test_uses_parametrized_resource(self, testdir):
-        testdir.makepyfile("""
+        testdir.makepyfile(
+            """
             import pytest
             values = []
             @pytest.fixture(params=[1,2])
             def arg(request):
                 return request.param
 
             @pytest.fixture(autouse=True)
             def something(arg):
@@ -1652,22 +1933,24 @@ class TestAutouseManagement(object):
             def test_hello():
                 if len(values) == 1:
                     assert values == [1]
                 elif len(values) == 2:
                     assert values == [1, 2]
                 else:
                     0/0
 
-        """)
+        """
+        )
         reprec = testdir.inline_run("-s")
         reprec.assertoutcome(passed=2)
 
     def test_session_parametrized_function(self, testdir):
-        testdir.makepyfile("""
+        testdir.makepyfile(
+            """
             import pytest
 
             values = []
 
             @pytest.fixture(scope="session", params=[1,2])
             def arg(request):
                return request.param
 
@@ -1677,22 +1960,24 @@ class TestAutouseManagement(object):
                     values.append(arg)
 
             def test_some():
                 pass
 
             def test_result(arg):
                 assert len(values) == arg
                 assert values[:arg] == [1,2][:arg]
-        """)
+        """
+        )
         reprec = testdir.inline_run("-v", "-s")
         reprec.assertoutcome(passed=4)
 
     def test_class_function_parametrization_finalization(self, testdir):
-        p = testdir.makeconftest("""
+        p = testdir.makeconftest(
+            """
             import pytest
             import pprint
 
             values = []
 
             @pytest.fixture(scope="function", params=[1,2])
             def farg(request):
                 return request.param
@@ -1701,217 +1986,247 @@ class TestAutouseManagement(object):
             def carg(request):
                 return request.param
 
             @pytest.fixture(scope="function", autouse=True)
             def append(request, farg, carg):
                 def fin():
                     values.append("fin_%s%s" % (carg, farg))
                 request.addfinalizer(fin)
-        """)
-        testdir.makepyfile("""
+        """
+        )
+        testdir.makepyfile(
+            """
             import pytest
 
             class TestClass(object):
                 def test_1(self):
                     pass
             class TestClass2(object):
                 def test_2(self):
                     pass
-        """)
-        confcut = "--confcutdir={0}".format(testdir.tmpdir)
+        """
+        )
+        confcut = "--confcutdir={}".format(testdir.tmpdir)
         reprec = testdir.inline_run("-v", "-s", confcut)
         reprec.assertoutcome(passed=8)
         config = reprec.getcalls("pytest_unconfigure")[0].config
         values = config.pluginmanager._getconftestmodules(p)[0].values
         assert values == ["fin_a1", "fin_a2", "fin_b1", "fin_b2"] * 2
 
     def test_scope_ordering(self, testdir):
-        testdir.makepyfile("""
+        testdir.makepyfile(
+            """
             import pytest
             values = []
             @pytest.fixture(scope="function", autouse=True)
             def fappend2():
                 values.append(2)
             @pytest.fixture(scope="class", autouse=True)
             def classappend3():
                 values.append(3)
             @pytest.fixture(scope="module", autouse=True)
             def mappend():
                 values.append(1)
 
             class TestHallo(object):
                 def test_method(self):
                     assert values == [1,3,2]
-        """)
+        """
+        )
         reprec = testdir.inline_run()
         reprec.assertoutcome(passed=1)
 
     def test_parametrization_setup_teardown_ordering(self, testdir):
-        testdir.makepyfile("""
+        testdir.makepyfile(
+            """
             import pytest
             values = []
             def pytest_generate_tests(metafunc):
+                if metafunc.cls is None:
+                    assert metafunc.function is test_finish
                 if metafunc.cls is not None:
                     metafunc.parametrize("item", [1,2], scope="class")
             class TestClass(object):
                 @pytest.fixture(scope="class", autouse=True)
                 def addteardown(self, item, request):
                     values.append("setup-%d" % item)
                     request.addfinalizer(lambda: values.append("teardown-%d" % item))
                 def test_step1(self, item):
                     values.append("step1-%d" % item)
                 def test_step2(self, item):
                     values.append("step2-%d" % item)
 
             def test_finish():
                 print (values)
                 assert values == ["setup-1", "step1-1", "step2-1", "teardown-1",
                              "setup-2", "step1-2", "step2-2", "teardown-2",]
-        """)
-        reprec = testdir.inline_run()
+        """
+        )
+        reprec = testdir.inline_run("-s")
         reprec.assertoutcome(passed=5)
 
     def test_ordering_autouse_before_explicit(self, testdir):
-        testdir.makepyfile("""
+        testdir.makepyfile(
+            """
             import pytest
 
             values = []
             @pytest.fixture(autouse=True)
             def fix1():
                 values.append(1)
             @pytest.fixture()
             def arg1():
                 values.append(2)
             def test_hello(arg1):
                 assert values == [1,2]
-        """)
+        """
+        )
         reprec = testdir.inline_run()
         reprec.assertoutcome(passed=1)
 
     @pytest.mark.issue226
     @pytest.mark.parametrize("param1", ["", "params=[1]"], ids=["p00", "p01"])
     @pytest.mark.parametrize("param2", ["", "params=[1]"], ids=["p10", "p11"])
     def test_ordering_dependencies_torndown_first(self, testdir, param1, param2):
-        testdir.makepyfile("""
+        testdir.makepyfile(
+            """
             import pytest
             values = []
             @pytest.fixture(%(param1)s)
             def arg1(request):
                 request.addfinalizer(lambda: values.append("fin1"))
                 values.append("new1")
             @pytest.fixture(%(param2)s)
             def arg2(request, arg1):
                 request.addfinalizer(lambda: values.append("fin2"))
                 values.append("new2")
 
             def test_arg(arg2):
                 pass
             def test_check():
                 assert values == ["new1", "new2", "fin2", "fin1"]
-        """ % locals())
+        """
+            % locals()
+        )
         reprec = testdir.inline_run("-s")
         reprec.assertoutcome(passed=2)
 
 
 class TestFixtureMarker(object):
+
     def test_parametrize(self, testdir):
-        testdir.makepyfile("""
+        testdir.makepyfile(
+            """
             import pytest
             @pytest.fixture(params=["a", "b", "c"])
             def arg(request):
                 return request.param
             values = []
             def test_param(arg):
                 values.append(arg)
             def test_result():
                 assert values == list("abc")
-        """)
+        """
+        )
         reprec = testdir.inline_run()
         reprec.assertoutcome(passed=4)
 
     def test_multiple_parametrization_issue_736(self, testdir):
-        testdir.makepyfile("""
+        testdir.makepyfile(
+            """
             import pytest
 
             @pytest.fixture(params=[1,2,3])
             def foo(request):
                 return request.param
 
             @pytest.mark.parametrize('foobar', [4,5,6])
             def test_issue(foo, foobar):
                 assert foo in [1,2,3]
                 assert foobar in [4,5,6]
-        """)
+        """
+        )
         reprec = testdir.inline_run()
         reprec.assertoutcome(passed=9)
 
-    @pytest.mark.parametrize('param_args', ["'fixt, val'", "'fixt,val'", "['fixt', 'val']", "('fixt', 'val')"])
+    @pytest.mark.parametrize(
+        "param_args",
+        ["'fixt, val'", "'fixt,val'", "['fixt', 'val']", "('fixt', 'val')"],
+    )
     def test_override_parametrized_fixture_issue_979(self, testdir, param_args):
         """Make sure a parametrized argument can override a parametrized fixture.
 
         This was a regression introduced in the fix for #736.
         """
-        testdir.makepyfile("""
+        testdir.makepyfile(
+            """
             import pytest
 
             @pytest.fixture(params=[1, 2])
             def fixt(request):
                 return request.param
 
             @pytest.mark.parametrize(%s, [(3, 'x'), (4, 'x')])
             def test_foo(fixt, val):
                 pass
-        """ % param_args)
+        """
+            % param_args
+        )
         reprec = testdir.inline_run()
         reprec.assertoutcome(passed=2)
 
     def test_scope_session(self, testdir):
-        testdir.makepyfile("""
+        testdir.makepyfile(
+            """
             import pytest
             values = []
             @pytest.fixture(scope="module")
             def arg():
                 values.append(1)
                 return 1
 
             def test_1(arg):
                 assert arg == 1
             def test_2(arg):
                 assert arg == 1
                 assert len(values) == 1
             class TestClass(object):
                 def test3(self, arg):
                     assert arg == 1
                     assert len(values) == 1
-        """)
+        """
+        )
         reprec = testdir.inline_run()
         reprec.assertoutcome(passed=3)
 
     def test_scope_session_exc(self, testdir):
-        testdir.makepyfile("""
+        testdir.makepyfile(
+            """
             import pytest
             values = []
             @pytest.fixture(scope="session")
             def fix():
                 values.append(1)
                 pytest.skip('skipping')
 
             def test_1(fix):
                 pass
             def test_2(fix):
                 pass
             def test_last():
                 assert values == [1]
-        """)
+        """
+        )
         reprec = testdir.inline_run()
         reprec.assertoutcome(skipped=2, passed=1)
 
     def test_scope_session_exc_two_fix(self, testdir):
-        testdir.makepyfile("""
+        testdir.makepyfile(
+            """
             import pytest
             values = []
             m = []
             @pytest.fixture(scope="session")
             def a():
                 values.append(1)
                 pytest.skip('skipping')
             @pytest.fixture(scope="session")
@@ -1920,17 +2235,18 @@ class TestFixtureMarker(object):
 
             def test_1(b):
                 pass
             def test_2(b):
                 pass
             def test_last():
                 assert values == [1]
                 assert m == []
-        """)
+        """
+        )
         reprec = testdir.inline_run()
         reprec.assertoutcome(skipped=2, passed=1)
 
     def test_scope_exc(self, testdir):
         testdir.makepyfile(
             test_foo="""
                 def test_foo(fix):
                     pass
@@ -1948,233 +2264,323 @@ class TestFixtureMarker(object):
                     pytest.skip()
                 @pytest.fixture
                 def req_list():
                     return reqs
             """,
             test_real="""
                 def test_last(req_list):
                     assert req_list == [1]
-            """
+            """,
         )
         reprec = testdir.inline_run()
         reprec.assertoutcome(skipped=2, passed=1)
 
     def test_scope_module_uses_session(self, testdir):
-        testdir.makepyfile("""
+        testdir.makepyfile(
+            """
             import pytest
             values = []
             @pytest.fixture(scope="module")
             def arg():
                 values.append(1)
                 return 1
 
             def test_1(arg):
                 assert arg == 1
             def test_2(arg):
                 assert arg == 1
                 assert len(values) == 1
             class TestClass(object):
                 def test3(self, arg):
                     assert arg == 1
                     assert len(values) == 1
-        """)
+        """
+        )
         reprec = testdir.inline_run()
         reprec.assertoutcome(passed=3)
 
     def test_scope_module_and_finalizer(self, testdir):
-        testdir.makeconftest("""
+        testdir.makeconftest(
+            """
             import pytest
             finalized_list = []
             created_list = []
             @pytest.fixture(scope="module")
             def arg(request):
                 created_list.append(1)
                 assert request.scope == "module"
                 request.addfinalizer(lambda: finalized_list.append(1))
             @pytest.fixture
             def created(request):
                 return len(created_list)
             @pytest.fixture
             def finalized(request):
                 return len(finalized_list)
-        """)
+        """
+        )
         testdir.makepyfile(
             test_mod1="""
                 def test_1(arg, created, finalized):
                     assert created == 1
                     assert finalized == 0
                 def test_2(arg, created, finalized):
                     assert created == 1
                     assert finalized == 0""",
             test_mod2="""
                 def test_3(arg, created, finalized):
                     assert created == 2
                     assert finalized == 1""",
             test_mode3="""
                 def test_4(arg, created, finalized):
                     assert created == 3
                     assert finalized == 2
-            """)
+            """,
+        )
         reprec = testdir.inline_run()
         reprec.assertoutcome(passed=4)
 
-    @pytest.mark.parametrize("method", [
-        'request.getfixturevalue("arg")',
-        'request.cached_setup(lambda: None, scope="function")',
-    ], ids=["getfixturevalue", "cached_setup"])
+    @pytest.mark.parametrize(
+        "method",
+        [
+            'request.getfixturevalue("arg")',
+            'request.cached_setup(lambda: None, scope="function")',
+        ],
+        ids=["getfixturevalue", "cached_setup"],
+    )
     def test_scope_mismatch_various(self, testdir, method):
-        testdir.makeconftest("""
+        testdir.makeconftest(
+            """
             import pytest
             finalized = []
             created = []
             @pytest.fixture(scope="function")
             def arg(request):
                 pass
-        """)
+        """
+        )
         testdir.makepyfile(
             test_mod1="""
                 import pytest
                 @pytest.fixture(scope="session")
                 def arg(request):
                     %s
                 def test_1(arg):
                     pass
-            """ % method)
+            """
+            % method
+        )
         result = testdir.runpytest()
         assert result.ret != 0
-        result.stdout.fnmatch_lines([
-            "*ScopeMismatch*You tried*function*session*request*",
-        ])
+        result.stdout.fnmatch_lines(
+            ["*ScopeMismatch*You tried*function*session*request*"]
+        )
 
     def test_register_only_with_mark(self, testdir):
-        testdir.makeconftest("""
+        testdir.makeconftest(
+            """
             import pytest
             @pytest.fixture()
             def arg():
                 return 1
-        """)
+        """
+        )
         testdir.makepyfile(
             test_mod1="""
                 import pytest
                 @pytest.fixture()
                 def arg(arg):
                     return arg + 1
                 def test_1(arg):
                     assert arg == 2
-            """)
+            """
+        )
         reprec = testdir.inline_run()
         reprec.assertoutcome(passed=1)
 
     def test_parametrize_and_scope(self, testdir):
-        testdir.makepyfile("""
+        testdir.makepyfile(
+            """
             import pytest
             @pytest.fixture(scope="module", params=["a", "b", "c"])
             def arg(request):
                 return request.param
             values = []
             def test_param(arg):
                 values.append(arg)
-        """)
+        """
+        )
         reprec = testdir.inline_run("-v")
         reprec.assertoutcome(passed=3)
         values = reprec.getcalls("pytest_runtest_call")[0].item.module.values
         assert len(values) == 3
         assert "a" in values
         assert "b" in values
         assert "c" in values
 
     def test_scope_mismatch(self, testdir):
-        testdir.makeconftest("""
+        testdir.makeconftest(
+            """
             import pytest
             @pytest.fixture(scope="function")
             def arg(request):
                 pass
-        """)
-        testdir.makepyfile("""
+        """
+        )
+        testdir.makepyfile(
+            """
             import pytest
             @pytest.fixture(scope="session")
             def arg(arg):
                 pass
             def test_mismatch(arg):
                 pass
-        """)
+        """
+        )
         result = testdir.runpytest()
-        result.stdout.fnmatch_lines([
-            "*ScopeMismatch*",
-            "*1 error*",
-        ])
+        result.stdout.fnmatch_lines(["*ScopeMismatch*", "*1 error*"])
 
     def test_parametrize_separated_order(self, testdir):
-        testdir.makepyfile("""
+        testdir.makepyfile(
+            """
             import pytest
 
             @pytest.fixture(scope="module", params=[1, 2])
             def arg(request):
                 return request.param
 
             values = []
             def test_1(arg):
                 values.append(arg)
             def test_2(arg):
                 values.append(arg)
-        """)
+        """
+        )
         reprec = testdir.inline_run("-v")
         reprec.assertoutcome(passed=4)
         values = reprec.getcalls("pytest_runtest_call")[0].item.module.values
         assert values == [1, 1, 2, 2]
 
     def test_module_parametrized_ordering(self, testdir):
-        testdir.makeconftest("""
+        testdir.makeini(
+            """
+            [pytest]
+            console_output_style=classic
+        """
+        )
+        testdir.makeconftest(
+            """
             import pytest
 
             @pytest.fixture(scope="session", params="s1 s2".split())
             def sarg():
                 pass
             @pytest.fixture(scope="module", params="m1 m2".split())
             def marg():
                 pass
-        """)
-        testdir.makepyfile(test_mod1="""
+        """
+        )
+        testdir.makepyfile(
+            test_mod1="""
             def test_func(sarg):
                 pass
             def test_func1(marg):
                 pass
-        """, test_mod2="""
+        """,
+            test_mod2="""
             def test_func2(sarg):
                 pass
             def test_func3(sarg, marg):
                 pass
             def test_func3b(sarg, marg):
                 pass
             def test_func4(marg):
                 pass
-        """)
+        """,
+        )
         result = testdir.runpytest("-v")
-        result.stdout.fnmatch_lines("""
+        result.stdout.fnmatch_lines(
+            """
             test_mod1.py::test_func[s1] PASSED
             test_mod2.py::test_func2[s1] PASSED
             test_mod2.py::test_func3[s1-m1] PASSED
             test_mod2.py::test_func3b[s1-m1] PASSED
             test_mod2.py::test_func3[s1-m2] PASSED
             test_mod2.py::test_func3b[s1-m2] PASSED
             test_mod1.py::test_func[s2] PASSED
             test_mod2.py::test_func2[s2] PASSED
             test_mod2.py::test_func3[s2-m1] PASSED
             test_mod2.py::test_func3b[s2-m1] PASSED
             test_mod2.py::test_func4[m1] PASSED
             test_mod2.py::test_func3[s2-m2] PASSED
             test_mod2.py::test_func3b[s2-m2] PASSED
             test_mod2.py::test_func4[m2] PASSED
             test_mod1.py::test_func1[m1] PASSED
             test_mod1.py::test_func1[m2] PASSED
-        """)
+        """
+        )
+
+    def test_dynamic_parametrized_ordering(self, testdir):
+        testdir.makeini(
+            """
+            [pytest]
+            console_output_style=classic
+        """
+        )
+        testdir.makeconftest(
+            """
+            import pytest
+
+            def pytest_configure(config):
+                class DynamicFixturePlugin(object):
+                    @pytest.fixture(scope='session', params=['flavor1', 'flavor2'])
+                    def flavor(self, request):
+                        return request.param
+                config.pluginmanager.register(DynamicFixturePlugin(), 'flavor-fixture')
+
+            @pytest.fixture(scope='session', params=['vxlan', 'vlan'])
+            def encap(request):
+                return request.param
+
+            @pytest.fixture(scope='session', autouse='True')
+            def reprovision(request, flavor, encap):
+                pass
+        """
+        )
+        testdir.makepyfile(
+            """
+            def test(reprovision):
+                pass
+            def test2(reprovision):
+                pass
+        """
+        )
+        result = testdir.runpytest("-v")
+        result.stdout.fnmatch_lines(
+            """
+            test_dynamic_parametrized_ordering.py::test[flavor1-vxlan] PASSED
+            test_dynamic_parametrized_ordering.py::test2[flavor1-vxlan] PASSED
+            test_dynamic_parametrized_ordering.py::test[flavor2-vxlan] PASSED
+            test_dynamic_parametrized_ordering.py::test2[flavor2-vxlan] PASSED
+            test_dynamic_parametrized_ordering.py::test[flavor2-vlan] PASSED
+            test_dynamic_parametrized_ordering.py::test2[flavor2-vlan] PASSED
+            test_dynamic_parametrized_ordering.py::test[flavor1-vlan] PASSED
+            test_dynamic_parametrized_ordering.py::test2[flavor1-vlan] PASSED
+        """
+        )
 
     def test_class_ordering(self, testdir):
-        testdir.makeconftest("""
+        testdir.makeini(
+            """
+            [pytest]
+            console_output_style=classic
+        """
+        )
+        testdir.makeconftest(
+            """
             import pytest
 
             values = []
 
             @pytest.fixture(scope="function", params=[1,2])
             def farg(request):
                 return request.param
 
@@ -2182,47 +2588,53 @@ class TestFixtureMarker(object):
             def carg(request):
                 return request.param
 
             @pytest.fixture(scope="function", autouse=True)
             def append(request, farg, carg):
                 def fin():
                     values.append("fin_%s%s" % (carg, farg))
                 request.addfinalizer(fin)
-        """)
-        testdir.makepyfile("""
+        """
+        )
+        testdir.makepyfile(
+            """
             import pytest
 
             class TestClass2(object):
                 def test_1(self):
                     pass
                 def test_2(self):
                     pass
             class TestClass(object):
                 def test_3(self):
                     pass
-        """)
+        """
+        )
         result = testdir.runpytest("-vs")
-        result.stdout.fnmatch_lines("""
-            test_class_ordering.py::TestClass2::test_1[1-a] PASSED
-            test_class_ordering.py::TestClass2::test_1[2-a] PASSED
-            test_class_ordering.py::TestClass2::test_2[1-a] PASSED
-            test_class_ordering.py::TestClass2::test_2[2-a] PASSED
-            test_class_ordering.py::TestClass2::test_1[1-b] PASSED
-            test_class_ordering.py::TestClass2::test_1[2-b] PASSED
-            test_class_ordering.py::TestClass2::test_2[1-b] PASSED
-            test_class_ordering.py::TestClass2::test_2[2-b] PASSED
-            test_class_ordering.py::TestClass::test_3[1-a] PASSED
-            test_class_ordering.py::TestClass::test_3[2-a] PASSED
-            test_class_ordering.py::TestClass::test_3[1-b] PASSED
-            test_class_ordering.py::TestClass::test_3[2-b] PASSED
-        """)
+        result.stdout.re_match_lines(
+            r"""
+            test_class_ordering.py::TestClass2::test_1\[a-1\] PASSED
+            test_class_ordering.py::TestClass2::test_1\[a-2\] PASSED
+            test_class_ordering.py::TestClass2::test_2\[a-1\] PASSED
+            test_class_ordering.py::TestClass2::test_2\[a-2\] PASSED
+            test_class_ordering.py::TestClass2::test_1\[b-1\] PASSED
+            test_class_ordering.py::TestClass2::test_1\[b-2\] PASSED
+            test_class_ordering.py::TestClass2::test_2\[b-1\] PASSED
+            test_class_ordering.py::TestClass2::test_2\[b-2\] PASSED
+            test_class_ordering.py::TestClass::test_3\[a-1\] PASSED
+            test_class_ordering.py::TestClass::test_3\[a-2\] PASSED
+            test_class_ordering.py::TestClass::test_3\[b-1\] PASSED
+            test_class_ordering.py::TestClass::test_3\[b-2\] PASSED
+        """
+        )
 
     def test_parametrize_separated_order_higher_scope_first(self, testdir):
-        testdir.makepyfile("""
+        testdir.makepyfile(
+            """
             import pytest
 
             @pytest.fixture(scope="function", params=[1, 2])
             def arg(request):
                 param = request.param
                 request.addfinalizer(lambda: values.append("fin:%s" % param))
                 values.append("create:%s" % param)
                 return request.param
@@ -2238,35 +2650,67 @@ class TestFixtureMarker(object):
             def test_1(arg):
                 values.append("test1")
             def test_2(modarg):
                 values.append("test2")
             def test_3(arg, modarg):
                 values.append("test3")
             def test_4(modarg, arg):
                 values.append("test4")
-        """)
+        """
+        )
         reprec = testdir.inline_run("-v")
         reprec.assertoutcome(passed=12)
         values = reprec.getcalls("pytest_runtest_call")[0].item.module.values
         expected = [
-            'create:1', 'test1', 'fin:1', 'create:2', 'test1',
-            'fin:2', 'create:mod1', 'test2', 'create:1', 'test3',
-            'fin:1', 'create:2', 'test3', 'fin:2', 'create:1',
-            'test4', 'fin:1', 'create:2', 'test4', 'fin:2',
-            'fin:mod1', 'create:mod2', 'test2', 'create:1', 'test3',
-            'fin:1', 'create:2', 'test3', 'fin:2', 'create:1',
-            'test4', 'fin:1', 'create:2', 'test4', 'fin:2',
-            'fin:mod2']
+            "create:1",
+            "test1",
+            "fin:1",
+            "create:2",
+            "test1",
+            "fin:2",
+            "create:mod1",
+            "test2",
+            "create:1",
+            "test3",
+            "fin:1",
+            "create:2",
+            "test3",
+            "fin:2",
+            "create:1",
+            "test4",
+            "fin:1",
+            "create:2",
+            "test4",
+            "fin:2",
+            "fin:mod1",
+            "create:mod2",
+            "test2",
+            "create:1",
+            "test3",
+            "fin:1",
+            "create:2",
+            "test3",
+            "fin:2",
+            "create:1",
+            "test4",
+            "fin:1",
+            "create:2",
+            "test4",
+            "fin:2",
+            "fin:mod2",
+        ]
         import pprint
+
         pprint.pprint(list(zip(values, expected)))
         assert values == expected
 
     def test_parametrized_fixture_teardown_order(self, testdir):
-        testdir.makepyfile("""
+        testdir.makepyfile(
+            """
             import pytest
             @pytest.fixture(params=[1,2], scope="class")
             def param1(request):
                 return request.param
 
             values = []
 
             class TestClass(object):
@@ -2285,53 +2729,63 @@ class TestFixtureMarker(object):
                 @classmethod
                 def teardown2(self):
                     assert values.pop() == 2
                 def test(self):
                     pass
 
             def test_finish():
                 assert not values
-        """)
+        """
+        )
         result = testdir.runpytest("-v")
-        result.stdout.fnmatch_lines("""
+        result.stdout.fnmatch_lines(
+            """
             *3 passed*
-        """)
+        """
+        )
         assert "error" not in result.stdout.str()
 
     def test_fixture_finalizer(self, testdir):
-        testdir.makeconftest("""
+        testdir.makeconftest(
+            """
             import pytest
             import sys
 
             @pytest.fixture
             def browser(request):
 
                 def finalize():
                     sys.stdout.write('Finalized')
                 request.addfinalizer(finalize)
                 return {}
-        """)
+        """
+        )
         b = testdir.mkdir("subdir")
-        b.join("test_overridden_fixture_finalizer.py").write(dedent("""
+        b.join("test_overridden_fixture_finalizer.py").write(
+            dedent(
+                """
             import pytest
             @pytest.fixture
             def browser(browser):
                 browser['visited'] = True
                 return browser
 
             def test_browser(browser):
                 assert browser['visited'] is True
-        """))
+        """
+            )
+        )
         reprec = testdir.runpytest("-s")
-        for test in ['test_browser']:
-            reprec.stdout.fnmatch_lines('*Finalized*')
+        for test in ["test_browser"]:
+            reprec.stdout.fnmatch_lines("*Finalized*")
 
     def test_class_scope_with_normal_tests(self, testdir):
-        testpath = testdir.makepyfile("""
+        testpath = testdir.makepyfile(
+            """
             import pytest
 
             class Box(object):
                 value = 0
 
             @pytest.fixture(scope='class')
             def a(request):
                 Box.value += 1
@@ -2341,87 +2795,96 @@ class TestFixtureMarker(object):
                 assert a == 1
 
             class Test1(object):
                 def test_b(self, a):
                     assert a == 2
 
             class Test2(object):
                 def test_c(self, a):
-                    assert a == 3""")
+                    assert a == 3"""
+        )
         reprec = testdir.inline_run(testpath)
-        for test in ['test_a', 'test_b', 'test_c']:
+        for test in ["test_a", "test_b", "test_c"]:
             assert reprec.matchreport(test).passed
 
     def test_request_is_clean(self, testdir):
-        testdir.makepyfile("""
+        testdir.makepyfile(
+            """
             import pytest
             values = []
             @pytest.fixture(params=[1, 2])
             def fix(request):
                 request.addfinalizer(lambda: values.append(request.param))
             def test_fix(fix):
                 pass
-        """)
+        """
+        )
         reprec = testdir.inline_run("-s")
         values = reprec.getcalls("pytest_runtest_call")[0].item.module.values
         assert values == [1, 2]
 
     def test_parametrize_separated_lifecycle(self, testdir):
-        testdir.makepyfile("""
+        testdir.makepyfile(
+            """
             import pytest
 
             values = []
             @pytest.fixture(scope="module", params=[1, 2])
             def arg(request):
                 x = request.param
                 request.addfinalizer(lambda: values.append("fin%s" % x))
                 return request.param
             def test_1(arg):
                 values.append(arg)
             def test_2(arg):
                 values.append(arg)
-        """)
+        """
+        )
         reprec = testdir.inline_run("-vs")
         reprec.assertoutcome(passed=4)
         values = reprec.getcalls("pytest_runtest_call")[0].item.module.values
         import pprint
+
         pprint.pprint(values)
         # assert len(values) == 6
         assert values[0] == values[1] == 1
         assert values[2] == "fin1"
         assert values[3] == values[4] == 2
         assert values[5] == "fin2"
 
     def test_parametrize_function_scoped_finalizers_called(self, testdir):
-        testdir.makepyfile("""
+        testdir.makepyfile(
+            """
             import pytest
 
             @pytest.fixture(scope="function", params=[1, 2])
             def arg(request):
                 x = request.param
                 request.addfinalizer(lambda: values.append("fin%s" % x))
                 return request.param
 
             values = []
             def test_1(arg):
                 values.append(arg)
             def test_2(arg):
                 values.append(arg)
             def test_3():
                 assert len(values) == 8
                 assert values == [1, "fin1", 2, "fin2", 1, "fin1", 2, "fin2"]
-        """)
+        """
+        )
         reprec = testdir.inline_run("-v")
         reprec.assertoutcome(passed=5)
 
     @pytest.mark.issue246
     @pytest.mark.parametrize("scope", ["session", "function", "module"])
     def test_finalizer_order_on_parametrization(self, scope, testdir):
-        testdir.makepyfile("""
+        testdir.makepyfile(
+            """
             import pytest
             values = []
 
             @pytest.fixture(scope=%(scope)r, params=["1"])
             def fix1(request):
                 return request.param
 
             @pytest.fixture(scope=%(scope)r)
@@ -2438,23 +2901,26 @@ class TestFixtureMarker(object):
                 request.addfinalizer(cleanup_base)
 
             def test_begin():
                 pass
             def test_baz(base, fix2):
                 pass
             def test_other():
                 pass
-        """ % {"scope": scope})
+        """
+            % {"scope": scope}
+        )
         reprec = testdir.inline_run("-lvs")
         reprec.assertoutcome(passed=3)
 
     @pytest.mark.issue396
     def test_class_scope_parametrization_ordering(self, testdir):
-        testdir.makepyfile("""
+        testdir.makepyfile(
+            """
             import pytest
             values = []
             @pytest.fixture(params=["John", "Doe"], scope="class")
             def human(request):
                 request.addfinalizer(lambda: values.append("fin %s" % request.param))
                 return request.param
 
             class TestGreetings(object):
@@ -2462,26 +2928,40 @@ class TestFixtureMarker(object):
                     values.append("test_hello")
 
             class TestMetrics(object):
                 def test_name(self, human):
                     values.append("test_name")
 
                 def test_population(self, human):
                     values.append("test_population")
-        """)
+        """
+        )
         reprec = testdir.inline_run()
         reprec.assertoutcome(passed=6)
         values = reprec.getcalls("pytest_runtest_call")[0].item.module.values
-        assert values == ["test_hello", "fin John", "test_hello", "fin Doe",
-                          "test_name", "test_population", "fin John",
-                          "test_name", "test_population", "fin Doe"]
+        assert (
+            values
+            == [
+                "test_hello",
+                "fin John",
+                "test_hello",
+                "fin Doe",
+                "test_name",
+                "test_population",
+                "fin John",
+                "test_name",
+                "test_population",
+                "fin Doe",
+            ]
+        )
 
     def test_parametrize_setup_function(self, testdir):
-        testdir.makepyfile("""
+        testdir.makepyfile(
+            """
             import pytest
 
             @pytest.fixture(scope="module", params=[1, 2])
             def arg(request):
                 return request.param
 
             @pytest.fixture(scope="module", autouse=True)
             def mysetup(request, arg):
@@ -2497,70 +2977,74 @@ class TestFixtureMarker(object):
                 import pprint
                 pprint.pprint(values)
                 if arg == 1:
                     assert values == ["setup1", 1, 1, ]
                 elif arg == 2:
                     assert values == ["setup1", 1, 1, "fin1",
                                  "setup2", 2, 2, ]
 
-        """)
+        """
+        )
         reprec = testdir.inline_run("-v")
         reprec.assertoutcome(passed=6)
 
     def test_fixture_marked_function_not_collected_as_test(self, testdir):
-        testdir.makepyfile("""
+        testdir.makepyfile(
+            """
             import pytest
             @pytest.fixture
             def test_app():
                 return 1
 
             def test_something(test_app):
                 assert test_app == 1
-        """)
+        """
+        )
         reprec = testdir.inline_run()
         reprec.assertoutcome(passed=1)
 
     def test_params_and_ids(self, testdir):
-        testdir.makepyfile("""
+        testdir.makepyfile(
+            """
             import pytest
 
             @pytest.fixture(params=[object(), object()],
                             ids=['alpha', 'beta'])
             def fix(request):
                 return request.param
 
             def test_foo(fix):
                 assert 1
-        """)
-        res = testdir.runpytest('-v')
-        res.stdout.fnmatch_lines([
-            '*test_foo*alpha*',
-            '*test_foo*beta*'])
+        """
+        )
+        res = testdir.runpytest("-v")
+        res.stdout.fnmatch_lines(["*test_foo*alpha*", "*test_foo*beta*"])
 
     def test_params_and_ids_yieldfixture(self, testdir):
-        testdir.makepyfile("""
+        testdir.makepyfile(
+            """
             import pytest
 
             @pytest.yield_fixture(params=[object(), object()],
                                   ids=['alpha', 'beta'])
             def fix(request):
                  yield request.param
 
             def test_foo(fix):
                 assert 1
-        """)
-        res = testdir.runpytest('-v')
-        res.stdout.fnmatch_lines([
-            '*test_foo*alpha*',
-            '*test_foo*beta*'])
+        """
+        )
+        res = testdir.runpytest("-v")
+        res.stdout.fnmatch_lines(["*test_foo*alpha*", "*test_foo*beta*"])
 
     @pytest.mark.issue920
     def test_deterministic_fixture_collection(self, testdir, monkeypatch):
-        testdir.makepyfile("""
+        testdir.makepyfile(
+            """
             import pytest
 
             @pytest.fixture(scope="module",
                             params=["A",
                                     "B",
                                     "C"])
             def A(request):
                 return request.param
@@ -2571,557 +3055,957 @@ class TestFixtureMarker(object):
                 return request.param
 
             def test_foo(B):
                 # Something funky is going on here.
                 # Despite specified seeds, on what is collected,
                 # sometimes we get unexpected passes. hashing B seems
                 # to help?
                 assert hash(B) or True
-            """)
+            """
+        )
         monkeypatch.setenv("PYTHONHASHSEED", "1")
         out1 = testdir.runpytest_subprocess("-v")
         monkeypatch.setenv("PYTHONHASHSEED", "2")
         out2 = testdir.runpytest_subprocess("-v")
-        out1 = [line for line in out1.outlines if line.startswith("test_deterministic_fixture_collection.py::test_foo")]
-        out2 = [line for line in out2.outlines if line.startswith("test_deterministic_fixture_collection.py::test_foo")]
+        out1 = [
+            line
+            for line in out1.outlines
+            if line.startswith("test_deterministic_fixture_collection.py::test_foo")
+        ]
+        out2 = [
+            line
+            for line in out2.outlines
+            if line.startswith("test_deterministic_fixture_collection.py::test_foo")
+        ]
         assert len(out1) == 12
         assert out1 == out2
 
 
 class TestRequestScopeAccess(object):
-    pytestmark = pytest.mark.parametrize(("scope", "ok", "error"), [
-        ["session", "", "fspath class function module"],
-        ["module", "module fspath", "cls function"],
-        ["class", "module fspath cls", "function"],
-        ["function", "module fspath cls function", ""]
-    ])
+    pytestmark = pytest.mark.parametrize(
+        ("scope", "ok", "error"),
+        [
+            ["session", "", "fspath class function module"],
+            ["module", "module fspath", "cls function"],
+            ["class", "module fspath cls", "function"],
+            ["function", "module fspath cls function", ""],
+        ],
+    )
 
     def test_setup(self, testdir, scope, ok, error):
-        testdir.makepyfile("""
+        testdir.makepyfile(
+            """
             import pytest
             @pytest.fixture(scope=%r, autouse=True)
             def myscoped(request):
                 for x in %r:
                     assert hasattr(request, x)
                 for x in %r:
                     pytest.raises(AttributeError, lambda:
                         getattr(request, x))
                 assert request.session
                 assert request.config
             def test_func():
                 pass
-        """ % (scope, ok.split(), error.split()))
+        """
+            % (scope, ok.split(), error.split())
+        )
         reprec = testdir.inline_run("-l")
         reprec.assertoutcome(passed=1)
 
     def test_funcarg(self, testdir, scope, ok, error):
-        testdir.makepyfile("""
+        testdir.makepyfile(
+            """
             import pytest
             @pytest.fixture(scope=%r)
             def arg(request):
                 for x in %r:
                     assert hasattr(request, x)
                 for x in %r:
                     pytest.raises(AttributeError, lambda:
                         getattr(request, x))
                 assert request.session
                 assert request.config
             def test_func(arg):
                 pass
-        """ % (scope, ok.split(), error.split()))
+        """
+            % (scope, ok.split(), error.split())
+        )
         reprec = testdir.inline_run()
         reprec.assertoutcome(passed=1)
 
 
 class TestErrors(object):
+
     def test_subfactory_missing_funcarg(self, testdir):
-        testdir.makepyfile("""
+        testdir.makepyfile(
+            """
             import pytest
             @pytest.fixture()
             def gen(qwe123):
                 return 1
             def test_something(gen):
                 pass
-        """)
+        """
+        )
         result = testdir.runpytest()
         assert result.ret != 0
-        result.stdout.fnmatch_lines([
-            "*def gen(qwe123):*",
-            "*fixture*qwe123*not found*",
-            "*1 error*",
-        ])
+        result.stdout.fnmatch_lines(
+            ["*def gen(qwe123):*", "*fixture*qwe123*not found*", "*1 error*"]
+        )
 
     def test_issue498_fixture_finalizer_failing(self, testdir):
-        testdir.makepyfile("""
+        testdir.makepyfile(
+            """
             import pytest
             @pytest.fixture
             def fix1(request):
                 def f():
                     raise KeyError
                 request.addfinalizer(f)
                 return object()
 
             values = []
             def test_1(fix1):
                 values.append(fix1)
             def test_2(fix1):
                 values.append(fix1)
             def test_3():
                 assert values[0] != values[1]
-        """)
+        """
+        )
         result = testdir.runpytest()
-        result.stdout.fnmatch_lines("""
+        result.stdout.fnmatch_lines(
+            """
             *ERROR*teardown*test_1*
             *KeyError*
             *ERROR*teardown*test_2*
             *KeyError*
             *3 pass*2 error*
-        """)
+        """
+        )
 
     def test_setupfunc_missing_funcarg(self, testdir):
-        testdir.makepyfile("""
+        testdir.makepyfile(
+            """
             import pytest
             @pytest.fixture(autouse=True)
             def gen(qwe123):
                 return 1
             def test_something():
                 pass
-        """)
+        """
+        )
         result = testdir.runpytest()
         assert result.ret != 0
-        result.stdout.fnmatch_lines([
-            "*def gen(qwe123):*",
-            "*fixture*qwe123*not found*",
-            "*1 error*",
-        ])
+        result.stdout.fnmatch_lines(
+            ["*def gen(qwe123):*", "*fixture*qwe123*not found*", "*1 error*"]
+        )
 
 
 class TestShowFixtures(object):
+
     def test_funcarg_compat(self, testdir):
         config = testdir.parseconfigure("--funcargs")
         assert config.option.showfixtures
 
     def test_show_fixtures(self, testdir):
         result = testdir.runpytest("--fixtures")
-        result.stdout.fnmatch_lines([
-            "*tmpdir*",
-            "*temporary directory*",
-        ])
+        result.stdout.fnmatch_lines(["*tmpdir*", "*temporary directory*"])
 
     def test_show_fixtures_verbose(self, testdir):
         result = testdir.runpytest("--fixtures", "-v")
-        result.stdout.fnmatch_lines([
-            "*tmpdir*--*tmpdir.py*",
-            "*temporary directory*",
-        ])
+        result.stdout.fnmatch_lines(["*tmpdir*--*tmpdir.py*", "*temporary directory*"])
 
     def test_show_fixtures_testmodule(self, testdir):
-        p = testdir.makepyfile('''
+        p = testdir.makepyfile(
+            '''
             import pytest
             @pytest.fixture
             def _arg0():
                 """ hidden """
             @pytest.fixture
             def arg1():
                 """  hello world """
-        ''')
+        '''
+        )
         result = testdir.runpytest("--fixtures", p)
-        result.stdout.fnmatch_lines("""
+        result.stdout.fnmatch_lines(
+            """
             *tmpdir
             *fixtures defined from*
             *arg1*
             *hello world*
-        """)
+        """
+        )
         assert "arg0" not in result.stdout.str()
 
     @pytest.mark.parametrize("testmod", [True, False])
     def test_show_fixtures_conftest(self, testdir, testmod):
-        testdir.makeconftest('''
+        testdir.makeconftest(
+            '''
             import pytest
             @pytest.fixture
             def arg1():
                 """  hello world """
-        ''')
+        '''
+        )
         if testmod:
-            testdir.makepyfile("""
+            testdir.makepyfile(
+                """
                 def test_hello():
                     pass
-            """)
+            """
+            )
         result = testdir.runpytest("--fixtures")
-        result.stdout.fnmatch_lines("""
+        result.stdout.fnmatch_lines(
+            """
             *tmpdir*
             *fixtures defined from*conftest*
             *arg1*
             *hello world*
-        """)
+        """
+        )
 
     def test_show_fixtures_trimmed_doc(self, testdir):
-        p = testdir.makepyfile(dedent('''
+        p = testdir.makepyfile(
+            dedent(
+                '''
             import pytest
             @pytest.fixture
             def arg1():
                 """
                 line1
                 line2
 
                 """
             @pytest.fixture
             def arg2():
                 """
                 line1
                 line2
 
                 """
-        '''))
+        '''
+            )
+        )
         result = testdir.runpytest("--fixtures", p)
-        result.stdout.fnmatch_lines(dedent("""
+        result.stdout.fnmatch_lines(
+            dedent(
+                """
             * fixtures defined from test_show_fixtures_trimmed_doc *
             arg2
                 line1
                 line2
             arg1
                 line1
                 line2
 
-        """))
+        """
+            )
+        )
 
     def test_show_fixtures_indented_doc(self, testdir):
-        p = testdir.makepyfile(dedent('''
+        p = testdir.makepyfile(
+            dedent(
+                '''
             import pytest
             @pytest.fixture
             def fixture1():
                 """
                 line1
                     indented line
                 """
-        '''))
+        '''
+            )
+        )
         result = testdir.runpytest("--fixtures", p)
-        result.stdout.fnmatch_lines(dedent("""
+        result.stdout.fnmatch_lines(
+            dedent(
+                """
             * fixtures defined from test_show_fixtures_indented_doc *
             fixture1
                 line1
                     indented line
-        """))
+        """
+            )
+        )
 
     def test_show_fixtures_indented_doc_first_line_unindented(self, testdir):
-        p = testdir.makepyfile(dedent('''
+        p = testdir.makepyfile(
+            dedent(
+                '''
             import pytest
             @pytest.fixture
             def fixture1():
                 """line1
                 line2
                     indented line
                 """
-        '''))
+        '''
+            )
+        )
         result = testdir.runpytest("--fixtures", p)
-        result.stdout.fnmatch_lines(dedent("""
+        result.stdout.fnmatch_lines(
+            dedent(
+                """
             * fixtures defined from test_show_fixtures_indented_doc_first_line_unindented *
             fixture1
                 line1
                 line2
                     indented line
-        """))
+        """
+            )
+        )
 
     def test_show_fixtures_indented_in_class(self, testdir):
-        p = testdir.makepyfile(dedent('''
+        p = testdir.makepyfile(
+            dedent(
+                '''
             import pytest
-            class TestClass:
+            class TestClass(object):
                 @pytest.fixture
-                def fixture1():
+                def fixture1(self):
                     """line1
                     line2
                         indented line
                     """
-        '''))
+        '''
+            )
+        )
         result = testdir.runpytest("--fixtures", p)
-        result.stdout.fnmatch_lines(dedent("""
+        result.stdout.fnmatch_lines(
+            dedent(
+                """
             * fixtures defined from test_show_fixtures_indented_in_class *
             fixture1
                 line1
                 line2
                     indented line
-        """))
+        """
+            )
+        )
 
     def test_show_fixtures_different_files(self, testdir):
         """
         #833: --fixtures only shows fixtures from first file
         """
-        testdir.makepyfile(test_a='''
+        testdir.makepyfile(
+            test_a='''
             import pytest
 
             @pytest.fixture
             def fix_a():
                 """Fixture A"""
                 pass
 
             def test_a(fix_a):
                 pass
-        ''')
-        testdir.makepyfile(test_b='''
+        '''
+        )
+        testdir.makepyfile(
+            test_b='''
             import pytest
 
             @pytest.fixture
             def fix_b():
                 """Fixture B"""
                 pass
 
             def test_b(fix_b):
                 pass
-        ''')
+        '''
+        )
         result = testdir.runpytest("--fixtures")
-        result.stdout.fnmatch_lines("""
+        result.stdout.fnmatch_lines(
+            """
             * fixtures defined from test_a *
             fix_a
                 Fixture A
 
             * fixtures defined from test_b *
             fix_b
                 Fixture B
-        """)
+        """
+        )
 
     def test_show_fixtures_with_same_name(self, testdir):
-        testdir.makeconftest('''
+        testdir.makeconftest(
+            '''
             import pytest
             @pytest.fixture
             def arg1():
                 """Hello World in conftest.py"""
                 return "Hello World"
-        ''')
-        testdir.makepyfile('''
+        '''
+        )
+        testdir.makepyfile(
+            """
             def test_foo(arg1):
                 assert arg1 == "Hello World"
-        ''')
-        testdir.makepyfile('''
+        """
+        )
+        testdir.makepyfile(
+            '''
             import pytest
             @pytest.fixture
             def arg1():
                 """Hi from test module"""
                 return "Hi"
             def test_bar(arg1):
                 assert arg1 == "Hi"
-        ''')
+        '''
+        )
         result = testdir.runpytest("--fixtures")
-        result.stdout.fnmatch_lines('''
+        result.stdout.fnmatch_lines(
+            """
             * fixtures defined from conftest *
             arg1
                 Hello World in conftest.py
 
             * fixtures defined from test_show_fixtures_with_same_name *
             arg1
                 Hi from test module
-        ''')
-
-
-@pytest.mark.parametrize('flavor', ['fixture', 'yield_fixture'])
+        """
+        )
+
+    def test_fixture_disallow_twice(self):
+        """Test that applying @pytest.fixture twice generates an error (#2334)."""
+        with pytest.raises(ValueError):
+
+            @pytest.fixture
+            @pytest.fixture
+            def foo():
+                pass
+
+
+@pytest.mark.parametrize("flavor", ["fixture", "yield_fixture"])
 class TestContextManagerFixtureFuncs(object):
 
     def test_simple(self, testdir, flavor):
-        testdir.makepyfile("""
+        testdir.makepyfile(
+            """
             import pytest
             @pytest.{flavor}
             def arg1():
                 print ("setup")
                 yield 1
                 print ("teardown")
             def test_1(arg1):
                 print ("test1 %s" % arg1)
             def test_2(arg1):
                 print ("test2 %s" % arg1)
                 assert 0
-        """.format(flavor=flavor))
+        """.format(
+                flavor=flavor
+            )
+        )
         result = testdir.runpytest("-s")
-        result.stdout.fnmatch_lines("""
+        result.stdout.fnmatch_lines(
+            """
             *setup*
             *test1 1*
             *teardown*
             *setup*
             *test2 1*
             *teardown*
-        """)
+        """
+        )
 
     def test_scoped(self, testdir, flavor):
-        testdir.makepyfile("""
+        testdir.makepyfile(
+            """
             import pytest
             @pytest.{flavor}(scope="module")
             def arg1():
                 print ("setup")
                 yield 1
                 print ("teardown")
             def test_1(arg1):
                 print ("test1 %s" % arg1)
             def test_2(arg1):
                 print ("test2 %s" % arg1)
-        """.format(flavor=flavor))
+        """.format(
+                flavor=flavor
+            )
+        )
         result = testdir.runpytest("-s")
-        result.stdout.fnmatch_lines("""
+        result.stdout.fnmatch_lines(
+            """
             *setup*
             *test1 1*
             *test2 1*
             *teardown*
-        """)
+        """
+        )
 
     def test_setup_exception(self, testdir, flavor):
-        testdir.makepyfile("""
+        testdir.makepyfile(
+            """
             import pytest
             @pytest.{flavor}(scope="module")
             def arg1():
                 pytest.fail("setup")
                 yield 1
             def test_1(arg1):
                 pass
-        """.format(flavor=flavor))
+        """.format(
+                flavor=flavor
+            )
+        )
         result = testdir.runpytest("-s")
-        result.stdout.fnmatch_lines("""
+        result.stdout.fnmatch_lines(
+            """
             *pytest.fail*setup*
             *1 error*
-        """)
+        """
+        )
 
     def test_teardown_exception(self, testdir, flavor):
-        testdir.makepyfile("""
+        testdir.makepyfile(
+            """
             import pytest
             @pytest.{flavor}(scope="module")
             def arg1():
                 yield 1
                 pytest.fail("teardown")
             def test_1(arg1):
                 pass
-        """.format(flavor=flavor))
+        """.format(
+                flavor=flavor
+            )
+        )
         result = testdir.runpytest("-s")
-        result.stdout.fnmatch_lines("""
+        result.stdout.fnmatch_lines(
+            """
             *pytest.fail*teardown*
             *1 passed*1 error*
-        """)
+        """
+        )
 
     def test_yields_more_than_one(self, testdir, flavor):
-        testdir.makepyfile("""
+        testdir.makepyfile(
+            """
             import pytest
             @pytest.{flavor}(scope="module")
             def arg1():
                 yield 1
                 yield 2
             def test_1(arg1):
                 pass
-        """.format(flavor=flavor))
+        """.format(
+                flavor=flavor
+            )
+        )
         result = testdir.runpytest("-s")
-        result.stdout.fnmatch_lines("""
+        result.stdout.fnmatch_lines(
+            """
             *fixture function*
             *test_yields*:2*
-        """)
+        """
+        )
 
     def test_custom_name(self, testdir, flavor):
-        testdir.makepyfile("""
+        testdir.makepyfile(
+            """
             import pytest
             @pytest.{flavor}(name='meow')
             def arg1():
                 return 'mew'
             def test_1(meow):
                 print(meow)
-        """.format(flavor=flavor))
+        """.format(
+                flavor=flavor
+            )
+        )
         result = testdir.runpytest("-s")
         result.stdout.fnmatch_lines("*mew*")
 
 
 class TestParameterizedSubRequest(object):
+
     def test_call_from_fixture(self, testdir):
-        testfile = testdir.makepyfile("""
+        testfile = testdir.makepyfile(
+            """
             import pytest
 
             @pytest.fixture(params=[0, 1, 2])
             def fix_with_param(request):
                 return request.param
 
             @pytest.fixture
             def get_named_fixture(request):
                 return request.getfixturevalue('fix_with_param')
 
             def test_foo(request, get_named_fixture):
                 pass
-            """)
+            """
+        )
         result = testdir.runpytest()
-        result.stdout.fnmatch_lines("""
+        result.stdout.fnmatch_lines(
+            """
             E*Failed: The requested fixture has no parameter defined for the current test.
             E*
             E*Requested fixture 'fix_with_param' defined in:
-            E*{0}:4
+            E*{}:4
             E*Requested here:
-            E*{1}:9
+            E*{}:9
             *1 error*
-            """.format(testfile.basename, testfile.basename))
+            """.format(
+                testfile.basename, testfile.basename
+            )
+        )
 
     def test_call_from_test(self, testdir):
-        testfile = testdir.makepyfile("""
+        testfile = testdir.makepyfile(
+            """
             import pytest
 
             @pytest.fixture(params=[0, 1, 2])
             def fix_with_param(request):
                 return request.param
 
             def test_foo(request):
                 request.getfixturevalue('fix_with_param')
-            """)
+            """
+        )
         result = testdir.runpytest()
-        result.stdout.fnmatch_lines("""
+        result.stdout.fnmatch_lines(
+            """
             E*Failed: The requested fixture has no parameter defined for the current test.
             E*
             E*Requested fixture 'fix_with_param' defined in:
-            E*{0}:4
+            E*{}:4
             E*Requested here:
-            E*{1}:8
+            E*{}:8
             *1 failed*
-            """.format(testfile.basename, testfile.basename))
+            """.format(
+                testfile.basename, testfile.basename
+            )
+        )
 
     def test_external_fixture(self, testdir):
-        conffile = testdir.makeconftest("""
+        conffile = testdir.makeconftest(
+            """
+            import pytest
+
+            @pytest.fixture(params=[0, 1, 2])
+            def fix_with_param(request):
+                return request.param
+            """
+        )
+
+        testfile = testdir.makepyfile(
+            """
+            def test_foo(request):
+                request.getfixturevalue('fix_with_param')
+            """
+        )
+        result = testdir.runpytest()
+        result.stdout.fnmatch_lines(
+            """
+            E*Failed: The requested fixture has no parameter defined for the current test.
+            E*
+            E*Requested fixture 'fix_with_param' defined in:
+            E*{}:4
+            E*Requested here:
+            E*{}:2
+            *1 failed*
+            """.format(
+                conffile.basename, testfile.basename
+            )
+        )
+
+    def test_non_relative_path(self, testdir):
+        tests_dir = testdir.mkdir("tests")
+        fixdir = testdir.mkdir("fixtures")
+        fixfile = fixdir.join("fix.py")
+        fixfile.write(
+            _pytest._code.Source(
+                """
             import pytest
 
             @pytest.fixture(params=[0, 1, 2])
             def fix_with_param(request):
                 return request.param
-            """)
-
-        testfile = testdir.makepyfile("""
-            def test_foo(request):
-                request.getfixturevalue('fix_with_param')
-            """)
-        result = testdir.runpytest()
-        result.stdout.fnmatch_lines("""
-            E*Failed: The requested fixture has no parameter defined for the current test.
-            E*
-            E*Requested fixture 'fix_with_param' defined in:
-            E*{0}:4
-            E*Requested here:
-            E*{1}:2
-            *1 failed*
-            """.format(conffile.basename, testfile.basename))
-
-    def test_non_relative_path(self, testdir):
-        tests_dir = testdir.mkdir('tests')
-        fixdir = testdir.mkdir('fixtures')
-        fixfile = fixdir.join("fix.py")
-        fixfile.write(_pytest._code.Source("""
-            import pytest
-
-            @pytest.fixture(params=[0, 1, 2])
-            def fix_with_param(request):
-                return request.param
-            """))
+            """
+            )
+        )
 
         testfile = tests_dir.join("test_foos.py")
-        testfile.write(_pytest._code.Source("""
+        testfile.write(
+            _pytest._code.Source(
+                """
             from fix import fix_with_param
 
             def test_foo(request):
                 request.getfixturevalue('fix_with_param')
-            """))
+            """
+            )
+        )
 
         tests_dir.chdir()
         testdir.syspathinsert(fixdir)
         result = testdir.runpytest()
-        result.stdout.fnmatch_lines("""
+        result.stdout.fnmatch_lines(
+            """
             E*Failed: The requested fixture has no parameter defined for the current test.
             E*
             E*Requested fixture 'fix_with_param' defined in:
-            E*{0}:5
+            E*{}:5
             E*Requested here:
-            E*{1}:5
+            E*{}:5
             *1 failed*
-            """.format(fixfile.strpath, testfile.basename))
+            """.format(
+                fixfile.strpath, testfile.basename
+            )
+        )
+
+
+def test_pytest_fixture_setup_and_post_finalizer_hook(testdir):
+    testdir.makeconftest(
+        """
+        from __future__ import print_function
+        def pytest_fixture_setup(fixturedef, request):
+            print('ROOT setup hook called for {0} from {1}'.format(fixturedef.argname, request.node.name))
+        def pytest_fixture_post_finalizer(fixturedef, request):
+            print('ROOT finalizer hook called for {0} from {1}'.format(fixturedef.argname, request.node.name))
+    """
+    )
+    testdir.makepyfile(
+        **{
+            "tests/conftest.py": """
+            from __future__ import print_function
+            def pytest_fixture_setup(fixturedef, request):
+                print('TESTS setup hook called for {0} from {1}'.format(fixturedef.argname, request.node.name))
+            def pytest_fixture_post_finalizer(fixturedef, request):
+                print('TESTS finalizer hook called for {0} from {1}'.format(fixturedef.argname, request.node.name))
+        """,
+            "tests/test_hooks.py": """
+            from __future__ import print_function
+            import pytest
+
+            @pytest.fixture()
+            def my_fixture():
+                return 'some'
+
+            def test_func(my_fixture):
+                print('TEST test_func')
+                assert my_fixture == 'some'
+        """,
+        }
+    )
+    result = testdir.runpytest("-s")
+    assert result.ret == 0
+    result.stdout.fnmatch_lines(
+        [
+            "*TESTS setup hook called for my_fixture from test_func*",
+            "*ROOT setup hook called for my_fixture from test_func*",
+            "*TEST test_func*",
+            "*TESTS finalizer hook called for my_fixture from test_func*",
+            "*ROOT finalizer hook called for my_fixture from test_func*",
+        ]
+    )
+
+
+class TestScopeOrdering(object):
+    """Class of tests that ensure fixtures are ordered based on their scopes (#2405)"""
+
+    @pytest.mark.parametrize("use_mark", [True, False])
+    def test_func_closure_module_auto(self, testdir, use_mark):
+        """Semantically identical to the example posted in #2405 when ``use_mark=True``"""
+        testdir.makepyfile(
+            """
+            import pytest
+
+            @pytest.fixture(scope='module', autouse={autouse})
+            def m1(): pass
+
+            if {use_mark}:
+                pytestmark = pytest.mark.usefixtures('m1')
+
+            @pytest.fixture(scope='function', autouse=True)
+            def f1(): pass
+
+            def test_func(m1):
+                pass
+        """.format(
+                autouse=not use_mark, use_mark=use_mark
+            )
+        )
+        items, _ = testdir.inline_genitems()
+        request = FixtureRequest(items[0])
+        assert request.fixturenames == "m1 f1".split()
+
+    def test_func_closure_with_native_fixtures(self, testdir, monkeypatch):
+        """Sanity check that verifies the order returned by the closures and the actual fixture execution order:
+        The execution order may differ because of fixture inter-dependencies.
+        """
+        monkeypatch.setattr(pytest, "FIXTURE_ORDER", [], raising=False)
+        testdir.makepyfile(
+            """
+            import pytest
+
+            FIXTURE_ORDER = pytest.FIXTURE_ORDER
+
+            @pytest.fixture(scope="session")
+            def s1():
+                FIXTURE_ORDER.append('s1')
+
+            @pytest.fixture(scope="module")
+            def m1():
+                FIXTURE_ORDER.append('m1')
+
+            @pytest.fixture(scope='session')
+            def my_tmpdir_factory():
+                FIXTURE_ORDER.append('my_tmpdir_factory')
+
+            @pytest.fixture
+            def my_tmpdir(my_tmpdir_factory):
+                FIXTURE_ORDER.append('my_tmpdir')
+
+            @pytest.fixture
+            def f1(my_tmpdir):
+                FIXTURE_ORDER.append('f1')
+
+            @pytest.fixture
+            def f2():
+                FIXTURE_ORDER.append('f2')
+
+            def test_foo(f1, m1, f2, s1): pass
+        """
+        )
+        items, _ = testdir.inline_genitems()
+        request = FixtureRequest(items[0])
+        # order of fixtures based on their scope and position in the parameter list
+        assert request.fixturenames == "s1 my_tmpdir_factory m1 f1 f2 my_tmpdir".split()
+        testdir.runpytest()
+        # actual fixture execution differs: dependent fixtures must be created first ("my_tmpdir")
+        assert pytest.FIXTURE_ORDER == "s1 my_tmpdir_factory m1 my_tmpdir f1 f2".split()
+
+    def test_func_closure_module(self, testdir):
+        testdir.makepyfile(
+            """
+            import pytest
+
+            @pytest.fixture(scope='module')
+            def m1(): pass
+
+            @pytest.fixture(scope='function')
+            def f1(): pass
+
+            def test_func(f1, m1):
+                pass
+        """
+        )
+        items, _ = testdir.inline_genitems()
+        request = FixtureRequest(items[0])
+        assert request.fixturenames == "m1 f1".split()
+
+    def test_func_closure_scopes_reordered(self, testdir):
+        """Test ensures that fixtures are ordered by scope regardless of the order of the parameters, although
+        fixtures of same scope keep the declared order
+        """
+        testdir.makepyfile(
+            """
+            import pytest
+
+            @pytest.fixture(scope='session')
+            def s1(): pass
+
+            @pytest.fixture(scope='module')
+            def m1(): pass
+
+            @pytest.fixture(scope='function')
+            def f1(): pass
+
+            @pytest.fixture(scope='function')
+            def f2(): pass
+
+            class Test:
+
+                @pytest.fixture(scope='class')
+                def c1(cls): pass
+
+                def test_func(self, f2, f1, c1, m1, s1):
+                    pass
+        """
+        )
+        items, _ = testdir.inline_genitems()
+        request = FixtureRequest(items[0])
+        assert request.fixturenames == "s1 m1 c1 f2 f1".split()
+
+    def test_func_closure_same_scope_closer_root_first(self, testdir):
+        """Auto-use fixtures of same scope are ordered by closer-to-root first"""
+        testdir.makeconftest(
+            """
+            import pytest
+
+            @pytest.fixture(scope='module', autouse=True)
+            def m_conf(): pass
+        """
+        )
+        testdir.makepyfile(
+            **{
+                "sub/conftest.py": """
+                import pytest
+
+                @pytest.fixture(scope='module', autouse=True)
+                def m_sub(): pass
+            """,
+                "sub/test_func.py": """
+                import pytest
+
+                @pytest.fixture(scope='module', autouse=True)
+                def m_test(): pass
+
+                @pytest.fixture(scope='function')
+                def f1(): pass
+
+                def test_func(m_test, f1):
+                    pass
+        """,
+            }
+        )
+        items, _ = testdir.inline_genitems()
+        request = FixtureRequest(items[0])
+        assert request.fixturenames == "m_conf m_sub m_test f1".split()
+
+    def test_func_closure_all_scopes_complex(self, testdir):
+        """Complex test involving all scopes and mixing autouse with normal fixtures"""
+        testdir.makeconftest(
+            """
+            import pytest
+
+            @pytest.fixture(scope='session')
+            def s1(): pass
+        """
+        )
+        testdir.makepyfile(
+            """
+            import pytest
+
+            @pytest.fixture(scope='module', autouse=True)
+            def m1(): pass
+
+            @pytest.fixture(scope='module')
+            def m2(s1): pass
+
+            @pytest.fixture(scope='function')
+            def f1(): pass
+
+            @pytest.fixture(scope='function')
+            def f2(): pass
+
+            class Test:
+
+                @pytest.fixture(scope='class', autouse=True)
+                def c1(self):
+                    pass
+
+                def test_func(self, f2, f1, m2):
+                    pass
+        """
+        )
+        items, _ = testdir.inline_genitems()
+        request = FixtureRequest(items[0])
+        assert request.fixturenames == "s1 m1 m2 c1 f2 f1".split()
--- a/third_party/python/pytest/testing/python/integration.py
+++ b/third_party/python/pytest/testing/python/integration.py
@@ -1,88 +1,100 @@
 import pytest
 from _pytest import python
 from _pytest import runner
 
 
 class TestOEJSKITSpecials(object):
+
     def test_funcarg_non_pycollectobj(self, testdir):  # rough jstests usage
-        testdir.makeconftest("""
+        testdir.makeconftest(
+            """
             import pytest
             def pytest_pycollect_makeitem(collector, name, obj):
                 if name == "MyClass":
                     return MyCollector(name, parent=collector)
             class MyCollector(pytest.Collector):
                 def reportinfo(self):
                     return self.fspath, 3, "xyz"
-        """)
-        modcol = testdir.getmodulecol("""
+        """
+        )
+        modcol = testdir.getmodulecol(
+            """
             import pytest
             @pytest.fixture
             def arg1(request):
                 return 42
             class MyClass(object):
                 pass
-        """)
+        """
+        )
         # this hook finds funcarg factories
         rep = runner.collect_one_node(collector=modcol)
         clscol = rep.result[0]
         clscol.obj = lambda arg1: None
         clscol.funcargs = {}
         pytest._fillfuncargs(clscol)
-        assert clscol.funcargs['arg1'] == 42
+        assert clscol.funcargs["arg1"] == 42
 
     def test_autouse_fixture(self, testdir):  # rough jstests usage
-        testdir.makeconftest("""
+        testdir.makeconftest(
+            """
             import pytest
             def pytest_pycollect_makeitem(collector, name, obj):
                 if name == "MyClass":
                     return MyCollector(name, parent=collector)
             class MyCollector(pytest.Collector):
                 def reportinfo(self):
                     return self.fspath, 3, "xyz"
-        """)
-        modcol = testdir.getmodulecol("""
+        """
+        )
+        modcol = testdir.getmodulecol(
+            """
             import pytest
             @pytest.fixture(autouse=True)
             def hello():
                 pass
             @pytest.fixture
             def arg1(request):
                 return 42
             class MyClass(object):
                 pass
-        """)
+        """
+        )
         # this hook finds funcarg factories
         rep = runner.collect_one_node(modcol)
         clscol = rep.result[0]
         clscol.obj = lambda: None
         clscol.funcargs = {}
         pytest._fillfuncargs(clscol)
         assert not clscol.funcargs
 
 
 def test_wrapped_getfslineno():
+
     def func():
         pass
 
     def wrap(f):
         func.__wrapped__ = f
         func.patchings = ["qwe"]
         return func
 
     @wrap
     def wrapped_func(x, y, z):
         pass
+
     fs, lineno = python.getfslineno(wrapped_func)
     fs2, lineno2 = python.getfslineno(wrap)
     assert lineno > lineno2, "getfslineno does not unwrap correctly"
 
 
 class TestMockDecoration(object):
+
     def test_wrapped_getfuncargnames(self):
         from _pytest.compat import getfuncargnames
 
         def wrap(f):
 
             def func():
                 pass
 
@@ -91,70 +103,104 @@ class TestMockDecoration(object):
 
         @wrap
         def f(x):
             pass
 
         values = getfuncargnames(f)
         assert values == ("x",)
 
+    @pytest.mark.xfail(
+        strict=False, reason="getfuncargnames breaks if mock is imported"
+    )
     def test_wrapped_getfuncargnames_patching(self):
         from _pytest.compat import getfuncargnames
 
         def wrap(f):
+
             def func():
                 pass
+
             func.__wrapped__ = f
             func.patchings = ["qwe"]
             return func
 
         @wrap
         def f(x, y, z):
             pass
 
         values = getfuncargnames(f)
         assert values == ("y", "z")
 
     def test_unittest_mock(self, testdir):
         pytest.importorskip("unittest.mock")
-        testdir.makepyfile("""
+        testdir.makepyfile(
+            """
             import unittest.mock
             class T(unittest.TestCase):
                 @unittest.mock.patch("os.path.abspath")
                 def test_hello(self, abspath):
                     import os
                     os.path.abspath("hello")
                     abspath.assert_any_call("hello")
-        """)
+        """
+        )
         reprec = testdir.inline_run()
         reprec.assertoutcome(passed=1)
 
     def test_unittest_mock_and_fixture(self, testdir):
         pytest.importorskip("unittest.mock")
-        testdir.makepyfile("""
+        testdir.makepyfile(
+            """
             import os.path
             import unittest.mock
             import pytest
 
             @pytest.fixture
             def inject_me():
                 pass
 
             @unittest.mock.patch.object(os.path, "abspath",
                                         new=unittest.mock.MagicMock)
             def test_hello(inject_me):
                 import os
                 os.path.abspath("hello")
-        """)
+        """
+        )
         reprec = testdir.inline_run()
         reprec.assertoutcome(passed=1)
 
+    def test_unittest_mock_and_pypi_mock(self, testdir):
+        pytest.importorskip("unittest.mock")
+        pytest.importorskip("mock", "1.0.1")
+        testdir.makepyfile(
+            """
+            import mock
+            import unittest.mock
+            class TestBoth(object):
+                @unittest.mock.patch("os.path.abspath")
+                def test_hello(self, abspath):
+                    import os
+                    os.path.abspath("hello")
+                    abspath.assert_any_call("hello")
+
+                @mock.patch("os.path.abspath")
+                def test_hello_mock(self, abspath):
+                    import os
+                    os.path.abspath("hello")
+                    abspath.assert_any_call("hello")
+        """
+        )
+        reprec = testdir.inline_run()
+        reprec.assertoutcome(passed=2)
+
     def test_mock(self, testdir):
         pytest.importorskip("mock", "1.0.1")
-        testdir.makepyfile("""
+        testdir.makepyfile(
+            """
             import os
             import unittest
             import mock
 
             class T(unittest.TestCase):
                 @mock.patch("os.path.abspath")
                 def test_hello(self, abspath):
                     os.path.abspath("hello")
@@ -164,203 +210,228 @@ class TestMockDecoration(object):
             @mock.patch("os.path.abspath")
             @mock.patch("os.path.normpath")
             @mock.patch("os.path.basename", new=mock_basename)
             def test_someting(normpath, abspath, tmpdir):
                 abspath.return_value = "this"
                 os.path.normpath(os.path.abspath("hello"))
                 normpath.assert_any_call("this")
                 assert os.path.basename("123") == "mock_basename"
-        """)
+        """
+        )
         reprec = testdir.inline_run()
         reprec.assertoutcome(passed=2)
         calls = reprec.getcalls("pytest_runtest_logreport")
-        funcnames = [call.report.location[2] for call in calls
-                     if call.report.when == "call"]
+        funcnames = [
+            call.report.location[2] for call in calls if call.report.when == "call"
+        ]
         assert funcnames == ["T.test_hello", "test_someting"]
 
     def test_mock_sorting(self, testdir):
         pytest.importorskip("mock", "1.0.1")
-        testdir.makepyfile("""
+        testdir.makepyfile(
+            """
             import os
             import mock
 
             @mock.patch("os.path.abspath")
             def test_one(abspath):
                 pass
             @mock.patch("os.path.abspath")
             def test_two(abspath):
                 pass
             @mock.patch("os.path.abspath")
             def test_three(abspath):
                 pass
-        """)
+        """
+        )
         reprec = testdir.inline_run()
         calls = reprec.getreports("pytest_runtest_logreport")
         calls = [x for x in calls if x.when == "call"]
         names = [x.nodeid.split("::")[-1] for x in calls]
         assert names == ["test_one", "test_two", "test_three"]
 
     def test_mock_double_patch_issue473(self, testdir):
         pytest.importorskip("mock", "1.0.1")
-        testdir.makepyfile("""
+        testdir.makepyfile(
+            """
             from mock import patch
             from pytest import mark
 
             @patch('os.getcwd')
             @patch('os.path')
             @mark.slow
             class TestSimple(object):
                 def test_simple_thing(self, mock_path, mock_getcwd):
                     pass
-        """)
+        """
+        )
         reprec = testdir.inline_run()
         reprec.assertoutcome(passed=1)
 
 
 class TestReRunTests(object):
+
     def test_rerun(self, testdir):
-        testdir.makeconftest("""
+        testdir.makeconftest(
+            """
             from _pytest.runner import runtestprotocol
             def pytest_runtest_protocol(item, nextitem):
                 runtestprotocol(item, log=False, nextitem=nextitem)
                 runtestprotocol(item, log=True, nextitem=nextitem)
-        """)
-        testdir.makepyfile("""
+        """
+        )
+        testdir.makepyfile(
+            """
             import pytest
             count = 0
             req = None
             @pytest.fixture
             def fix(request):
                 global count, req
                 assert request != req
                 req = request
                 print ("fix count %s" % count)
                 count += 1
             def test_fix(fix):
                 pass
-        """)
+        """
+        )
         result = testdir.runpytest("-s")
-        result.stdout.fnmatch_lines("""
+        result.stdout.fnmatch_lines(
+            """
             *fix count 0*
             *fix count 1*
-        """)
-        result.stdout.fnmatch_lines("""
+        """
+        )
+        result.stdout.fnmatch_lines(
+            """
             *2 passed*
-        """)
+        """
+        )
 
 
 def test_pytestconfig_is_session_scoped():
     from _pytest.fixtures import pytestconfig
+
     assert pytestconfig._pytestfixturefunction.scope == "session"
 
 
 class TestNoselikeTestAttribute(object):
+
     def test_module_with_global_test(self, testdir):
-        testdir.makepyfile("""
+        testdir.makepyfile(
+            """
             __test__ = False
             def test_hello():
                 pass
-        """)
+        """
+        )
         reprec = testdir.inline_run()
         assert not reprec.getfailedcollections()
         calls = reprec.getreports("pytest_runtest_logreport")
         assert not calls
 
     def test_class_and_method(self, testdir):
-        testdir.makepyfile("""
+        testdir.makepyfile(
+            """
             __test__ = True
             def test_func():
                 pass
             test_func.__test__ = False
 
             class TestSome(object):
                 __test__ = False
                 def test_method(self):
                     pass
-        """)
+        """
+        )
         reprec = testdir.inline_run()
         assert not reprec.getfailedcollections()
         calls = reprec.getreports("pytest_runtest_logreport")
         assert not calls
 
     def test_unittest_class(self, testdir):
-        testdir.makepyfile("""
+        testdir.makepyfile(
+            """
             import unittest
             class TC(unittest.TestCase):
                 def test_1(self):
                     pass
             class TC2(unittest.TestCase):
                 __test__ = False
                 def test_2(self):
                     pass
-        """)
+        """
+        )
         reprec = testdir.inline_run()
         assert not reprec.getfailedcollections()
         call = reprec.getcalls("pytest_collection_modifyitems")[0]
         assert len(call.items) == 1
         assert call.items[0].cls.__name__ == "TC"
 
     def test_class_with_nasty_getattr(self, testdir):
         """Make sure we handle classes with a custom nasty __getattr__ right.
 
         With a custom __getattr__ which e.g. returns a function (like with a
         RPC wrapper), we shouldn't assume this meant "__test__ = True".
         """
         # https://github.com/pytest-dev/pytest/issues/1204
-        testdir.makepyfile("""
+        testdir.makepyfile(
+            """
             class MetaModel(type):
 
                 def __getattr__(cls, key):
                     return lambda: None
 
 
             BaseModel = MetaModel('Model', (), {})
 
 
             class Model(BaseModel):
 
                 __metaclass__ = MetaModel
 
                 def test_blah(self):
                     pass
-        """)
+        """
+        )
         reprec = testdir.inline_run()
         assert not reprec.getfailedcollections()
         call = reprec.getcalls("pytest_collection_modifyitems")[0]
         assert not call.items
 
 
 @pytest.mark.issue351
 class TestParameterize(object):
 
     def test_idfn_marker(self, testdir):
-        testdir.makepyfile("""
+        testdir.makepyfile(
+            """
             import pytest
 
             def idfn(param):
                 if param == 0:
                     return 'spam'
                 elif param == 1:
                     return 'ham'
                 else:
                     return None
 
             @pytest.mark.parametrize('a,b', [(0, 2), (1, 2)], ids=idfn)
             def test_params(a, b):
                 pass
-        """)
-        res = testdir.runpytest('--collect-only')
-        res.stdout.fnmatch_lines([
-            "*spam-2*",
-            "*ham-2*",
-        ])
+        """
+        )
+        res = testdir.runpytest("--collect-only")
+        res.stdout.fnmatch_lines(["*spam-2*", "*ham-2*"])
 
     def test_idfn_fixture(self, testdir):
-        testdir.makepyfile("""
+        testdir.makepyfile(
+            """
             import pytest
 
             def idfn(param):
                 if param == 0:
                     return 'spam'
                 elif param == 1:
                     return 'ham'
                 else:
@@ -371,14 +442,12 @@ class TestParameterize(object):
                 return request.param
 
             @pytest.fixture(params=[1, 2], ids=idfn)
             def b(request):
                 return request.param
 
             def test_params(a, b):
                 pass
-        """)
-        res = testdir.runpytest('--collect-only')
-        res.stdout.fnmatch_lines([
-            "*spam-2*",
-            "*ham-2*",
-        ])
+        """
+        )
+        res = testdir.runpytest("--collect-only")
+        res.stdout.fnmatch_lines(["*spam-2*", "*ham-2*"])
--- a/third_party/python/pytest/testing/python/metafunc.py
+++ b/third_party/python/pytest/testing/python/metafunc.py
@@ -1,628 +1,748 @@
 # -*- coding: utf-8 -*-
 import re
 import sys
-
+import attr
 import _pytest._code
 import py
 import pytest
 from _pytest import python, fixtures
 
 import hypothesis
 from hypothesis import strategies
 
 PY3 = sys.version_info >= (3, 0)
 
 
 class TestMetafunc(object):
-    def Metafunc(self, func):
+
+    def Metafunc(self, func, config=None):
         # the unit tests of this class check if things work correctly
         # on the funcarg level, so we don't need a full blown
         # initiliazation
         class FixtureInfo(object):
             name2fixturedefs = None
 
             def __init__(self, names):
                 self.names_closure = names
 
+        @attr.s
+        class DefinitionMock(object):
+            obj = attr.ib()
+
         names = fixtures.getfuncargnames(func)
         fixtureinfo = FixtureInfo(names)
-        return python.Metafunc(func, fixtureinfo, None)
+        definition = DefinitionMock(func)
+        return python.Metafunc(definition, fixtureinfo, config)
 
     def test_no_funcargs(self, testdir):
+
         def function():
             pass
+
         metafunc = self.Metafunc(function)
         assert not metafunc.fixturenames
         repr(metafunc._calls)
 
     def test_function_basic(self):
+
         def func(arg1, arg2="qwe"):
             pass
+
         metafunc = self.Metafunc(func)
         assert len(metafunc.fixturenames) == 1
-        assert 'arg1' in metafunc.fixturenames
+        assert "arg1" in metafunc.fixturenames
         assert metafunc.function is func
         assert metafunc.cls is None
 
     def test_addcall_no_args(self):
+
         def func(arg1):
             pass
+
         metafunc = self.Metafunc(func)
         metafunc.addcall()
         assert len(metafunc._calls) == 1
         call = metafunc._calls[0]
         assert call.id == "0"
-        assert not hasattr(call, 'param')
+        assert not hasattr(call, "param")
 
     def test_addcall_id(self):
+
         def func(arg1):
             pass
+
         metafunc = self.Metafunc(func)
         pytest.raises(ValueError, "metafunc.addcall(id=None)")
 
         metafunc.addcall(id=1)
         pytest.raises(ValueError, "metafunc.addcall(id=1)")
         pytest.raises(ValueError, "metafunc.addcall(id='1')")
         metafunc.addcall(id=2)
         assert len(metafunc._calls) == 2
         assert metafunc._calls[0].id == "1"
         assert metafunc._calls[1].id == "2"
 
     def test_addcall_param(self):
+
         def func(arg1):
             pass
+
         metafunc = self.Metafunc(func)
 
         class obj(object):
             pass
 
         metafunc.addcall(param=obj)
         metafunc.addcall(param=obj)
         metafunc.addcall(param=1)
         assert len(metafunc._calls) == 3
         assert metafunc._calls[0].getparam("arg1") == obj
         assert metafunc._calls[1].getparam("arg1") == obj
         assert metafunc._calls[2].getparam("arg1") == 1
 
     def test_addcall_funcargs(self):
+
         def func(x):
             pass
 
         metafunc = self.Metafunc(func)
 
         class obj(object):
             pass
 
         metafunc.addcall(funcargs={"x": 2})
         metafunc.addcall(funcargs={"x": 3})
         pytest.raises(pytest.fail.Exception, "metafunc.addcall({'xyz': 0})")
         assert len(metafunc._calls) == 2
-        assert metafunc._calls[0].funcargs == {'x': 2}
-        assert metafunc._calls[1].funcargs == {'x': 3}
-        assert not hasattr(metafunc._calls[1], 'param')
+        assert metafunc._calls[0].funcargs == {"x": 2}
+        assert metafunc._calls[1].funcargs == {"x": 3}
+        assert not hasattr(metafunc._calls[1], "param")
 
     def test_parametrize_error(self):
+
         def func(x, y):
             pass
+
         metafunc = self.Metafunc(func)
         metafunc.parametrize("x", [1, 2])
         pytest.raises(ValueError, lambda: metafunc.parametrize("x", [5, 6]))
         pytest.raises(ValueError, lambda: metafunc.parametrize("x", [5, 6]))
         metafunc.parametrize("y", [1, 2])
         pytest.raises(ValueError, lambda: metafunc.parametrize("y", [5, 6]))
         pytest.raises(ValueError, lambda: metafunc.parametrize("y", [5, 6]))
 
     def test_parametrize_bad_scope(self, testdir):
+
         def func(x):
             pass
+
         metafunc = self.Metafunc(func)
         try:
-            metafunc.parametrize("x", [1], scope='doggy')
+            metafunc.parametrize("x", [1], scope="doggy")
         except ValueError as ve:
             assert "has an unsupported scope value 'doggy'" in str(ve)
 
     def test_parametrize_and_id(self):
+
         def func(x, y):
             pass
+
         metafunc = self.Metafunc(func)
 
-        metafunc.parametrize("x", [1, 2], ids=['basic', 'advanced'])
+        metafunc.parametrize("x", [1, 2], ids=["basic", "advanced"])
         metafunc.parametrize("y", ["abc", "def"])
         ids = [x.id for x in metafunc._calls]
         assert ids == ["basic-abc", "basic-def", "advanced-abc", "advanced-def"]
 
     def test_parametrize_and_id_unicode(self):
         """Allow unicode strings for "ids" parameter in Python 2 (##1905)"""
+
         def func(x):
             pass
+
         metafunc = self.Metafunc(func)
-        metafunc.parametrize("x", [1, 2], ids=[u'basic', u'advanced'])
+        metafunc.parametrize("x", [1, 2], ids=[u"basic", u"advanced"])
         ids = [x.id for x in metafunc._calls]
         assert ids == [u"basic", u"advanced"]
 
     def test_parametrize_with_wrong_number_of_ids(self, testdir):
+
         def func(x, y):
             pass
+
         metafunc = self.Metafunc(func)
 
-        pytest.raises(ValueError, lambda:
-                      metafunc.parametrize("x", [1, 2], ids=['basic']))
+        pytest.raises(
+            ValueError, lambda: metafunc.parametrize("x", [1, 2], ids=["basic"])
+        )
 
-        pytest.raises(ValueError, lambda:
-                      metafunc.parametrize(("x", "y"), [("abc", "def"),
-                                                        ("ghi", "jkl")], ids=["one"]))
+        pytest.raises(
+            ValueError,
+            lambda: metafunc.parametrize(
+                ("x", "y"), [("abc", "def"), ("ghi", "jkl")], ids=["one"]
+            ),
+        )
 
     @pytest.mark.issue510
     def test_parametrize_empty_list(self):
+
         def func(y):
             pass
-        metafunc = self.Metafunc(func)
+
+        class MockConfig(object):
+
+            def getini(self, name):
+                return ""
+
+            @property
+            def hook(self):
+                return self
+
+            def pytest_make_parametrize_id(self, **kw):
+                pass
+
+        metafunc = self.Metafunc(func, MockConfig())
         metafunc.parametrize("y", [])
-        assert 'skip' in metafunc._calls[0].keywords
+        assert "skip" == metafunc._calls[0].marks[0].name
 
     def test_parametrize_with_userobjects(self):
+
         def func(x, y):
             pass
+
         metafunc = self.Metafunc(func)
 
         class A(object):
             pass
 
         metafunc.parametrize("x", [A(), A()])
         metafunc.parametrize("y", list("ab"))
         assert metafunc._calls[0].id == "x0-a"
         assert metafunc._calls[1].id == "x0-b"
         assert metafunc._calls[2].id == "x1-a"
         assert metafunc._calls[3].id == "x1-b"
 
     @hypothesis.given(strategies.text() | strategies.binary())
+    @hypothesis.settings(
+        deadline=400.0
+    )  # very close to std deadline and CI boxes are not reliable in CPU power
     def test_idval_hypothesis(self, value):
         from _pytest.python import _idval
-        escaped = _idval(value, 'a', 6, None)
+
+        escaped = _idval(value, "a", 6, None)
         assert isinstance(escaped, str)
         if PY3:
-            escaped.encode('ascii')
+            escaped.encode("ascii")
         else:
-            escaped.decode('ascii')
+            escaped.decode("ascii")
 
     def test_unicode_idval(self):
         """This tests that Unicode strings outside the ASCII character set get
         escaped, using byte escapes if they're in that range or unicode
         escapes if they're not.
 
         """
         from _pytest.python import _idval
+
         values = [
-            (
-                u'',
-                ''
-            ),
-            (
-                u'ascii',
-                'ascii'
-            ),
+            (u"", ""),
+            (u"ascii", "ascii"),
+            (u"ação", "a\\xe7\\xe3o"),
+            (u"josé@blah.com", "jos\\xe9@blah.com"),
             (
-                u'ação',
-                'a\\xe7\\xe3o'
-            ),
-            (
-                u'josé@blah.com',
-                'jos\\xe9@blah.com'
-            ),
-            (
-                u'δοκ.ιμή@παράδειγμα.δοκιμή',
-                '\\u03b4\\u03bf\\u03ba.\\u03b9\\u03bc\\u03ae@\\u03c0\\u03b1\\u03c1\\u03ac\\u03b4\\u03b5\\u03b9\\u03b3'
-                '\\u03bc\\u03b1.\\u03b4\\u03bf\\u03ba\\u03b9\\u03bc\\u03ae'
+                u"δοκ.ιμή@παράδειγμα.δοκιμή",
+                "\\u03b4\\u03bf\\u03ba.\\u03b9\\u03bc\\u03ae@\\u03c0\\u03b1\\u03c1\\u03ac\\u03b4\\u03b5\\u03b9\\u03b3"
+                "\\u03bc\\u03b1.\\u03b4\\u03bf\\u03ba\\u03b9\\u03bc\\u03ae",
             ),
         ]
         for val, expected in values:
-            assert _idval(val, 'a', 6, None) == expected
+            assert _idval(val, "a", 6, None) == expected
 
     def test_bytes_idval(self):
         """unittest for the expected behavior to obtain ids for parametrized
         bytes values:
         - python2: non-ascii strings are considered bytes and formatted using
         "binary escape", where any byte < 127 is escaped into its hex form.
         - python3: bytes objects are always escaped using "binary escape".
         """
         from _pytest.python import _idval
+
         values = [
-            (b'', ''),
-            (b'\xc3\xb4\xff\xe4', '\\xc3\\xb4\\xff\\xe4'),
-            (b'ascii', 'ascii'),
-            (u'αρά'.encode('utf-8'), '\\xce\\xb1\\xcf\\x81\\xce\\xac'),
+            (b"", ""),
+            (b"\xc3\xb4\xff\xe4", "\\xc3\\xb4\\xff\\xe4"),
+            (b"ascii", "ascii"),
+            (u"αρά".encode("utf-8"), "\\xce\\xb1\\xcf\\x81\\xce\\xac"),
         ]
         for val, expected in values:
-            assert _idval(val, 'a', 6, None) == expected
+            assert _idval(val, "a", 6, None) == expected
+
+    def test_class_or_function_idval(self):
+        """unittest for the expected behavior to obtain ids for parametrized
+        values that are classes or functions: their __name__.
+        """
+        from _pytest.python import _idval
+
+        class TestClass(object):
+            pass
+
+        def test_function():
+            pass
+
+        values = [(TestClass, "TestClass"), (test_function, "test_function")]
+        for val, expected in values:
+            assert _idval(val, "a", 6, None) == expected
 
     @pytest.mark.issue250
     def test_idmaker_autoname(self):
         from _pytest.python import idmaker
-        result = idmaker(("a", "b"), [pytest.param("string", 1.0),
-                                      pytest.param("st-ring", 2.0)])
+
+        result = idmaker(
+            ("a", "b"), [pytest.param("string", 1.0), pytest.param("st-ring", 2.0)]
+        )
         assert result == ["string-1.0", "st-ring-2.0"]
 
-        result = idmaker(("a", "b"), [pytest.param(object(), 1.0),
-                                      pytest.param(object(), object())])
+        result = idmaker(
+            ("a", "b"), [pytest.param(object(), 1.0), pytest.param(object(), object())]
+        )
         assert result == ["a0-1.0", "a1-b1"]
         # unicode mixing, issue250
         result = idmaker(
-            (py.builtin._totext("a"), "b"),
-            [pytest.param({}, b'\xc3\xb4')])
-        assert result == ['a0-\\xc3\\xb4']
+            (py.builtin._totext("a"), "b"), [pytest.param({}, b"\xc3\xb4")]
+        )
+        assert result == ["a0-\\xc3\\xb4"]
 
     def test_idmaker_with_bytes_regex(self):
         from _pytest.python import idmaker
-        result = idmaker(("a"), [pytest.param(re.compile(b'foo'), 1.0)])
+
+        result = idmaker(("a"), [pytest.param(re.compile(b"foo"), 1.0)])
         assert result == ["foo"]
 
     def test_idmaker_native_strings(self):
         from _pytest.python import idmaker
+
         totext = py.builtin._totext
-        result = idmaker(("a", "b"), [
-            pytest.param(1.0, -1.1),
-            pytest.param(2, -202),
-            pytest.param("three", "three hundred"),
-            pytest.param(True, False),
-            pytest.param(None, None),
-            pytest.param(re.compile('foo'), re.compile('bar')),
-            pytest.param(str, int),
-            pytest.param(list("six"), [66, 66]),
-            pytest.param(set([7]), set("seven")),
-            pytest.param(tuple("eight"), (8, -8, 8)),
-            pytest.param(b'\xc3\xb4', b"name"),
-            pytest.param(b'\xc3\xb4', totext("other")),
-        ])
-        assert result == ["1.0--1.1",
-                          "2--202",
-                          "three-three hundred",
-                          "True-False",
-                          "None-None",
-                          "foo-bar",
-                          "str-int",
-                          "a7-b7",
-                          "a8-b8",
-                          "a9-b9",
-                          "\\xc3\\xb4-name",
-                          "\\xc3\\xb4-other",
-                          ]
+        result = idmaker(
+            ("a", "b"),
+            [
+                pytest.param(1.0, -1.1),
+                pytest.param(2, -202),
+                pytest.param("three", "three hundred"),
+                pytest.param(True, False),
+                pytest.param(None, None),
+                pytest.param(re.compile("foo"), re.compile("bar")),
+                pytest.param(str, int),
+                pytest.param(list("six"), [66, 66]),
+                pytest.param({7}, set("seven")),
+                pytest.param(tuple("eight"), (8, -8, 8)),
+                pytest.param(b"\xc3\xb4", b"name"),
+                pytest.param(b"\xc3\xb4", totext("other")),
+            ],
+        )
+        assert (
+            result
+            == [
+                "1.0--1.1",
+                "2--202",
+                "three-three hundred",
+                "True-False",
+                "None-None",
+                "foo-bar",
+                "str-int",
+                "a7-b7",
+                "a8-b8",
+                "a9-b9",
+                "\\xc3\\xb4-name",
+                "\\xc3\\xb4-other",
+            ]
+        )
 
     def test_idmaker_enum(self):
         from _pytest.python import idmaker
+
         enum = pytest.importorskip("enum")
         e = enum.Enum("Foo", "one, two")
         result = idmaker(("a", "b"), [pytest.param(e.one, e.two)])
         assert result == ["Foo.one-Foo.two"]
 
     @pytest.mark.issue351
     def test_idmaker_idfn(self):
         from _pytest.python import idmaker
 
         def ids(val):
             if isinstance(val, Exception):
                 return repr(val)
 
-        result = idmaker(("a", "b"), [
-            pytest.param(10.0, IndexError()),
-            pytest.param(20, KeyError()),
-            pytest.param("three", [1, 2, 3]),
-        ], idfn=ids)
-        assert result == ["10.0-IndexError()",
-                          "20-KeyError()",
-                          "three-b2",
-                          ]
+        result = idmaker(
+            ("a", "b"),
+            [
+                pytest.param(10.0, IndexError()),
+                pytest.param(20, KeyError()),
+                pytest.param("three", [1, 2, 3]),
+            ],
+            idfn=ids,
+        )
+        assert result == ["10.0-IndexError()", "20-KeyError()", "three-b2"]
 
     @pytest.mark.issue351
     def test_idmaker_idfn_unique_names(self):
         from _pytest.python import idmaker
 
         def ids(val):
-            return 'a'
+            return "a"
 
-        result = idmaker(("a", "b"), [pytest.param(10.0, IndexError()),
-                                      pytest.param(20, KeyError()),
-                                      pytest.param("three", [1, 2, 3]),
-                                      ], idfn=ids)
-        assert result == ["a-a0",
-                          "a-a1",
-                          "a-a2",
-                          ]
+        result = idmaker(
+            ("a", "b"),
+            [
+                pytest.param(10.0, IndexError()),
+                pytest.param(20, KeyError()),
+                pytest.param("three", [1, 2, 3]),
+            ],
+            idfn=ids,
+        )
+        assert result == ["a-a0", "a-a1", "a-a2"]
 
     @pytest.mark.issue351
     def test_idmaker_idfn_exception(self):
         from _pytest.python import idmaker
         from _pytest.recwarn import WarningsRecorder
 
         class BadIdsException(Exception):
             pass
 
         def ids(val):
             raise BadIdsException("ids raised")
 
         rec = WarningsRecorder()
         with rec:
-            idmaker(("a", "b"), [
-                pytest.param(10.0, IndexError()),
-                pytest.param(20, KeyError()),
-                pytest.param("three", [1, 2, 3]),
-            ], idfn=ids)
+            idmaker(
+                ("a", "b"),
+                [
+                    pytest.param(10.0, IndexError()),
+                    pytest.param(20, KeyError()),
+                    pytest.param("three", [1, 2, 3]),
+                ],
+                idfn=ids,
+            )
 
-        assert [str(i.message) for i in rec.list] == [
-            "Raised while trying to determine id of parameter a at position 0."
-            "\nUpdate your code as this will raise an error in pytest-4.0.",
-            "Raised while trying to determine id of parameter b at position 0."
-            "\nUpdate your code as this will raise an error in pytest-4.0.",
-            "Raised while trying to determine id of parameter a at position 1."
-            "\nUpdate your code as this will raise an error in pytest-4.0.",
-            "Raised while trying to determine id of parameter b at position 1."
-            "\nUpdate your code as this will raise an error in pytest-4.0.",
-            "Raised while trying to determine id of parameter a at position 2."
-            "\nUpdate your code as this will raise an error in pytest-4.0.",
-            "Raised while trying to determine id of parameter b at position 2."
-            "\nUpdate your code as this will raise an error in pytest-4.0.",
-        ]
+        assert (
+            [str(i.message) for i in rec.list]
+            == [
+                "Raised while trying to determine id of parameter a at position 0."
+                "\nUpdate your code as this will raise an error in pytest-4.0.",
+                "Raised while trying to determine id of parameter b at position 0."
+                "\nUpdate your code as this will raise an error in pytest-4.0.",
+                "Raised while trying to determine id of parameter a at position 1."
+                "\nUpdate your code as this will raise an error in pytest-4.0.",
+                "Raised while trying to determine id of parameter b at position 1."
+                "\nUpdate your code as this will raise an error in pytest-4.0.",
+                "Raised while trying to determine id of parameter a at position 2."
+                "\nUpdate your code as this will raise an error in pytest-4.0.",
+                "Raised while trying to determine id of parameter b at position 2."
+                "\nUpdate your code as this will raise an error in pytest-4.0.",
+            ]
+        )
 
     def test_parametrize_ids_exception(self, testdir):
         """
         :param testdir: the instance of Testdir class, a temporary
         test directory.
         """
-        testdir.makepyfile("""
+        testdir.makepyfile(
+            """
                 import pytest
 
                 def ids(arg):
                     raise Exception("bad ids")
 
                 @pytest.mark.parametrize("arg", ["a", "b"], ids=ids)
                 def test_foo(arg):
                     pass
-            """)
+            """
+        )
         with pytest.warns(DeprecationWarning):
             result = testdir.runpytest("--collect-only")
-        result.stdout.fnmatch_lines([
-            "<Module 'test_parametrize_ids_exception.py'>",
-            "  <Function 'test_foo[a]'>",
-            "  <Function 'test_foo[b]'>",
-        ])
+        result.stdout.fnmatch_lines(
+            [
+                "<Module 'test_parametrize_ids_exception.py'>",
+                "  <Function 'test_foo[a]'>",
+                "  <Function 'test_foo[b]'>",
+            ]
+        )
 
     def test_idmaker_with_ids(self):
         from _pytest.python import idmaker
-        result = idmaker(("a", "b"), [pytest.param(1, 2),
-                                      pytest.param(3, 4)],
-                         ids=["a", None])
+
+        result = idmaker(
+            ("a", "b"), [pytest.param(1, 2), pytest.param(3, 4)], ids=["a", None]
+        )
         assert result == ["a", "3-4"]
 
     def test_idmaker_with_paramset_id(self):
         from _pytest.python import idmaker
-        result = idmaker(("a", "b"), [pytest.param(1, 2, id="me"),
-                                      pytest.param(3, 4, id="you")],
-                         ids=["a", None])
+
+        result = idmaker(
+            ("a", "b"),
+            [pytest.param(1, 2, id="me"), pytest.param(3, 4, id="you")],
+            ids=["a", None],
+        )
         assert result == ["me", "you"]
 
     def test_idmaker_with_ids_unique_names(self):
         from _pytest.python import idmaker
-        result = idmaker(("a"), map(pytest.param, [1, 2, 3, 4, 5]),
-                         ids=["a", "a", "b", "c", "b"])
+
+        result = idmaker(
+            ("a"), map(pytest.param, [1, 2, 3, 4, 5]), ids=["a", "a", "b", "c", "b"]
+        )
         assert result == ["a0", "a1", "b0", "c", "b1"]
 
     def test_addcall_and_parametrize(self):
+
         def func(x, y):
             pass
+
         metafunc = self.Metafunc(func)
-        metafunc.addcall({'x': 1})
-        metafunc.parametrize('y', [2, 3])
+        metafunc.addcall({"x": 1})
+        metafunc.parametrize("y", [2, 3])
         assert len(metafunc._calls) == 2
-        assert metafunc._calls[0].funcargs == {'x': 1, 'y': 2}
-        assert metafunc._calls[1].funcargs == {'x': 1, 'y': 3}
+        assert metafunc._calls[0].funcargs == {"x": 1, "y": 2}
+        assert metafunc._calls[1].funcargs == {"x": 1, "y": 3}
         assert metafunc._calls[0].id == "0-2"
         assert metafunc._calls[1].id == "0-3"
 
     @pytest.mark.issue714
     def test_parametrize_indirect(self):
+
         def func(x, y):
             pass
+
         metafunc = self.Metafunc(func)
-        metafunc.parametrize('x', [1], indirect=True)
-        metafunc.parametrize('y', [2, 3], indirect=True)
+        metafunc.parametrize("x", [1], indirect=True)
+        metafunc.parametrize("y", [2, 3], indirect=True)
         assert len(metafunc._calls) == 2
         assert metafunc._calls[0].funcargs == {}
         assert metafunc._calls[1].funcargs == {}
         assert metafunc._calls[0].params == dict(x=1, y=2)
         assert metafunc._calls[1].params == dict(x=1, y=3)
 
     @pytest.mark.issue714
     def test_parametrize_indirect_list(self):
+
         def func(x, y):
             pass
+
         metafunc = self.Metafunc(func)
-        metafunc.parametrize('x, y', [('a', 'b')], indirect=['x'])
-        assert metafunc._calls[0].funcargs == dict(y='b')
-        assert metafunc._calls[0].params == dict(x='a')
+        metafunc.parametrize("x, y", [("a", "b")], indirect=["x"])
+        assert metafunc._calls[0].funcargs == dict(y="b")
+        assert metafunc._calls[0].params == dict(x="a")
 
     @pytest.mark.issue714
     def test_parametrize_indirect_list_all(self):
+
         def func(x, y):
             pass
+
         metafunc = self.Metafunc(func)
-        metafunc.parametrize('x, y', [('a', 'b')], indirect=['x', 'y'])
+        metafunc.parametrize("x, y", [("a", "b")], indirect=["x", "y"])
         assert metafunc._calls[0].funcargs == {}
-        assert metafunc._calls[0].params == dict(x='a', y='b')
+        assert metafunc._calls[0].params == dict(x="a", y="b")
 
     @pytest.mark.issue714
     def test_parametrize_indirect_list_empty(self):
+
         def func(x, y):
             pass
+
         metafunc = self.Metafunc(func)
-        metafunc.parametrize('x, y', [('a', 'b')], indirect=[])
-        assert metafunc._calls[0].funcargs == dict(x='a', y='b')
+        metafunc.parametrize("x, y", [("a", "b")], indirect=[])
+        assert metafunc._calls[0].funcargs == dict(x="a", y="b")
         assert metafunc._calls[0].params == {}
 
     @pytest.mark.issue714
     def test_parametrize_indirect_list_functional(self, testdir):
         """
         Test parametrization with 'indirect' parameter applied on
         particular arguments. As y is is direct, its value should
         be used directly rather than being passed to the fixture
         y.
 
         :param testdir: the instance of Testdir class, a temporary
         test directory.
         """
-        testdir.makepyfile("""
+        testdir.makepyfile(
+            """
             import pytest
             @pytest.fixture(scope='function')
             def x(request):
                 return request.param * 3
             @pytest.fixture(scope='function')
             def y(request):
                 return request.param * 2
             @pytest.mark.parametrize('x, y', [('a', 'b')], indirect=['x'])
             def test_simple(x,y):
                 assert len(x) == 3
                 assert len(y) == 1
-        """)
+        """
+        )
         result = testdir.runpytest("-v")
-        result.stdout.fnmatch_lines([
-            "*test_simple*a-b*",
-            "*1 passed*",
-        ])
+        result.stdout.fnmatch_lines(["*test_simple*a-b*", "*1 passed*"])
 
     @pytest.mark.issue714
     def test_parametrize_indirect_list_error(self, testdir):
+
         def func(x, y):
             pass
+
         metafunc = self.Metafunc(func)
         with pytest.raises(ValueError):
-            metafunc.parametrize('x, y', [('a', 'b')], indirect=['x', 'z'])
+            metafunc.parametrize("x, y", [("a", "b")], indirect=["x", "z"])
 
     @pytest.mark.issue714
     def test_parametrize_uses_no_fixture_error_indirect_false(self, testdir):
         """The 'uses no fixture' error tells the user at collection time
         that the parametrize data they've set up doesn't correspond to the
         fixtures in their test function, rather than silently ignoring this
         and letting the test potentially pass.
         """
-        testdir.makepyfile("""
+        testdir.makepyfile(
+            """
             import pytest
 
             @pytest.mark.parametrize('x, y', [('a', 'b')], indirect=False)
             def test_simple(x):
                 assert len(x) == 3
-        """)
+        """
+        )
         result = testdir.runpytest("--collect-only")
-        result.stdout.fnmatch_lines([
-            "*uses no argument 'y'*",
-        ])
+        result.stdout.fnmatch_lines(["*uses no argument 'y'*"])
 
     @pytest.mark.issue714
     def test_parametrize_uses_no_fixture_error_indirect_true(self, testdir):
-        testdir.makepyfile("""
+        testdir.makepyfile(
+            """
             import pytest
             @pytest.fixture(scope='function')
             def x(request):
                 return request.param * 3
             @pytest.fixture(scope='function')
             def y(request):
                 return request.param * 2
 
             @pytest.mark.parametrize('x, y', [('a', 'b')], indirect=True)
             def test_simple(x):
                 assert len(x) == 3
-        """)
+        """
+        )
         result = testdir.runpytest("--collect-only")
-        result.stdout.fnmatch_lines([
-            "*uses no fixture 'y'*",
-        ])
+        result.stdout.fnmatch_lines(["*uses no fixture 'y'*"])
 
     @pytest.mark.issue714
     def test_parametrize_indirect_uses_no_fixture_error_indirect_string(self, testdir):
-        testdir.makepyfile("""
+        testdir.makepyfile(
+            """
             import pytest
             @pytest.fixture(scope='function')
             def x(request):
                 return request.param * 3
 
             @pytest.mark.parametrize('x, y', [('a', 'b')], indirect='y')
             def test_simple(x):
                 assert len(x) == 3
-        """)
+        """
+        )
         result = testdir.runpytest("--collect-only")
-        result.stdout.fnmatch_lines([
-            "*uses no fixture 'y'*",
-        ])
+        result.stdout.fnmatch_lines(["*uses no fixture 'y'*"])
 
     @pytest.mark.issue714
     def test_parametrize_indirect_uses_no_fixture_error_indirect_list(self, testdir):
-        testdir.makepyfile("""
+        testdir.makepyfile(
+            """
             import pytest
             @pytest.fixture(scope='function')
             def x(request):
                 return request.param * 3
 
             @pytest.mark.parametrize('x, y', [('a', 'b')], indirect=['y'])
             def test_simple(x):
                 assert len(x) == 3
-        """)
+        """
+        )
         result = testdir.runpytest("--collect-only")
-        result.stdout.fnmatch_lines([
-            "*uses no fixture 'y'*",
-        ])
+        result.stdout.fnmatch_lines(["*uses no fixture 'y'*"])
 
     @pytest.mark.issue714
     def test_parametrize_argument_not_in_indirect_list(self, testdir):
-        testdir.makepyfile("""
+        testdir.makepyfile(
+            """
             import pytest
             @pytest.fixture(scope='function')
             def x(request):
                 return request.param * 3
 
             @pytest.mark.parametrize('x, y', [('a', 'b')], indirect=['x'])
             def test_simple(x):
                 assert len(x) == 3
-        """)
+        """
+        )
         result = testdir.runpytest("--collect-only")
-        result.stdout.fnmatch_lines([
-            "*uses no argument 'y'*",
-        ])
+        result.stdout.fnmatch_lines(["*uses no argument 'y'*"])
+
+    def test_parametrize_gives_indicative_error_on_function_with_default_argument(
+        self, testdir
+    ):
+        testdir.makepyfile(
+            """
+            import pytest
+
+            @pytest.mark.parametrize('x, y', [('a', 'b')])
+            def test_simple(x, y=1):
+                assert len(x) == 1
+        """
+        )
+        result = testdir.runpytest("--collect-only")
+        result.stdout.fnmatch_lines(
+            ["*already takes an argument 'y' with a default value"]
+        )
 
     def test_addcalls_and_parametrize_indirect(self):
+
         def func(x, y):
             pass
+
         metafunc = self.Metafunc(func)
         metafunc.addcall(param="123")
-        metafunc.parametrize('x', [1], indirect=True)
-        metafunc.parametrize('y', [2, 3], indirect=True)
+        metafunc.parametrize("x", [1], indirect=True)
+        metafunc.parametrize("y", [2, 3], indirect=True)
         assert len(metafunc._calls) == 2
         assert metafunc._calls[0].funcargs == {}
         assert metafunc._calls[1].funcargs == {}
         assert metafunc._calls[0].params == dict(x=1, y=2)
         assert metafunc._calls[1].params == dict(x=1, y=3)
 
     def test_parametrize_functional(self, testdir):
-        testdir.makepyfile("""
+        testdir.makepyfile(
+            """
             import pytest
             def pytest_generate_tests(metafunc):
                 metafunc.parametrize('x', [1,2], indirect=True)
                 metafunc.parametrize('y', [2])
             @pytest.fixture
             def x(request):
                 return request.param * 10
 
             def test_simple(x,y):
                 assert x in (10,20)
                 assert y == 2
-        """)
+        """
+        )
         result = testdir.runpytest("-v")
-        result.stdout.fnmatch_lines([
-            "*test_simple*1-2*",
-            "*test_simple*2-2*",
-            "*2 passed*",
-        ])
+        result.stdout.fnmatch_lines(
+            ["*test_simple*1-2*", "*test_simple*2-2*", "*2 passed*"]
+        )
 
     def test_parametrize_onearg(self):
         metafunc = self.Metafunc(lambda x: None)
         metafunc.parametrize("x", [1, 2])
         assert len(metafunc._calls) == 2
         assert metafunc._calls[0].funcargs == dict(x=1)
         assert metafunc._calls[0].id == "1"
         assert metafunc._calls[1].funcargs == dict(x=2)
@@ -641,42 +761,47 @@ class TestMetafunc(object):
         metafunc.parametrize(("x", "y"), [(1, 2), (3, 4)])
         assert len(metafunc._calls) == 2
         assert metafunc._calls[0].funcargs == dict(x=1, y=2)
         assert metafunc._calls[0].id == "1-2"
         assert metafunc._calls[1].funcargs == dict(x=3, y=4)
         assert metafunc._calls[1].id == "3-4"
 
     def test_parametrize_multiple_times(self, testdir):
-        testdir.makepyfile("""
+        testdir.makepyfile(
+            """
             import pytest
             pytestmark = pytest.mark.parametrize("x", [1,2])
             def test_func(x):
                 assert 0, x
             class TestClass(object):
                 pytestmark = pytest.mark.parametrize("y", [3,4])
                 def test_meth(self, x, y):
                     assert 0, x
-        """)
+        """
+        )
         result = testdir.runpytest()
         assert result.ret == 1
         result.assert_outcomes(failed=6)
 
     def test_parametrize_CSV(self, testdir):
-        testdir.makepyfile("""
+        testdir.makepyfile(
+            """
             import pytest
             @pytest.mark.parametrize("x, y,", [(1,2), (2,3)])
             def test_func(x, y):
                 assert x+1 == y
-        """)
+        """
+        )
         reprec = testdir.inline_run()
         reprec.assertoutcome(passed=2)
 
     def test_parametrize_class_scenarios(self, testdir):
-        testdir.makepyfile("""
+        testdir.makepyfile(
+            """
         # same as doc/en/example/parametrize scenario example
         def pytest_generate_tests(metafunc):
             idlist = []
             argvalues = []
             for scenario in metafunc.cls.scenarios:
                 idlist.append(scenario[0])
                 items = scenario[1].items()
                 argnames = [x[0] for x in items]
@@ -690,52 +815,62 @@ class TestMetafunc(object):
                def test_1(self, arg, arg2):
                   pass
 
                def test_2(self, arg2, arg):
                   pass
 
                def test_3(self, arg, arg2):
                   pass
-        """)
+        """
+        )
         result = testdir.runpytest("-v")
         assert result.ret == 0
-        result.stdout.fnmatch_lines("""
+        result.stdout.fnmatch_lines(
+            """
             *test_1*1*
             *test_2*1*
             *test_3*1*
             *test_1*2*
             *test_2*2*
             *test_3*2*
             *6 passed*
-        """)
+        """
+        )
 
     def test_format_args(self):
+
         def function1():
             pass
-        assert fixtures._format_args(function1) == '()'
+
+        assert fixtures._format_args(function1) == "()"
 
         def function2(arg1):
             pass
+
         assert fixtures._format_args(function2) == "(arg1)"
 
         def function3(arg1, arg2="qwe"):
             pass
+
         assert fixtures._format_args(function3) == "(arg1, arg2='qwe')"
 
         def function4(arg1, *args, **kwargs):
             pass
+
         assert fixtures._format_args(function4) == "(arg1, *args, **kwargs)"
 
 
 class TestMetafuncFunctional(object):
+
     def test_attributes(self, testdir):
-        p = testdir.makepyfile("""
+        p = testdir.makepyfile(
+            """
             # assumes that generate/provide runs in the same process
-            import py, pytest
+            import sys, pytest
             def pytest_generate_tests(metafunc):
                 metafunc.addcall(param=metafunc)
 
             @pytest.fixture
             def metafunc(request):
                 assert request._pyfuncitem._genid == "0"
                 return request.param
 
@@ -744,500 +879,564 @@ class TestMetafuncFunctional(object):
                 assert metafunc.module.__name__ == __name__
                 assert metafunc.function == test_function
                 assert metafunc.cls is None
 
             class TestClass(object):
                 def test_method(self, metafunc, pytestconfig):
                     assert metafunc.config == pytestconfig
                     assert metafunc.module.__name__ == __name__
-                    if py.std.sys.version_info > (3, 0):
+                    if sys.version_info > (3, 0):
                         unbound = TestClass.test_method
                     else:
                         unbound = TestClass.test_method.im_func
                     # XXX actually have an unbound test function here?
                     assert metafunc.function == unbound
                     assert metafunc.cls == TestClass
-        """)
+        """
+        )
         result = testdir.runpytest(p, "-v")
         result.assert_outcomes(passed=2)
 
     def test_addcall_with_two_funcargs_generators(self, testdir):
-        testdir.makeconftest("""
+        testdir.makeconftest(
+            """
             def pytest_generate_tests(metafunc):
                 assert "arg1" in metafunc.fixturenames
                 metafunc.addcall(funcargs=dict(arg1=1, arg2=2))
-        """)
-        p = testdir.makepyfile("""
+        """
+        )
+        p = testdir.makepyfile(
+            """
             def pytest_generate_tests(metafunc):
                 metafunc.addcall(funcargs=dict(arg1=1, arg2=1))
 
             class TestClass(object):
                 def test_myfunc(self, arg1, arg2):
                     assert arg1 == arg2
-        """)
+        """
+        )
         result = testdir.runpytest("-v", p)
-        result.stdout.fnmatch_lines([
-            "*test_myfunc*0*PASS*",
-            "*test_myfunc*1*FAIL*",
-            "*1 failed, 1 passed*"
-        ])
+        result.stdout.fnmatch_lines(
+            ["*test_myfunc*0*PASS*", "*test_myfunc*1*FAIL*", "*1 failed, 1 passed*"]
+        )
 
     def test_two_functions(self, testdir):
-        p = testdir.makepyfile("""
+        p = testdir.makepyfile(
+            """
             def pytest_generate_tests(metafunc):
                 metafunc.addcall(param=10)
                 metafunc.addcall(param=20)
 
             import pytest
             @pytest.fixture
             def arg1(request):
                 return request.param
 
             def test_func1(arg1):
                 assert arg1 == 10
             def test_func2(arg1):
                 assert arg1 in (10, 20)
-        """)
+        """
+        )
         result = testdir.runpytest("-v", p)
-        result.stdout.fnmatch_lines([
-            "*test_func1*0*PASS*",
-            "*test_func1*1*FAIL*",
-            "*test_func2*PASS*",
-            "*1 failed, 3 passed*"
-        ])
+        result.stdout.fnmatch_lines(
+            [
+                "*test_func1*0*PASS*",
+                "*test_func1*1*FAIL*",
+                "*test_func2*PASS*",
+                "*1 failed, 3 passed*",
+            ]
+        )
 
     def test_noself_in_method(self, testdir):
-        p = testdir.makepyfile("""
+        p = testdir.makepyfile(
+            """
             def pytest_generate_tests(metafunc):
                 assert 'xyz' not in metafunc.fixturenames
 
             class TestHello(object):
                 def test_hello(xyz):
                     pass
-        """)
+        """
+        )
         result = testdir.runpytest(p)
         result.assert_outcomes(passed=1)
 
     def test_generate_plugin_and_module(self, testdir):
-        testdir.makeconftest("""
+        testdir.makeconftest(
+            """
             def pytest_generate_tests(metafunc):
                 assert "arg1" in metafunc.fixturenames
                 metafunc.addcall(id="world", param=(2,100))
-        """)
-        p = testdir.makepyfile("""
+        """
+        )
+        p = testdir.makepyfile(
+            """
             def pytest_generate_tests(metafunc):
                 metafunc.addcall(param=(1,1), id="hello")
 
             import pytest
             @pytest.fixture
             def arg1(request):
                 return request.param[0]
             @pytest.fixture
             def arg2(request):
                 return request.param[1]
 
             class TestClass(object):
                 def test_myfunc(self, arg1, arg2):
                     assert arg1 == arg2
-        """)
+        """
+        )
         result = testdir.runpytest("-v", p)
-        result.stdout.fnmatch_lines([
-            "*test_myfunc*hello*PASS*",
-            "*test_myfunc*world*FAIL*",
-            "*1 failed, 1 passed*"
-        ])
+        result.stdout.fnmatch_lines(
+            [
+                "*test_myfunc*hello*PASS*",
+                "*test_myfunc*world*FAIL*",
+                "*1 failed, 1 passed*",
+            ]
+        )
 
     def test_generate_tests_in_class(self, testdir):
-        p = testdir.makepyfile("""
+        p = testdir.makepyfile(
+            """
             class TestClass(object):
                 def pytest_generate_tests(self, metafunc):
                     metafunc.addcall(funcargs={'hello': 'world'}, id="hello")
 
                 def test_myfunc(self, hello):
                     assert hello == "world"
-        """)
+        """
+        )
         result = testdir.runpytest("-v", p)
-        result.stdout.fnmatch_lines([
-            "*test_myfunc*hello*PASS*",
-            "*1 passed*"
-        ])
+        result.stdout.fnmatch_lines(["*test_myfunc*hello*PASS*", "*1 passed*"])
 
     def test_two_functions_not_same_instance(self, testdir):
-        p = testdir.makepyfile("""
+        p = testdir.makepyfile(
+            """
             def pytest_generate_tests(metafunc):
                 metafunc.addcall({'arg1': 10})
                 metafunc.addcall({'arg1': 20})
 
             class TestClass(object):
                 def test_func(self, arg1):
                     assert not hasattr(self, 'x')
                     self.x = 1
-        """)
+        """
+        )
         result = testdir.runpytest("-v", p)
-        result.stdout.fnmatch_lines([
-            "*test_func*0*PASS*",
-            "*test_func*1*PASS*",
-            "*2 pass*",
-        ])
+        result.stdout.fnmatch_lines(
+            ["*test_func*0*PASS*", "*test_func*1*PASS*", "*2 pass*"]
+        )
 
     def test_issue28_setup_method_in_generate_tests(self, testdir):
-        p = testdir.makepyfile("""
+        p = testdir.makepyfile(
+            """
             def pytest_generate_tests(metafunc):
                 metafunc.addcall({'arg1': 1})
 
             class TestClass(object):
                 def test_method(self, arg1):
                     assert arg1 == self.val
                 def setup_method(self, func):
                     self.val = 1
-            """)
+            """
+        )
         result = testdir.runpytest(p)
         result.assert_outcomes(passed=1)
 
     def test_parametrize_functional2(self, testdir):
-        testdir.makepyfile("""
+        testdir.makepyfile(
+            """
             def pytest_generate_tests(metafunc):
                 metafunc.parametrize("arg1", [1,2])
                 metafunc.parametrize("arg2", [4,5])
             def test_hello(arg1, arg2):
                 assert 0, (arg1, arg2)
-        """)
+        """
+        )
         result = testdir.runpytest()
-        result.stdout.fnmatch_lines([
-            "*(1, 4)*",
-            "*(1, 5)*",
-            "*(2, 4)*",
-            "*(2, 5)*",
-            "*4 failed*",
-        ])
+        result.stdout.fnmatch_lines(
+            ["*(1, 4)*", "*(1, 5)*", "*(2, 4)*", "*(2, 5)*", "*4 failed*"]
+        )
 
     def test_parametrize_and_inner_getfixturevalue(self, testdir):
-        p = testdir.makepyfile("""
+        p = testdir.makepyfile(
+            """
             def pytest_generate_tests(metafunc):
                 metafunc.parametrize("arg1", [1], indirect=True)
                 metafunc.parametrize("arg2", [10], indirect=True)
 
             import pytest
             @pytest.fixture
             def arg1(request):
                 x = request.getfixturevalue("arg2")
                 return x + request.param
 
             @pytest.fixture
             def arg2(request):
                 return request.param
 
             def test_func1(arg1, arg2):
                 assert arg1 == 11
-        """)
+        """
+        )
         result = testdir.runpytest("-v", p)
-        result.stdout.fnmatch_lines([
-            "*test_func1*1*PASS*",
-            "*1 passed*"
-        ])
+        result.stdout.fnmatch_lines(["*test_func1*1*PASS*", "*1 passed*"])
 
     def test_parametrize_on_setup_arg(self, testdir):
-        p = testdir.makepyfile("""
+        p = testdir.makepyfile(
+            """
             def pytest_generate_tests(metafunc):
                 assert "arg1" in metafunc.fixturenames
                 metafunc.parametrize("arg1", [1], indirect=True)
 
             import pytest
             @pytest.fixture
             def arg1(request):
                 return request.param
 
             @pytest.fixture
             def arg2(request, arg1):
                 return 10 * arg1
 
             def test_func(arg2):
                 assert arg2 == 10
-        """)
+        """
+        )
         result = testdir.runpytest("-v", p)
-        result.stdout.fnmatch_lines([
-            "*test_func*1*PASS*",
-            "*1 passed*"
-        ])
+        result.stdout.fnmatch_lines(["*test_func*1*PASS*", "*1 passed*"])
 
     def test_parametrize_with_ids(self, testdir):
-        testdir.makepyfile("""
+        testdir.makeini(
+            """
+            [pytest]
+            console_output_style=classic
+        """
+        )
+        testdir.makepyfile(
+            """
             import pytest
             def pytest_generate_tests(metafunc):
                 metafunc.parametrize(("a", "b"), [(1,1), (1,2)],
                                      ids=["basic", "advanced"])
 
             def test_function(a, b):
                 assert a == b
-        """)
+        """
+        )
         result = testdir.runpytest("-v")
         assert result.ret == 1
-        result.stdout.fnmatch_lines_random([
-            "*test_function*basic*PASSED",
-            "*test_function*advanced*FAILED",
-        ])
+        result.stdout.fnmatch_lines_random(
+            ["*test_function*basic*PASSED", "*test_function*advanced*FAILED"]
+        )
 
     def test_parametrize_without_ids(self, testdir):
-        testdir.makepyfile("""
+        testdir.makepyfile(
+            """
             import pytest
             def pytest_generate_tests(metafunc):
                 metafunc.parametrize(("a", "b"),
                                      [(1,object()), (1.3,object())])
 
             def test_function(a, b):
                 assert 1
-        """)
+        """
+        )
         result = testdir.runpytest("-v")
-        result.stdout.fnmatch_lines("""
+        result.stdout.fnmatch_lines(
+            """
             *test_function*1-b0*
             *test_function*1.3-b1*
-        """)
+        """
+        )
 
     def test_parametrize_with_None_in_ids(self, testdir):
-        testdir.makepyfile("""
+        testdir.makepyfile(
+            """
             import pytest
             def pytest_generate_tests(metafunc):
                 metafunc.parametrize(("a", "b"), [(1,1), (1,1), (1,2)],
                                      ids=["basic", None, "advanced"])
 
             def test_function(a, b):
                 assert a == b
-        """)
+        """
+        )
         result = testdir.runpytest("-v")
         assert result.ret == 1
-        result.stdout.fnmatch_lines_random([
-            "*test_function*basic*PASSED",
-            "*test_function*1-1*PASSED",
-            "*test_function*advanced*FAILED",
-        ])
+        result.stdout.fnmatch_lines_random(
+            [
+                "*test_function*basic*PASSED*",
+                "*test_function*1-1*PASSED*",
+                "*test_function*advanced*FAILED*",
+            ]
+        )
 
     def test_fixture_parametrized_empty_ids(self, testdir):
         """Fixtures parametrized with empty ids cause an internal error (#1849)."""
-        testdir.makepyfile('''
+        testdir.makepyfile(
+            """
             import pytest
 
             @pytest.fixture(scope="module", ids=[], params=[])
             def temp(request):
                return request.param
 
             def test_temp(temp):
                  pass
-        ''')
+        """
+        )
         result = testdir.runpytest()
-        result.stdout.fnmatch_lines(['* 1 skipped *'])
+        result.stdout.fnmatch_lines(["* 1 skipped *"])
 
     def test_parametrized_empty_ids(self, testdir):
         """Tests parametrized with empty ids cause an internal error (#1849)."""
-        testdir.makepyfile('''
+        testdir.makepyfile(
+            """
             import pytest
 
             @pytest.mark.parametrize('temp', [], ids=list())
             def test_temp(temp):
                  pass
-        ''')
+        """
+        )
         result = testdir.runpytest()
-        result.stdout.fnmatch_lines(['* 1 skipped *'])
+        result.stdout.fnmatch_lines(["* 1 skipped *"])
 
     def test_parametrized_ids_invalid_type(self, testdir):
         """Tests parametrized with ids as non-strings (#1857)."""
-        testdir.makepyfile('''
+        testdir.makepyfile(
+            """
             import pytest
 
             @pytest.mark.parametrize("x, expected", [(10, 20), (40, 80)], ids=(None, 2))
             def test_ids_numbers(x,expected):
                 assert x * 2 == expected
-        ''')
+        """
+        )
         result = testdir.runpytest()
-        result.stdout.fnmatch_lines(['*ids must be list of strings, found: 2 (type: int)*'])
+        result.stdout.fnmatch_lines(
+            ["*ids must be list of strings, found: 2 (type: int)*"]
+        )
 
     def test_parametrize_with_identical_ids_get_unique_names(self, testdir):
-        testdir.makepyfile("""
+        testdir.makepyfile(
+            """
             import pytest
             def pytest_generate_tests(metafunc):
                 metafunc.parametrize(("a", "b"), [(1,1), (1,2)],
                                      ids=["a", "a"])
 
             def test_function(a, b):
                 assert a == b
-        """)
+        """
+        )
         result = testdir.runpytest("-v")
         assert result.ret == 1
-        result.stdout.fnmatch_lines_random([
-            "*test_function*a0*PASSED",
-            "*test_function*a1*FAILED"
-        ])
+        result.stdout.fnmatch_lines_random(
+            ["*test_function*a0*PASSED*", "*test_function*a1*FAILED*"]
+        )
 
-    @pytest.mark.parametrize(("scope", "length"),
-                             [("module", 2), ("function", 4)])
+    @pytest.mark.parametrize(("scope", "length"), [("module", 2), ("function", 4)])
     def test_parametrize_scope_overrides(self, testdir, scope, length):
-        testdir.makepyfile("""
+        testdir.makepyfile(
+            """
             import pytest
             values = []
             def pytest_generate_tests(metafunc):
                 if "arg" in metafunc.funcargnames:
                     metafunc.parametrize("arg", [1,2], indirect=True,
                                          scope=%r)
             @pytest.fixture
             def arg(request):
                 values.append(request.param)
                 return request.param
             def test_hello(arg):
                 assert arg in (1,2)
             def test_world(arg):
                 assert arg in (1,2)
             def test_checklength():
                 assert len(values) == %d
-        """ % (scope, length))
+        """
+            % (scope, length)
+        )
         reprec = testdir.inline_run()
         reprec.assertoutcome(passed=5)
 
     def test_parametrize_issue323(self, testdir):
-        testdir.makepyfile("""
+        testdir.makepyfile(
+            """
             import pytest
 
             @pytest.fixture(scope='module', params=range(966))
             def foo(request):
                 return request.param
 
             def test_it(foo):
                 pass
             def test_it2(foo):
                 pass
-        """)
+        """
+        )
         reprec = testdir.inline_run("--collect-only")
         assert not reprec.getcalls("pytest_internalerror")
 
     def test_usefixtures_seen_in_generate_tests(self, testdir):
-        testdir.makepyfile("""
+        testdir.makepyfile(
+            """
             import pytest
             def pytest_generate_tests(metafunc):
                 assert "abc" in metafunc.fixturenames
                 metafunc.parametrize("abc", [1])
 
             @pytest.mark.usefixtures("abc")
             def test_function():
                 pass
-        """)
+        """
+        )
         reprec = testdir.runpytest()
         reprec.assert_outcomes(passed=1)
 
     def test_generate_tests_only_done_in_subdir(self, testdir):
         sub1 = testdir.mkpydir("sub1")
         sub2 = testdir.mkpydir("sub2")
-        sub1.join("conftest.py").write(_pytest._code.Source("""
+        sub1.join("conftest.py").write(
+            _pytest._code.Source(
+                """
             def pytest_generate_tests(metafunc):
                 assert metafunc.function.__name__ == "test_1"
-        """))
-        sub2.join("conftest.py").write(_pytest._code.Source("""
+        """
+            )
+        )
+        sub2.join("conftest.py").write(
+            _pytest._code.Source(
+                """
             def pytest_generate_tests(metafunc):
                 assert metafunc.function.__name__ == "test_2"
-        """))
+        """
+            )
+        )
         sub1.join("test_in_sub1.py").write("def test_1(): pass")
         sub2.join("test_in_sub2.py").write("def test_2(): pass")
         result = testdir.runpytest("--keep-duplicates", "-v", "-s", sub1, sub2, sub1)
         result.assert_outcomes(passed=3)
 
     def test_generate_same_function_names_issue403(self, testdir):
-        testdir.makepyfile("""
+        testdir.makepyfile(
+            """
             import pytest
 
             def make_tests():
                 @pytest.mark.parametrize("x", range(2))
                 def test_foo(x):
                     pass
                 return test_foo
 
             test_x = make_tests()
             test_y = make_tests()
-        """)
+        """
+        )
         reprec = testdir.runpytest()
         reprec.assert_outcomes(passed=4)
 
     @pytest.mark.issue463
-    @pytest.mark.parametrize('attr', ['parametrise', 'parameterize',
-                                      'parameterise'])
+    @pytest.mark.parametrize("attr", ["parametrise", "parameterize", "parameterise"])
     def test_parametrize_misspelling(self, testdir, attr):
-        testdir.makepyfile("""
+        testdir.makepyfile(
+            """
             import pytest
 
-            @pytest.mark.{0}("x", range(2))
+            @pytest.mark.{}("x", range(2))
             def test_foo(x):
                 pass
-        """.format(attr))
-        reprec = testdir.inline_run('--collectonly')
+        """.format(
+                attr
+            )
+        )
+        reprec = testdir.inline_run("--collectonly")
         failures = reprec.getfailures()
         assert len(failures) == 1
-        expectederror = "MarkerError: test_foo has '{0}', spelling should be 'parametrize'".format(attr)
+        expectederror = "MarkerError: test_foo has '{}', spelling should be 'parametrize'".format(
+            attr
+        )
         assert expectederror in failures[0].longrepr.reprcrash.message
 
 
 class TestMetafuncFunctionalAuto(object):
     """
     Tests related to automatically find out the correct scope for parametrized tests (#1832).
     """
 
     def test_parametrize_auto_scope(self, testdir):
-        testdir.makepyfile('''
+        testdir.makepyfile(
+            """
             import pytest
 
             @pytest.fixture(scope='session', autouse=True)
             def fixture():
                 return 1
 
             @pytest.mark.parametrize('animal', ["dog", "cat"])
             def test_1(animal):
                 assert animal in ('dog', 'cat')
 
             @pytest.mark.parametrize('animal', ['fish'])
             def test_2(animal):
                 assert animal == 'fish'
 
-        ''')
+        """
+        )
         result = testdir.runpytest()
-        result.stdout.fnmatch_lines(['* 3 passed *'])
+        result.stdout.fnmatch_lines(["* 3 passed *"])
 
     def test_parametrize_auto_scope_indirect(self, testdir):
-        testdir.makepyfile('''
+        testdir.makepyfile(
+            """
             import pytest
 
             @pytest.fixture(scope='session')
             def echo(request):
                 return request.param
 
             @pytest.mark.parametrize('animal, echo', [("dog", 1), ("cat", 2)], indirect=['echo'])
             def test_1(animal, echo):
                 assert animal in ('dog', 'cat')
                 assert echo in (1, 2, 3)
 
             @pytest.mark.parametrize('animal, echo', [('fish', 3)], indirect=['echo'])
             def test_2(animal, echo):
                 assert animal == 'fish'
                 assert echo in (1, 2, 3)
-        ''')
+        """
+        )
         result = testdir.runpytest()
-        result.stdout.fnmatch_lines(['* 3 passed *'])
+        result.stdout.fnmatch_lines(["* 3 passed *"])
 
     def test_parametrize_auto_scope_override_fixture(self, testdir):
-        testdir.makepyfile('''
+        testdir.makepyfile(
+            """
             import pytest
 
             @pytest.fixture(scope='session', autouse=True)
             def animal():
                 return 'fox'
 
             @pytest.mark.parametrize('animal', ["dog", "cat"])
             def test_1(animal):
                 assert animal in ('dog', 'cat')
-        ''')
+        """
+        )
         result = testdir.runpytest()
-        result.stdout.fnmatch_lines(['* 2 passed *'])
+        result.stdout.fnmatch_lines(["* 2 passed *"])
 
     def test_parametrize_all_indirects(self, testdir):
-        testdir.makepyfile('''
+        testdir.makepyfile(
+            """
             import pytest
 
             @pytest.fixture()
             def animal(request):
                 return request.param
 
             @pytest.fixture(scope='session')
             def echo(request):
@@ -1247,22 +1446,24 @@ class TestMetafuncFunctionalAuto(object)
             def test_1(animal, echo):
                 assert animal in ('dog', 'cat')
                 assert echo in (1, 2, 3)
 
             @pytest.mark.parametrize('animal, echo', [("fish", 3)], indirect=True)
             def test_2(animal, echo):
                 assert animal == 'fish'
                 assert echo in (1, 2, 3)
-        ''')
+        """
+        )
         result = testdir.runpytest()
-        result.stdout.fnmatch_lines(['* 3 passed *'])
+        result.stdout.fnmatch_lines(["* 3 passed *"])
 
     def test_parametrize_issue634(self, testdir):
-        testdir.makepyfile('''
+        testdir.makepyfile(
+            """
             import pytest
 
             @pytest.fixture(scope='module')
             def foo(request):
                 print('preparing foo-%d' % request.param)
                 return 'foo-%d' % request.param
 
             def test_one(foo):
@@ -1277,24 +1478,25 @@ class TestMetafuncFunctionalAuto(object)
                 params = (1, 2, 3, 4)
                 if not 'foo' in metafunc.fixturenames:
                     return
 
                 test_with = getattr(metafunc.function, 'test_with', None)
                 if test_with:
                     params = test_with
                 metafunc.parametrize('foo', params, indirect=True)
-        ''')
+        """
+        )
         result = testdir.runpytest("-s")
         output = result.stdout.str()
-        assert output.count('preparing foo-2') == 1
-        assert output.count('preparing foo-3') == 1
+        assert output.count("preparing foo-2") == 1
+        assert output.count("preparing foo-3") == 1
 
 
-@pytest.mark.filterwarnings('ignore:Applying marks directly to parameters')
+@pytest.mark.filterwarnings("ignore:Applying marks directly to parameters")
 @pytest.mark.issue308
 class TestMarkersWithParametrization(object):
 
     def test_simple_mark(self, testdir):
         s = """
             import pytest
 
             @pytest.mark.foo
@@ -1304,35 +1506,35 @@ class TestMarkersWithParametrization(obj
                 (2, 3),
             ])
             def test_increment(n, expected):
                 assert n + 1 == expected
         """
         items = testdir.getitems(s)
         assert len(items) == 3
         for item in items:
-            assert 'foo' in item.keywords
-        assert 'bar' not in items[0].keywords
-        assert 'bar' in items[1].keywords
-        assert 'bar' not in items[2].keywords
+            assert "foo" in item.keywords
+        assert "bar" not in items[0].keywords
+        assert "bar" in items[1].keywords
+        assert "bar" not in items[2].keywords
 
     def test_select_based_on_mark(self, testdir):
         s = """
             import pytest
 
             @pytest.mark.parametrize(("n", "expected"), [
                 (1, 2),
                 pytest.mark.foo((2, 3)),
                 (3, 4),
             ])
             def test_increment(n, expected):
                 assert n + 1 == expected
         """
         testdir.makepyfile(s)
-        rec = testdir.inline_run("-m", 'foo')
+        rec = testdir.inline_run("-m", "foo")
         passed, skipped, fail = rec.listoutcomes()
         assert len(passed) == 1
         assert len(skipped) == 0
         assert len(fail) == 0
 
     @pytest.mark.xfail(reason="is this important to support??")
     def test_nested_marks(self, testdir):
         s = """
@@ -1344,17 +1546,17 @@ class TestMarkersWithParametrization(obj
                 mastermark((1, 3)),
                 (2, 3),
             ])
             def test_increment(n, expected):
                 assert n + 1 == expected
         """
         items = testdir.getitems(s)
         assert len(items) == 3
-        for mark in ['foo', 'bar']:
+        for mark in ["foo", "bar"]:
             assert mark not in items[0].keywords
             assert mark in items[1].keywords
             assert mark not in items[2].keywords
 
     def test_simple_xfail(self, testdir):
         s = """
             import pytest
 
@@ -1430,29 +1632,31 @@ class TestMarkersWithParametrization(obj
             ])
             def test_increment(n, expected):
                 assert n + 1 == expected
         """
         testdir.makepyfile(s)
         reprec = testdir.inline_run()
         reprec.assertoutcome(passed=2, skipped=1)
 
-    @pytest.mark.parametrize('strict', [True, False])
+    @pytest.mark.parametrize("strict", [True, False])
     def test_xfail_passing_is_xpass(self, testdir, strict):
         s = """
             import pytest
 
             @pytest.mark.parametrize(("n", "expected"), [
                 (1, 2),
                 pytest.mark.xfail("sys.version_info > (0, 0, 0)", reason="some bug", strict={strict})((2, 3)),
                 (3, 4),
             ])
             def test_increment(n, expected):
                 assert n + 1 == expected
-        """.format(strict=strict)
+        """.format(
+            strict=strict
+        )
         testdir.makepyfile(s)
         reprec = testdir.inline_run()
         passed, failed = (2, 1) if strict else (3, 0)
         reprec.assertoutcome(passed=passed, failed=failed)
 
     def test_parametrize_called_in_generate_tests(self, testdir):
         s = """
             import pytest
@@ -1473,85 +1677,92 @@ class TestMarkersWithParametrization(obj
                 assert n + 1 == expected
         """
         testdir.makepyfile(s)
         reprec = testdir.inline_run()
         reprec.assertoutcome(passed=2, skipped=2)
 
     @pytest.mark.issue290
     def test_parametrize_ID_generation_string_int_works(self, testdir):
-        testdir.makepyfile("""
+        testdir.makepyfile(
+            """
             import pytest
 
             @pytest.fixture
             def myfixture():
                 return 'example'
             @pytest.mark.parametrize(
                 'limit', (0, '0'))
             def test_limit(limit, myfixture):
                 return
-        """)
+        """
+        )
         reprec = testdir.inline_run()
         reprec.assertoutcome(passed=2)
 
-    @pytest.mark.parametrize('strict', [True, False])
+    @pytest.mark.parametrize("strict", [True, False])
     def test_parametrize_marked_value(self, testdir, strict):
         s = """
             import pytest
 
             @pytest.mark.parametrize(("n", "expected"), [
                 pytest.param(
                     2,3,
                     marks=pytest.mark.xfail("sys.version_info > (0, 0, 0)", reason="some bug", strict={strict}),
                 ),
                 pytest.param(
                     2,3,
                     marks=[pytest.mark.xfail("sys.version_info > (0, 0, 0)", reason="some bug", strict={strict})],
                 ),
             ])
             def test_increment(n, expected):
                 assert n + 1 == expected
-        """.format(strict=strict)
+        """.format(
+            strict=strict
+        )
         testdir.makepyfile(s)
         reprec = testdir.inline_run()
         passed, failed = (0, 2) if strict else (2, 0)
         reprec.assertoutcome(passed=passed, failed=failed)
 
     def test_pytest_make_parametrize_id(self, testdir):
-        testdir.makeconftest("""
+        testdir.makeconftest(
+            """
             def pytest_make_parametrize_id(config, val):
                 return str(val * 2)
-        """)
-        testdir.makepyfile("""
+        """
+        )
+        testdir.makepyfile(
+            """
                 import pytest
 
                 @pytest.mark.parametrize("x", range(2))
                 def test_func(x):
                     pass
-                """)
+                """
+        )
         result = testdir.runpytest("-v")
-        result.stdout.fnmatch_lines([
-            "*test_func*0*PASS*",
-            "*test_func*2*PASS*",
-        ])
+        result.stdout.fnmatch_lines(["*test_func*0*PASS*", "*test_func*2*PASS*"])
 
     def test_pytest_make_parametrize_id_with_argname(self, testdir):
-        testdir.makeconftest("""
+        testdir.makeconftest(
+            """
             def pytest_make_parametrize_id(config, val, argname):
                 return str(val * 2 if argname == 'x' else val * 10)
-        """)
-        testdir.makepyfile("""
+        """
+        )
+        testdir.makepyfile(
+            """
                 import pytest
 
                 @pytest.mark.parametrize("x", range(2))
                 def test_func_a(x):
                     pass
 
                 @pytest.mark.parametrize("y", [1])
                 def test_func_b(y):
                     pass
-                """)
+                """
+        )
         result = testdir.runpytest("-v")
-        result.stdout.fnmatch_lines([
-            "*test_func_a*0*PASS*",
-            "*test_func_a*2*PASS*",
-            "*test_func_b*10*PASS*",
-        ])
+        result.stdout.fnmatch_lines(
+            ["*test_func_a*0*PASS*", "*test_func_a*2*PASS*", "*test_func_b*10*PASS*"]
+        )
--- a/third_party/python/pytest/testing/python/raises.py
+++ b/third_party/python/pytest/testing/python/raises.py
@@ -1,40 +1,46 @@
+from _pytest.outcomes import Failed
 import pytest
 import sys
 
 
 class TestRaises(object):
+
     def test_raises(self):
         source = "int('qwe')"
         excinfo = pytest.raises(ValueError, source)
         code = excinfo.traceback[-1].frame.code
         s = str(code.fullsource)
         assert s == source
 
     def test_raises_exec(self):
         pytest.raises(ValueError, "a,x = []")
 
     def test_raises_syntax_error(self):
         pytest.raises(SyntaxError, "qwe qwe qwe")
 
     def test_raises_function(self):
-        pytest.raises(ValueError, int, 'hello')
+        pytest.raises(ValueError, int, "hello")
 
     def test_raises_callable_no_exception(self):
+
         class A(object):
+
             def __call__(self):
                 pass
+
         try:
             pytest.raises(ValueError, A())
         except pytest.raises.Exception:
             pass
 
     def test_raises_as_contextmanager(self, testdir):
-        testdir.makepyfile("""
+        testdir.makepyfile(
+            """
             from __future__ import with_statement
             import py, pytest
             import _pytest._code
 
             def test_simple():
                 with pytest.raises(ZeroDivisionError) as excinfo:
                     assert isinstance(excinfo, _pytest._code.ExceptionInfo)
                     1/0
@@ -46,69 +52,74 @@ class TestRaises(object):
                 with pytest.raises(pytest.raises.Exception):
                     with pytest.raises(ValueError):
                            int()
 
             def test_raise_wrong_exception_passes_by():
                 with pytest.raises(ZeroDivisionError):
                     with pytest.raises(ValueError):
                            1/0
-        """)
+        """
+        )
         result = testdir.runpytest()
-        result.stdout.fnmatch_lines([
-            '*3 passed*',
-        ])
+        result.stdout.fnmatch_lines(["*3 passed*"])
 
     def test_noclass(self):
         with pytest.raises(TypeError):
-            pytest.raises('wrong', lambda: None)
+            pytest.raises("wrong", lambda: None)
+
+    def test_invalid_arguments_to_raises(self):
+        with pytest.raises(TypeError, match="unknown"):
+            with pytest.raises(TypeError, unknown="bogus"):
+                raise ValueError()
 
     def test_tuple(self):
         with pytest.raises((KeyError, ValueError)):
-            raise KeyError('oops')
+            raise KeyError("oops")
 
     def test_no_raise_message(self):
         try:
-            pytest.raises(ValueError, int, '0')
+            pytest.raises(ValueError, int, "0")
         except pytest.raises.Exception as e:
-            assert e.msg == "DID NOT RAISE {0}".format(repr(ValueError))
+            assert e.msg == "DID NOT RAISE {}".format(repr(ValueError))
         else:
             assert False, "Expected pytest.raises.Exception"
 
         try:
             with pytest.raises(ValueError):
                 pass
         except pytest.raises.Exception as e:
-            assert e.msg == "DID NOT RAISE {0}".format(repr(ValueError))
+            assert e.msg == "DID NOT RAISE {}".format(repr(ValueError))
         else:
             assert False, "Expected pytest.raises.Exception"
 
     def test_custom_raise_message(self):
         message = "TEST_MESSAGE"
         try:
             with pytest.raises(ValueError, message=message):
                 pass
         except pytest.raises.Exception as e:
             assert e.msg == message
         else:
             assert False, "Expected pytest.raises.Exception"
 
-    @pytest.mark.parametrize('method', ['function', 'with'])
+    @pytest.mark.parametrize("method", ["function", "with"])
     def test_raises_cyclic_reference(self, method):
         """
         Ensure pytest.raises does not leave a reference cycle (#1965).
         """
         import gc
 
         class T(object):
+
             def __call__(self):
                 raise ValueError
 
         t = T()
-        if method == 'function':
+        if method == "function":
             pytest.raises(ValueError, t)
         else:
             with pytest.raises(ValueError):
                 t()
 
         # ensure both forms of pytest.raises don't leave exceptions in sys.exc_info()
         assert sys.exc_info() == (None, None, None)
 
@@ -116,19 +127,51 @@ class TestRaises(object):
 
         # ensure the t instance is not stuck in a cyclic reference
         for o in gc.get_objects():
             assert type(o) is not T
 
     def test_raises_match(self):
         msg = r"with base \d+"
         with pytest.raises(ValueError, match=msg):
-            int('asdf')
+            int("asdf")
 
         msg = "with base 10"
         with pytest.raises(ValueError, match=msg):
-            int('asdf')
+            int("asdf")
 
         msg = "with base 16"
-        expr = r"Pattern '{0}' not found in 'invalid literal for int\(\) with base 10: 'asdf''".format(msg)
+        expr = r"Pattern '{}' not found in 'invalid literal for int\(\) with base 10: 'asdf''".format(
+            msg
+        )
         with pytest.raises(AssertionError, match=expr):
             with pytest.raises(ValueError, match=msg):
-                int('asdf', base=10)
+                int("asdf", base=10)
+
+    def test_raises_match_wrong_type(self):
+        """Raising an exception with the wrong type and match= given.
+
+        pytest should throw the unexpected exception - the pattern match is not
+        really relevant if we got a different exception.
+        """
+        with pytest.raises(ValueError):
+            with pytest.raises(IndexError, match="nomatch"):
+                int("asdf")
+
+    def test_raises_exception_looks_iterable(self):
+        from six import add_metaclass
+
+        class Meta(type(object)):
+
+            def __getitem__(self, item):
+                return 1 / 0
+
+            def __len__(self):
+                return 1
+
+        @add_metaclass(Meta)
+        class ClassLooksIterableException(Exception):
+            pass
+
+        with pytest.raises(
+            Failed, match="DID NOT RAISE <class 'raises.ClassLooksIterableException'>"
+        ):
+            pytest.raises(ClassLooksIterableException, lambda: None)
--- a/third_party/python/pytest/testing/python/setup_only.py
+++ b/third_party/python/pytest/testing/python/setup_only.py
@@ -1,243 +1,269 @@
 import pytest
 
 
-@pytest.fixture(params=['--setup-only', '--setup-plan', '--setup-show'],
-                scope='module')
+@pytest.fixture(params=["--setup-only", "--setup-plan", "--setup-show"], scope="module")
 def mode(request):
     return request.param
 
 
 def test_show_only_active_fixtures(testdir, mode):
-    p = testdir.makepyfile('''
+    p = testdir.makepyfile(
+        '''
         import pytest
         @pytest.fixture
         def _arg0():
             """hidden arg0 fixture"""
         @pytest.fixture
         def arg1():
             """arg1 docstring"""
         def test_arg1(arg1):
             pass
-    ''')
+    '''
+    )
 
     result = testdir.runpytest(mode, p)
     assert result.ret == 0
 
-    result.stdout.fnmatch_lines([
-        '*SETUP    F arg1*',
-        '*test_arg1 (fixtures used: arg1)*',
-        '*TEARDOWN F arg1*',
-    ])
+    result.stdout.fnmatch_lines(
+        ["*SETUP    F arg1*", "*test_arg1 (fixtures used: arg1)*", "*TEARDOWN F arg1*"]
+    )
     assert "_arg0" not in result.stdout.str()
 
 
 def test_show_different_scopes(testdir, mode):
-    p = testdir.makepyfile('''
+    p = testdir.makepyfile(
+        '''
         import pytest
         @pytest.fixture
         def arg_function():
             """function scoped fixture"""
         @pytest.fixture(scope='session')
         def arg_session():
             """session scoped fixture"""
         def test_arg1(arg_session, arg_function):
             pass
-    ''')
+    '''
+    )
 
     result = testdir.runpytest(mode, p)
     assert result.ret == 0
 
-    result.stdout.fnmatch_lines([
-        'SETUP    S arg_session*',
-        '*SETUP    F arg_function*',
-        '*test_arg1 (fixtures used: arg_function, arg_session)*',
-        '*TEARDOWN F arg_function*',
-        'TEARDOWN S arg_session*',
-    ])
+    result.stdout.fnmatch_lines(
+        [
+            "SETUP    S arg_session*",
+            "*SETUP    F arg_function*",
+            "*test_arg1 (fixtures used: arg_function, arg_session)*",
+            "*TEARDOWN F arg_function*",
+            "TEARDOWN S arg_session*",
+        ]
+    )
 
 
 def test_show_nested_fixtures(testdir, mode):
-    testdir.makeconftest('''
+    testdir.makeconftest(
+        '''
         import pytest
         @pytest.fixture(scope='session')
         def arg_same():
             """session scoped fixture"""
-        ''')
-    p = testdir.makepyfile('''
+        '''
+    )
+    p = testdir.makepyfile(
+        '''
         import pytest
         @pytest.fixture(scope='function')
         def arg_same(arg_same):
             """function scoped fixture"""
         def test_arg1(arg_same):
             pass
-    ''')
+    '''
+    )
 
     result = testdir.runpytest(mode, p)
     assert result.ret == 0
 
-    result.stdout.fnmatch_lines([
-        'SETUP    S arg_same*',
-        '*SETUP    F arg_same (fixtures used: arg_same)*',
-        '*test_arg1 (fixtures used: arg_same)*',
-        '*TEARDOWN F arg_same*',
-        'TEARDOWN S arg_same*',
-    ])
+    result.stdout.fnmatch_lines(
+        [
+            "SETUP    S arg_same*",
+            "*SETUP    F arg_same (fixtures used: arg_same)*",
+            "*test_arg1 (fixtures used: arg_same)*",
+            "*TEARDOWN F arg_same*",
+            "TEARDOWN S arg_same*",
+        ]
+    )
 
 
 def test_show_fixtures_with_autouse(testdir, mode):
-    p = testdir.makepyfile('''
+    p = testdir.makepyfile(
+        '''
         import pytest
         @pytest.fixture
         def arg_function():
             """function scoped fixture"""
         @pytest.fixture(scope='session', autouse=True)
         def arg_session():
             """session scoped fixture"""
         def test_arg1(arg_function):
             pass
-    ''')
+    '''
+    )
 
     result = testdir.runpytest(mode, p)
     assert result.ret == 0
 
-    result.stdout.fnmatch_lines([
-        'SETUP    S arg_session*',
-        '*SETUP    F arg_function*',
-        '*test_arg1 (fixtures used: arg_function, arg_session)*',
-    ])
+    result.stdout.fnmatch_lines(
+        [
+            "SETUP    S arg_session*",
+            "*SETUP    F arg_function*",
+            "*test_arg1 (fixtures used: arg_function, arg_session)*",
+        ]
+    )
 
 
 def test_show_fixtures_with_parameters(testdir, mode):
-    testdir.makeconftest('''
+    testdir.makeconftest(
+        '''
         import pytest
         @pytest.fixture(scope='session', params=['foo', 'bar'])
         def arg_same():
             """session scoped fixture"""
-        ''')
-    p = testdir.makepyfile('''
+        '''
+    )
+    p = testdir.makepyfile(
+        '''
         import pytest
         @pytest.fixture(scope='function')
         def arg_other(arg_same):
             """function scoped fixture"""
         def test_arg1(arg_other):
             pass
-    ''')
+    '''
+    )
 
     result = testdir.runpytest(mode, p)
     assert result.ret == 0
 
-    result.stdout.fnmatch_lines([
-        'SETUP    S arg_same?foo?',
-        'TEARDOWN S arg_same?foo?',
-        'SETUP    S arg_same?bar?',
-        'TEARDOWN S arg_same?bar?',
-    ])
+    result.stdout.fnmatch_lines(
+        [
+            "SETUP    S arg_same?foo?",
+            "TEARDOWN S arg_same?foo?",
+            "SETUP    S arg_same?bar?",
+            "TEARDOWN S arg_same?bar?",
+        ]
+    )
 
 
 def test_show_fixtures_with_parameter_ids(testdir, mode):
-    testdir.makeconftest('''
+    testdir.makeconftest(
+        '''
         import pytest
         @pytest.fixture(
             scope='session', params=['foo', 'bar'], ids=['spam', 'ham'])
         def arg_same():
             """session scoped fixture"""
-        ''')
-    p = testdir.makepyfile('''
+        '''
+    )
+    p = testdir.makepyfile(
+        '''
         import pytest
         @pytest.fixture(scope='function')
         def arg_other(arg_same):
             """function scoped fixture"""
         def test_arg1(arg_other):
             pass
-    ''')
+    '''
+    )
 
     result = testdir.runpytest(mode, p)
     assert result.ret == 0
 
-    result.stdout.fnmatch_lines([
-        'SETUP    S arg_same?spam?',
-        'SETUP    S arg_same?ham?',
-    ])
+    result.stdout.fnmatch_lines(
+        ["SETUP    S arg_same?spam?", "SETUP    S arg_same?ham?"]
+    )
 
 
 def test_show_fixtures_with_parameter_ids_function(testdir, mode):
-    p = testdir.makepyfile('''
+    p = testdir.makepyfile(
+        """
         import pytest
         @pytest.fixture(params=['foo', 'bar'], ids=lambda p: p.upper())
         def foobar():
             pass
         def test_foobar(foobar):
             pass
-    ''')
+    """
+    )
 
     result = testdir.runpytest(mode, p)
     assert result.ret == 0
 
-    result.stdout.fnmatch_lines([
-        '*SETUP    F foobar?FOO?',
-        '*SETUP    F foobar?BAR?',
-    ])
+    result.stdout.fnmatch_lines(["*SETUP    F foobar?FOO?", "*SETUP    F foobar?BAR?"])
 
 
 def test_dynamic_fixture_request(testdir):
-    p = testdir.makepyfile('''
+    p = testdir.makepyfile(
+        """
         import pytest
         @pytest.fixture()
         def dynamically_requested_fixture():
             pass
         @pytest.fixture()
         def dependent_fixture(request):
             request.getfixturevalue('dynamically_requested_fixture')
         def test_dyn(dependent_fixture):
             pass
-    ''')
+    """
+    )
 
-    result = testdir.runpytest('--setup-only', p)
+    result = testdir.runpytest("--setup-only", p)
     assert result.ret == 0
 
-    result.stdout.fnmatch_lines([
-        '*SETUP    F dynamically_requested_fixture',
-        '*TEARDOWN F dynamically_requested_fixture'
-    ])
+    result.stdout.fnmatch_lines(
+        [
+            "*SETUP    F dynamically_requested_fixture",
+            "*TEARDOWN F dynamically_requested_fixture",
+        ]
+    )
 
 
 def test_capturing(testdir):
-    p = testdir.makepyfile('''
+    p = testdir.makepyfile(
+        """
         import pytest, sys
         @pytest.fixture()
         def one():
             sys.stdout.write('this should be captured')
             sys.stderr.write('this should also be captured')
         @pytest.fixture()
         def two(one):
             assert 0
         def test_capturing(two):
             pass
-    ''')
+    """
+    )
 
-    result = testdir.runpytest('--setup-only', p)
-    result.stdout.fnmatch_lines([
-        'this should be captured',
-        'this should also be captured'
-    ])
+    result = testdir.runpytest("--setup-only", p)
+    result.stdout.fnmatch_lines(
+        ["this should be captured", "this should also be captured"]
+    )
 
 
 def test_show_fixtures_and_execute_test(testdir):
     """ Verifies that setups are shown and tests are executed. """
-    p = testdir.makepyfile('''
+    p = testdir.makepyfile(
+        """
         import pytest
         @pytest.fixture
         def arg():
             assert True
         def test_arg(arg):
             assert False
-    ''')
+    """
+    )
 
     result = testdir.runpytest("--setup-show", p)
     assert result.ret == 1
 
-    result.stdout.fnmatch_lines([
-        '*SETUP    F arg*',
-        '*test_arg (fixtures used: arg)F',
-        '*TEARDOWN F arg*',
-    ])
+    result.stdout.fnmatch_lines(
+        ["*SETUP    F arg*", "*test_arg (fixtures used: arg)F*", "*TEARDOWN F arg*"]
+    )
--- a/third_party/python/pytest/testing/python/setup_plan.py
+++ b/third_party/python/pytest/testing/python/setup_plan.py
@@ -1,19 +1,19 @@
 def test_show_fixtures_and_test(testdir):
     """ Verifies that fixtures are not executed. """
-    p = testdir.makepyfile('''
+    p = testdir.makepyfile(
+        """
         import pytest
         @pytest.fixture
         def arg():
             assert False
         def test_arg(arg):
             assert False
-    ''')
+    """
+    )
 
     result = testdir.runpytest("--setup-plan", p)
     assert result.ret == 0
 
-    result.stdout.fnmatch_lines([
-        '*SETUP    F arg*',
-        '*test_arg (fixtures used: arg)',
-        '*TEARDOWN F arg*',
-    ])
+    result.stdout.fnmatch_lines(
+        ["*SETUP    F arg*", "*test_arg (fixtures used: arg)", "*TEARDOWN F arg*"]
+    )
--- a/third_party/python/pytest/testing/python/show_fixtures_per_test.py
+++ b/third_party/python/pytest/testing/python/show_fixtures_per_test.py
@@ -1,158 +1,183 @@
 # -*- coding: utf-8 -*-
 
 
 def test_no_items_should_not_show_output(testdir):
-    result = testdir.runpytest('--fixtures-per-test')
-    assert 'fixtures used by' not in result.stdout.str()
+    result = testdir.runpytest("--fixtures-per-test")
+    assert "fixtures used by" not in result.stdout.str()
     assert result.ret == 0
 
 
 def test_fixtures_in_module(testdir):
-    p = testdir.makepyfile('''
+    p = testdir.makepyfile(
+        '''
         import pytest
         @pytest.fixture
         def _arg0():
             """hidden arg0 fixture"""
         @pytest.fixture
         def arg1():
             """arg1 docstring"""
         def test_arg1(arg1):
             pass
-    ''')
+    '''
+    )
 
     result = testdir.runpytest("--fixtures-per-test", p)
     assert result.ret == 0
 
-    result.stdout.fnmatch_lines([
-        '*fixtures used by test_arg1*',
-        '*(test_fixtures_in_module.py:9)*',
-        'arg1',
-        '    arg1 docstring',
-    ])
+    result.stdout.fnmatch_lines(
+        [
+            "*fixtures used by test_arg1*",
+            "*(test_fixtures_in_module.py:9)*",
+            "arg1",
+            "    arg1 docstring",
+        ]
+    )
     assert "_arg0" not in result.stdout.str()
 
 
 def test_fixtures_in_conftest(testdir):
-    testdir.makeconftest('''
+    testdir.makeconftest(
+        '''
         import pytest
         @pytest.fixture
         def arg1():
             """arg1 docstring"""
         @pytest.fixture
         def arg2():
             """arg2 docstring"""
         @pytest.fixture
         def arg3(arg1, arg2):
             """arg3
             docstring
             """
-    ''')
-    p = testdir.makepyfile('''
+    '''
+    )
+    p = testdir.makepyfile(
+        """
         def test_arg2(arg2):
             pass
         def test_arg3(arg3):
             pass
-    ''')
+    """
+    )
     result = testdir.runpytest("--fixtures-per-test", p)
     assert result.ret == 0
 
-    result.stdout.fnmatch_lines([
-        '*fixtures used by test_arg2*',
-        '*(test_fixtures_in_conftest.py:2)*',
-        'arg2',
-        '    arg2 docstring',
-        '*fixtures used by test_arg3*',
-        '*(test_fixtures_in_conftest.py:4)*',
-        'arg1',
-        '    arg1 docstring',
-        'arg2',
-        '    arg2 docstring',
-        'arg3',
-        '    arg3',
-        '    docstring',
-    ])
+    result.stdout.fnmatch_lines(
+        [
+            "*fixtures used by test_arg2*",
+            "*(test_fixtures_in_conftest.py:2)*",
+            "arg2",
+            "    arg2 docstring",
+            "*fixtures used by test_arg3*",
+            "*(test_fixtures_in_conftest.py:4)*",
+            "arg1",
+            "    arg1 docstring",
+            "arg2",
+            "    arg2 docstring",
+            "arg3",
+            "    arg3",
+            "    docstring",
+        ]
+    )
 
 
 def test_should_show_fixtures_used_by_test(testdir):
-    testdir.makeconftest('''
+    testdir.makeconftest(
+        '''
         import pytest
         @pytest.fixture
         def arg1():
             """arg1 from conftest"""
         @pytest.fixture
         def arg2():
             """arg2 from conftest"""
-    ''')
-    p = testdir.makepyfile('''
+    '''
+    )
+    p = testdir.makepyfile(
+        '''
         import pytest
         @pytest.fixture
         def arg1():
             """arg1 from testmodule"""
         def test_args(arg1, arg2):
             pass
-    ''')
+    '''
+    )
     result = testdir.runpytest("--fixtures-per-test", p)
     assert result.ret == 0
 
-    result.stdout.fnmatch_lines([
-        '*fixtures used by test_args*',
-        '*(test_should_show_fixtures_used_by_test.py:6)*',
-        'arg1',
-        '    arg1 from testmodule',
-        'arg2',
-        '    arg2 from conftest',
-    ])
+    result.stdout.fnmatch_lines(
+        [
+            "*fixtures used by test_args*",
+            "*(test_should_show_fixtures_used_by_test.py:6)*",
+            "arg1",
+            "    arg1 from testmodule",
+            "arg2",
+            "    arg2 from conftest",
+        ]
+    )
 
 
 def test_verbose_include_private_fixtures_and_loc(testdir):
-    testdir.makeconftest('''
+    testdir.makeconftest(
+        '''
         import pytest
         @pytest.fixture
         def _arg1():
             """_arg1 from conftest"""
         @pytest.fixture
         def arg2(_arg1):
             """arg2 from conftest"""
-    ''')
-    p = testdir.makepyfile('''
+    '''
+    )
+    p = testdir.makepyfile(
+        '''
         import pytest
         @pytest.fixture
         def arg3():
             """arg3 from testmodule"""
         def test_args(arg2, arg3):
             pass
-    ''')
+    '''
+    )
     result = testdir.runpytest("--fixtures-per-test", "-v", p)
     assert result.ret == 0
 
-    result.stdout.fnmatch_lines([
-        '*fixtures used by test_args*',
-        '*(test_verbose_include_private_fixtures_and_loc.py:6)*',
-        '_arg1 -- conftest.py:3',
-        '    _arg1 from conftest',
-        'arg2 -- conftest.py:6',
-        '    arg2 from conftest',
-        'arg3 -- test_verbose_include_private_fixtures_and_loc.py:3',
-        '    arg3 from testmodule',
-    ])
+    result.stdout.fnmatch_lines(
+        [
+            "*fixtures used by test_args*",
+            "*(test_verbose_include_private_fixtures_and_loc.py:6)*",
+            "_arg1 -- conftest.py:3",
+            "    _arg1 from conftest",
+            "arg2 -- conftest.py:6",
+            "    arg2 from conftest",
+            "arg3 -- test_verbose_include_private_fixtures_and_loc.py:3",
+            "    arg3 from testmodule",
+        ]
+    )
 
 
 def test_doctest_items(testdir):
-    testdir.makepyfile('''
+    testdir.makepyfile(
+        '''
         def foo():
             """
             >>> 1 + 1
             2
             """
-    ''')
-    testdir.maketxtfile('''
+    '''
+    )
+    testdir.maketxtfile(
+        """
         >>> 1 + 1
         2
-    ''')
-    result = testdir.runpytest("--fixtures-per-test", "--doctest-modules",
-                               "--doctest-glob=*.txt", "-v")
+    """
+    )
+    result = testdir.runpytest(
+        "--fixtures-per-test", "--doctest-modules", "--doctest-glob=*.txt", "-v"
+    )
     assert result.ret == 0
 
-    result.stdout.fnmatch_lines([
-        '*collected 2 items*',
-    ])
+    result.stdout.fnmatch_lines(["*collected 2 items*"])
new file mode 100644
--- /dev/null
+++ b/third_party/python/pytest/testing/python/test_deprecations.py
@@ -0,0 +1,22 @@
+import pytest
+
+from _pytest.python import PyCollector
+
+
+class PyCollectorMock(PyCollector):
+    """evil hack"""
+
+    def __init__(self):
+        self.called = False
+
+    def _makeitem(self, *k):
+        """hack to disable the actual behaviour"""
+        self.called = True
+
+
+def test_pycollector_makeitem_is_deprecated():
+
+    collector = PyCollectorMock()
+    with pytest.deprecated_call():
+        collector.makeitem("foo", "bar")
+    assert collector.called
--- a/third_party/python/pytest/testing/test_argcomplete.py
+++ b/third_party/python/pytest/testing/test_argcomplete.py
@@ -1,97 +1,109 @@
 from __future__ import absolute_import, division, print_function
-import py
+import subprocess
+import sys
 import pytest
 
 # test for _argcomplete but not specific for any application
 
 
 def equal_with_bash(prefix, ffc, fc, out=None):
     res = ffc(prefix)
     res_bash = set(fc(prefix))
     retval = set(res) == res_bash
     if out:
-        out.write('equal_with_bash %s %s\n' % (retval, res))
+        out.write("equal_with_bash %s %s\n" % (retval, res))
         if not retval:
-            out.write(' python - bash: %s\n' % (set(res) - res_bash))
-            out.write(' bash - python: %s\n' % (res_bash - set(res)))
+            out.write(" python - bash: %s\n" % (set(res) - res_bash))
+            out.write(" bash - python: %s\n" % (res_bash - set(res)))
     return retval
 
+
 # copied from argcomplete.completers as import from there
 # also pulls in argcomplete.__init__ which opens filedescriptor 9
 # this gives an IOError at the end of testrun
 
 
 def _wrapcall(*args, **kargs):
     try:
-        if py.std.sys.version_info > (2, 7):
-            return py.std.subprocess.check_output(*args, **kargs).decode().splitlines()
-        if 'stdout' in kargs:
-            raise ValueError('stdout argument not allowed, it will be overridden.')
-        process = py.std.subprocess.Popen(
-            stdout=py.std.subprocess.PIPE, *args, **kargs)
+        if sys.version_info > (2, 7):
+            return subprocess.check_output(*args, **kargs).decode().splitlines()
+        if "stdout" in kargs:
+            raise ValueError("stdout argument not allowed, it will be overridden.")
+        process = subprocess.Popen(stdout=subprocess.PIPE, *args, **kargs)
         output, unused_err = process.communicate()
         retcode = process.poll()
         if retcode:
             cmd = kargs.get("args")
             if cmd is None:
                 cmd = args[0]
-            raise py.std.subprocess.CalledProcessError(retcode, cmd)
+            raise subprocess.CalledProcessError(retcode, cmd)
         return output.decode().splitlines()
-    except py.std.subprocess.CalledProcessError:
+    except subprocess.CalledProcessError:
         return []
 
 
 class FilesCompleter(object):
-    'File completer class, optionally takes a list of allowed extensions'
+    "File completer class, optionally takes a list of allowed extensions"
 
     def __init__(self, allowednames=(), directories=True):
         # Fix if someone passes in a string instead of a list
         if type(allowednames) is str:
             allowednames = [allowednames]
 
-        self.allowednames = [x.lstrip('*').lstrip('.') for x in allowednames]
+        self.allowednames = [x.lstrip("*").lstrip(".") for x in allowednames]
         self.directories = directories
 
     def __call__(self, prefix, **kwargs):
         completion = []
         if self.allowednames:
             if self.directories:
-                files = _wrapcall(['bash', '-c',
-                                   "compgen -A directory -- '{p}'".format(p=prefix)])
-                completion += [f + '/' for f in files]
+                files = _wrapcall(
+                    ["bash", "-c", "compgen -A directory -- '{p}'".format(p=prefix)]
+                )
+                completion += [f + "/" for f in files]
             for x in self.allowednames:
-                completion += _wrapcall(['bash', '-c',
-                                         "compgen -A file -X '!*.{0}' -- '{p}'".format(x, p=prefix)])
+                completion += _wrapcall(
+                    [
+                        "bash",
+                        "-c",
+                        "compgen -A file -X '!*.{0}' -- '{p}'".format(x, p=prefix),
+                    ]
+                )
         else:
-            completion += _wrapcall(['bash', '-c',
-                                     "compgen -A file -- '{p}'".format(p=prefix)])
+            completion += _wrapcall(
+                ["bash", "-c", "compgen -A file -- '{p}'".format(p=prefix)]
+            )
 
-            anticomp = _wrapcall(['bash', '-c',
-                                  "compgen -A directory -- '{p}'".format(p=prefix)])
+            anticomp = _wrapcall(
+                ["bash", "-c", "compgen -A directory -- '{p}'".format(p=prefix)]
+            )
 
             completion = list(set(completion) - set(anticomp))
 
             if self.directories:
-                completion += [f + '/' for f in anticomp]
+                completion += [f + "/" for f in anticomp]
         return completion
 
 
 class TestArgComplete(object):
+
     @pytest.mark.skipif("sys.platform in ('win32', 'darwin')")
     def test_compare_with_compgen(self):
         from _pytest._argcomplete import FastFilesCompleter
+
         ffc = FastFilesCompleter()
         fc = FilesCompleter()
-        for x in ['/', '/d', '/data', 'qqq', '']:
-            assert equal_with_bash(x, ffc, fc, out=py.std.sys.stdout)
+        for x in ["/", "/d", "/data", "qqq", ""]:
+            assert equal_with_bash(x, ffc, fc, out=sys.stdout)
 
     @pytest.mark.skipif("sys.platform in ('win32', 'darwin')")
     def test_remove_dir_prefix(self):
         """this is not compatible with compgen but it is with bash itself:
         ls /usr/<TAB>
         """
         from _pytest._argcomplete import FastFilesCompleter
+
         ffc = FastFilesCompleter()
         fc = FilesCompleter()
-        for x in '/usr/'.split():
-            assert not equal_with_bash(x, ffc, fc, out=py.std.sys.stdout)
+        for x in "/usr/".split():
+            assert not equal_with_bash(x, ffc, fc, out=sys.stdout)
--- a/third_party/python/pytest/testing/test_assertion.py
+++ b/third_party/python/pytest/testing/test_assertion.py
@@ -14,153 +14,173 @@ PY3 = sys.version_info >= (3, 0)
 
 @pytest.fixture
 def mock_config():
 
     class Config(object):
         verbose = False
 
         def getoption(self, name):
-            if name == 'verbose':
+            if name == "verbose":
                 return self.verbose
-            raise KeyError('Not mocked out: %s' % name)
+            raise KeyError("Not mocked out: %s" % name)
 
     return Config()
 
 
 class TestImportHookInstallation(object):
 
-    @pytest.mark.parametrize('initial_conftest', [True, False])
-    @pytest.mark.parametrize('mode', ['plain', 'rewrite'])
+    @pytest.mark.parametrize("initial_conftest", [True, False])
+    @pytest.mark.parametrize("mode", ["plain", "rewrite"])
     def test_conftest_assertion_rewrite(self, testdir, initial_conftest, mode):
         """Test that conftest files are using assertion rewrite on import.
         (#1619)
         """
-        testdir.tmpdir.join('foo/tests').ensure(dir=1)
-        conftest_path = 'conftest.py' if initial_conftest else 'foo/conftest.py'
+        testdir.tmpdir.join("foo/tests").ensure(dir=1)
+        conftest_path = "conftest.py" if initial_conftest else "foo/conftest.py"
         contents = {
             conftest_path: """
                 import pytest
                 @pytest.fixture
                 def check_first():
                     def check(values, value):
                         assert values.pop(0) == value
                     return check
             """,
-            'foo/tests/test_foo.py': """
+            "foo/tests/test_foo.py": """
                 def test(check_first):
                     check_first([10, 30], 30)
-            """
+            """,
         }
         testdir.makepyfile(**contents)
-        result = testdir.runpytest_subprocess('--assert=%s' % mode)
-        if mode == 'plain':
-            expected = 'E       AssertionError'
-        elif mode == 'rewrite':
-            expected = '*assert 10 == 30*'
+        result = testdir.runpytest_subprocess("--assert=%s" % mode)
+        if mode == "plain":
+            expected = "E       AssertionError"
+        elif mode == "rewrite":
+            expected = "*assert 10 == 30*"
         else:
             assert 0
         result.stdout.fnmatch_lines([expected])
 
     def test_rewrite_assertions_pytester_plugin(self, testdir):
         """
         Assertions in the pytester plugin must also benefit from assertion
         rewriting (#1920).
         """
-        testdir.makepyfile("""
+        testdir.makepyfile(
+            """
             pytest_plugins = ['pytester']
             def test_dummy_failure(testdir):  # how meta!
                 testdir.makepyfile('def test(): assert 0')
                 r = testdir.inline_run()
                 r.assertoutcome(passed=1)
-        """)
+        """
+        )
         result = testdir.runpytest_subprocess()
-        result.stdout.fnmatch_lines([
-            '*assert 1 == 0*',
-        ])
+        result.stdout.fnmatch_lines(["*assert 1 == 0*"])
 
-    @pytest.mark.parametrize('mode', ['plain', 'rewrite'])
+    @pytest.mark.parametrize("mode", ["plain", "rewrite"])
     def test_pytest_plugins_rewrite(self, testdir, mode):
         contents = {
-            'conftest.py': """
+            "conftest.py": """
                 pytest_plugins = ['ham']
             """,
-            'ham.py': """
+            "ham.py": """
                 import pytest
                 @pytest.fixture
                 def check_first():
                     def check(values, value):
                         assert values.pop(0) == value
                     return check
             """,
-            'test_foo.py': """
+            "test_foo.py": """
                 def test_foo(check_first):
                     check_first([10, 30], 30)
             """,
         }
         testdir.makepyfile(**contents)
-        result = testdir.runpytest_subprocess('--assert=%s' % mode)
-        if mode == 'plain':
-            expected = 'E       AssertionError'
-        elif mode == 'rewrite':
-            expected = '*assert 10 == 30*'
+        result = testdir.runpytest_subprocess("--assert=%s" % mode)
+        if mode == "plain":
+            expected = "E       AssertionError"
+        elif mode == "rewrite":
+            expected = "*assert 10 == 30*"
         else:
             assert 0
         result.stdout.fnmatch_lines([expected])
 
-    @pytest.mark.parametrize('mode', ['str', 'list'])
+    @pytest.mark.parametrize("mode", ["str", "list"])
     def test_pytest_plugins_rewrite_module_names(self, testdir, mode):
         """Test that pluginmanager correct marks pytest_plugins variables
         for assertion rewriting if they are defined as plain strings or
         list of strings (#1888).
         """
-        plugins = '"ham"' if mode == 'str' else '["ham"]'
+        plugins = '"ham"' if mode == "str" else '["ham"]'
         contents = {
-            'conftest.py': """
+            "conftest.py": """
                 pytest_plugins = {plugins}
-            """.format(plugins=plugins),
-            'ham.py': """
+            """.format(
+                plugins=plugins
+            ),
+            "ham.py": """
                 import pytest
             """,
-            'test_foo.py': """
+            "test_foo.py": """
                 def test_foo(pytestconfig):
                     assert 'ham' in pytestconfig.pluginmanager.rewrite_hook._must_rewrite
             """,
         }
         testdir.makepyfile(**contents)
-        result = testdir.runpytest_subprocess('--assert=rewrite')
+        result = testdir.runpytest_subprocess("--assert=rewrite")
         assert result.ret == 0
 
-    @pytest.mark.parametrize('mode', ['plain', 'rewrite'])
-    @pytest.mark.parametrize('plugin_state', ['development', 'installed'])
+    def test_pytest_plugins_rewrite_module_names_correctly(self, testdir):
+        """Test that we match files correctly when they are marked for rewriting (#2939)."""
+        contents = {
+            "conftest.py": """
+                pytest_plugins = "ham"
+            """,
+            "ham.py": "",
+            "hamster.py": "",
+            "test_foo.py": """
+                def test_foo(pytestconfig):
+                    assert pytestconfig.pluginmanager.rewrite_hook.find_module('ham') is not None
+                    assert pytestconfig.pluginmanager.rewrite_hook.find_module('hamster') is None
+            """,
+        }
+        testdir.makepyfile(**contents)
+        result = testdir.runpytest_subprocess("--assert=rewrite")
+        assert result.ret == 0
+
+    @pytest.mark.parametrize("mode", ["plain", "rewrite"])
+    @pytest.mark.parametrize("plugin_state", ["development", "installed"])
     def test_installed_plugin_rewrite(self, testdir, mode, plugin_state):
         # Make sure the hook is installed early enough so that plugins
-        # installed via setuptools are re-written.
-        testdir.tmpdir.join('hampkg').ensure(dir=1)
+        # installed via setuptools are rewritten.
+        testdir.tmpdir.join("hampkg").ensure(dir=1)
         contents = {
-            'hampkg/__init__.py': """
+            "hampkg/__init__.py": """
                 import pytest
 
                 @pytest.fixture
                 def check_first2():
                     def check(values, value):
                         assert values.pop(0) == value
                     return check
             """,
-            'spamplugin.py': """
+            "spamplugin.py": """
             import pytest
             from hampkg import check_first2
 
             @pytest.fixture
             def check_first():
                 def check(values, value):
                     assert values.pop(0) == value
                 return check
             """,
-            'mainwrapper.py': """
+            "mainwrapper.py": """
             import pytest, pkg_resources
 
             plugin_state = "{plugin_state}"
 
             class DummyDistInfo(object):
                 project_name = 'spam'
                 version = '1.0'
 
@@ -186,241 +206,265 @@ class TestImportHookInstallation(object)
                     import spamplugin
                     return spamplugin
 
             def iter_entry_points(name):
                 yield DummyEntryPoint()
 
             pkg_resources.iter_entry_points = iter_entry_points
             pytest.main()
-            """.format(plugin_state=plugin_state),
-            'test_foo.py': """
+            """.format(
+                plugin_state=plugin_state
+            ),
+            "test_foo.py": """
             def test(check_first):
                 check_first([10, 30], 30)
 
             def test2(check_first2):
                 check_first([10, 30], 30)
             """,
         }
         testdir.makepyfile(**contents)
-        result = testdir.run(sys.executable, 'mainwrapper.py', '-s', '--assert=%s' % mode)
-        if mode == 'plain':
-            expected = 'E       AssertionError'
-        elif mode == 'rewrite':
-            expected = '*assert 10 == 30*'
+        result = testdir.run(
+            sys.executable, "mainwrapper.py", "-s", "--assert=%s" % mode
+        )
+        if mode == "plain":
+            expected = "E       AssertionError"
+        elif mode == "rewrite":
+            expected = "*assert 10 == 30*"
         else:
             assert 0
         result.stdout.fnmatch_lines([expected])
 
     def test_rewrite_ast(self, testdir):
-        testdir.tmpdir.join('pkg').ensure(dir=1)
+        testdir.tmpdir.join("pkg").ensure(dir=1)
         contents = {
-            'pkg/__init__.py': """
+            "pkg/__init__.py": """
                 import pytest
                 pytest.register_assert_rewrite('pkg.helper')
             """,
-            'pkg/helper.py': """
+            "pkg/helper.py": """
                 def tool():
                     a, b = 2, 3
                     assert a == b
             """,
-            'pkg/plugin.py': """
+            "pkg/plugin.py": """
                 import pytest, pkg.helper
                 @pytest.fixture
                 def tool():
                     return pkg.helper.tool
             """,
-            'pkg/other.py': """
+            "pkg/other.py": """
                 values = [3, 2]
                 def tool():
                     assert values.pop() == 3
             """,
-            'conftest.py': """
+            "conftest.py": """
                 pytest_plugins = ['pkg.plugin']
             """,
-            'test_pkg.py': """
+            "test_pkg.py": """
                 import pkg.other
                 def test_tool(tool):
                     tool()
                 def test_other():
                     pkg.other.tool()
             """,
         }
         testdir.makepyfile(**contents)
-        result = testdir.runpytest_subprocess('--assert=rewrite')
-        result.stdout.fnmatch_lines(['>*assert a == b*',
-                                     'E*assert 2 == 3*',
-                                     '>*assert values.pop() == 3*',
-                                     'E*AssertionError'])
+        result = testdir.runpytest_subprocess("--assert=rewrite")
+        result.stdout.fnmatch_lines(
+            [
+                ">*assert a == b*",
+                "E*assert 2 == 3*",
+                ">*assert values.pop() == 3*",
+                "E*AssertionError",
+            ]
+        )
 
     def test_register_assert_rewrite_checks_types(self):
         with pytest.raises(TypeError):
-            pytest.register_assert_rewrite(['pytest_tests_internal_non_existing'])
-        pytest.register_assert_rewrite('pytest_tests_internal_non_existing',
-                                       'pytest_tests_internal_non_existing2')
+            pytest.register_assert_rewrite(["pytest_tests_internal_non_existing"])
+        pytest.register_assert_rewrite(
+            "pytest_tests_internal_non_existing", "pytest_tests_internal_non_existing2"
+        )
 
 
 class TestBinReprIntegration(object):
 
     def test_pytest_assertrepr_compare_called(self, testdir):
-        testdir.makeconftest("""
+        testdir.makeconftest(
+            """
             import pytest
             values = []
             def pytest_assertrepr_compare(op, left, right):
                 values.append((op, left, right))
 
             @pytest.fixture
             def list(request):
                 return values
-        """)
-        testdir.makepyfile("""
+        """
+        )
+        testdir.makepyfile(
+            """
             def test_hello():
                 assert 0 == 1
             def test_check(list):
                 assert list == [("==", 0, 1)]
-        """)
+        """
+        )
         result = testdir.runpytest("-v")
-        result.stdout.fnmatch_lines([
-            "*test_hello*FAIL*",
-            "*test_check*PASS*",
-        ])
+        result.stdout.fnmatch_lines(["*test_hello*FAIL*", "*test_check*PASS*"])
 
 
 def callequal(left, right, verbose=False):
     config = mock_config()
     config.verbose = verbose
-    return plugin.pytest_assertrepr_compare(config, '==', left, right)
+    return plugin.pytest_assertrepr_compare(config, "==", left, right)
 
 
 class TestAssert_reprcompare(object):
+
     def test_different_types(self):
-        assert callequal([0, 1], 'foo') is None
+        assert callequal([0, 1], "foo") is None
 
     def test_summary(self):
         summary = callequal([0, 1], [0, 2])[0]
         assert len(summary) < 65
 
     def test_text_diff(self):
-        diff = callequal('spam', 'eggs')[1:]
-        assert '- spam' in diff
-        assert '+ eggs' in diff
+        diff = callequal("spam", "eggs")[1:]
+        assert "- spam" in diff
+        assert "+ eggs" in diff
 
     def test_text_skipping(self):
-        lines = callequal('a' * 50 + 'spam', 'a' * 50 + 'eggs')
-        assert 'Skipping' in lines[1]
+        lines = callequal("a" * 50 + "spam", "a" * 50 + "eggs")
+        assert "Skipping" in lines[1]
         for line in lines:
-            assert 'a' * 50 not in line
+            assert "a" * 50 not in line
 
     def test_text_skipping_verbose(self):
-        lines = callequal('a' * 50 + 'spam', 'a' * 50 + 'eggs', verbose=True)
-        assert '- ' + 'a' * 50 + 'spam' in lines
-        assert '+ ' + 'a' * 50 + 'eggs' in lines
+        lines = callequal("a" * 50 + "spam", "a" * 50 + "eggs", verbose=True)
+        assert "- " + "a" * 50 + "spam" in lines
+        assert "+ " + "a" * 50 + "eggs" in lines
 
     def test_multiline_text_diff(self):
-        left = 'foo\nspam\nbar'
-        right = 'foo\neggs\nbar'
+        left = "foo\nspam\nbar"
+        right = "foo\neggs\nbar"
         diff = callequal(left, right)
-        assert '- spam' in diff
-        assert '+ eggs' in diff
+        assert "- spam" in diff
+        assert "+ eggs" in diff
 
     def test_list(self):
         expl = callequal([0, 1], [0, 2])
         assert len(expl) > 1
 
     @pytest.mark.parametrize(
-        ['left', 'right', 'expected'], [
-            ([0, 1], [0, 2], """
+        ["left", "right", "expected"],
+        [
+            (
+                [0, 1],
+                [0, 2],
+                """
                 Full diff:
                 - [0, 1]
                 ?     ^
                 + [0, 2]
                 ?     ^
-            """),
-            ({0: 1}, {0: 2}, """
+            """,
+            ),
+            (
+                {0: 1},
+                {0: 2},
+                """
                 Full diff:
                 - {0: 1}
                 ?     ^
                 + {0: 2}
                 ?     ^
-            """),
-            (set([0, 1]), set([0, 2]), """
+            """,
+            ),
+            (
+                {0, 1},
+                {0, 2},
+                """
                 Full diff:
                 - set([0, 1])
                 ?         ^
                 + set([0, 2])
                 ?         ^
-            """ if not PY3 else """
+            """
+                if not PY3
+                else """
                 Full diff:
                 - {0, 1}
                 ?     ^
                 + {0, 2}
                 ?     ^
-            """)
-        ]
+            """,
+            ),
+        ],
     )
     def test_iterable_full_diff(self, left, right, expected):
         """Test the full diff assertion failure explanation.
 
         When verbose is False, then just a -v notice to get the diff is rendered,
         when verbose is True, then ndiff of the pprint is returned.
         """
         expl = callequal(left, right, verbose=False)
-        assert expl[-1] == 'Use -v to get the full diff'
-        expl = '\n'.join(callequal(left, right, verbose=True))
+        assert expl[-1] == "Use -v to get the full diff"
+        expl = "\n".join(callequal(left, right, verbose=True))
         assert expl.endswith(textwrap.dedent(expected).strip())
 
     def test_list_different_lengths(self):
         expl = callequal([0, 1], [0, 1, 2])
         assert len(expl) > 1
         expl = callequal([0, 1, 2], [0, 1])
         assert len(expl) > 1
 
     def test_dict(self):
-        expl = callequal({'a': 0}, {'a': 1})
+        expl = callequal({"a": 0}, {"a": 1})
         assert len(expl) > 1
 
     def test_dict_omitting(self):
-        lines = callequal({'a': 0, 'b': 1}, {'a': 1, 'b': 1})
-        assert lines[1].startswith('Omitting 1 identical item')
-        assert 'Common items' not in lines
+        lines = callequal({"a": 0, "b": 1}, {"a": 1, "b": 1})
+        assert lines[1].startswith("Omitting 1 identical item")
+        assert "Common items" not in lines
         for line in lines[1:]:
-            assert 'b' not in line
+            assert "b" not in line
 
     def test_dict_omitting_with_verbosity_1(self):
         """ Ensure differing items are visible for verbosity=1 (#1512) """
-        lines = callequal({'a': 0, 'b': 1}, {'a': 1, 'b': 1}, verbose=1)
-        assert lines[1].startswith('Omitting 1 identical item')
-        assert lines[2].startswith('Differing items')
+        lines = callequal({"a": 0, "b": 1}, {"a": 1, "b": 1}, verbose=1)
+        assert lines[1].startswith("Omitting 1 identical item")
+        assert lines[2].startswith("Differing items")
         assert lines[3] == "{'a': 0} != {'a': 1}"
-        assert 'Common items' not in lines
+        assert "Common items" not in lines
 
     def test_dict_omitting_with_verbosity_2(self):
-        lines = callequal({'a': 0, 'b': 1}, {'a': 1, 'b': 1}, verbose=2)
-        assert lines[1].startswith('Common items:')
-        assert 'Omitting' not in lines[1]
+        lines = callequal({"a": 0, "b": 1}, {"a": 1, "b": 1}, verbose=2)
+        assert lines[1].startswith("Common items:")
+        assert "Omitting" not in lines[1]
         assert lines[2] == "{'b': 1}"
 
     def test_set(self):
-        expl = callequal(set([0, 1]), set([0, 2]))
+        expl = callequal({0, 1}, {0, 2})
         assert len(expl) > 1
 
     def test_frozenzet(self):
-        expl = callequal(frozenset([0, 1]), set([0, 2]))
+        expl = callequal(frozenset([0, 1]), {0, 2})
         assert len(expl) > 1
 
     def test_Sequence(self):
-        col = py.builtin._tryimport(
-            "collections.abc",
-            "collections",
-            "sys")
+        col = py.builtin._tryimport("collections.abc", "collections", "sys")
         if not hasattr(col, "MutableSequence"):
             pytest.skip("cannot import MutableSequence")
         MutableSequence = col.MutableSequence
 
         class TestSequence(MutableSequence):  # works with a Sequence subclass
+
             def __init__(self, iterable):
                 self.elements = list(iterable)
 
             def __getitem__(self, item):
                 return self.elements[item]
 
             def __len__(self):
                 return len(self.elements)
@@ -439,164 +483,169 @@ class TestAssert_reprcompare(object):
 
     def test_list_tuples(self):
         expl = callequal([], [(1, 2)])
         assert len(expl) > 1
         expl = callequal([(1, 2)], [])
         assert len(expl) > 1
 
     def test_list_bad_repr(self):
+
         class A(object):
+
             def __repr__(self):
                 raise ValueError(42)
+
         expl = callequal([], [A()])
-        assert 'ValueError' in "".join(expl)
-        expl = callequal({}, {'1': A()})
-        assert 'faulty' in "".join(expl)
+        assert "ValueError" in "".join(expl)
+        expl = callequal({}, {"1": A()})
+        assert "faulty" in "".join(expl)
 
     def test_one_repr_empty(self):
         """
         the faulty empty string repr did trigger
-        a unbound local error in _diff_text
+        an unbound local error in _diff_text
         """
+
         class A(str):
+
             def __repr__(self):
-                return ''
-        expl = callequal(A(), '')
+                return ""
+
+        expl = callequal(A(), "")
         assert not expl
 
     def test_repr_no_exc(self):
-        expl = ' '.join(callequal('foo', 'bar'))
-        assert 'raised in repr()' not in expl
+        expl = " ".join(callequal("foo", "bar"))
+        assert "raised in repr()" not in expl
 
     def test_unicode(self):
-        left = py.builtin._totext('£€', 'utf-8')
-        right = py.builtin._totext('£', 'utf-8')
+        left = py.builtin._totext("£€", "utf-8")
+        right = py.builtin._totext("£", "utf-8")
         expl = callequal(left, right)
-        assert expl[0] == py.builtin._totext("'£€' == '£'", 'utf-8')
-        assert expl[1] == py.builtin._totext('- £€', 'utf-8')
-        assert expl[2] == py.builtin._totext('+ £', 'utf-8')
+        assert expl[0] == py.builtin._totext("'£€' == '£'", "utf-8")
+        assert expl[1] == py.builtin._totext("- £€", "utf-8")
+        assert expl[2] == py.builtin._totext("+ £", "utf-8")
 
     def test_nonascii_text(self):
         """
         :issue: 877
         non ascii python2 str caused a UnicodeDecodeError
         """
+
         class A(str):
+
             def __repr__(self):
-                return '\xff'
-        expl = callequal(A(), '1')
+                return "\xff"
+
+        expl = callequal(A(), "1")
         assert expl
 
     def test_format_nonascii_explanation(self):
-        assert util.format_explanation('λ')
+        assert util.format_explanation("λ")
 
     def test_mojibake(self):
         # issue 429
-        left = 'e'
-        right = '\xc3\xa9'
-        if not isinstance(left, py.builtin.bytes):
-            left = py.builtin.bytes(left, 'utf-8')
-            right = py.builtin.bytes(right, 'utf-8')
+        left = "e"
+        right = "\xc3\xa9"
+        if not isinstance(left, bytes):
+            left = bytes(left, "utf-8")
+            right = bytes(right, "utf-8")
         expl = callequal(left, right)
         for line in expl:
             assert isinstance(line, py.builtin.text)
-        msg = py.builtin._totext('\n').join(expl)
+        msg = py.builtin._totext("\n").join(expl)
         assert msg
 
 
 class TestFormatExplanation(object):
 
     def test_special_chars_full(self, testdir):
         # Issue 453, for the bug this would raise IndexError
-        testdir.makepyfile("""
+        testdir.makepyfile(
+            """
             def test_foo():
                 assert '\\n}' == ''
-        """)
+        """
+        )
         result = testdir.runpytest()
         assert result.ret == 1
-        result.stdout.fnmatch_lines([
-            "*AssertionError*",
-        ])
+        result.stdout.fnmatch_lines(["*AssertionError*"])
 
     def test_fmt_simple(self):
-        expl = 'assert foo'
-        assert util.format_explanation(expl) == 'assert foo'
+        expl = "assert foo"
+        assert util.format_explanation(expl) == "assert foo"
 
     def test_fmt_where(self):
-        expl = '\n'.join(['assert 1',
-                          '{1 = foo',
-                          '} == 2'])
-        res = '\n'.join(['assert 1 == 2',
-                         ' +  where 1 = foo'])
+        expl = "\n".join(["assert 1", "{1 = foo", "} == 2"])
+        res = "\n".join(["assert 1 == 2", " +  where 1 = foo"])
         assert util.format_explanation(expl) == res
 
     def test_fmt_and(self):
-        expl = '\n'.join(['assert 1',
-                          '{1 = foo',
-                          '} == 2',
-                          '{2 = bar',
-                          '}'])
-        res = '\n'.join(['assert 1 == 2',
-                         ' +  where 1 = foo',
-                         ' +  and   2 = bar'])
+        expl = "\n".join(["assert 1", "{1 = foo", "} == 2", "{2 = bar", "}"])
+        res = "\n".join(["assert 1 == 2", " +  where 1 = foo", " +  and   2 = bar"])
         assert util.format_explanation(expl) == res
 
     def test_fmt_where_nested(self):
-        expl = '\n'.join(['assert 1',
-                          '{1 = foo',
-                          '{foo = bar',
-                          '}',
-                          '} == 2'])
-        res = '\n'.join(['assert 1 == 2',
-                         ' +  where 1 = foo',
-                         ' +    where foo = bar'])
+        expl = "\n".join(["assert 1", "{1 = foo", "{foo = bar", "}", "} == 2"])
+        res = "\n".join(["assert 1 == 2", " +  where 1 = foo", " +    where foo = bar"])
         assert util.format_explanation(expl) == res
 
     def test_fmt_newline(self):
-        expl = '\n'.join(['assert "foo" == "bar"',
-                          '~- foo',
-                          '~+ bar'])
-        res = '\n'.join(['assert "foo" == "bar"',
-                         '  - foo',
-                         '  + bar'])
+        expl = "\n".join(['assert "foo" == "bar"', "~- foo", "~+ bar"])
+        res = "\n".join(['assert "foo" == "bar"', "  - foo", "  + bar"])
         assert util.format_explanation(expl) == res
 
     def test_fmt_newline_escaped(self):
-        expl = '\n'.join(['assert foo == bar',
-                          'baz'])
-        res = 'assert foo == bar\\nbaz'
+        expl = "\n".join(["assert foo == bar", "baz"])
+        res = "assert foo == bar\\nbaz"
         assert util.format_explanation(expl) == res
 
     def test_fmt_newline_before_where(self):
-        expl = '\n'.join(['the assertion message here',
-                          '>assert 1',
-                          '{1 = foo',
-                          '} == 2',
-                          '{2 = bar',
-                          '}'])
-        res = '\n'.join(['the assertion message here',
-                         'assert 1 == 2',
-                         ' +  where 1 = foo',
-                         ' +  and   2 = bar'])
+        expl = "\n".join(
+            [
+                "the assertion message here",
+                ">assert 1",
+                "{1 = foo",
+                "} == 2",
+                "{2 = bar",
+                "}",
+            ]
+        )
+        res = "\n".join(
+            [
+                "the assertion message here",
+                "assert 1 == 2",
+                " +  where 1 = foo",
+                " +  and   2 = bar",
+            ]
+        )
         assert util.format_explanation(expl) == res
 
     def test_fmt_multi_newline_before_where(self):
-        expl = '\n'.join(['the assertion',
-                          '~message here',
-                          '>assert 1',
-                          '{1 = foo',
-                          '} == 2',
-                          '{2 = bar',
-                          '}'])
-        res = '\n'.join(['the assertion',
-                         '  message here',
-                         'assert 1 == 2',
-                         ' +  where 1 = foo',
-                         ' +  and   2 = bar'])
+        expl = "\n".join(
+            [
+                "the assertion",
+                "~message here",
+                ">assert 1",
+                "{1 = foo",
+                "} == 2",
+                "{2 = bar",
+                "}",
+            ]
+        )
+        res = "\n".join(
+            [
+                "the assertion",
+                "  message here",
+                "assert 1 == 2",
+                " +  where 1 = foo",
+                " +  and   2 = bar",
+            ]
+        )
         assert util.format_explanation(expl) == res
 
 
 class TestTruncateExplanation(object):
 
     """ Confirm assertion output is truncated as expected """
 
     # The number of lines in the truncation explanation message. Used
@@ -604,445 +653,520 @@ class TestTruncateExplanation(object):
     LINES_IN_TRUNCATION_MSG = 2
 
     def test_doesnt_truncate_when_input_is_empty_list(self):
         expl = []
         result = truncate._truncate_explanation(expl, max_lines=8, max_chars=100)
         assert result == expl
 
     def test_doesnt_truncate_at_when_input_is_5_lines_and_LT_max_chars(self):
-        expl = ['a' * 100 for x in range(5)]
+        expl = ["a" * 100 for x in range(5)]
         result = truncate._truncate_explanation(expl, max_lines=8, max_chars=8 * 80)
         assert result == expl
 
     def test_truncates_at_8_lines_when_given_list_of_empty_strings(self):
-        expl = ['' for x in range(50)]
+        expl = ["" for x in range(50)]
         result = truncate._truncate_explanation(expl, max_lines=8, max_chars=100)
         assert result != expl
         assert len(result) == 8 + self.LINES_IN_TRUNCATION_MSG
         assert "Full output truncated" in result[-1]
         assert "43 lines hidden" in result[-1]
-        last_line_before_trunc_msg = result[- self.LINES_IN_TRUNCATION_MSG - 1]
+        last_line_before_trunc_msg = result[-self.LINES_IN_TRUNCATION_MSG - 1]
         assert last_line_before_trunc_msg.endswith("...")
 
     def test_truncates_at_8_lines_when_first_8_lines_are_LT_max_chars(self):
-        expl = ['a' for x in range(100)]
+        expl = ["a" for x in range(100)]
         result = truncate._truncate_explanation(expl, max_lines=8, max_chars=8 * 80)
         assert result != expl
         assert len(result) == 8 + self.LINES_IN_TRUNCATION_MSG
         assert "Full output truncated" in result[-1]
         assert "93 lines hidden" in result[-1]
-        last_line_before_trunc_msg = result[- self.LINES_IN_TRUNCATION_MSG - 1]
+        last_line_before_trunc_msg = result[-self.LINES_IN_TRUNCATION_MSG - 1]
         assert last_line_before_trunc_msg.endswith("...")
 
     def test_truncates_at_8_lines_when_first_8_lines_are_EQ_max_chars(self):
-        expl = ['a' * 80 for x in range(16)]
+        expl = ["a" * 80 for x in range(16)]
         result = truncate._truncate_explanation(expl, max_lines=8, max_chars=8 * 80)
         assert result != expl
         assert len(result) == 8 + self.LINES_IN_TRUNCATION_MSG
         assert "Full output truncated" in result[-1]
         assert "9 lines hidden" in result[-1]
-        last_line_before_trunc_msg = result[- self.LINES_IN_TRUNCATION_MSG - 1]
+        last_line_before_trunc_msg = result[-self.LINES_IN_TRUNCATION_MSG - 1]
         assert last_line_before_trunc_msg.endswith("...")
 
     def test_truncates_at_4_lines_when_first_4_lines_are_GT_max_chars(self):
-        expl = ['a' * 250 for x in range(10)]
+        expl = ["a" * 250 for x in range(10)]
         result = truncate._truncate_explanation(expl, max_lines=8, max_chars=999)
         assert result != expl
         assert len(result) == 4 + self.LINES_IN_TRUNCATION_MSG
         assert "Full output truncated" in result[-1]
         assert "7 lines hidden" in result[-1]
-        last_line_before_trunc_msg = result[- self.LINES_IN_TRUNCATION_MSG - 1]
+        last_line_before_trunc_msg = result[-self.LINES_IN_TRUNCATION_MSG - 1]
         assert last_line_before_trunc_msg.endswith("...")
 
     def test_truncates_at_1_line_when_first_line_is_GT_max_chars(self):
-        expl = ['a' * 250 for x in range(1000)]
+        expl = ["a" * 250 for x in range(1000)]
         result = truncate._truncate_explanation(expl, max_lines=8, max_chars=100)
         assert result != expl
         assert len(result) == 1 + self.LINES_IN_TRUNCATION_MSG
         assert "Full output truncated" in result[-1]
         assert "1000 lines hidden" in result[-1]
-        last_line_before_trunc_msg = result[- self.LINES_IN_TRUNCATION_MSG - 1]
+        last_line_before_trunc_msg = result[-self.LINES_IN_TRUNCATION_MSG - 1]
         assert last_line_before_trunc_msg.endswith("...")
 
     def test_full_output_truncated(self, monkeypatch, testdir):
         """ Test against full runpytest() output. """
 
         line_count = 7
         line_len = 100
         expected_truncated_lines = 2
-        testdir.makepyfile(r"""
+        testdir.makepyfile(
+            r"""
             def test_many_lines():
                 a = list([str(i)[0] * %d for i in range(%d)])
                 b = a[::2]
                 a = '\n'.join(map(str, a))
                 b = '\n'.join(map(str, b))
                 assert a == b
-        """ % (line_len, line_count))
-        monkeypatch.delenv('CI', raising=False)
+        """
+            % (line_len, line_count)
+        )
+        monkeypatch.delenv("CI", raising=False)
 
         result = testdir.runpytest()
         # without -vv, truncate the message showing a few diff lines only
-        result.stdout.fnmatch_lines([
-            "*- 1*",
-            "*- 3*",
-            "*- 5*",
-            "*truncated (%d lines hidden)*use*-vv*" % expected_truncated_lines,
-        ])
+        result.stdout.fnmatch_lines(
+            [
+                "*- 1*",
+                "*- 3*",
+                "*- 5*",
+                "*truncated (%d lines hidden)*use*-vv*" % expected_truncated_lines,
+            ]
+        )
 
-        result = testdir.runpytest('-vv')
-        result.stdout.fnmatch_lines([
-            "* 6*",
-        ])
+        result = testdir.runpytest("-vv")
+        result.stdout.fnmatch_lines(["* 6*"])
 
-        monkeypatch.setenv('CI', '1')
+        monkeypatch.setenv("CI", "1")
         result = testdir.runpytest()
-        result.stdout.fnmatch_lines([
-            "* 6*",
-        ])
+        result.stdout.fnmatch_lines(["* 6*"])
 
 
 def test_python25_compile_issue257(testdir):
-    testdir.makepyfile("""
+    testdir.makepyfile(
+        """
         def test_rewritten():
             assert 1 == 2
         # some comment
-    """)
+    """
+    )
     result = testdir.runpytest()
     assert result.ret == 1
-    result.stdout.fnmatch_lines("""
+    result.stdout.fnmatch_lines(
+        """
             *E*assert 1 == 2*
             *1 failed*
-    """)
+    """
+    )
 
 
 def test_rewritten(testdir):
-    testdir.makepyfile("""
+    testdir.makepyfile(
+        """
         def test_rewritten():
             assert "@py_builtins" in globals()
-    """)
+    """
+    )
     assert testdir.runpytest().ret == 0
 
 
 def test_reprcompare_notin(mock_config):
     detail = plugin.pytest_assertrepr_compare(
-        mock_config, 'not in', 'foo', 'aaafoobbb')[1:]
-    assert detail == ["'foo' is contained here:", '  aaafoobbb', '?    +++']
+        mock_config, "not in", "foo", "aaafoobbb"
+    )[
+        1:
+    ]
+    assert detail == ["'foo' is contained here:", "  aaafoobbb", "?    +++"]
+
+
+def test_reprcompare_whitespaces(mock_config):
+    detail = plugin.pytest_assertrepr_compare(mock_config, "==", "\r\n", "\n")
+    assert (
+        detail
+        == [
+            r"'\r\n' == '\n'",
+            r"Strings contain only whitespace, escaping them using repr()",
+            r"- '\r\n'",
+            r"?  --",
+            r"+ '\n'",
+        ]
+    )
 
 
 def test_pytest_assertrepr_compare_integration(testdir):
-    testdir.makepyfile("""
+    testdir.makepyfile(
+        """
         def test_hello():
             x = set(range(100))
             y = x.copy()
             y.remove(50)
             assert x == y
-    """)
+    """
+    )
     result = testdir.runpytest()
-    result.stdout.fnmatch_lines([
-        "*def test_hello():*",
-        "*assert x == y*",
-        "*E*Extra items*left*",
-        "*E*50*",
-    ])
+    result.stdout.fnmatch_lines(
+        ["*def test_hello():*", "*assert x == y*", "*E*Extra items*left*", "*E*50*"]
+    )
 
 
 def test_sequence_comparison_uses_repr(testdir):
-    testdir.makepyfile("""
+    testdir.makepyfile(
+        """
         def test_hello():
             x = set("hello x")
             y = set("hello y")
             assert x == y
-    """)
+    """
+    )
     result = testdir.runpytest()
-    result.stdout.fnmatch_lines([
-        "*def test_hello():*",
-        "*assert x == y*",
-        "*E*Extra items*left*",
-        "*E*'x'*",
-        "*E*Extra items*right*",
-        "*E*'y'*",
-    ])
+    result.stdout.fnmatch_lines(
+        [
+            "*def test_hello():*",
+            "*assert x == y*",
+            "*E*Extra items*left*",
+            "*E*'x'*",
+            "*E*Extra items*right*",
+            "*E*'y'*",
+        ]
+    )
 
 
 def test_assertrepr_loaded_per_dir(testdir):
-    testdir.makepyfile(test_base=['def test_base(): assert 1 == 2'])
-    a = testdir.mkdir('a')
-    a_test = a.join('test_a.py')
-    a_test.write('def test_a(): assert 1 == 2')
-    a_conftest = a.join('conftest.py')
+    testdir.makepyfile(test_base=["def test_base(): assert 1 == 2"])
+    a = testdir.mkdir("a")
+    a_test = a.join("test_a.py")
+    a_test.write("def test_a(): assert 1 == 2")
+    a_conftest = a.join("conftest.py")
     a_conftest.write('def pytest_assertrepr_compare(): return ["summary a"]')
-    b = testdir.mkdir('b')
-    b_test = b.join('test_b.py')
-    b_test.write('def test_b(): assert 1 == 2')
-    b_conftest = b.join('conftest.py')
+    b = testdir.mkdir("b")
+    b_test = b.join("test_b.py")
+    b_test.write("def test_b(): assert 1 == 2")
+    b_conftest = b.join("conftest.py")
     b_conftest.write('def pytest_assertrepr_compare(): return ["summary b"]')
     result = testdir.runpytest()
-    result.stdout.fnmatch_lines([
-        '*def test_base():*',
-        '*E*assert 1 == 2*',
-        '*def test_a():*',
-        '*E*assert summary a*',
-        '*def test_b():*',
-        '*E*assert summary b*'])
+    result.stdout.fnmatch_lines(
+        [
+            "*def test_base():*",
+            "*E*assert 1 == 2*",
+            "*def test_a():*",
+            "*E*assert summary a*",
+            "*def test_b():*",
+            "*E*assert summary b*",
+        ]
+    )
 
 
 def test_assertion_options(testdir):
-    testdir.makepyfile("""
+    testdir.makepyfile(
+        """
         def test_hello():
             x = 3
             assert x == 4
-    """)
+    """
+    )
     result = testdir.runpytest()
     assert "3 == 4" in result.stdout.str()
     result = testdir.runpytest_subprocess("--assert=plain")
     assert "3 == 4" not in result.stdout.str()
 
 
 def test_triple_quoted_string_issue113(testdir):
-    testdir.makepyfile("""
+    testdir.makepyfile(
+        """
         def test_hello():
             assert "" == '''
-    '''""")
+    '''"""
+    )
     result = testdir.runpytest("--fulltrace")
-    result.stdout.fnmatch_lines([
-        "*1 failed*",
-    ])
-    assert 'SyntaxError' not in result.stdout.str()
+    result.stdout.fnmatch_lines(["*1 failed*"])
+    assert "SyntaxError" not in result.stdout.str()
 
 
 def test_traceback_failure(testdir):
-    p1 = testdir.makepyfile("""
+    p1 = testdir.makepyfile(
+        """
         def g():
             return 2
         def f(x):
             assert x == g()
         def test_onefails():
             f(3)
-    """)
+    """
+    )
     result = testdir.runpytest(p1, "--tb=long")
-    result.stdout.fnmatch_lines([
-        "*test_traceback_failure.py F",
-        "====* FAILURES *====",
-        "____*____",
-        "",
-        "    def test_onefails():",
-        ">       f(3)",
-        "",
-        "*test_*.py:6: ",
-        "_ _ _ *",
-        # "",
-        "    def f(x):",
-        ">       assert x == g()",
-        "E       assert 3 == 2",
-        "E        +  where 2 = g()",
-        "",
-        "*test_traceback_failure.py:4: AssertionError"
-    ])
+    result.stdout.fnmatch_lines(
+        [
+            "*test_traceback_failure.py F*",
+            "====* FAILURES *====",
+            "____*____",
+            "",
+            "    def test_onefails():",
+            ">       f(3)",
+            "",
+            "*test_*.py:6: ",
+            "_ _ _ *",
+            # "",
+            "    def f(x):",
+            ">       assert x == g()",
+            "E       assert 3 == 2",
+            "E        +  where 2 = g()",
+            "",
+            "*test_traceback_failure.py:4: AssertionError",
+        ]
+    )
 
     result = testdir.runpytest(p1)  # "auto"
-    result.stdout.fnmatch_lines([
-        "*test_traceback_failure.py F",
-        "====* FAILURES *====",
-        "____*____",
-        "",
-        "    def test_onefails():",
-        ">       f(3)",
-        "",
-        "*test_*.py:6: ",
-        "",
-        "    def f(x):",
-        ">       assert x == g()",
-        "E       assert 3 == 2",
-        "E        +  where 2 = g()",
-        "",
-        "*test_traceback_failure.py:4: AssertionError"
-    ])
+    result.stdout.fnmatch_lines(
+        [
+            "*test_traceback_failure.py F*",
+            "====* FAILURES *====",
+            "____*____",
+            "",
+            "    def test_onefails():",
+            ">       f(3)",
+            "",
+            "*test_*.py:6: ",
+            "",
+            "    def f(x):",
+            ">       assert x == g()",
+            "E       assert 3 == 2",
+            "E        +  where 2 = g()",
+            "",
+            "*test_traceback_failure.py:4: AssertionError",
+        ]
+    )
 
 
-@pytest.mark.skipif(sys.version_info[:2] <= (3, 3), reason='Python 3.4+ shows chained exceptions on multiprocess')
+@pytest.mark.skipif(
+    sys.version_info[:2] <= (3, 3),
+    reason="Python 3.4+ shows chained exceptions on multiprocess",
+)
 def test_exception_handling_no_traceback(testdir):
     """
     Handle chain exceptions in tasks submitted by the multiprocess module (#1984).
     """
-    p1 = testdir.makepyfile("""
+    p1 = testdir.makepyfile(
+        """
         from multiprocessing import Pool
 
         def process_task(n):
             assert n == 10
 
         def multitask_job():
             tasks = [1]
             with Pool(processes=1) as pool:
                 pool.map(process_task, tasks)
 
         def test_multitask_job():
             multitask_job()
-    """)
+    """
+    )
     result = testdir.runpytest(p1, "--tb=long")
-    result.stdout.fnmatch_lines([
-        "====* FAILURES *====",
-        "*multiprocessing.pool.RemoteTraceback:*",
-        "Traceback (most recent call last):",
-        "*assert n == 10",
-        "The above exception was the direct cause of the following exception:",
-        "> * multitask_job()",
-    ])
+    result.stdout.fnmatch_lines(
+        [
+            "====* FAILURES *====",
+            "*multiprocessing.pool.RemoteTraceback:*",
+            "Traceback (most recent call last):",
+            "*assert n == 10",
+            "The above exception was the direct cause of the following exception:",
+            "> * multitask_job()",
+        ]
+    )
 
 
-@pytest.mark.skipif("'__pypy__' in sys.builtin_module_names or sys.platform.startswith('java')")
+@pytest.mark.skipif(
+    "'__pypy__' in sys.builtin_module_names or sys.platform.startswith('java')"
+)
 def test_warn_missing(testdir):
     testdir.makepyfile("")
     result = testdir.run(sys.executable, "-OO", "-m", "pytest", "-h")
-    result.stderr.fnmatch_lines([
-        "*WARNING*assert statements are not executed*",
-    ])
+    result.stderr.fnmatch_lines(["*WARNING*assert statements are not executed*"])
     result = testdir.run(sys.executable, "-OO", "-m", "pytest")
-    result.stderr.fnmatch_lines([
-        "*WARNING*assert statements are not executed*",
-    ])
+    result.stderr.fnmatch_lines(["*WARNING*assert statements are not executed*"])
 
 
 def test_recursion_source_decode(testdir):
-    testdir.makepyfile("""
+    testdir.makepyfile(
+        """
         def test_something():
             pass
-    """)
-    testdir.makeini("""
+    """
+    )
+    testdir.makeini(
+        """
         [pytest]
         python_files = *.py
-    """)
+    """
+    )
     result = testdir.runpytest("--collect-only")
-    result.stdout.fnmatch_lines("""
+    result.stdout.fnmatch_lines(
+        """
         <Module*>
-    """)
+    """
+    )
 
 
 def test_AssertionError_message(testdir):
-    testdir.makepyfile("""
+    testdir.makepyfile(
+        """
         def test_hello():
             x,y = 1,2
             assert 0, (x,y)
-    """)
+    """
+    )
     result = testdir.runpytest()
-    result.stdout.fnmatch_lines("""
+    result.stdout.fnmatch_lines(
+        """
         *def test_hello*
         *assert 0, (x,y)*
         *AssertionError: (1, 2)*
-    """)
+    """
+    )
 
 
-@pytest.mark.skipif(PY3, reason='This bug does not exist on PY3')
+@pytest.mark.skipif(PY3, reason="This bug does not exist on PY3")
 def test_set_with_unsortable_elements():
     # issue #718
     class UnsortableKey(object):
+
         def __init__(self, name):
             self.name = name
 
         def __lt__(self, other):
             raise RuntimeError()
 
         def __repr__(self):
-            return 'repr({0})'.format(self.name)
+            return "repr({})".format(self.name)
 
         def __eq__(self, other):
             return self.name == other.name
 
         def __hash__(self):
             return hash(self.name)
 
-    left_set = set(UnsortableKey(str(i)) for i in range(1, 3))
-    right_set = set(UnsortableKey(str(i)) for i in range(2, 4))
+    left_set = {UnsortableKey(str(i)) for i in range(1, 3)}
+    right_set = {UnsortableKey(str(i)) for i in range(2, 4)}
     expl = callequal(left_set, right_set, verbose=True)
     # skip first line because it contains the "construction" of the set, which does not have a guaranteed order
     expl = expl[1:]
-    dedent = textwrap.dedent("""
+    dedent = textwrap.dedent(
+        """
         Extra items in the left set:
         repr(1)
         Extra items in the right set:
         repr(3)
         Full diff (fallback to calling repr on each item):
         - repr(1)
         repr(2)
         + repr(3)
-    """).strip()
-    assert '\n'.join(expl) == dedent
+    """
+    ).strip()
+    assert "\n".join(expl) == dedent
 
 
 def test_diff_newline_at_end(monkeypatch, testdir):
-    testdir.makepyfile(r"""
+    testdir.makepyfile(
+        r"""
         def test_diff():
             assert 'asdf' == 'asdf\n'
-    """)
+    """
+    )
 
     result = testdir.runpytest()
-    result.stdout.fnmatch_lines(r"""
+    result.stdout.fnmatch_lines(
+        r"""
         *assert 'asdf' == 'asdf\n'
         *  - asdf
         *  + asdf
         *  ?     +
-    """)
+    """
+    )
 
 
 def test_assert_tuple_warning(testdir):
-    testdir.makepyfile("""
+    testdir.makepyfile(
+        """
         def test_tuple():
             assert(False, 'you shall not pass')
-    """)
-    result = testdir.runpytest('-rw')
-    result.stdout.fnmatch_lines([
-        '*test_assert_tuple_warning.py:2',
-        '*assertion is always true*',
-    ])
+    """
+    )
+    result = testdir.runpytest("-rw")
+    result.stdout.fnmatch_lines(
+        ["*test_assert_tuple_warning.py:2", "*assertion is always true*"]
+    )
 
 
 def test_assert_indirect_tuple_no_warning(testdir):
-    testdir.makepyfile("""
+    testdir.makepyfile(
+        """
         def test_tuple():
             tpl = ('foo', 'bar')
             assert tpl
-    """)
-    result = testdir.runpytest('-rw')
-    output = '\n'.join(result.stdout.lines)
-    assert 'WR1' not in output
+    """
+    )
+    result = testdir.runpytest("-rw")
+    output = "\n".join(result.stdout.lines)
+    assert "WR1" not in output
 
 
 def test_assert_with_unicode(monkeypatch, testdir):
-    testdir.makepyfile(u"""
+    testdir.makepyfile(
+        u"""
         # -*- coding: utf-8 -*-
         def test_unicode():
             assert u'유니코드' == u'Unicode'
-    """)
+    """
+    )
     result = testdir.runpytest()
-    result.stdout.fnmatch_lines(['*AssertionError*'])
+    result.stdout.fnmatch_lines(["*AssertionError*"])
 
 
 def test_raise_unprintable_assertion_error(testdir):
-    testdir.makepyfile(r"""
+    testdir.makepyfile(
+        r"""
         def test_raise_assertion_error():
             raise AssertionError('\xff')
-    """)
+    """
+    )
     result = testdir.runpytest()
-    result.stdout.fnmatch_lines([r">       raise AssertionError('\xff')", 'E       AssertionError: *'])
+    result.stdout.fnmatch_lines(
+        [r">       raise AssertionError('\xff')", "E       AssertionError: *"]
+    )
 
 
 def test_raise_assertion_error_raisin_repr(testdir):
-    testdir.makepyfile(u"""
+    testdir.makepyfile(
+        u"""
         class RaisingRepr(object):
             def __repr__(self):
                 raise Exception()
         def test_raising_repr():
             raise AssertionError(RaisingRepr())
-    """)
+    """
+    )
     result = testdir.runpytest()
-    result.stdout.fnmatch_lines(['E       AssertionError: <unprintable AssertionError object>'])
+    result.stdout.fnmatch_lines(
+        ["E       AssertionError: <unprintable AssertionError object>"]
+    )
 
 
 def test_issue_1944(testdir):
-    testdir.makepyfile("""
+    testdir.makepyfile(
+        """
         def f():
             return
 
         assert f() == 10
-    """)
+    """
+    )
     result = testdir.runpytest()
     result.stdout.fnmatch_lines(["*1 error*"])
     assert "AttributeError: 'Module' object has no attribute '_obj'" not in result.stdout.str()
--- a/third_party/python/pytest/testing/test_assertrewrite.py
+++ b/third_party/python/pytest/testing/test_assertrewrite.py
@@ -1,22 +1,27 @@
 from __future__ import absolute_import, division, print_function
 
 import glob
 import os
 import py_compile
 import stat
 import sys
+import textwrap
 import zipfile
 import py
 import pytest
 
 import _pytest._code
 from _pytest.assertion import util
-from _pytest.assertion.rewrite import rewrite_asserts, PYTEST_TAG, AssertionRewritingHook
+from _pytest.assertion.rewrite import (
+    rewrite_asserts,
+    PYTEST_TAG,
+    AssertionRewritingHook,
+)
 from _pytest.main import EXIT_NOTESTSCOLLECTED
 
 ast = pytest.importorskip("ast")
 if sys.platform.startswith("java"):
     # XXX should be xfail
     pytest.skip("assert rewrite does currently not work on jython")
 
 
@@ -33,17 +38,17 @@ def teardown_module(mod):
 def rewrite(src):
     tree = ast.parse(src)
     rewrite_asserts(tree)
     return tree
 
 
 def getmsg(f, extra_ns=None, must_pass=False):
     """Rewrite the assertions in f, run it, and get the failure message."""
-    src = '\n'.join(_pytest._code.Code(f).source().lines)
+    src = "\n".join(_pytest._code.Code(f).source().lines)
     mod = rewrite(src)
     code = compile(mod, "<test>", "exec")
     ns = {}
     if extra_ns is not None:
         ns.update(extra_ns)
     py.builtin.exec_(code, ns)
     func = ns[f.__name__]
     try:
@@ -55,58 +60,69 @@ def getmsg(f, extra_ns=None, must_pass=F
         if not s.startswith("assert"):
             return "AssertionError: " + s
         return s
     else:
         if not must_pass:
             pytest.fail("function didn't raise at all")
 
 
+def adjust_body_for_new_docstring_in_module_node(m):
+    """Module docstrings in 3.8 are part of Module node.
+    This was briefly in 3.7 as well but got reverted in beta 5.
+
+    It's not in the body so we remove it so the following body items have
+    the same indexes on all Python versions:
+
+    TODO:
+
+    We have a complicated sys.version_info if in here to ease testing on
+    various Python 3.7 versions, but we should remove the 3.7 check after
+    3.7 is released as stable to make this check more straightforward.
+    """
+    if (
+        sys.version_info < (3, 8)
+        and not ((3, 7) <= sys.version_info <= (3, 7, 0, "beta", 4))
+    ):
+        assert len(m.body) > 1
+        assert isinstance(m.body[0], ast.Expr)
+        assert isinstance(m.body[0].value, ast.Str)
+        del m.body[0]
+
+
 class TestAssertionRewrite(object):
 
     def test_place_initial_imports(self):
         s = """'Doc string'\nother = stuff"""
         m = rewrite(s)
-        # Module docstrings in 3.7 are part of Module node, it's not in the body
-        # so we remove it so the following body items have the same indexes on
-        # all Python versions
-        if sys.version_info < (3, 7):
-            assert isinstance(m.body[0], ast.Expr)
-            assert isinstance(m.body[0].value, ast.Str)
-            del m.body[0]
+        adjust_body_for_new_docstring_in_module_node(m)
         for imp in m.body[0:2]:
             assert isinstance(imp, ast.Import)
             assert imp.lineno == 2
             assert imp.col_offset == 0
         assert isinstance(m.body[2], ast.Assign)
         s = """from __future__ import with_statement\nother_stuff"""
         m = rewrite(s)
         assert isinstance(m.body[0], ast.ImportFrom)
         for imp in m.body[1:3]:
             assert isinstance(imp, ast.Import)
             assert imp.lineno == 2
             assert imp.col_offset == 0
         assert isinstance(m.body[3], ast.Expr)
         s = """'doc string'\nfrom __future__ import with_statement"""
         m = rewrite(s)
-        if sys.version_info < (3, 7):
-            assert isinstance(m.body[0], ast.Expr)
-            assert isinstance(m.body[0].value, ast.Str)
-            del m.body[0]
+        adjust_body_for_new_docstring_in_module_node(m)
         assert isinstance(m.body[0], ast.ImportFrom)
         for imp in m.body[1:3]:
             assert isinstance(imp, ast.Import)
             assert imp.lineno == 2
             assert imp.col_offset == 0
         s = """'doc string'\nfrom __future__ import with_statement\nother"""
         m = rewrite(s)
-        if sys.version_info < (3, 7):
-            assert isinstance(m.body[0], ast.Expr)
-            assert isinstance(m.body[0].value, ast.Str)
-            del m.body[0]
+        adjust_body_for_new_docstring_in_module_node(m)
         assert isinstance(m.body[0], ast.ImportFrom)
         for imp in m.body[1:3]:
             assert isinstance(imp, ast.Import)
             assert imp.lineno == 3
             assert imp.col_offset == 0
         assert isinstance(m.body[3], ast.Expr)
         s = """from . import relative\nother_stuff"""
         m = rewrite(s)
@@ -114,28 +130,35 @@ class TestAssertionRewrite(object):
             assert isinstance(imp, ast.Import)
             assert imp.lineno == 1
             assert imp.col_offset == 0
         assert isinstance(m.body[3], ast.Expr)
 
     def test_dont_rewrite(self):
         s = """'PYTEST_DONT_REWRITE'\nassert 14"""
         m = rewrite(s)
-        if sys.version_info < (3, 7):
-            assert len(m.body) == 2
-            assert isinstance(m.body[0], ast.Expr)
-            assert isinstance(m.body[0].value, ast.Str)
-            del m.body[0]
-        else:
-            assert len(m.body) == 1
+        adjust_body_for_new_docstring_in_module_node(m)
+        assert len(m.body) == 1
         assert m.body[0].msg is None
 
+    def test_dont_rewrite_plugin(self, testdir):
+        contents = {
+            "conftest.py": "pytest_plugins = 'plugin'; import plugin",
+            "plugin.py": "'PYTEST_DONT_REWRITE'",
+            "test_foo.py": "def test_foo(): pass",
+        }
+        testdir.makepyfile(**contents)
+        result = testdir.runpytest_subprocess()
+        assert "warnings" not in "".join(result.outlines)
+
     def test_name(self):
+
         def f():
             assert False
+
         assert getmsg(f) == "assert False"
 
         def f():
             f = False
             assert f
 
         assert getmsg(f) == "assert False"
 
@@ -153,82 +176,87 @@ class TestAssertionRewrite(object):
             assert cls == 42  # noqa
 
         class X(object):
             pass
 
         assert getmsg(f, {"cls": X}) == "assert cls == 42"
 
     def test_assert_already_has_message(self):
+
         def f():
             assert False, "something bad!"
+
         assert getmsg(f) == "AssertionError: something bad!\nassert False"
 
     def test_assertion_message(self, testdir):
-        testdir.makepyfile("""
+        testdir.makepyfile(
+            """
             def test_foo():
                 assert 1 == 2, "The failure message"
-        """)
+        """
+        )
         result = testdir.runpytest()
         assert result.ret == 1
-        result.stdout.fnmatch_lines([
-            "*AssertionError*The failure message*",
-            "*assert 1 == 2*",
-        ])
+        result.stdout.fnmatch_lines(
+            ["*AssertionError*The failure message*", "*assert 1 == 2*"]
+        )
 
     def test_assertion_message_multiline(self, testdir):
-        testdir.makepyfile("""
+        testdir.makepyfile(
+            """
             def test_foo():
                 assert 1 == 2, "A multiline\\nfailure message"
-        """)
-        result = testdir.runpytest()
-        assert result.ret == 1
-        result.stdout.fnmatch_lines([
-            "*AssertionError*A multiline*",
-            "*failure message*",
-            "*assert 1 == 2*",
-        ])
-
-    def test_assertion_message_tuple(self, testdir):
-        testdir.makepyfile("""
-            def test_foo():
-                assert 1 == 2, (1, 2)
-        """)
+        """
+        )
         result = testdir.runpytest()
         assert result.ret == 1
-        result.stdout.fnmatch_lines([
-            "*AssertionError*%s*" % repr((1, 2)),
-            "*assert 1 == 2*",
-        ])
+        result.stdout.fnmatch_lines(
+            ["*AssertionError*A multiline*", "*failure message*", "*assert 1 == 2*"]
+        )
 
-    def test_assertion_message_expr(self, testdir):
-        testdir.makepyfile("""
+    def test_assertion_message_tuple(self, testdir):
+        testdir.makepyfile(
+            """
             def test_foo():
-                assert 1 == 2, 1 + 2
-        """)
+                assert 1 == 2, (1, 2)
+        """
+        )
         result = testdir.runpytest()
         assert result.ret == 1
-        result.stdout.fnmatch_lines([
-            "*AssertionError*3*",
-            "*assert 1 == 2*",
-        ])
+        result.stdout.fnmatch_lines(
+            ["*AssertionError*%s*" % repr((1, 2)), "*assert 1 == 2*"]
+        )
+
+    def test_assertion_message_expr(self, testdir):
+        testdir.makepyfile(
+            """
+            def test_foo():
+                assert 1 == 2, 1 + 2
+        """
+        )
+        result = testdir.runpytest()
+        assert result.ret == 1
+        result.stdout.fnmatch_lines(["*AssertionError*3*", "*assert 1 == 2*"])
 
     def test_assertion_message_escape(self, testdir):
-        testdir.makepyfile("""
+        testdir.makepyfile(
+            """
             def test_foo():
                 assert 1 == 2, 'To be escaped: %'
-        """)
+        """
+        )
         result = testdir.runpytest()
         assert result.ret == 1
-        result.stdout.fnmatch_lines([
-            "*AssertionError: To be escaped: %",
-            "*assert 1 == 2",
-        ])
+        result.stdout.fnmatch_lines(
+            ["*AssertionError: To be escaped: %", "*assert 1 == 2"]
+        )
 
     def test_boolop(self):
+
         def f():
             f = g = False
             assert f and g
 
         assert getmsg(f) == "assert (False)"
 
         def f():
             f = True
@@ -257,24 +285,30 @@ class TestAssertionRewrite(object):
         getmsg(f, must_pass=True)
 
         def x():
             return False
 
         def f():
             assert x() and x()
 
-        assert getmsg(f, {"x": x}) == """assert (False)
+        assert (
+            getmsg(f, {"x": x})
+            == """assert (False)
  +  where False = x()"""
+        )
 
         def f():
             assert False or x()
 
-        assert getmsg(f, {"x": x}) == """assert (False or False)
+        assert (
+            getmsg(f, {"x": x})
+            == """assert (False or False)
  +  where False = x()"""
+        )
 
         def f():
             assert 1 in {} and 2 in {}
 
         assert getmsg(f) == "assert (1 in {})"
 
         def f():
             x = 1
@@ -292,28 +326,30 @@ class TestAssertionRewrite(object):
 
         def f():
             f = g = h = lambda: True
             assert f() and g() and h()
 
         getmsg(f, must_pass=True)
 
     def test_short_circuit_evaluation(self):
+
         def f():
             assert True or explode  # noqa
 
         getmsg(f, must_pass=True)
 
         def f():
             x = 1
             assert x == 1 or x == 2
 
         getmsg(f, must_pass=True)
 
     def test_unary_op(self):
+
         def f():
             x = True
             assert not x
 
         assert getmsg(f) == "assert not True"
 
         def f():
             x = 0
@@ -329,118 +365,153 @@ class TestAssertionRewrite(object):
 
         def f():
             x = 0
             assert +x + x
 
         assert getmsg(f) == "assert (+0 + 0)"
 
     def test_binary_op(self):
+
         def f():
             x = 1
             y = -1
             assert x + y
 
         assert getmsg(f) == "assert (1 + -1)"
 
         def f():
             assert not 5 % 4
+
         assert getmsg(f) == "assert not (5 % 4)"
 
     def test_boolop_percent(self):
+
         def f():
             assert 3 % 2 and False
 
         assert getmsg(f) == "assert ((3 % 2) and False)"
 
         def f():
             assert False or 4 % 2
+
         assert getmsg(f) == "assert (False or (4 % 2))"
 
     @pytest.mark.skipif("sys.version_info < (3,5)")
     def test_at_operator_issue1290(self, testdir):
-        testdir.makepyfile("""
+        testdir.makepyfile(
+            """
             class Matrix(object):
                 def __init__(self, num):
                     self.num = num
                 def __matmul__(self, other):
                     return self.num * other.num
 
             def test_multmat_operator():
-                assert Matrix(2) @ Matrix(3) == 6""")
+                assert Matrix(2) @ Matrix(3) == 6"""
+        )
         testdir.runpytest().assert_outcomes(passed=1)
 
     def test_call(self):
+
         def g(a=42, *args, **kwargs):
             return False
 
         ns = {"g": g}
 
         def f():
             assert g()
 
-        assert getmsg(f, ns) == """assert False
+        assert (
+            getmsg(f, ns)
+            == """assert False
  +  where False = g()"""
+        )
 
         def f():
             assert g(1)
 
-        assert getmsg(f, ns) == """assert False
+        assert (
+            getmsg(f, ns)
+            == """assert False
  +  where False = g(1)"""
+        )
 
         def f():
             assert g(1, 2)
 
-        assert getmsg(f, ns) == """assert False
+        assert (
+            getmsg(f, ns)
+            == """assert False
  +  where False = g(1, 2)"""
+        )
 
         def f():
             assert g(1, g=42)
 
-        assert getmsg(f, ns) == """assert False
+        assert (
+            getmsg(f, ns)
+            == """assert False
  +  where False = g(1, g=42)"""
+        )
 
         def f():
             assert g(1, 3, g=23)
 
-        assert getmsg(f, ns) == """assert False
+        assert (
+            getmsg(f, ns)
+            == """assert False
  +  where False = g(1, 3, g=23)"""
+        )
 
         def f():
             seq = [1, 2, 3]
             assert g(*seq)
 
-        assert getmsg(f, ns) == """assert False
+        assert (
+            getmsg(f, ns)
+            == """assert False
  +  where False = g(*[1, 2, 3])"""
+        )
 
         def f():
             x = "a"
             assert g(**{x: 2})
 
-        assert getmsg(f, ns) == """assert False
+        assert (
+            getmsg(f, ns)
+            == """assert False
  +  where False = g(**{'a': 2})"""
+        )
 
     def test_attribute(self):
+
         class X(object):
             g = 3
 
         ns = {"x": X}
 
         def f():
             assert not x.g  # noqa
 
-        assert getmsg(f, ns) == """assert not 3
+        assert (
+            getmsg(f, ns)
+            == """assert not 3
  +  where 3 = x.g"""
+        )
 
         def f():
             x.a = False  # noqa
-            assert x.a   # noqa
+            assert x.a  # noqa
 
-        assert getmsg(f, ns) == """assert False
+        assert (
+            getmsg(f, ns)
+            == """assert False
  +  where False = x.a"""
+        )
 
     def test_comparisons(self):
 
         def f():
             a, b = range(2)
             assert b < a
 
         assert getmsg(f) == """assert 1 < 0"""
@@ -471,20 +542,23 @@ class TestAssertionRewrite(object):
         getmsg(f, must_pass=True)
 
     def test_len(self):
 
         def f():
             values = list(range(10))
             assert len(values) == 11
 
-        assert getmsg(f).startswith("""assert 10 == 11
- +  where 10 = len([""")
+        assert getmsg(f).startswith(
+            """assert 10 == 11
+ +  where 10 = len(["""
+        )
 
     def test_custom_reprcompare(self, monkeypatch):
+
         def my_reprcompare(op, left, right):
             return "42"
 
         monkeypatch.setattr(util, "_reprcompare", my_reprcompare)
 
         def f():
             assert 42 < 3
 
@@ -496,17 +570,19 @@ class TestAssertionRewrite(object):
         monkeypatch.setattr(util, "_reprcompare", my_reprcompare)
 
         def f():
             assert 1 < 3 < 5 <= 4 < 7
 
         assert getmsg(f) == "assert 5 <= 4"
 
     def test_assert_raising_nonzero_in_comparison(self):
+
         def f():
+
             class A(object):
 
                 def __nonzero__(self):
                     raise ValueError(42)
 
                 def __lt__(self, other):
                     return A()
 
@@ -516,481 +592,553 @@ class TestAssertionRewrite(object):
             def myany(x):
                 return False
 
             assert myany(A() < 0)
 
         assert "<MY42 object> < 0" in getmsg(f)
 
     def test_formatchar(self):
+
         def f():
             assert "%test" == "test"
 
         assert getmsg(f).startswith("assert '%test' == 'test'")
 
     def test_custom_repr(self):
+
         def f():
+
             class Foo(object):
                 a = 1
 
                 def __repr__(self):
                     return "\n{ \n~ \n}"
 
             f = Foo()
             assert 0 == f.a
 
         assert r"where 1 = \n{ \n~ \n}.a" in util._format_lines([getmsg(f)])[0]
 
 
 class TestRewriteOnImport(object):
 
     def test_pycache_is_a_file(self, testdir):
         testdir.tmpdir.join("__pycache__").write("Hello")
-        testdir.makepyfile("""
+        testdir.makepyfile(
+            """
             def test_rewritten():
-                assert "@py_builtins" in globals()""")
+                assert "@py_builtins" in globals()"""
+        )
         assert testdir.runpytest().ret == 0
 
     def test_pycache_is_readonly(self, testdir):
         cache = testdir.tmpdir.mkdir("__pycache__")
         old_mode = cache.stat().mode
         cache.chmod(old_mode ^ stat.S_IWRITE)
-        testdir.makepyfile("""
+        testdir.makepyfile(
+            """
             def test_rewritten():
-                assert "@py_builtins" in globals()""")
+                assert "@py_builtins" in globals()"""
+        )
         try:
             assert testdir.runpytest().ret == 0
         finally:
             cache.chmod(old_mode)
 
     def test_zipfile(self, testdir):
         z = testdir.tmpdir.join("myzip.zip")
         z_fn = str(z)
         f = zipfile.ZipFile(z_fn, "w")
         try:
             f.writestr("test_gum/__init__.py", "")
             f.writestr("test_gum/test_lizard.py", "")
         finally:
             f.close()
         z.chmod(256)
-        testdir.makepyfile("""
+        testdir.makepyfile(
+            """
             import sys
             sys.path.append(%r)
-            import test_gum.test_lizard""" % (z_fn,))
+            import test_gum.test_lizard"""
+            % (z_fn,)
+        )
         assert testdir.runpytest().ret == EXIT_NOTESTSCOLLECTED
 
     def test_readonly(self, testdir):
         sub = testdir.mkdir("testing")
         sub.join("test_readonly.py").write(
-            py.builtin._totext("""
+            py.builtin._totext(
+                """
 def test_rewritten():
     assert "@py_builtins" in globals()
-            """).encode("utf-8"), "wb")
+            """
+            ).encode(
+                "utf-8"
+            ),
+            "wb",
+        )
         old_mode = sub.stat().mode
         sub.chmod(320)
         try:
             assert testdir.runpytest().ret == 0
         finally:
             sub.chmod(old_mode)
 
     def test_dont_write_bytecode(self, testdir, monkeypatch):
-        testdir.makepyfile("""
+        testdir.makepyfile(
+            """
             import os
             def test_no_bytecode():
                 assert "__pycache__" in __cached__
                 assert not os.path.exists(__cached__)
-                assert not os.path.exists(os.path.dirname(__cached__))""")
+                assert not os.path.exists(os.path.dirname(__cached__))"""
+        )
         monkeypatch.setenv("PYTHONDONTWRITEBYTECODE", "1")
         assert testdir.runpytest_subprocess().ret == 0
 
     def test_orphaned_pyc_file(self, testdir):
-        if sys.version_info < (3, 0) and hasattr(sys, 'pypy_version_info'):
+        if sys.version_info < (3, 0) and hasattr(sys, "pypy_version_info"):
             pytest.skip("pypy2 doesn't run orphaned pyc files")
 
-        testdir.makepyfile("""
+        testdir.makepyfile(
+            """
             import orphan
             def test_it():
                 assert orphan.value == 17
-            """)
-        testdir.makepyfile(orphan="""
+            """
+        )
+        testdir.makepyfile(
+            orphan="""
             value = 17
-            """)
+            """
+        )
         py_compile.compile("orphan.py")
         os.remove("orphan.py")
 
         # Python 3 puts the .pyc files in a __pycache__ directory, and will
         # not import from there without source.  It will import a .pyc from
         # the source location though.
         if not os.path.exists("orphan.pyc"):
             pycs = glob.glob("__pycache__/orphan.*.pyc")
             assert len(pycs) == 1
             os.rename(pycs[0], "orphan.pyc")
 
         assert testdir.runpytest().ret == 0
 
     @pytest.mark.skipif('"__pypy__" in sys.modules')
     def test_pyc_vs_pyo(self, testdir, monkeypatch):
-        testdir.makepyfile("""
+        testdir.makepyfile(
+            """
             import pytest
             def test_optimized():
                 "hello"
                 assert test_optimized.__doc__ is None"""
-                           )
-        p = py.path.local.make_numbered_dir(prefix="runpytest-", keep=None,
-                                            rootdir=testdir.tmpdir)
+        )
+        p = py.path.local.make_numbered_dir(
+            prefix="runpytest-", keep=None, rootdir=testdir.tmpdir
+        )
         tmp = "--basetemp=%s" % p
         monkeypatch.setenv("PYTHONOPTIMIZE", "2")
         monkeypatch.delenv("PYTHONDONTWRITEBYTECODE", raising=False)
         assert testdir.runpytest_subprocess(tmp).ret == 0
         tagged = "test_pyc_vs_pyo." + PYTEST_TAG
         assert tagged + ".pyo" in os.listdir("__pycache__")
         monkeypatch.undo()
         monkeypatch.delenv("PYTHONDONTWRITEBYTECODE", raising=False)
         assert testdir.runpytest_subprocess(tmp).ret == 1
         assert tagged + ".pyc" in os.listdir("__pycache__")
 
     def test_package(self, testdir):
         pkg = testdir.tmpdir.join("pkg")
         pkg.mkdir()
         pkg.join("__init__.py").ensure()
-        pkg.join("test_blah.py").write("""
+        pkg.join("test_blah.py").write(
+            """
 def test_rewritten():
-    assert "@py_builtins" in globals()""")
+    assert "@py_builtins" in globals()"""
+        )
         assert testdir.runpytest().ret == 0
 
     def test_translate_newlines(self, testdir):
         content = "def test_rewritten():\r\n assert '@py_builtins' in globals()"
         b = content.encode("utf-8")
         testdir.tmpdir.join("test_newlines.py").write(b, "wb")
         assert testdir.runpytest().ret == 0
 
-    @pytest.mark.skipif(sys.version_info < (3, 3),
-                        reason='packages without __init__.py not supported on python 2')
+    @pytest.mark.skipif(
+        sys.version_info < (3, 4),
+        reason="packages without __init__.py not supported on python 2",
+    )
     def test_package_without__init__py(self, testdir):
-        pkg = testdir.mkdir('a_package_without_init_py')
-        pkg.join('module.py').ensure()
+        pkg = testdir.mkdir("a_package_without_init_py")
+        pkg.join("module.py").ensure()
         testdir.makepyfile("import a_package_without_init_py.module")
         assert testdir.runpytest().ret == EXIT_NOTESTSCOLLECTED
 
     def test_rewrite_warning(self, pytestconfig, monkeypatch):
         hook = AssertionRewritingHook(pytestconfig)
         warnings = []
 
         def mywarn(code, msg):
             warnings.append((code, msg))
 
-        monkeypatch.setattr(hook.config, 'warn', mywarn)
-        hook.mark_rewrite('_pytest')
-        assert '_pytest' in warnings[0][1]
+        monkeypatch.setattr(hook.config, "warn", mywarn)
+        hook.mark_rewrite("_pytest")
+        assert "_pytest" in warnings[0][1]
 
     def test_rewrite_module_imported_from_conftest(self, testdir):
-        testdir.makeconftest('''
+        testdir.makeconftest(
+            """
             import test_rewrite_module_imported
-        ''')
-        testdir.makepyfile(test_rewrite_module_imported='''
+        """
+        )
+        testdir.makepyfile(
+            test_rewrite_module_imported="""
             def test_rewritten():
                 assert "@py_builtins" in globals()
-        ''')
+        """
+        )
         assert testdir.runpytest_subprocess().ret == 0
 
     def test_remember_rewritten_modules(self, pytestconfig, testdir, monkeypatch):
         """
         AssertionRewriteHook should remember rewritten modules so it
         doesn't give false positives (#2005).
         """
         monkeypatch.syspath_prepend(testdir.tmpdir)
-        testdir.makepyfile(test_remember_rewritten_modules='')
+        testdir.makepyfile(test_remember_rewritten_modules="")
         warnings = []
         hook = AssertionRewritingHook(pytestconfig)
-        monkeypatch.setattr(hook.config, 'warn', lambda code, msg: warnings.append(msg))
-        hook.find_module('test_remember_rewritten_modules')
-        hook.load_module('test_remember_rewritten_modules')
-        hook.mark_rewrite('test_remember_rewritten_modules')
-        hook.mark_rewrite('test_remember_rewritten_modules')
+        monkeypatch.setattr(hook.config, "warn", lambda code, msg: warnings.append(msg))
+        hook.find_module("test_remember_rewritten_modules")
+        hook.load_module("test_remember_rewritten_modules")
+        hook.mark_rewrite("test_remember_rewritten_modules")
+        hook.mark_rewrite("test_remember_rewritten_modules")
         assert warnings == []
 
     def test_rewrite_warning_using_pytest_plugins(self, testdir):
-        testdir.makepyfile(**{
-            'conftest.py': "pytest_plugins = ['core', 'gui', 'sci']",
-            'core.py': "",
-            'gui.py': "pytest_plugins = ['core', 'sci']",
-            'sci.py': "pytest_plugins = ['core']",
-            'test_rewrite_warning_pytest_plugins.py': "def test(): pass",
-        })
+        testdir.makepyfile(
+            **{
+                "conftest.py": "pytest_plugins = ['core', 'gui', 'sci']",
+                "core.py": "",
+                "gui.py": "pytest_plugins = ['core', 'sci']",
+                "sci.py": "pytest_plugins = ['core']",
+                "test_rewrite_warning_pytest_plugins.py": "def test(): pass",
+            }
+        )
         testdir.chdir()
         result = testdir.runpytest_subprocess()
-        result.stdout.fnmatch_lines(['*= 1 passed in *=*'])
-        assert 'pytest-warning summary' not in result.stdout.str()
+        result.stdout.fnmatch_lines(["*= 1 passed in *=*"])
+        assert "pytest-warning summary" not in result.stdout.str()
 
     def test_rewrite_warning_using_pytest_plugins_env_var(self, testdir, monkeypatch):
-        monkeypatch.setenv('PYTEST_PLUGINS', 'plugin')
-        testdir.makepyfile(**{
-            'plugin.py': "",
-            'test_rewrite_warning_using_pytest_plugins_env_var.py': """
+        monkeypatch.setenv("PYTEST_PLUGINS", "plugin")
+        testdir.makepyfile(
+            **{
+                "plugin.py": "",
+                "test_rewrite_warning_using_pytest_plugins_env_var.py": """
                 import plugin
                 pytest_plugins = ['plugin']
                 def test():
                     pass
             """,
-        })
+            }
+        )
         testdir.chdir()
         result = testdir.runpytest_subprocess()
-        result.stdout.fnmatch_lines(['*= 1 passed in *=*'])
-        assert 'pytest-warning summary' not in result.stdout.str()
+        result.stdout.fnmatch_lines(["*= 1 passed in *=*"])
+        assert "pytest-warning summary" not in result.stdout.str()
 
-    @pytest.mark.skipif(sys.version_info[0] > 2, reason='python 2 only')
+    @pytest.mark.skipif(sys.version_info[0] > 2, reason="python 2 only")
     def test_rewrite_future_imports(self, testdir):
         """Test that rewritten modules don't inherit the __future__ flags
         from the assertrewrite module.
 
         assertion.rewrite imports __future__.division (and others), so
         ensure rewritten modules don't inherit those flags.
 
         The test below will fail if __future__.division is enabled
         """
-        testdir.makepyfile('''
+        testdir.makepyfile(
+            """
             def test():
                 x = 1 / 2
                 assert type(x) is int
-        ''')
+        """
+        )
         result = testdir.runpytest()
         assert result.ret == 0
 
 
 class TestAssertionRewriteHookDetails(object):
+
     def test_loader_is_package_false_for_module(self, testdir):
-        testdir.makepyfile(test_fun="""
+        testdir.makepyfile(
+            test_fun="""
             def test_loader():
                 assert not __loader__.is_package(__name__)
-            """)
+            """
+        )
         result = testdir.runpytest()
-        result.stdout.fnmatch_lines([
-            "* 1 passed*",
-        ])
+        result.stdout.fnmatch_lines(["* 1 passed*"])
 
     def test_loader_is_package_true_for_package(self, testdir):
-        testdir.makepyfile(test_fun="""
+        testdir.makepyfile(
+            test_fun="""
             def test_loader():
                 assert not __loader__.is_package(__name__)
 
             def test_fun():
                 assert __loader__.is_package('fun')
 
             def test_missing():
                 assert not __loader__.is_package('pytest_not_there')
-            """)
-        testdir.mkpydir('fun')
+            """
+        )
+        testdir.mkpydir("fun")
         result = testdir.runpytest()
-        result.stdout.fnmatch_lines([
-            '* 3 passed*',
-        ])
+        result.stdout.fnmatch_lines(["* 3 passed*"])
 
     @pytest.mark.skipif("sys.version_info[0] >= 3")
     @pytest.mark.xfail("hasattr(sys, 'pypy_translation_info')")
     def test_assume_ascii(self, testdir):
         content = "u'\xe2\x99\xa5\x01\xfe'"
         testdir.tmpdir.join("test_encoding.py").write(content, "wb")
         res = testdir.runpytest()
         assert res.ret != 0
         assert "SyntaxError: Non-ASCII character" in res.stdout.str()
 
     @pytest.mark.skipif("sys.version_info[0] >= 3")
     def test_detect_coding_cookie(self, testdir):
-        testdir.makepyfile(test_cookie="""
+        testdir.makepyfile(
+            test_cookie="""
             # -*- coding: utf-8 -*-
             u"St\xc3\xa4d"
             def test_rewritten():
-                assert "@py_builtins" in globals()""")
+                assert "@py_builtins" in globals()"""
+        )
         assert testdir.runpytest().ret == 0
 
     @pytest.mark.skipif("sys.version_info[0] >= 3")
     def test_detect_coding_cookie_second_line(self, testdir):
-        testdir.makepyfile(test_cookie="""
+        testdir.makepyfile(
+            test_cookie="""
             # -*- coding: utf-8 -*-
             u"St\xc3\xa4d"
             def test_rewritten():
-                assert "@py_builtins" in globals()""")
+                assert "@py_builtins" in globals()"""
+        )
         assert testdir.runpytest().ret == 0
 
     @pytest.mark.skipif("sys.version_info[0] >= 3")
     def test_detect_coding_cookie_crlf(self, testdir):
-        testdir.makepyfile(test_cookie="""
+        testdir.makepyfile(
+            test_cookie="""
             # -*- coding: utf-8 -*-
             u"St\xc3\xa4d"
             def test_rewritten():
-                assert "@py_builtins" in globals()""")
+                assert "@py_builtins" in globals()"""
+        )
         assert testdir.runpytest().ret == 0
 
     def test_sys_meta_path_munged(self, testdir):
-        testdir.makepyfile("""
+        testdir.makepyfile(
+            """
             def test_meta_path():
-                import sys; sys.meta_path = []""")
+                import sys; sys.meta_path = []"""
+        )
         assert testdir.runpytest().ret == 0
 
     def test_write_pyc(self, testdir, tmpdir, monkeypatch):
         from _pytest.assertion.rewrite import _write_pyc
         from _pytest.assertion import AssertionState
-        try:
-            import __builtin__ as b
-        except ImportError:
-            import builtins as b
+        import atomicwrites
+        from contextlib import contextmanager
+
         config = testdir.parseconfig([])
         state = AssertionState(config, "rewrite")
         source_path = tmpdir.ensure("source.py")
         pycpath = tmpdir.join("pyc").strpath
         assert _write_pyc(state, [1], source_path.stat(), pycpath)
 
-        def open(*args):
+        @contextmanager
+        def atomic_write_failed(fn, mode="r", overwrite=False):
             e = IOError()
             e.errno = 10
             raise e
+            yield  # noqa
 
-        monkeypatch.setattr(b, "open", open)
+        monkeypatch.setattr(atomicwrites, "atomic_write", atomic_write_failed)
         assert not _write_pyc(state, [1], source_path.stat(), pycpath)
 
     def test_resources_provider_for_loader(self, testdir):
         """
         Attempts to load resources from a package should succeed normally,
         even when the AssertionRewriteHook is used to load the modules.
 
         See #366 for details.
         """
         pytest.importorskip("pkg_resources")
 
-        testdir.mkpydir('testpkg')
+        testdir.mkpydir("testpkg")
         contents = {
-            'testpkg/test_pkg': """
+            "testpkg/test_pkg": """
                 import pkg_resources
 
                 import pytest
                 from _pytest.assertion.rewrite import AssertionRewritingHook
 
                 def test_load_resource():
                     assert isinstance(__loader__, AssertionRewritingHook)
                     res = pkg_resources.resource_string(__name__, 'resource.txt')
                     res = res.decode('ascii')
                     assert res == 'Load me please.'
-                """,
+                """
         }
         testdir.makepyfile(**contents)
-        testdir.maketxtfile(**{'testpkg/resource': "Load me please."})
+        testdir.maketxtfile(**{"testpkg/resource": "Load me please."})
 
         result = testdir.runpytest_subprocess()
         result.assert_outcomes(passed=1)
 
     def test_read_pyc(self, tmpdir):
         """
         Ensure that the `_read_pyc` can properly deal with corrupted pyc files.
         In those circumstances it should just give up instead of generating
         an exception that is propagated to the caller.
         """
         import py_compile
         from _pytest.assertion.rewrite import _read_pyc
 
-        source = tmpdir.join('source.py')
-        pyc = source + 'c'
+        source = tmpdir.join("source.py")
+        pyc = source + "c"
 
-        source.write('def test(): pass')
+        source.write("def test(): pass")
         py_compile.compile(str(source), str(pyc))
 
-        contents = pyc.read(mode='rb')
+        contents = pyc.read(mode="rb")
         strip_bytes = 20  # header is around 8 bytes, strip a little more
         assert len(contents) > strip_bytes
-        pyc.write(contents[:strip_bytes], mode='wb')
+        pyc.write(contents[:strip_bytes], mode="wb")
 
         assert _read_pyc(source, str(pyc)) is None  # no error
 
     def test_reload_is_same(self, testdir):
         # A file that will be picked up during collecting.
         testdir.tmpdir.join("file.py").ensure()
-        testdir.tmpdir.join("pytest.ini").write(py.std.textwrap.dedent("""
+        testdir.tmpdir.join("pytest.ini").write(
+            textwrap.dedent(
+                """
             [pytest]
             python_files = *.py
-        """))
+        """
+            )
+        )
 
-        testdir.makepyfile(test_fun="""
+        testdir.makepyfile(
+            test_fun="""
             import sys
             try:
                 from imp import reload
             except ImportError:
                 pass
 
             def test_loader():
                 import file
                 assert sys.modules["file"] is reload(file)
-            """)
-        result = testdir.runpytest('-s')
-        result.stdout.fnmatch_lines([
-            "* 1 passed*",
-        ])
+            """
+        )
+        result = testdir.runpytest("-s")
+        result.stdout.fnmatch_lines(["* 1 passed*"])
 
     def test_get_data_support(self, testdir):
         """Implement optional PEP302 api (#808).
         """
         path = testdir.mkpydir("foo")
-        path.join("test_foo.py").write(_pytest._code.Source("""
+        path.join("test_foo.py").write(
+            _pytest._code.Source(
+                """
             class Test(object):
                 def test_foo(self):
                     import pkgutil
                     data = pkgutil.get_data('foo.test_foo', 'data.txt')
                     assert data == b'Hey'
-        """))
-        path.join('data.txt').write('Hey')
+        """
+            )
+        )
+        path.join("data.txt").write("Hey")
         result = testdir.runpytest()
-        result.stdout.fnmatch_lines('*1 passed*')
+        result.stdout.fnmatch_lines("*1 passed*")
 
 
 def test_issue731(testdir):
-    testdir.makepyfile("""
+    testdir.makepyfile(
+        """
     class LongReprWithBraces(object):
         def __repr__(self):
            return 'LongReprWithBraces({' + ('a' * 80) + '}' + ('a' * 120) + ')'
 
         def some_method(self):
             return False
 
     def test_long_repr():
         obj = LongReprWithBraces()
         assert obj.some_method()
-    """)
+    """
+    )
     result = testdir.runpytest()
-    assert 'unbalanced braces' not in result.stdout.str()
+    assert "unbalanced braces" not in result.stdout.str()
 
 
 class TestIssue925(object):
+
     def test_simple_case(self, testdir):
-        testdir.makepyfile("""
+        testdir.makepyfile(
+            """
         def test_ternary_display():
             assert (False == False) == False
-        """)
+        """
+        )
         result = testdir.runpytest()
-        result.stdout.fnmatch_lines('*E*assert (False == False) == False')
+        result.stdout.fnmatch_lines("*E*assert (False == False) == False")
 
     def test_long_case(self, testdir):
-        testdir.makepyfile("""
+        testdir.makepyfile(
+            """
         def test_ternary_display():
              assert False == (False == True) == True
-        """)
+        """
+        )
         result = testdir.runpytest()
-        result.stdout.fnmatch_lines('*E*assert (False == True) == True')
+        result.stdout.fnmatch_lines("*E*assert (False == True) == True")
 
     def test_many_brackets(self, testdir):
-        testdir.makepyfile("""
+        testdir.makepyfile(
+            """
             def test_ternary_display():
                  assert True == ((False == True) == True)
-            """)
+            """
+        )
         result = testdir.runpytest()
-        result.stdout.fnmatch_lines('*E*assert True == ((False == True) == True)')
+        result.stdout.fnmatch_lines("*E*assert True == ((False == True) == True)")
 
 
 class TestIssue2121():
+
     def test_simple(self, testdir):
-        testdir.tmpdir.join("tests/file.py").ensure().write("""
+        testdir.tmpdir.join("tests/file.py").ensure().write(
+            """
 def test_simple_failure():
     assert 1 + 1 == 3
-""")
-        testdir.tmpdir.join("pytest.ini").write(py.std.textwrap.dedent("""
+"""
+        )
+        testdir.tmpdir.join("pytest.ini").write(
+            textwrap.dedent(
+                """
             [pytest]
             python_files = tests/**.py
-        """))
+        """
+            )
+        )
 
         result = testdir.runpytest()
-        result.stdout.fnmatch_lines('*E*assert (1 + 1) == 3')
+        result.stdout.fnmatch_lines("*E*assert (1 + 1) == 3")
deleted file mode 100755
--- a/third_party/python/pytest/testing/test_cache.py
+++ /dev/null
@@ -1,605 +0,0 @@
-from __future__ import absolute_import, division, print_function
-import sys
-import py
-import _pytest
-import pytest
-import os
-import shutil
-
-pytest_plugins = "pytester",
-
-
-class TestNewAPI(object):
-    def test_config_cache_makedir(self, testdir):
-        testdir.makeini("[pytest]")
-        config = testdir.parseconfigure()
-        with pytest.raises(ValueError):
-            config.cache.makedir("key/name")
-
-        p = config.cache.makedir("name")
-        assert p.check()
-
-    def test_config_cache_dataerror(self, testdir):
-        testdir.makeini("[pytest]")
-        config = testdir.parseconfigure()
-        cache = config.cache
-        pytest.raises(TypeError, lambda: cache.set("key/name", cache))
-        config.cache.set("key/name", 0)
-        config.cache._getvaluepath("key/name").write("123invalid")
-        val = config.cache.get("key/name", -2)
-        assert val == -2
-
-    def test_cache_writefail_cachfile_silent(self, testdir):
-        testdir.makeini("[pytest]")
-        testdir.tmpdir.join('.cache').write('gone wrong')
-        config = testdir.parseconfigure()
-        cache = config.cache
-        cache.set('test/broken', [])
-
-    @pytest.mark.skipif(sys.platform.startswith('win'), reason='no chmod on windows')
-    def test_cache_writefail_permissions(self, testdir):
-        testdir.makeini("[pytest]")
-        testdir.tmpdir.ensure_dir('.cache').chmod(0)
-        config = testdir.parseconfigure()
-        cache = config.cache
-        cache.set('test/broken', [])
-
-    @pytest.mark.skipif(sys.platform.startswith('win'), reason='no chmod on windows')
-    def test_cache_failure_warns(self, testdir):
-        testdir.tmpdir.ensure_dir('.cache').chmod(0)
-        testdir.makepyfile("""
-            def test_error():
-                raise Exception
-
-        """)
-        result = testdir.runpytest('-rw')
-        assert result.ret == 1
-        result.stdout.fnmatch_lines([
-            "*could not create cache path*",
-            "*1 warnings*",
-        ])
-
-    def test_config_cache(self, testdir):
-        testdir.makeconftest("""
-            def pytest_configure(config):
-                # see that we get cache information early on
-                assert hasattr(config, "cache")
-        """)
-        testdir.makepyfile("""
-            def test_session(pytestconfig):
-                assert hasattr(pytestconfig, "cache")
-        """)
-        result = testdir.runpytest()
-        assert result.ret == 0
-        result.stdout.fnmatch_lines(["*1 passed*"])
-
-    def test_cachefuncarg(self, testdir):
-        testdir.makepyfile("""
-            import pytest
-            def test_cachefuncarg(cache):
-                val = cache.get("some/thing", None)
-                assert val is None
-                cache.set("some/thing", [1])
-                pytest.raises(TypeError, lambda: cache.get("some/thing"))
-                val = cache.get("some/thing", [])
-                assert val == [1]
-        """)
-        result = testdir.runpytest()
-        assert result.ret == 0
-        result.stdout.fnmatch_lines(["*1 passed*"])
-
-    def test_custom_rel_cache_dir(self, testdir):
-        rel_cache_dir = os.path.join('custom_cache_dir', 'subdir')
-        testdir.makeini("""
-            [pytest]
-            cache_dir = {cache_dir}
-        """.format(cache_dir=rel_cache_dir))
-        testdir.makepyfile(test_errored='def test_error():\n    assert False')
-        testdir.runpytest()
-        assert testdir.tmpdir.join(rel_cache_dir).isdir()
-
-    def test_custom_abs_cache_dir(self, testdir, tmpdir_factory):
-        tmp = str(tmpdir_factory.mktemp('tmp'))
-        abs_cache_dir = os.path.join(tmp, 'custom_cache_dir')
-        testdir.makeini("""
-            [pytest]
-            cache_dir = {cache_dir}
-        """.format(cache_dir=abs_cache_dir))
-        testdir.makepyfile(test_errored='def test_error():\n    assert False')
-        testdir.runpytest()
-        assert py.path.local(abs_cache_dir).isdir()
-
-    def test_custom_cache_dir_with_env_var(self, testdir, monkeypatch):
-        monkeypatch.setenv('env_var', 'custom_cache_dir')
-        testdir.makeini("""
-            [pytest]
-            cache_dir = {cache_dir}
-        """.format(cache_dir='$env_var'))
-        testdir.makepyfile(test_errored='def test_error():\n    assert False')
-        testdir.runpytest()
-        assert testdir.tmpdir.join('custom_cache_dir').isdir()
-
-
-def test_cache_reportheader(testdir):
-    testdir.makepyfile("""
-        def test_hello():
-            pass
-    """)
-    result = testdir.runpytest("-v")
-    result.stdout.fnmatch_lines([
-        "cachedir: .cache"
-    ])
-
-
-def test_cache_show(testdir):
-    result = testdir.runpytest("--cache-show")
-    assert result.ret == 0
-    result.stdout.fnmatch_lines([
-        "*cache is empty*"
-    ])
-    testdir.makeconftest("""
-        def pytest_configure(config):
-            config.cache.set("my/name", [1,2,3])
-            config.cache.set("other/some", {1:2})
-            dp = config.cache.makedir("mydb")
-            dp.ensure("hello")
-            dp.ensure("world")
-    """)
-    result = testdir.runpytest()
-    assert result.ret == 5  # no tests executed
-    result = testdir.runpytest("--cache-show")
-    result.stdout.fnmatch_lines_random([
-        "*cachedir:*",
-        "-*cache values*-",
-        "*my/name contains:",
-        "  [1, 2, 3]",
-        "*other/some contains*",
-        "  {*1*: 2}",
-        "-*cache directories*-",
-        "*mydb/hello*length 0*",
-        "*mydb/world*length 0*",
-    ])
-
-
-class TestLastFailed(object):
-
-    def test_lastfailed_usecase(self, testdir, monkeypatch):
-        monkeypatch.setenv("PYTHONDONTWRITEBYTECODE", 1)
-        p = testdir.makepyfile("""
-            def test_1():
-                assert 0
-            def test_2():
-                assert 0
-            def test_3():
-                assert 1
-        """)
-        result = testdir.runpytest()
-        result.stdout.fnmatch_lines([
-            "*2 failed*",
-        ])
-        p.write(_pytest._code.Source("""
-            def test_1():
-                assert 1
-
-            def test_2():
-                assert 1
-
-            def test_3():
-                assert 0
-        """))
-        result = testdir.runpytest("--lf")
-        result.stdout.fnmatch_lines([
-            "*2 passed*1 desel*",
-        ])
-        result = testdir.runpytest("--lf")
-        result.stdout.fnmatch_lines([
-            "*1 failed*2 passed*",
-        ])
-        result = testdir.runpytest("--lf", "--cache-clear")
-        result.stdout.fnmatch_lines([
-            "*1 failed*2 passed*",
-        ])
-
-        # Run this again to make sure clear-cache is robust
-        if os.path.isdir('.cache'):
-            shutil.rmtree('.cache')
-        result = testdir.runpytest("--lf", "--cache-clear")
-        result.stdout.fnmatch_lines([
-            "*1 failed*2 passed*",
-        ])
-
-    def test_failedfirst_order(self, testdir):
-        testdir.tmpdir.join('test_a.py').write(_pytest._code.Source("""
-            def test_always_passes():
-                assert 1
-        """))
-        testdir.tmpdir.join('test_b.py').write(_pytest._code.Source("""
-            def test_always_fails():
-                assert 0
-        """))
-        result = testdir.runpytest()
-        # Test order will be collection order; alphabetical
-        result.stdout.fnmatch_lines([
-            "test_a.py*",
-            "test_b.py*",
-        ])
-        result = testdir.runpytest("--ff")
-        # Test order will be failing tests firs
-        result.stdout.fnmatch_lines([
-            "test_b.py*",
-            "test_a.py*",
-        ])
-
-    def test_lastfailed_failedfirst_order(self, testdir):
-        testdir.makepyfile(**{
-            'test_a.py': """
-                def test_always_passes():
-                    assert 1
-            """,
-            'test_b.py': """
-                def test_always_fails():
-                    assert 0
-            """,
-        })
-        result = testdir.runpytest()
-        # Test order will be collection order; alphabetical
-        result.stdout.fnmatch_lines([
-            "test_a.py*",
-            "test_b.py*",
-        ])
-        result = testdir.runpytest("--lf", "--ff")
-        # Test order will be failing tests firs
-        result.stdout.fnmatch_lines([
-            "test_b.py*",
-        ])
-        assert 'test_a.py' not in result.stdout.str()
-
-    def test_lastfailed_difference_invocations(self, testdir, monkeypatch):
-        monkeypatch.setenv("PYTHONDONTWRITEBYTECODE", 1)
-        testdir.makepyfile(test_a="""
-            def test_a1():
-                assert 0
-            def test_a2():
-                assert 1
-        """, test_b="""
-            def test_b1():
-                assert 0
-        """)
-        p = testdir.tmpdir.join("test_a.py")
-        p2 = testdir.tmpdir.join("test_b.py")
-
-        result = testdir.runpytest()
-        result.stdout.fnmatch_lines([
-            "*2 failed*",
-        ])
-        result = testdir.runpytest("--lf", p2)
-        result.stdout.fnmatch_lines([
-            "*1 failed*",
-        ])
-        p2.write(_pytest._code.Source("""
-            def test_b1():
-                assert 1
-        """))
-        result = testdir.runpytest("--lf", p2)
-        result.stdout.fnmatch_lines([
-            "*1 passed*",
-        ])
-        result = testdir.runpytest("--lf", p)
-        result.stdout.fnmatch_lines([
-            "*1 failed*1 desel*",
-        ])
-
-    def test_lastfailed_usecase_splice(self, testdir, monkeypatch):
-        monkeypatch.setenv("PYTHONDONTWRITEBYTECODE", 1)
-        testdir.makepyfile("""
-            def test_1():
-                assert 0
-        """)
-        p2 = testdir.tmpdir.join("test_something.py")
-        p2.write(_pytest._code.Source("""
-            def test_2():
-                assert 0
-        """))
-        result = testdir.runpytest()
-        result.stdout.fnmatch_lines([
-            "*2 failed*",
-        ])
-        result = testdir.runpytest("--lf", p2)
-        result.stdout.fnmatch_lines([
-            "*1 failed*",
-        ])
-        result = testdir.runpytest("--lf")
-        result.stdout.fnmatch_lines([
-            "*2 failed*",
-        ])
-
-    def test_lastfailed_xpass(self, testdir):
-        testdir.inline_runsource("""
-            import pytest
-            @pytest.mark.xfail
-            def test_hello():
-                assert 1
-        """)
-        config = testdir.parseconfigure()
-        lastfailed = config.cache.get("cache/lastfailed", -1)
-        assert lastfailed == -1
-
-    def test_non_serializable_parametrize(self, testdir):
-        """Test that failed parametrized tests with unmarshable parameters
-        don't break pytest-cache.
-        """
-        testdir.makepyfile(r"""
-            import pytest
-
-            @pytest.mark.parametrize('val', [
-                b'\xac\x10\x02G',
-            ])
-            def test_fail(val):
-                assert False
-        """)
-        result = testdir.runpytest()
-        result.stdout.fnmatch_lines('*1 failed in*')
-
-    def test_terminal_report_lastfailed(self, testdir):
-        test_a = testdir.makepyfile(test_a="""
-            def test_a1():
-                pass
-            def test_a2():
-                pass
-        """)
-        test_b = testdir.makepyfile(test_b="""
-            def test_b1():
-                assert 0
-            def test_b2():
-                assert 0
-        """)
-        result = testdir.runpytest()
-        result.stdout.fnmatch_lines([
-            'collected 4 items',
-            '*2 failed, 2 passed in*',
-        ])
-
-        result = testdir.runpytest('--lf')
-        result.stdout.fnmatch_lines([
-            'collected 4 items',
-            'run-last-failure: rerun previous 2 failures',
-            '*2 failed, 2 deselected in*',
-        ])
-
-        result = testdir.runpytest(test_a, '--lf')
-        result.stdout.fnmatch_lines([
-            'collected 2 items',
-            'run-last-failure: run all (no recorded failures)',
-            '*2 passed in*',
-        ])
-
-        result = testdir.runpytest(test_b, '--lf')
-        result.stdout.fnmatch_lines([
-            'collected 2 items',
-            'run-last-failure: rerun previous 2 failures',
-            '*2 failed in*',
-        ])
-
-        result = testdir.runpytest('test_b.py::test_b1', '--lf')
-        result.stdout.fnmatch_lines([
-            'collected 1 item',
-            'run-last-failure: rerun previous 1 failure',
-            '*1 failed in*',
-        ])
-
-    def test_terminal_report_failedfirst(self, testdir):
-        testdir.makepyfile(test_a="""
-            def test_a1():
-                assert 0
-            def test_a2():
-                pass
-        """)
-        result = testdir.runpytest()
-        result.stdout.fnmatch_lines([
-            'collected 2 items',
-            '*1 failed, 1 passed in*',
-        ])
-
-        result = testdir.runpytest('--ff')
-        result.stdout.fnmatch_lines([
-            'collected 2 items',
-            'run-last-failure: rerun previous 1 failure first',
-            '*1 failed, 1 passed in*',
-        ])
-
-    def test_lastfailed_collectfailure(self, testdir, monkeypatch):
-
-        testdir.makepyfile(test_maybe="""
-            import py
-            env = py.std.os.environ
-            if '1' == env['FAILIMPORT']:
-                raise ImportError('fail')
-            def test_hello():
-                assert '0' == env['FAILTEST']
-        """)
-
-        def rlf(fail_import, fail_run):
-            monkeypatch.setenv('FAILIMPORT', fail_import)
-            monkeypatch.setenv('FAILTEST', fail_run)
-
-            testdir.runpytest('-q')
-            config = testdir.parseconfigure()
-            lastfailed = config.cache.get("cache/lastfailed", -1)
-            return lastfailed
-
-        lastfailed = rlf(fail_import=0, fail_run=0)
-        assert lastfailed == -1
-
-        lastfailed = rlf(fail_import=1, fail_run=0)
-        assert list(lastfailed) == ['test_maybe.py']
-
-        lastfailed = rlf(fail_import=0, fail_run=1)
-        assert list(lastfailed) == ['test_maybe.py::test_hello']
-
-    def test_lastfailed_failure_subset(self, testdir, monkeypatch):
-
-        testdir.makepyfile(test_maybe="""
-            import py
-            env = py.std.os.environ
-            if '1' == env['FAILIMPORT']:
-                raise ImportError('fail')
-            def test_hello():
-                assert '0' == env['FAILTEST']
-        """)
-
-        testdir.makepyfile(test_maybe2="""
-            import py
-            env = py.std.os.environ
-            if '1' == env['FAILIMPORT']:
-                raise ImportError('fail')
-            def test_hello():
-                assert '0' == env['FAILTEST']
-
-            def test_pass():
-                pass
-        """)
-
-        def rlf(fail_import, fail_run, args=()):
-            monkeypatch.setenv('FAILIMPORT', fail_import)
-            monkeypatch.setenv('FAILTEST', fail_run)
-
-            result = testdir.runpytest('-q', '--lf', *args)
-            config = testdir.parseconfigure()
-            lastfailed = config.cache.get("cache/lastfailed", -1)
-            return result, lastfailed
-
-        result, lastfailed = rlf(fail_import=0, fail_run=0)
-        assert lastfailed == -1
-        result.stdout.fnmatch_lines([
-            '*3 passed*',
-        ])
-
-        result, lastfailed = rlf(fail_import=1, fail_run=0)
-        assert sorted(list(lastfailed)) == ['test_maybe.py', 'test_maybe2.py']
-
-        result, lastfailed = rlf(fail_import=0, fail_run=0,
-                                 args=('test_maybe2.py',))
-        assert list(lastfailed) == ['test_maybe.py']
-
-        # edge case of test selection - even if we remember failures
-        # from other tests we still need to run all tests if no test
-        # matches the failures
-        result, lastfailed = rlf(fail_import=0, fail_run=0,
-                                 args=('test_maybe2.py',))
-        assert list(lastfailed) == ['test_maybe.py']
-        result.stdout.fnmatch_lines([
-            '*2 passed*',
-        ])
-
-    def test_lastfailed_creates_cache_when_needed(self, testdir):
-        # Issue #1342
-        testdir.makepyfile(test_empty='')
-        testdir.runpytest('-q', '--lf')
-        assert not os.path.exists('.cache')
-
-        testdir.makepyfile(test_successful='def test_success():\n    assert True')
-        testdir.runpytest('-q', '--lf')
-        assert not os.path.exists('.cache')
-
-        testdir.makepyfile(test_errored='def test_error():\n    assert False')
-        testdir.runpytest('-q', '--lf')
-        assert os.path.exists('.cache')
-
-    def test_xfail_not_considered_failure(self, testdir):
-        testdir.makepyfile('''
-            import pytest
-            @pytest.mark.xfail
-            def test():
-                assert 0
-        ''')
-        result = testdir.runpytest()
-        result.stdout.fnmatch_lines('*1 xfailed*')
-        assert self.get_cached_last_failed(testdir) == []
-
-    def test_xfail_strict_considered_failure(self, testdir):
-        testdir.makepyfile('''
-            import pytest
-            @pytest.mark.xfail(strict=True)
-            def test():
-                pass
-        ''')
-        result = testdir.runpytest()
-        result.stdout.fnmatch_lines('*1 failed*')
-        assert self.get_cached_last_failed(testdir) == ['test_xfail_strict_considered_failure.py::test']
-
-    @pytest.mark.parametrize('mark', ['mark.xfail', 'mark.skip'])
-    def test_failed_changed_to_xfail_or_skip(self, testdir, mark):
-        testdir.makepyfile('''
-            import pytest
-            def test():
-                assert 0
-        ''')
-        result = testdir.runpytest()
-        assert self.get_cached_last_failed(testdir) == ['test_failed_changed_to_xfail_or_skip.py::test']
-        assert result.ret == 1
-
-        testdir.makepyfile('''
-            import pytest
-            @pytest.{mark}
-            def test():
-                assert 0
-        '''.format(mark=mark))
-        result = testdir.runpytest()
-        assert result.ret == 0
-        assert self.get_cached_last_failed(testdir) == []
-        assert result.ret == 0
-
-    def get_cached_last_failed(self, testdir):
-        config = testdir.parseconfigure()
-        return sorted(config.cache.get("cache/lastfailed", {}))
-
-    def test_cache_cumulative(self, testdir):
-        """
-        Test workflow where user fixes errors gradually file by file using --lf.
-        """
-        # 1. initial run
-        test_bar = testdir.makepyfile(test_bar="""
-            def test_bar_1():
-                pass
-            def test_bar_2():
-                assert 0
-        """)
-        test_foo = testdir.makepyfile(test_foo="""
-            def test_foo_3():
-                pass
-            def test_foo_4():
-                assert 0
-        """)
-        testdir.runpytest()
-        assert self.get_cached_last_failed(testdir) == ['test_bar.py::test_bar_2', 'test_foo.py::test_foo_4']
-
-        # 2. fix test_bar_2, run only test_bar.py
-        testdir.makepyfile(test_bar="""
-            def test_bar_1():
-                pass
-            def test_bar_2():
-                pass
-        """)
-        result = testdir.runpytest(test_bar)
-        result.stdout.fnmatch_lines('*2 passed*')
-        # ensure cache does not forget that test_foo_4 failed once before
-        assert self.get_cached_last_failed(testdir) == ['test_foo.py::test_foo_4']
-
-        result = testdir.runpytest('--last-failed')
-        result.stdout.fnmatch_lines('*1 failed, 3 deselected*')
-        assert self.get_cached_last_failed(testdir) == ['test_foo.py::test_foo_4']
-
-        # 3. fix test_foo_4, run only test_foo.py
-        test_foo = testdir.makepyfile(test_foo="""
-            def test_foo_3():
-                pass
-            def test_foo_4():
-                pass
-        """)
-        result = testdir.runpytest(test_foo, '--last-failed')
-        result.stdout.fnmatch_lines('*1 passed, 1 deselected*')
-        assert self.get_cached_last_failed(testdir) == []
-
-        result = testdir.runpytest('--last-failed')
-        result.stdout.fnmatch_lines('*4 passed*')
-        assert self.get_cached_last_failed(testdir) == []
new file mode 100644
--- /dev/null
+++ b/third_party/python/pytest/testing/test_cacheprovider.py
@@ -0,0 +1,820 @@
+from __future__ import absolute_import, division, print_function
+import sys
+import py
+import _pytest
+import pytest
+import os
+import shutil
+
+pytest_plugins = "pytester",
+
+
+class TestNewAPI(object):
+
+    def test_config_cache_makedir(self, testdir):
+        testdir.makeini("[pytest]")
+        config = testdir.parseconfigure()
+        with pytest.raises(ValueError):
+            config.cache.makedir("key/name")
+
+        p = config.cache.makedir("name")
+        assert p.check()
+
+    def test_config_cache_dataerror(self, testdir):
+        testdir.makeini("[pytest]")
+        config = testdir.parseconfigure()
+        cache = config.cache
+        pytest.raises(TypeError, lambda: cache.set("key/name", cache))
+        config.cache.set("key/name", 0)
+        config.cache._getvaluepath("key/name").write("123invalid")
+        val = config.cache.get("key/name", -2)
+        assert val == -2
+
+    def test_cache_writefail_cachfile_silent(self, testdir):
+        testdir.makeini("[pytest]")
+        testdir.tmpdir.join(".pytest_cache").write("gone wrong")
+        config = testdir.parseconfigure()
+        cache = config.cache
+        cache.set("test/broken", [])
+
+    @pytest.mark.skipif(sys.platform.startswith("win"), reason="no chmod on windows")
+    def test_cache_writefail_permissions(self, testdir):
+        testdir.makeini("[pytest]")
+        testdir.tmpdir.ensure_dir(".pytest_cache").chmod(0)
+        config = testdir.parseconfigure()
+        cache = config.cache
+        cache.set("test/broken", [])
+
+    @pytest.mark.skipif(sys.platform.startswith("win"), reason="no chmod on windows")
+    def test_cache_failure_warns(self, testdir):
+        testdir.tmpdir.ensure_dir(".pytest_cache").chmod(0)
+        testdir.makepyfile(
+            """
+            def test_error():
+                raise Exception
+
+        """
+        )
+        result = testdir.runpytest("-rw")
+        assert result.ret == 1
+        result.stdout.fnmatch_lines(["*could not create cache path*", "*2 warnings*"])
+
+    def test_config_cache(self, testdir):
+        testdir.makeconftest(
+            """
+            def pytest_configure(config):
+                # see that we get cache information early on
+                assert hasattr(config, "cache")
+        """
+        )
+        testdir.makepyfile(
+            """
+            def test_session(pytestconfig):
+                assert hasattr(pytestconfig, "cache")
+        """
+        )
+        result = testdir.runpytest()
+        assert result.ret == 0
+        result.stdout.fnmatch_lines(["*1 passed*"])
+
+    def test_cachefuncarg(self, testdir):
+        testdir.makepyfile(
+            """
+            import pytest
+            def test_cachefuncarg(cache):
+                val = cache.get("some/thing", None)
+                assert val is None
+                cache.set("some/thing", [1])
+                pytest.raises(TypeError, lambda: cache.get("some/thing"))
+                val = cache.get("some/thing", [])
+                assert val == [1]
+        """
+        )
+        result = testdir.runpytest()
+        assert result.ret == 0
+        result.stdout.fnmatch_lines(["*1 passed*"])
+
+    def test_custom_rel_cache_dir(self, testdir):
+        rel_cache_dir = os.path.join("custom_cache_dir", "subdir")
+        testdir.makeini(
+            """
+            [pytest]
+            cache_dir = {cache_dir}
+        """.format(
+                cache_dir=rel_cache_dir
+            )
+        )
+        testdir.makepyfile(test_errored="def test_error():\n    assert False")
+        testdir.runpytest()
+        assert testdir.tmpdir.join(rel_cache_dir).isdir()
+
+    def test_custom_abs_cache_dir(self, testdir, tmpdir_factory):
+        tmp = str(tmpdir_factory.mktemp("tmp"))
+        abs_cache_dir = os.path.join(tmp, "custom_cache_dir")
+        testdir.makeini(
+            """
+            [pytest]
+            cache_dir = {cache_dir}
+        """.format(
+                cache_dir=abs_cache_dir
+            )
+        )
+        testdir.makepyfile(test_errored="def test_error():\n    assert False")
+        testdir.runpytest()
+        assert py.path.local(abs_cache_dir).isdir()
+
+    def test_custom_cache_dir_with_env_var(self, testdir, monkeypatch):
+        monkeypatch.setenv("env_var", "custom_cache_dir")
+        testdir.makeini(
+            """
+            [pytest]
+            cache_dir = {cache_dir}
+        """.format(
+                cache_dir="$env_var"
+            )
+        )
+        testdir.makepyfile(test_errored="def test_error():\n    assert False")
+        testdir.runpytest()
+        assert testdir.tmpdir.join("custom_cache_dir").isdir()
+
+
+def test_cache_reportheader(testdir):
+    testdir.makepyfile(
+        """
+        def test_hello():
+            pass
+    """
+    )
+    result = testdir.runpytest("-v")
+    result.stdout.fnmatch_lines(["cachedir: .pytest_cache"])
+
+
+def test_cache_show(testdir):
+    result = testdir.runpytest("--cache-show")
+    assert result.ret == 0
+    result.stdout.fnmatch_lines(["*cache is empty*"])
+    testdir.makeconftest(
+        """
+        def pytest_configure(config):
+            config.cache.set("my/name", [1,2,3])
+            config.cache.set("other/some", {1:2})
+            dp = config.cache.makedir("mydb")
+            dp.ensure("hello")
+            dp.ensure("world")
+    """
+    )
+    result = testdir.runpytest()
+    assert result.ret == 5  # no tests executed
+    result = testdir.runpytest("--cache-show")
+    result.stdout.fnmatch_lines_random(
+        [
+            "*cachedir:*",
+            "-*cache values*-",
+            "*my/name contains:",
+            "  [1, 2, 3]",
+            "*other/some contains*",
+            "  {*1*: 2}",
+            "-*cache directories*-",
+            "*mydb/hello*length 0*",
+            "*mydb/world*length 0*",
+        ]
+    )
+
+
+class TestLastFailed(object):
+
+    def test_lastfailed_usecase(self, testdir, monkeypatch):
+        monkeypatch.setenv("PYTHONDONTWRITEBYTECODE", 1)
+        p = testdir.makepyfile(
+            """
+            def test_1():
+                assert 0
+            def test_2():
+                assert 0
+            def test_3():
+                assert 1
+        """
+        )
+        result = testdir.runpytest()
+        result.stdout.fnmatch_lines(["*2 failed*"])
+        p.write(
+            _pytest._code.Source(
+                """
+            def test_1():
+                assert 1
+
+            def test_2():
+                assert 1
+
+            def test_3():
+                assert 0
+        """
+            )
+        )
+        result = testdir.runpytest("--lf")
+        result.stdout.fnmatch_lines(["*2 passed*1 desel*"])
+        result = testdir.runpytest("--lf")
+        result.stdout.fnmatch_lines(["*1 failed*2 passed*"])
+        result = testdir.runpytest("--lf", "--cache-clear")
+        result.stdout.fnmatch_lines(["*1 failed*2 passed*"])
+
+        # Run this again to make sure clear-cache is robust
+        if os.path.isdir(".pytest_cache"):
+            shutil.rmtree(".pytest_cache")
+        result = testdir.runpytest("--lf", "--cache-clear")
+        result.stdout.fnmatch_lines(["*1 failed*2 passed*"])
+
+    def test_failedfirst_order(self, testdir):
+        testdir.tmpdir.join("test_a.py").write(
+            _pytest._code.Source(
+                """
+            def test_always_passes():
+                assert 1
+        """
+            )
+        )
+        testdir.tmpdir.join("test_b.py").write(
+            _pytest._code.Source(
+                """
+            def test_always_fails():
+                assert 0
+        """
+            )
+        )
+        result = testdir.runpytest()
+        # Test order will be collection order; alphabetical
+        result.stdout.fnmatch_lines(["test_a.py*", "test_b.py*"])
+        result = testdir.runpytest("--ff")
+        # Test order will be failing tests firs
+        result.stdout.fnmatch_lines(["test_b.py*", "test_a.py*"])
+
+    def test_lastfailed_failedfirst_order(self, testdir):
+        testdir.makepyfile(
+            **{
+                "test_a.py": """
+                def test_always_passes():
+                    assert 1
+            """,
+                "test_b.py": """
+                def test_always_fails():
+                    assert 0
+            """,
+            }
+        )
+        result = testdir.runpytest()
+        # Test order will be collection order; alphabetical
+        result.stdout.fnmatch_lines(["test_a.py*", "test_b.py*"])
+        result = testdir.runpytest("--lf", "--ff")
+        # Test order will be failing tests firs
+        result.stdout.fnmatch_lines(["test_b.py*"])
+        assert "test_a.py" not in result.stdout.str()
+
+    def test_lastfailed_difference_invocations(self, testdir, monkeypatch):
+        monkeypatch.setenv("PYTHONDONTWRITEBYTECODE", 1)
+        testdir.makepyfile(
+            test_a="""
+            def test_a1():
+                assert 0
+            def test_a2():
+                assert 1
+        """,
+            test_b="""
+            def test_b1():
+                assert 0
+        """,
+        )
+        p = testdir.tmpdir.join("test_a.py")
+        p2 = testdir.tmpdir.join("test_b.py")
+
+        result = testdir.runpytest()
+        result.stdout.fnmatch_lines(["*2 failed*"])
+        result = testdir.runpytest("--lf", p2)
+        result.stdout.fnmatch_lines(["*1 failed*"])
+        p2.write(
+            _pytest._code.Source(
+                """
+            def test_b1():
+                assert 1
+        """
+            )
+        )
+        result = testdir.runpytest("--lf", p2)
+        result.stdout.fnmatch_lines(["*1 passed*"])
+        result = testdir.runpytest("--lf", p)
+        result.stdout.fnmatch_lines(["*1 failed*1 desel*"])
+
+    def test_lastfailed_usecase_splice(self, testdir, monkeypatch):
+        monkeypatch.setenv("PYTHONDONTWRITEBYTECODE", 1)
+        testdir.makepyfile(
+            """
+            def test_1():
+                assert 0
+        """
+        )
+        p2 = testdir.tmpdir.join("test_something.py")
+        p2.write(
+            _pytest._code.Source(
+                """
+            def test_2():
+                assert 0
+        """
+            )
+        )
+        result = testdir.runpytest()
+        result.stdout.fnmatch_lines(["*2 failed*"])
+        result = testdir.runpytest("--lf", p2)
+        result.stdout.fnmatch_lines(["*1 failed*"])
+        result = testdir.runpytest("--lf")
+        result.stdout.fnmatch_lines(["*2 failed*"])
+
+    def test_lastfailed_xpass(self, testdir):
+        testdir.inline_runsource(
+            """
+            import pytest
+            @pytest.mark.xfail
+            def test_hello():
+                assert 1
+        """
+        )
+        config = testdir.parseconfigure()
+        lastfailed = config.cache.get("cache/lastfailed", -1)
+        assert lastfailed == -1
+
+    def test_non_serializable_parametrize(self, testdir):
+        """Test that failed parametrized tests with unmarshable parameters
+        don't break pytest-cache.
+        """
+        testdir.makepyfile(
+            r"""
+            import pytest
+
+            @pytest.mark.parametrize('val', [
+                b'\xac\x10\x02G',
+            ])
+            def test_fail(val):
+                assert False
+        """
+        )
+        result = testdir.runpytest()
+        result.stdout.fnmatch_lines("*1 failed in*")
+
+    def test_terminal_report_lastfailed(self, testdir):
+        test_a = testdir.makepyfile(
+            test_a="""
+            def test_a1():
+                pass
+            def test_a2():
+                pass
+        """
+        )
+        test_b = testdir.makepyfile(
+            test_b="""
+            def test_b1():
+                assert 0
+            def test_b2():
+                assert 0
+        """
+        )
+        result = testdir.runpytest()
+        result.stdout.fnmatch_lines(["collected 4 items", "*2 failed, 2 passed in*"])
+
+        result = testdir.runpytest("--lf")
+        result.stdout.fnmatch_lines(
+            [
+                "collected 4 items / 2 deselected",
+                "run-last-failure: rerun previous 2 failures",
+                "*2 failed, 2 deselected in*",
+            ]
+        )
+
+        result = testdir.runpytest(test_a, "--lf")
+        result.stdout.fnmatch_lines(
+            [
+                "collected 2 items",
+                "run-last-failure: run all (no recorded failures)",
+                "*2 passed in*",
+            ]
+        )
+
+        result = testdir.runpytest(test_b, "--lf")
+        result.stdout.fnmatch_lines(
+            [
+                "collected 2 items",
+                "run-last-failure: rerun previous 2 failures",
+                "*2 failed in*",
+            ]
+        )
+
+        result = testdir.runpytest("test_b.py::test_b1", "--lf")
+        result.stdout.fnmatch_lines(
+            [
+                "collected 1 item",
+                "run-last-failure: rerun previous 1 failure",
+                "*1 failed in*",
+            ]
+        )
+
+    def test_terminal_report_failedfirst(self, testdir):
+        testdir.makepyfile(
+            test_a="""
+            def test_a1():
+                assert 0
+            def test_a2():
+                pass
+        """
+        )
+        result = testdir.runpytest()
+        result.stdout.fnmatch_lines(["collected 2 items", "*1 failed, 1 passed in*"])
+
+        result = testdir.runpytest("--ff")
+        result.stdout.fnmatch_lines(
+            [
+                "collected 2 items",
+                "run-last-failure: rerun previous 1 failure first",
+                "*1 failed, 1 passed in*",
+            ]
+        )
+
+    def test_lastfailed_collectfailure(self, testdir, monkeypatch):
+
+        testdir.makepyfile(
+            test_maybe="""
+            import os
+            env = os.environ
+            if '1' == env['FAILIMPORT']:
+                raise ImportError('fail')
+            def test_hello():
+                assert '0' == env['FAILTEST']
+        """
+        )
+
+        def rlf(fail_import, fail_run):
+            monkeypatch.setenv("FAILIMPORT", fail_import)
+            monkeypatch.setenv("FAILTEST", fail_run)
+
+            testdir.runpytest("-q")
+            config = testdir.parseconfigure()
+            lastfailed = config.cache.get("cache/lastfailed", -1)
+            return lastfailed
+
+        lastfailed = rlf(fail_import=0, fail_run=0)
+        assert lastfailed == -1
+
+        lastfailed = rlf(fail_import=1, fail_run=0)
+        assert list(lastfailed) == ["test_maybe.py"]
+
+        lastfailed = rlf(fail_import=0, fail_run=1)
+        assert list(lastfailed) == ["test_maybe.py::test_hello"]
+
+    def test_lastfailed_failure_subset(self, testdir, monkeypatch):
+
+        testdir.makepyfile(
+            test_maybe="""
+            import os
+            env = os.environ
+            if '1' == env['FAILIMPORT']:
+                raise ImportError('fail')
+            def test_hello():
+                assert '0' == env['FAILTEST']
+        """
+        )
+
+        testdir.makepyfile(
+            test_maybe2="""
+            import os
+            env = os.environ
+            if '1' == env['FAILIMPORT']:
+                raise ImportError('fail')
+            def test_hello():
+                assert '0' == env['FAILTEST']
+
+            def test_pass():
+                pass
+        """
+        )
+
+        def rlf(fail_import, fail_run, args=()):
+            monkeypatch.setenv("FAILIMPORT", fail_import)
+            monkeypatch.setenv("FAILTEST", fail_run)
+
+            result = testdir.runpytest("-q", "--lf", *args)
+            config = testdir.parseconfigure()
+            lastfailed = config.cache.get("cache/lastfailed", -1)
+            return result, lastfailed
+
+        result, lastfailed = rlf(fail_import=0, fail_run=0)
+        assert lastfailed == -1
+        result.stdout.fnmatch_lines(["*3 passed*"])
+
+        result, lastfailed = rlf(fail_import=1, fail_run=0)
+        assert sorted(list(lastfailed)) == ["test_maybe.py", "test_maybe2.py"]
+
+        result, lastfailed = rlf(fail_import=0, fail_run=0, args=("test_maybe2.py",))
+        assert list(lastfailed) == ["test_maybe.py"]
+
+        # edge case of test selection - even if we remember failures
+        # from other tests we still need to run all tests if no test
+        # matches the failures
+        result, lastfailed = rlf(fail_import=0, fail_run=0, args=("test_maybe2.py",))
+        assert list(lastfailed) == ["test_maybe.py"]
+        result.stdout.fnmatch_lines(["*2 passed*"])
+
+    def test_lastfailed_creates_cache_when_needed(self, testdir):
+        # Issue #1342
+        testdir.makepyfile(test_empty="")
+        testdir.runpytest("-q", "--lf")
+        assert not os.path.exists(".pytest_cache/v/cache/lastfailed")
+
+        testdir.makepyfile(test_successful="def test_success():\n    assert True")
+        testdir.runpytest("-q", "--lf")
+        assert not os.path.exists(".pytest_cache/v/cache/lastfailed")
+
+        testdir.makepyfile(test_errored="def test_error():\n    assert False")
+        testdir.runpytest("-q", "--lf")
+        assert os.path.exists(".pytest_cache/v/cache/lastfailed")
+
+    def test_xfail_not_considered_failure(self, testdir):
+        testdir.makepyfile(
+            """
+            import pytest
+            @pytest.mark.xfail
+            def test():
+                assert 0
+        """
+        )
+        result = testdir.runpytest()
+        result.stdout.fnmatch_lines("*1 xfailed*")
+        assert self.get_cached_last_failed(testdir) == []
+
+    def test_xfail_strict_considered_failure(self, testdir):
+        testdir.makepyfile(
+            """
+            import pytest
+            @pytest.mark.xfail(strict=True)
+            def test():
+                pass
+        """
+        )
+        result = testdir.runpytest()
+        result.stdout.fnmatch_lines("*1 failed*")
+        assert (
+            self.get_cached_last_failed(testdir)
+            == ["test_xfail_strict_considered_failure.py::test"]
+        )
+
+    @pytest.mark.parametrize("mark", ["mark.xfail", "mark.skip"])
+    def test_failed_changed_to_xfail_or_skip(self, testdir, mark):
+        testdir.makepyfile(
+            """
+            import pytest
+            def test():
+                assert 0
+        """
+        )
+        result = testdir.runpytest()
+        assert (
+            self.get_cached_last_failed(testdir)
+            == ["test_failed_changed_to_xfail_or_skip.py::test"]
+        )
+        assert result.ret == 1
+
+        testdir.makepyfile(
+            """
+            import pytest
+            @pytest.{mark}
+            def test():
+                assert 0
+        """.format(
+                mark=mark
+            )
+        )
+        result = testdir.runpytest()
+        assert result.ret == 0
+        assert self.get_cached_last_failed(testdir) == []
+        assert result.ret == 0
+
+    def get_cached_last_failed(self, testdir):
+        config = testdir.parseconfigure()
+        return sorted(config.cache.get("cache/lastfailed", {}))
+
+    def test_cache_cumulative(self, testdir):
+        """
+        Test workflow where user fixes errors gradually file by file using --lf.
+        """
+        # 1. initial run
+        test_bar = testdir.makepyfile(
+            test_bar="""
+            def test_bar_1():
+                pass
+            def test_bar_2():
+                assert 0
+        """
+        )
+        test_foo = testdir.makepyfile(
+            test_foo="""
+            def test_foo_3():
+                pass
+            def test_foo_4():
+                assert 0
+        """
+        )
+        testdir.runpytest()
+        assert (
+            self.get_cached_last_failed(testdir)
+            == ["test_bar.py::test_bar_2", "test_foo.py::test_foo_4"]
+        )
+
+        # 2. fix test_bar_2, run only test_bar.py
+        testdir.makepyfile(
+            test_bar="""
+            def test_bar_1():
+                pass
+            def test_bar_2():
+                pass
+        """
+        )
+        result = testdir.runpytest(test_bar)
+        result.stdout.fnmatch_lines("*2 passed*")
+        # ensure cache does not forget that test_foo_4 failed once before
+        assert self.get_cached_last_failed(testdir) == ["test_foo.py::test_foo_4"]
+
+        result = testdir.runpytest("--last-failed")
+        result.stdout.fnmatch_lines("*1 failed, 3 deselected*")
+        assert self.get_cached_last_failed(testdir) == ["test_foo.py::test_foo_4"]
+
+        # 3. fix test_foo_4, run only test_foo.py
+        test_foo = testdir.makepyfile(
+            test_foo="""
+            def test_foo_3():
+                pass
+            def test_foo_4():
+                pass
+        """
+        )
+        result = testdir.runpytest(test_foo, "--last-failed")
+        result.stdout.fnmatch_lines("*1 passed, 1 deselected*")
+        assert self.get_cached_last_failed(testdir) == []
+
+        result = testdir.runpytest("--last-failed")
+        result.stdout.fnmatch_lines("*4 passed*")
+        assert self.get_cached_last_failed(testdir) == []
+
+    def test_lastfailed_no_failures_behavior_all_passed(self, testdir):
+        testdir.makepyfile(
+            """
+            def test_1():
+                assert True
+            def test_2():
+                assert True
+        """
+        )
+        result = testdir.runpytest()
+        result.stdout.fnmatch_lines(["*2 passed*"])
+        result = testdir.runpytest("--lf")
+        result.stdout.fnmatch_lines(["*2 passed*"])
+        result = testdir.runpytest("--lf", "--lfnf", "all")
+        result.stdout.fnmatch_lines(["*2 passed*"])
+        result = testdir.runpytest("--lf", "--lfnf", "none")
+        result.stdout.fnmatch_lines(["*2 desel*"])
+
+    def test_lastfailed_no_failures_behavior_empty_cache(self, testdir):
+        testdir.makepyfile(
+            """
+            def test_1():
+                assert True
+            def test_2():
+                assert False
+        """
+        )
+        result = testdir.runpytest("--lf", "--cache-clear")
+        result.stdout.fnmatch_lines(["*1 failed*1 passed*"])
+        result = testdir.runpytest("--lf", "--cache-clear", "--lfnf", "all")
+        result.stdout.fnmatch_lines(["*1 failed*1 passed*"])
+        result = testdir.runpytest("--lf", "--cache-clear", "--lfnf", "none")
+        result.stdout.fnmatch_lines(["*2 desel*"])
+
+
+class TestNewFirst(object):
+
+    def test_newfirst_usecase(self, testdir):
+        testdir.makepyfile(
+            **{
+                "test_1/test_1.py": """
+                def test_1(): assert 1
+                def test_2(): assert 1
+                def test_3(): assert 1
+            """,
+                "test_2/test_2.py": """
+                def test_1(): assert 1
+                def test_2(): assert 1
+                def test_3(): assert 1
+            """,
+            }
+        )
+
+        testdir.tmpdir.join("test_1/test_1.py").setmtime(1)
+
+        result = testdir.runpytest("-v")
+        result.stdout.fnmatch_lines(
+            [
+                "*test_1/test_1.py::test_1 PASSED*",
+                "*test_1/test_1.py::test_2 PASSED*",
+                "*test_1/test_1.py::test_3 PASSED*",
+                "*test_2/test_2.py::test_1 PASSED*",
+                "*test_2/test_2.py::test_2 PASSED*",
+                "*test_2/test_2.py::test_3 PASSED*",
+            ]
+        )
+
+        result = testdir.runpytest("-v", "--nf")
+
+        result.stdout.fnmatch_lines(
+            [
+                "*test_2/test_2.py::test_1 PASSED*",
+                "*test_2/test_2.py::test_2 PASSED*",
+                "*test_2/test_2.py::test_3 PASSED*",
+                "*test_1/test_1.py::test_1 PASSED*",
+                "*test_1/test_1.py::test_2 PASSED*",
+                "*test_1/test_1.py::test_3 PASSED*",
+            ]
+        )
+
+        testdir.tmpdir.join("test_1/test_1.py").write(
+            "def test_1(): assert 1\n"
+            "def test_2(): assert 1\n"
+            "def test_3(): assert 1\n"
+            "def test_4(): assert 1\n"
+        )
+        testdir.tmpdir.join("test_1/test_1.py").setmtime(1)
+
+        result = testdir.runpytest("-v", "--nf")
+
+        result.stdout.fnmatch_lines(
+            [
+                "*test_1/test_1.py::test_4 PASSED*",
+                "*test_2/test_2.py::test_1 PASSED*",
+                "*test_2/test_2.py::test_2 PASSED*",
+                "*test_2/test_2.py::test_3 PASSED*",
+                "*test_1/test_1.py::test_1 PASSED*",
+                "*test_1/test_1.py::test_2 PASSED*",
+                "*test_1/test_1.py::test_3 PASSED*",
+            ]
+        )
+
+    def test_newfirst_parametrize(self, testdir):
+        testdir.makepyfile(
+            **{
+                "test_1/test_1.py": """
+                import pytest
+                @pytest.mark.parametrize('num', [1, 2])
+                def test_1(num): assert num
+            """,
+                "test_2/test_2.py": """
+                import pytest
+                @pytest.mark.parametrize('num', [1, 2])
+                def test_1(num): assert num
+            """,
+            }
+        )
+
+        testdir.tmpdir.join("test_1/test_1.py").setmtime(1)
+
+        result = testdir.runpytest("-v")
+        result.stdout.fnmatch_lines(
+            [
+                "*test_1/test_1.py::test_1[1*",
+                "*test_1/test_1.py::test_1[2*",
+                "*test_2/test_2.py::test_1[1*",
+                "*test_2/test_2.py::test_1[2*",
+            ]
+        )
+
+        result = testdir.runpytest("-v", "--nf")
+
+        result.stdout.fnmatch_lines(
+            [
+                "*test_2/test_2.py::test_1[1*",
+                "*test_2/test_2.py::test_1[2*",
+                "*test_1/test_1.py::test_1[1*",
+                "*test_1/test_1.py::test_1[2*",
+            ]
+        )
+
+        testdir.tmpdir.join("test_1/test_1.py").write(
+            "import pytest\n"
+            "@pytest.mark.parametrize('num', [1, 2, 3])\n"
+            "def test_1(num): assert num\n"
+        )
+        testdir.tmpdir.join("test_1/test_1.py").setmtime(1)
+
+        result = testdir.runpytest("-v", "--nf")
+
+        result.stdout.fnmatch_lines(
+            [
+                "*test_1/test_1.py::test_1[3*",
+                "*test_2/test_2.py::test_1[1*",
+                "*test_2/test_2.py::test_1[2*",
+                "*test_1/test_1.py::test_1[1*",
+                "*test_1/test_1.py::test_1[2*",
+            ]
+        )
--- a/third_party/python/pytest/testing/test_capture.py
+++ b/third_party/python/pytest/testing/test_capture.py
@@ -1,711 +1,860 @@
 from __future__ import absolute_import, division, print_function
+
 # note: py.io capture tests where copied from
 # pylib 1.4.20.dev2 (rev 13d9af95547e)
 from __future__ import with_statement
 import pickle
 import os
 import sys
 from io import UnsupportedOperation
 
 import _pytest._code
 import py
 import pytest
 import contextlib
-
+from six import binary_type, text_type
 from _pytest import capture
 from _pytest.capture import CaptureManager
 from _pytest.main import EXIT_NOTESTSCOLLECTED
 
 
 needsosdup = pytest.mark.xfail("not hasattr(os, 'dup')")
 
-if sys.version_info >= (3, 0):
-    def tobytes(obj):
-        if isinstance(obj, str):
-            obj = obj.encode('UTF-8')
-        assert isinstance(obj, bytes)
-        return obj
+
+def tobytes(obj):
+    if isinstance(obj, text_type):
+        obj = obj.encode("UTF-8")
+    assert isinstance(obj, binary_type)
+    return obj
 
-    def totext(obj):
-        if isinstance(obj, bytes):
-            obj = str(obj, 'UTF-8')
-        assert isinstance(obj, str)
-        return obj
-else:
-    def tobytes(obj):
-        if isinstance(obj, unicode):
-            obj = obj.encode('UTF-8')
-        assert isinstance(obj, str)
-        return obj
 
-    def totext(obj):
-        if isinstance(obj, str):
-            obj = unicode(obj, 'UTF-8')
-        assert isinstance(obj, unicode)
-        return obj
+def totext(obj):
+    if isinstance(obj, binary_type):
+        obj = text_type(obj, "UTF-8")
+    assert isinstance(obj, text_type)
+    return obj
 
 
 def oswritebytes(fd, obj):
     os.write(fd, tobytes(obj))
 
 
 def StdCaptureFD(out=True, err=True, in_=True):
     return capture.MultiCapture(out, err, in_, Capture=capture.FDCapture)
 
 
 def StdCapture(out=True, err=True, in_=True):
     return capture.MultiCapture(out, err, in_, Capture=capture.SysCapture)
 
 
 class TestCaptureManager(object):
+
     def test_getmethod_default_no_fd(self, monkeypatch):
         from _pytest.capture import pytest_addoption
-        from _pytest.config import Parser
+        from _pytest.config.argparsing import Parser
+
         parser = Parser()
         pytest_addoption(parser)
         default = parser._groups[0].options[0].default
         assert default == "fd" if hasattr(os, "dup") else "sys"
         parser = Parser()
-        monkeypatch.delattr(os, 'dup', raising=False)
+        monkeypatch.delattr(os, "dup", raising=False)
         pytest_addoption(parser)
         assert parser._groups[0].options[0].default == "sys"
 
     @needsosdup
-    @pytest.mark.parametrize("method",
-                             ['no', 'sys', pytest.mark.skipif('not hasattr(os, "dup")', 'fd')])
+    @pytest.mark.parametrize(
+        "method", ["no", "sys", pytest.mark.skipif('not hasattr(os, "dup")', "fd")]
+    )
     def test_capturing_basic_api(self, method):
         capouter = StdCaptureFD()
         old = sys.stdout, sys.stderr, sys.stdin
         try:
             capman = CaptureManager(method)
-            capman.init_capturings()
-            outerr = capman.suspendcapture()
+            capman.start_global_capturing()
+            outerr = capman.suspend_global_capture()
             assert outerr == ("", "")
-            outerr = capman.suspendcapture()
+            outerr = capman.suspend_global_capture()
             assert outerr == ("", "")
             print("hello")
-            out, err = capman.suspendcapture()
+            out, err = capman.suspend_global_capture()
             if method == "no":
                 assert old == (sys.stdout, sys.stderr, sys.stdin)
             else:
                 assert not out
-            capman.resumecapture()
+            capman.resume_global_capture()
             print("hello")
-            out, err = capman.suspendcapture()
+            out, err = capman.suspend_global_capture()
             if method != "no":
                 assert out == "hello\n"
-            capman.reset_capturings()
+            capman.stop_global_capturing()
         finally:
             capouter.stop_capturing()
 
     @needsosdup
     def test_init_capturing(self):
         capouter = StdCaptureFD()
         try:
             capman = CaptureManager("fd")
-            capman.init_capturings()
-            pytest.raises(AssertionError, "capman.init_capturings()")
-            capman.reset_capturings()
+            capman.start_global_capturing()
+            pytest.raises(AssertionError, "capman.start_global_capturing()")
+            capman.stop_global_capturing()
         finally:
             capouter.stop_capturing()
 
 
-@pytest.mark.parametrize("method", ['fd', 'sys'])
+@pytest.mark.parametrize("method", ["fd", "sys"])
 def test_capturing_unicode(testdir, method):
     if hasattr(sys, "pypy_version_info") and sys.pypy_version_info < (2, 2):
         pytest.xfail("does not work on pypy < 2.2")
     if sys.version_info >= (3, 0):
         obj = "'b\u00f6y'"
     else:
         obj = "u'\u00f6y'"
-    testdir.makepyfile("""
+    testdir.makepyfile(
+        """
         # coding=utf8
         # taken from issue 227 from nosetests
         def test_unicode():
             import sys
             print (sys.stdout)
             print (%s)
-    """ % obj)
+    """
+        % obj
+    )
     result = testdir.runpytest("--capture=%s" % method)
-    result.stdout.fnmatch_lines([
-        "*1 passed*"
-    ])
+    result.stdout.fnmatch_lines(["*1 passed*"])
 
 
-@pytest.mark.parametrize("method", ['fd', 'sys'])
+@pytest.mark.parametrize("method", ["fd", "sys"])
 def test_capturing_bytes_in_utf8_encoding(testdir, method):
-    testdir.makepyfile("""
+    testdir.makepyfile(
+        """
         def test_unicode():
             print ('b\\u00f6y')
-    """)
+    """
+    )
     result = testdir.runpytest("--capture=%s" % method)
-    result.stdout.fnmatch_lines([
-        "*1 passed*"
-    ])
+    result.stdout.fnmatch_lines(["*1 passed*"])
 
 
 def test_collect_capturing(testdir):
-    p = testdir.makepyfile("""
+    p = testdir.makepyfile(
+        """
         print ("collect %s failure" % 13)
         import xyz42123
-    """)
+    """
+    )
     result = testdir.runpytest(p)
-    result.stdout.fnmatch_lines([
-        "*Captured stdout*",
-        "*collect 13 failure*",
-    ])
+    result.stdout.fnmatch_lines(["*Captured stdout*", "*collect 13 failure*"])
 
 
 class TestPerTestCapturing(object):
+
     def test_capture_and_fixtures(self, testdir):
-        p = testdir.makepyfile("""
+        p = testdir.makepyfile(
+            """
             def setup_module(mod):
                 print ("setup module")
             def setup_function(function):
                 print ("setup " + function.__name__)
             def test_func1():
                 print ("in func1")
                 assert 0
             def test_func2():
                 print ("in func2")
                 assert 0
-        """)
+        """
+        )
         result = testdir.runpytest(p)
-        result.stdout.fnmatch_lines([
-            "setup module*",
-            "setup test_func1*",
-            "in func1*",
-            "setup test_func2*",
-            "in func2*",
-        ])
+        result.stdout.fnmatch_lines(
+            [
+                "setup module*",
+                "setup test_func1*",
+                "in func1*",
+                "setup test_func2*",
+                "in func2*",
+            ]
+        )
 
     @pytest.mark.xfail(reason="unimplemented feature")
     def test_capture_scope_cache(self, testdir):
-        p = testdir.makepyfile("""
+        p = testdir.makepyfile(
+            """
             import sys
             def setup_module(func):
                 print ("module-setup")
             def setup_function(func):
                 print ("function-setup")
             def test_func():
                 print ("in function")
                 assert 0
             def teardown_function(func):
                 print ("in teardown")
-        """)
+        """
+        )
         result = testdir.runpytest(p)
-        result.stdout.fnmatch_lines([
-            "*test_func():*",
-            "*Captured stdout during setup*",
-            "module-setup*",
-            "function-setup*",
-            "*Captured stdout*",
-            "in teardown*",
-        ])
+        result.stdout.fnmatch_lines(
+            [
+                "*test_func():*",
+                "*Captured stdout during setup*",
+                "module-setup*",
+                "function-setup*",
+                "*Captured stdout*",
+                "in teardown*",
+            ]
+        )
 
     def test_no_carry_over(self, testdir):
-        p = testdir.makepyfile("""
+        p = testdir.makepyfile(
+            """
             def test_func1():
                 print ("in func1")
             def test_func2():
                 print ("in func2")
                 assert 0
-        """)
+        """
+        )
         result = testdir.runpytest(p)
         s = result.stdout.str()
         assert "in func1" not in s
         assert "in func2" in s
 
     def test_teardown_capturing(self, testdir):
-        p = testdir.makepyfile("""
+        p = testdir.makepyfile(
+            """
             def setup_function(function):
                 print ("setup func1")
             def teardown_function(function):
                 print ("teardown func1")
                 assert 0
             def test_func1():
                 print ("in func1")
                 pass
-        """)
+        """
+        )
         result = testdir.runpytest(p)
-        result.stdout.fnmatch_lines([
-            '*teardown_function*',
-            '*Captured stdout*',
-            "setup func1*",
-            "in func1*",
-            "teardown func1*",
-            # "*1 fixture failure*"
-        ])
+        result.stdout.fnmatch_lines(
+            [
+                "*teardown_function*",
+                "*Captured stdout*",
+                "setup func1*",
+                "in func1*",
+                "teardown func1*",
+                # "*1 fixture failure*"
+            ]
+        )
 
     def test_teardown_capturing_final(self, testdir):
-        p = testdir.makepyfile("""
+        p = testdir.makepyfile(
+            """
             def teardown_module(mod):
                 print ("teardown module")
                 assert 0
             def test_func():
                 pass
-        """)
+        """
+        )
         result = testdir.runpytest(p)
-        result.stdout.fnmatch_lines([
-            "*def teardown_module(mod):*",
-            "*Captured stdout*",
-            "*teardown module*",
-            "*1 error*",
-        ])
+        result.stdout.fnmatch_lines(
+            [
+                "*def teardown_module(mod):*",
+                "*Captured stdout*",
+                "*teardown module*",
+                "*1 error*",
+            ]
+        )
 
     def test_capturing_outerr(self, testdir):
-        p1 = testdir.makepyfile("""
+        p1 = testdir.makepyfile(
+            """
             import sys
             def test_capturing():
                 print (42)
                 sys.stderr.write(str(23))
             def test_capturing_error():
                 print (1)
                 sys.stderr.write(str(2))
                 raise ValueError
-        """)
+        """
+        )
         result = testdir.runpytest(p1)
-        result.stdout.fnmatch_lines([
-            "*test_capturing_outerr.py .F",
-            "====* FAILURES *====",
-            "____*____",
-            "*test_capturing_outerr.py:8: ValueError",
-            "*--- Captured stdout *call*",
-            "1",
-            "*--- Captured stderr *call*",
-            "2",
-        ])
+        result.stdout.fnmatch_lines(
+            [
+                "*test_capturing_outerr.py .F*",
+                "====* FAILURES *====",
+                "____*____",
+                "*test_capturing_outerr.py:8: ValueError",
+                "*--- Captured stdout *call*",
+                "1",
+                "*--- Captured stderr *call*",
+                "2",
+            ]
+        )
 
 
 class TestLoggingInteraction(object):
+
     def test_logging_stream_ownership(self, testdir):
-        p = testdir.makepyfile("""
+        p = testdir.makepyfile(
+            """
             def test_logging():
                 import logging
                 import pytest
                 stream = capture.CaptureIO()
                 logging.basicConfig(stream=stream)
                 stream.close() # to free memory/release resources
-        """)
+        """
+        )
         result = testdir.runpytest_subprocess(p)
         assert result.stderr.str().find("atexit") == -1
 
     def test_logging_and_immediate_setupteardown(self, testdir):
-        p = testdir.makepyfile("""
+        p = testdir.makepyfile(
+            """
             import logging
             def setup_function(function):
                 logging.warn("hello1")
 
             def test_logging():
                 logging.warn("hello2")
                 assert 0
 
             def teardown_function(function):
                 logging.warn("hello3")
                 assert 0
-        """)
-        for optargs in (('--capture=sys',), ('--capture=fd',)):
+        """
+        )
+        for optargs in (("--capture=sys",), ("--capture=fd",)):
             print(optargs)
             result = testdir.runpytest_subprocess(p, *optargs)
             s = result.stdout.str()
-            result.stdout.fnmatch_lines([
-                "*WARN*hello3",  # errors show first!
-                "*WARN*hello1",
-                "*WARN*hello2",
-            ])
+            result.stdout.fnmatch_lines(
+                ["*WARN*hello3", "*WARN*hello1", "*WARN*hello2"]  # errors show first!
+            )
             # verify proper termination
             assert "closed" not in s
 
     def test_logging_and_crossscope_fixtures(self, testdir):
-        p = testdir.makepyfile("""
+        p = testdir.makepyfile(
+            """
             import logging
             def setup_module(function):
                 logging.warn("hello1")
 
             def test_logging():
                 logging.warn("hello2")
                 assert 0
 
             def teardown_module(function):
                 logging.warn("hello3")
                 assert 0
-        """)
-        for optargs in (('--capture=sys',), ('--capture=fd',)):
+        """
+        )
+        for optargs in (("--capture=sys",), ("--capture=fd",)):
             print(optargs)
             result = testdir.runpytest_subprocess(p, *optargs)
             s = result.stdout.str()
-            result.stdout.fnmatch_lines([
-                "*WARN*hello3",  # errors come first
-                "*WARN*hello1",
-                "*WARN*hello2",
-            ])
+            result.stdout.fnmatch_lines(
+                ["*WARN*hello3", "*WARN*hello1", "*WARN*hello2"]  # errors come first
+            )
             # verify proper termination
             assert "closed" not in s
 
-    def test_logging_initialized_in_test(self, testdir):
-        p = testdir.makepyfile("""
-            import sys
-            def test_something():
-                # pytest does not import logging
-                assert 'logging' not in sys.modules
-                import logging
-                logging.basicConfig()
-                logging.warn("hello432")
-                assert 0
-        """)
-        result = testdir.runpytest_subprocess(
-            p, "--traceconfig",
-            "-p", "no:capturelog", "-p", "no:hypothesis", "-p", "no:hypothesispytest")
-        assert result.ret != 0
-        result.stdout.fnmatch_lines([
-            "*hello432*",
-        ])
-        assert 'operation on closed file' not in result.stderr.str()
-
     def test_conftestlogging_is_shown(self, testdir):
-        testdir.makeconftest("""
+        testdir.makeconftest(
+            """
                 import logging
                 logging.basicConfig()
                 logging.warn("hello435")
-        """)
+        """
+        )
         # make sure that logging is still captured in tests
         result = testdir.runpytest_subprocess("-s", "-p", "no:capturelog")
         assert result.ret == EXIT_NOTESTSCOLLECTED
-        result.stderr.fnmatch_lines([
-            "WARNING*hello435*",
-        ])
-        assert 'operation on closed file' not in result.stderr.str()
+        result.stderr.fnmatch_lines(["WARNING*hello435*"])
+        assert "operation on closed file" not in result.stderr.str()
 
     def test_conftestlogging_and_test_logging(self, testdir):
-        testdir.makeconftest("""
+        testdir.makeconftest(
+            """
                 import logging
                 logging.basicConfig()
-        """)
+        """
+        )
         # make sure that logging is still captured in tests
-        p = testdir.makepyfile("""
+        p = testdir.makepyfile(
+            """
             def test_hello():
                 import logging
                 logging.warn("hello433")
                 assert 0
-        """)
+        """
+        )
         result = testdir.runpytest_subprocess(p, "-p", "no:capturelog")
         assert result.ret != 0
-        result.stdout.fnmatch_lines([
-            "WARNING*hello433*",
-        ])
-        assert 'something' not in result.stderr.str()
-        assert 'operation on closed file' not in result.stderr.str()
+        result.stdout.fnmatch_lines(["WARNING*hello433*"])
+        assert "something" not in result.stderr.str()
+        assert "operation on closed file" not in result.stderr.str()
 
 
 class TestCaptureFixture(object):
+
     @pytest.mark.parametrize("opt", [[], ["-s"]])
     def test_std_functional(self, testdir, opt):
-        reprec = testdir.inline_runsource("""
+        reprec = testdir.inline_runsource(
+            """
             def test_hello(capsys):
                 print (42)
                 out, err = capsys.readouterr()
                 assert out.startswith("42")
-        """, *opt)
+        """,
+            *opt
+        )
         reprec.assertoutcome(passed=1)
 
     def test_capsyscapfd(self, testdir):
-        p = testdir.makepyfile("""
+        p = testdir.makepyfile(
+            """
             def test_one(capsys, capfd):
                 pass
             def test_two(capfd, capsys):
                 pass
-        """)
+        """
+        )
         result = testdir.runpytest(p)
-        result.stdout.fnmatch_lines([
-            "*ERROR*setup*test_one*",
-            "E*capsys*capfd*same*time*",
-            "*ERROR*setup*test_two*",
-            "E*capsys*capfd*same*time*",
-            "*2 error*"])
+        result.stdout.fnmatch_lines(
+            [
+                "*ERROR*setup*test_one*",
+                "E*capfd*capsys*same*time*",
+                "*ERROR*setup*test_two*",
+                "E*capsys*capfd*same*time*",
+                "*2 error*",
+            ]
+        )
 
     def test_capturing_getfixturevalue(self, testdir):
         """Test that asking for "capfd" and "capsys" using request.getfixturevalue
         in the same test is an error.
         """
-        testdir.makepyfile("""
+        testdir.makepyfile(
+            """
             def test_one(capsys, request):
                 request.getfixturevalue("capfd")
             def test_two(capfd, request):
                 request.getfixturevalue("capsys")
-        """)
+        """
+        )
         result = testdir.runpytest()
-        result.stdout.fnmatch_lines([
-            "*test_one*",
-            "*capsys*capfd*same*time*",
-            "*test_two*",
-            "*capsys*capfd*same*time*",
-            "*2 failed in*",
-        ])
+        result.stdout.fnmatch_lines(
+            [
+                "*test_one*",
+                "*capsys*capfd*same*time*",
+                "*test_two*",
+                "*capfd*capsys*same*time*",
+                "*2 failed in*",
+            ]
+        )
+
+    def test_capsyscapfdbinary(self, testdir):
+        p = testdir.makepyfile(
+            """
+            def test_one(capsys, capfdbinary):
+                pass
+        """
+        )
+        result = testdir.runpytest(p)
+        result.stdout.fnmatch_lines(
+            ["*ERROR*setup*test_one*", "E*capfdbinary*capsys*same*time*", "*1 error*"]
+        )
 
     @pytest.mark.parametrize("method", ["sys", "fd"])
     def test_capture_is_represented_on_failure_issue128(self, testdir, method):
-        p = testdir.makepyfile("""
+        p = testdir.makepyfile(
+            """
             def test_hello(cap%s):
                 print ("xxx42xxx")
                 assert 0
-        """ % method)
+        """
+            % method
+        )
         result = testdir.runpytest(p)
-        result.stdout.fnmatch_lines([
-            "xxx42xxx",
-        ])
+        result.stdout.fnmatch_lines(["xxx42xxx"])
 
     @needsosdup
     def test_stdfd_functional(self, testdir):
-        reprec = testdir.inline_runsource("""
+        reprec = testdir.inline_runsource(
+            """
             def test_hello(capfd):
                 import os
                 os.write(1, "42".encode('ascii'))
                 out, err = capfd.readouterr()
                 assert out.startswith("42")
                 capfd.close()
-        """)
+        """
+        )
+        reprec.assertoutcome(passed=1)
+
+    @needsosdup
+    def test_capfdbinary(self, testdir):
+        reprec = testdir.inline_runsource(
+            """
+            def test_hello(capfdbinary):
+                import os
+                # some likely un-decodable bytes
+                os.write(1, b'\\xfe\\x98\\x20')
+                out, err = capfdbinary.readouterr()
+                assert out == b'\\xfe\\x98\\x20'
+                assert err == b''
+        """
+        )
         reprec.assertoutcome(passed=1)
 
+    @pytest.mark.skipif(
+        sys.version_info < (3,), reason="only have capsysbinary in python 3"
+    )
+    def test_capsysbinary(self, testdir):
+        reprec = testdir.inline_runsource(
+            """
+            def test_hello(capsysbinary):
+                import sys
+                # some likely un-decodable bytes
+                sys.stdout.buffer.write(b'\\xfe\\x98\\x20')
+                out, err = capsysbinary.readouterr()
+                assert out == b'\\xfe\\x98\\x20'
+                assert err == b''
+        """
+        )
+        reprec.assertoutcome(passed=1)
+
+    @pytest.mark.skipif(
+        sys.version_info >= (3,), reason="only have capsysbinary in python 3"
+    )
+    def test_capsysbinary_forbidden_in_python2(self, testdir):
+        testdir.makepyfile(
+            """
+            def test_hello(capsysbinary):
+                pass
+        """
+        )
+        result = testdir.runpytest()
+        result.stdout.fnmatch_lines(
+            [
+                "*test_hello*",
+                "*capsysbinary is only supported on python 3*",
+                "*1 error in*",
+            ]
+        )
+
     def test_partial_setup_failure(self, testdir):
-        p = testdir.makepyfile("""
+        p = testdir.makepyfile(
+            """
             def test_hello(capsys, missingarg):
                 pass
-        """)
+        """
+        )
         result = testdir.runpytest(p)
-        result.stdout.fnmatch_lines([
-            "*test_partial_setup_failure*",
-            "*1 error*",
-        ])
+        result.stdout.fnmatch_lines(["*test_partial_setup_failure*", "*1 error*"])
 
     @needsosdup
     def test_keyboardinterrupt_disables_capturing(self, testdir):
-        p = testdir.makepyfile("""
+        p = testdir.makepyfile(
+            """
             def test_hello(capfd):
                 import os
                 os.write(1, str(42).encode('ascii'))
                 raise KeyboardInterrupt()
-        """)
+        """
+        )
         result = testdir.runpytest_subprocess(p)
-        result.stdout.fnmatch_lines([
-            "*KeyboardInterrupt*"
-        ])
+        result.stdout.fnmatch_lines(["*KeyboardInterrupt*"])
         assert result.ret == 2
 
     @pytest.mark.issue14
     def test_capture_and_logging(self, testdir):
-        p = testdir.makepyfile("""
+        p = testdir.makepyfile(
+            """
             import logging
             def test_log(capsys):
                 logging.error('x')
-            """)
+            """
+        )
         result = testdir.runpytest_subprocess(p)
-        assert 'closed' not in result.stderr.str()
+        assert "closed" not in result.stderr.str()
 
-    @pytest.mark.parametrize('fixture', ['capsys', 'capfd'])
-    def test_disabled_capture_fixture(self, testdir, fixture):
-        testdir.makepyfile("""
+    @pytest.mark.parametrize("fixture", ["capsys", "capfd"])
+    @pytest.mark.parametrize("no_capture", [True, False])
+    def test_disabled_capture_fixture(self, testdir, fixture, no_capture):
+        testdir.makepyfile(
+            """
             def test_disabled({fixture}):
                 print('captured before')
                 with {fixture}.disabled():
                     print('while capture is disabled')
                 print('captured after')
-        """.format(fixture=fixture))
-        result = testdir.runpytest_subprocess()
-        result.stdout.fnmatch_lines("""
+                assert {fixture}.readouterr() == ('captured before\\ncaptured after\\n', '')
+
+            def test_normal():
+                print('test_normal executed')
+        """.format(
+                fixture=fixture
+            )
+        )
+        args = ("-s",) if no_capture else ()
+        result = testdir.runpytest_subprocess(*args)
+        result.stdout.fnmatch_lines(
+            """
             *while capture is disabled*
-        """)
-        assert 'captured before' not in result.stdout.str()
-        assert 'captured after' not in result.stdout.str()
+        """
+        )
+        assert "captured before" not in result.stdout.str()
+        assert "captured after" not in result.stdout.str()
+        if no_capture:
+            assert "test_normal executed" in result.stdout.str()
+        else:
+            assert "test_normal executed" not in result.stdout.str()
+
+    @pytest.mark.parametrize("fixture", ["capsys", "capfd"])
+    def test_fixture_use_by_other_fixtures(self, testdir, fixture):
+        """
+        Ensure that capsys and capfd can be used by other fixtures during setup and teardown.
+        """
+        testdir.makepyfile(
+            """
+            from __future__ import print_function
+            import sys
+            import pytest
+
+            @pytest.fixture
+            def captured_print({fixture}):
+                print('stdout contents begin')
+                print('stderr contents begin', file=sys.stderr)
+                out, err = {fixture}.readouterr()
+
+                yield out, err
+
+                print('stdout contents end')
+                print('stderr contents end', file=sys.stderr)
+                out, err = {fixture}.readouterr()
+                assert out == 'stdout contents end\\n'
+                assert err == 'stderr contents end\\n'
+
+            def test_captured_print(captured_print):
+                out, err = captured_print
+                assert out == 'stdout contents begin\\n'
+                assert err == 'stderr contents begin\\n'
+        """.format(
+                fixture=fixture
+            )
+        )
+        result = testdir.runpytest_subprocess()
+        result.stdout.fnmatch_lines("*1 passed*")
+        assert "stdout contents begin" not in result.stdout.str()
+        assert "stderr contents begin" not in result.stdout.str()
 
 
 def test_setup_failure_does_not_kill_capturing(testdir):
     sub1 = testdir.mkpydir("sub1")
-    sub1.join("conftest.py").write(_pytest._code.Source("""
+    sub1.join("conftest.py").write(
+        _pytest._code.Source(
+            """
         def pytest_runtest_setup(item):
             raise ValueError(42)
-    """))
+    """
+        )
+    )
     sub1.join("test_mod.py").write("def test_func1(): pass")
-    result = testdir.runpytest(testdir.tmpdir, '--traceconfig')
-    result.stdout.fnmatch_lines([
-        "*ValueError(42)*",
-        "*1 error*"
-    ])
+    result = testdir.runpytest(testdir.tmpdir, "--traceconfig")
+    result.stdout.fnmatch_lines(["*ValueError(42)*", "*1 error*"])
 
 
 def test_fdfuncarg_skips_on_no_osdup(testdir):
-    testdir.makepyfile("""
+    testdir.makepyfile(
+        """
         import os
         if hasattr(os, 'dup'):
             del os.dup
         def test_hello(capfd):
             pass
-    """)
+    """
+    )
     result = testdir.runpytest_subprocess("--capture=no")
-    result.stdout.fnmatch_lines([
-        "*1 skipped*"
-    ])
+    result.stdout.fnmatch_lines(["*1 skipped*"])
 
 
 def test_capture_conftest_runtest_setup(testdir):
-    testdir.makeconftest("""
+    testdir.makeconftest(
+        """
         def pytest_runtest_setup():
             print ("hello19")
-    """)
+    """
+    )
     testdir.makepyfile("def test_func(): pass")
     result = testdir.runpytest()
     assert result.ret == 0
-    assert 'hello19' not in result.stdout.str()
+    assert "hello19" not in result.stdout.str()
 
 
 def test_capture_badoutput_issue412(testdir):
-    testdir.makepyfile("""
+    testdir.makepyfile(
+        """
         import os
 
         def test_func():
             omg = bytearray([1,129,1])
             os.write(1, omg)
             assert 0
-        """)
-    result = testdir.runpytest('--cap=fd')
-    result.stdout.fnmatch_lines('''
+        """
+    )
+    result = testdir.runpytest("--cap=fd")
+    result.stdout.fnmatch_lines(
+        """
         *def test_func*
         *assert 0*
         *Captured*
         *1 failed*
-    ''')
+    """
+    )
 
 
 def test_capture_early_option_parsing(testdir):
-    testdir.makeconftest("""
+    testdir.makeconftest(
+        """
         def pytest_runtest_setup():
             print ("hello19")
-    """)
+    """
+    )
     testdir.makepyfile("def test_func(): pass")
     result = testdir.runpytest("-vs")
     assert result.ret == 0
-    assert 'hello19' in result.stdout.str()
+    assert "hello19" in result.stdout.str()
 
 
 def test_capture_binary_output(testdir):
-    testdir.makepyfile(r"""
+    testdir.makepyfile(
+        r"""
         import pytest
 
         def test_a():
             import sys
             import subprocess
             subprocess.call([sys.executable, __file__])
 
         def test_foo():
             import os;os.write(1, b'\xc3')
 
         if __name__ == '__main__':
             test_foo()
-        """)
-    result = testdir.runpytest('--assert=plain')
+        """
+    )
+    result = testdir.runpytest("--assert=plain")
     result.assert_outcomes(passed=2)
 
 
 def test_error_during_readouterr(testdir):
     """Make sure we suspend capturing if errors occur during readouterr"""
-    testdir.makepyfile(pytest_xyz="""
+    testdir.makepyfile(
+        pytest_xyz="""
         from _pytest.capture import FDCapture
         def bad_snap(self):
             raise Exception('boom')
         assert FDCapture.snap
         FDCapture.snap = bad_snap
-    """)
+    """
+    )
     result = testdir.runpytest_subprocess(
         "-p", "pytest_xyz", "--version", syspathinsert=True
     )
-    result.stderr.fnmatch_lines([
-        "*in bad_snap",
-        "    raise Exception('boom')",
-        "Exception: boom",
-    ])
+    result.stderr.fnmatch_lines(
+        ["*in bad_snap", "    raise Exception('boom')", "Exception: boom"]
+    )
 
 
 class TestCaptureIO(object):
+
     def test_text(self):
         f = capture.CaptureIO()
         f.write("hello")
         s = f.getvalue()
         assert s == "hello"
         f.close()
 
     def test_unicode_and_str_mixture(self):
         f = capture.CaptureIO()
         if sys.version_info >= (3, 0):
             f.write("\u00f6")
             pytest.raises(TypeError, "f.write(bytes('hello', 'UTF-8'))")
         else:
-            f.write(unicode("\u00f6", 'UTF-8'))
+            f.write(text_type("\u00f6", "UTF-8"))
             f.write("hello")  # bytes
             s = f.getvalue()
             f.close()
-            assert isinstance(s, unicode)
+            assert isinstance(s, text_type)
 
-    @pytest.mark.skipif(
-        sys.version_info[0] == 2,
-        reason='python 3 only behaviour',
-    )
+    @pytest.mark.skipif(sys.version_info[0] == 2, reason="python 3 only behaviour")
     def test_write_bytes_to_buffer(self):
         """In python3, stdout / stderr are text io wrappers (exposing a buffer
         property of the underlying bytestream).  See issue #1407
         """
         f = capture.CaptureIO()
-        f.buffer.write(b'foo\r\n')
-        assert f.getvalue() == 'foo\r\n'
+        f.buffer.write(b"foo\r\n")
+        assert f.getvalue() == "foo\r\n"
 
 
 def test_bytes_io():
     f = py.io.BytesIO()
     f.write(tobytes("hello"))
     pytest.raises(TypeError, "f.write(totext('hello'))")
     s = f.getvalue()
     assert s == tobytes("hello")
 
 
 def test_dontreadfrominput():
     from _pytest.capture import DontReadFromInput
+
     f = DontReadFromInput()
     assert not f.isatty()
     pytest.raises(IOError, f.read)
     pytest.raises(IOError, f.readlines)
-    pytest.raises(IOError, iter, f)
+    iter_f = iter(f)
+    pytest.raises(IOError, next, iter_f)
     pytest.raises(UnsupportedOperation, f.fileno)
     f.close()  # just for completeness
 
 
-@pytest.mark.skipif('sys.version_info < (3,)', reason='python2 has no buffer')
+@pytest.mark.skipif("sys.version_info < (3,)", reason="python2 has no buffer")
 def test_dontreadfrominput_buffer_python3():
     from _pytest.capture import DontReadFromInput
+
     f = DontReadFromInput()
     fb = f.buffer
     assert not fb.isatty()
     pytest.raises(IOError, fb.read)
     pytest.raises(IOError, fb.readlines)
-    pytest.raises(IOError, iter, fb)
+    iter_f = iter(f)
+    pytest.raises(IOError, next, iter_f)
     pytest.raises(ValueError, fb.fileno)
     f.close()  # just for completeness
 
 
-@pytest.mark.skipif('sys.version_info >= (3,)', reason='python2 has no buffer')
+@pytest.mark.skipif("sys.version_info >= (3,)", reason="python2 has no buffer")
 def test_dontreadfrominput_buffer_python2():
     from _pytest.capture import DontReadFromInput
+
     f = DontReadFromInput()
     with pytest.raises(AttributeError):
         f.buffer
     f.close()  # just for completeness
 
 
 @pytest.yield_fixture
 def tmpfile(testdir):
-    f = testdir.makepyfile("").open('wb+')
+    f = testdir.makepyfile("").open("wb+")
     yield f
     if not f.closed:
         f.close()
 
 
 @needsosdup
 def test_dupfile(tmpfile):
     flist = []
@@ -733,25 +882,25 @@ def test_dupfile(tmpfile):
     assert fname_closed == repr(flist[0].buffer)
 
 
 def test_dupfile_on_bytesio():
     io = py.io.BytesIO()
     f = capture.safe_text_dupfile(io, "wb")
     f.write("hello")
     assert io.getvalue() == b"hello"
-    assert 'BytesIO object' in f.name
+    assert "BytesIO object" in f.name
 
 
 def test_dupfile_on_textio():
     io = py.io.TextIO()
     f = capture.safe_text_dupfile(io, "wb")
     f.write("hello")
     assert io.getvalue() == "hello"
-    assert not hasattr(f, 'name')
+    assert not hasattr(f, "name")
 
 
 @contextlib.contextmanager
 def lsof_check():
     pid = os.getpid()
     try:
         out = py.process.cmdexec("lsof -p %d" % pid)
     except (py.process.cmdexec.Error, UnicodeDecodeError):
@@ -783,17 +932,17 @@ class TestFDCapture(object):
         assert s == "hello"
 
     def test_simple_many(self, tmpfile):
         for i in range(10):
             self.test_simple(tmpfile)
 
     def test_simple_many_check_open_files(self, testdir):
         with lsof_check():
-            with testdir.makepyfile("").open('wb+') as tmpfile:
+            with testdir.makepyfile("").open("wb+") as tmpfile:
                 self.test_simple_many(tmpfile)
 
     def test_simple_fail_second_start(self, tmpfile):
         fd = tmpfile.fileno()
         cap = capture.FDCapture(fd)
         cap.done()
         pytest.raises(ValueError, cap.start)
 
@@ -805,29 +954,29 @@ class TestFDCapture(object):
         cap.done()
         assert s == "hello\n"
 
     def test_stdin(self, tmpfile):
         cap = capture.FDCapture(0)
         cap.start()
         x = os.read(0, 100).strip()
         cap.done()
-        assert x == tobytes('')
+        assert x == tobytes("")
 
     def test_writeorg(self, tmpfile):
         data1, data2 = tobytes("foo"), tobytes("bar")
         cap = capture.FDCapture(tmpfile.fileno())
         cap.start()
         tmpfile.write(data1)
         tmpfile.flush()
         cap.writeorg(data2)
         scap = cap.snap()
         cap.done()
         assert scap == totext(data1)
-        with open(tmpfile.name, 'rb') as stmp_file:
+        with open(tmpfile.name, "rb") as stmp_file:
             stmp = stmp_file.read()
             assert stmp == data2
 
     def test_simple_resume_suspend(self, tmpfile):
         with saved_fd(1):
             cap = capture.FDCapture(1)
             cap.start()
             data = tobytes("hello")
@@ -893,30 +1042,39 @@ class TestStdCapture(object):
             sys.stderr.write("hello error\n")
             out, err = cap.readouterr()
             assert out == "hello world\n"
             assert err == "hello error\n"
             sys.stderr.write("error2")
             out, err = cap.readouterr()
         assert err == "error2"
 
+    def test_capture_results_accessible_by_attribute(self):
+        with self.getcapture() as cap:
+            sys.stdout.write("hello")
+            sys.stderr.write("world")
+            capture_result = cap.readouterr()
+        assert capture_result.out == "hello"
+        assert capture_result.err == "world"
+
     def test_capturing_readouterr_unicode(self):
         with self.getcapture() as cap:
             print("hx\xc4\x85\xc4\x87")
             out, err = cap.readouterr()
         assert out == py.builtin._totext("hx\xc4\x85\xc4\x87\n", "utf8")
 
-    @pytest.mark.skipif('sys.version_info >= (3,)',
-                        reason='text output different for bytes on python3')
+    @pytest.mark.skipif(
+        "sys.version_info >= (3,)", reason="text output different for bytes on python3"
+    )
     def test_capturing_readouterr_decode_error_handling(self):
         with self.getcapture() as cap:
-            # triggered a internal error in pytest
-            print('\xa6')
+            # triggered an internal error in pytest
+            print("\xa6")
             out, err = cap.readouterr()
-        assert out == py.builtin._totext('\ufffd\n', 'unicode-escape')
+        assert out == py.builtin._totext("\ufffd\n", "unicode-escape")
 
     def test_reset_twice_error(self):
         with self.getcapture() as cap:
             print("hello")
             out, err = cap.readouterr()
         pytest.raises(ValueError, cap.stop_capturing)
         assert out == "hello\n"
         assert not err
@@ -978,28 +1136,32 @@ class TestStdCapture(object):
             pytest.raises(IOError, "sys.stdin.read()")
 
 
 class TestStdCaptureFD(TestStdCapture):
     pytestmark = needsosdup
     captureclass = staticmethod(StdCaptureFD)
 
     def test_simple_only_fd(self, testdir):
-        testdir.makepyfile("""
+        testdir.makepyfile(
+            """
             import os
             def test_x():
                 os.write(1, "hello\\n".encode("ascii"))
                 assert 0
-        """)
+        """
+        )
         result = testdir.runpytest_subprocess()
-        result.stdout.fnmatch_lines("""
+        result.stdout.fnmatch_lines(
+            """
             *test_x*
             *assert 0*
             *Captured stdout*
-        """)
+        """
+        )
 
     def test_intermingling(self):
         with self.getcapture() as cap:
             oswritebytes(1, "1")
             sys.stdout.write(str(2))
             sys.stdout.flush()
             oswritebytes(1, "3")
             oswritebytes(2, "a")
@@ -1016,17 +1178,18 @@ class TestStdCaptureFD(TestStdCapture):
                 cap = StdCaptureFD()
                 cap.stop_capturing()
 
 
 class TestStdCaptureFDinvalidFD(object):
     pytestmark = needsosdup
 
     def test_stdcapture_fd_invalid_fd(self, testdir):
-        testdir.makepyfile("""
+        testdir.makepyfile(
+            """
             import os
             from _pytest import capture
             def StdCaptureFD(out=True, err=True, in_=True):
                 return capture.MultiCapture(out, err, in_,
                                               Capture=capture.FDCapture)
             def test_stdout():
                 os.close(1)
                 cap = StdCaptureFD(out=True, err=False, in_=False)
@@ -1034,77 +1197,91 @@ class TestStdCaptureFDinvalidFD(object):
             def test_stderr():
                 os.close(2)
                 cap = StdCaptureFD(out=False, err=True, in_=False)
                 cap.stop_capturing()
             def test_stdin():
                 os.close(0)
                 cap = StdCaptureFD(out=False, err=False, in_=True)
                 cap.stop_capturing()
-        """)
+        """
+        )
         result = testdir.runpytest_subprocess("--capture=fd")
         assert result.ret == 0
-        assert result.parseoutcomes()['passed'] == 3
+        assert result.parseoutcomes()["passed"] == 3
 
 
 def test_capture_not_started_but_reset():
     capsys = StdCapture()
     capsys.stop_capturing()
 
 
 def test_using_capsys_fixture_works_with_sys_stdout_encoding(capsys):
-    test_text = 'test text'
+    test_text = "test text"
 
-    print(test_text.encode(sys.stdout.encoding, 'replace'))
+    print(test_text.encode(sys.stdout.encoding, "replace"))
     (out, err) = capsys.readouterr()
     assert out
-    assert err == ''
+    assert err == ""
+
+
+def test_capsys_results_accessible_by_attribute(capsys):
+    sys.stdout.write("spam")
+    sys.stderr.write("eggs")
+    capture_result = capsys.readouterr()
+    assert capture_result.out == "spam"
+    assert capture_result.err == "eggs"
 
 
 @needsosdup
-@pytest.mark.parametrize('use', [True, False])
+@pytest.mark.parametrize("use", [True, False])
 def test_fdcapture_tmpfile_remains_the_same(tmpfile, use):
     if not use:
         tmpfile = True
     cap = StdCaptureFD(out=False, err=tmpfile)
     try:
         cap.start_capturing()
         capfile = cap.err.tmpfile
         cap.readouterr()
     finally:
         cap.stop_capturing()
     capfile2 = cap.err.tmpfile
     assert capfile2 == capfile
 
 
 @needsosdup
 def test_close_and_capture_again(testdir):
-    testdir.makepyfile("""
+    testdir.makepyfile(
+        """
         import os
         def test_close():
             os.close(1)
         def test_capture_again():
             os.write(1, b"hello\\n")
             assert 0
-    """)
+    """
+    )
     result = testdir.runpytest_subprocess()
-    result.stdout.fnmatch_lines("""
+    result.stdout.fnmatch_lines(
+        """
         *test_capture_again*
         *assert 0*
         *stdout*
         *hello*
-    """)
+    """
+    )
 
 
-@pytest.mark.parametrize('method', ['SysCapture', 'FDCapture'])
+@pytest.mark.parametrize("method", ["SysCapture", "FDCapture"])
 def test_capturing_and_logging_fundamentals(testdir, method):
-    if method == "StdCaptureFD" and not hasattr(os, 'dup'):
+    if method == "StdCaptureFD" and not hasattr(os, "dup"):
         pytest.skip("need os.dup")
     # here we check a fundamental feature
-    p = testdir.makepyfile("""
+    p = testdir.makepyfile(
+        """
         import sys, os
         import py, logging
         from _pytest import capture
         cap = capture.MultiCapture(out=False, in_=False,
                                      Capture=capture.%s)
         cap.start_capturing()
 
         logging.warn("hello1")
@@ -1112,67 +1289,106 @@ def test_capturing_and_logging_fundament
         print ("suspend, captured %%s" %%(outerr,))
         logging.warn("hello2")
 
         cap.pop_outerr_to_orig()
         logging.warn("hello3")
 
         outerr = cap.readouterr()
         print ("suspend2, captured %%s" %% (outerr,))
-    """ % (method,))
+    """
+        % (method,)
+    )
     result = testdir.runpython(p)
-    result.stdout.fnmatch_lines("""
+    result.stdout.fnmatch_lines(
+        """
         suspend, captured*hello1*
         suspend2, captured*WARNING:root:hello3*
-    """)
-    result.stderr.fnmatch_lines("""
+    """
+    )
+    result.stderr.fnmatch_lines(
+        """
         WARNING:root:hello2
-    """)
+    """
+    )
     assert "atexit" not in result.stderr.str()
 
 
 def test_error_attribute_issue555(testdir):
-    testdir.makepyfile("""
+    testdir.makepyfile(
+        """
         import sys
         def test_capattr():
             assert sys.stdout.errors == "strict"
             assert sys.stderr.errors == "strict"
-    """)
+    """
+    )
     reprec = testdir.inline_run()
     reprec.assertoutcome(passed=1)
 
 
-@pytest.mark.skipif(not sys.platform.startswith('win') and sys.version_info[:2] >= (3, 6),
-                    reason='only py3.6+ on windows')
+@pytest.mark.skipif(
+    not sys.platform.startswith("win") and sys.version_info[:2] >= (3, 6),
+    reason="only py3.6+ on windows",
+)
 def test_py36_windowsconsoleio_workaround_non_standard_streams():
     """
     Ensure _py36_windowsconsoleio_workaround function works with objects that
     do not implement the full ``io``-based stream protocol, for example execnet channels (#2666).
     """
     from _pytest.capture import _py36_windowsconsoleio_workaround
 
-    class DummyStream:
+    class DummyStream(object):
+
         def write(self, s):
             pass
 
     stream = DummyStream()
     _py36_windowsconsoleio_workaround(stream)
 
 
 def test_dontreadfrominput_has_encoding(testdir):
-    testdir.makepyfile("""
+    testdir.makepyfile(
+        """
         import sys
         def test_capattr():
             # should not raise AttributeError
             assert sys.stdout.encoding
             assert sys.stderr.encoding
-    """)
+    """
+    )
     reprec = testdir.inline_run()
     reprec.assertoutcome(passed=1)
 
 
-def test_pickling_and_unpickling_enocded_file():
+def test_crash_on_closing_tmpfile_py27(testdir):
+    testdir.makepyfile(
+        """
+        from __future__ import print_function
+        import time
+        import threading
+        import sys
+
+        def spam():
+            f = sys.stderr
+            while True:
+                print('.', end='', file=f)
+
+        def test_silly():
+            t = threading.Thread(target=spam)
+            t.daemon = True
+            t.start()
+            time.sleep(0.5)
+
+    """
+    )
+    result = testdir.runpytest_subprocess()
+    assert result.ret == 0
+    assert "IOError" not in result.stdout.str()
+
+
+def test_pickling_and_unpickling_encoded_file():
     # See https://bitbucket.org/pytest-dev/pytest/pull-request/194
     # pickle.loads() raises infinite recursion if
     # EncodedFile.__getattr__ is not implemented properly
     ef = capture.EncodedFile(None, None)
     ef_as_str = pickle.dumps(ef)
     pickle.loads(ef_as_str)
--- a/third_party/python/pytest/testing/test_collection.py
+++ b/third_party/python/pytest/testing/test_collection.py
@@ -1,396 +1,448 @@
 from __future__ import absolute_import, division, print_function
+import pprint
+import sys
 import pytest
-import py
 
 import _pytest._code
 from _pytest.main import Session, EXIT_NOTESTSCOLLECTED, _in_venv
 
 
 class TestCollector(object):
+
     def test_collect_versus_item(self):
         from pytest import Collector, Item
+
         assert not issubclass(Collector, Item)
         assert not issubclass(Item, Collector)
 
     def test_compat_attributes(self, testdir, recwarn):
-        modcol = testdir.getmodulecol("""
+        modcol = testdir.getmodulecol(
+            """
             def test_pass(): pass
             def test_fail(): assert 0
-        """)
+        """
+        )
         recwarn.clear()
         assert modcol.Module == pytest.Module
         assert modcol.Class == pytest.Class
         assert modcol.Item == pytest.Item
         assert modcol.File == pytest.File
         assert modcol.Function == pytest.Function
 
     def test_check_equality(self, testdir):
-        modcol = testdir.getmodulecol("""
+        modcol = testdir.getmodulecol(
+            """
             def test_pass(): pass
             def test_fail(): assert 0
-        """)
+        """
+        )
         fn1 = testdir.collect_by_name(modcol, "test_pass")
         assert isinstance(fn1, pytest.Function)
         fn2 = testdir.collect_by_name(modcol, "test_pass")
         assert isinstance(fn2, pytest.Function)
 
         assert fn1 == fn2
         assert fn1 != modcol
-        if py.std.sys.version_info < (3, 0):
-            assert cmp(fn1, fn2) == 0
+        if sys.version_info < (3, 0):
+            assert cmp(fn1, fn2) == 0  # NOQA
         assert hash(fn1) == hash(fn2)
 
         fn3 = testdir.collect_by_name(modcol, "test_fail")
         assert isinstance(fn3, pytest.Function)
         assert not (fn1 == fn3)
         assert fn1 != fn3
 
         for fn in fn1, fn2, fn3:
             assert fn != 3
             assert fn != modcol
             assert fn != [1, 2, 3]
             assert [1, 2, 3] != fn
             assert modcol != fn
 
     def test_getparent(self, testdir):
-        modcol = testdir.getmodulecol("""
+        modcol = testdir.getmodulecol(
+            """
             class TestClass(object):
                  def test_foo():
                      pass
-        """)
+        """
+        )
         cls = testdir.collect_by_name(modcol, "TestClass")
-        fn = testdir.collect_by_name(
-            testdir.collect_by_name(cls, "()"), "test_foo")
+        fn = testdir.collect_by_name(testdir.collect_by_name(cls, "()"), "test_foo")
 
         parent = fn.getparent(pytest.Module)
         assert parent is modcol
 
         parent = fn.getparent(pytest.Function)
         assert parent is fn
 
         parent = fn.getparent(pytest.Class)
         assert parent is cls
 
     def test_getcustomfile_roundtrip(self, testdir):
         hello = testdir.makefile(".xxx", hello="world")
-        testdir.makepyfile(conftest="""
+        testdir.makepyfile(
+            conftest="""
             import pytest
             class CustomFile(pytest.File):
                 pass
             def pytest_collect_file(path, parent):
                 if path.ext == ".xxx":
                     return CustomFile(path, parent=parent)
-        """)
+        """
+        )
         node = testdir.getpathnode(hello)
         assert isinstance(node, pytest.File)
         assert node.name == "hello.xxx"
         nodes = node.session.perform_collect([node.nodeid], genitems=False)
         assert len(nodes) == 1
         assert isinstance(nodes[0], pytest.File)
 
     def test_can_skip_class_with_test_attr(self, testdir):
         """Assure test class is skipped when using `__test__=False` (See #2007)."""
-        testdir.makepyfile("""
+        testdir.makepyfile(
+            """
             class TestFoo(object):
                 __test__ = False
                 def __init__(self):
                     pass
                 def test_foo():
                     assert True
-        """)
+        """
+        )
         result = testdir.runpytest()
-        result.stdout.fnmatch_lines([
-            'collected 0 items',
-            '*no tests ran in*',
-        ])
+        result.stdout.fnmatch_lines(["collected 0 items", "*no tests ran in*"])
 
 
 class TestCollectFS(object):
+
     def test_ignored_certain_directories(self, testdir):
         tmpdir = testdir.tmpdir
-        tmpdir.ensure("build", 'test_notfound.py')
-        tmpdir.ensure("dist", 'test_notfound.py')
-        tmpdir.ensure("_darcs", 'test_notfound.py')
-        tmpdir.ensure("CVS", 'test_notfound.py')
-        tmpdir.ensure("{arch}", 'test_notfound.py')
-        tmpdir.ensure(".whatever", 'test_notfound.py')
-        tmpdir.ensure(".bzr", 'test_notfound.py')
-        tmpdir.ensure("normal", 'test_found.py')
+        tmpdir.ensure("build", "test_notfound.py")
+        tmpdir.ensure("dist", "test_notfound.py")
+        tmpdir.ensure("_darcs", "test_notfound.py")
+        tmpdir.ensure("CVS", "test_notfound.py")
+        tmpdir.ensure("{arch}", "test_notfound.py")
+        tmpdir.ensure(".whatever", "test_notfound.py")
+        tmpdir.ensure(".bzr", "test_notfound.py")
+        tmpdir.ensure("normal", "test_found.py")
         for x in tmpdir.visit("test_*.py"):
             x.write("def test_hello(): pass")
 
         result = testdir.runpytest("--collect-only")
         s = result.stdout.str()
         assert "test_notfound" not in s
         assert "test_found" in s
 
-    @pytest.mark.parametrize('fname',
-                             ("activate", "activate.csh", "activate.fish",
-                              "Activate", "Activate.bat", "Activate.ps1"))
+    @pytest.mark.parametrize(
+        "fname",
+        (
+            "activate",
+            "activate.csh",
+            "activate.fish",
+            "Activate",
+            "Activate.bat",
+            "Activate.ps1",
+        ),
+    )
     def test_ignored_virtualenvs(self, testdir, fname):
-        bindir = "Scripts" if py.std.sys.platform.startswith("win") else "bin"
+        bindir = "Scripts" if sys.platform.startswith("win") else "bin"
         testdir.tmpdir.ensure("virtual", bindir, fname)
         testfile = testdir.tmpdir.ensure("virtual", "test_invenv.py")
         testfile.write("def test_hello(): pass")
 
         # by default, ignore tests inside a virtualenv
         result = testdir.runpytest()
         assert "test_invenv" not in result.stdout.str()
         # allow test collection if user insists
         result = testdir.runpytest("--collect-in-virtualenv")
         assert "test_invenv" in result.stdout.str()
         # allow test collection if user directly passes in the directory
         result = testdir.runpytest("virtual")
         assert "test_invenv" in result.stdout.str()
 
-    @pytest.mark.parametrize('fname',
-                             ("activate", "activate.csh", "activate.fish",
-                              "Activate", "Activate.bat", "Activate.ps1"))
+    @pytest.mark.parametrize(
+        "fname",
+        (
+            "activate",
+            "activate.csh",
+            "activate.fish",
+            "Activate",
+            "Activate.bat",
+            "Activate.ps1",
+        ),
+    )
     def test_ignored_virtualenvs_norecursedirs_precedence(self, testdir, fname):
-        bindir = "Scripts" if py.std.sys.platform.startswith("win") else "bin"
+        bindir = "Scripts" if sys.platform.startswith("win") else "bin"
         # norecursedirs takes priority
         testdir.tmpdir.ensure(".virtual", bindir, fname)
         testfile = testdir.tmpdir.ensure(".virtual", "test_invenv.py")
         testfile.write("def test_hello(): pass")
         result = testdir.runpytest("--collect-in-virtualenv")
         assert "test_invenv" not in result.stdout.str()
         # ...unless the virtualenv is explicitly given on the CLI
         result = testdir.runpytest("--collect-in-virtualenv", ".virtual")
         assert "test_invenv" in result.stdout.str()
 
-    @pytest.mark.parametrize('fname',
-                             ("activate", "activate.csh", "activate.fish",
-                              "Activate", "Activate.bat", "Activate.ps1"))
+    @pytest.mark.parametrize(
+        "fname",
+        (
+            "activate",
+            "activate.csh",
+            "activate.fish",
+            "Activate",
+            "Activate.bat",
+            "Activate.ps1",
+        ),
+    )
     def test__in_venv(self, testdir, fname):
         """Directly test the virtual env detection function"""
-        bindir = "Scripts" if py.std.sys.platform.startswith("win") else "bin"
+        bindir = "Scripts" if sys.platform.startswith("win") else "bin"
         # no bin/activate, not a virtualenv
-        base_path = testdir.tmpdir.mkdir('venv')
+        base_path = testdir.tmpdir.mkdir("venv")
         assert _in_venv(base_path) is False
         # with bin/activate, totally a virtualenv
         base_path.ensure(bindir, fname)
         assert _in_venv(base_path) is True
 
     def test_custom_norecursedirs(self, testdir):
-        testdir.makeini("""
+        testdir.makeini(
+            """
             [pytest]
             norecursedirs = mydir xyz*
-        """)
+        """
+        )
         tmpdir = testdir.tmpdir
         tmpdir.ensure("mydir", "test_hello.py").write("def test_1(): pass")
         tmpdir.ensure("xyz123", "test_2.py").write("def test_2(): 0/0")
         tmpdir.ensure("xy", "test_ok.py").write("def test_3(): pass")
         rec = testdir.inline_run()
         rec.assertoutcome(passed=1)
         rec = testdir.inline_run("xyz123/test_2.py")
         rec.assertoutcome(failed=1)
 
     def test_testpaths_ini(self, testdir, monkeypatch):
-        testdir.makeini("""
+        testdir.makeini(
+            """
             [pytest]
             testpaths = gui uts
-        """)
+        """
+        )
         tmpdir = testdir.tmpdir
         tmpdir.ensure("env", "test_1.py").write("def test_env(): pass")
         tmpdir.ensure("gui", "test_2.py").write("def test_gui(): pass")
         tmpdir.ensure("uts", "test_3.py").write("def test_uts(): pass")
 
         # executing from rootdir only tests from `testpaths` directories
         # are collected
-        items, reprec = testdir.inline_genitems('-v')
-        assert [x.name for x in items] == ['test_gui', 'test_uts']
+        items, reprec = testdir.inline_genitems("-v")
+        assert [x.name for x in items] == ["test_gui", "test_uts"]
 
         # check that explicitly passing directories in the command-line
         # collects the tests
-        for dirname in ('env', 'gui', 'uts'):
+        for dirname in ("env", "gui", "uts"):
             items, reprec = testdir.inline_genitems(tmpdir.join(dirname))
-            assert [x.name for x in items] == ['test_%s' % dirname]
+            assert [x.name for x in items] == ["test_%s" % dirname]
 
         # changing cwd to each subdirectory and running pytest without
         # arguments collects the tests in that directory normally
-        for dirname in ('env', 'gui', 'uts'):
+        for dirname in ("env", "gui", "uts"):
             monkeypatch.chdir(testdir.tmpdir.join(dirname))
             items, reprec = testdir.inline_genitems()
-            assert [x.name for x in items] == ['test_%s' % dirname]
+            assert [x.name for x in items] == ["test_%s" % dirname]
 
 
 class TestCollectPluginHookRelay(object):
+
     def test_pytest_collect_file(self, testdir):
         wascalled = []
 
         class Plugin(object):
+
             def pytest_collect_file(self, path, parent):
                 if not path.basename.startswith("."):
                     # Ignore hidden files, e.g. .testmondata.
                     wascalled.append(path)
 
         testdir.makefile(".abc", "xyz")
         pytest.main([testdir.tmpdir], plugins=[Plugin()])
         assert len(wascalled) == 1
-        assert wascalled[0].ext == '.abc'
+        assert wascalled[0].ext == ".abc"
 
     def test_pytest_collect_directory(self, testdir):
         wascalled = []
 
         class Plugin(object):
+
             def pytest_collect_directory(self, path, parent):
                 wascalled.append(path.basename)
 
         testdir.mkdir("hello")
         testdir.mkdir("world")
         pytest.main(testdir.tmpdir, plugins=[Plugin()])
         assert "hello" in wascalled
         assert "world" in wascalled
 
 
 class TestPrunetraceback(object):
 
     def test_custom_repr_failure(self, testdir):
-        p = testdir.makepyfile("""
+        p = testdir.makepyfile(
+            """
             import not_exists
-        """)
-        testdir.makeconftest("""
+        """
+        )
+        testdir.makeconftest(
+            """
             import pytest
             def pytest_collect_file(path, parent):
                 return MyFile(path, parent)
             class MyError(Exception):
                 pass
             class MyFile(pytest.File):
                 def collect(self):
                     raise MyError()
                 def repr_failure(self, excinfo):
                     if excinfo.errisinstance(MyError):
                         return "hello world"
                     return pytest.File.repr_failure(self, excinfo)
-        """)
+        """
+        )
 
         result = testdir.runpytest(p)
-        result.stdout.fnmatch_lines([
-            "*ERROR collecting*",
-            "*hello world*",
-        ])
+        result.stdout.fnmatch_lines(["*ERROR collecting*", "*hello world*"])
 
     @pytest.mark.xfail(reason="other mechanism for adding to reporting needed")
     def test_collect_report_postprocessing(self, testdir):
-        p = testdir.makepyfile("""
+        p = testdir.makepyfile(
+            """
             import not_exists
-        """)
-        testdir.makeconftest("""
+        """
+        )
+        testdir.makeconftest(
+            """
             import pytest
-            def pytest_make_collect_report(__multicall__):
-                rep = __multicall__.execute()
+            @pytest.hookimpl(hookwrapper=True)
+            def pytest_make_collect_report():
+                outcome = yield
+                rep = outcome.get_result()
                 rep.headerlines += ["header1"]
-                return rep
-        """)
+                outcome.force_result(rep)
+        """
+        )
         result = testdir.runpytest(p)
-        result.stdout.fnmatch_lines([
-            "*ERROR collecting*",
-            "*header1*",
-        ])
+        result.stdout.fnmatch_lines(["*ERROR collecting*", "*header1*"])
 
 
 class TestCustomConftests(object):
+
     def test_ignore_collect_path(self, testdir):
-        testdir.makeconftest("""
+        testdir.makeconftest(
+            """
             def pytest_ignore_collect(path, config):
                 return path.basename.startswith("x") or \
                        path.basename == "test_one.py"
-        """)
+        """
+        )
         sub = testdir.mkdir("xy123")
         sub.ensure("test_hello.py").write("syntax error")
         sub.join("conftest.py").write("syntax error")
         testdir.makepyfile("def test_hello(): pass")
         testdir.makepyfile(test_one="syntax error")
         result = testdir.runpytest("--fulltrace")
         assert result.ret == 0
         result.stdout.fnmatch_lines(["*1 passed*"])
 
     def test_ignore_collect_not_called_on_argument(self, testdir):
-        testdir.makeconftest("""
+        testdir.makeconftest(
+            """
             def pytest_ignore_collect(path, config):
                 return True
-        """)
+        """
+        )
         p = testdir.makepyfile("def test_hello(): pass")
         result = testdir.runpytest(p)
         assert result.ret == 0
         result.stdout.fnmatch_lines("*1 passed*")
         result = testdir.runpytest()
         assert result.ret == EXIT_NOTESTSCOLLECTED
         result.stdout.fnmatch_lines("*collected 0 items*")
 
     def test_collectignore_exclude_on_option(self, testdir):
-        testdir.makeconftest("""
+        testdir.makeconftest(
+            """
             collect_ignore = ['hello', 'test_world.py']
             def pytest_addoption(parser):
                 parser.addoption("--XX", action="store_true", default=False)
             def pytest_configure(config):
                 if config.getvalue("XX"):
                     collect_ignore[:] = []
-        """)
+        """
+        )
         testdir.mkdir("hello")
         testdir.makepyfile(test_world="def test_hello(): pass")
         result = testdir.runpytest()
         assert result.ret == EXIT_NOTESTSCOLLECTED
         assert "passed" not in result.stdout.str()
         result = testdir.runpytest("--XX")
         assert result.ret == 0
         assert "passed" in result.stdout.str()
 
     def test_pytest_fs_collect_hooks_are_seen(self, testdir):
-        testdir.makeconftest("""
+        testdir.makeconftest(
+            """
             import pytest
             class MyModule(pytest.Module):
                 pass
             def pytest_collect_file(path, parent):
                 if path.ext == ".py":
                     return MyModule(path, parent)
-        """)
+        """
+        )
         testdir.mkdir("sub")
         testdir.makepyfile("def test_x(): pass")
         result = testdir.runpytest("--collect-only")
-        result.stdout.fnmatch_lines([
-            "*MyModule*",
-            "*test_x*"
-        ])
+        result.stdout.fnmatch_lines(["*MyModule*", "*test_x*"])
 
     def test_pytest_collect_file_from_sister_dir(self, testdir):
         sub1 = testdir.mkpydir("sub1")
         sub2 = testdir.mkpydir("sub2")
-        conf1 = testdir.makeconftest("""
+        conf1 = testdir.makeconftest(
+            """
             import pytest
             class MyModule1(pytest.Module):
                 pass
             def pytest_collect_file(path, parent):
                 if path.ext == ".py":
                     return MyModule1(path, parent)
-        """)
+        """
+        )
         conf1.move(sub1.join(conf1.basename))
-        conf2 = testdir.makeconftest("""
+        conf2 = testdir.makeconftest(
+            """
             import pytest
             class MyModule2(pytest.Module):
                 pass
             def pytest_collect_file(path, parent):
                 if path.ext == ".py":
                     return MyModule2(path, parent)
-        """)
+        """
+        )
         conf2.move(sub2.join(conf2.basename))
         p = testdir.makepyfile("def test_x(): pass")
         p.copy(sub1.join(p.basename))
         p.copy(sub2.join(p.basename))
         result = testdir.runpytest("--collect-only")
-        result.stdout.fnmatch_lines([
-            "*MyModule1*",
-            "*MyModule2*",
-            "*test_x*"
-        ])
+        result.stdout.fnmatch_lines(["*MyModule1*", "*MyModule2*", "*test_x*"])
 
 
 class TestSession(object):
+
     def test_parsearg(self, testdir):
         p = testdir.makepyfile("def test_func(): pass")
         subdir = testdir.mkdir("sub")
         subdir.ensure("__init__.py")
         target = subdir.join(p.basename)
         p.move(target)
         subdir.chdir()
         config = testdir.parseconfig(p.basename)
@@ -417,255 +469,284 @@ class TestSession(object):
         # root2 = rcol.perform_collect([rcol.nodeid], genitems=False)[0]
         # assert root2 == rcol, rootid
         colitems = rcol.perform_collect([rcol.nodeid], genitems=False)
         assert len(colitems) == 1
         assert colitems[0].fspath == p
 
     def get_reported_items(self, hookrec):
         """Return pytest.Item instances reported by the pytest_collectreport hook"""
-        calls = hookrec.getcalls('pytest_collectreport')
-        return [x for call in calls for x in call.report.result
-                if isinstance(x, pytest.Item)]
+        calls = hookrec.getcalls("pytest_collectreport")
+        return [
+            x
+            for call in calls
+            for x in call.report.result
+            if isinstance(x, pytest.Item)
+        ]
 
     def test_collect_protocol_single_function(self, testdir):
         p = testdir.makepyfile("def test_func(): pass")
         id = "::".join([p.basename, "test_func"])
         items, hookrec = testdir.inline_genitems(id)
         item, = items
         assert item.name == "test_func"
         newid = item.nodeid
         assert newid == id
-        py.std.pprint.pprint(hookrec.calls)
+        pprint.pprint(hookrec.calls)
         topdir = testdir.tmpdir  # noqa
-        hookrec.assert_contains([
-            ("pytest_collectstart", "collector.fspath == topdir"),
-            ("pytest_make_collect_report", "collector.fspath == topdir"),
-            ("pytest_collectstart", "collector.fspath == p"),
-            ("pytest_make_collect_report", "collector.fspath == p"),
-            ("pytest_pycollect_makeitem", "name == 'test_func'"),
-            ("pytest_collectreport", "report.result[0].name == 'test_func'"),
-        ])
+        hookrec.assert_contains(
+            [
+                ("pytest_collectstart", "collector.fspath == topdir"),
+                ("pytest_make_collect_report", "collector.fspath == topdir"),
+                ("pytest_collectstart", "collector.fspath == p"),
+                ("pytest_make_collect_report", "collector.fspath == p"),
+                ("pytest_pycollect_makeitem", "name == 'test_func'"),
+                ("pytest_collectreport", "report.result[0].name == 'test_func'"),
+            ]
+        )
         # ensure we are reporting the collection of the single test item (#2464)
-        assert [x.name for x in self.get_reported_items(hookrec)] == ['test_func']
+        assert [x.name for x in self.get_reported_items(hookrec)] == ["test_func"]
 
     def test_collect_protocol_method(self, testdir):
-        p = testdir.makepyfile("""
+        p = testdir.makepyfile(
+            """
             class TestClass(object):
                 def test_method(self):
                     pass
-        """)
+        """
+        )
         normid = p.basename + "::TestClass::()::test_method"
-        for id in [p.basename,
-                   p.basename + "::TestClass",
-                   p.basename + "::TestClass::()",
-                   normid,
-                   ]:
+        for id in [
+            p.basename,
+            p.basename + "::TestClass",
+            p.basename + "::TestClass::()",
+            normid,
+        ]:
             items, hookrec = testdir.inline_genitems(id)
             assert len(items) == 1
             assert items[0].name == "test_method"
             newid = items[0].nodeid
             assert newid == normid
             # ensure we are reporting the collection of the single test item (#2464)
-            assert [x.name for x in self.get_reported_items(hookrec)] == ['test_method']
+            assert [x.name for x in self.get_reported_items(hookrec)] == ["test_method"]
 
     def test_collect_custom_nodes_multi_id(self, testdir):
         p = testdir.makepyfile("def test_func(): pass")
-        testdir.makeconftest("""
+        testdir.makeconftest(
+            """
             import pytest
             class SpecialItem(pytest.Item):
                 def runtest(self):
                     return # ok
             class SpecialFile(pytest.File):
                 def collect(self):
                     return [SpecialItem(name="check", parent=self)]
             def pytest_collect_file(path, parent):
                 if path.basename == %r:
                     return SpecialFile(fspath=path, parent=parent)
-        """ % p.basename)
+        """
+            % p.basename
+        )
         id = p.basename
 
         items, hookrec = testdir.inline_genitems(id)
-        py.std.pprint.pprint(hookrec.calls)
+        pprint.pprint(hookrec.calls)
         assert len(items) == 2
-        hookrec.assert_contains([
-            ("pytest_collectstart",
-                "collector.fspath == collector.session.fspath"),
-            ("pytest_collectstart",
-                "collector.__class__.__name__ == 'SpecialFile'"),
-            ("pytest_collectstart",
-                "collector.__class__.__name__ == 'Module'"),
-            ("pytest_pycollect_makeitem", "name == 'test_func'"),
-            ("pytest_collectreport", "report.nodeid.startswith(p.basename)"),
-        ])
+        hookrec.assert_contains(
+            [
+                ("pytest_collectstart", "collector.fspath == collector.session.fspath"),
+                (
+                    "pytest_collectstart",
+                    "collector.__class__.__name__ == 'SpecialFile'",
+                ),
+                ("pytest_collectstart", "collector.__class__.__name__ == 'Module'"),
+                ("pytest_pycollect_makeitem", "name == 'test_func'"),
+                ("pytest_collectreport", "report.nodeid.startswith(p.basename)"),
+            ]
+        )
         assert len(self.get_reported_items(hookrec)) == 2
 
     def test_collect_subdir_event_ordering(self, testdir):
         p = testdir.makepyfile("def test_func(): pass")
         aaa = testdir.mkpydir("aaa")
         test_aaa = aaa.join("test_aaa.py")
         p.move(test_aaa)
 
         items, hookrec = testdir.inline_genitems()
         assert len(items) == 1
-        py.std.pprint.pprint(hookrec.calls)
-        hookrec.assert_contains([
-            ("pytest_collectstart", "collector.fspath == test_aaa"),
-            ("pytest_pycollect_makeitem", "name == 'test_func'"),
-            ("pytest_collectreport",
-             "report.nodeid.startswith('aaa/test_aaa.py')"),
-        ])
+        pprint.pprint(hookrec.calls)
+        hookrec.assert_contains(
+            [
+                ("pytest_collectstart", "collector.fspath == test_aaa"),
+                ("pytest_pycollect_makeitem", "name == 'test_func'"),
+                ("pytest_collectreport", "report.nodeid.startswith('aaa/test_aaa.py')"),
+            ]
+        )
 
     def test_collect_two_commandline_args(self, testdir):
         p = testdir.makepyfile("def test_func(): pass")
         aaa = testdir.mkpydir("aaa")
         bbb = testdir.mkpydir("bbb")
         test_aaa = aaa.join("test_aaa.py")
         p.copy(test_aaa)
         test_bbb = bbb.join("test_bbb.py")
         p.move(test_bbb)
 
         id = "."
 
         items, hookrec = testdir.inline_genitems(id)
         assert len(items) == 2
-        py.std.pprint.pprint(hookrec.calls)
-        hookrec.assert_contains([
-            ("pytest_collectstart", "collector.fspath == test_aaa"),
-            ("pytest_pycollect_makeitem", "name == 'test_func'"),
-            ("pytest_collectreport", "report.nodeid == 'aaa/test_aaa.py'"),
-            ("pytest_collectstart", "collector.fspath == test_bbb"),
-            ("pytest_pycollect_makeitem", "name == 'test_func'"),
-            ("pytest_collectreport", "report.nodeid == 'bbb/test_bbb.py'"),
-        ])
+        pprint.pprint(hookrec.calls)
+        hookrec.assert_contains(
+            [
+                ("pytest_collectstart", "collector.fspath == test_aaa"),
+                ("pytest_pycollect_makeitem", "name == 'test_func'"),
+                ("pytest_collectreport", "report.nodeid == 'aaa/test_aaa.py'"),
+                ("pytest_collectstart", "collector.fspath == test_bbb"),
+                ("pytest_pycollect_makeitem", "name == 'test_func'"),
+                ("pytest_collectreport", "report.nodeid == 'bbb/test_bbb.py'"),
+            ]
+        )
 
     def test_serialization_byid(self, testdir):
         testdir.makepyfile("def test_func(): pass")
         items, hookrec = testdir.inline_genitems()
         assert len(items) == 1
         item, = items
         items2, hookrec = testdir.inline_genitems(item.nodeid)
         item2, = items2
         assert item2.name == item.name
         assert item2.fspath == item.fspath
 
     def test_find_byid_without_instance_parents(self, testdir):
-        p = testdir.makepyfile("""
+        p = testdir.makepyfile(
+            """
             class TestClass(object):
                 def test_method(self):
                     pass
-        """)
+        """
+        )
         arg = p.basename + "::TestClass::test_method"
         items, hookrec = testdir.inline_genitems(arg)
         assert len(items) == 1
         item, = items
         assert item.nodeid.endswith("TestClass::()::test_method")
         # ensure we are reporting the collection of the single test item (#2464)
-        assert [x.name for x in self.get_reported_items(hookrec)] == ['test_method']
+        assert [x.name for x in self.get_reported_items(hookrec)] == ["test_method"]
 
 
 class Test_getinitialnodes(object):
+
     def test_global_file(self, testdir, tmpdir):
         x = tmpdir.ensure("x.py")
         with tmpdir.as_cwd():
             config = testdir.parseconfigure(x)
         col = testdir.getnode(config, x)
         assert isinstance(col, pytest.Module)
-        assert col.name == 'x.py'
-        assert col.parent.name == testdir.tmpdir.basename
+        assert col.name == "x.py"
         assert col.parent.parent is None
         for col in col.listchain():
             assert col.config is config
 
     def test_pkgfile(self, testdir):
         tmpdir = testdir.tmpdir
         subdir = tmpdir.join("subdir")
         x = subdir.ensure("x.py")
         subdir.ensure("__init__.py")
         with subdir.as_cwd():
             config = testdir.parseconfigure(x)
         col = testdir.getnode(config, x)
         assert isinstance(col, pytest.Module)
-        assert col.name == 'x.py'
+        assert col.name == "x.py"
         assert col.parent.parent is None
         for col in col.listchain():
             assert col.config is config
 
 
 class Test_genitems(object):
+
     def test_check_collect_hashes(self, testdir):
-        p = testdir.makepyfile("""
+        p = testdir.makepyfile(
+            """
             def test_1():
                 pass
 
             def test_2():
                 pass
-        """)
+        """
+        )
         p.copy(p.dirpath(p.purebasename + "2" + ".py"))
         items, reprec = testdir.inline_genitems(p.dirpath())
         assert len(items) == 4
         for numi, i in enumerate(items):
             for numj, j in enumerate(items):
                 if numj != numi:
                     assert hash(i) != hash(j)
                     assert i != j
 
     def test_example_items1(self, testdir):
-        p = testdir.makepyfile('''
+        p = testdir.makepyfile(
+            """
             def testone():
                 pass
 
             class TestX(object):
                 def testmethod_one(self):
                     pass
 
             class TestY(TestX):
                 pass
-        ''')
+        """
+        )
         items, reprec = testdir.inline_genitems(p)
         assert len(items) == 3
-        assert items[0].name == 'testone'
-        assert items[1].name == 'testmethod_one'
-        assert items[2].name == 'testmethod_one'
+        assert items[0].name == "testone"
+        assert items[1].name == "testmethod_one"
+        assert items[2].name == "testmethod_one"
 
         # let's also test getmodpath here
         assert items[0].getmodpath() == "testone"
         assert items[1].getmodpath() == "TestX.testmethod_one"
         assert items[2].getmodpath() == "TestY.testmethod_one"
 
         s = items[0].getmodpath(stopatmodule=False)
         assert s.endswith("test_example_items1.testone")
         print(s)
 
     def test_class_and_functions_discovery_using_glob(self, testdir):
         """
         tests that python_classes and python_functions config options work
         as prefixes and glob-like patterns (issue #600).
         """
-        testdir.makeini("""
+        testdir.makeini(
+            """
             [pytest]
             python_classes = *Suite Test
             python_functions = *_test test
-        """)
-        p = testdir.makepyfile('''
+        """
+        )
+        p = testdir.makepyfile(
+            """
             class MyTestSuite(object):
                 def x_test(self):
                     pass
 
             class TestCase(object):
                 def test_y(self):
                     pass
-        ''')
+        """
+        )
         items, reprec = testdir.inline_genitems(p)
         ids = [x.getmodpath() for x in items]
-        assert ids == ['MyTestSuite.x_test', 'TestCase.test_y']
+        assert ids == ["MyTestSuite.x_test", "TestCase.test_y"]
 
 
 def test_matchnodes_two_collections_same_file(testdir):
-    testdir.makeconftest("""
+    testdir.makeconftest(
+        """
         import pytest
         def pytest_configure(config):
             config.pluginmanager.register(Plugin2())
 
         class Plugin2(object):
             def pytest_collect_file(self, path, parent):
                 if path.ext == ".abc":
                     return MyFile2(path, parent)
@@ -679,49 +760,51 @@ def test_matchnodes_two_collections_same
                 pass
         class MyFile2(pytest.File):
             def collect(self):
                 return [Item2("hello", parent=self)]
 
         class Item2(pytest.Item):
             def runtest(self):
                 pass
-    """)
+    """
+    )
     p = testdir.makefile(".abc", "")
     result = testdir.runpytest()
     assert result.ret == 0
-    result.stdout.fnmatch_lines([
-        "*2 passed*",
-    ])
+    result.stdout.fnmatch_lines(["*2 passed*"])
     res = testdir.runpytest("%s::hello" % p.basename)
-    res.stdout.fnmatch_lines([
-        "*1 passed*",
-    ])
+    res.stdout.fnmatch_lines(["*1 passed*"])
 
 
 class TestNodekeywords(object):
+
     def test_no_under(self, testdir):
-        modcol = testdir.getmodulecol("""
+        modcol = testdir.getmodulecol(
+            """
             def test_pass(): pass
             def test_fail(): assert 0
-        """)
+        """
+        )
         values = list(modcol.keywords)
         assert modcol.name in values
         for x in values:
             assert not x.startswith("_")
         assert modcol.name in repr(modcol.keywords)
 
     def test_issue345(self, testdir):
-        testdir.makepyfile("""
+        testdir.makepyfile(
+            """
             def test_should_not_be_selected():
                 assert False, 'I should not have been selected to run'
 
             def test___repr__():
                 pass
-        """)
+        """
+        )
         reprec = testdir.inline_run("-k repr")
         reprec.assertoutcome(passed=1, failed=0)
 
 
 COLLECTION_ERROR_PY_FILES = dict(
     test_01_failure="""
         def test_1():
             assert False
@@ -745,114 +828,117 @@ COLLECTION_ERROR_PY_FILES = dict(
 
 def test_exit_on_collection_error(testdir):
     """Verify that all collection errors are collected and no tests executed"""
     testdir.makepyfile(**COLLECTION_ERROR_PY_FILES)
 
     res = testdir.runpytest()
     assert res.ret == 2
 
-    res.stdout.fnmatch_lines([
-        "collected 2 items / 2 errors",
-        "*ERROR collecting test_02_import_error.py*",
-        "*No module named *asdfa*",
-        "*ERROR collecting test_03_import_error.py*",
-        "*No module named *asdfa*",
-    ])
+    res.stdout.fnmatch_lines(
+        [
+            "collected 2 items / 2 errors",
+            "*ERROR collecting test_02_import_error.py*",
+            "*No module named *asdfa*",
+            "*ERROR collecting test_03_import_error.py*",
+            "*No module named *asdfa*",
+        ]
+    )
 
 
 def test_exit_on_collection_with_maxfail_smaller_than_n_errors(testdir):
     """
     Verify collection is aborted once maxfail errors are encountered ignoring
     further modules which would cause more collection errors.
     """
     testdir.makepyfile(**COLLECTION_ERROR_PY_FILES)
 
     res = testdir.runpytest("--maxfail=1")
-    assert res.ret == 2
+    assert res.ret == 1
 
-    res.stdout.fnmatch_lines([
-        "*ERROR collecting test_02_import_error.py*",
-        "*No module named *asdfa*",
-        "*Interrupted: stopping after 1 failures*",
-    ])
+    res.stdout.fnmatch_lines(
+        ["*ERROR collecting test_02_import_error.py*", "*No module named *asdfa*"]
+    )
 
-    assert 'test_03' not in res.stdout.str()
+    assert "test_03" not in res.stdout.str()
 
 
 def test_exit_on_collection_with_maxfail_bigger_than_n_errors(testdir):
     """
     Verify the test run aborts due to collection errors even if maxfail count of
     errors was not reached.
     """
     testdir.makepyfile(**COLLECTION_ERROR_PY_FILES)
 
     res = testdir.runpytest("--maxfail=4")
     assert res.ret == 2
 
-    res.stdout.fnmatch_lines([
-        "collected 2 items / 2 errors",
-        "*ERROR collecting test_02_import_error.py*",
-        "*No module named *asdfa*",
-        "*ERROR collecting test_03_import_error.py*",
-        "*No module named *asdfa*",
-    ])
+    res.stdout.fnmatch_lines(
+        [
+            "collected 2 items / 2 errors",
+            "*ERROR collecting test_02_import_error.py*",
+            "*No module named *asdfa*",
+            "*ERROR collecting test_03_import_error.py*",
+            "*No module named *asdfa*",
+        ]
+    )
 
 
 def test_continue_on_collection_errors(testdir):
     """
     Verify tests are executed even when collection errors occur when the
     --continue-on-collection-errors flag is set
     """
     testdir.makepyfile(**COLLECTION_ERROR_PY_FILES)
 
     res = testdir.runpytest("--continue-on-collection-errors")
     assert res.ret == 1
 
-    res.stdout.fnmatch_lines([
-        "collected 2 items / 2 errors",
-        "*1 failed, 1 passed, 2 error*",
-    ])
+    res.stdout.fnmatch_lines(
+        ["collected 2 items / 2 errors", "*1 failed, 1 passed, 2 error*"]
+    )
 
 
 def test_continue_on_collection_errors_maxfail(testdir):
     """
     Verify tests are executed even when collection errors occur and that maxfail
     is honoured (including the collection error count).
     4 tests: 2 collection errors + 1 failure + 1 success
     test_4 is never executed because the test run is with --maxfail=3 which
     means it is interrupted after the 2 collection errors + 1 failure.
     """
     testdir.makepyfile(**COLLECTION_ERROR_PY_FILES)
 
     res = testdir.runpytest("--continue-on-collection-errors", "--maxfail=3")
-    assert res.ret == 2
+    assert res.ret == 1
 
-    res.stdout.fnmatch_lines([
-        "collected 2 items / 2 errors",
-        "*Interrupted: stopping after 3 failures*",
-        "*1 failed, 2 error*",
-    ])
+    res.stdout.fnmatch_lines(["collected 2 items / 2 errors", "*1 failed, 2 error*"])
 
 
 def test_fixture_scope_sibling_conftests(testdir):
     """Regression test case for https://github.com/pytest-dev/pytest/issues/2836"""
     foo_path = testdir.mkpydir("foo")
-    foo_path.join("conftest.py").write(_pytest._code.Source("""
+    foo_path.join("conftest.py").write(
+        _pytest._code.Source(
+            """
         import pytest
         @pytest.fixture
         def fix():
             return 1
-    """))
+    """
+        )
+    )
     foo_path.join("test_foo.py").write("def test_foo(fix): assert fix == 1")
 
     # Tests in `food/` should not see the conftest fixture from `foo/`
     food_path = testdir.mkpydir("food")
     food_path.join("test_food.py").write("def test_food(fix): assert fix == 1")
 
     res = testdir.runpytest()
     assert res.ret == 1
 
-    res.stdout.fnmatch_lines([
-        "*ERROR at setup of test_food*",
-        "E*fixture 'fix' not found",
-        "*1 passed, 1 error*",
-    ])
+    res.stdout.fnmatch_lines(
+        [
+            "*ERROR at setup of test_food*",
+            "E*fixture 'fix' not found",
+            "*1 passed, 1 error*",
+        ]
+    )
--- a/third_party/python/pytest/testing/test_compat.py
+++ b/third_party/python/pytest/testing/test_compat.py
@@ -2,100 +2,109 @@ from __future__ import absolute_import, 
 import sys
 
 import pytest
 from _pytest.compat import is_generator, get_real_func, safe_getattr
 from _pytest.outcomes import OutcomeException
 
 
 def test_is_generator():
+
     def zap():
         yield
 
     def foo():
         pass
 
     assert is_generator(zap)
     assert not is_generator(foo)
 
 
 def test_real_func_loop_limit():
 
     class Evil(object):
+
         def __init__(self):
             self.left = 1000
 
         def __repr__(self):
             return "<Evil left={left}>".format(left=self.left)
 
         def __getattr__(self, attr):
             if not self.left:
-                raise RuntimeError('its over')
+                raise RuntimeError("its over")
             self.left -= 1
             return self
 
     evil = Evil()
 
     with pytest.raises(ValueError):
         res = get_real_func(evil)
         print(res)
 
 
-@pytest.mark.skipif(sys.version_info < (3, 4),
-                    reason='asyncio available in Python 3.4+')
+@pytest.mark.skipif(
+    sys.version_info < (3, 4), reason="asyncio available in Python 3.4+"
+)
 def test_is_generator_asyncio(testdir):
-    testdir.makepyfile("""
+    testdir.makepyfile(
+        """
         from _pytest.compat import is_generator
         import asyncio
         @asyncio.coroutine
         def baz():
             yield from [1,2,3]
 
         def test_is_generator_asyncio():
             assert not is_generator(baz)
-    """)
+    """
+    )
     # avoid importing asyncio into pytest's own process,
     # which in turn imports logging (#8)
     result = testdir.runpytest_subprocess()
-    result.stdout.fnmatch_lines(['*1 passed*'])
+    result.stdout.fnmatch_lines(["*1 passed*"])
 
 
-@pytest.mark.skipif(sys.version_info < (3, 5),
-                    reason='async syntax available in Python 3.5+')
+@pytest.mark.skipif(
+    sys.version_info < (3, 5), reason="async syntax available in Python 3.5+"
+)
 def test_is_generator_async_syntax(testdir):
-    testdir.makepyfile("""
+    testdir.makepyfile(
+        """
         from _pytest.compat import is_generator
         def test_is_generator_py35():
             async def foo():
                 await foo()
 
             async def bar():
                 pass
 
             assert not is_generator(foo)
             assert not is_generator(bar)
-    """)
+    """
+    )
     result = testdir.runpytest()
-    result.stdout.fnmatch_lines(['*1 passed*'])
+    result.stdout.fnmatch_lines(["*1 passed*"])
 
 
 class ErrorsHelper(object):
+
     @property
     def raise_exception(self):
-        raise Exception('exception should be catched')
+        raise Exception("exception should be catched")
 
     @property
     def raise_fail(self):
-        pytest.fail('fail should be catched')
+        pytest.fail("fail should be catched")
 
 
 def test_helper_failures():
     helper = ErrorsHelper()
     with pytest.raises(Exception):
         helper.raise_exception
     with pytest.raises(OutcomeException):
         helper.raise_fail
 
 
 def test_safe_getattr():
     helper = ErrorsHelper()
-    assert safe_getattr(helper, 'raise_exception', 'default') == 'default'
-    assert safe_getattr(helper, 'raise_fail', 'default') == 'default'
+    assert safe_getattr(helper, "raise_exception", "default") == "default"
+    assert safe_getattr(helper, "raise_fail", "default") == "default"
--- a/third_party/python/pytest/testing/test_config.py
+++ b/third_party/python/pytest/testing/test_config.py
@@ -1,682 +1,825 @@
 from __future__ import absolute_import, division, print_function
-import py
+import sys
+import textwrap
 import pytest
 
 import _pytest._code
-from _pytest.config import getcfg, get_common_ancestor, determine_setup, _iter_rewritable_modules
+from _pytest.config.findpaths import getcfg, get_common_ancestor, determine_setup
+from _pytest.config import _iter_rewritable_modules
 from _pytest.main import EXIT_NOTESTSCOLLECTED
 
 
 class TestParseIni(object):
 
-    @pytest.mark.parametrize('section, filename',
-                             [('pytest', 'pytest.ini'), ('tool:pytest', 'setup.cfg')])
+    @pytest.mark.parametrize(
+        "section, filename", [("pytest", "pytest.ini"), ("tool:pytest", "setup.cfg")]
+    )
     def test_getcfg_and_config(self, testdir, tmpdir, section, filename):
         sub = tmpdir.mkdir("sub")
         sub.chdir()
-        tmpdir.join(filename).write(_pytest._code.Source("""
+        tmpdir.join(filename).write(
+            _pytest._code.Source(
+                """
             [{section}]
             name = value
-        """.format(section=section)))
+        """.format(
+                    section=section
+                )
+            )
+        )
         rootdir, inifile, cfg = getcfg([sub])
-        assert cfg['name'] == "value"
+        assert cfg["name"] == "value"
         config = testdir.parseconfigure(sub)
-        assert config.inicfg['name'] == 'value'
+        assert config.inicfg["name"] == "value"
 
     def test_getcfg_empty_path(self):
         """correctly handle zero length arguments (a la pytest '')"""
-        getcfg([''])
+        getcfg([""])
 
     def test_append_parse_args(self, testdir, tmpdir, monkeypatch):
-        monkeypatch.setenv('PYTEST_ADDOPTS', '--color no -rs --tb="short"')
-        tmpdir.join("pytest.ini").write(_pytest._code.Source("""
+        monkeypatch.setenv("PYTEST_ADDOPTS", '--color no -rs --tb="short"')
+        tmpdir.join("pytest.ini").write(
+            _pytest._code.Source(
+                """
             [pytest]
             addopts = --verbose
-        """))
+        """
+            )
+        )
         config = testdir.parseconfig(tmpdir)
-        assert config.option.color == 'no'
-        assert config.option.reportchars == 's'
-        assert config.option.tbstyle == 'short'
+        assert config.option.color == "no"
+        assert config.option.reportchars == "s"
+        assert config.option.tbstyle == "short"
         assert config.option.verbose
 
     def test_tox_ini_wrong_version(self, testdir):
-        testdir.makefile('.ini', tox="""
+        testdir.makefile(
+            ".ini",
+            tox="""
             [pytest]
             minversion=9.0
-        """)
+        """,
+        )
         result = testdir.runpytest()
         assert result.ret != 0
-        result.stderr.fnmatch_lines([
-            "*tox.ini:2*requires*9.0*actual*"
-        ])
+        result.stderr.fnmatch_lines(["*tox.ini:2*requires*9.0*actual*"])
 
-    @pytest.mark.parametrize("section, name", [
-        ('tool:pytest', 'setup.cfg'),
-        ('pytest', 'tox.ini'),
-        ('pytest', 'pytest.ini')],
+    @pytest.mark.parametrize(
+        "section, name",
+        [("tool:pytest", "setup.cfg"), ("pytest", "tox.ini"), ("pytest", "pytest.ini")],
     )
     def test_ini_names(self, testdir, name, section):
-        testdir.tmpdir.join(name).write(py.std.textwrap.dedent("""
+        testdir.tmpdir.join(name).write(
+            textwrap.dedent(
+                """
             [{section}]
             minversion = 1.0
-        """.format(section=section)))
+        """.format(
+                    section=section
+                )
+            )
+        )
         config = testdir.parseconfig()
         assert config.getini("minversion") == "1.0"
 
     def test_toxini_before_lower_pytestini(self, testdir):
         sub = testdir.tmpdir.mkdir("sub")
-        sub.join("tox.ini").write(py.std.textwrap.dedent("""
+        sub.join("tox.ini").write(
+            textwrap.dedent(
+                """
             [pytest]
             minversion = 2.0
-        """))
-        testdir.tmpdir.join("pytest.ini").write(py.std.textwrap.dedent("""
+        """
+            )
+        )
+        testdir.tmpdir.join("pytest.ini").write(
+            textwrap.dedent(
+                """
             [pytest]
             minversion = 1.5
-        """))
+        """
+            )
+        )
         config = testdir.parseconfigure(sub)
         assert config.getini("minversion") == "2.0"
 
     @pytest.mark.xfail(reason="probably not needed")
     def test_confcutdir(self, testdir):
         sub = testdir.mkdir("sub")
         sub.chdir()
-        testdir.makeini("""
+        testdir.makeini(
+            """
             [pytest]
             addopts = --qwe
-        """)
+        """
+        )
         result = testdir.inline_run("--confcutdir=.")
         assert result.ret == 0
 
 
 class TestConfigCmdlineParsing(object):
+
     def test_parsing_again_fails(self, testdir):
         config = testdir.parseconfig()
         pytest.raises(AssertionError, lambda: config.parse([]))
 
     def test_explicitly_specified_config_file_is_loaded(self, testdir):
-        testdir.makeconftest("""
+        testdir.makeconftest(
+            """
             def pytest_addoption(parser):
                 parser.addini("custom", "")
-        """)
-        testdir.makeini("""
+        """
+        )
+        testdir.makeini(
+            """
             [pytest]
             custom = 0
-        """)
-        testdir.makefile(".cfg", custom="""
+        """
+        )
+        testdir.makefile(
+            ".cfg",
+            custom="""
             [pytest]
             custom = 1
-        """)
+        """,
+        )
         config = testdir.parseconfig("-c", "custom.cfg")
         assert config.getini("custom") == "1"
 
+        testdir.makefile(
+            ".cfg",
+            custom_tool_pytest_section="""
+            [tool:pytest]
+            custom = 1
+        """,
+        )
+        config = testdir.parseconfig("-c", "custom_tool_pytest_section.cfg")
+        assert config.getini("custom") == "1"
+
     def test_absolute_win32_path(self, testdir):
-        temp_cfg_file = testdir.makefile(".cfg", custom="""
+        temp_cfg_file = testdir.makefile(
+            ".cfg",
+            custom="""
             [pytest]
             addopts = --version
-        """)
+        """,
+        )
         from os.path import normpath
+
         temp_cfg_file = normpath(str(temp_cfg_file))
         ret = pytest.main("-c " + temp_cfg_file)
         assert ret == _pytest.main.EXIT_OK
 
 
 class TestConfigAPI(object):
+
     def test_config_trace(self, testdir):
         config = testdir.parseconfig()
         values = []
         config.trace.root.setwriter(values.append)
         config.trace("hello")
         assert len(values) == 1
         assert values[0] == "hello [config]\n"
 
     def test_config_getoption(self, testdir):
-        testdir.makeconftest("""
+        testdir.makeconftest(
+            """
             def pytest_addoption(parser):
                 parser.addoption("--hello", "-X", dest="hello")
-        """)
+        """
+        )
         config = testdir.parseconfig("--hello=this")
         for x in ("hello", "--hello", "-X"):
             assert config.getoption(x) == "this"
         pytest.raises(ValueError, "config.getoption('qweqwe')")
 
-    @pytest.mark.skipif('sys.version_info[:2] not in [(2, 6), (2, 7)]')
+    @pytest.mark.skipif("sys.version_info[0] < 3")
     def test_config_getoption_unicode(self, testdir):
-        testdir.makeconftest("""
+        testdir.makeconftest(
+            """
             from __future__ import unicode_literals
 
             def pytest_addoption(parser):
                 parser.addoption('--hello', type=str)
-        """)
-        config = testdir.parseconfig('--hello=this')
-        assert config.getoption('hello') == 'this'
+        """
+        )
+        config = testdir.parseconfig("--hello=this")
+        assert config.getoption("hello") == "this"
 
     def test_config_getvalueorskip(self, testdir):
         config = testdir.parseconfig()
-        pytest.raises(pytest.skip.Exception,
-                      "config.getvalueorskip('hello')")
+        pytest.raises(pytest.skip.Exception, "config.getvalueorskip('hello')")
         verbose = config.getvalueorskip("verbose")
         assert verbose == config.option.verbose
 
     def test_config_getvalueorskip_None(self, testdir):
-        testdir.makeconftest("""
+        testdir.makeconftest(
+            """
             def pytest_addoption(parser):
                 parser.addoption("--hello")
-        """)
+        """
+        )
         config = testdir.parseconfig()
         with pytest.raises(pytest.skip.Exception):
-            config.getvalueorskip('hello')
+            config.getvalueorskip("hello")
 
     def test_getoption(self, testdir):
         config = testdir.parseconfig()
         with pytest.raises(ValueError):
-            config.getvalue('x')
+            config.getvalue("x")
         assert config.getoption("x", 1) == 1
 
     def test_getconftest_pathlist(self, testdir, tmpdir):
         somepath = tmpdir.join("x", "y", "z")
         p = tmpdir.join("conftest.py")
         p.write("pathlist = ['.', %r]" % str(somepath))
         config = testdir.parseconfigure(p)
-        assert config._getconftest_pathlist('notexist', path=tmpdir) is None
-        pl = config._getconftest_pathlist('pathlist', path=tmpdir)
+        assert config._getconftest_pathlist("notexist", path=tmpdir) is None
+        pl = config._getconftest_pathlist("pathlist", path=tmpdir)
         print(pl)
         assert len(pl) == 2
         assert pl[0] == tmpdir
         assert pl[1] == somepath
 
     def test_addini(self, testdir):
-        testdir.makeconftest("""
+        testdir.makeconftest(
+            """
             def pytest_addoption(parser):
                 parser.addini("myname", "my new ini value")
-        """)
-        testdir.makeini("""
+        """
+        )
+        testdir.makeini(
+            """
             [pytest]
             myname=hello
-        """)
+        """
+        )
         config = testdir.parseconfig()
         val = config.getini("myname")
         assert val == "hello"
-        pytest.raises(ValueError, config.getini, 'other')
+        pytest.raises(ValueError, config.getini, "other")
 
     def test_addini_pathlist(self, testdir):
-        testdir.makeconftest("""
+        testdir.makeconftest(
+            """
             def pytest_addoption(parser):
                 parser.addini("paths", "my new ini value", type="pathlist")
                 parser.addini("abc", "abc value")
-        """)
-        p = testdir.makeini("""
+        """
+        )
+        p = testdir.makeini(
+            """
             [pytest]
             paths=hello world/sub.py
-        """)
+        """
+        )
         config = testdir.parseconfig()
         values = config.getini("paths")
         assert len(values) == 2
-        assert values[0] == p.dirpath('hello')
-        assert values[1] == p.dirpath('world/sub.py')
-        pytest.raises(ValueError, config.getini, 'other')
+        assert values[0] == p.dirpath("hello")
+        assert values[1] == p.dirpath("world/sub.py")
+        pytest.raises(ValueError, config.getini, "other")
 
     def test_addini_args(self, testdir):
-        testdir.makeconftest("""
+        testdir.makeconftest(
+            """
             def pytest_addoption(parser):
                 parser.addini("args", "new args", type="args")
                 parser.addini("a2", "", "args", default="1 2 3".split())
-        """)
-        testdir.makeini("""
+        """
+        )
+        testdir.makeini(
+            """
             [pytest]
             args=123 "123 hello" "this"
-        """)
+        """
+        )
         config = testdir.parseconfig()
         values = config.getini("args")
         assert len(values) == 3
         assert values == ["123", "123 hello", "this"]
         values = config.getini("a2")
         assert values == list("123")
 
     def test_addini_linelist(self, testdir):
-        testdir.makeconftest("""
+        testdir.makeconftest(
+            """
             def pytest_addoption(parser):
                 parser.addini("xy", "", type="linelist")
                 parser.addini("a2", "", "linelist")
-        """)
-        testdir.makeini("""
+        """
+        )
+        testdir.makeini(
+            """
             [pytest]
             xy= 123 345
                 second line
-        """)
+        """
+        )
         config = testdir.parseconfig()
         values = config.getini("xy")
         assert len(values) == 2
         assert values == ["123 345", "second line"]
         values = config.getini("a2")
         assert values == []
 
-    @pytest.mark.parametrize('str_val, bool_val',
-                             [('True', True), ('no', False), ('no-ini', True)])
+    @pytest.mark.parametrize(
+        "str_val, bool_val", [("True", True), ("no", False), ("no-ini", True)]
+    )
     def test_addini_bool(self, testdir, str_val, bool_val):
-        testdir.makeconftest("""
+        testdir.makeconftest(
+            """
             def pytest_addoption(parser):
                 parser.addini("strip", "", type="bool", default=True)
-        """)
-        if str_val != 'no-ini':
-            testdir.makeini("""
+        """
+        )
+        if str_val != "no-ini":
+            testdir.makeini(
+                """
                 [pytest]
                 strip=%s
-            """ % str_val)
+            """
+                % str_val
+            )
         config = testdir.parseconfig()
         assert config.getini("strip") is bool_val
 
     def test_addinivalue_line_existing(self, testdir):
-        testdir.makeconftest("""
+        testdir.makeconftest(
+            """
             def pytest_addoption(parser):
                 parser.addini("xy", "", type="linelist")
-        """)
-        testdir.makeini("""
+        """
+        )
+        testdir.makeini(
+            """
             [pytest]
             xy= 123
-        """)
+        """
+        )
         config = testdir.parseconfig()
         values = config.getini("xy")
         assert len(values) == 1
         assert values == ["123"]
         config.addinivalue_line("xy", "456")
         values = config.getini("xy")
         assert len(values) == 2
         assert values == ["123", "456"]
 
     def test_addinivalue_line_new(self, testdir):
-        testdir.makeconftest("""
+        testdir.makeconftest(
+            """
             def pytest_addoption(parser):
                 parser.addini("xy", "", type="linelist")
-        """)
+        """
+        )
         config = testdir.parseconfig()
         assert not config.getini("xy")
         config.addinivalue_line("xy", "456")
         values = config.getini("xy")
         assert len(values) == 1
         assert values == ["456"]
         config.addinivalue_line("xy", "123")
         values = config.getini("xy")
         assert len(values) == 2
         assert values == ["456", "123"]
 
     def test_confcutdir_check_isdir(self, testdir):
         """Give an error if --confcutdir is not a valid directory (#2078)"""
         with pytest.raises(pytest.UsageError):
-            testdir.parseconfig('--confcutdir', testdir.tmpdir.join('file').ensure(file=1))
+            testdir.parseconfig(
+                "--confcutdir", testdir.tmpdir.join("file").ensure(file=1)
+            )
         with pytest.raises(pytest.UsageError):
-            testdir.parseconfig('--confcutdir', testdir.tmpdir.join('inexistant'))
-        config = testdir.parseconfig('--confcutdir', testdir.tmpdir.join('dir').ensure(dir=1))
-        assert config.getoption('confcutdir') == str(testdir.tmpdir.join('dir'))
+            testdir.parseconfig("--confcutdir", testdir.tmpdir.join("inexistant"))
+        config = testdir.parseconfig(
+            "--confcutdir", testdir.tmpdir.join("dir").ensure(dir=1)
+        )
+        assert config.getoption("confcutdir") == str(testdir.tmpdir.join("dir"))
 
-    @pytest.mark.parametrize('names, expected', [
-        (['bar.py'], ['bar']),
-        (['foo', 'bar.py'], []),
-        (['foo', 'bar.pyc'], []),
-        (['foo', '__init__.py'], ['foo']),
-        (['foo', 'bar', '__init__.py'], []),
-    ])
+    @pytest.mark.parametrize(
+        "names, expected",
+        [
+            (["bar.py"], ["bar"]),
+            (["foo", "bar.py"], []),
+            (["foo", "bar.pyc"], []),
+            (["foo", "__init__.py"], ["foo"]),
+            (["foo", "bar", "__init__.py"], []),
+        ],
+    )
     def test_iter_rewritable_modules(self, names, expected):
-        assert list(_iter_rewritable_modules(['/'.join(names)])) == expected
+        assert list(_iter_rewritable_modules(["/".join(names)])) == expected
 
 
 class TestConfigFromdictargs(object):
+
     def test_basic_behavior(self):
         from _pytest.config import Config
-        option_dict = {
-            'verbose': 444,
-            'foo': 'bar',
-            'capture': 'no',
-        }
-        args = ['a', 'b']
+
+        option_dict = {"verbose": 444, "foo": "bar", "capture": "no"}
+        args = ["a", "b"]
 
         config = Config.fromdictargs(option_dict, args)
         with pytest.raises(AssertionError):
-            config.parse(['should refuse to parse again'])
+            config.parse(["should refuse to parse again"])
         assert config.option.verbose == 444
-        assert config.option.foo == 'bar'
-        assert config.option.capture == 'no'
+        assert config.option.foo == "bar"
+        assert config.option.capture == "no"
         assert config.args == args
 
     def test_origargs(self):
         """Show that fromdictargs can handle args in their "orig" format"""
         from _pytest.config import Config
+
         option_dict = {}
-        args = ['-vvvv', '-s', 'a', 'b']
+        args = ["-vvvv", "-s", "a", "b"]
 
         config = Config.fromdictargs(option_dict, args)
-        assert config.args == ['a', 'b']
+        assert config.args == ["a", "b"]
         assert config._origargs == args
         assert config.option.verbose == 4
-        assert config.option.capture == 'no'
+        assert config.option.capture == "no"
 
     def test_inifilename(self, tmpdir):
-        tmpdir.join("foo/bar.ini").ensure().write(_pytest._code.Source("""
+        tmpdir.join("foo/bar.ini").ensure().write(
+            _pytest._code.Source(
+                """
             [pytest]
             name = value
-        """))
+        """
+            )
+        )
 
         from _pytest.config import Config
-        inifile = '../../foo/bar.ini'
-        option_dict = {
-            'inifilename': inifile,
-            'capture': 'no',
-        }
+
+        inifile = "../../foo/bar.ini"
+        option_dict = {"inifilename": inifile, "capture": "no"}
 
-        cwd = tmpdir.join('a/b')
-        cwd.join('pytest.ini').ensure().write(_pytest._code.Source("""
+        cwd = tmpdir.join("a/b")
+        cwd.join("pytest.ini").ensure().write(
+            _pytest._code.Source(
+                """
             [pytest]
             name = wrong-value
             should_not_be_set = true
-        """))
+        """
+            )
+        )
         with cwd.ensure(dir=True).as_cwd():
             config = Config.fromdictargs(option_dict, ())
 
         assert config.args == [str(cwd)]
         assert config.option.inifilename == inifile
-        assert config.option.capture == 'no'
+        assert config.option.capture == "no"
 
         # this indicates this is the file used for getting configuration values
         assert config.inifile == inifile
-        assert config.inicfg.get('name') == 'value'
-        assert config.inicfg.get('should_not_be_set') is None
+        assert config.inicfg.get("name") == "value"
+        assert config.inicfg.get("should_not_be_set") is None
 
 
 def test_options_on_small_file_do_not_blow_up(testdir):
+
     def runfiletest(opts):
         reprec = testdir.inline_run(*opts)
         passed, skipped, failed = reprec.countoutcomes()
         assert failed == 2
         assert skipped == passed == 0
-    path = testdir.makepyfile("""
+
+    path = testdir.makepyfile(
+        """
         def test_f1(): assert 0
         def test_f2(): assert 0
-    """)
+    """
+    )
 
-    for opts in ([], ['-l'], ['-s'], ['--tb=no'], ['--tb=short'],
-                 ['--tb=long'], ['--fulltrace'],
-                 ['--traceconfig'], ['-v'], ['-v', '-v']):
+    for opts in (
+        [],
+        ["-l"],
+        ["-s"],
+        ["--tb=no"],
+        ["--tb=short"],
+        ["--tb=long"],
+        ["--fulltrace"],
+        ["--traceconfig"],
+        ["-v"],
+        ["-v", "-v"],
+    ):
         runfiletest(opts + [path])
 
 
 def test_preparse_ordering_with_setuptools(testdir, monkeypatch):
     pkg_resources = pytest.importorskip("pkg_resources")
 
     def my_iter(name):
         assert name == "pytest11"
 
         class Dist(object):
-            project_name = 'spam'
-            version = '1.0'
+            project_name = "spam"
+            version = "1.0"
 
             def _get_metadata(self, name):
-                return ['foo.txt,sha256=abc,123']
+                return ["foo.txt,sha256=abc,123"]
 
         class EntryPoint(object):
             name = "mytestplugin"
             dist = Dist()
 
             def load(self):
+
                 class PseudoPlugin(object):
                     x = 42
+
                 return PseudoPlugin()
 
         return iter([EntryPoint()])
 
-    monkeypatch.setattr(pkg_resources, 'iter_entry_points', my_iter)
-    testdir.makeconftest("""
+    monkeypatch.setattr(pkg_resources, "iter_entry_points", my_iter)
+    testdir.makeconftest(
+        """
         pytest_plugins = "mytestplugin",
-    """)
+    """
+    )
     monkeypatch.setenv("PYTEST_PLUGINS", "mytestplugin")
     config = testdir.parseconfig()
     plugin = config.pluginmanager.getplugin("mytestplugin")
     assert plugin.x == 42
 
 
 def test_setuptools_importerror_issue1479(testdir, monkeypatch):
     pkg_resources = pytest.importorskip("pkg_resources")
 
     def my_iter(name):
         assert name == "pytest11"
 
         class Dist(object):
-            project_name = 'spam'
-            version = '1.0'
+            project_name = "spam"
+            version = "1.0"
 
             def _get_metadata(self, name):
-                return ['foo.txt,sha256=abc,123']
+                return ["foo.txt,sha256=abc,123"]
 
         class EntryPoint(object):
             name = "mytestplugin"
             dist = Dist()
 
             def load(self):
                 raise ImportError("Don't hide me!")
 
         return iter([EntryPoint()])
 
-    monkeypatch.setattr(pkg_resources, 'iter_entry_points', my_iter)
+    monkeypatch.setattr(pkg_resources, "iter_entry_points", my_iter)
     with pytest.raises(ImportError):
         testdir.parseconfig()
 
 
-def test_plugin_preparse_prevents_setuptools_loading(testdir, monkeypatch):
+@pytest.mark.parametrize("block_it", [True, False])
+def test_plugin_preparse_prevents_setuptools_loading(testdir, monkeypatch, block_it):
     pkg_resources = pytest.importorskip("pkg_resources")
 
+    plugin_module_placeholder = object()
+
     def my_iter(name):
         assert name == "pytest11"
 
         class Dist(object):
-            project_name = 'spam'
-            version = '1.0'
+            project_name = "spam"
+            version = "1.0"
 
             def _get_metadata(self, name):
-                return ['foo.txt,sha256=abc,123']
+                return ["foo.txt,sha256=abc,123"]
 
         class EntryPoint(object):
             name = "mytestplugin"
             dist = Dist()
 
             def load(self):
-                assert 0, "should not arrive here"
+                return plugin_module_placeholder
 
         return iter([EntryPoint()])
 
-    monkeypatch.setattr(pkg_resources, 'iter_entry_points', my_iter)
-    config = testdir.parseconfig("-p", "no:mytestplugin")
-    plugin = config.pluginmanager.getplugin("mytestplugin")
-    assert plugin is None
+    monkeypatch.setattr(pkg_resources, "iter_entry_points", my_iter)
+    args = ("-p", "no:mytestplugin") if block_it else ()
+    config = testdir.parseconfig(*args)
+    config.pluginmanager.import_plugin("mytestplugin")
+    if block_it:
+        assert "mytestplugin" not in sys.modules
+        assert config.pluginmanager.get_plugin("mytestplugin") is None
+    else:
+        assert config.pluginmanager.get_plugin(
+            "mytestplugin"
+        ) is plugin_module_placeholder
 
 
 def test_cmdline_processargs_simple(testdir):
-    testdir.makeconftest("""
+    testdir.makeconftest(
+        """
         def pytest_cmdline_preparse(args):
             args.append("-h")
-    """)
+    """
+    )
     result = testdir.runpytest()
-    result.stdout.fnmatch_lines([
-        "*pytest*",
-        "*-h*",
-    ])
+    result.stdout.fnmatch_lines(["*pytest*", "*-h*"])
 
 
 def test_invalid_options_show_extra_information(testdir):
     """display extra information when pytest exits due to unrecognized
     options in the command-line"""
-    testdir.makeini("""
+    testdir.makeini(
+        """
         [pytest]
         addopts = --invalid-option
-    """)
+    """
+    )
     result = testdir.runpytest()
-    result.stderr.fnmatch_lines([
-        "*error: unrecognized arguments: --invalid-option*",
-        "*  inifile: %s*" % testdir.tmpdir.join('tox.ini'),
-        "*  rootdir: %s*" % testdir.tmpdir,
-    ])
+    result.stderr.fnmatch_lines(
+        [
+            "*error: unrecognized arguments: --invalid-option*",
+            "*  inifile: %s*" % testdir.tmpdir.join("tox.ini"),
+            "*  rootdir: %s*" % testdir.tmpdir,
+        ]
+    )
 
 
-@pytest.mark.parametrize('args', [
-    ['dir1', 'dir2', '-v'],
-    ['dir1', '-v', 'dir2'],
-    ['dir2', '-v', 'dir1'],
-    ['-v', 'dir2', 'dir1'],
-])
+@pytest.mark.parametrize(
+    "args",
+    [
+        ["dir1", "dir2", "-v"],
+        ["dir1", "-v", "dir2"],
+        ["dir2", "-v", "dir1"],
+        ["-v", "dir2", "dir1"],
+    ],
+)
 def test_consider_args_after_options_for_rootdir_and_inifile(testdir, args):
     """
     Consider all arguments in the command-line for rootdir and inifile
     discovery, even if they happen to occur after an option. #949
     """
     # replace "dir1" and "dir2" from "args" into their real directory
-    root = testdir.tmpdir.mkdir('myroot')
-    d1 = root.mkdir('dir1')
-    d2 = root.mkdir('dir2')
+    root = testdir.tmpdir.mkdir("myroot")
+    d1 = root.mkdir("dir1")
+    d2 = root.mkdir("dir2")
     for i, arg in enumerate(args):
-        if arg == 'dir1':
+        if arg == "dir1":
             args[i] = d1
-        elif arg == 'dir2':
+        elif arg == "dir2":
             args[i] = d2
     with root.as_cwd():
         result = testdir.runpytest(*args)
-    result.stdout.fnmatch_lines(['*rootdir: *myroot, inifile:'])
+    result.stdout.fnmatch_lines(["*rootdir: *myroot, inifile:"])
 
 
 @pytest.mark.skipif("sys.platform == 'win32'")
 def test_toolongargs_issue224(testdir):
     result = testdir.runpytest("-m", "hello" * 500)
     assert result.ret == EXIT_NOTESTSCOLLECTED
 
 
 def test_config_in_subdirectory_colon_command_line_issue2148(testdir):
-    conftest_source = '''
+    conftest_source = """
         def pytest_addoption(parser):
             parser.addini('foo', 'foo')
-    '''
+    """
 
-    testdir.makefile('.ini', **{
-        'pytest': '[pytest]\nfoo = root',
-        'subdir/pytest': '[pytest]\nfoo = subdir',
-    })
+    testdir.makefile(
+        ".ini",
+        **{"pytest": "[pytest]\nfoo = root", "subdir/pytest": "[pytest]\nfoo = subdir"}
+    )
 
-    testdir.makepyfile(**{
-        'conftest': conftest_source,
-        'subdir/conftest': conftest_source,
-        'subdir/test_foo': '''
+    testdir.makepyfile(
+        **{
+            "conftest": conftest_source,
+            "subdir/conftest": conftest_source,
+            "subdir/test_foo": """
             def test_foo(pytestconfig):
                 assert pytestconfig.getini('foo') == 'subdir'
-        '''})
+        """,
+        }
+    )
 
-    result = testdir.runpytest('subdir/test_foo.py::test_foo')
+    result = testdir.runpytest("subdir/test_foo.py::test_foo")
     assert result.ret == 0
 
 
 def test_notify_exception(testdir, capfd):
     config = testdir.parseconfig()
     excinfo = pytest.raises(ValueError, "raise ValueError(1)")
     config.notify_exception(excinfo)
     out, err = capfd.readouterr()
     assert "ValueError" in err
 
     class A(object):
+
         def pytest_internalerror(self, excrepr):
             return True
 
     config.pluginmanager.register(A())
     config.notify_exception(excinfo)
     out, err = capfd.readouterr()
     assert not err
 
 
 def test_load_initial_conftest_last_ordering(testdir):
     from _pytest.config import get_config
+
     pm = get_config().pluginmanager
 
     class My(object):
+
         def pytest_load_initial_conftests(self):
             pass
 
     m = My()
     pm.register(m)
     hc = pm.hook.pytest_load_initial_conftests
     values = hc._nonwrappers + hc._wrappers
-    expected = [
-        "_pytest.config",
-        'test_config',
-        '_pytest.capture',
-    ]
+    expected = ["_pytest.config", "test_config", "_pytest.capture"]
     assert [x.function.__module__ for x in values] == expected
 
 
 def test_get_plugin_specs_as_list():
     from _pytest.config import _get_plugin_specs_as_list
+
     with pytest.raises(pytest.UsageError):
-        _get_plugin_specs_as_list(set(['foo']))
+        _get_plugin_specs_as_list({"foo"})
     with pytest.raises(pytest.UsageError):
         _get_plugin_specs_as_list(dict())
 
     assert _get_plugin_specs_as_list(None) == []
-    assert _get_plugin_specs_as_list('') == []
-    assert _get_plugin_specs_as_list('foo') == ['foo']
-    assert _get_plugin_specs_as_list('foo,bar') == ['foo', 'bar']
-    assert _get_plugin_specs_as_list(['foo', 'bar']) == ['foo', 'bar']
-    assert _get_plugin_specs_as_list(('foo', 'bar')) == ['foo', 'bar']
+    assert _get_plugin_specs_as_list("") == []
+    assert _get_plugin_specs_as_list("foo") == ["foo"]
+    assert _get_plugin_specs_as_list("foo,bar") == ["foo", "bar"]
+    assert _get_plugin_specs_as_list(["foo", "bar"]) == ["foo", "bar"]
+    assert _get_plugin_specs_as_list(("foo", "bar")) == ["foo", "bar"]
 
 
 class TestWarning(object):
+
     def test_warn_config(self, testdir):
-        testdir.makeconftest("""
+        testdir.makeconftest(
+            """
             values = []
             def pytest_configure(config):
                 config.warn("C1", "hello")
             def pytest_logwarning(code, message):
                 if message == "hello" and code == "C1":
                     values.append(1)
-        """)
-        testdir.makepyfile("""
+        """
+        )
+        testdir.makepyfile(
+            """
             def test_proper(pytestconfig):
                 import conftest
                 assert conftest.values == [1]
-        """)
+        """
+        )
         reprec = testdir.inline_run()
         reprec.assertoutcome(passed=1)
 
     def test_warn_on_test_item_from_request(self, testdir, request):
-        testdir.makepyfile("""
+        testdir.makepyfile(
+            """
             import pytest
 
             @pytest.fixture
             def fix(request):
                 request.node.warn("T1", "hello")
 
             def test_hello(fix):
                 pass
-        """)
+        """
+        )
         result = testdir.runpytest("--disable-pytest-warnings")
         assert result.parseoutcomes()["warnings"] > 0
         assert "hello" not in result.stdout.str()
 
         result = testdir.runpytest()
-        result.stdout.fnmatch_lines("""
+        result.stdout.fnmatch_lines(
+            """
             ===*warnings summary*===
             *test_warn_on_test_item_from_request.py::test_hello*
             *hello*
-        """)
+        """
+        )
 
 
 class TestRootdir(object):
+
     def test_simple_noini(self, tmpdir):
         assert get_common_ancestor([tmpdir]) == tmpdir
         a = tmpdir.mkdir("a")
         assert get_common_ancestor([a, tmpdir]) == tmpdir
         assert get_common_ancestor([tmpdir, a]) == tmpdir
         with tmpdir.as_cwd():
             assert get_common_ancestor([]) == tmpdir
-            no_path = tmpdir.join('does-not-exist')
+            no_path = tmpdir.join("does-not-exist")
             assert get_common_ancestor([no_path]) == tmpdir
-            assert get_common_ancestor([no_path.join('a')]) == tmpdir
+            assert get_common_ancestor([no_path.join("a")]) == tmpdir
 
     @pytest.mark.parametrize("name", "setup.cfg tox.ini pytest.ini".split())
     def test_with_ini(self, tmpdir, name):
         inifile = tmpdir.join(name)
         inifile.write("[pytest]\n")
 
         a = tmpdir.mkdir("a")
         b = a.mkdir("b")
@@ -715,106 +858,146 @@ class TestRootdir(object):
 
     def test_with_specific_inifile(self, tmpdir):
         inifile = tmpdir.ensure("pytest.ini")
         rootdir, inifile, inicfg = determine_setup(inifile, [tmpdir])
         assert rootdir == tmpdir
 
 
 class TestOverrideIniArgs(object):
+
     @pytest.mark.parametrize("name", "setup.cfg tox.ini pytest.ini".split())
     def test_override_ini_names(self, testdir, name):
-        testdir.tmpdir.join(name).write(py.std.textwrap.dedent("""
+        testdir.tmpdir.join(name).write(
+            textwrap.dedent(
+                """
             [pytest]
-            custom = 1.0"""))
-        testdir.makeconftest("""
+            custom = 1.0"""
+            )
+        )
+        testdir.makeconftest(
+            """
             def pytest_addoption(parser):
-                parser.addini("custom", "")""")
-        testdir.makepyfile("""
+                parser.addini("custom", "")"""
+        )
+        testdir.makepyfile(
+            """
             def test_pass(pytestconfig):
                 ini_val = pytestconfig.getini("custom")
-                print('\\ncustom_option:%s\\n' % ini_val)""")
+                print('\\ncustom_option:%s\\n' % ini_val)"""
+        )
 
         result = testdir.runpytest("--override-ini", "custom=2.0", "-s")
         assert result.ret == 0
         result.stdout.fnmatch_lines(["custom_option:2.0"])
 
-        result = testdir.runpytest("--override-ini", "custom=2.0",
-                                   "--override-ini=custom=3.0", "-s")
+        result = testdir.runpytest(
+            "--override-ini", "custom=2.0", "--override-ini=custom=3.0", "-s"
+        )
         assert result.ret == 0
         result.stdout.fnmatch_lines(["custom_option:3.0"])
 
     def test_override_ini_pathlist(self, testdir):
-        testdir.makeconftest("""
+        testdir.makeconftest(
+            """
             def pytest_addoption(parser):
-                parser.addini("paths", "my new ini value", type="pathlist")""")
-        testdir.makeini("""
+                parser.addini("paths", "my new ini value", type="pathlist")"""
+        )
+        testdir.makeini(
+            """
             [pytest]
-            paths=blah.py""")
-        testdir.makepyfile("""
+            paths=blah.py"""
+        )
+        testdir.makepyfile(
+            """
             import py.path
             def test_pathlist(pytestconfig):
                 config_paths = pytestconfig.getini("paths")
                 print(config_paths)
                 for cpf in config_paths:
-                    print('\\nuser_path:%s' % cpf.basename)""")
-        result = testdir.runpytest("--override-ini",
-                                   'paths=foo/bar1.py foo/bar2.py', "-s")
-        result.stdout.fnmatch_lines(["user_path:bar1.py",
-                                     "user_path:bar2.py"])
+                    print('\\nuser_path:%s' % cpf.basename)"""
+        )
+        result = testdir.runpytest(
+            "--override-ini", "paths=foo/bar1.py foo/bar2.py", "-s"
+        )
+        result.stdout.fnmatch_lines(["user_path:bar1.py", "user_path:bar2.py"])
 
     def test_override_multiple_and_default(self, testdir):
-        testdir.makeconftest("""
+        testdir.makeconftest(
+            """
             def pytest_addoption(parser):
                 addini = parser.addini
                 addini("custom_option_1", "", default="o1")
                 addini("custom_option_2", "", default="o2")
                 addini("custom_option_3", "", default=False, type="bool")
-                addini("custom_option_4", "", default=True, type="bool")""")
-        testdir.makeini("""
+                addini("custom_option_4", "", default=True, type="bool")"""
+        )
+        testdir.makeini(
+            """
             [pytest]
             custom_option_1=custom_option_1
-            custom_option_2=custom_option_2""")
-        testdir.makepyfile("""
+            custom_option_2=custom_option_2
+        """
+        )
+        testdir.makepyfile(
+            """
             def test_multiple_options(pytestconfig):
                 prefix = "custom_option"
                 for x in range(1, 5):
                     ini_value=pytestconfig.getini("%s_%d" % (prefix, x))
-                    print('\\nini%d:%s' % (x, ini_value))""")
+                    print('\\nini%d:%s' % (x, ini_value))
+        """
+        )
         result = testdir.runpytest(
-            "--override-ini", 'custom_option_1=fulldir=/tmp/user1',
-            'custom_option_2=url=/tmp/user2?a=b&d=e',
-            "-o", 'custom_option_3=True',
-            "-o", 'custom_option_4=no', "-s")
-        result.stdout.fnmatch_lines(["ini1:fulldir=/tmp/user1",
-                                     "ini2:url=/tmp/user2?a=b&d=e",
-                                     "ini3:True",
-                                     "ini4:False"])
+            "--override-ini",
+            "custom_option_1=fulldir=/tmp/user1",
+            "-o",
+            "custom_option_2=url=/tmp/user2?a=b&d=e",
+            "-o",
+            "custom_option_3=True",
+            "-o",
+            "custom_option_4=no",
+            "-s",
+        )
+        result.stdout.fnmatch_lines(
+            [
+                "ini1:fulldir=/tmp/user1",
+                "ini2:url=/tmp/user2?a=b&d=e",
+                "ini3:True",
+                "ini4:False",
+            ]
+        )
 
     def test_override_ini_usage_error_bad_style(self, testdir):
-        testdir.makeini("""
+        testdir.makeini(
+            """
             [pytest]
             xdist_strict=False
-        """)
-        result = testdir.runpytest("--override-ini", 'xdist_strict True', "-s")
+        """
+        )
+        result = testdir.runpytest("--override-ini", "xdist_strict True", "-s")
         result.stderr.fnmatch_lines(["*ERROR* *expects option=value*"])
 
-    @pytest.mark.parametrize('with_ini', [True, False])
+    @pytest.mark.parametrize("with_ini", [True, False])
     def test_override_ini_handled_asap(self, testdir, with_ini):
         """-o should be handled as soon as possible and always override what's in ini files (#2238)"""
         if with_ini:
-            testdir.makeini("""
+            testdir.makeini(
+                """
                 [pytest]
                 python_files=test_*.py
-            """)
-        testdir.makepyfile(unittest_ini_handle="""
+            """
+            )
+        testdir.makepyfile(
+            unittest_ini_handle="""
             def test():
                 pass
-        """)
-        result = testdir.runpytest("--override-ini", 'python_files=unittest_*.py')
+        """
+        )
+        result = testdir.runpytest("--override-ini", "python_files=unittest_*.py")
         result.stdout.fnmatch_lines(["*1 passed in*"])
 
     def test_with_arg_outside_cwd_without_inifile(self, tmpdir, monkeypatch):
         monkeypatch.chdir(str(tmpdir))
         a = tmpdir.mkdir("a")
         b = tmpdir.mkdir("b")
         rootdir, inifile, inicfg = determine_setup(None, [a, b])
         assert rootdir == tmpdir
@@ -823,23 +1006,63 @@ class TestOverrideIniArgs(object):
     def test_with_arg_outside_cwd_with_inifile(self, tmpdir):
         a = tmpdir.mkdir("a")
         b = tmpdir.mkdir("b")
         inifile = a.ensure("pytest.ini")
         rootdir, parsed_inifile, inicfg = determine_setup(None, [a, b])
         assert rootdir == a
         assert inifile == parsed_inifile
 
-    @pytest.mark.parametrize('dirs', ([], ['does-not-exist'],
-                                      ['a/does-not-exist']))
+    @pytest.mark.parametrize("dirs", ([], ["does-not-exist"], ["a/does-not-exist"]))
     def test_with_non_dir_arg(self, dirs, tmpdir):
         with tmpdir.ensure(dir=True).as_cwd():
             rootdir, inifile, inicfg = determine_setup(None, dirs)
             assert rootdir == tmpdir
             assert inifile is None
 
     def test_with_existing_file_in_subdir(self, tmpdir):
         a = tmpdir.mkdir("a")
         a.ensure("exist")
         with tmpdir.as_cwd():
-            rootdir, inifile, inicfg = determine_setup(None, ['a/exist'])
+            rootdir, inifile, inicfg = determine_setup(None, ["a/exist"])
             assert rootdir == tmpdir
             assert inifile is None
+
+    def test_addopts_before_initini(self, monkeypatch):
+        cache_dir = ".custom_cache"
+        monkeypatch.setenv("PYTEST_ADDOPTS", "-o cache_dir=%s" % cache_dir)
+        from _pytest.config import get_config
+
+        config = get_config()
+        config._preparse([], addopts=True)
+        assert config._override_ini == ["cache_dir=%s" % cache_dir]
+
+    def test_override_ini_does_not_contain_paths(self):
+        """Check that -o no longer swallows all options after it (#3103)"""
+        from _pytest.config import get_config
+
+        config = get_config()
+        config._preparse(["-o", "cache_dir=/cache", "/some/test/path"])
+        assert config._override_ini == ["cache_dir=/cache"]
+
+    def test_multiple_override_ini_options(self, testdir, request):
+        """Ensure a file path following a '-o' option does not generate an error (#3103)"""
+        testdir.makepyfile(
+            **{
+                "conftest.py": """
+                def pytest_addoption(parser):
+                    parser.addini('foo', default=None, help='some option')
+                    parser.addini('bar', default=None, help='some option')
+            """,
+                "test_foo.py": """
+                def test(pytestconfig):
+                    assert pytestconfig.getini('foo') == '1'
+                    assert pytestconfig.getini('bar') == '0'
+            """,
+                "test_bar.py": """
+                def test():
+                    assert False
+            """,
+            }
+        )
+        result = testdir.runpytest("-o", "foo=1", "-o", "bar=0", "test_foo.py")
+        assert "ERROR:" not in result.stderr.str()
+        result.stdout.fnmatch_lines(["collected 1 item", "*= 1 passed in *="])
--- a/third_party/python/pytest/testing/test_conftest.py
+++ b/third_party/python/pytest/testing/test_conftest.py
@@ -6,61 +6,66 @@ import py
 import pytest
 from _pytest.config import PytestPluginManager
 from _pytest.main import EXIT_NOTESTSCOLLECTED, EXIT_USAGEERROR
 
 
 @pytest.fixture(scope="module", params=["global", "inpackage"])
 def basedir(request, tmpdir_factory):
     from _pytest.tmpdir import tmpdir
+
     tmpdir = tmpdir(request, tmpdir_factory)
     tmpdir.ensure("adir/conftest.py").write("a=1 ; Directory = 3")
     tmpdir.ensure("adir/b/conftest.py").write("b=2 ; a = 1.5")
     if request.param == "inpackage":
         tmpdir.ensure("adir/__init__.py")
         tmpdir.ensure("adir/b/__init__.py")
     return tmpdir
 
 
 def ConftestWithSetinitial(path):
     conftest = PytestPluginManager()
     conftest_setinitial(conftest, [path])
     return conftest
 
 
 def conftest_setinitial(conftest, args, confcutdir=None):
+
     class Namespace(object):
+
         def __init__(self):
             self.file_or_dir = args
             self.confcutdir = str(confcutdir)
             self.noconftest = False
+
     conftest._set_initial_conftests(Namespace())
 
 
 class TestConftestValueAccessGlobal(object):
+
     def test_basic_init(self, basedir):
         conftest = PytestPluginManager()
         p = basedir.join("adir")
         assert conftest._rget_with_confmod("a", p)[1] == 1
 
     def test_immediate_initialiation_and_incremental_are_the_same(self, basedir):
         conftest = PytestPluginManager()
         len(conftest._path2confmods)
         conftest._getconftestmodules(basedir)
         snap1 = len(conftest._path2confmods)
         # assert len(conftest._path2confmods) == snap1 + 1
-        conftest._getconftestmodules(basedir.join('adir'))
+        conftest._getconftestmodules(basedir.join("adir"))
         assert len(conftest._path2confmods) == snap1 + 1
-        conftest._getconftestmodules(basedir.join('b'))
+        conftest._getconftestmodules(basedir.join("b"))
         assert len(conftest._path2confmods) == snap1 + 2
 
     def test_value_access_not_existing(self, basedir):
         conftest = ConftestWithSetinitial(basedir)
         with pytest.raises(KeyError):
-            conftest._rget_with_confmod('a', basedir)
+            conftest._rget_with_confmod("a", basedir)
 
     def test_value_access_by_path(self, basedir):
         conftest = ConftestWithSetinitial(basedir)
         adir = basedir.join("adir")
         assert conftest._rget_with_confmod("a", adir)[1] == 1
         assert conftest._rget_with_confmod("a", adir.join("b"))[1] == 1.5
 
     def test_value_access_with_confmod(self, basedir):
@@ -79,17 +84,17 @@ def test_conftest_in_nonpkg_with_init(tm
     tmpdir.ensure("adir-1.0/b/conftest.py").write("b=2 ; a = 1.5")
     tmpdir.ensure("adir-1.0/b/__init__.py")
     tmpdir.ensure("adir-1.0/__init__.py")
     ConftestWithSetinitial(tmpdir.join("adir-1.0", "b"))
 
 
 def test_doubledash_considered(testdir):
     conf = testdir.mkdir("--option")
-    conf.join("conftest.py").ensure()
+    conf.ensure("conftest.py")
     conftest = PytestPluginManager()
     conftest_setinitial(conftest, [conf.basename, conf.basename])
     values = conftest._getconftestmodules(conf)
     assert len(values) == 1
 
 
 def test_issue151_load_all_conftests(testdir):
     names = "code proj src".split()
@@ -100,32 +105,34 @@ def test_issue151_load_all_conftests(tes
     conftest = PytestPluginManager()
     conftest_setinitial(conftest, names)
     d = list(conftest._conftestpath2mod.values())
     assert len(d) == len(names)
 
 
 def test_conftest_global_import(testdir):
     testdir.makeconftest("x=3")
-    p = testdir.makepyfile("""
+    p = testdir.makepyfile(
+        """
         import py, pytest
         from _pytest.config import PytestPluginManager
         conf = PytestPluginManager()
         mod = conf._importconftest(py.path.local("conftest.py"))
         assert mod.x == 3
         import conftest
         assert conftest is mod, (conftest, mod)
         subconf = py.path.local().ensure("sub", "conftest.py")
         subconf.write("y=4")
         mod2 = conf._importconftest(subconf)
         assert mod != mod2
         assert mod2.y == 4
         import conftest
         assert conftest is mod2, (conftest, mod)
-    """)
+    """
+    )
     res = testdir.runpython(p)
     assert res.ret == 0
 
 
 def test_conftestcutdir(testdir):
     conf = testdir.makeconftest("")
     p = testdir.mkdir("x")
     conftest = PytestPluginManager()
@@ -149,330 +156,388 @@ def test_conftestcutdir_inplace_consider
     conf = testdir.makeconftest("")
     conftest = PytestPluginManager()
     conftest_setinitial(conftest, [conf.dirpath()], confcutdir=conf.dirpath())
     values = conftest._getconftestmodules(conf.dirpath())
     assert len(values) == 1
     assert values[0].__file__.startswith(str(conf))
 
 
-@pytest.mark.parametrize("name", 'test tests whatever .dotdir'.split())
+@pytest.mark.parametrize("name", "test tests whatever .dotdir".split())
 def test_setinitial_conftest_subdirs(testdir, name):
     sub = testdir.mkdir(name)
     subconftest = sub.ensure("conftest.py")
     conftest = PytestPluginManager()
     conftest_setinitial(conftest, [sub.dirpath()], confcutdir=testdir.tmpdir)
-    if name not in ('whatever', '.dotdir'):
+    if name not in ("whatever", ".dotdir"):
         assert subconftest in conftest._conftestpath2mod
         assert len(conftest._conftestpath2mod) == 1
     else:
         assert subconftest not in conftest._conftestpath2mod
         assert len(conftest._conftestpath2mod) == 0
 
 
 def test_conftest_confcutdir(testdir):
     testdir.makeconftest("assert 0")
     x = testdir.mkdir("x")
-    x.join("conftest.py").write(_pytest._code.Source("""
+    x.join("conftest.py").write(
+        _pytest._code.Source(
+            """
         def pytest_addoption(parser):
             parser.addoption("--xyz", action="store_true")
-    """))
+    """
+        )
+    )
     result = testdir.runpytest("-h", "--confcutdir=%s" % x, x)
     result.stdout.fnmatch_lines(["*--xyz*"])
-    assert 'warning: could not load initial' not in result.stdout.str()
+    assert "warning: could not load initial" not in result.stdout.str()
 
 
 def test_no_conftest(testdir):
     testdir.makeconftest("assert 0")
     result = testdir.runpytest("--noconftest")
     assert result.ret == EXIT_NOTESTSCOLLECTED
 
     result = testdir.runpytest()
     assert result.ret == EXIT_USAGEERROR
 
 
 def test_conftest_existing_resultlog(testdir):
     x = testdir.mkdir("tests")
-    x.join("conftest.py").write(_pytest._code.Source("""
+    x.join("conftest.py").write(
+        _pytest._code.Source(
+            """
         def pytest_addoption(parser):
             parser.addoption("--xyz", action="store_true")
-    """))
+    """
+        )
+    )
     testdir.makefile(ext=".log", result="")  # Writes result.log
     result = testdir.runpytest("-h", "--resultlog", "result.log")
     result.stdout.fnmatch_lines(["*--xyz*"])
 
 
 def test_conftest_existing_junitxml(testdir):
     x = testdir.mkdir("tests")
-    x.join("conftest.py").write(_pytest._code.Source("""
+    x.join("conftest.py").write(
+        _pytest._code.Source(
+            """
         def pytest_addoption(parser):
             parser.addoption("--xyz", action="store_true")
-    """))
+    """
+        )
+    )
     testdir.makefile(ext=".xml", junit="")  # Writes junit.xml
     result = testdir.runpytest("-h", "--junitxml", "junit.xml")
     result.stdout.fnmatch_lines(["*--xyz*"])
 
 
 def test_conftest_import_order(testdir, monkeypatch):
     ct1 = testdir.makeconftest("")
     sub = testdir.mkdir("sub")
     ct2 = sub.join("conftest.py")
     ct2.write("")
 
     def impct(p):
         return p
 
     conftest = PytestPluginManager()
     conftest._confcutdir = testdir.tmpdir
-    monkeypatch.setattr(conftest, '_importconftest', impct)
+    monkeypatch.setattr(conftest, "_importconftest", impct)
     assert conftest._getconftestmodules(sub) == [ct1, ct2]
 
 
 def test_fixture_dependency(testdir, monkeypatch):
     ct1 = testdir.makeconftest("")
     ct1 = testdir.makepyfile("__init__.py")
     ct1.write("")
     sub = testdir.mkdir("sub")
     sub.join("__init__.py").write("")
-    sub.join("conftest.py").write(py.std.textwrap.dedent("""
+    sub.join("conftest.py").write(
+        dedent(
+            """
         import pytest
 
         @pytest.fixture
         def not_needed():
             assert False, "Should not be called!"
 
         @pytest.fixture
         def foo():
             assert False, "Should not be called!"
 
         @pytest.fixture
         def bar(foo):
             return 'bar'
-    """))
+    """
+        )
+    )
     subsub = sub.mkdir("subsub")
     subsub.join("__init__.py").write("")
-    subsub.join("test_bar.py").write(py.std.textwrap.dedent("""
+    subsub.join("test_bar.py").write(
+        dedent(
+            """
         import pytest
 
         @pytest.fixture
         def bar():
             return 'sub bar'
 
         def test_event_fixture(bar):
             assert bar == 'sub bar'
-    """))
+    """
+        )
+    )
     result = testdir.runpytest("sub")
     result.stdout.fnmatch_lines(["*1 passed*"])
 
 
 def test_conftest_found_with_double_dash(testdir):
     sub = testdir.mkdir("sub")
-    sub.join("conftest.py").write(py.std.textwrap.dedent("""
+    sub.join("conftest.py").write(
+        dedent(
+            """
         def pytest_addoption(parser):
             parser.addoption("--hello-world", action="store_true")
-    """))
+    """
+        )
+    )
     p = sub.join("test_hello.py")
-    p.write(py.std.textwrap.dedent("""
-        import pytest
-        def test_hello(found):
-            assert found == 1
-    """))
+    p.write("def test_hello(): pass")
     result = testdir.runpytest(str(p) + "::test_hello", "-h")
-    result.stdout.fnmatch_lines("""
+    result.stdout.fnmatch_lines(
+        """
         *--hello-world*
-    """)
+    """
+    )
 
 
 class TestConftestVisibility(object):
+
     def _setup_tree(self, testdir):  # for issue616
         # example mostly taken from:
         # https://mail.python.org/pipermail/pytest-dev/2014-September/002617.html
         runner = testdir.mkdir("empty")
         package = testdir.mkdir("package")
 
-        package.join("conftest.py").write(dedent("""\
+        package.join("conftest.py").write(
+            dedent(
+                """\
             import pytest
             @pytest.fixture
             def fxtr():
                 return "from-package"
-        """))
-        package.join("test_pkgroot.py").write(dedent("""\
+        """
+            )
+        )
+        package.join("test_pkgroot.py").write(
+            dedent(
+                """\
             def test_pkgroot(fxtr):
                 assert fxtr == "from-package"
-        """))
+        """
+            )
+        )
 
         swc = package.mkdir("swc")
         swc.join("__init__.py").ensure()
-        swc.join("conftest.py").write(dedent("""\
+        swc.join("conftest.py").write(
+            dedent(
+                """\
             import pytest
             @pytest.fixture
             def fxtr():
                 return "from-swc"
-        """))
-        swc.join("test_with_conftest.py").write(dedent("""\
+        """
+            )
+        )
+        swc.join("test_with_conftest.py").write(
+            dedent(
+                """\
             def test_with_conftest(fxtr):
                 assert fxtr == "from-swc"
 
-        """))
+        """
+            )
+        )
 
         snc = package.mkdir("snc")
         snc.join("__init__.py").ensure()
-        snc.join("test_no_conftest.py").write(dedent("""\
+        snc.join("test_no_conftest.py").write(
+            dedent(
+                """\
             def test_no_conftest(fxtr):
                 assert fxtr == "from-package"   # No local conftest.py, so should
                                                 # use value from parent dir's
 
-        """))
+        """
+            )
+        )
         print("created directory structure:")
         for x in testdir.tmpdir.visit():
             print("   " + x.relto(testdir.tmpdir))
 
-        return {
-            "runner": runner,
-            "package": package,
-            "swc": swc,
-            "snc": snc}
+        return {"runner": runner, "package": package, "swc": swc, "snc": snc}
 
     # N.B.: "swc" stands for "subdir with conftest.py"
     #       "snc" stands for "subdir no [i.e. without] conftest.py"
-    @pytest.mark.parametrize("chdir,testarg,expect_ntests_passed", [
-        # Effective target: package/..
-        ("runner", "..", 3),
-        ("package", "..", 3),
-        ("swc", "../..", 3),
-        ("snc", "../..", 3),
-
-        # Effective target: package
-        ("runner", "../package", 3),
-        ("package", ".", 3),
-        ("swc", "..", 3),
-        ("snc", "..", 3),
-
-        # Effective target: package/swc
-        ("runner", "../package/swc", 1),
-        ("package", "./swc", 1),
-        ("swc", ".", 1),
-        ("snc", "../swc", 1),
-
-        # Effective target: package/snc
-        ("runner", "../package/snc", 1),
-        ("package", "./snc", 1),
-        ("swc", "../snc", 1),
-        ("snc", ".", 1),
-    ])
+    @pytest.mark.parametrize(
+        "chdir,testarg,expect_ntests_passed",
+        [
+            # Effective target: package/..
+            ("runner", "..", 3),
+            ("package", "..", 3),
+            ("swc", "../..", 3),
+            ("snc", "../..", 3),
+            # Effective target: package
+            ("runner", "../package", 3),
+            ("package", ".", 3),
+            ("swc", "..", 3),
+            ("snc", "..", 3),
+            # Effective target: package/swc
+            ("runner", "../package/swc", 1),
+            ("package", "./swc", 1),
+            ("swc", ".", 1),
+            ("snc", "../swc", 1),
+            # Effective target: package/snc
+            ("runner", "../package/snc", 1),
+            ("package", "./snc", 1),
+            ("swc", "../snc", 1),
+            ("snc", ".", 1),
+        ],
+    )
     @pytest.mark.issue616
     def test_parsefactories_relative_node_ids(
-            self, testdir, chdir, testarg, expect_ntests_passed):
+        self, testdir, chdir, testarg, expect_ntests_passed
+    ):
         dirs = self._setup_tree(testdir)
-        print("pytest run in cwd: %s" % (
-              dirs[chdir].relto(testdir.tmpdir)))
+        print("pytest run in cwd: %s" % (dirs[chdir].relto(testdir.tmpdir)))
         print("pytestarg        : %s" % (testarg))
         print("expected pass    : %s" % (expect_ntests_passed))
         with dirs[chdir].as_cwd():
             reprec = testdir.inline_run(testarg, "-q", "--traceconfig")
             reprec.assertoutcome(passed=expect_ntests_passed)
 
 
-@pytest.mark.parametrize('confcutdir,passed,error', [
-    ('.', 2, 0),
-    ('src', 1, 1),
-    (None, 1, 1),
-])
+@pytest.mark.parametrize(
+    "confcutdir,passed,error", [(".", 2, 0), ("src", 1, 1), (None, 1, 1)]
+)
 def test_search_conftest_up_to_inifile(testdir, confcutdir, passed, error):
-    """Test that conftest files are detected only up to a ini file, unless
+    """Test that conftest files are detected only up to an ini file, unless
     an explicit --confcutdir option is given.
     """
     root = testdir.tmpdir
-    src = root.join('src').ensure(dir=1)
-    src.join('pytest.ini').write('[pytest]')
-    src.join('conftest.py').write(_pytest._code.Source("""
+    src = root.join("src").ensure(dir=1)
+    src.join("pytest.ini").write("[pytest]")
+    src.join("conftest.py").write(
+        _pytest._code.Source(
+            """
         import pytest
         @pytest.fixture
         def fix1(): pass
-    """))
-    src.join('test_foo.py').write(_pytest._code.Source("""
+    """
+        )
+    )
+    src.join("test_foo.py").write(
+        _pytest._code.Source(
+            """
         def test_1(fix1):
             pass
         def test_2(out_of_reach):
             pass
-    """))
-    root.join('conftest.py').write(_pytest._code.Source("""
+    """
+        )
+    )
+    root.join("conftest.py").write(
+        _pytest._code.Source(
+            """
         import pytest
         @pytest.fixture
         def out_of_reach(): pass
-    """))
+    """
+        )
+    )
 
     args = [str(src)]
     if confcutdir:
-        args = ['--confcutdir=%s' % root.join(confcutdir)]
+        args = ["--confcutdir=%s" % root.join(confcutdir)]
     result = testdir.runpytest(*args)
-    match = ''
+    match = ""
     if passed:
-        match += '*%d passed*' % passed
+        match += "*%d passed*" % passed
     if error:
-        match += '*%d error*' % error
+        match += "*%d error*" % error
     result.stdout.fnmatch_lines(match)
 
 
 def test_issue1073_conftest_special_objects(testdir):
-    testdir.makeconftest("""
+    testdir.makeconftest(
+        """
         class DontTouchMe(object):
             def __getattr__(self, x):
                 raise Exception('cant touch me')
 
         x = DontTouchMe()
-    """)
-    testdir.makepyfile("""
+    """
+    )
+    testdir.makepyfile(
+        """
         def test_some():
             pass
-    """)
+    """
+    )
     res = testdir.runpytest()
     assert res.ret == 0
 
 
 def test_conftest_exception_handling(testdir):
-    testdir.makeconftest('''
+    testdir.makeconftest(
+        """
         raise ValueError()
-    ''')
-    testdir.makepyfile("""
+    """
+    )
+    testdir.makepyfile(
+        """
         def test_some():
             pass
-    """)
+    """
+    )
     res = testdir.runpytest()
     assert res.ret == 4
-    assert 'raise ValueError()' in [line.strip() for line in res.errlines]
+    assert "raise ValueError()" in [line.strip() for line in res.errlines]
 
 
 def test_hook_proxy(testdir):
     """Session's gethookproxy() would cache conftests incorrectly (#2016).
     It was decided to remove the cache altogether.
     """
-    testdir.makepyfile(**{
-        'root/demo-0/test_foo1.py': "def test1(): pass",
-
-        'root/demo-a/test_foo2.py': "def test1(): pass",
-        'root/demo-a/conftest.py': """
+    testdir.makepyfile(
+        **{
+            "root/demo-0/test_foo1.py": "def test1(): pass",
+            "root/demo-a/test_foo2.py": "def test1(): pass",
+            "root/demo-a/conftest.py": """
             def pytest_ignore_collect(path, config):
                 return True
             """,
-
-        'root/demo-b/test_foo3.py': "def test1(): pass",
-        'root/demo-c/test_foo4.py': "def test1(): pass",
-    })
+            "root/demo-b/test_foo3.py": "def test1(): pass",
+            "root/demo-c/test_foo4.py": "def test1(): pass",
+        }
+    )
     result = testdir.runpytest()
-    result.stdout.fnmatch_lines([
-        '*test_foo1.py*',
-        '*test_foo3.py*',
-        '*test_foo4.py*',
-        '*3 passed*',
-    ])
+    result.stdout.fnmatch_lines(
+        ["*test_foo1.py*", "*test_foo3.py*", "*test_foo4.py*", "*3 passed*"]
+    )
 
 
 def test_required_option_help(testdir):
     testdir.makeconftest("assert 0")
     x = testdir.mkdir("x")
-    x.join("conftest.py").write(_pytest._code.Source("""
+    x.join("conftest.py").write(
+        _pytest._code.Source(
+            """
         def pytest_addoption(parser):
             parser.addoption("--xyz", action="store_true", required=True)
-    """))
+    """
+        )
+    )
     result = testdir.runpytest("-h", x)
-    assert 'argument --xyz is required' not in result.stdout.str()
-    assert 'general:' in result.stdout.str()
+    assert "argument --xyz is required" not in result.stdout.str()
+    assert "general:" in result.stdout.str()
--- a/third_party/python/pytest/testing/test_doctest.py
+++ b/third_party/python/pytest/testing/test_doctest.py
@@ -6,183 +6,194 @@ from _pytest.compat import MODULE_NOT_FO
 from _pytest.doctest import DoctestItem, DoctestModule, DoctestTextfile
 import pytest
 
 
 class TestDoctests(object):
 
     def test_collect_testtextfile(self, testdir):
         w = testdir.maketxtfile(whatever="")
-        checkfile = testdir.maketxtfile(test_something="""
+        checkfile = testdir.maketxtfile(
+            test_something="""
             alskdjalsdk
             >>> i = 5
             >>> i-1
             4
-        """)
+        """
+        )
 
         for x in (testdir.tmpdir, checkfile):
             # print "checking that %s returns custom items" % (x,)
             items, reprec = testdir.inline_genitems(x)
             assert len(items) == 1
             assert isinstance(items[0], DoctestItem)
             assert isinstance(items[0].parent, DoctestTextfile)
         # Empty file has no items.
         items, reprec = testdir.inline_genitems(w)
         assert len(items) == 0
 
     def test_collect_module_empty(self, testdir):
         path = testdir.makepyfile(whatever="#")
         for p in (path, testdir.tmpdir):
-            items, reprec = testdir.inline_genitems(p,
-                                                    '--doctest-modules')
+            items, reprec = testdir.inline_genitems(p, "--doctest-modules")
             assert len(items) == 0
 
     def test_collect_module_single_modulelevel_doctest(self, testdir):
         path = testdir.makepyfile(whatever='""">>> pass"""')
         for p in (path, testdir.tmpdir):
-            items, reprec = testdir.inline_genitems(p,
-                                                    '--doctest-modules')
+            items, reprec = testdir.inline_genitems(p, "--doctest-modules")
             assert len(items) == 1
             assert isinstance(items[0], DoctestItem)
             assert isinstance(items[0].parent, DoctestModule)
 
     def test_collect_module_two_doctest_one_modulelevel(self, testdir):
-        path = testdir.makepyfile(whatever="""
+        path = testdir.makepyfile(
+            whatever="""
             '>>> x = None'
             def my_func():
                 ">>> magic = 42 "
-        """)
+        """
+        )
         for p in (path, testdir.tmpdir):
-            items, reprec = testdir.inline_genitems(p,
-                                                    '--doctest-modules')
+            items, reprec = testdir.inline_genitems(p, "--doctest-modules")
             assert len(items) == 2
             assert isinstance(items[0], DoctestItem)
             assert isinstance(items[1], DoctestItem)
             assert isinstance(items[0].parent, DoctestModule)
             assert items[0].parent is items[1].parent
 
     def test_collect_module_two_doctest_no_modulelevel(self, testdir):
-        path = testdir.makepyfile(whatever="""
+        path = testdir.makepyfile(
+            whatever="""
             '# Empty'
             def my_func():
                 ">>> magic = 42 "
             def unuseful():
                 '''
                 # This is a function
                 # >>> # it doesn't have any doctest
                 '''
             def another():
                 '''
                 # This is another function
                 >>> import os # this one does have a doctest
                 '''
-        """)
+        """
+        )
         for p in (path, testdir.tmpdir):
-            items, reprec = testdir.inline_genitems(p,
-                                                    '--doctest-modules')
+            items, reprec = testdir.inline_genitems(p, "--doctest-modules")
             assert len(items) == 2
             assert isinstance(items[0], DoctestItem)
             assert isinstance(items[1], DoctestItem)
             assert isinstance(items[0].parent, DoctestModule)
             assert items[0].parent is items[1].parent
 
     def test_simple_doctestfile(self, testdir):
-        p = testdir.maketxtfile(test_doc="""
+        p = testdir.maketxtfile(
+            test_doc="""
             >>> x = 1
             >>> x == 1
             False
-        """)
-        reprec = testdir.inline_run(p, )
+        """
+        )
+        reprec = testdir.inline_run(p)
         reprec.assertoutcome(failed=1)
 
     def test_new_pattern(self, testdir):
-        p = testdir.maketxtfile(xdoc="""
+        p = testdir.maketxtfile(
+            xdoc="""
             >>> x = 1
             >>> x == 1
             False
-        """)
+        """
+        )
         reprec = testdir.inline_run(p, "--doctest-glob=x*.txt")
         reprec.assertoutcome(failed=1)
 
     def test_multiple_patterns(self, testdir):
         """Test support for multiple --doctest-glob arguments (#1255).
         """
-        testdir.maketxtfile(xdoc="""
+        testdir.maketxtfile(
+            xdoc="""
             >>> 1
             1
-        """)
-        testdir.makefile('.foo', test="""
+        """
+        )
+        testdir.makefile(
+            ".foo",
+            test="""
             >>> 1
             1
-        """)
-        testdir.maketxtfile(test_normal="""
+        """,
+        )
+        testdir.maketxtfile(
+            test_normal="""
             >>> 1
             1
-        """)
-        expected = set(['xdoc.txt', 'test.foo', 'test_normal.txt'])
-        assert set(x.basename for x in testdir.tmpdir.listdir()) == expected
+        """
+        )
+        expected = {"xdoc.txt", "test.foo", "test_normal.txt"}
+        assert {x.basename for x in testdir.tmpdir.listdir()} == expected
         args = ["--doctest-glob=xdoc*.txt", "--doctest-glob=*.foo"]
         result = testdir.runpytest(*args)
-        result.stdout.fnmatch_lines([
-            '*test.foo *',
-            '*xdoc.txt *',
-            '*2 passed*',
-        ])
+        result.stdout.fnmatch_lines(["*test.foo *", "*xdoc.txt *", "*2 passed*"])
         result = testdir.runpytest()
-        result.stdout.fnmatch_lines([
-            '*test_normal.txt *',
-            '*1 passed*',
-        ])
+        result.stdout.fnmatch_lines(["*test_normal.txt *", "*1 passed*"])
 
     @pytest.mark.parametrize(
-        '   test_string,    encoding',
-        [
-            (u'foo', 'ascii'),
-            (u'öäü', 'latin1'),
-            (u'öäü', 'utf-8')
-        ]
+        "   test_string,    encoding",
+        [(u"foo", "ascii"), (u"öäü", "latin1"), (u"öäü", "utf-8")],
     )
     def test_encoding(self, testdir, test_string, encoding):
         """Test support for doctest_encoding ini option.
         """
-        testdir.makeini("""
+        testdir.makeini(
+            """
             [pytest]
-            doctest_encoding={0}
-        """.format(encoding))
+            doctest_encoding={}
+        """.format(
+                encoding
+            )
+        )
         doctest = u"""
-            >>> u"{0}"
-            {1}
-        """.format(test_string, repr(test_string))
+            >>> u"{}"
+            {}
+        """.format(
+            test_string, repr(test_string)
+        )
         testdir._makefile(".txt", [doctest], {}, encoding=encoding)
 
         result = testdir.runpytest()
 
-        result.stdout.fnmatch_lines([
-            '*1 passed*',
-        ])
+        result.stdout.fnmatch_lines(["*1 passed*"])
 
     def test_doctest_unexpected_exception(self, testdir):
-        testdir.maketxtfile("""
+        testdir.maketxtfile(
+            """
             >>> i = 0
             >>> 0 / i
             2
-        """)
+        """
+        )
         result = testdir.runpytest("--doctest-modules")
-        result.stdout.fnmatch_lines([
-            "*unexpected_exception*",
-            "*>>> i = 0*",
-            "*>>> 0 / i*",
-            "*UNEXPECTED*ZeroDivision*",
-        ])
+        result.stdout.fnmatch_lines(
+            [
+                "*unexpected_exception*",
+                "*>>> i = 0*",
+                "*>>> 0 / i*",
+                "*UNEXPECTED*ZeroDivision*",
+            ]
+        )
 
     def test_docstring_partial_context_around_error(self, testdir):
         """Test that we show some context before the actual line of a failing
         doctest.
         """
-        testdir.makepyfile('''
+        testdir.makepyfile(
+            '''
             def foo():
                 """
                 text-line-1
                 text-line-2
                 text-line-3
                 text-line-4
                 text-line-5
                 text-line-6
@@ -191,199 +202,247 @@ class TestDoctests(object):
                 text-line-9
                 text-line-10
                 text-line-11
                 >>> 1 + 1
                 3
 
                 text-line-after
                 """
-        ''')
-        result = testdir.runpytest('--doctest-modules')
-        result.stdout.fnmatch_lines([
-            '*docstring_partial_context_around_error*',
-            '005*text-line-3',
-            '006*text-line-4',
-            '013*text-line-11',
-            '014*>>> 1 + 1',
-            'Expected:',
-            '    3',
-            'Got:',
-            '    2',
-        ])
+        '''
+        )
+        result = testdir.runpytest("--doctest-modules")
+        result.stdout.fnmatch_lines(
+            [
+                "*docstring_partial_context_around_error*",
+                "005*text-line-3",
+                "006*text-line-4",
+                "013*text-line-11",
+                "014*>>> 1 + 1",
+                "Expected:",
+                "    3",
+                "Got:",
+                "    2",
+            ]
+        )
         # lines below should be trimmed out
-        assert 'text-line-2' not in result.stdout.str()
-        assert 'text-line-after' not in result.stdout.str()
+        assert "text-line-2" not in result.stdout.str()
+        assert "text-line-after" not in result.stdout.str()
 
     def test_docstring_full_context_around_error(self, testdir):
         """Test that we show the whole context before the actual line of a failing
         doctest, provided that the context is up to 10 lines long.
         """
-        testdir.makepyfile('''
+        testdir.makepyfile(
+            '''
             def foo():
                 """
                 text-line-1
                 text-line-2
 
                 >>> 1 + 1
                 3
                 """
-        ''')
-        result = testdir.runpytest('--doctest-modules')
-        result.stdout.fnmatch_lines([
-            '*docstring_full_context_around_error*',
-            '003*text-line-1',
-            '004*text-line-2',
-            '006*>>> 1 + 1',
-            'Expected:',
-            '    3',
-            'Got:',
-            '    2',
-        ])
+        '''
+        )
+        result = testdir.runpytest("--doctest-modules")
+        result.stdout.fnmatch_lines(
+            [
+                "*docstring_full_context_around_error*",
+                "003*text-line-1",
+                "004*text-line-2",
+                "006*>>> 1 + 1",
+                "Expected:",
+                "    3",
+                "Got:",
+                "    2",
+            ]
+        )
 
     def test_doctest_linedata_missing(self, testdir):
-        testdir.tmpdir.join('hello.py').write(_pytest._code.Source("""
+        testdir.tmpdir.join("hello.py").write(
+            _pytest._code.Source(
+                """
             class Fun(object):
                 @property
                 def test(self):
                     '''
                     >>> a = 1
                     >>> 1/0
                     '''
-            """))
+            """
+            )
+        )
         result = testdir.runpytest("--doctest-modules")
-        result.stdout.fnmatch_lines([
-            "*hello*",
-            "*EXAMPLE LOCATION UNKNOWN, not showing all tests of that example*",
-            "*1/0*",
-            "*UNEXPECTED*ZeroDivision*",
-            "*1 failed*",
-        ])
+        result.stdout.fnmatch_lines(
+            [
+                "*hello*",
+                "*EXAMPLE LOCATION UNKNOWN, not showing all tests of that example*",
+                "*1/0*",
+                "*UNEXPECTED*ZeroDivision*",
+                "*1 failed*",
+            ]
+        )
 
     def test_doctest_unex_importerror_only_txt(self, testdir):
-        testdir.maketxtfile("""
+        testdir.maketxtfile(
+            """
             >>> import asdalsdkjaslkdjasd
             >>>
-        """)
+        """
+        )
         result = testdir.runpytest()
         # doctest is never executed because of error during hello.py collection
-        result.stdout.fnmatch_lines([
-            "*>>> import asdals*",
-            "*UNEXPECTED*{e}*".format(e=MODULE_NOT_FOUND_ERROR),
-            "{e}: No module named *asdal*".format(e=MODULE_NOT_FOUND_ERROR),
-        ])
+        result.stdout.fnmatch_lines(
+            [
+                "*>>> import asdals*",
+                "*UNEXPECTED*{e}*".format(e=MODULE_NOT_FOUND_ERROR),
+                "{e}: No module named *asdal*".format(e=MODULE_NOT_FOUND_ERROR),
+            ]
+        )
 
     def test_doctest_unex_importerror_with_module(self, testdir):
-        testdir.tmpdir.join("hello.py").write(_pytest._code.Source("""
+        testdir.tmpdir.join("hello.py").write(
+            _pytest._code.Source(
+                """
             import asdalsdkjaslkdjasd
-        """))
-        testdir.maketxtfile("""
+        """
+            )
+        )
+        testdir.maketxtfile(
+            """
             >>> import hello
             >>>
-        """)
+        """
+        )
         result = testdir.runpytest("--doctest-modules")
         # doctest is never executed because of error during hello.py collection
-        result.stdout.fnmatch_lines([
-            "*ERROR collecting hello.py*",
-            "*{e}: No module named *asdals*".format(e=MODULE_NOT_FOUND_ERROR),
-            "*Interrupted: 1 errors during collection*",
-        ])
+        result.stdout.fnmatch_lines(
+            [
+                "*ERROR collecting hello.py*",
+                "*{e}: No module named *asdals*".format(e=MODULE_NOT_FOUND_ERROR),
+                "*Interrupted: 1 errors during collection*",
+            ]
+        )
 
     def test_doctestmodule(self, testdir):
-        p = testdir.makepyfile("""
+        p = testdir.makepyfile(
+            """
             '''
                 >>> x = 1
                 >>> x == 1
                 False
 
             '''
-        """)
+        """
+        )
         reprec = testdir.inline_run(p, "--doctest-modules")
         reprec.assertoutcome(failed=1)
 
     def test_doctestmodule_external_and_issue116(self, testdir):
         p = testdir.mkpydir("hello")
-        p.join("__init__.py").write(_pytest._code.Source("""
+        p.join("__init__.py").write(
+            _pytest._code.Source(
+                """
             def somefunc():
                 '''
                     >>> i = 0
                     >>> i + 1
                     2
                 '''
-        """))
+        """
+            )
+        )
         result = testdir.runpytest(p, "--doctest-modules")
-        result.stdout.fnmatch_lines([
-            '004 *>>> i = 0',
-            '005 *>>> i + 1',
-            '*Expected:',
-            "*    2",
-            "*Got:",
-            "*    1",
-            "*:5: DocTestFailure"
-        ])
+        result.stdout.fnmatch_lines(
+            [
+                "004 *>>> i = 0",
+                "005 *>>> i + 1",
+                "*Expected:",
+                "*    2",
+                "*Got:",
+                "*    1",
+                "*:5: DocTestFailure",
+            ]
+        )
 
     def test_txtfile_failing(self, testdir):
-        p = testdir.maketxtfile("""
+        p = testdir.maketxtfile(
+            """
             >>> i = 0
             >>> i + 1
             2
-        """)
+        """
+        )
         result = testdir.runpytest(p, "-s")
-        result.stdout.fnmatch_lines([
-            '001 >>> i = 0',
-            '002 >>> i + 1',
-            'Expected:',
-            "    2",
-            "Got:",
-            "    1",
-            "*test_txtfile_failing.txt:2: DocTestFailure"
-        ])
+        result.stdout.fnmatch_lines(
+            [
+                "001 >>> i = 0",
+                "002 >>> i + 1",
+                "Expected:",
+                "    2",
+                "Got:",
+                "    1",
+                "*test_txtfile_failing.txt:2: DocTestFailure",
+            ]
+        )
 
     def test_txtfile_with_fixtures(self, testdir):
-        p = testdir.maketxtfile("""
+        p = testdir.maketxtfile(
+            """
             >>> dir = getfixture('tmpdir')
             >>> type(dir).__name__
             'LocalPath'
-        """)
-        reprec = testdir.inline_run(p, )
+        """
+        )
+        reprec = testdir.inline_run(p)
         reprec.assertoutcome(passed=1)
 
     def test_txtfile_with_usefixtures_in_ini(self, testdir):
-        testdir.makeini("""
+        testdir.makeini(
+            """
             [pytest]
             usefixtures = myfixture
-        """)
-        testdir.makeconftest("""
+        """
+        )
+        testdir.makeconftest(
+            """
             import pytest
             @pytest.fixture
             def myfixture(monkeypatch):
                 monkeypatch.setenv("HELLO", "WORLD")
-        """)
+        """
+        )
 
-        p = testdir.maketxtfile("""
+        p = testdir.maketxtfile(
+            """
             >>> import os
             >>> os.environ["HELLO"]
             'WORLD'
-        """)
-        reprec = testdir.inline_run(p, )
+        """
+        )
+        reprec = testdir.inline_run(p)
         reprec.assertoutcome(passed=1)
 
     def test_doctestmodule_with_fixtures(self, testdir):
-        p = testdir.makepyfile("""
+        p = testdir.makepyfile(
+            """
             '''
                 >>> dir = getfixture('tmpdir')
                 >>> type(dir).__name__
                 'LocalPath'
             '''
-        """)
+        """
+        )
         reprec = testdir.inline_run(p, "--doctest-modules")
         reprec.assertoutcome(passed=1)
 
     def test_doctestmodule_three_tests(self, testdir):
-        p = testdir.makepyfile("""
+        p = testdir.makepyfile(
+            """
             '''
             >>> dir = getfixture('tmpdir')
             >>> type(dir).__name__
             'LocalPath'
             '''
             def my_func():
                 '''
                 >>> magic = 42
@@ -393,583 +452,755 @@ class TestDoctests(object):
             def unuseful():
                 pass
             def another():
                 '''
                 >>> import os
                 >>> os is os
                 True
                 '''
-        """)
+        """
+        )
         reprec = testdir.inline_run(p, "--doctest-modules")
         reprec.assertoutcome(passed=3)
 
     def test_doctestmodule_two_tests_one_fail(self, testdir):
-        p = testdir.makepyfile("""
+        p = testdir.makepyfile(
+            """
             class MyClass(object):
                 def bad_meth(self):
                     '''
                     >>> magic = 42
                     >>> magic
                     0
                     '''
                 def nice_meth(self):
                     '''
                     >>> magic = 42
                     >>> magic - 42
                     0
                     '''
-        """)
+        """
+        )
         reprec = testdir.inline_run(p, "--doctest-modules")
         reprec.assertoutcome(failed=1, passed=1)
 
     def test_ignored_whitespace(self, testdir):
-        testdir.makeini("""
+        testdir.makeini(
+            """
             [pytest]
             doctest_optionflags = ELLIPSIS NORMALIZE_WHITESPACE
-        """)
-        p = testdir.makepyfile("""
+        """
+        )
+        p = testdir.makepyfile(
+            """
             class MyClass(object):
                 '''
                 >>> a = "foo    "
                 >>> print(a)
                 foo
                 '''
                 pass
-        """)
+        """
+        )
         reprec = testdir.inline_run(p, "--doctest-modules")
         reprec.assertoutcome(passed=1)
 
     def test_non_ignored_whitespace(self, testdir):
-        testdir.makeini("""
+        testdir.makeini(
+            """
             [pytest]
             doctest_optionflags = ELLIPSIS
-        """)
-        p = testdir.makepyfile("""
+        """
+        )
+        p = testdir.makepyfile(
+            """
             class MyClass(object):
                 '''
                 >>> a = "foo    "
                 >>> print(a)
                 foo
                 '''
                 pass
-        """)
+        """
+        )
         reprec = testdir.inline_run(p, "--doctest-modules")
         reprec.assertoutcome(failed=1, passed=0)
 
     def test_ignored_whitespace_glob(self, testdir):
-        testdir.makeini("""
+        testdir.makeini(
+            """
             [pytest]
             doctest_optionflags = ELLIPSIS NORMALIZE_WHITESPACE
-        """)
-        p = testdir.maketxtfile(xdoc="""
+        """
+        )
+        p = testdir.maketxtfile(
+            xdoc="""
             >>> a = "foo    "
             >>> print(a)
             foo
-        """)
+        """
+        )
         reprec = testdir.inline_run(p, "--doctest-glob=x*.txt")
         reprec.assertoutcome(passed=1)
 
     def test_non_ignored_whitespace_glob(self, testdir):
-        testdir.makeini("""
+        testdir.makeini(
+            """
             [pytest]
             doctest_optionflags = ELLIPSIS
-        """)
-        p = testdir.maketxtfile(xdoc="""
+        """
+        )
+        p = testdir.maketxtfile(
+            xdoc="""
             >>> a = "foo    "
             >>> print(a)
             foo
-        """)
+        """
+        )
         reprec = testdir.inline_run(p, "--doctest-glob=x*.txt")
         reprec.assertoutcome(failed=1, passed=0)
 
     def test_contains_unicode(self, testdir):
         """Fix internal error with docstrings containing non-ascii characters.
         """
-        testdir.makepyfile(u'''
+        testdir.makepyfile(
+            u'''
             # encoding: utf-8
             def foo():
                 """
                 >>> name = 'с' # not letter 'c' but instead Cyrillic 's'.
                 'anything'
                 """
-        ''')
-        result = testdir.runpytest('--doctest-modules')
-        result.stdout.fnmatch_lines([
-            'Got nothing',
-            '* 1 failed in*',
-        ])
+        '''
+        )
+        result = testdir.runpytest("--doctest-modules")
+        result.stdout.fnmatch_lines(["Got nothing", "* 1 failed in*"])
 
     def test_ignore_import_errors_on_doctest(self, testdir):
-        p = testdir.makepyfile("""
+        p = testdir.makepyfile(
+            """
             import asdf
 
             def add_one(x):
                 '''
                 >>> add_one(1)
                 2
                 '''
                 return x + 1
-        """)
+        """
+        )
 
-        reprec = testdir.inline_run(p, "--doctest-modules",
-                                    "--doctest-ignore-import-errors")
+        reprec = testdir.inline_run(
+            p, "--doctest-modules", "--doctest-ignore-import-errors"
+        )
         reprec.assertoutcome(skipped=1, failed=1, passed=0)
 
     def test_junit_report_for_doctest(self, testdir):
         """
         #713: Fix --junit-xml option when used with --doctest-modules.
         """
-        p = testdir.makepyfile("""
+        p = testdir.makepyfile(
+            """
             def foo():
                 '''
                 >>> 1 + 1
                 3
                 '''
                 pass
-        """)
-        reprec = testdir.inline_run(p, "--doctest-modules",
-                                    "--junit-xml=junit.xml")
+        """
+        )
+        reprec = testdir.inline_run(p, "--doctest-modules", "--junit-xml=junit.xml")
         reprec.assertoutcome(failed=1)
 
     def test_unicode_doctest(self, testdir):
         """
         Test case for issue 2434: DecodeError on Python 2 when doctest contains non-ascii
         characters.
         """
-        p = testdir.maketxtfile(test_unicode_doctest="""
+        p = testdir.maketxtfile(
+            test_unicode_doctest="""
             .. doctest::
 
                 >>> print(
                 ...    "Hi\\n\\nByé")
                 Hi
                 ...
                 Byé
                 >>> 1/0  # Byé
                 1
-        """)
+        """
+        )
         result = testdir.runpytest(p)
-        result.stdout.fnmatch_lines([
-            '*UNEXPECTED EXCEPTION: ZeroDivisionError*',
-            '*1 failed*',
-        ])
+        result.stdout.fnmatch_lines(
+            ["*UNEXPECTED EXCEPTION: ZeroDivisionError*", "*1 failed*"]
+        )
 
     def test_unicode_doctest_module(self, testdir):
         """
         Test case for issue 2434: DecodeError on Python 2 when doctest docstring
         contains non-ascii characters.
         """
-        p = testdir.makepyfile(test_unicode_doctest_module="""
+        p = testdir.makepyfile(
+            test_unicode_doctest_module="""
             # -*- encoding: utf-8 -*-
             from __future__ import unicode_literals
 
             def fix_bad_unicode(text):
                 '''
                     >>> print(fix_bad_unicode('único'))
                     único
                 '''
                 return "único"
-        """)
-        result = testdir.runpytest(p, '--doctest-modules')
-        result.stdout.fnmatch_lines(['* 1 passed *'])
+        """
+        )
+        result = testdir.runpytest(p, "--doctest-modules")
+        result.stdout.fnmatch_lines(["* 1 passed *"])
+
+    def test_print_unicode_value(self, testdir):
+        """
+        Test case for issue 3583: Printing Unicode in doctest under Python 2.7
+        doesn't work
+        """
+        p = testdir.maketxtfile(
+            test_print_unicode_value=r"""
+            Here is a doctest::
+
+                >>> print(u'\xE5\xE9\xEE\xF8\xFC')
+                åéîøü
+        """
+        )
+        result = testdir.runpytest(p)
+        result.stdout.fnmatch_lines(["* 1 passed *"])
 
     def test_reportinfo(self, testdir):
-        '''
+        """
         Test case to make sure that DoctestItem.reportinfo() returns lineno.
-        '''
-        p = testdir.makepyfile(test_reportinfo="""
+        """
+        p = testdir.makepyfile(
+            test_reportinfo="""
             def foo(x):
                 '''
                     >>> foo('a')
                     'b'
                 '''
                 return 'c'
-        """)
-        items, reprec = testdir.inline_genitems(p, '--doctest-modules')
+        """
+        )
+        items, reprec = testdir.inline_genitems(p, "--doctest-modules")
         reportinfo = items[0].reportinfo()
         assert reportinfo[1] == 1
 
+    def test_valid_setup_py(self, testdir):
+        """
+        Test to make sure that pytest ignores valid setup.py files when ran
+        with --doctest-modules
+        """
+        p = testdir.makepyfile(
+            setup="""
+            from setuptools import setup, find_packages
+            setup(name='sample',
+                  version='0.0',
+                  description='description',
+                  packages=find_packages()
+            )
+        """
+        )
+        result = testdir.runpytest(p, "--doctest-modules")
+        result.stdout.fnmatch_lines(["*collected 0 items*"])
+
+    def test_invalid_setup_py(self, testdir):
+        """
+        Test to make sure that pytest reads setup.py files that are not used
+        for python packages when ran with --doctest-modules
+        """
+        p = testdir.makepyfile(
+            setup="""
+            def test_foo():
+                return 'bar'
+        """
+        )
+        result = testdir.runpytest(p, "--doctest-modules")
+        result.stdout.fnmatch_lines(["*collected 1 item*"])
+
 
 class TestLiterals(object):
 
-    @pytest.mark.parametrize('config_mode', ['ini', 'comment'])
+    @pytest.mark.parametrize("config_mode", ["ini", "comment"])
     def test_allow_unicode(self, testdir, config_mode):
         """Test that doctests which output unicode work in all python versions
         tested by pytest when the ALLOW_UNICODE option is used (either in
         the ini file or by an inline comment).
         """
-        if config_mode == 'ini':
-            testdir.makeini('''
+        if config_mode == "ini":
+            testdir.makeini(
+                """
             [pytest]
             doctest_optionflags = ALLOW_UNICODE
-            ''')
-            comment = ''
+            """
+            )
+            comment = ""
         else:
-            comment = '#doctest: +ALLOW_UNICODE'
+            comment = "#doctest: +ALLOW_UNICODE"
 
-        testdir.maketxtfile(test_doc="""
+        testdir.maketxtfile(
+            test_doc="""
             >>> b'12'.decode('ascii') {comment}
             '12'
-        """.format(comment=comment))
-        testdir.makepyfile(foo="""
+        """.format(
+                comment=comment
+            )
+        )
+        testdir.makepyfile(
+            foo="""
             def foo():
               '''
               >>> b'12'.decode('ascii') {comment}
               '12'
               '''
-        """.format(comment=comment))
+        """.format(
+                comment=comment
+            )
+        )
         reprec = testdir.inline_run("--doctest-modules")
         reprec.assertoutcome(passed=2)
 
-    @pytest.mark.parametrize('config_mode', ['ini', 'comment'])
+    @pytest.mark.parametrize("config_mode", ["ini", "comment"])
     def test_allow_bytes(self, testdir, config_mode):
         """Test that doctests which output bytes work in all python versions
         tested by pytest when the ALLOW_BYTES option is used (either in
         the ini file or by an inline comment)(#1287).
         """
-        if config_mode == 'ini':
-            testdir.makeini('''
+        if config_mode == "ini":
+            testdir.makeini(
+                """
             [pytest]
             doctest_optionflags = ALLOW_BYTES
-            ''')
-            comment = ''
+            """
+            )
+            comment = ""
         else:
-            comment = '#doctest: +ALLOW_BYTES'
+            comment = "#doctest: +ALLOW_BYTES"
 
-        testdir.maketxtfile(test_doc="""
+        testdir.maketxtfile(
+            test_doc="""
             >>> b'foo'  {comment}
             'foo'
-        """.format(comment=comment))
-        testdir.makepyfile(foo="""
+        """.format(
+                comment=comment
+            )
+        )
+        testdir.makepyfile(
+            foo="""
             def foo():
               '''
               >>> b'foo'  {comment}
               'foo'
               '''
-        """.format(comment=comment))
+        """.format(
+                comment=comment
+            )
+        )
         reprec = testdir.inline_run("--doctest-modules")
         reprec.assertoutcome(passed=2)
 
     def test_unicode_string(self, testdir):
         """Test that doctests which output unicode fail in Python 2 when
         the ALLOW_UNICODE option is not used. The same test should pass
         in Python 3.
         """
-        testdir.maketxtfile(test_doc="""
+        testdir.maketxtfile(
+            test_doc="""
             >>> b'12'.decode('ascii')
             '12'
-        """)
+        """
+        )
         reprec = testdir.inline_run()
         passed = int(sys.version_info[0] >= 3)
         reprec.assertoutcome(passed=passed, failed=int(not passed))
 
     def test_bytes_literal(self, testdir):
         """Test that doctests which output bytes fail in Python 3 when
         the ALLOW_BYTES option is not used. The same test should pass
         in Python 2 (#1287).
         """
-        testdir.maketxtfile(test_doc="""
+        testdir.maketxtfile(
+            test_doc="""
             >>> b'foo'
             'foo'
-        """)
+        """
+        )
         reprec = testdir.inline_run()
         passed = int(sys.version_info[0] == 2)
         reprec.assertoutcome(passed=passed, failed=int(not passed))
 
 
 class TestDoctestSkips(object):
     """
     If all examples in a doctest are skipped due to the SKIP option, then
     the tests should be SKIPPED rather than PASSED. (#957)
     """
 
-    @pytest.fixture(params=['text', 'module'])
+    @pytest.fixture(params=["text", "module"])
     def makedoctest(self, testdir, request):
+
         def makeit(doctest):
             mode = request.param
-            if mode == 'text':
+            if mode == "text":
                 testdir.maketxtfile(doctest)
             else:
-                assert mode == 'module'
+                assert mode == "module"
                 testdir.makepyfile('"""\n%s"""' % doctest)
 
         return makeit
 
     def test_one_skipped(self, testdir, makedoctest):
-        makedoctest("""
+        makedoctest(
+            """
             >>> 1 + 1  # doctest: +SKIP
             2
             >>> 2 + 2
             4
-        """)
+        """
+        )
         reprec = testdir.inline_run("--doctest-modules")
         reprec.assertoutcome(passed=1)
 
     def test_one_skipped_failed(self, testdir, makedoctest):
-        makedoctest("""
+        makedoctest(
+            """
             >>> 1 + 1  # doctest: +SKIP
             2
             >>> 2 + 2
             200
-        """)
+        """
+        )
         reprec = testdir.inline_run("--doctest-modules")
         reprec.assertoutcome(failed=1)
 
     def test_all_skipped(self, testdir, makedoctest):
-        makedoctest("""
+        makedoctest(
+            """
             >>> 1 + 1  # doctest: +SKIP
             2
             >>> 2 + 2  # doctest: +SKIP
             200
-        """)
+        """
+        )
         reprec = testdir.inline_run("--doctest-modules")
         reprec.assertoutcome(skipped=1)
 
     def test_vacuous_all_skipped(self, testdir, makedoctest):
-        makedoctest('')
+        makedoctest("")
         reprec = testdir.inline_run("--doctest-modules")
         reprec.assertoutcome(passed=0, skipped=0)
 
+    def test_continue_on_failure(self, testdir):
+        testdir.maketxtfile(
+            test_something="""
+            >>> i = 5
+            >>> def foo():
+            ...     raise ValueError('error1')
+            >>> foo()
+            >>> i
+            >>> i + 2
+            7
+            >>> i + 1
+        """
+        )
+        result = testdir.runpytest("--doctest-modules", "--doctest-continue-on-failure")
+        result.assert_outcomes(passed=0, failed=1)
+        # The lines that contains the failure are 4, 5, and 8.  The first one
+        # is a stack trace and the other two are mismatches.
+        result.stdout.fnmatch_lines(
+            ["*4: UnexpectedException*", "*5: DocTestFailure*", "*8: DocTestFailure*"]
+        )
+
 
 class TestDoctestAutoUseFixtures(object):
 
-    SCOPES = ['module', 'session', 'class', 'function']
+    SCOPES = ["module", "session", "class", "function"]
 
     def test_doctest_module_session_fixture(self, testdir):
         """Test that session fixtures are initialized for doctest modules (#768)
         """
         # session fixture which changes some global data, which will
         # be accessed by doctests in a module
-        testdir.makeconftest("""
+        testdir.makeconftest(
+            """
             import pytest
             import sys
 
             @pytest.yield_fixture(autouse=True, scope='session')
             def myfixture():
                 assert not hasattr(sys, 'pytest_session_data')
                 sys.pytest_session_data = 1
                 yield
                 del sys.pytest_session_data
-        """)
-        testdir.makepyfile(foo="""
+        """
+        )
+        testdir.makepyfile(
+            foo="""
             import sys
 
             def foo():
               '''
               >>> assert sys.pytest_session_data == 1
               '''
 
             def bar():
               '''
               >>> assert sys.pytest_session_data == 1
               '''
-        """)
+        """
+        )
         result = testdir.runpytest("--doctest-modules")
-        result.stdout.fnmatch_lines('*2 passed*')
+        result.stdout.fnmatch_lines("*2 passed*")
 
-    @pytest.mark.parametrize('scope', SCOPES)
-    @pytest.mark.parametrize('enable_doctest', [True, False])
+    @pytest.mark.parametrize("scope", SCOPES)
+    @pytest.mark.parametrize("enable_doctest", [True, False])
     def test_fixture_scopes(self, testdir, scope, enable_doctest):
         """Test that auto-use fixtures work properly with doctest modules.
         See #1057 and #1100.
         """
-        testdir.makeconftest('''
+        testdir.makeconftest(
+            """
             import pytest
 
             @pytest.fixture(autouse=True, scope="{scope}")
             def auto(request):
                 return 99
-        '''.format(scope=scope))
-        testdir.makepyfile(test_1='''
+        """.format(
+                scope=scope
+            )
+        )
+        testdir.makepyfile(
+            test_1='''
             def test_foo():
                 """
                 >>> getfixture('auto') + 1
                 100
                 """
             def test_bar():
                 assert 1
-        ''')
-        params = ('--doctest-modules',) if enable_doctest else ()
+        '''
+        )
+        params = ("--doctest-modules",) if enable_doctest else ()
         passes = 3 if enable_doctest else 2
         result = testdir.runpytest(*params)
-        result.stdout.fnmatch_lines(['*=== %d passed in *' % passes])
+        result.stdout.fnmatch_lines(["*=== %d passed in *" % passes])
 
-    @pytest.mark.parametrize('scope', SCOPES)
-    @pytest.mark.parametrize('autouse', [True, False])
-    @pytest.mark.parametrize('use_fixture_in_doctest', [True, False])
-    def test_fixture_module_doctest_scopes(self, testdir, scope, autouse,
-                                           use_fixture_in_doctest):
+    @pytest.mark.parametrize("scope", SCOPES)
+    @pytest.mark.parametrize("autouse", [True, False])
+    @pytest.mark.parametrize("use_fixture_in_doctest", [True, False])
+    def test_fixture_module_doctest_scopes(
+        self, testdir, scope, autouse, use_fixture_in_doctest
+    ):
         """Test that auto-use fixtures work properly with doctest files.
         See #1057 and #1100.
         """
-        testdir.makeconftest('''
+        testdir.makeconftest(
+            """
             import pytest
 
             @pytest.fixture(autouse={autouse}, scope="{scope}")
             def auto(request):
                 return 99
-        '''.format(scope=scope, autouse=autouse))
+        """.format(
+                scope=scope, autouse=autouse
+            )
+        )
         if use_fixture_in_doctest:
-            testdir.maketxtfile(test_doc="""
+            testdir.maketxtfile(
+                test_doc="""
                 >>> getfixture('auto')
                 99
-            """)
+            """
+            )
         else:
-            testdir.maketxtfile(test_doc="""
+            testdir.maketxtfile(
+                test_doc="""
                 >>> 1 + 1
                 2
-            """)
-        result = testdir.runpytest('--doctest-modules')
-        assert 'FAILURES' not in str(result.stdout.str())
-        result.stdout.fnmatch_lines(['*=== 1 passed in *'])
+            """
+            )
+        result = testdir.runpytest("--doctest-modules")
+        assert "FAILURES" not in str(result.stdout.str())
+        result.stdout.fnmatch_lines(["*=== 1 passed in *"])
 
-    @pytest.mark.parametrize('scope', SCOPES)
+    @pytest.mark.parametrize("scope", SCOPES)
     def test_auto_use_request_attributes(self, testdir, scope):
         """Check that all attributes of a request in an autouse fixture
         behave as expected when requested for a doctest item.
         """
-        testdir.makeconftest('''
+        testdir.makeconftest(
+            """
             import pytest
 
             @pytest.fixture(autouse=True, scope="{scope}")
             def auto(request):
                 if "{scope}" == 'module':
                     assert request.module is None
                 if "{scope}" == 'class':
                     assert request.cls is None
                 if "{scope}" == 'function':
                     assert request.function is None
                 return 99
-        '''.format(scope=scope))
-        testdir.maketxtfile(test_doc="""
+        """.format(
+                scope=scope
+            )
+        )
+        testdir.maketxtfile(
+            test_doc="""
             >>> 1 + 1
             2
-        """)
-        result = testdir.runpytest('--doctest-modules')
-        assert 'FAILURES' not in str(result.stdout.str())
-        result.stdout.fnmatch_lines(['*=== 1 passed in *'])
+        """
+        )
+        result = testdir.runpytest("--doctest-modules")
+        assert "FAILURES" not in str(result.stdout.str())
+        result.stdout.fnmatch_lines(["*=== 1 passed in *"])
 
 
 class TestDoctestNamespaceFixture(object):
 
-    SCOPES = ['module', 'session', 'class', 'function']
+    SCOPES = ["module", "session", "class", "function"]
 
-    @pytest.mark.parametrize('scope', SCOPES)
+    @pytest.mark.parametrize("scope", SCOPES)
     def test_namespace_doctestfile(self, testdir, scope):
         """
         Check that inserting something into the namespace works in a
         simple text file doctest
         """
-        testdir.makeconftest("""
+        testdir.makeconftest(
+            """
             import pytest
             import contextlib
 
             @pytest.fixture(autouse=True, scope="{scope}")
             def add_contextlib(doctest_namespace):
                 doctest_namespace['cl'] = contextlib
-        """.format(scope=scope))
-        p = testdir.maketxtfile("""
+        """.format(
+                scope=scope
+            )
+        )
+        p = testdir.maketxtfile(
+            """
             >>> print(cl.__name__)
             contextlib
-        """)
+        """
+        )
         reprec = testdir.inline_run(p)
         reprec.assertoutcome(passed=1)
 
-    @pytest.mark.parametrize('scope', SCOPES)
+    @pytest.mark.parametrize("scope", SCOPES)
     def test_namespace_pyfile(self, testdir, scope):
         """
         Check that inserting something into the namespace works in a
         simple Python file docstring doctest
         """
-        testdir.makeconftest("""
+        testdir.makeconftest(
+            """
             import pytest
             import contextlib
 
             @pytest.fixture(autouse=True, scope="{scope}")
             def add_contextlib(doctest_namespace):
                 doctest_namespace['cl'] = contextlib
-        """.format(scope=scope))
-        p = testdir.makepyfile("""
+        """.format(
+                scope=scope
+            )
+        )
+        p = testdir.makepyfile(
+            """
             def foo():
                 '''
                 >>> print(cl.__name__)
                 contextlib
                 '''
-        """)
+        """
+        )
         reprec = testdir.inline_run(p, "--doctest-modules")
         reprec.assertoutcome(passed=1)
 
 
 class TestDoctestReportingOption(object):
+
     def _run_doctest_report(self, testdir, format):
-        testdir.makepyfile("""
+        testdir.makepyfile(
+            """
             def foo():
                 '''
                 >>> foo()
                    a  b
                 0  1  4
                 1  2  4
                 2  3  6
                 '''
                 print('   a  b\\n'
                       '0  1  4\\n'
                       '1  2  5\\n'
                       '2  3  6')
-            """)
+            """
+        )
         return testdir.runpytest("--doctest-modules", "--doctest-report", format)
 
-    @pytest.mark.parametrize('format', ['udiff', 'UDIFF', 'uDiFf'])
+    @pytest.mark.parametrize("format", ["udiff", "UDIFF", "uDiFf"])
     def test_doctest_report_udiff(self, testdir, format):
         result = self._run_doctest_report(testdir, format)
-        result.stdout.fnmatch_lines([
-            '     0  1  4',
-            '    -1  2  4',
-            '    +1  2  5',
-            '     2  3  6',
-        ])
+        result.stdout.fnmatch_lines(
+            ["     0  1  4", "    -1  2  4", "    +1  2  5", "     2  3  6"]
+        )
 
     def test_doctest_report_cdiff(self, testdir):
-        result = self._run_doctest_report(testdir, 'cdiff')
-        result.stdout.fnmatch_lines([
-            '         a  b',
-            '      0  1  4',
-            '    ! 1  2  4',
-            '      2  3  6',
-            '    --- 1,4 ----',
-            '         a  b',
-            '      0  1  4',
-            '    ! 1  2  5',
-            '      2  3  6',
-        ])
+        result = self._run_doctest_report(testdir, "cdiff")
+        result.stdout.fnmatch_lines(
+            [
+                "         a  b",
+                "      0  1  4",
+                "    ! 1  2  4",
+                "      2  3  6",
+                "    --- 1,4 ----",
+                "         a  b",
+                "      0  1  4",
+                "    ! 1  2  5",
+                "      2  3  6",
+            ]
+        )
 
     def test_doctest_report_ndiff(self, testdir):
-        result = self._run_doctest_report(testdir, 'ndiff')
-        result.stdout.fnmatch_lines([
-            '         a  b',
-            '      0  1  4',
-            '    - 1  2  4',
-            '    ?       ^',
-            '    + 1  2  5',
-            '    ?       ^',
-            '      2  3  6',
-        ])
+        result = self._run_doctest_report(testdir, "ndiff")
+        result.stdout.fnmatch_lines(
+            [
+                "         a  b",
+                "      0  1  4",
+                "    - 1  2  4",
+                "    ?       ^",
+                "    + 1  2  5",
+                "    ?       ^",
+                "      2  3  6",
+            ]
+        )
 
-    @pytest.mark.parametrize('format', ['none', 'only_first_failure'])
+    @pytest.mark.parametrize("format", ["none", "only_first_failure"])
     def test_doctest_report_none_or_only_first_failure(self, testdir, format):
         result = self._run_doctest_report(testdir, format)
-        result.stdout.fnmatch_lines([
-            'Expected:',
-            '       a  b',
-            '    0  1  4',
-            '    1  2  4',
-            '    2  3  6',
-            'Got:',
-            '       a  b',
-            '    0  1  4',
-            '    1  2  5',
-            '    2  3  6',
-        ])
+        result.stdout.fnmatch_lines(
+            [
+                "Expected:",
+                "       a  b",
+                "    0  1  4",
+                "    1  2  4",
+                "    2  3  6",
+                "Got:",
+                "       a  b",
+                "    0  1  4",
+                "    1  2  5",
+                "    2  3  6",
+            ]
+        )
 
     def test_doctest_report_invalid(self, testdir):
-        result = self._run_doctest_report(testdir, 'obviously_invalid_format')
-        result.stderr.fnmatch_lines([
-            "*error: argument --doctest-report: invalid choice: 'obviously_invalid_format' (choose from*"
-        ])
+        result = self._run_doctest_report(testdir, "obviously_invalid_format")
+        result.stderr.fnmatch_lines(
+            [
+                "*error: argument --doctest-report: invalid choice: 'obviously_invalid_format' (choose from*"
+            ]
+        )
--- a/third_party/python/pytest/testing/test_entry_points.py
+++ b/third_party/python/pytest/testing/test_entry_points.py
@@ -1,14 +1,14 @@
 from __future__ import absolute_import, division, print_function
 import pkg_resources
 
 import pytest
 
 
-@pytest.mark.parametrize("entrypoint", ['py.test', 'pytest'])
+@pytest.mark.parametrize("entrypoint", ["py.test", "pytest"])
 def test_entry_point_exist(entrypoint):
-    assert entrypoint in pkg_resources.get_entry_map('pytest')['console_scripts']
+    assert entrypoint in pkg_resources.get_entry_map("pytest")["console_scripts"]
 
 
 def test_pytest_entry_points_are_identical():
-    entryMap = pkg_resources.get_entry_map('pytest')['console_scripts']
-    assert entryMap['pytest'].module_name == entryMap['py.test'].module_name
+    entryMap = pkg_resources.get_entry_map("pytest")["console_scripts"]
+    assert entryMap["pytest"].module_name == entryMap["py.test"].module_name
--- a/third_party/python/pytest/testing/test_helpconfig.py
+++ b/third_party/python/pytest/testing/test_helpconfig.py
@@ -2,76 +2,71 @@ from __future__ import absolute_import, 
 from _pytest.main import EXIT_NOTESTSCOLLECTED
 import pytest
 
 
 def test_version(testdir, pytestconfig):
     result = testdir.runpytest("--version")
     assert result.ret == 0
     # p = py.path.local(py.__file__).dirpath()
-    result.stderr.fnmatch_lines([
-        '*pytest*%s*imported from*' % (pytest.__version__, )
-    ])
+    result.stderr.fnmatch_lines(["*pytest*%s*imported from*" % (pytest.__version__,)])
     if pytestconfig.pluginmanager.list_plugin_distinfo():
-        result.stderr.fnmatch_lines([
-            "*setuptools registered plugins:",
-            "*at*",
-        ])
+        result.stderr.fnmatch_lines(["*setuptools registered plugins:", "*at*"])
 
 
 def test_help(testdir):
     result = testdir.runpytest("--help")
     assert result.ret == 0
-    result.stdout.fnmatch_lines("""
+    result.stdout.fnmatch_lines(
+        """
         *-v*verbose*
         *setup.cfg*
         *minversion*
         *to see*markers*pytest --markers*
         *to see*fixtures*pytest --fixtures*
-    """)
+    """
+    )
 
 
 def test_hookvalidation_unknown(testdir):
-    testdir.makeconftest("""
+    testdir.makeconftest(
+        """
         def pytest_hello(xyz):
             pass
-    """)
+    """
+    )
     result = testdir.runpytest()
     assert result.ret != 0
-    result.stdout.fnmatch_lines([
-        '*unknown hook*pytest_hello*'
-    ])
+    result.stdout.fnmatch_lines(["*unknown hook*pytest_hello*"])
 
 
 def test_hookvalidation_optional(testdir):
-    testdir.makeconftest("""
+    testdir.makeconftest(
+        """
         import pytest
         @pytest.hookimpl(optionalhook=True)
         def pytest_hello(xyz):
             pass
-    """)
+    """
+    )
     result = testdir.runpytest()
     assert result.ret == EXIT_NOTESTSCOLLECTED
 
 
 def test_traceconfig(testdir):
     result = testdir.runpytest("--traceconfig")
-    result.stdout.fnmatch_lines([
-        "*using*pytest*py*",
-        "*active plugins*",
-    ])
+    result.stdout.fnmatch_lines(["*using*pytest*py*", "*active plugins*"])
 
 
 def test_debug(testdir, monkeypatch):
     result = testdir.runpytest_subprocess("--debug")
     assert result.ret == EXIT_NOTESTSCOLLECTED
     p = testdir.tmpdir.join("pytestdebug.log")
     assert "pytest_sessionstart" in p.read()
 
 
 def test_PYTEST_DEBUG(testdir, monkeypatch):
     monkeypatch.setenv("PYTEST_DEBUG", "1")
     result = testdir.runpytest_subprocess()
     assert result.ret == EXIT_NOTESTSCOLLECTED
-    result.stderr.fnmatch_lines([
-        "*pytest_plugin_registered*",
-        "*manager*PluginManager*"
-    ])
+    result.stderr.fnmatch_lines(
+        ["*pytest_plugin_registered*", "*manager*PluginManager*"]
+    )
--- a/third_party/python/pytest/testing/test_junitxml.py
+++ b/third_party/python/pytest/testing/test_junitxml.py
@@ -18,22 +18,23 @@ def runandparse(testdir, *args):
 def assert_attr(node, **kwargs):
     __tracebackhide__ = True
 
     def nodeval(node, name):
         anode = node.getAttributeNode(name)
         if anode is not None:
             return anode.value
 
-    expected = dict((name, str(value)) for name, value in kwargs.items())
-    on_node = dict((name, nodeval(node, name)) for name in expected)
+    expected = {name: str(value) for name, value in kwargs.items()}
+    on_node = {name: nodeval(node, name) for name in expected}
     assert on_node == expected
 
 
 class DomNode(object):
+
     def __init__(self, dom):
         self.__node = dom
 
     def __repr__(self):
         return self.__node.toxml()
 
     def find_first_by_tag(self, tag):
         return self.find_nth_by_tag(tag, 0)
@@ -75,758 +76,886 @@ class DomNode(object):
         return self.__node.tagName
 
     @property
     def next_siebling(self):
         return type(self)(self.__node.nextSibling)
 
 
 class TestPython(object):
+
     def test_summing_simple(self, testdir):
-        testdir.makepyfile("""
+        testdir.makepyfile(
+            """
             import pytest
             def test_pass():
                 pass
             def test_fail():
                 assert 0
             def test_skip():
                 pytest.skip("")
             @pytest.mark.xfail
             def test_xfail():
                 assert 0
             @pytest.mark.xfail
             def test_xpass():
                 assert 1
-        """)
+        """
+        )
         result, dom = runandparse(testdir)
         assert result.ret
         node = dom.find_first_by_tag("testsuite")
         node.assert_attr(name="pytest", errors=0, failures=1, skips=2, tests=5)
 
     def test_summing_simple_with_errors(self, testdir):
-        testdir.makepyfile("""
+        testdir.makepyfile(
+            """
             import pytest
             @pytest.fixture
             def fixture():
                 raise Exception()
             def test_pass():
                 pass
             def test_fail():
                 assert 0
             def test_error(fixture):
                 pass
             @pytest.mark.xfail
             def test_xfail():
                 assert False
             @pytest.mark.xfail(strict=True)
             def test_xpass():
                 assert True
-        """)
+        """
+        )
         result, dom = runandparse(testdir)
         assert result.ret
         node = dom.find_first_by_tag("testsuite")
         node.assert_attr(name="pytest", errors=1, failures=2, skips=1, tests=5)
 
     def test_timing_function(self, testdir):
-        testdir.makepyfile("""
+        testdir.makepyfile(
+            """
             import time, pytest
             def setup_module():
                 time.sleep(0.01)
             def teardown_module():
                 time.sleep(0.01)
             def test_sleep():
                 time.sleep(0.01)
-        """)
+        """
+        )
         result, dom = runandparse(testdir)
         node = dom.find_first_by_tag("testsuite")
         tnode = node.find_first_by_tag("testcase")
         val = tnode["time"]
         assert round(float(val), 2) >= 0.03
 
     def test_setup_error(self, testdir):
-        testdir.makepyfile("""
+        testdir.makepyfile(
+            """
             import pytest
 
             @pytest.fixture
             def arg(request):
                 raise ValueError()
             def test_function(arg):
                 pass
-        """)
+        """
+        )
         result, dom = runandparse(testdir)
         assert result.ret
         node = dom.find_first_by_tag("testsuite")
         node.assert_attr(errors=1, tests=1)
         tnode = node.find_first_by_tag("testcase")
         tnode.assert_attr(
             file="test_setup_error.py",
             line="5",
             classname="test_setup_error",
-            name="test_function")
+            name="test_function",
+        )
         fnode = tnode.find_first_by_tag("error")
         fnode.assert_attr(message="test setup failure")
         assert "ValueError" in fnode.toxml()
 
     def test_teardown_error(self, testdir):
-        testdir.makepyfile("""
+        testdir.makepyfile(
+            """
             import pytest
 
             @pytest.fixture
             def arg():
                 yield
                 raise ValueError()
             def test_function(arg):
                 pass
-        """)
+        """
+        )
         result, dom = runandparse(testdir)
         assert result.ret
         node = dom.find_first_by_tag("testsuite")
         tnode = node.find_first_by_tag("testcase")
         tnode.assert_attr(
             file="test_teardown_error.py",
             line="6",
             classname="test_teardown_error",
-            name="test_function")
+            name="test_function",
+        )
         fnode = tnode.find_first_by_tag("error")
         fnode.assert_attr(message="test teardown failure")
         assert "ValueError" in fnode.toxml()
 
     def test_call_failure_teardown_error(self, testdir):
-        testdir.makepyfile("""
+        testdir.makepyfile(
+            """
             import pytest
 
             @pytest.fixture
             def arg():
                 yield
                 raise Exception("Teardown Exception")
             def test_function(arg):
                 raise Exception("Call Exception")
-        """)
+        """
+        )
         result, dom = runandparse(testdir)
         assert result.ret
         node = dom.find_first_by_tag("testsuite")
         node.assert_attr(errors=1, failures=1, tests=1)
         first, second = dom.find_by_tag("testcase")
         if not first or not second or first == second:
             assert 0
         fnode = first.find_first_by_tag("failure")
         fnode.assert_attr(message="Exception: Call Exception")
         snode = second.find_first_by_tag("error")
         snode.assert_attr(message="test teardown failure")
 
     def test_skip_contains_name_reason(self, testdir):
-        testdir.makepyfile("""
+        testdir.makepyfile(
+            """
             import pytest
             def test_skip():
                 pytest.skip("hello23")
-        """)
+        """
+        )
         result, dom = runandparse(testdir)
         assert result.ret == 0
         node = dom.find_first_by_tag("testsuite")
         node.assert_attr(skips=1)
         tnode = node.find_first_by_tag("testcase")
         tnode.assert_attr(
             file="test_skip_contains_name_reason.py",
             line="1",
             classname="test_skip_contains_name_reason",
-            name="test_skip")
+            name="test_skip",
+        )
         snode = tnode.find_first_by_tag("skipped")
-        snode.assert_attr(type="pytest.skip", message="hello23", )
+        snode.assert_attr(type="pytest.skip", message="hello23")
 
     def test_mark_skip_contains_name_reason(self, testdir):
-        testdir.makepyfile("""
+        testdir.makepyfile(
+            """
             import pytest
             @pytest.mark.skip(reason="hello24")
             def test_skip():
                 assert True
-        """)
+        """
+        )
         result, dom = runandparse(testdir)
         assert result.ret == 0
         node = dom.find_first_by_tag("testsuite")
         node.assert_attr(skips=1)
         tnode = node.find_first_by_tag("testcase")
         tnode.assert_attr(
             file="test_mark_skip_contains_name_reason.py",
             line="1",
             classname="test_mark_skip_contains_name_reason",
-            name="test_skip")
+            name="test_skip",
+        )
         snode = tnode.find_first_by_tag("skipped")
-        snode.assert_attr(type="pytest.skip", message="hello24", )
+        snode.assert_attr(type="pytest.skip", message="hello24")
 
     def test_mark_skipif_contains_name_reason(self, testdir):
-        testdir.makepyfile("""
+        testdir.makepyfile(
+            """
             import pytest
             GLOBAL_CONDITION = True
             @pytest.mark.skipif(GLOBAL_CONDITION, reason="hello25")
             def test_skip():
                 assert True
-        """)
+        """
+        )
         result, dom = runandparse(testdir)
         assert result.ret == 0
         node = dom.find_first_by_tag("testsuite")
         node.assert_attr(skips=1)
         tnode = node.find_first_by_tag("testcase")
         tnode.assert_attr(
             file="test_mark_skipif_contains_name_reason.py",
             line="2",
             classname="test_mark_skipif_contains_name_reason",
-            name="test_skip")
+            name="test_skip",
+        )
         snode = tnode.find_first_by_tag("skipped")
-        snode.assert_attr(type="pytest.skip", message="hello25", )
+        snode.assert_attr(type="pytest.skip", message="hello25")
 
     def test_mark_skip_doesnt_capture_output(self, testdir):
-        testdir.makepyfile("""
+        testdir.makepyfile(
+            """
             import pytest
             @pytest.mark.skip(reason="foo")
             def test_skip():
                 print("bar!")
-        """)
+        """
+        )
         result, dom = runandparse(testdir)
         assert result.ret == 0
         node_xml = dom.find_first_by_tag("testsuite").toxml()
         assert "bar!" not in node_xml
 
     def test_classname_instance(self, testdir):
-        testdir.makepyfile("""
+        testdir.makepyfile(
+            """
             class TestClass(object):
                 def test_method(self):
                     assert 0
-        """)
+        """
+        )
         result, dom = runandparse(testdir)
         assert result.ret
         node = dom.find_first_by_tag("testsuite")
         node.assert_attr(failures=1)
         tnode = node.find_first_by_tag("testcase")
         tnode.assert_attr(
             file="test_classname_instance.py",
             line="1",
             classname="test_classname_instance.TestClass",
-            name="test_method")
+            name="test_method",
+        )
 
     def test_classname_nested_dir(self, testdir):
         p = testdir.tmpdir.ensure("sub", "test_hello.py")
         p.write("def test_func(): 0/0")
         result, dom = runandparse(testdir)
         assert result.ret
         node = dom.find_first_by_tag("testsuite")
         node.assert_attr(failures=1)
         tnode = node.find_first_by_tag("testcase")
         tnode.assert_attr(
             file=os.path.join("sub", "test_hello.py"),
             line="0",
             classname="sub.test_hello",
-            name="test_func")
+            name="test_func",
+        )
 
     def test_internal_error(self, testdir):
         testdir.makeconftest("def pytest_runtest_protocol(): 0 / 0")
         testdir.makepyfile("def test_function(): pass")
         result, dom = runandparse(testdir)
         assert result.ret
         node = dom.find_first_by_tag("testsuite")
         node.assert_attr(errors=1, tests=1)
         tnode = node.find_first_by_tag("testcase")
         tnode.assert_attr(classname="pytest", name="internal")
         fnode = tnode.find_first_by_tag("error")
         fnode.assert_attr(message="internal error")
         assert "Division" in fnode.toxml()
 
-    def test_failure_function(self, testdir):
-        testdir.makepyfile("""
+    @pytest.mark.parametrize("junit_logging", ["no", "system-out", "system-err"])
+    def test_failure_function(self, testdir, junit_logging):
+        testdir.makepyfile(
+            """
+            import logging
             import sys
+
             def test_fail():
                 print ("hello-stdout")
                 sys.stderr.write("hello-stderr\\n")
+                logging.info('info msg')
+                logging.warning('warning msg')
                 raise ValueError(42)
-        """)
+        """
+        )
 
-        result, dom = runandparse(testdir)
+        result, dom = runandparse(testdir, "-o", "junit_logging=%s" % junit_logging)
         assert result.ret
         node = dom.find_first_by_tag("testsuite")
         node.assert_attr(failures=1, tests=1)
         tnode = node.find_first_by_tag("testcase")
         tnode.assert_attr(
             file="test_failure_function.py",
-            line="1",
+            line="3",
             classname="test_failure_function",
-            name="test_fail")
+            name="test_fail",
+        )
         fnode = tnode.find_first_by_tag("failure")
         fnode.assert_attr(message="ValueError: 42")
         assert "ValueError" in fnode.toxml()
         systemout = fnode.next_siebling
         assert systemout.tag == "system-out"
         assert "hello-stdout" in systemout.toxml()
+        assert "info msg" not in systemout.toxml()
         systemerr = systemout.next_siebling
         assert systemerr.tag == "system-err"
         assert "hello-stderr" in systemerr.toxml()
+        assert "info msg" not in systemerr.toxml()
+
+        if junit_logging == "system-out":
+            assert "warning msg" in systemout.toxml()
+            assert "warning msg" not in systemerr.toxml()
+        elif junit_logging == "system-err":
+            assert "warning msg" not in systemout.toxml()
+            assert "warning msg" in systemerr.toxml()
+        elif junit_logging == "no":
+            assert "warning msg" not in systemout.toxml()
+            assert "warning msg" not in systemerr.toxml()
 
     def test_failure_verbose_message(self, testdir):
-        testdir.makepyfile("""
+        testdir.makepyfile(
+            """
             import sys
             def test_fail():
                 assert 0, "An error"
-        """)
+        """
+        )
 
         result, dom = runandparse(testdir)
         node = dom.find_first_by_tag("testsuite")
         tnode = node.find_first_by_tag("testcase")
         fnode = tnode.find_first_by_tag("failure")
         fnode.assert_attr(message="AssertionError: An error assert 0")
 
     def test_failure_escape(self, testdir):
-        testdir.makepyfile("""
+        testdir.makepyfile(
+            """
             import pytest
             @pytest.mark.parametrize('arg1', "<&'", ids="<&'")
             def test_func(arg1):
                 print(arg1)
                 assert 0
-        """)
+        """
+        )
         result, dom = runandparse(testdir)
         assert result.ret
         node = dom.find_first_by_tag("testsuite")
         node.assert_attr(failures=3, tests=3)
 
         for index, char in enumerate("<&'"):
 
             tnode = node.find_nth_by_tag("testcase", index)
             tnode.assert_attr(
                 file="test_failure_escape.py",
                 line="1",
                 classname="test_failure_escape",
-                name="test_func[%s]" % char)
-            sysout = tnode.find_first_by_tag('system-out')
+                name="test_func[%s]" % char,
+            )
+            sysout = tnode.find_first_by_tag("system-out")
             text = sysout.text
-            assert text == '%s\n' % char
+            assert text == "%s\n" % char
 
     def test_junit_prefixing(self, testdir):
-        testdir.makepyfile("""
+        testdir.makepyfile(
+            """
             def test_func():
                 assert 0
             class TestHello(object):
                 def test_hello(self):
                     pass
-        """)
+        """
+        )
         result, dom = runandparse(testdir, "--junitprefix=xyz")
         assert result.ret
         node = dom.find_first_by_tag("testsuite")
         node.assert_attr(failures=1, tests=2)
         tnode = node.find_first_by_tag("testcase")
         tnode.assert_attr(
             file="test_junit_prefixing.py",
             line="0",
             classname="xyz.test_junit_prefixing",
-            name="test_func")
+            name="test_func",
+        )
         tnode = node.find_nth_by_tag("testcase", 1)
         tnode.assert_attr(
             file="test_junit_prefixing.py",
             line="3",
-            classname="xyz.test_junit_prefixing."
-            "TestHello",
-            name="test_hello")
+            classname="xyz.test_junit_prefixing." "TestHello",
+            name="test_hello",
+        )
 
     def test_xfailure_function(self, testdir):
-        testdir.makepyfile("""
+        testdir.makepyfile(
+            """
             import pytest
             def test_xfail():
                 pytest.xfail("42")
-        """)
+        """
+        )
         result, dom = runandparse(testdir)
         assert not result.ret
         node = dom.find_first_by_tag("testsuite")
         node.assert_attr(skips=1, tests=1)
         tnode = node.find_first_by_tag("testcase")
         tnode.assert_attr(
             file="test_xfailure_function.py",
             line="1",
             classname="test_xfailure_function",
-            name="test_xfail")
+            name="test_xfail",
+        )
         fnode = tnode.find_first_by_tag("skipped")
         fnode.assert_attr(message="expected test failure")
         # assert "ValueError" in fnode.toxml()
 
+    def test_xfail_captures_output_once(self, testdir):
+        testdir.makepyfile(
+            """
+            import sys
+            import pytest
+
+            @pytest.mark.xfail()
+            def test_fail():
+                sys.stdout.write('XFAIL This is stdout')
+                sys.stderr.write('XFAIL This is stderr')
+                assert 0
+        """
+        )
+        result, dom = runandparse(testdir)
+        node = dom.find_first_by_tag("testsuite")
+        tnode = node.find_first_by_tag("testcase")
+        assert len(tnode.find_by_tag("system-err")) == 1
+        assert len(tnode.find_by_tag("system-out")) == 1
+
     def test_xfailure_xpass(self, testdir):
-        testdir.makepyfile("""
+        testdir.makepyfile(
+            """
             import pytest
             @pytest.mark.xfail
             def test_xpass():
                 pass
-        """)
+        """
+        )
         result, dom = runandparse(testdir)
         # assert result.ret
         node = dom.find_first_by_tag("testsuite")
         node.assert_attr(skips=0, tests=1)
         tnode = node.find_first_by_tag("testcase")
         tnode.assert_attr(
             file="test_xfailure_xpass.py",
             line="1",
             classname="test_xfailure_xpass",
-            name="test_xpass")
+            name="test_xpass",
+        )
 
     def test_xfailure_xpass_strict(self, testdir):
-        testdir.makepyfile("""
+        testdir.makepyfile(
+            """
             import pytest
             @pytest.mark.xfail(strict=True, reason="This needs to fail!")
             def test_xpass():
                 pass
-        """)
+        """
+        )
         result, dom = runandparse(testdir)
         # assert result.ret
         node = dom.find_first_by_tag("testsuite")
         node.assert_attr(skips=0, tests=1)
         tnode = node.find_first_by_tag("testcase")
         tnode.assert_attr(
             file="test_xfailure_xpass_strict.py",
             line="1",
             classname="test_xfailure_xpass_strict",
-            name="test_xpass")
+            name="test_xpass",
+        )
         fnode = tnode.find_first_by_tag("failure")
         fnode.assert_attr(message="[XPASS(strict)] This needs to fail!")
 
     def test_collect_error(self, testdir):
         testdir.makepyfile("syntax error")
         result, dom = runandparse(testdir)
         assert result.ret
         node = dom.find_first_by_tag("testsuite")
         node.assert_attr(errors=1, tests=1)
         tnode = node.find_first_by_tag("testcase")
-        tnode.assert_attr(
-            file="test_collect_error.py",
-            name="test_collect_error")
+        tnode.assert_attr(file="test_collect_error.py", name="test_collect_error")
         assert tnode["line"] is None
         fnode = tnode.find_first_by_tag("error")
         fnode.assert_attr(message="collection failure")
         assert "SyntaxError" in fnode.toxml()
 
     def test_unicode(self, testdir):
-        value = 'hx\xc4\x85\xc4\x87\n'
-        testdir.makepyfile("""
+        value = "hx\xc4\x85\xc4\x87\n"
+        testdir.makepyfile(
+            """
             # coding: latin1
             def test_hello():
                 print (%r)
                 assert 0
-        """ % value)
+        """
+            % value
+        )
         result, dom = runandparse(testdir)
         assert result.ret == 1
         tnode = dom.find_first_by_tag("testcase")
         fnode = tnode.find_first_by_tag("failure")
         if not sys.platform.startswith("java"):
             assert "hx" in fnode.toxml()
 
     def test_assertion_binchars(self, testdir):
         """this test did fail when the escaping wasnt strict"""
-        testdir.makepyfile("""
+        testdir.makepyfile(
+            """
 
             M1 = '\x01\x02\x03\x04'
             M2 = '\x01\x02\x03\x05'
 
             def test_str_compare():
                 assert M1 == M2
-            """)
+            """
+        )
         result, dom = runandparse(testdir)
         print(dom.toxml())
 
     def test_pass_captures_stdout(self, testdir):
-        testdir.makepyfile("""
+        testdir.makepyfile(
+            """
             def test_pass():
                 print('hello-stdout')
-        """)
+        """
+        )
         result, dom = runandparse(testdir)
         node = dom.find_first_by_tag("testsuite")
         pnode = node.find_first_by_tag("testcase")
         systemout = pnode.find_first_by_tag("system-out")
         assert "hello-stdout" in systemout.toxml()
 
     def test_pass_captures_stderr(self, testdir):
-        testdir.makepyfile("""
+        testdir.makepyfile(
+            """
             import sys
             def test_pass():
                 sys.stderr.write('hello-stderr')
-        """)
+        """
+        )
         result, dom = runandparse(testdir)
         node = dom.find_first_by_tag("testsuite")
         pnode = node.find_first_by_tag("testcase")
         systemout = pnode.find_first_by_tag("system-err")
         assert "hello-stderr" in systemout.toxml()
 
     def test_setup_error_captures_stdout(self, testdir):
-        testdir.makepyfile("""
+        testdir.makepyfile(
+            """
             import pytest
 
             @pytest.fixture
             def arg(request):
                 print('hello-stdout')
                 raise ValueError()
             def test_function(arg):
                 pass
-        """)
+        """
+        )
         result, dom = runandparse(testdir)
         node = dom.find_first_by_tag("testsuite")
         pnode = node.find_first_by_tag("testcase")
         systemout = pnode.find_first_by_tag("system-out")
         assert "hello-stdout" in systemout.toxml()
 
     def test_setup_error_captures_stderr(self, testdir):
-        testdir.makepyfile("""
+        testdir.makepyfile(
+            """
             import sys
             import pytest
 
             @pytest.fixture
             def arg(request):
                 sys.stderr.write('hello-stderr')
                 raise ValueError()
             def test_function(arg):
                 pass
-        """)
+        """
+        )
         result, dom = runandparse(testdir)
         node = dom.find_first_by_tag("testsuite")
         pnode = node.find_first_by_tag("testcase")
         systemout = pnode.find_first_by_tag("system-err")
         assert "hello-stderr" in systemout.toxml()
 
     def test_avoid_double_stdout(self, testdir):
-        testdir.makepyfile("""
+        testdir.makepyfile(
+            """
             import sys
             import pytest
 
             @pytest.fixture
             def arg(request):
                 yield
                 sys.stdout.write('hello-stdout teardown')
                 raise ValueError()
             def test_function(arg):
                 sys.stdout.write('hello-stdout call')
-        """)
+        """
+        )
         result, dom = runandparse(testdir)
         node = dom.find_first_by_tag("testsuite")
         pnode = node.find_first_by_tag("testcase")
         systemout = pnode.find_first_by_tag("system-out")
         assert "hello-stdout call" in systemout.toxml()
         assert "hello-stdout teardown" in systemout.toxml()
 
 
 def test_mangle_test_address():
     from _pytest.junitxml import mangle_test_address
-    address = '::'.join(
-        ["a/my.py.thing.py", "Class", "()", "method", "[a-1-::]"])
+
+    address = "::".join(["a/my.py.thing.py", "Class", "()", "method", "[a-1-::]"])
     newnames = mangle_test_address(address)
     assert newnames == ["a.my.py.thing", "Class", "method", "[a-1-::]"]
 
 
 def test_dont_configure_on_slaves(tmpdir):
     gotten = []
 
     class FakeConfig(object):
+
         def __init__(self):
             self.pluginmanager = self
             self.option = self
 
         def getini(self, name):
             return "pytest"
 
         junitprefix = None
         # XXX: shouldnt need tmpdir ?
-        xmlpath = str(tmpdir.join('junix.xml'))
+        xmlpath = str(tmpdir.join("junix.xml"))
         register = gotten.append
 
     fake_config = FakeConfig()
     from _pytest import junitxml
+
     junitxml.pytest_configure(fake_config)
     assert len(gotten) == 1
     FakeConfig.slaveinput = None
     junitxml.pytest_configure(fake_config)
     assert len(gotten) == 1
 
 
 class TestNonPython(object):
+
     def test_summing_simple(self, testdir):
-        testdir.makeconftest("""
+        testdir.makeconftest(
+            """
             import pytest
             def pytest_collect_file(path, parent):
                 if path.ext == ".xyz":
                     return MyItem(path, parent)
             class MyItem(pytest.Item):
                 def __init__(self, path, parent):
                     super(MyItem, self).__init__(path.basename, parent)
                     self.fspath = path
                 def runtest(self):
                     raise ValueError(42)
                 def repr_failure(self, excinfo):
                     return "custom item runtest failed"
-        """)
+        """
+        )
         testdir.tmpdir.join("myfile.xyz").write("hello")
         result, dom = runandparse(testdir)
         assert result.ret
         node = dom.find_first_by_tag("testsuite")
         node.assert_attr(errors=0, failures=1, skips=0, tests=1)
         tnode = node.find_first_by_tag("testcase")
         tnode.assert_attr(name="myfile.xyz")
         fnode = tnode.find_first_by_tag("failure")
         fnode.assert_attr(message="custom item runtest failed")
         assert "custom item runtest failed" in fnode.toxml()
 
 
 def test_nullbyte(testdir):
     # A null byte can not occur in XML (see section 2.2 of the spec)
-    testdir.makepyfile("""
+    testdir.makepyfile(
+        """
         import sys
         def test_print_nullbyte():
             sys.stdout.write('Here the null -->' + chr(0) + '<--')
             sys.stdout.write('In repr form -->' + repr(chr(0)) + '<--')
             assert False
-    """)
-    xmlf = testdir.tmpdir.join('junit.xml')
-    testdir.runpytest('--junitxml=%s' % xmlf)
+    """
+    )
+    xmlf = testdir.tmpdir.join("junit.xml")
+    testdir.runpytest("--junitxml=%s" % xmlf)
     text = xmlf.read()
-    assert '\x00' not in text
-    assert '#x00' in text
+    assert "\x00" not in text
+    assert "#x00" in text
 
 
 def test_nullbyte_replace(testdir):
     # Check if the null byte gets replaced
-    testdir.makepyfile("""
+    testdir.makepyfile(
+        """
         import sys
         def test_print_nullbyte():
             sys.stdout.write('Here the null -->' + chr(0) + '<--')
             sys.stdout.write('In repr form -->' + repr(chr(0)) + '<--')
             assert False
-    """)
-    xmlf = testdir.tmpdir.join('junit.xml')
-    testdir.runpytest('--junitxml=%s' % xmlf)
+    """
+    )
+    xmlf = testdir.tmpdir.join("junit.xml")
+    testdir.runpytest("--junitxml=%s" % xmlf)
     text = xmlf.read()
-    assert '#x0' in text
+    assert "#x0" in text
 
 
 def test_invalid_xml_escape():
     # Test some more invalid xml chars, the full range should be
     # tested really but let's just thest the edges of the ranges
     # intead.
     # XXX This only tests low unicode character points for now as
     #     there are some issues with the testing infrastructure for
     #     the higher ones.
     # XXX Testing 0xD (\r) is tricky as it overwrites the just written
     #     line in the output, so we skip it too.
     global unichr
     try:
         unichr(65)
     except NameError:
         unichr = chr
-    invalid = (0x00, 0x1, 0xB, 0xC, 0xE, 0x19, 27,  # issue #126
-               0xD800, 0xDFFF, 0xFFFE, 0x0FFFF)  # , 0x110000)
-    valid = (0x9, 0xA, 0x20, )
+    invalid = (
+        0x00,
+        0x1,
+        0xB,
+        0xC,
+        0xE,
+        0x19,
+        27,  # issue #126
+        0xD800,
+        0xDFFF,
+        0xFFFE,
+        0x0FFFF,
+    )  # , 0x110000)
+    valid = (0x9, 0xA, 0x20)
     # 0xD, 0xD7FF, 0xE000, 0xFFFD, 0x10000, 0x10FFFF)
 
     from _pytest.junitxml import bin_xml_escape
 
     for i in invalid:
         got = bin_xml_escape(unichr(i)).uniobj
         if i <= 0xFF:
-            expected = '#x%02X' % i
+            expected = "#x%02X" % i
         else:
-            expected = '#x%04X' % i
+            expected = "#x%04X" % i
         assert got == expected
     for i in valid:
         assert chr(i) == bin_xml_escape(unichr(i)).uniobj
 
 
 def test_logxml_path_expansion(tmpdir, monkeypatch):
-    home_tilde = py.path.local(os.path.expanduser('~')).join('test.xml')
+    home_tilde = py.path.local(os.path.expanduser("~")).join("test.xml")
 
-    xml_tilde = LogXML('~%stest.xml' % tmpdir.sep, None)
+    xml_tilde = LogXML("~%stest.xml" % tmpdir.sep, None)
     assert xml_tilde.logfile == home_tilde
 
     # this is here for when $HOME is not set correct
     monkeypatch.setenv("HOME", tmpdir)
-    home_var = os.path.normpath(os.path.expandvars('$HOME/test.xml'))
+    home_var = os.path.normpath(os.path.expandvars("$HOME/test.xml"))
 
-    xml_var = LogXML('$HOME%stest.xml' % tmpdir.sep, None)
+    xml_var = LogXML("$HOME%stest.xml" % tmpdir.sep, None)
     assert xml_var.logfile == home_var
 
 
 def test_logxml_changingdir(testdir):
-    testdir.makepyfile("""
+    testdir.makepyfile(
+        """
         def test_func():
             import os
             os.chdir("a")
-    """)
+    """
+    )
     testdir.tmpdir.mkdir("a")
     result = testdir.runpytest("--junitxml=a/x.xml")
     assert result.ret == 0
     assert testdir.tmpdir.join("a/x.xml").check()
 
 
 def test_logxml_makedir(testdir):
     """--junitxml should automatically create directories for the xml file"""
-    testdir.makepyfile("""
+    testdir.makepyfile(
+        """
         def test_pass():
             pass
-    """)
+    """
+    )
     result = testdir.runpytest("--junitxml=path/to/results.xml")
     assert result.ret == 0
     assert testdir.tmpdir.join("path/to/results.xml").check()
 
 
 def test_logxml_check_isdir(testdir):
     """Give an error if --junit-xml is a directory (#2089)"""
     result = testdir.runpytest("--junit-xml=.")
     result.stderr.fnmatch_lines(["*--junitxml must be a filename*"])
 
 
 def test_escaped_parametrized_names_xml(testdir):
-    testdir.makepyfile("""
+    testdir.makepyfile(
+        """
         import pytest
         @pytest.mark.parametrize('char', [u"\\x00"])
         def test_func(char):
             assert char
-    """)
+    """
+    )
     result, dom = runandparse(testdir)
     assert result.ret == 0
     node = dom.find_first_by_tag("testcase")
     node.assert_attr(name="test_func[\\x00]")
 
 
 def test_double_colon_split_function_issue469(testdir):
-    testdir.makepyfile("""
+    testdir.makepyfile(
+        """
         import pytest
         @pytest.mark.parametrize('param', ["double::colon"])
         def test_func(param):
             pass
-    """)
+    """
+    )
     result, dom = runandparse(testdir)
     assert result.ret == 0
     node = dom.find_first_by_tag("testcase")
     node.assert_attr(classname="test_double_colon_split_function_issue469")
-    node.assert_attr(name='test_func[double::colon]')
+    node.assert_attr(name="test_func[double::colon]")
 
 
 def test_double_colon_split_method_issue469(testdir):
-    testdir.makepyfile("""
+    testdir.makepyfile(
+        """
         import pytest
         class TestClass(object):
             @pytest.mark.parametrize('param', ["double::colon"])
             def test_func(self, param):
                 pass
-    """)
+    """
+    )
     result, dom = runandparse(testdir)
     assert result.ret == 0
     node = dom.find_first_by_tag("testcase")
-    node.assert_attr(
-        classname="test_double_colon_split_method_issue469.TestClass")
-    node.assert_attr(name='test_func[double::colon]')
+    node.assert_attr(classname="test_double_colon_split_method_issue469.TestClass")
+    node.assert_attr(name="test_func[double::colon]")
 
 
 def test_unicode_issue368(testdir):
     path = testdir.tmpdir.join("test.xml")
     log = LogXML(str(path), None)
     ustr = py.builtin._totext("ВНИ!", "utf-8")
     from _pytest.runner import BaseReport
 
     class Report(BaseReport):
         longrepr = ustr
         sections = []
         nodeid = "something"
-        location = 'tests/filename.py', 42, 'TestClass.method'
+        location = "tests/filename.py", 42, "TestClass.method"
 
     test_report = Report()
 
     # hopefully this is not too brittle ...
     log.pytest_sessionstart()
     node_reporter = log._opentestcase(test_report)
     node_reporter.append_failure(test_report)
     node_reporter.append_collect_error(test_report)
@@ -837,106 +966,133 @@ def test_unicode_issue368(testdir):
     test_report.longrepr = "filename", 1, "Skipped: 卡嘣嘣"
     node_reporter.append_skipped(test_report)
     test_report.wasxfail = ustr
     node_reporter.append_skipped(test_report)
     log.pytest_sessionfinish()
 
 
 def test_record_property(testdir):
-    testdir.makepyfile("""
+    testdir.makepyfile(
+        """
         import pytest
 
         @pytest.fixture
-        def other(record_xml_property):
-            record_xml_property("bar", 1)
-        def test_record(record_xml_property, other):
-            record_xml_property("foo", "<1");
-    """)
-    result, dom = runandparse(testdir, '-rw')
+        def other(record_property):
+            record_property("bar", 1)
+        def test_record(record_property, other):
+            record_property("foo", "<1");
+    """
+    )
+    result, dom = runandparse(testdir, "-rwv")
     node = dom.find_first_by_tag("testsuite")
     tnode = node.find_first_by_tag("testcase")
-    psnode = tnode.find_first_by_tag('properties')
-    pnodes = psnode.find_by_tag('property')
+    psnode = tnode.find_first_by_tag("properties")
+    pnodes = psnode.find_by_tag("property")
     pnodes[0].assert_attr(name="bar", value="1")
     pnodes[1].assert_attr(name="foo", value="<1")
-    result.stdout.fnmatch_lines([
-        'test_record_property.py::test_record',
-        '*record_xml_property*experimental*',
-    ])
 
 
 def test_record_property_same_name(testdir):
-    testdir.makepyfile("""
-        def test_record_with_same_name(record_xml_property):
-            record_xml_property("foo", "bar")
-            record_xml_property("foo", "baz")
-    """)
-    result, dom = runandparse(testdir, '-rw')
+    testdir.makepyfile(
+        """
+        def test_record_with_same_name(record_property):
+            record_property("foo", "bar")
+            record_property("foo", "baz")
+    """
+    )
+    result, dom = runandparse(testdir, "-rw")
     node = dom.find_first_by_tag("testsuite")
     tnode = node.find_first_by_tag("testcase")
-    psnode = tnode.find_first_by_tag('properties')
-    pnodes = psnode.find_by_tag('property')
+    psnode = tnode.find_first_by_tag("properties")
+    pnodes = psnode.find_by_tag("property")
     pnodes[0].assert_attr(name="foo", value="bar")
     pnodes[1].assert_attr(name="foo", value="baz")
 
 
+def test_record_attribute(testdir):
+    testdir.makepyfile(
+        """
+        import pytest
+
+        @pytest.fixture
+        def other(record_xml_attribute):
+            record_xml_attribute("bar", 1)
+        def test_record(record_xml_attribute, other):
+            record_xml_attribute("foo", "<1");
+    """
+    )
+    result, dom = runandparse(testdir, "-rw")
+    node = dom.find_first_by_tag("testsuite")
+    tnode = node.find_first_by_tag("testcase")
+    tnode.assert_attr(bar="1")
+    tnode.assert_attr(foo="<1")
+    result.stdout.fnmatch_lines(
+        ["test_record_attribute.py::test_record", "*record_xml_attribute*experimental*"]
+    )
+
+
 def test_random_report_log_xdist(testdir):
     """xdist calls pytest_runtest_logreport as they are executed by the slaves,
     with nodes from several nodes overlapping, so junitxml must cope with that
     to produce correct reports. #1064
     """
-    pytest.importorskip('xdist')
-    testdir.makepyfile("""
+    pytest.importorskip("xdist")
+    testdir.makepyfile(
+        """
         import pytest, time
         @pytest.mark.parametrize('i', list(range(30)))
         def test_x(i):
             assert i != 22
-    """)
-    _, dom = runandparse(testdir, '-n2')
+    """
+    )
+    _, dom = runandparse(testdir, "-n2")
     suite_node = dom.find_first_by_tag("testsuite")
     failed = []
     for case_node in suite_node.find_by_tag("testcase"):
-        if case_node.find_first_by_tag('failure'):
-            failed.append(case_node['name'])
+        if case_node.find_first_by_tag("failure"):
+            failed.append(case_node["name"])
 
-    assert failed == ['test_x[22]']
+    assert failed == ["test_x[22]"]
 
 
 def test_runs_twice(testdir):
-    f = testdir.makepyfile('''
+    f = testdir.makepyfile(
+        """
         def test_pass():
             pass
-    ''')
+    """
+    )
 
     result, dom = runandparse(testdir, f, f)
-    assert 'INTERNALERROR' not in result.stdout.str()
-    first, second = [x['classname'] for x in dom.find_by_tag("testcase")]
+    assert "INTERNALERROR" not in result.stdout.str()
+    first, second = [x["classname"] for x in dom.find_by_tag("testcase")]
     assert first == second
 
 
-@pytest.mark.xfail(reason='hangs', run=False)
+@pytest.mark.xfail(reason="hangs", run=False)
 def test_runs_twice_xdist(testdir):
-    pytest.importorskip('xdist')
-    f = testdir.makepyfile('''
+    pytest.importorskip("xdist")
+    f = testdir.makepyfile(
+        """
         def test_pass():
             pass
-    ''')
+    """
+    )
 
-    result, dom = runandparse(
-        testdir, f,
-        '--dist', 'each', '--tx', '2*popen',)
-    assert 'INTERNALERROR' not in result.stdout.str()
-    first, second = [x['classname'] for x in dom.find_by_tag("testcase")]
+    result, dom = runandparse(testdir, f, "--dist", "each", "--tx", "2*popen")
+    assert "INTERNALERROR" not in result.stdout.str()
+    first, second = [x["classname"] for x in dom.find_by_tag("testcase")]
     assert first == second
 
 
 def test_fancy_items_regression(testdir):
     # issue 1259
-    testdir.makeconftest("""
+    testdir.makeconftest(
+        """
         import pytest
         class FunItem(pytest.Item):
             def runtest(self):
                 pass
         class NoFunItem(pytest.Item):
             def runtest(self):
                 pass
 
@@ -946,117 +1102,130 @@ def test_fancy_items_regression(testdir)
                     FunItem('a', self),
                     NoFunItem('a', self),
                     NoFunItem('b', self),
                 ]
 
         def pytest_collect_file(path, parent):
             if path.check(ext='.py'):
                 return FunCollector(path, parent)
-    """)
+    """
+    )
 
-    testdir.makepyfile('''
+    testdir.makepyfile(
+        """
         def test_pass():
             pass
-    ''')
+    """
+    )
 
     result, dom = runandparse(testdir)
 
-    assert 'INTERNALERROR' not in result.stdout.str()
+    assert "INTERNALERROR" not in result.stdout.str()
 
     items = sorted(
-        '%(classname)s %(name)s %(file)s' % x
+        "%(classname)s %(name)s %(file)s" % x for x in dom.find_by_tag("testcase")
+    )
+    import pprint
 
-        for x in dom.find_by_tag("testcase"))
-    import pprint
     pprint.pprint(items)
-    assert items == [
-        u'conftest a conftest.py',
-        u'conftest a conftest.py',
-        u'conftest b conftest.py',
-        u'test_fancy_items_regression a test_fancy_items_regression.py',
-        u'test_fancy_items_regression a test_fancy_items_regression.py',
-        u'test_fancy_items_regression b test_fancy_items_regression.py',
-        u'test_fancy_items_regression test_pass'
-        u' test_fancy_items_regression.py',
-    ]
+    assert (
+        items
+        == [
+            u"conftest a conftest.py",
+            u"conftest a conftest.py",
+            u"conftest b conftest.py",
+            u"test_fancy_items_regression a test_fancy_items_regression.py",
+            u"test_fancy_items_regression a test_fancy_items_regression.py",
+            u"test_fancy_items_regression b test_fancy_items_regression.py",
+            u"test_fancy_items_regression test_pass" u" test_fancy_items_regression.py",
+        ]
+    )
 
 
 def test_global_properties(testdir):
     path = testdir.tmpdir.join("test_global_properties.xml")
     log = LogXML(str(path), None)
     from _pytest.runner import BaseReport
 
     class Report(BaseReport):
         sections = []
         nodeid = "test_node_id"
 
     log.pytest_sessionstart()
-    log.add_global_property('foo', 1)
-    log.add_global_property('bar', 2)
+    log.add_global_property("foo", 1)
+    log.add_global_property("bar", 2)
     log.pytest_sessionfinish()
 
     dom = minidom.parse(str(path))
 
-    properties = dom.getElementsByTagName('properties')
+    properties = dom.getElementsByTagName("properties")
 
-    assert (properties.length == 1), "There must be one <properties> node"
+    assert properties.length == 1, "There must be one <properties> node"
 
-    property_list = dom.getElementsByTagName('property')
+    property_list = dom.getElementsByTagName("property")
 
-    assert (property_list.length == 2), "There most be only 2 property nodes"
+    assert property_list.length == 2, "There most be only 2 property nodes"
 
-    expected = {'foo': '1', 'bar': '2'}
+    expected = {"foo": "1", "bar": "2"}
     actual = {}
 
     for p in property_list:
-        k = str(p.getAttribute('name'))
-        v = str(p.getAttribute('value'))
+        k = str(p.getAttribute("name"))
+        v = str(p.getAttribute("value"))
         actual[k] = v
 
     assert actual == expected
 
 
 def test_url_property(testdir):
     test_url = "http://www.github.com/pytest-dev"
     path = testdir.tmpdir.join("test_url_property.xml")
     log = LogXML(str(path), None)
     from _pytest.runner import BaseReport
 
     class Report(BaseReport):
         longrepr = "FooBarBaz"
         sections = []
         nodeid = "something"
-        location = 'tests/filename.py', 42, 'TestClass.method'
+        location = "tests/filename.py", 42, "TestClass.method"
         url = test_url
 
     test_report = Report()
 
     log.pytest_sessionstart()
     node_reporter = log._opentestcase(test_report)
     node_reporter.append_failure(test_report)
     log.pytest_sessionfinish()
 
-    test_case = minidom.parse(str(path)).getElementsByTagName('testcase')[0]
+    test_case = minidom.parse(str(path)).getElementsByTagName("testcase")[0]
 
-    assert (test_case.getAttribute('url') == test_url), "The URL did not get written to the xml"
+    assert (
+        test_case.getAttribute("url") == test_url
+    ), "The URL did not get written to the xml"
 
 
-@pytest.mark.parametrize('suite_name', ['my_suite', ''])
+@pytest.mark.parametrize("suite_name", ["my_suite", ""])
 def test_set_suite_name(testdir, suite_name):
     if suite_name:
-        testdir.makeini("""
+        testdir.makeini(
+            """
             [pytest]
-            junit_suite_name={0}
-        """.format(suite_name))
+            junit_suite_name={}
+        """.format(
+                suite_name
+            )
+        )
         expected = suite_name
     else:
-        expected = 'pytest'
-    testdir.makepyfile("""
+        expected = "pytest"
+    testdir.makepyfile(
+        """
         import pytest
 
         def test_func():
             pass
-    """)
+    """
+    )
     result, dom = runandparse(testdir)
     assert result.ret == 0
     node = dom.find_first_by_tag("testsuite")
     node.assert_attr(name=expected)
--- a/third_party/python/pytest/testing/test_mark.py
+++ b/third_party/python/pytest/testing/test_mark.py
@@ -1,833 +1,1037 @@
 from __future__ import absolute_import, division, print_function
 import os
 import sys
-
+import mock
 import pytest
-from _pytest.mark import MarkGenerator as Mark, ParameterSet, transfer_markers
+from _pytest.mark import (
+    MarkGenerator as Mark,
+    ParameterSet,
+    transfer_markers,
+    EMPTY_PARAMETERSET_OPTION,
+)
+from _pytest.nodes import Node
+
+ignore_markinfo = pytest.mark.filterwarnings(
+    "ignore:MarkInfo objects:_pytest.deprecated.RemovedInPytest4Warning"
+)
 
 
 class TestMark(object):
+
     def test_markinfo_repr(self):
         from _pytest.mark import MarkInfo, Mark
-        m = MarkInfo(Mark("hello", (1, 2), {}))
+
+        m = MarkInfo.for_mark(Mark("hello", (1, 2), {}))
         repr(m)
 
-    @pytest.mark.parametrize('attr', ['mark', 'param'])
-    @pytest.mark.parametrize('modulename', ['py.test', 'pytest'])
+    @pytest.mark.parametrize("attr", ["mark", "param"])
+    @pytest.mark.parametrize("modulename", ["py.test", "pytest"])
     def test_pytest_exists_in_namespace_all(self, attr, modulename):
         module = sys.modules[modulename]
         assert attr in module.__all__
 
     def test_pytest_mark_notcallable(self):
         mark = Mark()
         pytest.raises((AttributeError, TypeError), mark)
 
     def test_mark_with_param(self):
+
         def some_function(abc):
             pass
 
         class SomeClass(object):
             pass
 
         assert pytest.mark.fun(some_function) is some_function
         assert pytest.mark.fun.with_args(some_function) is not some_function
 
         assert pytest.mark.fun(SomeClass) is SomeClass
         assert pytest.mark.fun.with_args(SomeClass) is not SomeClass
 
     def test_pytest_mark_name_starts_with_underscore(self):
         mark = Mark()
-        pytest.raises(AttributeError, getattr, mark, '_some_name')
+        pytest.raises(AttributeError, getattr, mark, "_some_name")
 
     def test_pytest_mark_bare(self):
         mark = Mark()
 
         def f():
             pass
 
         mark.hello(f)
         assert f.hello
 
+    @ignore_markinfo
     def test_pytest_mark_keywords(self):
         mark = Mark()
 
         def f():
             pass
 
         mark.world(x=3, y=4)(f)
         assert f.world
-        assert f.world.kwargs['x'] == 3
-        assert f.world.kwargs['y'] == 4
+        assert f.world.kwargs["x"] == 3
+        assert f.world.kwargs["y"] == 4
 
+    @ignore_markinfo
     def test_apply_multiple_and_merge(self):
         mark = Mark()
 
         def f():
             pass
 
         mark.world
         mark.world(x=3)(f)
-        assert f.world.kwargs['x'] == 3
+        assert f.world.kwargs["x"] == 3
         mark.world(y=4)(f)
-        assert f.world.kwargs['x'] == 3
-        assert f.world.kwargs['y'] == 4
+        assert f.world.kwargs["x"] == 3
+        assert f.world.kwargs["y"] == 4
         mark.world(y=1)(f)
-        assert f.world.kwargs['y'] == 1
+        assert f.world.kwargs["y"] == 1
         assert len(f.world.args) == 0
 
+    @ignore_markinfo
     def test_pytest_mark_positional(self):
         mark = Mark()
 
         def f():
             pass
 
         mark.world("hello")(f)
         assert f.world.args[0] == "hello"
         mark.world("world")(f)
 
+    @ignore_markinfo
     def test_pytest_mark_positional_func_and_keyword(self):
         mark = Mark()
 
         def f():
             raise Exception
 
         m = mark.world(f, omega="hello")
 
         def g():
             pass
 
         assert m(g) == g
         assert g.world.args[0] is f
         assert g.world.kwargs["omega"] == "hello"
 
+    @ignore_markinfo
     def test_pytest_mark_reuse(self):
         mark = Mark()
 
         def f():
             pass
 
         w = mark.some
         w("hello", reason="123")(f)
         assert f.some.args[0] == "hello"
-        assert f.some.kwargs['reason'] == "123"
+        assert f.some.kwargs["reason"] == "123"
 
         def g():
             pass
 
         w("world", reason2="456")(g)
         assert g.some.args[0] == "world"
-        assert 'reason' not in g.some.kwargs
-        assert g.some.kwargs['reason2'] == "456"
+        assert "reason" not in g.some.kwargs
+        assert g.some.kwargs["reason2"] == "456"
 
 
 def test_marked_class_run_twice(testdir, request):
     """Test fails file is run twice that contains marked class.
     See issue#683.
     """
-    py_file = testdir.makepyfile("""
+    py_file = testdir.makepyfile(
+        """
     import pytest
     @pytest.mark.parametrize('abc', [1, 2, 3])
     class Test1(object):
         def test_1(self, abc):
             assert abc in [1, 2, 3]
-    """)
+    """
+    )
     file_name = os.path.basename(py_file.strpath)
     rec = testdir.inline_run(file_name, file_name)
     rec.assertoutcome(passed=6)
 
 
 def test_ini_markers(testdir):
-    testdir.makeini("""
+    testdir.makeini(
+        """
         [pytest]
         markers =
             a1: this is a webtest marker
             a2: this is a smoke marker
-    """)
-    testdir.makepyfile("""
+    """
+    )
+    testdir.makepyfile(
+        """
         def test_markers(pytestconfig):
             markers = pytestconfig.getini("markers")
             print (markers)
             assert len(markers) >= 2
             assert markers[0].startswith("a1:")
             assert markers[1].startswith("a2:")
-    """)
+    """
+    )
     rec = testdir.inline_run()
     rec.assertoutcome(passed=1)
 
 
 def test_markers_option(testdir):
-    testdir.makeini("""
+    testdir.makeini(
+        """
         [pytest]
         markers =
             a1: this is a webtest marker
             a1some: another marker
-    """)
-    result = testdir.runpytest("--markers", )
-    result.stdout.fnmatch_lines([
-        "*a1*this is a webtest*",
-        "*a1some*another marker",
-    ])
+            nodescription
+    """
+    )
+    result = testdir.runpytest("--markers")
+    result.stdout.fnmatch_lines(
+        ["*a1*this is a webtest*", "*a1some*another marker", "*nodescription*"]
+    )
 
 
 def test_ini_markers_whitespace(testdir):
-    testdir.makeini("""
+    testdir.makeini(
+        """
         [pytest]
         markers =
             a1 : this is a whitespace marker
-    """)
-    testdir.makepyfile("""
+    """
+    )
+    testdir.makepyfile(
+        """
         import pytest
 
         @pytest.mark.a1
         def test_markers():
             assert True
-    """)
+    """
+    )
     rec = testdir.inline_run("--strict", "-m", "a1")
     rec.assertoutcome(passed=1)
 
 
+def test_marker_without_description(testdir):
+    testdir.makefile(
+        ".cfg",
+        setup="""
+        [tool:pytest]
+        markers=slow
+    """,
+    )
+    testdir.makeconftest(
+        """
+        import pytest
+        pytest.mark.xfail('FAIL')
+    """
+    )
+    ftdir = testdir.mkdir("ft1_dummy")
+    testdir.tmpdir.join("conftest.py").move(ftdir.join("conftest.py"))
+    rec = testdir.runpytest_subprocess("--strict")
+    rec.assert_outcomes()
+
+
 def test_markers_option_with_plugin_in_current_dir(testdir):
     testdir.makeconftest('pytest_plugins = "flip_flop"')
-    testdir.makepyfile(flip_flop="""\
+    testdir.makepyfile(
+        flip_flop="""\
         def pytest_configure(config):
             config.addinivalue_line("markers", "flip:flop")
 
         def pytest_generate_tests(metafunc):
             try:
                 mark = metafunc.function.flipper
             except AttributeError:
                 return
-            metafunc.parametrize("x", (10, 20))""")
-    testdir.makepyfile("""\
+            metafunc.parametrize("x", (10, 20))"""
+    )
+    testdir.makepyfile(
+        """\
         import pytest
         @pytest.mark.flipper
         def test_example(x):
-            assert x""")
+            assert x"""
+    )
 
     result = testdir.runpytest("--markers")
     result.stdout.fnmatch_lines(["*flip*flop*"])
 
 
 def test_mark_on_pseudo_function(testdir):
-    testdir.makepyfile("""
+    testdir.makepyfile(
+        """
         import pytest
 
         @pytest.mark.r(lambda x: 0/0)
         def test_hello():
             pass
-    """)
+    """
+    )
     reprec = testdir.inline_run()
     reprec.assertoutcome(passed=1)
 
 
 def test_strict_prohibits_unregistered_markers(testdir):
-    testdir.makepyfile("""
+    testdir.makepyfile(
+        """
         import pytest
         @pytest.mark.unregisteredmark
         def test_hello():
             pass
-    """)
+    """
+    )
     result = testdir.runpytest("--strict")
     assert result.ret != 0
-    result.stdout.fnmatch_lines([
-        "*unregisteredmark*not*registered*",
-    ])
+    result.stdout.fnmatch_lines(["*unregisteredmark*not*registered*"])
 
 
-@pytest.mark.parametrize("spec", [
-    ("xyz", ("test_one",)),
-    ("xyz and xyz2", ()),
-    ("xyz2", ("test_two",)),
-    ("xyz or xyz2", ("test_one", "test_two"),)
-])
+@pytest.mark.parametrize(
+    "spec",
+    [
+        ("xyz", ("test_one",)),
+        ("xyz and xyz2", ()),
+        ("xyz2", ("test_two",)),
+        ("xyz or xyz2", ("test_one", "test_two")),
+    ],
+)
 def test_mark_option(spec, testdir):
-    testdir.makepyfile("""
+    testdir.makepyfile(
+        """
         import pytest
         @pytest.mark.xyz
         def test_one():
             pass
         @pytest.mark.xyz2
         def test_two():
             pass
-    """)
+    """
+    )
+    opt, passed_result = spec
+    rec = testdir.inline_run("-m", opt)
+    passed, skipped, fail = rec.listoutcomes()
+    passed = [x.nodeid.split("::")[-1] for x in passed]
+    assert len(passed) == len(passed_result)
+    assert list(passed) == list(passed_result)
+
+
+@pytest.mark.parametrize(
+    "spec", [("interface", ("test_interface",)), ("not interface", ("test_nointer",))]
+)
+def test_mark_option_custom(spec, testdir):
+    testdir.makeconftest(
+        """
+        import pytest
+        def pytest_collection_modifyitems(items):
+            for item in items:
+                if "interface" in item.nodeid:
+                    item.add_marker(pytest.mark.interface)
+    """
+    )
+    testdir.makepyfile(
+        """
+        def test_interface():
+            pass
+        def test_nointer():
+            pass
+    """
+    )
     opt, passed_result = spec
     rec = testdir.inline_run("-m", opt)
     passed, skipped, fail = rec.listoutcomes()
     passed = [x.nodeid.split("::")[-1] for x in passed]
     assert len(passed) == len(passed_result)
     assert list(passed) == list(passed_result)
 
 
-@pytest.mark.parametrize("spec", [
-    ("interface", ("test_interface",)),
-    ("not interface", ("test_nointer",)),
-])
-def test_mark_option_custom(spec, testdir):
-    testdir.makeconftest("""
-        import pytest
-        def pytest_collection_modifyitems(items):
-            for item in items:
-                if "interface" in item.nodeid:
-                    item.keywords["interface"] = pytest.mark.interface
-    """)
-    testdir.makepyfile("""
+@pytest.mark.parametrize(
+    "spec",
+    [
+        ("interface", ("test_interface",)),
+        ("not interface", ("test_nointer", "test_pass")),
+        ("pass", ("test_pass",)),
+        ("not pass", ("test_interface", "test_nointer")),
+    ],
+)
+def test_keyword_option_custom(spec, testdir):
+    testdir.makepyfile(
+        """
         def test_interface():
             pass
         def test_nointer():
             pass
-    """)
+        def test_pass():
+            pass
+    """
+    )
     opt, passed_result = spec
-    rec = testdir.inline_run("-m", opt)
+    rec = testdir.inline_run("-k", opt)
     passed, skipped, fail = rec.listoutcomes()
     passed = [x.nodeid.split("::")[-1] for x in passed]
     assert len(passed) == len(passed_result)
     assert list(passed) == list(passed_result)
 
 
-@pytest.mark.parametrize("spec", [
-    ("interface", ("test_interface",)),
-    ("not interface", ("test_nointer", "test_pass")),
-    ("pass", ("test_pass",)),
-    ("not pass", ("test_interface", "test_nointer")),
-])
-def test_keyword_option_custom(spec, testdir):
-    testdir.makepyfile("""
-        def test_interface():
+@pytest.mark.parametrize(
+    "spec",
+    [
+        ("None", ("test_func[None]",)),
+        ("1.3", ("test_func[1.3]",)),
+        ("2-3", ("test_func[2-3]",)),
+    ],
+)
+def test_keyword_option_parametrize(spec, testdir):
+    testdir.makepyfile(
+        """
+        import pytest
+        @pytest.mark.parametrize("arg", [None, 1.3, "2-3"])
+        def test_func(arg):
             pass
-        def test_nointer():
-            pass
-        def test_pass():
-            pass
-    """)
+    """
+    )
     opt, passed_result = spec
     rec = testdir.inline_run("-k", opt)
     passed, skipped, fail = rec.listoutcomes()
     passed = [x.nodeid.split("::")[-1] for x in passed]
     assert len(passed) == len(passed_result)
     assert list(passed) == list(passed_result)
 
 
-@pytest.mark.parametrize("spec", [
-    ("None", ("test_func[None]",)),
-    ("1.3", ("test_func[1.3]",)),
-    ("2-3", ("test_func[2-3]",))
-])
-def test_keyword_option_parametrize(spec, testdir):
-    testdir.makepyfile("""
-        import pytest
-        @pytest.mark.parametrize("arg", [None, 1.3, "2-3"])
-        def test_func(arg):
-            pass
-    """)
-    opt, passed_result = spec
-    rec = testdir.inline_run("-k", opt)
-    passed, skipped, fail = rec.listoutcomes()
-    passed = [x.nodeid.split("::")[-1] for x in passed]
-    assert len(passed) == len(passed_result)
-    assert list(passed) == list(passed_result)
+@pytest.mark.parametrize(
+    "spec",
+    [
+        (
+            "foo or import",
+            "ERROR: Python keyword 'import' not accepted in expressions passed to '-k'",
+        ),
+        ("foo or", "ERROR: Wrong expression passed to '-k': foo or"),
+    ],
+)
+def test_keyword_option_wrong_arguments(spec, testdir, capsys):
+    testdir.makepyfile(
+        """
+            def test_func(arg):
+                pass
+        """
+    )
+    opt, expected_result = spec
+    testdir.inline_run("-k", opt)
+    out = capsys.readouterr().err
+    assert expected_result in out
 
 
 def test_parametrized_collected_from_command_line(testdir):
     """Parametrized test not collected if test named specified
        in command line issue#649.
     """
-    py_file = testdir.makepyfile("""
+    py_file = testdir.makepyfile(
+        """
         import pytest
         @pytest.mark.parametrize("arg", [None, 1.3, "2-3"])
         def test_func(arg):
             pass
-    """)
+    """
+    )
     file_name = os.path.basename(py_file.strpath)
     rec = testdir.inline_run(file_name + "::" + "test_func")
     rec.assertoutcome(passed=3)
 
 
 def test_parametrized_collect_with_wrong_args(testdir):
     """Test collect parametrized func with wrong number of args."""
-    py_file = testdir.makepyfile("""
+    py_file = testdir.makepyfile(
+        """
         import pytest
 
         @pytest.mark.parametrize('foo, bar', [(1, 2, 3)])
         def test_func(foo, bar):
             pass
-    """)
+    """
+    )
 
     result = testdir.runpytest(py_file)
-    result.stdout.fnmatch_lines([
-        'E   ValueError: In "parametrize" the number of values ((1, 2, 3)) '
-        'must be equal to the number of names ([\'foo\', \'bar\'])'
-    ])
+    result.stdout.fnmatch_lines(
+        [
+            'E   ValueError: In "parametrize" the number of values ((1, 2, 3)) '
+            "must be equal to the number of names (['foo', 'bar'])"
+        ]
+    )
 
 
 def test_parametrized_with_kwargs(testdir):
     """Test collect parametrized func with wrong number of args."""
-    py_file = testdir.makepyfile("""
+    py_file = testdir.makepyfile(
+        """
         import pytest
 
         @pytest.fixture(params=[1,2])
         def a(request):
             return request.param
 
         @pytest.mark.parametrize(argnames='b', argvalues=[1, 2])
         def test_func(a, b):
             pass
-    """)
+    """
+    )
 
     result = testdir.runpytest(py_file)
-    assert(result.ret == 0)
+    assert result.ret == 0
 
 
 class TestFunctional(object):
 
     def test_mark_per_function(self, testdir):
-        p = testdir.makepyfile("""
+        p = testdir.makepyfile(
+            """
             import pytest
             @pytest.mark.hello
             def test_hello():
                 assert hasattr(test_hello, 'hello')
-        """)
+        """
+        )
         result = testdir.runpytest(p)
         result.stdout.fnmatch_lines(["*1 passed*"])
 
     def test_mark_per_module(self, testdir):
-        item = testdir.getitem("""
+        item = testdir.getitem(
+            """
             import pytest
             pytestmark = pytest.mark.hello
             def test_func():
                 pass
-        """)
+        """
+        )
         keywords = item.keywords
-        assert 'hello' in keywords
+        assert "hello" in keywords
 
     def test_marklist_per_class(self, testdir):
-        item = testdir.getitem("""
+        item = testdir.getitem(
+            """
             import pytest
             class TestClass(object):
                 pytestmark = [pytest.mark.hello, pytest.mark.world]
                 def test_func(self):
                     assert TestClass.test_func.hello
                     assert TestClass.test_func.world
-        """)
+        """
+        )
         keywords = item.keywords
-        assert 'hello' in keywords
+        assert "hello" in keywords
 
     def test_marklist_per_module(self, testdir):
-        item = testdir.getitem("""
+        item = testdir.getitem(
+            """
             import pytest
             pytestmark = [pytest.mark.hello, pytest.mark.world]
             class TestClass(object):
                 def test_func(self):
                     assert TestClass.test_func.hello
                     assert TestClass.test_func.world
-        """)
+        """
+        )
         keywords = item.keywords
-        assert 'hello' in keywords
-        assert 'world' in keywords
+        assert "hello" in keywords
+        assert "world" in keywords
 
     def test_mark_per_class_decorator(self, testdir):
-        item = testdir.getitem("""
+        item = testdir.getitem(
+            """
             import pytest
             @pytest.mark.hello
             class TestClass(object):
                 def test_func(self):
                     assert TestClass.test_func.hello
-        """)
+        """
+        )
         keywords = item.keywords
-        assert 'hello' in keywords
+        assert "hello" in keywords
 
     def test_mark_per_class_decorator_plus_existing_dec(self, testdir):
-        item = testdir.getitem("""
+        item = testdir.getitem(
+            """
             import pytest
             @pytest.mark.hello
             class TestClass(object):
                 pytestmark = pytest.mark.world
                 def test_func(self):
                     assert TestClass.test_func.hello
                     assert TestClass.test_func.world
-        """)
+        """
+        )
         keywords = item.keywords
-        assert 'hello' in keywords
-        assert 'world' in keywords
+        assert "hello" in keywords
+        assert "world" in keywords
 
+    @ignore_markinfo
     def test_merging_markers(self, testdir):
-        p = testdir.makepyfile("""
+        p = testdir.makepyfile(
+            """
             import pytest
             pytestmark = pytest.mark.hello("pos1", x=1, y=2)
             class TestClass(object):
                 # classlevel overrides module level
                 pytestmark = pytest.mark.hello(x=3)
                 @pytest.mark.hello("pos0", z=4)
                 def test_func(self):
                     pass
-        """)
+        """
+        )
         items, rec = testdir.inline_genitems(p)
         item, = items
         keywords = item.keywords
-        marker = keywords['hello']
+        marker = keywords["hello"]
         assert marker.args == ("pos0", "pos1")
-        assert marker.kwargs == {'x': 1, 'y': 2, 'z': 4}
+        assert marker.kwargs == {"x": 1, "y": 2, "z": 4}
 
         # test the new __iter__ interface
         values = list(marker)
         assert len(values) == 3
         assert values[0].args == ("pos0",)
         assert values[1].args == ()
-        assert values[2].args == ("pos1", )
+        assert values[2].args == ("pos1",)
 
-    @pytest.mark.xfail(reason='unfixed')
     def test_merging_markers_deep(self, testdir):
         # issue 199 - propagate markers into nested classes
-        p = testdir.makepyfile("""
+        p = testdir.makepyfile(
+            """
             import pytest
             class TestA(object):
                 pytestmark = pytest.mark.a
                 def test_b(self):
                     assert True
                 class TestC(object):
                     # this one didnt get marked
                     def test_d(self):
                         assert True
-        """)
+        """
+        )
         items, rec = testdir.inline_genitems(p)
         for item in items:
             print(item, item.keywords)
-            assert 'a' in item.keywords
+            assert [x for x in item.iter_markers() if x.name == "a"]
 
     def test_mark_decorator_subclass_does_not_propagate_to_base(self, testdir):
-        p = testdir.makepyfile("""
+        p = testdir.makepyfile(
+            """
             import pytest
 
             @pytest.mark.a
             class Base(object): pass
 
             @pytest.mark.b
             class Test1(Base):
                 def test_foo(self): pass
 
             class Test2(Base):
                 def test_bar(self): pass
-        """)
+        """
+        )
         items, rec = testdir.inline_genitems(p)
-        self.assert_markers(items, test_foo=('a', 'b'), test_bar=('a',))
+        self.assert_markers(items, test_foo=("a", "b"), test_bar=("a",))
 
     @pytest.mark.issue568
-    @pytest.mark.xfail(reason="markers smear on methods of base classes")
     def test_mark_should_not_pass_to_siebling_class(self, testdir):
-        p = testdir.makepyfile("""
+        p = testdir.makepyfile(
+            """
             import pytest
 
             class TestBase(object):
                 def test_foo(self):
                     pass
 
             @pytest.mark.b
             class TestSub(TestBase):
                 pass
 
 
             class TestOtherSub(TestBase):
                 pass
 
-        """)
+        """
+        )
         items, rec = testdir.inline_genitems(p)
         base_item, sub_item, sub_item_other = items
-        assert not hasattr(base_item.obj, 'b')
-        assert not hasattr(sub_item_other.obj, 'b')
+        print(items, [x.nodeid for x in items])
+        # legacy api smears
+        assert hasattr(base_item.obj, "b")
+        assert hasattr(sub_item_other.obj, "b")
+        assert hasattr(sub_item.obj, "b")
+
+        # new api seregates
+        assert not list(base_item.iter_markers(name="b"))
+        assert not list(sub_item_other.iter_markers(name="b"))
+        assert list(sub_item.iter_markers(name="b"))
 
     def test_mark_decorator_baseclasses_merged(self, testdir):
-        p = testdir.makepyfile("""
+        p = testdir.makepyfile(
+            """
             import pytest
 
             @pytest.mark.a
             class Base(object): pass
 
             @pytest.mark.b
             class Base2(Base): pass
 
             @pytest.mark.c
             class Test1(Base2):
                 def test_foo(self): pass
 
             class Test2(Base2):
                 @pytest.mark.d
                 def test_bar(self): pass
-        """)
+        """
+        )
         items, rec = testdir.inline_genitems(p)
-        self.assert_markers(items, test_foo=('a', 'b', 'c'),
-                            test_bar=('a', 'b', 'd'))
+        self.assert_markers(items, test_foo=("a", "b", "c"), test_bar=("a", "b", "d"))
+
+    def test_mark_closest(self, testdir):
+        p = testdir.makepyfile(
+            """
+            import pytest
+
+            @pytest.mark.c(location="class")
+            class Test:
+                @pytest.mark.c(location="function")
+                def test_has_own():
+                    pass
+
+                def test_has_inherited():
+                    pass
+
+        """
+        )
+        items, rec = testdir.inline_genitems(p)
+        has_own, has_inherited = items
+        assert has_own.get_closest_marker("c").kwargs == {"location": "function"}
+        assert has_inherited.get_closest_marker("c").kwargs == {"location": "class"}
+        assert has_own.get_closest_marker("missing") is None
 
     def test_mark_with_wrong_marker(self, testdir):
-        reprec = testdir.inline_runsource("""
+        reprec = testdir.inline_runsource(
+            """
                 import pytest
                 class pytestmark(object):
                     pass
                 def test_func():
                     pass
-        """)
+        """
+        )
         values = reprec.getfailedcollections()
         assert len(values) == 1
         assert "TypeError" in str(values[0].longrepr)
 
     def test_mark_dynamically_in_funcarg(self, testdir):
-        testdir.makeconftest("""
+        testdir.makeconftest(
+            """
             import pytest
             @pytest.fixture
             def arg(request):
                 request.applymarker(pytest.mark.hello)
             def pytest_terminal_summary(terminalreporter):
                 values = terminalreporter.stats['passed']
-                terminalreporter.writer.line("keyword: %s" % values[0].keywords)
-        """)
-        testdir.makepyfile("""
+                terminalreporter._tw.line("keyword: %s" % values[0].keywords)
+        """
+        )
+        testdir.makepyfile(
+            """
             def test_func(arg):
                 pass
-        """)
+        """
+        )
         result = testdir.runpytest()
-        result.stdout.fnmatch_lines([
-            "keyword: *hello*"
-        ])
+        result.stdout.fnmatch_lines(["keyword: *hello*"])
 
+    @ignore_markinfo
     def test_merging_markers_two_functions(self, testdir):
-        p = testdir.makepyfile("""
+        p = testdir.makepyfile(
+            """
             import pytest
             @pytest.mark.hello("pos1", z=4)
             @pytest.mark.hello("pos0", z=3)
             def test_func():
                 pass
-        """)
+        """
+        )
         items, rec = testdir.inline_genitems(p)
         item, = items
         keywords = item.keywords
-        marker = keywords['hello']
+        marker = keywords["hello"]
         values = list(marker)
         assert len(values) == 2
         assert values[0].args == ("pos0",)
         assert values[1].args == ("pos1",)
 
     def test_no_marker_match_on_unmarked_names(self, testdir):
-        p = testdir.makepyfile("""
+        p = testdir.makepyfile(
+            """
             import pytest
             @pytest.mark.shouldmatch
             def test_marked():
                 assert 1
 
             def test_unmarked():
                 assert 1
-        """)
+        """
+        )
         reprec = testdir.inline_run("-m", "test_unmarked", p)
         passed, skipped, failed = reprec.listoutcomes()
         assert len(passed) + len(skipped) + len(failed) == 0
         dlist = reprec.getcalls("pytest_deselected")
         deselected_tests = dlist[0].items
         assert len(deselected_tests) == 2
 
     def test_keywords_at_node_level(self, testdir):
-        testdir.makepyfile("""
+        testdir.makepyfile(
+            """
             import pytest
             @pytest.fixture(scope="session", autouse=True)
             def some(request):
                 request.keywords["hello"] = 42
                 assert "world" not in request.keywords
 
             @pytest.fixture(scope="function", autouse=True)
             def funcsetup(request):
                 assert "world" in request.keywords
                 assert "hello" in  request.keywords
 
             @pytest.mark.world
             def test_function():
                 pass
-        """)
+        """
+        )
         reprec = testdir.inline_run()
         reprec.assertoutcome(passed=1)
 
+    @ignore_markinfo
     def test_keyword_added_for_session(self, testdir):
-        testdir.makeconftest("""
+        testdir.makeconftest(
+            """
             import pytest
             def pytest_collection_modifyitems(session):
                 session.add_marker("mark1")
                 session.add_marker(pytest.mark.mark2)
                 session.add_marker(pytest.mark.mark3)
                 pytest.raises(ValueError, lambda:
                         session.add_marker(10))
-        """)
-        testdir.makepyfile("""
+        """
+        )
+        testdir.makepyfile(
+            """
             def test_some(request):
                 assert "mark1" in request.keywords
                 assert "mark2" in request.keywords
                 assert "mark3" in request.keywords
                 assert 10 not in request.keywords
                 marker = request.node.get_marker("mark1")
                 assert marker.name == "mark1"
                 assert marker.args == ()
                 assert marker.kwargs == {}
-        """)
+        """
+        )
         reprec = testdir.inline_run("-m", "mark1")
         reprec.assertoutcome(passed=1)
 
     def assert_markers(self, items, **expected):
         """assert that given items have expected marker names applied to them.
         expected should be a dict of (item name -> seq of expected marker names)
 
         .. note:: this could be moved to ``testdir`` if proven to be useful
         to other modules.
         """
         from _pytest.mark import MarkInfo
-        items = dict((x.name, x) for x in items)
+
+        items = {x.name: x for x in items}
         for name, expected_markers in expected.items():
             markers = items[name].keywords._markers
-            marker_names = set([name for (name, v) in markers.items()
-                                if isinstance(v, MarkInfo)])
+            marker_names = {
+                name for (name, v) in markers.items() if isinstance(v, MarkInfo)
+            }
             assert marker_names == set(expected_markers)
 
-    @pytest.mark.xfail(reason='callspec2.setmulti misuses keywords')
     @pytest.mark.issue1540
+    @pytest.mark.filterwarnings("ignore")
     def test_mark_from_parameters(self, testdir):
-        testdir.makepyfile("""
+        testdir.makepyfile(
+            """
             import pytest
 
             pytestmark = pytest.mark.skipif(True, reason='skip all')
 
             # skipifs inside fixture params
             params = [pytest.mark.skipif(False, reason='dont skip')('parameter')]
 
 
             @pytest.fixture(params=params)
             def parameter(request):
                 return request.param
 
 
             def test_1(parameter):
                 assert True
-        """)
+        """
+        )
         reprec = testdir.inline_run()
         reprec.assertoutcome(skipped=1)
 
 
 class TestKeywordSelection(object):
 
     def test_select_simple(self, testdir):
-        file_test = testdir.makepyfile("""
+        file_test = testdir.makepyfile(
+            """
             def test_one():
                 assert 0
             class TestClass(object):
                 def test_method_one(self):
                     assert 42 == 43
-        """)
+        """
+        )
 
         def check(keyword, name):
             reprec = testdir.inline_run("-s", "-k", keyword, file_test)
             passed, skipped, failed = reprec.listoutcomes()
             assert len(failed) == 1
             assert failed[0].nodeid.split("::")[-1] == name
-            assert len(reprec.getcalls('pytest_deselected')) == 1
+            assert len(reprec.getcalls("pytest_deselected")) == 1
 
-        for keyword in ['test_one', 'est_on']:
-            check(keyword, 'test_one')
-        check('TestClass and test', 'test_method_one')
+        for keyword in ["test_one", "est_on"]:
+            check(keyword, "test_one")
+        check("TestClass and test", "test_method_one")
 
-    @pytest.mark.parametrize("keyword", [
-        'xxx', 'xxx and test_2', 'TestClass', 'xxx and not test_1',
-        'TestClass and test_2', 'xxx and TestClass and test_2'])
+    @pytest.mark.parametrize(
+        "keyword",
+        [
+            "xxx",
+            "xxx and test_2",
+            "TestClass",
+            "xxx and not test_1",
+            "TestClass and test_2",
+            "xxx and TestClass and test_2",
+        ],
+    )
     def test_select_extra_keywords(self, testdir, keyword):
-        p = testdir.makepyfile(test_select="""
+        p = testdir.makepyfile(
+            test_select="""
             def test_1():
                 pass
             class TestClass(object):
                 def test_2(self):
                     pass
-        """)
-        testdir.makepyfile(conftest="""
+        """
+        )
+        testdir.makepyfile(
+            conftest="""
             import pytest
             @pytest.hookimpl(hookwrapper=True)
             def pytest_pycollect_makeitem(name):
                 outcome = yield
                 if name == "TestClass":
                     item = outcome.get_result()
                     item.extra_keyword_matches.add("xxx")
-        """)
-        reprec = testdir.inline_run(p.dirpath(), '-s', '-k', keyword)
+        """
+        )
+        reprec = testdir.inline_run(p.dirpath(), "-s", "-k", keyword)
         print("keyword", repr(keyword))
         passed, skipped, failed = reprec.listoutcomes()
         assert len(passed) == 1
         assert passed[0].nodeid.endswith("test_2")
         dlist = reprec.getcalls("pytest_deselected")
         assert len(dlist) == 1
-        assert dlist[0].items[0].name == 'test_1'
+        assert dlist[0].items[0].name == "test_1"
 
     def test_select_starton(self, testdir):
-        threepass = testdir.makepyfile(test_threepass="""
+        threepass = testdir.makepyfile(
+            test_threepass="""
             def test_one(): assert 1
             def test_two(): assert 1
             def test_three(): assert 1
-        """)
+        """
+        )
         reprec = testdir.inline_run("-k", "test_two:", threepass)
         passed, skipped, failed = reprec.listoutcomes()
         assert len(passed) == 2
         assert not failed
         dlist = reprec.getcalls("pytest_deselected")
         assert len(dlist) == 1
         item = dlist[0].items[0]
         assert item.name == "test_one"
 
     def test_keyword_extra(self, testdir):
-        p = testdir.makepyfile("""
+        p = testdir.makepyfile(
+            """
            def test_one():
                assert 0
            test_one.mykeyword = True
-        """)
+        """
+        )
         reprec = testdir.inline_run("-k", "mykeyword", p)
         passed, skipped, failed = reprec.countoutcomes()
         assert failed == 1
 
     @pytest.mark.xfail
     def test_keyword_extra_dash(self, testdir):
-        p = testdir.makepyfile("""
+        p = testdir.makepyfile(
+            """
            def test_one():
                assert 0
            test_one.mykeyword = True
-        """)
+        """
+        )
         # with argparse the argument to an option cannot
         # start with '-'
         reprec = testdir.inline_run("-k", "-mykeyword", p)
         passed, skipped, failed = reprec.countoutcomes()
         assert passed + skipped + failed == 0
 
     def test_no_magic_values(self, testdir):
         """Make sure the tests do not match on magic values,
         no double underscored values, like '__dict__',
         and no instance values, like '()'.
         """
-        p = testdir.makepyfile("""
+        p = testdir.makepyfile(
+            """
             def test_one(): assert 1
-        """)
+        """
+        )
 
         def assert_test_is_not_selected(keyword):
             reprec = testdir.inline_run("-k", keyword, p)
             passed, skipped, failed = reprec.countoutcomes()
             dlist = reprec.getcalls("pytest_deselected")
             assert passed + skipped + failed == 0
             deselected_tests = dlist[0].items
             assert len(deselected_tests) == 1
 
         assert_test_is_not_selected("__")
         assert_test_is_not_selected("()")
 
 
-@pytest.mark.parametrize('argval, expected', [
-    (pytest.mark.skip()((1, 2)),
-     ParameterSet(values=(1, 2), marks=[pytest.mark.skip], id=None)),
-    (pytest.mark.xfail(pytest.mark.skip()((1, 2))),
-     ParameterSet(values=(1, 2),
-                  marks=[pytest.mark.xfail, pytest.mark.skip], id=None)),
-
-])
-@pytest.mark.filterwarnings('ignore')
+@pytest.mark.parametrize(
+    "argval, expected",
+    [
+        (
+            pytest.mark.skip()((1, 2)),
+            ParameterSet(values=(1, 2), marks=[pytest.mark.skip], id=None),
+        ),
+        (
+            pytest.mark.xfail(pytest.mark.skip()((1, 2))),
+            ParameterSet(
+                values=(1, 2), marks=[pytest.mark.xfail, pytest.mark.skip], id=None
+            ),
+        ),
+    ],
+)
+@pytest.mark.filterwarnings("ignore")
 def test_parameterset_extractfrom(argval, expected):
     extracted = ParameterSet.extract_from(argval)
     assert extracted == expected
 
 
 def test_legacy_transfer():
 
     class FakeModule(object):
@@ -846,16 +1050,85 @@ def test_legacy_transfer():
     assert fake_method.nofun
     assert fake_method.fun
     # pristine marks dont transfer
     assert fake_method.pytestmark == [pytest.mark.fun.mark]
 
 
 class TestMarkDecorator(object):
 
-    @pytest.mark.parametrize('lhs, rhs, expected', [
-        (pytest.mark.foo(), pytest.mark.foo(), True),
-        (pytest.mark.foo(), pytest.mark.bar(), False),
-        (pytest.mark.foo(), 'bar', False),
-        ('foo', pytest.mark.bar(), False)
-    ])
+    @pytest.mark.parametrize(
+        "lhs, rhs, expected",
+        [
+            (pytest.mark.foo(), pytest.mark.foo(), True),
+            (pytest.mark.foo(), pytest.mark.bar(), False),
+            (pytest.mark.foo(), "bar", False),
+            ("foo", pytest.mark.bar(), False),
+        ],
+    )
     def test__eq__(self, lhs, rhs, expected):
         assert (lhs == rhs) == expected
+
+
+@pytest.mark.parametrize("mark", [None, "", "skip", "xfail"])
+def test_parameterset_for_parametrize_marks(testdir, mark):
+    if mark is not None:
+        testdir.makeini("[pytest]\n{}={}".format(EMPTY_PARAMETERSET_OPTION, mark))
+
+    config = testdir.parseconfig()
+    from _pytest.mark import pytest_configure, get_empty_parameterset_mark
+
+    pytest_configure(config)
+    result_mark = get_empty_parameterset_mark(config, ["a"], all)
+    if mark in (None, ""):
+        # normalize to the requested name
+        mark = "skip"
+    assert result_mark.name == mark
+    assert result_mark.kwargs["reason"].startswith("got empty parameter set ")
+    if mark == "xfail":
+        assert result_mark.kwargs.get("run") is False
+
+
+def test_parameterset_for_parametrize_bad_markname(testdir):
+    with pytest.raises(pytest.UsageError):
+        test_parameterset_for_parametrize_marks(testdir, "bad")
+
+
+def test_mark_expressions_no_smear(testdir):
+    testdir.makepyfile(
+        """
+        import pytest
+
+        class BaseTests(object):
+            def test_something(self):
+                pass
+
+        @pytest.mark.FOO
+        class TestFooClass(BaseTests):
+            pass
+
+        @pytest.mark.BAR
+        class TestBarClass(BaseTests):
+            pass
+    """
+    )
+
+    reprec = testdir.inline_run("-m", "FOO")
+    passed, skipped, failed = reprec.countoutcomes()
+    dlist = reprec.getcalls("pytest_deselected")
+    assert passed == 1
+    assert skipped == failed == 0
+    deselected_tests = dlist[0].items
+    assert len(deselected_tests) == 1
+
+    # keywords smear - expected behaviour
+    reprec_keywords = testdir.inline_run("-k", "FOO")
+    passed_k, skipped_k, failed_k = reprec_keywords.countoutcomes()
+    assert passed_k == 2
+    assert skipped_k == failed_k == 0
+
+
+def test_addmarker_getmarker():
+    node = Node("Test", config=mock.Mock(), session=mock.Mock(), nodeid="Test")
+    node.add_marker(pytest.mark.a(1))
+    node.add_marker("b")
+    node.get_marker("a").combined
+    node.get_marker("b").combined
--- a/third_party/python/pytest/testing/test_modimport.py
+++ b/third_party/python/pytest/testing/test_modimport.py
@@ -1,25 +1,29 @@
 import py
 import subprocess
 import sys
 import pytest
 import _pytest
 
 MODSET = [
-    x for x in py.path.local(_pytest.__file__).dirpath().visit('*.py')
-    if x.purebasename != '__init__'
+    x
+    for x in py.path.local(_pytest.__file__).dirpath().visit("*.py")
+    if x.purebasename != "__init__"
 ]
 
 
-@pytest.mark.parametrize('modfile', MODSET, ids=lambda x: x.purebasename)
+@pytest.mark.parametrize("modfile", MODSET, ids=lambda x: x.purebasename)
 def test_fileimport(modfile):
     # this test ensures all internal packages can import
     # without needing the pytest namespace being set
     # this is critical for the initialization of xdist
 
-    res = subprocess.call([
-        sys.executable,
-        '-c', 'import sys, py; py.path.local(sys.argv[1]).pyimport()',
-        modfile.strpath,
-    ])
+    res = subprocess.call(
+        [
+            sys.executable,
+            "-c",
+            "import sys, py; py.path.local(sys.argv[1]).pyimport()",
+            modfile.strpath,
+        ]
+    )
     if res:
         pytest.fail("command result %s" % res)
--- a/third_party/python/pytest/testing/test_monkeypatch.py
+++ b/third_party/python/pytest/testing/test_monkeypatch.py
@@ -12,169 +12,175 @@ def mp():
     cwd = os.getcwd()
     sys_path = list(sys.path)
     yield MonkeyPatch()
     sys.path[:] = sys_path
     os.chdir(cwd)
 
 
 def test_setattr():
+
     class A(object):
         x = 1
 
     monkeypatch = MonkeyPatch()
     pytest.raises(AttributeError, "monkeypatch.setattr(A, 'notexists', 2)")
-    monkeypatch.setattr(A, 'y', 2, raising=False)
+    monkeypatch.setattr(A, "y", 2, raising=False)
     assert A.y == 2
     monkeypatch.undo()
-    assert not hasattr(A, 'y')
+    assert not hasattr(A, "y")
 
     monkeypatch = MonkeyPatch()
-    monkeypatch.setattr(A, 'x', 2)
+    monkeypatch.setattr(A, "x", 2)
     assert A.x == 2
-    monkeypatch.setattr(A, 'x', 3)
+    monkeypatch.setattr(A, "x", 3)
     assert A.x == 3
     monkeypatch.undo()
     assert A.x == 1
 
     A.x = 5
     monkeypatch.undo()  # double-undo makes no modification
     assert A.x == 5
 
 
 class TestSetattrWithImportPath(object):
+
     def test_string_expression(self, monkeypatch):
         monkeypatch.setattr("os.path.abspath", lambda x: "hello2")
         assert os.path.abspath("123") == "hello2"
 
     def test_string_expression_class(self, monkeypatch):
         monkeypatch.setattr("_pytest.config.Config", 42)
         import _pytest
+
         assert _pytest.config.Config == 42
 
     def test_unicode_string(self, monkeypatch):
         monkeypatch.setattr("_pytest.config.Config", 42)
         import _pytest
+
         assert _pytest.config.Config == 42
         monkeypatch.delattr("_pytest.config.Config")
 
     def test_wrong_target(self, monkeypatch):
         pytest.raises(TypeError, lambda: monkeypatch.setattr(None, None))
 
     def test_unknown_import(self, monkeypatch):
-        pytest.raises(ImportError,
-                      lambda: monkeypatch.setattr("unkn123.classx", None))
+        pytest.raises(ImportError, lambda: monkeypatch.setattr("unkn123.classx", None))
 
     def test_unknown_attr(self, monkeypatch):
-        pytest.raises(AttributeError,
-                      lambda: monkeypatch.setattr("os.path.qweqwe", None))
+        pytest.raises(
+            AttributeError, lambda: monkeypatch.setattr("os.path.qweqwe", None)
+        )
 
     def test_unknown_attr_non_raising(self, monkeypatch):
         # https://github.com/pytest-dev/pytest/issues/746
-        monkeypatch.setattr('os.path.qweqwe', 42, raising=False)
+        monkeypatch.setattr("os.path.qweqwe", 42, raising=False)
         assert os.path.qweqwe == 42
 
     def test_delattr(self, monkeypatch):
         monkeypatch.delattr("os.path.abspath")
         assert not hasattr(os.path, "abspath")
         monkeypatch.undo()
         assert os.path.abspath
 
 
 def test_delattr():
+
     class A(object):
         x = 1
 
     monkeypatch = MonkeyPatch()
-    monkeypatch.delattr(A, 'x')
-    assert not hasattr(A, 'x')
+    monkeypatch.delattr(A, "x")
+    assert not hasattr(A, "x")
     monkeypatch.undo()
     assert A.x == 1
 
     monkeypatch = MonkeyPatch()
-    monkeypatch.delattr(A, 'x')
+    monkeypatch.delattr(A, "x")
     pytest.raises(AttributeError, "monkeypatch.delattr(A, 'y')")
-    monkeypatch.delattr(A, 'y', raising=False)
-    monkeypatch.setattr(A, 'x', 5, raising=False)
+    monkeypatch.delattr(A, "y", raising=False)
+    monkeypatch.setattr(A, "x", 5, raising=False)
     assert A.x == 5
     monkeypatch.undo()
     assert A.x == 1
 
 
 def test_setitem():
-    d = {'x': 1}
+    d = {"x": 1}
     monkeypatch = MonkeyPatch()
-    monkeypatch.setitem(d, 'x', 2)
-    monkeypatch.setitem(d, 'y', 1700)
-    monkeypatch.setitem(d, 'y', 1700)
-    assert d['x'] == 2
-    assert d['y'] == 1700
-    monkeypatch.setitem(d, 'x', 3)
-    assert d['x'] == 3
+    monkeypatch.setitem(d, "x", 2)
+    monkeypatch.setitem(d, "y", 1700)
+    monkeypatch.setitem(d, "y", 1700)
+    assert d["x"] == 2
+    assert d["y"] == 1700
+    monkeypatch.setitem(d, "x", 3)
+    assert d["x"] == 3
     monkeypatch.undo()
-    assert d['x'] == 1
-    assert 'y' not in d
-    d['x'] = 5
+    assert d["x"] == 1
+    assert "y" not in d
+    d["x"] = 5
     monkeypatch.undo()
-    assert d['x'] == 5
+    assert d["x"] == 5
 
 
 def test_setitem_deleted_meanwhile():
     d = {}
     monkeypatch = MonkeyPatch()
-    monkeypatch.setitem(d, 'x', 2)
-    del d['x']
+    monkeypatch.setitem(d, "x", 2)
+    del d["x"]
     monkeypatch.undo()
     assert not d
 
 
 @pytest.mark.parametrize("before", [True, False])
 def test_setenv_deleted_meanwhile(before):
     key = "qwpeoip123"
     if before:
         os.environ[key] = "world"
     monkeypatch = MonkeyPatch()
-    monkeypatch.setenv(key, 'hello')
+    monkeypatch.setenv(key, "hello")
     del os.environ[key]
     monkeypatch.undo()
     if before:
         assert os.environ[key] == "world"
         del os.environ[key]
     else:
         assert key not in os.environ
 
 
 def test_delitem():
-    d = {'x': 1}
+    d = {"x": 1}
     monkeypatch = MonkeyPatch()
-    monkeypatch.delitem(d, 'x')
-    assert 'x' not in d
-    monkeypatch.delitem(d, 'y', raising=False)
+    monkeypatch.delitem(d, "x")
+    assert "x" not in d
+    monkeypatch.delitem(d, "y", raising=False)
     pytest.raises(KeyError, "monkeypatch.delitem(d, 'y')")
     assert not d
-    monkeypatch.setitem(d, 'y', 1700)
-    assert d['y'] == 1700
-    d['hello'] = 'world'
-    monkeypatch.setitem(d, 'x', 1500)
-    assert d['x'] == 1500
+    monkeypatch.setitem(d, "y", 1700)
+    assert d["y"] == 1700
+    d["hello"] = "world"
+    monkeypatch.setitem(d, "x", 1500)
+    assert d["x"] == 1500
     monkeypatch.undo()
-    assert d == {'hello': 'world', 'x': 1}
+    assert d == {"hello": "world", "x": 1}
 
 
 def test_setenv():
     monkeypatch = MonkeyPatch()
-    monkeypatch.setenv('XYZ123', 2)
+    monkeypatch.setenv("XYZ123", 2)
     import os
-    assert os.environ['XYZ123'] == "2"
+
+    assert os.environ["XYZ123"] == "2"
     monkeypatch.undo()
-    assert 'XYZ123' not in os.environ
+    assert "XYZ123" not in os.environ
 
 
 def test_delenv():
-    name = 'xyz1234'
+    name = "xyz1234"
     assert name not in os.environ
     monkeypatch = MonkeyPatch()
     pytest.raises(KeyError, "monkeypatch.delenv(%r, raising=True)" % name)
     monkeypatch.delenv(name, raising=False)
     monkeypatch.undo()
     os.environ[name] = "1"
     try:
         monkeypatch = MonkeyPatch()
@@ -186,52 +192,55 @@ def test_delenv():
         assert os.environ[name] == "1"
     finally:
         if name in os.environ:
             del os.environ[name]
 
 
 def test_setenv_prepend():
     import os
+
     monkeypatch = MonkeyPatch()
-    monkeypatch.setenv('XYZ123', 2, prepend="-")
-    assert os.environ['XYZ123'] == "2"
-    monkeypatch.setenv('XYZ123', 3, prepend="-")
-    assert os.environ['XYZ123'] == "3-2"
+    monkeypatch.setenv("XYZ123", 2, prepend="-")
+    assert os.environ["XYZ123"] == "2"
+    monkeypatch.setenv("XYZ123", 3, prepend="-")
+    assert os.environ["XYZ123"] == "3-2"
     monkeypatch.undo()
-    assert 'XYZ123' not in os.environ
+    assert "XYZ123" not in os.environ
 
 
 def test_monkeypatch_plugin(testdir):
-    reprec = testdir.inline_runsource("""
+    reprec = testdir.inline_runsource(
+        """
         def test_method(monkeypatch):
             assert monkeypatch.__class__.__name__ == "MonkeyPatch"
-    """)
+    """
+    )
     res = reprec.countoutcomes()
     assert tuple(res) == (1, 0, 0), res
 
 
 def test_syspath_prepend(mp):
     old = list(sys.path)
-    mp.syspath_prepend('world')
-    mp.syspath_prepend('hello')
+    mp.syspath_prepend("world")
+    mp.syspath_prepend("hello")
     assert sys.path[0] == "hello"
     assert sys.path[1] == "world"
     mp.undo()
     assert sys.path == old
     mp.undo()
     assert sys.path == old
 
 
 def test_syspath_prepend_double_undo(mp):
-    mp.syspath_prepend('hello world')
+    mp.syspath_prepend("hello world")
     mp.undo()
-    sys.path.append('more hello world')
+    sys.path.append("more hello world")
     mp.undo()
-    assert sys.path[-1] == 'more hello world'
+    assert sys.path[-1] == "more hello world"
 
 
 def test_chdir_with_path_local(mp, tmpdir):
     mp.chdir(tmpdir)
     assert os.getcwd() == tmpdir.strpath
 
 
 def test_chdir_with_str(mp, tmpdir):
@@ -250,47 +259,64 @@ def test_chdir_double_undo(mp, tmpdir):
     mp.chdir(tmpdir.strpath)
     mp.undo()
     tmpdir.chdir()
     mp.undo()
     assert os.getcwd() == tmpdir.strpath
 
 
 def test_issue185_time_breaks(testdir):
-    testdir.makepyfile("""
+    testdir.makepyfile(
+        """
         import time
         def test_m(monkeypatch):
             def f():
                 raise Exception
             monkeypatch.setattr(time, "time", f)
-    """)
+    """
+    )
     result = testdir.runpytest()
-    result.stdout.fnmatch_lines("""
+    result.stdout.fnmatch_lines(
+        """
         *1 passed*
-    """)
+    """
+    )
 
 
 def test_importerror(testdir):
     p = testdir.mkpydir("package")
-    p.join("a.py").write(textwrap.dedent("""\
+    p.join("a.py").write(
+        textwrap.dedent(
+            """\
         import doesnotexist
 
         x = 1
-    """))
-    testdir.tmpdir.join("test_importerror.py").write(textwrap.dedent("""\
+    """
+        )
+    )
+    testdir.tmpdir.join("test_importerror.py").write(
+        textwrap.dedent(
+            """\
         def test_importerror(monkeypatch):
             monkeypatch.setattr('package.a.x', 2)
-    """))
+    """
+        )
+    )
     result = testdir.runpytest()
-    result.stdout.fnmatch_lines("""
+    result.stdout.fnmatch_lines(
+        """
         *import error in package.a: No module named {0}doesnotexist{0}*
-    """.format("'" if sys.version_info > (3, 0) else ""))
+    """.format(
+            "'" if sys.version_info > (3, 0) else ""
+        )
+    )
 
 
 class SampleNew(object):
+
     @staticmethod
     def hello():
         return True
 
 
 class SampleNewInherit(SampleNew):
     pass
 
@@ -301,29 +327,42 @@ class SampleOld(object):
     def hello():
         return True
 
 
 class SampleOldInherit(SampleOld):
     pass
 
 
-@pytest.mark.parametrize('Sample', [
-    SampleNew, SampleNewInherit,
-    SampleOld, SampleOldInherit,
-], ids=['new', 'new-inherit', 'old', 'old-inherit'])
+@pytest.mark.parametrize(
+    "Sample",
+    [SampleNew, SampleNewInherit, SampleOld, SampleOldInherit],
+    ids=["new", "new-inherit", "old", "old-inherit"],
+)
 def test_issue156_undo_staticmethod(Sample):
     monkeypatch = MonkeyPatch()
 
-    monkeypatch.setattr(Sample, 'hello', None)
+    monkeypatch.setattr(Sample, "hello", None)
     assert Sample.hello is None
 
     monkeypatch.undo()
     assert Sample.hello()
 
 
 def test_issue1338_name_resolving():
-    pytest.importorskip('requests')
+    pytest.importorskip("requests")
     monkeypatch = MonkeyPatch()
     try:
-        monkeypatch.delattr('requests.sessions.Session.request')
+        monkeypatch.delattr("requests.sessions.Session.request")
     finally:
         monkeypatch.undo()
+
+
+def test_context():
+    monkeypatch = MonkeyPatch()
+
+    import functools
+    import inspect
+
+    with monkeypatch.context() as m:
+        m.setattr(functools, "partial", 3)
+        assert not inspect.isclass(functools.partial)
+    assert inspect.isclass(functools.partial)
--- a/third_party/python/pytest/testing/test_nodes.py
+++ b/third_party/python/pytest/testing/test_nodes.py
@@ -1,18 +1,21 @@
 import pytest
 
 from _pytest import nodes
 
 
-@pytest.mark.parametrize("baseid, nodeid, expected", (
-    ('', '', True),
-    ('', 'foo', True),
-    ('', 'foo/bar', True),
-    ('', 'foo/bar::TestBaz::()', True),
-    ('foo', 'food', False),
-    ('foo/bar::TestBaz::()', 'foo/bar', False),
-    ('foo/bar::TestBaz::()', 'foo/bar::TestBop::()', False),
-    ('foo/bar', 'foo/bar::TestBop::()', True),
-))
+@pytest.mark.parametrize(
+    "baseid, nodeid, expected",
+    (
+        ("", "", True),
+        ("", "foo", True),
+        ("", "foo/bar", True),
+        ("", "foo/bar::TestBaz::()", True),
+        ("foo", "food", False),
+        ("foo/bar::TestBaz::()", "foo/bar", False),
+        ("foo/bar::TestBaz::()", "foo/bar::TestBop::()", False),
+        ("foo/bar", "foo/bar::TestBop::()", True),
+    ),
+)
 def test_ischildnode(baseid, nodeid, expected):
     result = nodes.ischildnode(baseid, nodeid)
     assert result is expected
--- a/third_party/python/pytest/testing/test_nose.py
+++ b/third_party/python/pytest/testing/test_nose.py
@@ -2,39 +2,43 @@ from __future__ import absolute_import, 
 import pytest
 
 
 def setup_module(mod):
     mod.nose = pytest.importorskip("nose")
 
 
 def test_nose_setup(testdir):
-    p = testdir.makepyfile("""
+    p = testdir.makepyfile(
+        """
         values = []
         from nose.tools import with_setup
 
         @with_setup(lambda: values.append(1), lambda: values.append(2))
         def test_hello():
             assert values == [1]
 
         def test_world():
             assert values == [1,2]
 
         test_hello.setup = lambda: values.append(1)
         test_hello.teardown = lambda: values.append(2)
-    """)
-    result = testdir.runpytest(p, '-p', 'nose')
+    """
+    )
+    result = testdir.runpytest(p, "-p", "nose")
     result.assert_outcomes(passed=2)
 
 
 def test_setup_func_with_setup_decorator():
     from _pytest.nose import call_optional
+
     values = []
 
     class A(object):
+
         @pytest.fixture(autouse=True)
         def f(self):
             values.append(1)
 
     call_optional(A(), "f")
     assert not values
 
 
@@ -43,17 +47,18 @@ def test_setup_func_not_callable():
 
     class A(object):
         f = 1
 
     call_optional(A(), "f")
 
 
 def test_nose_setup_func(testdir):
-    p = testdir.makepyfile("""
+    p = testdir.makepyfile(
+        """
         from nose.tools import with_setup
 
         values = []
 
         def my_setup():
             a = 1
             values.append(a)
 
@@ -65,65 +70,69 @@ def test_nose_setup_func(testdir):
         def test_hello():
             print (values)
             assert values == [1]
 
         def test_world():
             print (values)
             assert values == [1,2]
 
-    """)
-    result = testdir.runpytest(p, '-p', 'nose')
+    """
+    )
+    result = testdir.runpytest(p, "-p", "nose")
     result.assert_outcomes(passed=2)
 
 
 def test_nose_setup_func_failure(testdir):
-    p = testdir.makepyfile("""
+    p = testdir.makepyfile(
+        """
         from nose.tools import with_setup
 
         values = []
         my_setup = lambda x: 1
         my_teardown = lambda x: 2
 
         @with_setup(my_setup, my_teardown)
         def test_hello():
             print (values)
             assert values == [1]
 
         def test_world():
             print (values)
             assert values == [1,2]
 
-    """)
-    result = testdir.runpytest(p, '-p', 'nose')
-    result.stdout.fnmatch_lines([
-        "*TypeError: <lambda>()*"
-    ])
+    """
+    )
+    result = testdir.runpytest(p, "-p", "nose")
+    result.stdout.fnmatch_lines(["*TypeError: <lambda>()*"])
 
 
 def test_nose_setup_func_failure_2(testdir):
-    testdir.makepyfile("""
+    testdir.makepyfile(
+        """
         values = []
 
         my_setup = 1
         my_teardown = 2
 
         def test_hello():
             assert values == []
 
         test_hello.setup = my_setup
         test_hello.teardown = my_teardown
-    """)
+    """
+    )
     reprec = testdir.inline_run()
     reprec.assertoutcome(passed=1)
 
 
 def test_nose_setup_partial(testdir):
     pytest.importorskip("functools")
-    p = testdir.makepyfile("""
+    p = testdir.makepyfile(
+        """
         from functools import partial
 
         values = []
 
         def my_setup(x):
             a = x
             values.append(a)
 
@@ -139,25 +148,25 @@ def test_nose_setup_partial(testdir):
             assert values == [1]
 
         def test_world():
             print (values)
             assert values == [1,2]
 
         test_hello.setup = my_setup_partial
         test_hello.teardown = my_teardown_partial
-    """)
-    result = testdir.runpytest(p, '-p', 'nose')
-    result.stdout.fnmatch_lines([
-        "*2 passed*"
-    ])
+    """
+    )
+    result = testdir.runpytest(p, "-p", "nose")
+    result.stdout.fnmatch_lines(["*2 passed*"])
 
 
 def test_nose_test_generator_fixtures(testdir):
-    p = testdir.makepyfile("""
+    p = testdir.makepyfile(
+        """
         # taken from nose-0.11.1 unit_tests/test_generator_fixtures.py
         from nose.tools import eq_
         called = []
 
         def outer_setup():
             called.append('outer_setup')
 
         def outer_teardown():
@@ -206,25 +215,25 @@ def test_nose_test_generator_fixtures(te
             def check(self, i):
                 print ("check called in %s" % self)
                 expect = ['setup']
                 #for x in range(0, i):
                 #    expect.append('setup')
                 #    expect.append('teardown')
                 #expect.append('setup')
                 eq_(self.called, expect)
-    """)
-    result = testdir.runpytest(p, '-p', 'nose')
-    result.stdout.fnmatch_lines([
-        "*10 passed*"
-    ])
+    """
+    )
+    result = testdir.runpytest(p, "-p", "nose")
+    result.stdout.fnmatch_lines(["*10 passed*"])
 
 
 def test_module_level_setup(testdir):
-    testdir.makepyfile("""
+    testdir.makepyfile(
+        """
         from nose.tools import with_setup
         items = {}
 
         def setup():
             items[1]=1
 
         def teardown():
             del items[1]
@@ -237,89 +246,91 @@ def test_module_level_setup(testdir):
 
         def test_setup_module_setup():
             assert items[1] == 1
 
         @with_setup(setup2, teardown2)
         def test_local_setup():
             assert items[2] == 2
             assert 1 not in items
-    """)
-    result = testdir.runpytest('-p', 'nose')
-    result.stdout.fnmatch_lines([
-        "*2 passed*",
-    ])
+    """
+    )
+    result = testdir.runpytest("-p", "nose")
+    result.stdout.fnmatch_lines(["*2 passed*"])
 
 
 def test_nose_style_setup_teardown(testdir):
-    testdir.makepyfile("""
+    testdir.makepyfile(
+        """
         values = []
 
         def setup_module():
             values.append(1)
 
         def teardown_module():
             del values[0]
 
         def test_hello():
             assert values == [1]
 
         def test_world():
             assert values == [1]
-        """)
-    result = testdir.runpytest('-p', 'nose')
-    result.stdout.fnmatch_lines([
-        "*2 passed*",
-    ])
+        """
+    )
+    result = testdir.runpytest("-p", "nose")
+    result.stdout.fnmatch_lines(["*2 passed*"])
 
 
 def test_nose_setup_ordering(testdir):
-    testdir.makepyfile("""
+    testdir.makepyfile(
+        """
         def setup_module(mod):
             mod.visited = True
 
         class TestClass(object):
             def setup(self):
                 assert visited
             def test_first(self):
                 pass
-        """)
+        """
+    )
     result = testdir.runpytest()
-    result.stdout.fnmatch_lines([
-        "*1 passed*",
-    ])
+    result.stdout.fnmatch_lines(["*1 passed*"])
 
 
 def test_apiwrapper_problem_issue260(testdir):
-    # this would end up trying a call a optional teardown on the class
+    # this would end up trying a call an optional teardown on the class
     # for plain unittests we dont want nose behaviour
-    testdir.makepyfile("""
+    testdir.makepyfile(
+        """
         import unittest
         class TestCase(unittest.TestCase):
             def setup(self):
                 #should not be called in unittest testcases
                 assert 0, 'setup'
             def teardown(self):
                 #should not be called in unittest testcases
                 assert 0, 'teardown'
             def setUp(self):
                 print('setup')
             def tearDown(self):
                 print('teardown')
             def test_fun(self):
                 pass
-        """)
+        """
+    )
     result = testdir.runpytest()
     result.assert_outcomes(passed=1)
 
 
 def test_setup_teardown_linking_issue265(testdir):
     # we accidentally didnt integrate nose setupstate with normal setupstate
     # this test ensures that won't happen again
-    testdir.makepyfile('''
+    testdir.makepyfile(
+        '''
         import pytest
 
         class TestGeneric(object):
             def test_nothing(self):
                 """Tests the API of the implementation (for generic and specialized)."""
 
         @pytest.mark.skipif("True", reason=
                     "Skip tests to check if teardown is skipped as well.")
@@ -327,83 +338,96 @@ def test_setup_teardown_linking_issue265
 
             def setup(self):
                 """Sets up my specialized implementation for $COOL_PLATFORM."""
                 raise Exception("should not call setup for skipped tests")
 
             def teardown(self):
                 """Undoes the setup."""
                 raise Exception("should not call teardown for skipped tests")
-        ''')
+        '''
+    )
     reprec = testdir.runpytest()
     reprec.assert_outcomes(passed=1, skipped=1)
 
 
 def test_SkipTest_during_collection(testdir):
-    p = testdir.makepyfile("""
+    p = testdir.makepyfile(
+        """
         import nose
         raise nose.SkipTest("during collection")
         def test_failing():
             assert False
-        """)
+        """
+    )
     result = testdir.runpytest(p)
     result.assert_outcomes(skipped=1)
 
 
 def test_SkipTest_in_test(testdir):
-    testdir.makepyfile("""
+    testdir.makepyfile(
+        """
         import nose
 
         def test_skipping():
             raise nose.SkipTest("in test")
-        """)
+        """
+    )
     reprec = testdir.inline_run()
     reprec.assertoutcome(skipped=1)
 
 
 def test_istest_function_decorator(testdir):
-    p = testdir.makepyfile("""
+    p = testdir.makepyfile(
+        """
         import nose.tools
         @nose.tools.istest
         def not_test_prefix():
             pass
-        """)
+        """
+    )
     result = testdir.runpytest(p)
     result.assert_outcomes(passed=1)
 
 
 def test_nottest_function_decorator(testdir):
-    testdir.makepyfile("""
+    testdir.makepyfile(
+        """
         import nose.tools
         @nose.tools.nottest
         def test_prefix():
             pass
-        """)
+        """
+    )
     reprec = testdir.inline_run()
     assert not reprec.getfailedcollections()
     calls = reprec.getreports("pytest_runtest_logreport")
     assert not calls
 
 
 def test_istest_class_decorator(testdir):
-    p = testdir.makepyfile("""
+    p = testdir.makepyfile(
+        """
         import nose.tools
         @nose.tools.istest
         class NotTestPrefix(object):
             def test_method(self):
                 pass
-        """)
+        """
+    )
     result = testdir.runpytest(p)
     result.assert_outcomes(passed=1)
 
 
 def test_nottest_class_decorator(testdir):
-    testdir.makepyfile("""
+    testdir.makepyfile(
+        """
         import nose.tools
         @nose.tools.nottest
         class TestPrefix(object):
             def test_method(self):
                 pass
-        """)
+        """
+    )
     reprec = testdir.inline_run()
     assert not reprec.getfailedcollections()
     calls = reprec.getreports("pytest_runtest_logreport")
     assert not calls
--- a/third_party/python/pytest/testing/test_parseopt.py
+++ b/third_party/python/pytest/testing/test_parseopt.py
@@ -1,67 +1,71 @@
 from __future__ import absolute_import, division, print_function
+import argparse
 import sys
 import os
 import py
 import pytest
-from _pytest import config as parseopt
+from _pytest.config import argparsing as parseopt
 
 
 @pytest.fixture
 def parser():
     return parseopt.Parser()
 
 
 class TestParser(object):
+
     def test_no_help_by_default(self, capsys):
         parser = parseopt.Parser(usage="xyz")
         pytest.raises(SystemExit, lambda: parser.parse(["-h"]))
         out, err = capsys.readouterr()
         assert err.find("error: unrecognized arguments") != -1
 
     def test_argument(self):
         with pytest.raises(parseopt.ArgumentError):
             # need a short or long option
             argument = parseopt.Argument()
-        argument = parseopt.Argument('-t')
-        assert argument._short_opts == ['-t']
+        argument = parseopt.Argument("-t")
+        assert argument._short_opts == ["-t"]
         assert argument._long_opts == []
-        assert argument.dest == 't'
-        argument = parseopt.Argument('-t', '--test')
-        assert argument._short_opts == ['-t']
-        assert argument._long_opts == ['--test']
-        assert argument.dest == 'test'
-        argument = parseopt.Argument('-t', '--test', dest='abc')
-        assert argument.dest == 'abc'
-        assert str(argument) == (
-            "Argument(_short_opts: ['-t'], _long_opts: ['--test'], dest: 'abc')"
+        assert argument.dest == "t"
+        argument = parseopt.Argument("-t", "--test")
+        assert argument._short_opts == ["-t"]
+        assert argument._long_opts == ["--test"]
+        assert argument.dest == "test"
+        argument = parseopt.Argument("-t", "--test", dest="abc")
+        assert argument.dest == "abc"
+        assert (
+            str(argument)
+            == ("Argument(_short_opts: ['-t'], _long_opts: ['--test'], dest: 'abc')")
         )
 
     def test_argument_type(self):
-        argument = parseopt.Argument('-t', dest='abc', type=int)
+        argument = parseopt.Argument("-t", dest="abc", type=int)
         assert argument.type is int
-        argument = parseopt.Argument('-t', dest='abc', type=str)
+        argument = parseopt.Argument("-t", dest="abc", type=str)
         assert argument.type is str
-        argument = parseopt.Argument('-t', dest='abc', type=float)
+        argument = parseopt.Argument("-t", dest="abc", type=float)
         assert argument.type is float
         with pytest.warns(DeprecationWarning):
             with pytest.raises(KeyError):
-                argument = parseopt.Argument('-t', dest='abc', type='choice')
-        argument = parseopt.Argument('-t', dest='abc', type=str,
-                                     choices=['red', 'blue'])
+                argument = parseopt.Argument("-t", dest="abc", type="choice")
+        argument = parseopt.Argument(
+            "-t", dest="abc", type=str, choices=["red", "blue"]
+        )
         assert argument.type is str
 
     def test_argument_processopt(self):
-        argument = parseopt.Argument('-t', type=int)
+        argument = parseopt.Argument("-t", type=int)
         argument.default = 42
-        argument.dest = 'abc'
+        argument.dest = "abc"
         res = argument.attrs()
-        assert res['default'] == 42
-        assert res['dest'] == 'abc'
+        assert res["default"] == 42
+        assert res["dest"] == "abc"
 
     def test_group_add_and_get(self, parser):
         group = parser.getgroup("hello", description="desc")
         assert group.name == "hello"
         assert group.description == "desc"
 
     def test_getgroup_simple(self, parser):
         group = parser.getgroup("hello", description="desc")
@@ -84,57 +88,61 @@ class TestParser(object):
         assert len(group.options) == 1
         assert isinstance(group.options[0], parseopt.Argument)
 
     def test_group_addoption_conflict(self):
         group = parseopt.OptionGroup("hello again")
         group.addoption("--option1", "--option-1", action="store_true")
         with pytest.raises(ValueError) as err:
             group.addoption("--option1", "--option-one", action="store_true")
-        assert str(set(["--option1"])) in str(err.value)
+        assert str({"--option1"}) in str(err.value)
 
     def test_group_shortopt_lowercase(self, parser):
         group = parser.getgroup("hello")
-        pytest.raises(ValueError, """
+        pytest.raises(
+            ValueError,
+            """
             group.addoption("-x", action="store_true")
-        """)
+        """,
+        )
         assert len(group.options) == 0
         group._addoption("-x", action="store_true")
         assert len(group.options) == 1
 
     def test_parser_addoption(self, parser):
         group = parser.getgroup("custom options")
         assert len(group.options) == 0
         group.addoption("--option1", action="store_true")
         assert len(group.options) == 1
 
     def test_parse(self, parser):
         parser.addoption("--hello", dest="hello", action="store")
-        args = parser.parse(['--hello', 'world'])
+        args = parser.parse(["--hello", "world"])
         assert args.hello == "world"
         assert not getattr(args, parseopt.FILE_OR_DIR)
 
     def test_parse2(self, parser):
         args = parser.parse([py.path.local()])
         assert getattr(args, parseopt.FILE_OR_DIR)[0] == py.path.local()
 
     def test_parse_known_args(self, parser):
         parser.parse_known_args([py.path.local()])
         parser.addoption("--hello", action="store_true")
         ns = parser.parse_known_args(["x", "--y", "--hello", "this"])
         assert ns.hello
-        assert ns.file_or_dir == ['x']
+        assert ns.file_or_dir == ["x"]
 
     def test_parse_known_and_unknown_args(self, parser):
         parser.addoption("--hello", action="store_true")
-        ns, unknown = parser.parse_known_and_unknown_args(["x", "--y",
-                                                           "--hello", "this"])
+        ns, unknown = parser.parse_known_and_unknown_args(
+            ["x", "--y", "--hello", "this"]
+        )
         assert ns.hello
-        assert ns.file_or_dir == ['x']
-        assert unknown == ['--y', 'this']
+        assert ns.file_or_dir == ["x"]
+        assert unknown == ["--y", "this"]
 
     def test_parse_will_set_default(self, parser):
         parser.addoption("--hello", dest="hello", default="x", action="store")
         option = parser.parse([])
         assert option.hello == "x"
         del option.hello
         parser.parse_setoption([], option)
         assert option.hello == "x"
@@ -142,174 +150,187 @@ class TestParser(object):
     def test_parse_setoption(self, parser):
         parser.addoption("--hello", dest="hello", action="store")
         parser.addoption("--world", dest="world", default=42)
 
         class A(object):
             pass
 
         option = A()
-        args = parser.parse_setoption(['--hello', 'world'], option)
+        args = parser.parse_setoption(["--hello", "world"], option)
         assert option.hello == "world"
         assert option.world == 42
         assert not args
 
     def test_parse_special_destination(self, parser):
         parser.addoption("--ultimate-answer", type=int)
-        args = parser.parse(['--ultimate-answer', '42'])
+        args = parser.parse(["--ultimate-answer", "42"])
         assert args.ultimate_answer == 42
 
     def test_parse_split_positional_arguments(self, parser):
-        parser.addoption("-R", action='store_true')
-        parser.addoption("-S", action='store_false')
-        args = parser.parse(['-R', '4', '2', '-S'])
-        assert getattr(args, parseopt.FILE_OR_DIR) == ['4', '2']
-        args = parser.parse(['-R', '-S', '4', '2', '-R'])
-        assert getattr(args, parseopt.FILE_OR_DIR) == ['4', '2']
+        parser.addoption("-R", action="store_true")
+        parser.addoption("-S", action="store_false")
+        args = parser.parse(["-R", "4", "2", "-S"])
+        assert getattr(args, parseopt.FILE_OR_DIR) == ["4", "2"]
+        args = parser.parse(["-R", "-S", "4", "2", "-R"])
+        assert getattr(args, parseopt.FILE_OR_DIR) == ["4", "2"]
         assert args.R is True
         assert args.S is False
-        args = parser.parse(['-R', '4', '-S', '2'])
-        assert getattr(args, parseopt.FILE_OR_DIR) == ['4', '2']
+        args = parser.parse(["-R", "4", "-S", "2"])
+        assert getattr(args, parseopt.FILE_OR_DIR) == ["4", "2"]
         assert args.R is True
         assert args.S is False
 
     def test_parse_defaultgetter(self):
+
         def defaultget(option):
-            if not hasattr(option, 'type'):
+            if not hasattr(option, "type"):
                 return
             if option.type is int:
                 option.default = 42
             elif option.type is str:
                 option.default = "world"
+
         parser = parseopt.Parser(processopt=defaultget)
         parser.addoption("--this", dest="this", type=int, action="store")
         parser.addoption("--hello", dest="hello", type=str, action="store")
         parser.addoption("--no", dest="no", action="store_true")
         option = parser.parse([])
         assert option.hello == "world"
         assert option.this == 42
         assert option.no is False
 
     def test_drop_short_helper(self):
-        parser = py.std.argparse.ArgumentParser(formatter_class=parseopt.DropShorterLongHelpFormatter)
-        parser.add_argument('-t', '--twoword', '--duo', '--two-word', '--two',
-                            help='foo').map_long_option = {'two': 'two-word'}
+        parser = argparse.ArgumentParser(
+            formatter_class=parseopt.DropShorterLongHelpFormatter
+        )
+        parser.add_argument(
+            "-t", "--twoword", "--duo", "--two-word", "--two", help="foo"
+        ).map_long_option = {
+            "two": "two-word"
+        }
         # throws error on --deux only!
-        parser.add_argument('-d', '--deuxmots', '--deux-mots',
-                            action='store_true', help='foo').map_long_option = {'deux': 'deux-mots'}
-        parser.add_argument('-s', action='store_true', help='single short')
-        parser.add_argument('--abc', '-a',
-                            action='store_true', help='bar')
-        parser.add_argument('--klm', '-k', '--kl-m',
-                            action='store_true', help='bar')
-        parser.add_argument('-P', '--pq-r', '-p', '--pqr',
-                            action='store_true', help='bar')
-        parser.add_argument('--zwei-wort', '--zweiwort', '--zweiwort',
-                            action='store_true', help='bar')
-        parser.add_argument('-x', '--exit-on-first', '--exitfirst',
-                            action='store_true', help='spam').map_long_option = {'exitfirst': 'exit-on-first'}
-        parser.add_argument('files_and_dirs', nargs='*')
-        args = parser.parse_args(['-k', '--duo', 'hallo', '--exitfirst'])
-        assert args.twoword == 'hallo'
+        parser.add_argument(
+            "-d", "--deuxmots", "--deux-mots", action="store_true", help="foo"
+        ).map_long_option = {
+            "deux": "deux-mots"
+        }
+        parser.add_argument("-s", action="store_true", help="single short")
+        parser.add_argument("--abc", "-a", action="store_true", help="bar")
+        parser.add_argument("--klm", "-k", "--kl-m", action="store_true", help="bar")
+        parser.add_argument(
+            "-P", "--pq-r", "-p", "--pqr", action="store_true", help="bar"
+        )
+        parser.add_argument(
+            "--zwei-wort", "--zweiwort", "--zweiwort", action="store_true", help="bar"
+        )
+        parser.add_argument(
+            "-x", "--exit-on-first", "--exitfirst", action="store_true", help="spam"
+        ).map_long_option = {
+            "exitfirst": "exit-on-first"
+        }
+        parser.add_argument("files_and_dirs", nargs="*")
+        args = parser.parse_args(["-k", "--duo", "hallo", "--exitfirst"])
+        assert args.twoword == "hallo"
         assert args.klm is True
         assert args.zwei_wort is False
         assert args.exit_on_first is True
         assert args.s is False
-        args = parser.parse_args(['--deux-mots'])
+        args = parser.parse_args(["--deux-mots"])
         with pytest.raises(AttributeError):
             assert args.deux_mots is True
         assert args.deuxmots is True
-        args = parser.parse_args(['file', 'dir'])
-        assert '|'.join(args.files_and_dirs) == 'file|dir'
+        args = parser.parse_args(["file", "dir"])
+        assert "|".join(args.files_and_dirs) == "file|dir"
 
     def test_drop_short_0(self, parser):
-        parser.addoption('--funcarg', '--func-arg', action='store_true')
-        parser.addoption('--abc-def', '--abc-def', action='store_true')
-        parser.addoption('--klm-hij', action='store_true')
-        args = parser.parse(['--funcarg', '--k'])
+        parser.addoption("--funcarg", "--func-arg", action="store_true")
+        parser.addoption("--abc-def", "--abc-def", action="store_true")
+        parser.addoption("--klm-hij", action="store_true")
+        args = parser.parse(["--funcarg", "--k"])
         assert args.funcarg is True
         assert args.abc_def is False
         assert args.klm_hij is True
 
     def test_drop_short_2(self, parser):
-        parser.addoption('--func-arg', '--doit', action='store_true')
-        args = parser.parse(['--doit'])
+        parser.addoption("--func-arg", "--doit", action="store_true")
+        args = parser.parse(["--doit"])
         assert args.func_arg is True
 
     def test_drop_short_3(self, parser):
-        parser.addoption('--func-arg', '--funcarg', '--doit', action='store_true')
-        args = parser.parse(['abcd'])
+        parser.addoption("--func-arg", "--funcarg", "--doit", action="store_true")
+        args = parser.parse(["abcd"])
         assert args.func_arg is False
-        assert args.file_or_dir == ['abcd']
+        assert args.file_or_dir == ["abcd"]
 
     def test_drop_short_help0(self, parser, capsys):
-        parser.addoption('--func-args', '--doit', help='foo',
-                         action='store_true')
+        parser.addoption("--func-args", "--doit", help="foo", action="store_true")
         parser.parse([])
         help = parser.optparser.format_help()
-        assert '--func-args, --doit  foo' in help
+        assert "--func-args, --doit  foo" in help
 
     # testing would be more helpful with all help generated
     def test_drop_short_help1(self, parser, capsys):
         group = parser.getgroup("general")
-        group.addoption('--doit', '--func-args', action='store_true', help='foo')
-        group._addoption("-h", "--help", action="store_true", dest="help",
-                         help="show help message and configuration info")
-        parser.parse(['-h'])
+        group.addoption("--doit", "--func-args", action="store_true", help="foo")
+        group._addoption(
+            "-h",
+            "--help",
+            action="store_true",
+            dest="help",
+            help="show help message and configuration info",
+        )
+        parser.parse(["-h"])
         help = parser.optparser.format_help()
-        assert '-doit, --func-args  foo' in help
+        assert "-doit, --func-args  foo" in help
 
     def test_multiple_metavar_help(self, parser):
         """
         Help text for options with a metavar tuple should display help
         in the form "--preferences=value1 value2 value3" (#2004).
         """
         group = parser.getgroup("general")
-        group.addoption('--preferences', metavar=('value1', 'value2', 'value3'), nargs=3)
+        group.addoption(
+            "--preferences", metavar=("value1", "value2", "value3"), nargs=3
+        )
         group._addoption("-h", "--help", action="store_true", dest="help")
-        parser.parse(['-h'])
+        parser.parse(["-h"])
         help = parser.optparser.format_help()
-        assert '--preferences=value1 value2 value3' in help
+        assert "--preferences=value1 value2 value3" in help
 
 
 def test_argcomplete(testdir, monkeypatch):
-    if not py.path.local.sysfind('bash'):
+    if not py.path.local.sysfind("bash"):
         pytest.skip("bash not available")
     script = str(testdir.tmpdir.join("test_argcomplete"))
     pytest_bin = sys.argv[0]
     if "pytest" not in os.path.basename(pytest_bin):
         pytest.skip("need to be run with pytest executable, not %s" % (pytest_bin,))
 
-    with open(str(script), 'w') as fp:
+    with open(str(script), "w") as fp:
         # redirect output from argcomplete to stdin and stderr is not trivial
         # http://stackoverflow.com/q/12589419/1307905
         # so we use bash
         fp.write('COMP_WORDBREAKS="$COMP_WORDBREAKS" %s 8>&1 9>&2' % pytest_bin)
     # alternative would be exteneded Testdir.{run(),_run(),popen()} to be able
     # to handle a keyword argument env that replaces os.environ in popen or
     # extends the copy, advantage: could not forget to restore
-    monkeypatch.setenv('_ARGCOMPLETE', "1")
-    monkeypatch.setenv('_ARGCOMPLETE_IFS', "\x0b")
-    monkeypatch.setenv('COMP_WORDBREAKS', ' \\t\\n"\\\'><=;|&(:')
+    monkeypatch.setenv("_ARGCOMPLETE", "1")
+    monkeypatch.setenv("_ARGCOMPLETE_IFS", "\x0b")
+    monkeypatch.setenv("COMP_WORDBREAKS", " \\t\\n\"\\'><=;|&(:")
 
-    arg = '--fu'
-    monkeypatch.setenv('COMP_LINE', "pytest " + arg)
-    monkeypatch.setenv('COMP_POINT', str(len("pytest " + arg)))
-    result = testdir.run('bash', str(script), arg)
+    arg = "--fu"
+    monkeypatch.setenv("COMP_LINE", "pytest " + arg)
+    monkeypatch.setenv("COMP_POINT", str(len("pytest " + arg)))
+    result = testdir.run("bash", str(script), arg)
     if result.ret == 255:
         # argcomplete not found
         pytest.skip("argcomplete not available")
     elif not result.stdout.str():
         pytest.skip("bash provided no output, argcomplete not available?")
     else:
-        if py.std.sys.version_info < (2, 7):
-            result.stdout.lines = result.stdout.lines[0].split('\x0b')
-            result.stdout.fnmatch_lines(["--funcargs", "--fulltrace"])
-        else:
-            result.stdout.fnmatch_lines(["--funcargs", "--fulltrace"])
-    if py.std.sys.version_info < (2, 7):
-        return
-    os.mkdir('test_argcomplete.d')
-    arg = 'test_argc'
-    monkeypatch.setenv('COMP_LINE', "pytest " + arg)
-    monkeypatch.setenv('COMP_POINT', str(len('pytest ' + arg)))
-    result = testdir.run('bash', str(script), arg)
+        result.stdout.fnmatch_lines(["--funcargs", "--fulltrace"])
+    os.mkdir("test_argcomplete.d")
+    arg = "test_argc"
+    monkeypatch.setenv("COMP_LINE", "pytest " + arg)
+    monkeypatch.setenv("COMP_POINT", str(len("pytest " + arg)))
+    result = testdir.run("bash", str(script), arg)
     result.stdout.fnmatch_lines(["test_argcomplete", "test_argcomplete.d/"])
--- a/third_party/python/pytest/testing/test_pastebin.py
+++ b/third_party/python/pytest/testing/test_pastebin.py
@@ -4,114 +4,129 @@ import sys
 import pytest
 
 
 class TestPasteCapture(object):
 
     @pytest.fixture
     def pastebinlist(self, monkeypatch, request):
         pastebinlist = []
-        plugin = request.config.pluginmanager.getplugin('pastebin')
-        monkeypatch.setattr(plugin, 'create_new_paste', pastebinlist.append)
+        plugin = request.config.pluginmanager.getplugin("pastebin")
+        monkeypatch.setattr(plugin, "create_new_paste", pastebinlist.append)
         return pastebinlist
 
     def test_failed(self, testdir, pastebinlist):
-        testpath = testdir.makepyfile("""
+        testpath = testdir.makepyfile(
+            """
             import pytest
             def test_pass():
                 pass
             def test_fail():
                 assert 0
             def test_skip():
                 pytest.skip("")
-        """)
+        """
+        )
         reprec = testdir.inline_run(testpath, "--paste=failed")
         assert len(pastebinlist) == 1
         s = pastebinlist[0]
         assert s.find("def test_fail") != -1
         assert reprec.countoutcomes() == [1, 1, 1]
 
     def test_all(self, testdir, pastebinlist):
         from _pytest.pytester import LineMatcher
-        testpath = testdir.makepyfile("""
+
+        testpath = testdir.makepyfile(
+            """
             import pytest
             def test_pass():
                 pass
             def test_fail():
                 assert 0
             def test_skip():
                 pytest.skip("")
-        """)
-        reprec = testdir.inline_run(testpath, "--pastebin=all", '-v')
+        """
+        )
+        reprec = testdir.inline_run(testpath, "--pastebin=all", "-v")
         assert reprec.countoutcomes() == [1, 1, 1]
         assert len(pastebinlist) == 1
-        contents = pastebinlist[0].decode('utf-8')
+        contents = pastebinlist[0].decode("utf-8")
         matcher = LineMatcher(contents.splitlines())
-        matcher.fnmatch_lines([
-            '*test_pass PASSED*',
-            '*test_fail FAILED*',
-            '*test_skip SKIPPED*',
-            '*== 1 failed, 1 passed, 1 skipped in *'
-        ])
+        matcher.fnmatch_lines(
+            [
+                "*test_pass PASSED*",
+                "*test_fail FAILED*",
+                "*test_skip SKIPPED*",
+                "*== 1 failed, 1 passed, 1 skipped in *",
+            ]
+        )
 
     def test_non_ascii_paste_text(self, testdir):
         """Make sure that text which contains non-ascii characters is pasted
         correctly. See #1219.
         """
-        testdir.makepyfile(test_unicode="""
+        testdir.makepyfile(
+            test_unicode="""
             # encoding: utf-8
             def test():
                 assert '☺' == 1
-        """)
-        result = testdir.runpytest('--pastebin=all')
+        """
+        )
+        result = testdir.runpytest("--pastebin=all")
         if sys.version_info[0] == 3:
             expected_msg = "*assert '☺' == 1*"
         else:
             expected_msg = "*assert '\\xe2\\x98\\xba' == 1*"
-        result.stdout.fnmatch_lines([
-            expected_msg,
-            "*== 1 failed in *",
-            '*Sending information to Paste Service*',
-        ])
+        result.stdout.fnmatch_lines(
+            [
+                expected_msg,
+                "*== 1 failed in *",
+                "*Sending information to Paste Service*",
+            ]
+        )
 
 
 class TestPaste(object):
 
     @pytest.fixture
     def pastebin(self, request):
-        return request.config.pluginmanager.getplugin('pastebin')
+        return request.config.pluginmanager.getplugin("pastebin")
 
     @pytest.fixture
     def mocked_urlopen(self, monkeypatch):
         """
         monkeypatch the actual urlopen calls done by the internal plugin
         function that connects to bpaste service.
         """
         calls = []
 
         def mocked(url, data):
             calls.append((url, data))
 
             class DummyFile(object):
+
                 def read(self):
                     # part of html of a normal response
                     return b'View <a href="/raw/3c0c6750bd">raw</a>.'
+
             return DummyFile()
 
         if sys.version_info < (3, 0):
             import urllib
-            monkeypatch.setattr(urllib, 'urlopen', mocked)
+
+            monkeypatch.setattr(urllib, "urlopen", mocked)
         else:
             import urllib.request
-            monkeypatch.setattr(urllib.request, 'urlopen', mocked)
+
+            monkeypatch.setattr(urllib.request, "urlopen", mocked)
         return calls
 
     def test_create_new_paste(self, pastebin, mocked_urlopen):
-        result = pastebin.create_new_paste(b'full-paste-contents')
-        assert result == 'https://bpaste.net/show/3c0c6750bd'
+        result = pastebin.create_new_paste(b"full-paste-contents")
+        assert result == "https://bpaste.net/show/3c0c6750bd"
         assert len(mocked_urlopen) == 1
         url, data = mocked_urlopen[0]
         assert type(data) is bytes
-        lexer = 'python3' if sys.version_info[0] == 3 else 'python'
-        assert url == 'https://bpaste.net'
-        assert 'lexer=%s' % lexer in data.decode()
-        assert 'code=full-paste-contents' in data.decode()
-        assert 'expiry=1week' in data.decode()
+        lexer = "python3" if sys.version_info[0] == 3 else "python"
+        assert url == "https://bpaste.net"
+        assert "lexer=%s" % lexer in data.decode()
+        assert "code=full-paste-contents" in data.decode()
+        assert "expiry=1week" in data.decode()
--- a/third_party/python/pytest/testing/test_pdb.py
+++ b/third_party/python/pytest/testing/test_pdb.py
@@ -1,406 +1,702 @@
 from __future__ import absolute_import, division, print_function
 import sys
 import platform
+import os
 
 import _pytest._code
+from _pytest.debugging import SUPPORTS_BREAKPOINT_BUILTIN
 import pytest
 
 
+_ENVIRON_PYTHONBREAKPOINT = os.environ.get("PYTHONBREAKPOINT", "")
+
+
 def runpdb_and_get_report(testdir, source):
     p = testdir.makepyfile(source)
     result = testdir.runpytest_inprocess("--pdb", p)
     reports = result.reprec.getreports("pytest_runtest_logreport")
     assert len(reports) == 3, reports  # setup/call/teardown
     return reports[1]
 
 
 @pytest.fixture
 def custom_pdb_calls():
     called = []
 
     # install dummy debugger class and track which methods were called on it
     class _CustomPdb(object):
+
         def __init__(self, *args, **kwargs):
             called.append("init")
 
         def reset(self):
             called.append("reset")
 
         def interaction(self, *args):
             called.append("interaction")
 
     _pytest._CustomPdb = _CustomPdb
     return called
 
 
+@pytest.fixture
+def custom_debugger_hook():
+    called = []
+
+    # install dummy debugger class and track which methods were called on it
+    class _CustomDebugger(object):
+
+        def __init__(self, *args, **kwargs):
+            called.append("init")
+
+        def reset(self):
+            called.append("reset")
+
+        def interaction(self, *args):
+            called.append("interaction")
+
+        def set_trace(self, frame):
+            print("**CustomDebugger**")
+            called.append("set_trace")
+
+    _pytest._CustomDebugger = _CustomDebugger
+    yield called
+    del _pytest._CustomDebugger
+
+
 class TestPDB(object):
 
     @pytest.fixture
     def pdblist(self, request):
         monkeypatch = request.getfixturevalue("monkeypatch")
         pdblist = []
 
         def mypdb(*args):
             pdblist.append(args)
 
-        plugin = request.config.pluginmanager.getplugin('debugging')
-        monkeypatch.setattr(plugin, 'post_mortem', mypdb)
+        plugin = request.config.pluginmanager.getplugin("debugging")
+        monkeypatch.setattr(plugin, "post_mortem", mypdb)
         return pdblist
 
     def test_pdb_on_fail(self, testdir, pdblist):
-        rep = runpdb_and_get_report(testdir, """
+        rep = runpdb_and_get_report(
+            testdir,
+            """
             def test_func():
                 assert 0
-        """)
+        """,
+        )
         assert rep.failed
         assert len(pdblist) == 1
         tb = _pytest._code.Traceback(pdblist[0][0])
         assert tb[-1].name == "test_func"
 
     def test_pdb_on_xfail(self, testdir, pdblist):
-        rep = runpdb_and_get_report(testdir, """
+        rep = runpdb_and_get_report(
+            testdir,
+            """
             import pytest
             @pytest.mark.xfail
             def test_func():
                 assert 0
-        """)
+        """,
+        )
         assert "xfail" in rep.keywords
         assert not pdblist
 
     def test_pdb_on_skip(self, testdir, pdblist):
-        rep = runpdb_and_get_report(testdir, """
+        rep = runpdb_and_get_report(
+            testdir,
+            """
             import pytest
             def test_func():
                 pytest.skip("hello")
-        """)
+        """,
+        )
         assert rep.skipped
         assert len(pdblist) == 0
 
     def test_pdb_on_BdbQuit(self, testdir, pdblist):
-        rep = runpdb_and_get_report(testdir, """
+        rep = runpdb_and_get_report(
+            testdir,
+            """
             import bdb
             def test_func():
                 raise bdb.BdbQuit
-        """)
+        """,
+        )
         assert rep.failed
         assert len(pdblist) == 0
 
+    def test_pdb_on_KeyboardInterrupt(self, testdir, pdblist):
+        rep = runpdb_and_get_report(
+            testdir,
+            """
+            def test_func():
+                raise KeyboardInterrupt
+        """,
+        )
+        assert rep.failed
+        assert len(pdblist) == 1
+
     def test_pdb_interaction(self, testdir):
-        p1 = testdir.makepyfile("""
+        p1 = testdir.makepyfile(
+            """
             def test_1():
                 i = 0
                 assert i == 1
-        """)
+        """
+        )
         child = testdir.spawn_pytest("--pdb %s" % p1)
         child.expect(".*def test_1")
         child.expect(".*i = 0")
         child.expect("(Pdb)")
         child.sendeof()
         rest = child.read().decode("utf8")
         assert "1 failed" in rest
         assert "def test_1" not in rest
         self.flush(child)
 
     @staticmethod
     def flush(child):
-        if platform.system() == 'Darwin':
+        if platform.system() == "Darwin":
             return
         if child.isalive():
             child.wait()
 
     def test_pdb_unittest_postmortem(self, testdir):
-        p1 = testdir.makepyfile("""
+        p1 = testdir.makepyfile(
+            """
             import unittest
             class Blub(unittest.TestCase):
                 def tearDown(self):
                     self.filename = None
                 def test_false(self):
                     self.filename = 'debug' + '.me'
                     assert 0
-        """)
+        """
+        )
         child = testdir.spawn_pytest("--pdb %s" % p1)
-        child.expect('(Pdb)')
-        child.sendline('p self.filename')
+        child.expect("(Pdb)")
+        child.sendline("p self.filename")
         child.sendeof()
         rest = child.read().decode("utf8")
-        assert 'debug.me' in rest
+        assert "debug.me" in rest
         self.flush(child)
 
     def test_pdb_unittest_skip(self, testdir):
         """Test for issue #2137"""
-        p1 = testdir.makepyfile("""
+        p1 = testdir.makepyfile(
+            """
             import unittest
             @unittest.skipIf(True, 'Skipping also with pdb active')
             class MyTestCase(unittest.TestCase):
                 def test_one(self):
                     assert 0
-        """)
+        """
+        )
         child = testdir.spawn_pytest("-rs --pdb %s" % p1)
-        child.expect('Skipping also with pdb active')
-        child.expect('1 skipped in')
+        child.expect("Skipping also with pdb active")
+        child.expect("1 skipped in")
         child.sendeof()
         self.flush(child)
 
-    def test_pdb_interaction_capture(self, testdir):
-        p1 = testdir.makepyfile("""
+    def test_pdb_print_captured_stdout(self, testdir):
+        p1 = testdir.makepyfile(
+            """
             def test_1():
-                print("getrekt")
+                print("get\\x20rekt")
                 assert False
-        """)
+        """
+        )
         child = testdir.spawn_pytest("--pdb %s" % p1)
-        child.expect("getrekt")
+        child.expect("captured stdout")
+        child.expect("get rekt")
+        child.expect("(Pdb)")
+        child.sendeof()
+        rest = child.read().decode("utf8")
+        assert "1 failed" in rest
+        assert "get rekt" not in rest
+        self.flush(child)
+
+    def test_pdb_print_captured_stderr(self, testdir):
+        p1 = testdir.makepyfile(
+            """
+            def test_1():
+                import sys
+                sys.stderr.write("get\\x20rekt")
+                assert False
+        """
+        )
+        child = testdir.spawn_pytest("--pdb %s" % p1)
+        child.expect("captured stderr")
+        child.expect("get rekt")
         child.expect("(Pdb)")
         child.sendeof()
         rest = child.read().decode("utf8")
         assert "1 failed" in rest
-        assert "getrekt" not in rest
+        assert "get rekt" not in rest
+        self.flush(child)
+
+    def test_pdb_dont_print_empty_captured_stdout_and_stderr(self, testdir):
+        p1 = testdir.makepyfile(
+            """
+            def test_1():
+                assert False
+        """
+        )
+        child = testdir.spawn_pytest("--pdb %s" % p1)
+        child.expect("(Pdb)")
+        output = child.before.decode("utf8")
+        child.sendeof()
+        assert "captured stdout" not in output
+        assert "captured stderr" not in output
+        self.flush(child)
+
+    @pytest.mark.parametrize("showcapture", ["all", "no", "log"])
+    def test_pdb_print_captured_logs(self, testdir, showcapture):
+        p1 = testdir.makepyfile(
+            """
+            def test_1():
+                import logging
+                logging.warn("get " + "rekt")
+                assert False
+        """
+        )
+        child = testdir.spawn_pytest("--show-capture=%s --pdb %s" % (showcapture, p1))
+        if showcapture in ("all", "log"):
+            child.expect("captured log")
+            child.expect("get rekt")
+        child.expect("(Pdb)")
+        child.sendeof()
+        rest = child.read().decode("utf8")
+        assert "1 failed" in rest
+        self.flush(child)
+
+    def test_pdb_print_captured_logs_nologging(self, testdir):
+        p1 = testdir.makepyfile(
+            """
+            def test_1():
+                import logging
+                logging.warn("get " + "rekt")
+                assert False
+        """
+        )
+        child = testdir.spawn_pytest(
+            "--show-capture=all --pdb " "-p no:logging %s" % p1
+        )
+        child.expect("get rekt")
+        output = child.before.decode("utf8")
+        assert "captured log" not in output
+        child.expect("(Pdb)")
+        child.sendeof()
+        rest = child.read().decode("utf8")
+        assert "1 failed" in rest
         self.flush(child)
 
     def test_pdb_interaction_exception(self, testdir):
-        p1 = testdir.makepyfile("""
+        p1 = testdir.makepyfile(
+            """
             import pytest
             def globalfunc():
                 pass
             def test_1():
                 pytest.raises(ValueError, globalfunc)
-        """)
+        """
+        )
         child = testdir.spawn_pytest("--pdb %s" % p1)
         child.expect(".*def test_1")
         child.expect(".*pytest.raises.*globalfunc")
         child.expect("(Pdb)")
         child.sendline("globalfunc")
         child.expect(".*function")
         child.sendeof()
         child.expect("1 failed")
         self.flush(child)
 
     def test_pdb_interaction_on_collection_issue181(self, testdir):
-        p1 = testdir.makepyfile("""
+        p1 = testdir.makepyfile(
+            """
             import pytest
             xxx
-        """)
+        """
+        )
         child = testdir.spawn_pytest("--pdb %s" % p1)
         # child.expect(".*import pytest.*")
         child.expect("(Pdb)")
         child.sendeof()
         child.expect("1 error")
         self.flush(child)
 
     def test_pdb_interaction_on_internal_error(self, testdir):
-        testdir.makeconftest("""
+        testdir.makeconftest(
+            """
             def pytest_runtest_protocol():
                 0/0
-        """)
+        """
+        )
         p1 = testdir.makepyfile("def test_func(): pass")
         child = testdir.spawn_pytest("--pdb %s" % p1)
         # child.expect(".*import pytest.*")
         child.expect("(Pdb)")
         child.sendeof()
         self.flush(child)
 
     def test_pdb_interaction_capturing_simple(self, testdir):
-        p1 = testdir.makepyfile("""
+        p1 = testdir.makepyfile(
+            """
             import pytest
             def test_1():
                 i = 0
                 print ("hello17")
                 pytest.set_trace()
                 x = 3
-        """)
+        """
+        )
         child = testdir.spawn_pytest(str(p1))
         child.expect("test_1")
         child.expect("x = 3")
         child.expect("(Pdb)")
         child.sendeof()
         rest = child.read().decode("utf-8")
         assert "1 failed" in rest
         assert "def test_1" in rest
         assert "hello17" in rest  # out is captured
         self.flush(child)
 
     def test_pdb_set_trace_interception(self, testdir):
-        p1 = testdir.makepyfile("""
+        p1 = testdir.makepyfile(
+            """
             import pdb
             def test_1():
                 pdb.set_trace()
-        """)
+        """
+        )
         child = testdir.spawn_pytest(str(p1))
         child.expect("test_1")
         child.expect("(Pdb)")
         child.sendeof()
         rest = child.read().decode("utf8")
         assert "1 failed" in rest
         assert "reading from stdin while output" not in rest
         self.flush(child)
 
     def test_pdb_and_capsys(self, testdir):
-        p1 = testdir.makepyfile("""
+        p1 = testdir.makepyfile(
+            """
             import pytest
             def test_1(capsys):
                 print ("hello1")
                 pytest.set_trace()
-        """)
+        """
+        )
         child = testdir.spawn_pytest(str(p1))
         child.expect("test_1")
         child.send("capsys.readouterr()\n")
         child.expect("hello1")
         child.sendeof()
         child.read()
         self.flush(child)
 
     def test_set_trace_capturing_afterwards(self, testdir):
-        p1 = testdir.makepyfile("""
+        p1 = testdir.makepyfile(
+            """
             import pdb
             def test_1():
                 pdb.set_trace()
             def test_2():
                 print ("hello")
                 assert 0
-        """)
+        """
+        )
         child = testdir.spawn_pytest(str(p1))
         child.expect("test_1")
         child.send("c\n")
         child.expect("test_2")
         child.expect("Captured")
         child.expect("hello")
         child.sendeof()
         child.read()
         self.flush(child)
 
     def test_pdb_interaction_doctest(self, testdir):
-        p1 = testdir.makepyfile("""
+        p1 = testdir.makepyfile(
+            """
             import pytest
             def function_1():
                 '''
                 >>> i = 0
                 >>> assert i == 1
                 '''
-        """)
+        """
+        )
         child = testdir.spawn_pytest("--doctest-modules --pdb %s" % p1)
         child.expect("(Pdb)")
-        child.sendline('i')
+        child.sendline("i")
         child.expect("0")
         child.expect("(Pdb)")
         child.sendeof()
         rest = child.read().decode("utf8")
         assert "1 failed" in rest
         self.flush(child)
 
     def test_pdb_interaction_capturing_twice(self, testdir):
-        p1 = testdir.makepyfile("""
+        p1 = testdir.makepyfile(
+            """
             import pytest
             def test_1():
                 i = 0
                 print ("hello17")
                 pytest.set_trace()
                 x = 3
                 print ("hello18")
                 pytest.set_trace()
                 x = 4
-        """)
+        """
+        )
         child = testdir.spawn_pytest(str(p1))
         child.expect("test_1")
         child.expect("x = 3")
         child.expect("(Pdb)")
-        child.sendline('c')
+        child.sendline("c")
         child.expect("x = 4")
         child.sendeof()
         rest = child.read().decode("utf8")
         assert "1 failed" in rest
         assert "def test_1" in rest
         assert "hello17" in rest  # out is captured
         assert "hello18" in rest  # out is captured
         self.flush(child)
 
     def test_pdb_used_outside_test(self, testdir):
-        p1 = testdir.makepyfile("""
+        p1 = testdir.makepyfile(
+            """
             import pytest
             pytest.set_trace()
             x = 5
-        """)
+        """
+        )
         child = testdir.spawn("%s %s" % (sys.executable, p1))
         child.expect("x = 5")
         child.sendeof()
         self.flush(child)
 
     def test_pdb_used_in_generate_tests(self, testdir):
-        p1 = testdir.makepyfile("""
+        p1 = testdir.makepyfile(
+            """
             import pytest
             def pytest_generate_tests(metafunc):
                 pytest.set_trace()
                 x = 5
             def test_foo(a):
                 pass
-        """)
+        """
+        )
         child = testdir.spawn_pytest(str(p1))
         child.expect("x = 5")
         child.sendeof()
         self.flush(child)
 
     def test_pdb_collection_failure_is_shown(self, testdir):
-        p1 = testdir.makepyfile("""xxx """)
+        p1 = testdir.makepyfile("xxx")
         result = testdir.runpytest_subprocess("--pdb", p1)
-        result.stdout.fnmatch_lines([
-            "*NameError*xxx*",
-            "*1 error*",
-        ])
+        result.stdout.fnmatch_lines(["*NameError*xxx*", "*1 error*"])
 
     def test_enter_pdb_hook_is_called(self, testdir):
-        testdir.makeconftest("""
+        testdir.makeconftest(
+            """
             def pytest_enter_pdb(config):
                 assert config.testing_verification == 'configured'
                 print 'enter_pdb_hook'
 
             def pytest_configure(config):
                 config.testing_verification = 'configured'
-        """)
-        p1 = testdir.makepyfile("""
+        """
+        )
+        p1 = testdir.makepyfile(
+            """
             import pytest
 
             def test_foo():
                 pytest.set_trace()
-        """)
+        """
+        )
         child = testdir.spawn_pytest(str(p1))
         child.expect("enter_pdb_hook")
-        child.send('c\n')
+        child.send("c\n")
         child.sendeof()
         self.flush(child)
 
     def test_pdb_custom_cls(self, testdir, custom_pdb_calls):
         p1 = testdir.makepyfile("""xxx """)
-        result = testdir.runpytest_inprocess(
-            "--pdb", "--pdbcls=_pytest:_CustomPdb", p1)
-        result.stdout.fnmatch_lines([
-            "*NameError*xxx*",
-            "*1 error*",
-        ])
+        result = testdir.runpytest_inprocess("--pdb", "--pdbcls=_pytest:_CustomPdb", p1)
+        result.stdout.fnmatch_lines(["*NameError*xxx*", "*1 error*"])
         assert custom_pdb_calls == ["init", "reset", "interaction"]
 
     def test_pdb_custom_cls_without_pdb(self, testdir, custom_pdb_calls):
         p1 = testdir.makepyfile("""xxx """)
-        result = testdir.runpytest_inprocess(
-            "--pdbcls=_pytest:_CustomPdb", p1)
-        result.stdout.fnmatch_lines([
-            "*NameError*xxx*",
-            "*1 error*",
-        ])
+        result = testdir.runpytest_inprocess("--pdbcls=_pytest:_CustomPdb", p1)
+        result.stdout.fnmatch_lines(["*NameError*xxx*", "*1 error*"])
         assert custom_pdb_calls == []
 
     def test_pdb_custom_cls_with_settrace(self, testdir, monkeypatch):
-        testdir.makepyfile(custom_pdb="""
+        testdir.makepyfile(
+            custom_pdb="""
             class CustomPdb(object):
                 def set_trace(*args, **kwargs):
                     print 'custom set_trace>'
-         """)
-        p1 = testdir.makepyfile("""
+         """
+        )
+        p1 = testdir.makepyfile(
+            """
             import pytest
 
             def test_foo():
                 pytest.set_trace()
-        """)
-        monkeypatch.setenv('PYTHONPATH', str(testdir.tmpdir))
+        """
+        )
+        monkeypatch.setenv("PYTHONPATH", str(testdir.tmpdir))
         child = testdir.spawn_pytest("--pdbcls=custom_pdb:CustomPdb %s" % str(p1))
 
-        child.expect('custom set_trace>')
-        if child.isalive():
-            child.wait()
+        child.expect("custom set_trace>")
+        self.flush(child)
+
+
+class TestDebuggingBreakpoints(object):
+
+    def test_supports_breakpoint_module_global(self):
+        """
+        Test that supports breakpoint global marks on Python 3.7+ and not on
+        CPython 3.5, 2.7
+        """
+        if sys.version_info.major == 3 and sys.version_info.minor >= 7:
+            assert SUPPORTS_BREAKPOINT_BUILTIN is True
+        if sys.version_info.major == 3 and sys.version_info.minor == 5:
+            assert SUPPORTS_BREAKPOINT_BUILTIN is False
+        if sys.version_info.major == 2 and sys.version_info.minor == 7:
+            assert SUPPORTS_BREAKPOINT_BUILTIN is False
+
+    @pytest.mark.skipif(
+        not SUPPORTS_BREAKPOINT_BUILTIN, reason="Requires breakpoint() builtin"
+    )
+    @pytest.mark.parametrize("arg", ["--pdb", ""])
+    def test_sys_breakpointhook_configure_and_unconfigure(self, testdir, arg):
+        """
+        Test that sys.breakpointhook is set to the custom Pdb class once configured, test that
+        hook is reset to system value once pytest has been unconfigured
+        """
+        testdir.makeconftest(
+            """
+            import sys
+            from pytest import hookimpl
+            from _pytest.debugging import pytestPDB
+
+            def pytest_configure(config):
+                config._cleanup.append(check_restored)
+
+            def check_restored():
+                assert sys.breakpointhook == sys.__breakpointhook__
+
+            def test_check():
+                assert sys.breakpointhook == pytestPDB.set_trace
+        """
+        )
+        testdir.makepyfile(
+            """
+            def test_nothing(): pass
+        """
+        )
+        args = (arg,) if arg else ()
+        result = testdir.runpytest_subprocess(*args)
+        result.stdout.fnmatch_lines(["*1 passed in *"])
+
+    @pytest.mark.skipif(
+        not SUPPORTS_BREAKPOINT_BUILTIN, reason="Requires breakpoint() builtin"
+    )
+    def test_pdb_custom_cls(self, testdir, custom_debugger_hook):
+        p1 = testdir.makepyfile(
+            """
+            def test_nothing():
+                breakpoint()
+        """
+        )
+        result = testdir.runpytest_inprocess(
+            "--pdb", "--pdbcls=_pytest:_CustomDebugger", p1
+        )
+        result.stdout.fnmatch_lines(["*CustomDebugger*", "*1 passed*"])
+        assert custom_debugger_hook == ["init", "set_trace"]
+
+    @pytest.mark.parametrize("arg", ["--pdb", ""])
+    @pytest.mark.skipif(
+        not SUPPORTS_BREAKPOINT_BUILTIN, reason="Requires breakpoint() builtin"
+    )
+    def test_environ_custom_class(self, testdir, custom_debugger_hook, arg):
+        testdir.makeconftest(
+            """
+            import os
+            import sys
+
+            os.environ['PYTHONBREAKPOINT'] = '_pytest._CustomDebugger.set_trace'
+
+            def pytest_configure(config):
+                config._cleanup.append(check_restored)
+
+            def check_restored():
+                assert sys.breakpointhook == sys.__breakpointhook__
+
+            def test_check():
+                import _pytest
+                assert sys.breakpointhook is _pytest._CustomDebugger.set_trace
+        """
+        )
+        testdir.makepyfile(
+            """
+            def test_nothing(): pass
+        """
+        )
+        args = (arg,) if arg else ()
+        result = testdir.runpytest_subprocess(*args)
+        result.stdout.fnmatch_lines(["*1 passed in *"])
+
+    @pytest.mark.skipif(
+        not SUPPORTS_BREAKPOINT_BUILTIN, reason="Requires breakpoint() builtin"
+    )
+    @pytest.mark.skipif(
+        not _ENVIRON_PYTHONBREAKPOINT == "",
+        reason="Requires breakpoint() default value",
+    )
+    def test_sys_breakpoint_interception(self, testdir):
+        p1 = testdir.makepyfile(
+            """
+            def test_1():
+                breakpoint()
+        """
+        )
+        child = testdir.spawn_pytest(str(p1))
+        child.expect("test_1")
+        child.expect("(Pdb)")
+        child.sendeof()
+        rest = child.read().decode("utf8")
+        assert "1 failed" in rest
+        assert "reading from stdin while output" not in rest
+        TestPDB.flush(child)
+
+    @pytest.mark.skipif(
+        not SUPPORTS_BREAKPOINT_BUILTIN, reason="Requires breakpoint() builtin"
+    )
+    def test_pdb_not_altered(self, testdir):
+        p1 = testdir.makepyfile(
+            """
+            import pdb
+            def test_1():
+                pdb.set_trace()
+        """
+        )
+        child = testdir.spawn_pytest(str(p1))
+        child.expect("test_1")
+        child.expect("(Pdb)")
+        child.sendeof()
+        rest = child.read().decode("utf8")
+        assert "1 failed" in rest
+        assert "reading from stdin while output" not in rest
+        TestPDB.flush(child)
--- a/third_party/python/pytest/testing/test_pluginmanager.py
+++ b/third_party/python/pytest/testing/test_pluginmanager.py
@@ -1,98 +1,115 @@
 # encoding: UTF-8
 from __future__ import absolute_import, division, print_function
 import pytest
-import py
 import os
+import re
+import sys
+import types
 
 from _pytest.config import get_config, PytestPluginManager
 from _pytest.main import EXIT_NOTESTSCOLLECTED, Session
 
 
 @pytest.fixture
 def pytestpm():
     return PytestPluginManager()
 
 
 class TestPytestPluginInteractions(object):
+
     def test_addhooks_conftestplugin(self, testdir):
-        testdir.makepyfile(newhooks="""
+        testdir.makepyfile(
+            newhooks="""
             def pytest_myhook(xyz):
                 "new hook"
-        """)
-        conf = testdir.makeconftest("""
+        """
+        )
+        conf = testdir.makeconftest(
+            """
             import sys ; sys.path.insert(0, '.')
             import newhooks
             def pytest_addhooks(pluginmanager):
                 pluginmanager.addhooks(newhooks)
             def pytest_myhook(xyz):
                 return xyz + 1
-        """)
+        """
+        )
         config = get_config()
         pm = config.pluginmanager
         pm.hook.pytest_addhooks.call_historic(
-            kwargs=dict(pluginmanager=config.pluginmanager))
+            kwargs=dict(pluginmanager=config.pluginmanager)
+        )
         config.pluginmanager._importconftest(conf)
         # print(config.pluginmanager.get_plugins())
         res = config.hook.pytest_myhook(xyz=10)
         assert res == [11]
 
     def test_addhooks_nohooks(self, testdir):
-        testdir.makeconftest("""
+        testdir.makeconftest(
+            """
             import sys
             def pytest_addhooks(pluginmanager):
                 pluginmanager.addhooks(sys)
-        """)
+        """
+        )
         res = testdir.runpytest()
         assert res.ret != 0
-        res.stderr.fnmatch_lines([
-            "*did not find*sys*"
-        ])
+        res.stderr.fnmatch_lines(["*did not find*sys*"])
 
     def test_namespace_early_from_import(self, testdir):
-        p = testdir.makepyfile("""
+        p = testdir.makepyfile(
+            """
             from pytest import Item
             from pytest import Item as Item2
             assert Item is Item2
-        """)
+        """
+        )
         result = testdir.runpython(p)
         assert result.ret == 0
 
     def test_do_ext_namespace(self, testdir):
-        testdir.makeconftest("""
+        testdir.makeconftest(
+            """
             def pytest_namespace():
                 return {'hello': 'world'}
-        """)
-        p = testdir.makepyfile("""
+        """
+        )
+        p = testdir.makepyfile(
+            """
             from pytest import hello
             import pytest
             def test_hello():
                 assert hello == "world"
                 assert 'hello' in pytest.__all__
-        """)
+        """
+        )
         reprec = testdir.inline_run(p)
         reprec.assertoutcome(passed=1)
 
     def test_do_option_postinitialize(self, testdir):
         config = testdir.parseconfigure()
-        assert not hasattr(config.option, 'test123')
-        p = testdir.makepyfile("""
+        assert not hasattr(config.option, "test123")
+        p = testdir.makepyfile(
+            """
             def pytest_addoption(parser):
                 parser.addoption('--test123', action="store_true",
                     default=True)
-        """)
+        """
+        )
         config.pluginmanager._importconftest(p)
         assert config.option.test123
 
     def test_configure(self, testdir):
         config = testdir.parseconfig()
         values = []
 
         class A(object):
+
             def pytest_configure(self, config):
                 values.append(self)
 
         config.pluginmanager.register(A())
         assert len(values) == 0
         config._do_configure()
         assert len(values) == 1
         config.pluginmanager.register(A())  # leads to a configured() plugin
@@ -103,221 +120,215 @@ class TestPytestPluginInteractions(objec
         config.pluginmanager.register(A())
         assert len(values) == 2
 
     def test_hook_tracing(self):
         pytestpm = get_config().pluginmanager  # fully initialized with plugins
         saveindent = []
 
         class api1(object):
+
             def pytest_plugin_registered(self):
                 saveindent.append(pytestpm.trace.root.indent)
 
         class api2(object):
+
             def pytest_plugin_registered(self):
                 saveindent.append(pytestpm.trace.root.indent)
                 raise ValueError()
 
         values = []
         pytestpm.trace.root.setwriter(values.append)
         undo = pytestpm.enable_tracing()
         try:
             indent = pytestpm.trace.root.indent
             p = api1()
             pytestpm.register(p)
             assert pytestpm.trace.root.indent == indent
             assert len(values) >= 2
-            assert 'pytest_plugin_registered' in values[0]
-            assert 'finish' in values[1]
+            assert "pytest_plugin_registered" in values[0]
+            assert "finish" in values[1]
 
             values[:] = []
             with pytest.raises(ValueError):
                 pytestpm.register(api2())
             assert pytestpm.trace.root.indent == indent
             assert saveindent[0] > indent
         finally:
             undo()
 
     def test_hook_proxy(self, testdir):
         """Test the gethookproxy function(#2016)"""
         config = testdir.parseconfig()
         session = Session(config)
-        testdir.makepyfile(**{
-            'tests/conftest.py': '',
-            'tests/subdir/conftest.py': '',
-        })
+        testdir.makepyfile(**{"tests/conftest.py": "", "tests/subdir/conftest.py": ""})
 
-        conftest1 = testdir.tmpdir.join('tests/conftest.py')
-        conftest2 = testdir.tmpdir.join('tests/subdir/conftest.py')
+        conftest1 = testdir.tmpdir.join("tests/conftest.py")
+        conftest2 = testdir.tmpdir.join("tests/subdir/conftest.py")
 
         config.pluginmanager._importconftest(conftest1)
-        ihook_a = session.gethookproxy(testdir.tmpdir.join('tests'))
+        ihook_a = session.gethookproxy(testdir.tmpdir.join("tests"))
         assert ihook_a is not None
         config.pluginmanager._importconftest(conftest2)
-        ihook_b = session.gethookproxy(testdir.tmpdir.join('tests'))
+        ihook_b = session.gethookproxy(testdir.tmpdir.join("tests"))
         assert ihook_a is not ihook_b
 
-    def test_warn_on_deprecated_multicall(self, pytestpm):
-        warnings = []
-
-        class get_warnings(object):
-            def pytest_logwarning(self, message):
-                warnings.append(message)
-
-        class Plugin(object):
-            def pytest_configure(self, __multicall__):
-                pass
-
-        pytestpm.register(get_warnings())
-        before = list(warnings)
-        pytestpm.register(Plugin())
-        assert len(warnings) == len(before) + 1
-        assert "deprecated" in warnings[-1]
-
     def test_warn_on_deprecated_addhooks(self, pytestpm):
         warnings = []
 
         class get_warnings(object):
+
             def pytest_logwarning(self, code, fslocation, message, nodeid):
                 warnings.append(message)
 
         class Plugin(object):
+
             def pytest_testhook():
                 pass
 
         pytestpm.register(get_warnings())
         before = list(warnings)
         pytestpm.addhooks(Plugin())
         assert len(warnings) == len(before) + 1
         assert "deprecated" in warnings[-1]
 
 
 def test_namespace_has_default_and_env_plugins(testdir):
-    p = testdir.makepyfile("""
+    p = testdir.makepyfile(
+        """
         import pytest
         pytest.mark
-    """)
+    """
+    )
     result = testdir.runpython(p)
     assert result.ret == 0
 
 
 def test_default_markers(testdir):
     result = testdir.runpytest("--markers")
-    result.stdout.fnmatch_lines([
-        "*tryfirst*first*",
-        "*trylast*last*",
-    ])
+    result.stdout.fnmatch_lines(["*tryfirst*first*", "*trylast*last*"])
 
 
 def test_importplugin_error_message(testdir, pytestpm):
     """Don't hide import errors when importing plugins and provide
     an easy to debug message.
 
     See #375 and #1998.
     """
     testdir.syspathinsert(testdir.tmpdir)
-    testdir.makepyfile(qwe="""
+    testdir.makepyfile(
+        qwe="""
         # encoding: UTF-8
-        raise ImportError(u'Not possible to import: ☺')
-    """)
+        def test_traceback():
+            raise ImportError(u'Not possible to import: ☺')
+        test_traceback()
+    """
+    )
     with pytest.raises(ImportError) as excinfo:
         pytestpm.import_plugin("qwe")
-    expected = '.*Error importing plugin "qwe": Not possible to import: .'
-    assert py.std.re.match(expected, str(excinfo.value))
+
+    expected_message = '.*Error importing plugin "qwe": Not possible to import: .'
+    expected_traceback = ".*in test_traceback"
+    assert re.match(expected_message, str(excinfo.value))
+    assert re.match(expected_traceback, str(excinfo.traceback[-1]))
 
 
 class TestPytestPluginManager(object):
+
     def test_register_imported_modules(self):
         pm = PytestPluginManager()
-        mod = py.std.types.ModuleType("x.y.pytest_hello")
+        mod = types.ModuleType("x.y.pytest_hello")
         pm.register(mod)
         assert pm.is_registered(mod)
         values = pm.get_plugins()
         assert mod in values
         pytest.raises(ValueError, "pm.register(mod)")
         pytest.raises(ValueError, lambda: pm.register(mod))
         # assert not pm.is_registered(mod2)
         assert pm.get_plugins() == values
 
     def test_canonical_import(self, monkeypatch):
-        mod = py.std.types.ModuleType("pytest_xyz")
-        monkeypatch.setitem(py.std.sys.modules, 'pytest_xyz', mod)
+        mod = types.ModuleType("pytest_xyz")
+        monkeypatch.setitem(sys.modules, "pytest_xyz", mod)
         pm = PytestPluginManager()
-        pm.import_plugin('pytest_xyz')
-        assert pm.get_plugin('pytest_xyz') == mod
+        pm.import_plugin("pytest_xyz")
+        assert pm.get_plugin("pytest_xyz") == mod
         assert pm.is_registered(mod)
 
     def test_consider_module(self, testdir, pytestpm):
         testdir.syspathinsert()
         testdir.makepyfile(pytest_p1="#")
         testdir.makepyfile(pytest_p2="#")
-        mod = py.std.types.ModuleType("temp")
+        mod = types.ModuleType("temp")
         mod.pytest_plugins = ["pytest_p1", "pytest_p2"]
         pytestpm.consider_module(mod)
         assert pytestpm.get_plugin("pytest_p1").__name__ == "pytest_p1"
         assert pytestpm.get_plugin("pytest_p2").__name__ == "pytest_p2"
 
     def test_consider_module_import_module(self, testdir):
         pytestpm = get_config().pluginmanager
-        mod = py.std.types.ModuleType("x")
+        mod = types.ModuleType("x")
         mod.pytest_plugins = "pytest_a"
         aplugin = testdir.makepyfile(pytest_a="#")
         reprec = testdir.make_hook_recorder(pytestpm)
         # syspath.prepend(aplugin.dirpath())
-        py.std.sys.path.insert(0, str(aplugin.dirpath()))
+        sys.path.insert(0, str(aplugin.dirpath()))
         pytestpm.consider_module(mod)
         call = reprec.getcall(pytestpm.hook.pytest_plugin_registered.name)
         assert call.plugin.__name__ == "pytest_a"
 
         # check that it is not registered twice
         pytestpm.consider_module(mod)
         values = reprec.getcalls("pytest_plugin_registered")
         assert len(values) == 1
 
     def test_consider_env_fails_to_import(self, monkeypatch, pytestpm):
-        monkeypatch.setenv('PYTEST_PLUGINS', 'nonexisting', prepend=",")
+        monkeypatch.setenv("PYTEST_PLUGINS", "nonexisting", prepend=",")
         with pytest.raises(ImportError):
             pytestpm.consider_env()
 
     def test_plugin_skip(self, testdir, monkeypatch):
-        p = testdir.makepyfile(skipping1="""
+        p = testdir.makepyfile(
+            skipping1="""
             import pytest
             pytest.skip("hello")
-        """)
+        """
+        )
         p.copy(p.dirpath("skipping2.py"))
         monkeypatch.setenv("PYTEST_PLUGINS", "skipping2")
         result = testdir.runpytest("-rw", "-p", "skipping1", syspathinsert=True)
         assert result.ret == EXIT_NOTESTSCOLLECTED
-        result.stdout.fnmatch_lines([
-            "*skipped plugin*skipping1*hello*",
-            "*skipped plugin*skipping2*hello*",
-        ])
+        result.stdout.fnmatch_lines(
+            ["*skipped plugin*skipping1*hello*", "*skipped plugin*skipping2*hello*"]
+        )
 
     def test_consider_env_plugin_instantiation(self, testdir, monkeypatch, pytestpm):
         testdir.syspathinsert()
         testdir.makepyfile(xy123="#")
-        monkeypatch.setitem(os.environ, 'PYTEST_PLUGINS', 'xy123')
+        monkeypatch.setitem(os.environ, "PYTEST_PLUGINS", "xy123")
         l1 = len(pytestpm.get_plugins())
         pytestpm.consider_env()
         l2 = len(pytestpm.get_plugins())
         assert l2 == l1 + 1
-        assert pytestpm.get_plugin('xy123')
+        assert pytestpm.get_plugin("xy123")
         pytestpm.consider_env()
         l3 = len(pytestpm.get_plugins())
         assert l2 == l3
 
     def test_pluginmanager_ENV_startup(self, testdir, monkeypatch):
         testdir.makepyfile(pytest_x500="#")
-        p = testdir.makepyfile("""
+        p = testdir.makepyfile(
+            """
             import pytest
             def test_hello(pytestconfig):
                 plugin = pytestconfig.pluginmanager.get_plugin('pytest_x500')
                 assert plugin is not None
-        """)
-        monkeypatch.setenv('PYTEST_PLUGINS', 'pytest_x500', prepend=",")
+        """
+        )
+        monkeypatch.setenv("PYTEST_PLUGINS", "pytest_x500", prepend=",")
         result = testdir.runpytest(p, syspathinsert=True)
         assert result.ret == 0
         result.stdout.fnmatch_lines(["*1 passed*"])
 
     def test_import_plugin_importname(self, testdir, pytestpm):
         pytest.raises(ImportError, 'pytestpm.import_plugin("qweqwex.y")')
         pytest.raises(ImportError, 'pytestpm.import_plugin("pytest_qweqwx.y")')
 
@@ -325,17 +336,17 @@ class TestPytestPluginManager(object):
         pluginname = "pytest_hello"
         testdir.makepyfile(**{pluginname: ""})
         pytestpm.import_plugin("pytest_hello")
         len1 = len(pytestpm.get_plugins())
         pytestpm.import_plugin("pytest_hello")
         len2 = len(pytestpm.get_plugins())
         assert len1 == len2
         plugin1 = pytestpm.get_plugin("pytest_hello")
-        assert plugin1.__name__.endswith('pytest_hello')
+        assert plugin1.__name__.endswith("pytest_hello")
         plugin2 = pytestpm.get_plugin("pytest_hello")
         assert plugin2 is plugin1
 
     def test_import_plugin_dotted_name(self, testdir, pytestpm):
         pytest.raises(ImportError, 'pytestpm.import_plugin("qweqwex.y")')
         pytest.raises(ImportError, 'pytestpm.import_plugin("pytest_qweqwex.y")')
 
         testdir.syspathinsert()
@@ -347,19 +358,21 @@ class TestPytestPluginManager(object):
 
     def test_consider_conftest_deps(self, testdir, pytestpm):
         mod = testdir.makepyfile("pytest_plugins='xyz'").pyimport()
         with pytest.raises(ImportError):
             pytestpm.consider_conftest(mod)
 
 
 class TestPytestPluginManagerBootstrapming(object):
+
     def test_preparse_args(self, pytestpm):
-        pytest.raises(ImportError, lambda:
-                      pytestpm.consider_preparse(["xyz", "-p", "hello123"]))
+        pytest.raises(
+            ImportError, lambda: pytestpm.consider_preparse(["xyz", "-p", "hello123"])
+        )
 
     def test_plugin_prevent_register(self, pytestpm):
         pytestpm.consider_preparse(["xyz", "-p", "no:abc"])
         l1 = pytestpm.get_plugins()
         pytestpm.register(42, name="abc")
         l2 = pytestpm.get_plugins()
         assert len(l2) == len(l1)
         assert 42 not in l2
--- a/third_party/python/pytest/testing/test_pytester.py
+++ b/third_party/python/pytest/testing/test_pytester.py
@@ -1,12 +1,17 @@
+# -*- coding: utf-8 -*-
 from __future__ import absolute_import, division, print_function
+import os
+import py.path
 import pytest
-import os
+import sys
+import _pytest.pytester as pytester
 from _pytest.pytester import HookRecorder
+from _pytest.pytester import CwdSnapshot, SysModulesSnapshot, SysPathsSnapshot
 from _pytest.config import PytestPluginManager
 from _pytest.main import EXIT_OK, EXIT_TESTSFAILED
 
 
 def test_make_hook_recorder(testdir):
     item = testdir.getitem("def test_func(): pass")
     recorder = testdir.make_hook_recorder(item.config.pluginmanager)
     assert not recorder.getfailures()
@@ -27,16 +32,17 @@ def test_make_hook_recorder(testdir):
     assert failures == [rep]
 
     class rep(object):
         excinfo = None
         passed = False
         failed = False
         skipped = True
         when = "call"
+
     rep.passed = False
     rep.skipped = True
     recorder.hook.pytest_runtest_logreport(report=rep)
 
     modcol = testdir.getmodulecol("")
     rep = modcol.config.hook.pytest_make_collect_report(collector=modcol)
     rep.passed = False
     rep.failed = True
@@ -61,34 +67,38 @@ def test_make_hook_recorder(testdir):
 def test_parseconfig(testdir):
     config1 = testdir.parseconfig()
     config2 = testdir.parseconfig()
     assert config2 != config1
     assert config1 != pytest.config
 
 
 def test_testdir_runs_with_plugin(testdir):
-    testdir.makepyfile("""
+    testdir.makepyfile(
+        """
         pytest_plugins = "pytester"
         def test_hello(testdir):
             assert 1
-    """)
+    """
+    )
     result = testdir.runpytest()
     result.assert_outcomes(passed=1)
 
 
 def make_holder():
+
     class apiclass(object):
+
         def pytest_xyz(self, arg):
             "x"
 
         def pytest_xyz_noarg(self):
             "x"
 
-    apimod = type(os)('api')
+    apimod = type(os)("api")
 
     def pytest_xyz(arg):
         "x"
 
     def pytest_xyz_noarg():
         "x"
 
     apimod.pytest_xyz = pytest_xyz
@@ -115,24 +125,277 @@ def test_makepyfile_unicode(testdir):
     global unichr
     try:
         unichr(65)
     except NameError:
         unichr = chr
     testdir.makepyfile(unichr(0xfffd))
 
 
-def test_inline_run_clean_modules(testdir):
-    test_mod = testdir.makepyfile("def test_foo(): assert True")
-    result = testdir.inline_run(str(test_mod))
-    assert result.ret == EXIT_OK
-    # rewrite module, now test should fail if module was re-imported
-    test_mod.write("def test_foo(): assert False")
-    result2 = testdir.inline_run(str(test_mod))
-    assert result2.ret == EXIT_TESTSFAILED
+def test_makepyfile_utf8(testdir):
+    """Ensure makepyfile accepts utf-8 bytes as input (#2738)"""
+    utf8_contents = u"""
+        def setup_function(function):
+            mixed_encoding = u'São Paulo'
+    """.encode(
+        "utf-8"
+    )
+    p = testdir.makepyfile(utf8_contents)
+    assert u"mixed_encoding = u'São Paulo'".encode("utf-8") in p.read("rb")
+
+
+class TestInlineRunModulesCleanup(object):
+
+    def test_inline_run_test_module_not_cleaned_up(self, testdir):
+        test_mod = testdir.makepyfile("def test_foo(): assert True")
+        result = testdir.inline_run(str(test_mod))
+        assert result.ret == EXIT_OK
+        # rewrite module, now test should fail if module was re-imported
+        test_mod.write("def test_foo(): assert False")
+        result2 = testdir.inline_run(str(test_mod))
+        assert result2.ret == EXIT_TESTSFAILED
+
+    def spy_factory(self):
+
+        class SysModulesSnapshotSpy(object):
+            instances = []
+
+            def __init__(self, preserve=None):
+                SysModulesSnapshotSpy.instances.append(self)
+                self._spy_restore_count = 0
+                self._spy_preserve = preserve
+                self.__snapshot = SysModulesSnapshot(preserve=preserve)
+
+            def restore(self):
+                self._spy_restore_count += 1
+                return self.__snapshot.restore()
+
+        return SysModulesSnapshotSpy
+
+    def test_inline_run_taking_and_restoring_a_sys_modules_snapshot(
+        self, testdir, monkeypatch
+    ):
+        spy_factory = self.spy_factory()
+        monkeypatch.setattr(pytester, "SysModulesSnapshot", spy_factory)
+        original = dict(sys.modules)
+        testdir.syspathinsert()
+        testdir.makepyfile(import1="# you son of a silly person")
+        testdir.makepyfile(import2="# my hovercraft is full of eels")
+        test_mod = testdir.makepyfile(
+            """
+            import import1
+            def test_foo(): import import2"""
+        )
+        testdir.inline_run(str(test_mod))
+        assert len(spy_factory.instances) == 1
+        spy = spy_factory.instances[0]
+        assert spy._spy_restore_count == 1
+        assert sys.modules == original
+        assert all(sys.modules[x] is original[x] for x in sys.modules)
+
+    def test_inline_run_sys_modules_snapshot_restore_preserving_modules(
+        self, testdir, monkeypatch
+    ):
+        spy_factory = self.spy_factory()
+        monkeypatch.setattr(pytester, "SysModulesSnapshot", spy_factory)
+        test_mod = testdir.makepyfile("def test_foo(): pass")
+        testdir.inline_run(str(test_mod))
+        spy = spy_factory.instances[0]
+        assert not spy._spy_preserve("black_knight")
+        assert spy._spy_preserve("zope")
+        assert spy._spy_preserve("zope.interface")
+        assert spy._spy_preserve("zopelicious")
+
+    def test_external_test_module_imports_not_cleaned_up(self, testdir):
+        testdir.syspathinsert()
+        testdir.makepyfile(imported="data = 'you son of a silly person'")
+        import imported
+
+        test_mod = testdir.makepyfile(
+            """
+            def test_foo():
+                import imported
+                imported.data = 42"""
+        )
+        testdir.inline_run(str(test_mod))
+        assert imported.data == 42
 
 
-def test_assert_outcomes_after_pytest_erro(testdir):
+def test_inline_run_clean_sys_paths(testdir):
+
+    def test_sys_path_change_cleanup(self, testdir):
+        test_path1 = testdir.tmpdir.join("boink1").strpath
+        test_path2 = testdir.tmpdir.join("boink2").strpath
+        test_path3 = testdir.tmpdir.join("boink3").strpath
+        sys.path.append(test_path1)
+        sys.meta_path.append(test_path1)
+        original_path = list(sys.path)
+        original_meta_path = list(sys.meta_path)
+        test_mod = testdir.makepyfile(
+            """
+            import sys
+            sys.path.append({:test_path2})
+            sys.meta_path.append({:test_path2})
+            def test_foo():
+                sys.path.append({:test_path3})
+                sys.meta_path.append({:test_path3})""".format(
+                locals()
+            )
+        )
+        testdir.inline_run(str(test_mod))
+        assert sys.path == original_path
+        assert sys.meta_path == original_meta_path
+
+    def spy_factory(self):
+
+        class SysPathsSnapshotSpy(object):
+            instances = []
+
+            def __init__(self):
+                SysPathsSnapshotSpy.instances.append(self)
+                self._spy_restore_count = 0
+                self.__snapshot = SysPathsSnapshot()
+
+            def restore(self):
+                self._spy_restore_count += 1
+                return self.__snapshot.restore()
+
+        return SysPathsSnapshotSpy
+
+    def test_inline_run_taking_and_restoring_a_sys_paths_snapshot(
+        self, testdir, monkeypatch
+    ):
+        spy_factory = self.spy_factory()
+        monkeypatch.setattr(pytester, "SysPathsSnapshot", spy_factory)
+        test_mod = testdir.makepyfile("def test_foo(): pass")
+        testdir.inline_run(str(test_mod))
+        assert len(spy_factory.instances) == 1
+        spy = spy_factory.instances[0]
+        assert spy._spy_restore_count == 1
+
+
+def test_assert_outcomes_after_pytest_error(testdir):
     testdir.makepyfile("def test_foo(): assert True")
 
-    result = testdir.runpytest('--unexpected-argument')
+    result = testdir.runpytest("--unexpected-argument")
     with pytest.raises(ValueError, message="Pytest terminal report not found"):
         result.assert_outcomes(passed=0)
+
+
+def test_cwd_snapshot(tmpdir):
+    foo = tmpdir.ensure("foo", dir=1)
+    bar = tmpdir.ensure("bar", dir=1)
+    foo.chdir()
+    snapshot = CwdSnapshot()
+    bar.chdir()
+    assert py.path.local() == bar
+    snapshot.restore()
+    assert py.path.local() == foo
+
+
+class TestSysModulesSnapshot(object):
+    key = "my-test-module"
+
+    def test_remove_added(self):
+        original = dict(sys.modules)
+        assert self.key not in sys.modules
+        snapshot = SysModulesSnapshot()
+        sys.modules[self.key] = "something"
+        assert self.key in sys.modules
+        snapshot.restore()
+        assert sys.modules == original
+
+    def test_add_removed(self, monkeypatch):
+        assert self.key not in sys.modules
+        monkeypatch.setitem(sys.modules, self.key, "something")
+        assert self.key in sys.modules
+        original = dict(sys.modules)
+        snapshot = SysModulesSnapshot()
+        del sys.modules[self.key]
+        assert self.key not in sys.modules
+        snapshot.restore()
+        assert sys.modules == original
+
+    def test_restore_reloaded(self, monkeypatch):
+        assert self.key not in sys.modules
+        monkeypatch.setitem(sys.modules, self.key, "something")
+        assert self.key in sys.modules
+        original = dict(sys.modules)
+        snapshot = SysModulesSnapshot()
+        sys.modules[self.key] = "something else"
+        snapshot.restore()
+        assert sys.modules == original
+
+    def test_preserve_modules(self, monkeypatch):
+        key = [self.key + str(i) for i in range(3)]
+        assert not any(k in sys.modules for k in key)
+        for i, k in enumerate(key):
+            monkeypatch.setitem(sys.modules, k, "something" + str(i))
+        original = dict(sys.modules)
+
+        def preserve(name):
+            return name in (key[0], key[1], "some-other-key")
+
+        snapshot = SysModulesSnapshot(preserve=preserve)
+        sys.modules[key[0]] = original[key[0]] = "something else0"
+        sys.modules[key[1]] = original[key[1]] = "something else1"
+        sys.modules[key[2]] = "something else2"
+        snapshot.restore()
+        assert sys.modules == original
+
+    def test_preserve_container(self, monkeypatch):
+        original = dict(sys.modules)
+        assert self.key not in original
+        replacement = dict(sys.modules)
+        replacement[self.key] = "life of brian"
+        snapshot = SysModulesSnapshot()
+        monkeypatch.setattr(sys, "modules", replacement)
+        snapshot.restore()
+        assert sys.modules is replacement
+        assert sys.modules == original
+
+
+@pytest.mark.parametrize("path_type", ("path", "meta_path"))
+class TestSysPathsSnapshot(object):
+    other_path = {"path": "meta_path", "meta_path": "path"}
+
+    @staticmethod
+    def path(n):
+        return "my-dirty-little-secret-" + str(n)
+
+    def test_restore(self, monkeypatch, path_type):
+        other_path_type = self.other_path[path_type]
+        for i in range(10):
+            assert self.path(i) not in getattr(sys, path_type)
+        sys_path = [self.path(i) for i in range(6)]
+        monkeypatch.setattr(sys, path_type, sys_path)
+        original = list(sys_path)
+        original_other = list(getattr(sys, other_path_type))
+        snapshot = SysPathsSnapshot()
+        transformation = {
+            "source": (0, 1, 2, 3, 4, 5), "target": (6, 2, 9, 7, 5, 8)
+        }  # noqa: E201
+        assert sys_path == [self.path(x) for x in transformation["source"]]
+        sys_path[1] = self.path(6)
+        sys_path[3] = self.path(7)
+        sys_path.append(self.path(8))
+        del sys_path[4]
+        sys_path[3:3] = [self.path(9)]
+        del sys_path[0]
+        assert sys_path == [self.path(x) for x in transformation["target"]]
+        snapshot.restore()
+        assert getattr(sys, path_type) is sys_path
+        assert getattr(sys, path_type) == original
+        assert getattr(sys, other_path_type) == original_other
+
+    def test_preserve_container(self, monkeypatch, path_type):
+        other_path_type = self.other_path[path_type]
+        original_data = list(getattr(sys, path_type))
+        original_other = getattr(sys, other_path_type)
+        original_other_data = list(original_other)
+        new = []
+        snapshot = SysPathsSnapshot()
+        monkeypatch.setattr(sys, path_type, new)
+        snapshot.restore()
+        assert getattr(sys, path_type) is new
+        assert getattr(sys, path_type) == original_data
+        assert getattr(sys, other_path_type) is original_other
+        assert getattr(sys, other_path_type) == original_other_data
--- a/third_party/python/pytest/testing/test_recwarn.py
+++ b/third_party/python/pytest/testing/test_recwarn.py
@@ -1,52 +1,55 @@
 from __future__ import absolute_import, division, print_function
 import warnings
 import re
-import py
 
 import pytest
 from _pytest.recwarn import WarningsRecorder
 
 
 def test_recwarn_functional(testdir):
-    reprec = testdir.inline_runsource("""
+    reprec = testdir.inline_runsource(
+        """
         import warnings
         def test_method(recwarn):
             warnings.warn("hello")
             warn = recwarn.pop()
             assert isinstance(warn.message, UserWarning)
-    """)
+    """
+    )
     res = reprec.countoutcomes()
     assert tuple(res) == (1, 0, 0), res
 
 
 class TestWarningsRecorderChecker(object):
+
     def test_recording(self):
         rec = WarningsRecorder()
         with rec:
             assert not rec.list
-            py.std.warnings.warn_explicit("hello", UserWarning, "xyz", 13)
+            warnings.warn_explicit("hello", UserWarning, "xyz", 13)
             assert len(rec.list) == 1
-            py.std.warnings.warn(DeprecationWarning("hello"))
+            warnings.warn(DeprecationWarning("hello"))
             assert len(rec.list) == 2
             warn = rec.pop()
             assert str(warn.message) == "hello"
             values = rec.list
             rec.clear()
             assert len(rec.list) == 0
             assert values is rec.list
             pytest.raises(AssertionError, "rec.pop()")
 
     def test_typechecking(self):
         from _pytest.recwarn import WarningsChecker
+
         with pytest.raises(TypeError):
             WarningsChecker(5)
         with pytest.raises(TypeError):
-            WarningsChecker(('hi', RuntimeWarning))
+            WarningsChecker(("hi", RuntimeWarning))
         with pytest.raises(TypeError):
             WarningsChecker([DeprecationWarning, RuntimeWarning])
 
     def test_invalid_enter_exit(self):
         # wrap this test in WarningsRecorder to ensure warning state gets reset
         with WarningsRecorder():
             with pytest.raises(RuntimeError):
                 rec = WarningsRecorder()
@@ -59,183 +62,215 @@ class TestWarningsRecorderChecker(object
                         pass  # can't enter twice
 
 
 class TestDeprecatedCall(object):
     """test pytest.deprecated_call()"""
 
     def dep(self, i, j=None):
         if i == 0:
-            py.std.warnings.warn("is deprecated", DeprecationWarning,
-                                 stacklevel=1)
+            warnings.warn("is deprecated", DeprecationWarning, stacklevel=1)
         return 42
 
     def dep_explicit(self, i):
         if i == 0:
-            py.std.warnings.warn_explicit("dep_explicit", category=DeprecationWarning,
-                                          filename="hello", lineno=3)
+            warnings.warn_explicit(
+                "dep_explicit", category=DeprecationWarning, filename="hello", lineno=3
+            )
 
     def test_deprecated_call_raises(self):
         with pytest.raises(AssertionError) as excinfo:
             pytest.deprecated_call(self.dep, 3, 5)
-        assert 'Did not produce' in str(excinfo)
+        assert "Did not produce" in str(excinfo)
 
     def test_deprecated_call(self):
         pytest.deprecated_call(self.dep, 0, 5)
 
     def test_deprecated_call_ret(self):
         ret = pytest.deprecated_call(self.dep, 0)
         assert ret == 42
 
     def test_deprecated_call_preserves(self):
-        onceregistry = py.std.warnings.onceregistry.copy()
-        filters = py.std.warnings.filters[:]
-        warn = py.std.warnings.warn
-        warn_explicit = py.std.warnings.warn_explicit
+        onceregistry = warnings.onceregistry.copy()
+        filters = warnings.filters[:]
+        warn = warnings.warn
+        warn_explicit = warnings.warn_explicit
         self.test_deprecated_call_raises()
         self.test_deprecated_call()
-        assert onceregistry == py.std.warnings.onceregistry
-        assert filters == py.std.warnings.filters
-        assert warn is py.std.warnings.warn
-        assert warn_explicit is py.std.warnings.warn_explicit
+        assert onceregistry == warnings.onceregistry
+        assert filters == warnings.filters
+        assert warn is warnings.warn
+        assert warn_explicit is warnings.warn_explicit
 
     def test_deprecated_explicit_call_raises(self):
         with pytest.raises(AssertionError):
             pytest.deprecated_call(self.dep_explicit, 3)
 
     def test_deprecated_explicit_call(self):
         pytest.deprecated_call(self.dep_explicit, 0)
         pytest.deprecated_call(self.dep_explicit, 0)
 
-    @pytest.mark.parametrize('mode', ['context_manager', 'call'])
+    @pytest.mark.parametrize("mode", ["context_manager", "call"])
     def test_deprecated_call_no_warning(self, mode):
         """Ensure deprecated_call() raises the expected failure when its block/function does
         not raise a deprecation warning.
         """
+
         def f():
             pass
 
-        msg = 'Did not produce DeprecationWarning or PendingDeprecationWarning'
-        with pytest.raises(AssertionError, matches=msg):
-            if mode == 'call':
+        msg = "Did not produce DeprecationWarning or PendingDeprecationWarning"
+        with pytest.raises(AssertionError, match=msg):
+            if mode == "call":
                 pytest.deprecated_call(f)
             else:
                 with pytest.deprecated_call():
                     f()
 
-    @pytest.mark.parametrize('warning_type', [PendingDeprecationWarning, DeprecationWarning])
-    @pytest.mark.parametrize('mode', ['context_manager', 'call'])
-    @pytest.mark.parametrize('call_f_first', [True, False])
-    @pytest.mark.filterwarnings('ignore')
+    @pytest.mark.parametrize(
+        "warning_type", [PendingDeprecationWarning, DeprecationWarning]
+    )
+    @pytest.mark.parametrize("mode", ["context_manager", "call"])
+    @pytest.mark.parametrize("call_f_first", [True, False])
+    @pytest.mark.filterwarnings("ignore")
     def test_deprecated_call_modes(self, warning_type, mode, call_f_first):
         """Ensure deprecated_call() captures a deprecation warning as expected inside its
         block/function.
         """
+
         def f():
             warnings.warn(warning_type("hi"))
             return 10
 
         # ensure deprecated_call() can capture the warning even if it has already been triggered
         if call_f_first:
             assert f() == 10
-        if mode == 'call':
+        if mode == "call":
             assert pytest.deprecated_call(f) == 10
         else:
             with pytest.deprecated_call():
                 assert f() == 10
 
-    @pytest.mark.parametrize('mode', ['context_manager', 'call'])
+    @pytest.mark.parametrize("mode", ["context_manager", "call"])
     def test_deprecated_call_exception_is_raised(self, mode):
         """If the block of the code being tested by deprecated_call() raises an exception,
         it must raise the exception undisturbed.
         """
-        def f():
-            raise ValueError('some exception')
 
-        with pytest.raises(ValueError, match='some exception'):
-            if mode == 'call':
+        def f():
+            raise ValueError("some exception")
+
+        with pytest.raises(ValueError, match="some exception"):
+            if mode == "call":
                 pytest.deprecated_call(f)
             else:
                 with pytest.deprecated_call():
                     f()
 
     def test_deprecated_call_specificity(self):
-        other_warnings = [Warning, UserWarning, SyntaxWarning, RuntimeWarning,
-                          FutureWarning, ImportWarning, UnicodeWarning]
+        other_warnings = [
+            Warning,
+            UserWarning,
+            SyntaxWarning,
+            RuntimeWarning,
+            FutureWarning,
+            ImportWarning,
+            UnicodeWarning,
+        ]
         for warning in other_warnings:
+
             def f():
                 warnings.warn(warning("hi"))
 
             with pytest.raises(AssertionError):
                 pytest.deprecated_call(f)
             with pytest.raises(AssertionError):
                 with pytest.deprecated_call():
                     f()
 
 
 class TestWarns(object):
+
     def test_strings(self):
         # different messages, b/c Python suppresses multiple identical warnings
         source1 = "warnings.warn('w1', RuntimeWarning)"
         source2 = "warnings.warn('w2', RuntimeWarning)"
         source3 = "warnings.warn('w3', RuntimeWarning)"
         pytest.warns(RuntimeWarning, source1)
-        pytest.raises(pytest.fail.Exception,
-                      lambda: pytest.warns(UserWarning, source2))
+        pytest.raises(pytest.fail.Exception, lambda: pytest.warns(UserWarning, source2))
         pytest.warns(RuntimeWarning, source3)
 
     def test_function(self):
-        pytest.warns(SyntaxWarning,
-                     lambda msg: warnings.warn(msg, SyntaxWarning), "syntax")
+        pytest.warns(
+            SyntaxWarning, lambda msg: warnings.warn(msg, SyntaxWarning), "syntax"
+        )
 
     def test_warning_tuple(self):
-        pytest.warns((RuntimeWarning, SyntaxWarning),
-                     lambda: warnings.warn('w1', RuntimeWarning))
-        pytest.warns((RuntimeWarning, SyntaxWarning),
-                     lambda: warnings.warn('w2', SyntaxWarning))
-        pytest.raises(pytest.fail.Exception,
-                      lambda: pytest.warns(
-                          (RuntimeWarning, SyntaxWarning),
-                          lambda: warnings.warn('w3', UserWarning)))
+        pytest.warns(
+            (RuntimeWarning, SyntaxWarning), lambda: warnings.warn("w1", RuntimeWarning)
+        )
+        pytest.warns(
+            (RuntimeWarning, SyntaxWarning), lambda: warnings.warn("w2", SyntaxWarning)
+        )
+        pytest.raises(
+            pytest.fail.Exception,
+            lambda: pytest.warns(
+                (RuntimeWarning, SyntaxWarning),
+                lambda: warnings.warn("w3", UserWarning),
+            ),
+        )
 
     def test_as_contextmanager(self):
         with pytest.warns(RuntimeWarning):
             warnings.warn("runtime", RuntimeWarning)
 
         with pytest.warns(UserWarning):
             warnings.warn("user", UserWarning)
 
         with pytest.raises(pytest.fail.Exception) as excinfo:
             with pytest.warns(RuntimeWarning):
                 warnings.warn("user", UserWarning)
-        excinfo.match(r"DID NOT WARN. No warnings of type \(.+RuntimeWarning.+,\) was emitted. "
-                      r"The list of emitted warnings is: \[UserWarning\('user',\)\].")
+        excinfo.match(
+            r"DID NOT WARN. No warnings of type \(.+RuntimeWarning.+,\) was emitted. "
+            r"The list of emitted warnings is: \[UserWarning\('user',?\)\]."
+        )
 
         with pytest.raises(pytest.fail.Exception) as excinfo:
             with pytest.warns(UserWarning):
                 warnings.warn("runtime", RuntimeWarning)
-        excinfo.match(r"DID NOT WARN. No warnings of type \(.+UserWarning.+,\) was emitted. "
-                      r"The list of emitted warnings is: \[RuntimeWarning\('runtime',\)\].")
+        excinfo.match(
+            r"DID NOT WARN. No warnings of type \(.+UserWarning.+,\) was emitted. "
+            r"The list of emitted warnings is: \[RuntimeWarning\('runtime',?\)\]."
+        )
 
         with pytest.raises(pytest.fail.Exception) as excinfo:
             with pytest.warns(UserWarning):
                 pass
-        excinfo.match(r"DID NOT WARN. No warnings of type \(.+UserWarning.+,\) was emitted. "
-                      r"The list of emitted warnings is: \[\].")
+        excinfo.match(
+            r"DID NOT WARN. No warnings of type \(.+UserWarning.+,\) was emitted. "
+            r"The list of emitted warnings is: \[\]."
+        )
 
         warning_classes = (UserWarning, FutureWarning)
         with pytest.raises(pytest.fail.Exception) as excinfo:
             with pytest.warns(warning_classes) as warninfo:
                 warnings.warn("runtime", RuntimeWarning)
                 warnings.warn("import", ImportWarning)
 
-        message_template = ("DID NOT WARN. No warnings of type {0} was emitted. "
-                            "The list of emitted warnings is: {1}.")
-        excinfo.match(re.escape(message_template.format(warning_classes,
-                                                        [each.message for each in warninfo])))
+        message_template = (
+            "DID NOT WARN. No warnings of type {0} was emitted. "
+            "The list of emitted warnings is: {1}."
+        )
+        excinfo.match(
+            re.escape(
+                message_template.format(
+                    warning_classes, [each.message for each in warninfo]
+                )
+            )
+        )
 
     def test_record(self):
         with pytest.warns(UserWarning) as record:
             warnings.warn("user", UserWarning)
 
         assert len(record) == 1
         assert str(record[0].message) == "user"
 
@@ -268,19 +303,45 @@ class TestWarns(object):
             warnings.warn("runtime", MyRuntimeWarning)
 
         assert len(record) == 2
         assert str(record[0].message) == "user"
         assert str(record[1].message) == "runtime"
 
     def test_double_test(self, testdir):
         """If a test is run again, the warning should still be raised"""
-        testdir.makepyfile('''
+        testdir.makepyfile(
+            """
             import pytest
             import warnings
 
             @pytest.mark.parametrize('run', [1, 2])
             def test(run):
                 with pytest.warns(RuntimeWarning):
                     warnings.warn("runtime", RuntimeWarning)
-        ''')
+        """
+        )
         result = testdir.runpytest()
-        result.stdout.fnmatch_lines(['*2 passed in*'])
+        result.stdout.fnmatch_lines(["*2 passed in*"])
+
+    def test_match_regex(self):
+        with pytest.warns(UserWarning, match=r"must be \d+$"):
+            warnings.warn("value must be 42", UserWarning)
+
+        with pytest.raises(pytest.fail.Exception):
+            with pytest.warns(UserWarning, match=r"must be \d+$"):
+                warnings.warn("this is not here", UserWarning)
+
+        with pytest.raises(pytest.fail.Exception):
+            with pytest.warns(FutureWarning, match=r"must be \d+$"):
+                warnings.warn("value must be 42", UserWarning)
+
+    def test_one_from_multiple_warns(self):
+        with pytest.warns(UserWarning, match=r"aaa"):
+            warnings.warn("cccccccccc", UserWarning)
+            warnings.warn("bbbbbbbbbb", UserWarning)
+            warnings.warn("aaaaaaaaaa", UserWarning)
+
+    def test_none_of_multiple_warns(self):
+        with pytest.raises(pytest.fail.Exception):
+            with pytest.warns(UserWarning, match=r"aaa"):
+                warnings.warn("bbbbbbbbbb", UserWarning)
+                warnings.warn("cccccccccc", UserWarning)
--- a/third_party/python/pytest/testing/test_resultlog.py
+++ b/third_party/python/pytest/testing/test_resultlog.py
@@ -1,80 +1,85 @@
 from __future__ import absolute_import, division, print_function
 import os
 
 import _pytest._code
 import py
 import pytest
-from _pytest.main import Node, Item, FSCollector
-from _pytest.resultlog import generic_path, ResultLog, \
-    pytest_configure, pytest_unconfigure
+from _pytest.nodes import Node, Item, FSCollector
+from _pytest.resultlog import (
+    generic_path,
+    ResultLog,
+    pytest_configure,
+    pytest_unconfigure,
+)
 
 
 def test_generic_path(testdir):
     from _pytest.main import Session
+
     config = testdir.parseconfig()
     session = Session(config)
-    p1 = Node('a', config=config, session=session)
+    p1 = Node("a", config=config, session=session, nodeid="a")
     # assert p1.fspath is None
-    p2 = Node('B', parent=p1)
-    p3 = Node('()', parent=p2)
-    item = Item('c', parent=p3)
+    p2 = Node("B", parent=p1)
+    p3 = Node("()", parent=p2)
+    item = Item("c", parent=p3)
 
     res = generic_path(item)
-    assert res == 'a.B().c'
+    assert res == "a.B().c"
 
-    p0 = FSCollector('proj/test', config=config, session=session)
-    p1 = FSCollector('proj/test/a', parent=p0)
-    p2 = Node('B', parent=p1)
-    p3 = Node('()', parent=p2)
-    p4 = Node('c', parent=p3)
-    item = Item('[1]', parent=p4)
+    p0 = FSCollector("proj/test", config=config, session=session)
+    p1 = FSCollector("proj/test/a", parent=p0)
+    p2 = Node("B", parent=p1)
+    p3 = Node("()", parent=p2)
+    p4 = Node("c", parent=p3)
+    item = Item("[1]", parent=p4)
 
     res = generic_path(item)
-    assert res == 'test/a:B().c[1]'
+    assert res == "test/a:B().c[1]"
 
 
 def test_write_log_entry():
     reslog = ResultLog(None, None)
     reslog.logfile = py.io.TextIO()
-    reslog.write_log_entry('name', '.', '')
+    reslog.write_log_entry("name", ".", "")
     entry = reslog.logfile.getvalue()
-    assert entry[-1] == '\n'
+    assert entry[-1] == "\n"
     entry_lines = entry.splitlines()
     assert len(entry_lines) == 1
-    assert entry_lines[0] == '. name'
+    assert entry_lines[0] == ". name"
 
     reslog.logfile = py.io.TextIO()
-    reslog.write_log_entry('name', 's', 'Skipped')
+    reslog.write_log_entry("name", "s", "Skipped")
     entry = reslog.logfile.getvalue()
-    assert entry[-1] == '\n'
+    assert entry[-1] == "\n"
     entry_lines = entry.splitlines()
     assert len(entry_lines) == 2
-    assert entry_lines[0] == 's name'
-    assert entry_lines[1] == ' Skipped'
+    assert entry_lines[0] == "s name"
+    assert entry_lines[1] == " Skipped"
 
     reslog.logfile = py.io.TextIO()
-    reslog.write_log_entry('name', 's', 'Skipped\n')
+    reslog.write_log_entry("name", "s", "Skipped\n")
     entry = reslog.logfile.getvalue()
-    assert entry[-1] == '\n'
+    assert entry[-1] == "\n"
     entry_lines = entry.splitlines()
     assert len(entry_lines) == 2
-    assert entry_lines[0] == 's name'
-    assert entry_lines[1] == ' Skipped'
+    assert entry_lines[0] == "s name"
+    assert entry_lines[1] == " Skipped"
 
     reslog.logfile = py.io.TextIO()
-    longrepr = ' tb1\n tb 2\nE tb3\nSome Error'
-    reslog.write_log_entry('name', 'F', longrepr)
+    longrepr = " tb1\n tb 2\nE tb3\nSome Error"
+    reslog.write_log_entry("name", "F", longrepr)
     entry = reslog.logfile.getvalue()
-    assert entry[-1] == '\n'
+    assert entry[-1] == "\n"
     entry_lines = entry.splitlines()
     assert len(entry_lines) == 5
-    assert entry_lines[0] == 'F name'
-    assert entry_lines[1:] == [' ' + line for line in longrepr.splitlines()]
+    assert entry_lines[0] == "F name"
+    assert entry_lines[1:] == [" " + line for line in longrepr.splitlines()]
 
 
 class TestWithFunctionIntegration(object):
     # XXX (hpk) i think that the resultlog plugin should
     # provide a Parser object so that one can remain
     # ignorant regarding formatting details.
     def getresultlog(self, testdir, arg):
         resultlog = testdir.tmpdir.join("resultlog")
@@ -93,136 +98,146 @@ class TestWithFunctionIntegration(object
         assert lines
         assert lines[0].startswith("F ")
         assert lines[0].endswith("test_collection_fail.py"), lines[0]
         for x in lines[1:]:
             assert x.startswith(" ")
         assert "XXX" in "".join(lines[1:])
 
     def test_log_test_outcomes(self, testdir):
-        mod = testdir.makepyfile(test_mod="""
+        mod = testdir.makepyfile(
+            test_mod="""
             import pytest
             def test_pass(): pass
             def test_skip(): pytest.skip("hello")
             def test_fail(): raise ValueError("FAIL")
 
             @pytest.mark.xfail
             def test_xfail(): raise ValueError("XFAIL")
             @pytest.mark.xfail
             def test_xpass(): pass
 
-        """)
+        """
+        )
         lines = self.getresultlog(testdir, mod)
         assert len(lines) >= 3
         assert lines[0].startswith(". ")
         assert lines[0].endswith("test_pass")
         assert lines[1].startswith("s "), lines[1]
         assert lines[1].endswith("test_skip")
         assert lines[2].find("hello") != -1
 
         assert lines[3].startswith("F ")
         assert lines[3].endswith("test_fail")
         tb = "".join(lines[4:8])
         assert tb.find('raise ValueError("FAIL")') != -1
 
-        assert lines[8].startswith('x ')
+        assert lines[8].startswith("x ")
         tb = "".join(lines[8:14])
         assert tb.find('raise ValueError("XFAIL")') != -1
 
-        assert lines[14].startswith('X ')
+        assert lines[14].startswith("X ")
         assert len(lines) == 15
 
     @pytest.mark.parametrize("style", ("native", "long", "short"))
     def test_internal_exception(self, style):
         # they are produced for example by a teardown failing
         # at the end of the run or a failing hook invocation
         try:
             raise ValueError
         except ValueError:
             excinfo = _pytest._code.ExceptionInfo()
         reslog = ResultLog(None, py.io.TextIO())
         reslog.pytest_internalerror(excinfo.getrepr(style=style))
         entry = reslog.logfile.getvalue()
         entry_lines = entry.splitlines()
 
-        assert entry_lines[0].startswith('! ')
+        assert entry_lines[0].startswith("! ")
         if style != "native":
             assert os.path.basename(__file__)[:-9] in entry_lines[0]  # .pyc/class
-        assert entry_lines[-1][0] == ' '
-        assert 'ValueError' in entry
+        assert entry_lines[-1][0] == " "
+        assert "ValueError" in entry
 
 
 def test_generic(testdir, LineMatcher):
     testdir.plugins.append("resultlog")
-    testdir.makepyfile("""
+    testdir.makepyfile(
+        """
         import pytest
         def test_pass():
             pass
         def test_fail():
             assert 0
         def test_skip():
             pytest.skip("")
         @pytest.mark.xfail
         def test_xfail():
             assert 0
         @pytest.mark.xfail(run=False)
         def test_xfail_norun():
             assert 0
-    """)
+    """
+    )
     testdir.runpytest("--resultlog=result.log")
     lines = testdir.tmpdir.join("result.log").readlines(cr=0)
-    LineMatcher(lines).fnmatch_lines([
-        ". *:test_pass",
-        "F *:test_fail",
-        "s *:test_skip",
-        "x *:test_xfail",
-        "x *:test_xfail_norun",
-    ])
+    LineMatcher(lines).fnmatch_lines(
+        [
+            ". *:test_pass",
+            "F *:test_fail",
+            "s *:test_skip",
+            "x *:test_xfail",
+            "x *:test_xfail_norun",
+        ]
+    )
 
 
 def test_makedir_for_resultlog(testdir, LineMatcher):
     """--resultlog should automatically create directories for the log file"""
     testdir.plugins.append("resultlog")
-    testdir.makepyfile("""
+    testdir.makepyfile(
+        """
         import pytest
         def test_pass():
             pass
-    """)
+    """
+    )
     testdir.runpytest("--resultlog=path/to/result.log")
     lines = testdir.tmpdir.join("path/to/result.log").readlines(cr=0)
-    LineMatcher(lines).fnmatch_lines([
-        ". *:test_pass",
-    ])
+    LineMatcher(lines).fnmatch_lines([". *:test_pass"])
 
 
 def test_no_resultlog_on_slaves(testdir):
     config = testdir.parseconfig("-p", "resultlog", "--resultlog=resultlog")
 
-    assert not hasattr(config, '_resultlog')
+    assert not hasattr(config, "_resultlog")
     pytest_configure(config)
-    assert hasattr(config, '_resultlog')
+    assert hasattr(config, "_resultlog")
     pytest_unconfigure(config)
-    assert not hasattr(config, '_resultlog')
+    assert not hasattr(config, "_resultlog")
 
     config.slaveinput = {}
     pytest_configure(config)
-    assert not hasattr(config, '_resultlog')
+    assert not hasattr(config, "_resultlog")
     pytest_unconfigure(config)
-    assert not hasattr(config, '_resultlog')
+    assert not hasattr(config, "_resultlog")
 
 
 def test_failure_issue380(testdir):
-    testdir.makeconftest("""
+    testdir.makeconftest(
+        """
         import pytest
         class MyCollector(pytest.File):
             def collect(self):
                 raise ValueError()
             def repr_failure(self, excinfo):
                 return "somestring"
         def pytest_collect_file(path, parent):
             return MyCollector(parent=parent, fspath=path)
-    """)
-    testdir.makepyfile("""
+    """
+    )
+    testdir.makepyfile(
+        """
         def test_func():
             pass
-    """)
+    """
+    )
     result = testdir.runpytest("--resultlog=log")
     assert result.ret == 2
--- a/third_party/python/pytest/testing/test_runner.py
+++ b/third_party/python/pytest/testing/test_runner.py
@@ -1,20 +1,23 @@
 # -*- coding: utf-8 -*-
 from __future__ import absolute_import, division, print_function
 
 import _pytest._code
+import inspect
 import os
 import py
 import pytest
 import sys
+import types
 from _pytest import runner, main, outcomes
 
 
 class TestSetupState(object):
+
     def test_setup(self, testdir):
         ss = runner.SetupState()
         item = testdir.getitem("def test_func(): pass")
         values = [1]
         ss.prepare(item)
         ss.addfinalizer(values.pop, colitem=item)
         assert values
         ss._pop_and_teardown()
@@ -23,192 +26,249 @@ class TestSetupState(object):
     def test_teardown_exact_stack_empty(self, testdir):
         item = testdir.getitem("def test_func(): pass")
         ss = runner.SetupState()
         ss.teardown_exact(item, None)
         ss.teardown_exact(item, None)
         ss.teardown_exact(item, None)
 
     def test_setup_fails_and_failure_is_cached(self, testdir):
-        item = testdir.getitem("""
+        item = testdir.getitem(
+            """
             def setup_module(mod):
                 raise ValueError(42)
             def test_func(): pass
-        """)  # noqa
+        """
+        )
         ss = runner.SetupState()
         pytest.raises(ValueError, lambda: ss.prepare(item))
         pytest.raises(ValueError, lambda: ss.prepare(item))
 
     def test_teardown_multiple_one_fails(self, testdir):
         r = []
 
         def fin1():
-            r.append('fin1')
+            r.append("fin1")
 
         def fin2():
-            raise Exception('oops')
+            raise Exception("oops")
 
         def fin3():
-            r.append('fin3')
+            r.append("fin3")
 
         item = testdir.getitem("def test_func(): pass")
         ss = runner.SetupState()
         ss.addfinalizer(fin1, item)
         ss.addfinalizer(fin2, item)
         ss.addfinalizer(fin3, item)
         with pytest.raises(Exception) as err:
             ss._callfinalizers(item)
-        assert err.value.args == ('oops',)
-        assert r == ['fin3', 'fin1']
+        assert err.value.args == ("oops",)
+        assert r == ["fin3", "fin1"]
 
     def test_teardown_multiple_fail(self, testdir):
         # Ensure the first exception is the one which is re-raised.
         # Ideally both would be reported however.
         def fin1():
-            raise Exception('oops1')
+            raise Exception("oops1")
 
         def fin2():
-            raise Exception('oops2')
+            raise Exception("oops2")
 
         item = testdir.getitem("def test_func(): pass")
         ss = runner.SetupState()
         ss.addfinalizer(fin1, item)
         ss.addfinalizer(fin2, item)
         with pytest.raises(Exception) as err:
             ss._callfinalizers(item)
-        assert err.value.args == ('oops2',)
+        assert err.value.args == ("oops2",)
+
+    def test_teardown_multiple_scopes_one_fails(self, testdir):
+        module_teardown = []
+
+        def fin_func():
+            raise Exception("oops1")
+
+        def fin_module():
+            module_teardown.append("fin_module")
+
+        item = testdir.getitem("def test_func(): pass")
+        ss = runner.SetupState()
+        ss.addfinalizer(fin_module, item.listchain()[-2])
+        ss.addfinalizer(fin_func, item)
+        ss.prepare(item)
+        with pytest.raises(Exception, match="oops1"):
+            ss.teardown_exact(item, None)
+        assert module_teardown
 
 
 class BaseFunctionalTests(object):
+
     def test_passfunction(self, testdir):
-        reports = testdir.runitem("""
+        reports = testdir.runitem(
+            """
             def test_func():
                 pass
-        """)
+        """
+        )
         rep = reports[1]
         assert rep.passed
         assert not rep.failed
         assert rep.outcome == "passed"
         assert not rep.longrepr
 
     def test_failfunction(self, testdir):
-        reports = testdir.runitem("""
+        reports = testdir.runitem(
+            """
             def test_func():
                 assert 0
-        """)
+        """
+        )
         rep = reports[1]
         assert not rep.passed
         assert not rep.skipped
         assert rep.failed
         assert rep.when == "call"
         assert rep.outcome == "failed"
         # assert isinstance(rep.longrepr, ReprExceptionInfo)
 
     def test_skipfunction(self, testdir):
-        reports = testdir.runitem("""
+        reports = testdir.runitem(
+            """
             import pytest
             def test_func():
                 pytest.skip("hello")
-        """)
+        """
+        )
         rep = reports[1]
         assert not rep.failed
         assert not rep.passed
         assert rep.skipped
         assert rep.outcome == "skipped"
         # assert rep.skipped.when == "call"
         # assert rep.skipped.when == "call"
         # assert rep.skipped == "%sreason == "hello"
         # assert rep.skipped.location.lineno == 3
         # assert rep.skipped.location.path
         # assert not rep.skipped.failurerepr
 
     def test_skip_in_setup_function(self, testdir):
-        reports = testdir.runitem("""
+        reports = testdir.runitem(
+            """
             import pytest
             def setup_function(func):
                 pytest.skip("hello")
             def test_func():
                 pass
-        """)
+        """
+        )
         print(reports)
         rep = reports[0]
         assert not rep.failed
         assert not rep.passed
         assert rep.skipped
         # assert rep.skipped.reason == "hello"
         # assert rep.skipped.location.lineno == 3
         # assert rep.skipped.location.lineno == 3
         assert len(reports) == 2
         assert reports[1].passed  # teardown
 
     def test_failure_in_setup_function(self, testdir):
-        reports = testdir.runitem("""
+        reports = testdir.runitem(
+            """
             import pytest
             def setup_function(func):
                 raise ValueError(42)
             def test_func():
                 pass
-        """)
+        """
+        )
         rep = reports[0]
         assert not rep.skipped
         assert not rep.passed
         assert rep.failed
         assert rep.when == "setup"
         assert len(reports) == 2
 
     def test_failure_in_teardown_function(self, testdir):
-        reports = testdir.runitem("""
+        reports = testdir.runitem(
+            """
             import pytest
             def teardown_function(func):
                 raise ValueError(42)
             def test_func():
                 pass
-        """)
+        """
+        )
         print(reports)
         assert len(reports) == 3
         rep = reports[2]
         assert not rep.skipped
         assert not rep.passed
         assert rep.failed
         assert rep.when == "teardown"
         # assert rep.longrepr.reprcrash.lineno == 3
         # assert rep.longrepr.reprtraceback.reprentries
 
     def test_custom_failure_repr(self, testdir):
-        testdir.makepyfile(conftest="""
+        testdir.makepyfile(
+            conftest="""
             import pytest
             class Function(pytest.Function):
                 def repr_failure(self, excinfo):
                     return "hello"
-        """)
-        reports = testdir.runitem("""
+        """
+        )
+        reports = testdir.runitem(
+            """
             import pytest
             def test_func():
                 assert 0
-        """)
+        """
+        )
         rep = reports[1]
         assert not rep.skipped
         assert not rep.passed
         assert rep.failed
         # assert rep.outcome.when == "call"
         # assert rep.failed.where.lineno == 3
         # assert rep.failed.where.path.basename == "test_func.py"
         # assert rep.failed.failurerepr == "hello"
 
     def test_teardown_final_returncode(self, testdir):
-        rec = testdir.inline_runsource("""
+        rec = testdir.inline_runsource(
+            """
             def test_func():
                 pass
             def teardown_function(func):
                 raise ValueError(42)
-        """)
+        """
+        )
         assert rec.ret == 1
 
+    def test_logstart_logfinish_hooks(self, testdir):
+        rec = testdir.inline_runsource(
+            """
+            import pytest
+            def test_func():
+                pass
+        """
+        )
+        reps = rec.getcalls("pytest_runtest_logstart pytest_runtest_logfinish")
+        assert (
+            [x._name for x in reps]
+            == ["pytest_runtest_logstart", "pytest_runtest_logfinish"]
+        )
+        for rep in reps:
+            assert rep.nodeid == "test_logstart_logfinish_hooks.py::test_func"
+            assert rep.location == ("test_logstart_logfinish_hooks.py", 1, "test_func")
+
     def test_exact_teardown_issue90(self, testdir):
-        rec = testdir.inline_runsource("""
+        rec = testdir.inline_runsource(
+            """
             import pytest
 
             class TestClass(object):
                 def test_method(self):
                     pass
                 def teardown_class(cls):
                     raise Exception()
 
@@ -219,17 +279,18 @@ class BaseFunctionalTests(object):
                 # sys.exc_info would return the indexerror
                 # from guessing the lastitem
                 excinfo = sys.exc_info()
                 import traceback
                 assert excinfo[0] is None, \
                        traceback.format_exception(*excinfo)
             def teardown_function(func):
                 raise ValueError(42)
-        """)
+        """
+        )
         reps = rec.getreports("pytest_runtest_logreport")
         print(reps)
         for i in range(2):
             assert reps[i].nodeid.endswith("test_method")
             assert reps[i].passed
         assert reps[2].when == "teardown"
         assert reps[2].failed
         assert len(reps) == 6
@@ -237,142 +298,162 @@ class BaseFunctionalTests(object):
             assert reps[i].nodeid.endswith("test_func")
             assert reps[i].passed
         assert reps[5].when == "teardown"
         assert reps[5].nodeid.endswith("test_func")
         assert reps[5].failed
 
     def test_exact_teardown_issue1206(self, testdir):
         """issue shadowing error with wrong number of arguments on teardown_method."""
-        rec = testdir.inline_runsource("""
+        rec = testdir.inline_runsource(
+            """
             import pytest
 
             class TestClass(object):
                 def teardown_method(self, x, y, z):
                     pass
 
                 def test_method(self):
                     assert True
-        """)
+        """
+        )
         reps = rec.getreports("pytest_runtest_logreport")
         print(reps)
         assert len(reps) == 3
         #
         assert reps[0].nodeid.endswith("test_method")
         assert reps[0].passed
-        assert reps[0].when == 'setup'
+        assert reps[0].when == "setup"
         #
         assert reps[1].nodeid.endswith("test_method")
         assert reps[1].passed
-        assert reps[1].when == 'call'
+        assert reps[1].when == "call"
         #
         assert reps[2].nodeid.endswith("test_method")
         assert reps[2].failed
         assert reps[2].when == "teardown"
         assert reps[2].longrepr.reprcrash.message in (
             # python3 error
             "TypeError: teardown_method() missing 2 required positional arguments: 'y' and 'z'",
             # python2 error
-            'TypeError: teardown_method() takes exactly 4 arguments (2 given)'
+            "TypeError: teardown_method() takes exactly 4 arguments (2 given)",
         )
 
     def test_failure_in_setup_function_ignores_custom_repr(self, testdir):
-        testdir.makepyfile(conftest="""
+        testdir.makepyfile(
+            conftest="""
             import pytest
             class Function(pytest.Function):
                 def repr_failure(self, excinfo):
                     assert 0
-        """)
-        reports = testdir.runitem("""
+        """
+        )
+        reports = testdir.runitem(
+            """
             def setup_function(func):
                 raise ValueError(42)
             def test_func():
                 pass
-        """)
+        """
+        )
         assert len(reports) == 2
         rep = reports[0]
         print(rep)
         assert not rep.skipped
         assert not rep.passed
         assert rep.failed
         # assert rep.outcome.when == "setup"
         # assert rep.outcome.where.lineno == 3
         # assert rep.outcome.where.path.basename == "test_func.py"
         # assert instanace(rep.failed.failurerepr, PythonFailureRepr)
 
     def test_systemexit_does_not_bail_out(self, testdir):
         try:
-            reports = testdir.runitem("""
+            reports = testdir.runitem(
+                """
                 def test_func():
                     raise SystemExit(42)
-            """)
+            """
+            )
         except SystemExit:
             pytest.fail("runner did not catch SystemExit")
         rep = reports[1]
         assert rep.failed
         assert rep.when == "call"
 
     def test_exit_propagates(self, testdir):
         try:
-            testdir.runitem("""
+            testdir.runitem(
+                """
                 import pytest
                 def test_func():
                     raise pytest.exit.Exception()
-            """)
+            """
+            )
         except pytest.exit.Exception:
             pass
         else:
             pytest.fail("did not raise")
 
 
 class TestExecutionNonForked(BaseFunctionalTests):
+
     def getrunner(self):
+
         def f(item):
             return runner.runtestprotocol(item, log=False)
+
         return f
 
     def test_keyboardinterrupt_propagates(self, testdir):
         try:
-            testdir.runitem("""
+            testdir.runitem(
+                """
                 def test_func():
                     raise KeyboardInterrupt("fake")
-            """)
+            """
+            )
         except KeyboardInterrupt:
             pass
         else:
             pytest.fail("did not raise")
 
 
 class TestExecutionForked(BaseFunctionalTests):
     pytestmark = pytest.mark.skipif("not hasattr(os, 'fork')")
 
     def getrunner(self):
         # XXX re-arrange this test to live in pytest-xdist
         boxed = pytest.importorskip("xdist.boxed")
         return boxed.forked_run_report
 
     def test_suicide(self, testdir):
-        reports = testdir.runitem("""
+        reports = testdir.runitem(
+            """
             def test_func():
                 import os
                 os.kill(os.getpid(), 15)
-        """)
+        """
+        )
         rep = reports[0]
         assert rep.failed
         assert rep.when == "???"
 
 
 class TestSessionReports(object):
+
     def test_collect_result(self, testdir):
-        col = testdir.getmodulecol("""
+        col = testdir.getmodulecol(
+            """
             def test_func1():
                 pass
             class TestClass(object):
                 pass
-        """)
+        """
+        )
         rep = runner.collect_one_node(col)
         assert not rep.failed
         assert not rep.skipped
         assert rep.passed
         locinfo = rep.location
         assert locinfo[0] == col.fspath.basename
         assert not locinfo[1]
         assert locinfo[2] == col.fspath.basename
@@ -385,45 +466,49 @@ class TestSessionReports(object):
 reporttypes = [
     runner.BaseReport,
     runner.TestReport,
     runner.TeardownErrorReport,
     runner.CollectReport,
 ]
 
 
-@pytest.mark.parametrize('reporttype', reporttypes, ids=[x.__name__ for x in reporttypes])
+@pytest.mark.parametrize(
+    "reporttype", reporttypes, ids=[x.__name__ for x in reporttypes]
+)
 def test_report_extra_parameters(reporttype):
-    if hasattr(py.std.inspect, 'signature'):
-        args = list(py.std.inspect.signature(reporttype.__init__).parameters.keys())[1:]
+    if hasattr(inspect, "signature"):
+        args = list(inspect.signature(reporttype.__init__).parameters.keys())[1:]
     else:
-        args = py.std.inspect.getargspec(reporttype.__init__)[0][1:]
+        args = inspect.getargspec(reporttype.__init__)[0][1:]
     basekw = dict.fromkeys(args, [])
     report = reporttype(newthing=1, **basekw)
     assert report.newthing == 1
 
 
 def test_callinfo():
-    ci = runner.CallInfo(lambda: 0, '123')
+    ci = runner.CallInfo(lambda: 0, "123")
     assert ci.when == "123"
     assert ci.result == 0
     assert "result" in repr(ci)
-    ci = runner.CallInfo(lambda: 0 / 0, '123')
+    ci = runner.CallInfo(lambda: 0 / 0, "123")
     assert ci.when == "123"
-    assert not hasattr(ci, 'result')
+    assert not hasattr(ci, "result")
     assert ci.excinfo
     assert "exc" in repr(ci)
 
+
 # design question: do we want general hooks in python files?
 # then something like the following functional tests makes sense
 
 
 @pytest.mark.xfail
 def test_runtest_in_module_ordering(testdir):
-    p1 = testdir.makepyfile("""
+    p1 = testdir.makepyfile(
+        """
         import pytest
         def pytest_runtest_setup(item): # runs after class-level!
             item.function.mylist.append("module")
         class TestClass(object):
             def pytest_runtest_setup(self, item):
                 assert not hasattr(item.function, 'mylist')
                 item.function.mylist = ['class']
             @pytest.fixture
@@ -436,32 +521,31 @@ def test_runtest_in_module_ordering(test
                     pass
             def test_hello1(self, mylist):
                 assert mylist == ['class', 'module'], mylist
                 raise ValueError()
             def test_hello2(self, mylist):
                 assert mylist == ['class', 'module'], mylist
         def pytest_runtest_teardown(item):
             del item.function.mylist
-    """)
+    """
+    )
     result = testdir.runpytest(p1)
-    result.stdout.fnmatch_lines([
-        "*2 passed*"
-    ])
+    result.stdout.fnmatch_lines(["*2 passed*"])
 
 
 def test_outcomeexception_exceptionattributes():
-    outcome = outcomes.OutcomeException('test')
+    outcome = outcomes.OutcomeException("test")
     assert outcome.args[0] == outcome.msg
 
 
 def test_outcomeexception_passes_except_Exception():
     with pytest.raises(outcomes.OutcomeException):
         try:
-            raise outcomes.OutcomeException('test')
+            raise outcomes.OutcomeException("test")
         except Exception:
             pass
 
 
 def test_pytest_exit():
     try:
         pytest.exit("hello")
     except pytest.exit.Exception:
@@ -474,82 +558,86 @@ def test_pytest_fail():
         pytest.fail("hello")
     except pytest.fail.Exception:
         excinfo = _pytest._code.ExceptionInfo()
         s = excinfo.exconly(tryshort=True)
         assert s.startswith("Failed")
 
 
 def test_pytest_exit_msg(testdir):
-    testdir.makeconftest("""
+    testdir.makeconftest(
+        """
     import pytest
 
     def pytest_configure(config):
         pytest.exit('oh noes')
-    """)
+    """
+    )
     result = testdir.runpytest()
-    result.stderr.fnmatch_lines([
-        "Exit: oh noes",
-    ])
+    result.stderr.fnmatch_lines(["Exit: oh noes"])
 
 
 def test_pytest_fail_notrace(testdir):
-    testdir.makepyfile("""
+    testdir.makepyfile(
+        """
         import pytest
         def test_hello():
             pytest.fail("hello", pytrace=False)
         def teardown_function(function):
             pytest.fail("world", pytrace=False)
-    """)
+    """
+    )
     result = testdir.runpytest()
-    result.stdout.fnmatch_lines([
-        "world",
-        "hello",
-    ])
-    assert 'def teardown_function' not in result.stdout.str()
+    result.stdout.fnmatch_lines(["world", "hello"])
+    assert "def teardown_function" not in result.stdout.str()
 
 
-@pytest.mark.parametrize('str_prefix', ['u', ''])
+@pytest.mark.parametrize("str_prefix", ["u", ""])
 def test_pytest_fail_notrace_non_ascii(testdir, str_prefix):
     """Fix pytest.fail with pytrace=False with non-ascii characters (#1178).
 
     This tests with native and unicode strings containing non-ascii chars.
     """
-    testdir.makepyfile(u"""
+    testdir.makepyfile(
+        u"""
         # coding: utf-8
         import pytest
 
         def test_hello():
             pytest.fail(%s'oh oh: ☺', pytrace=False)
-    """ % str_prefix)
+    """
+        % str_prefix
+    )
     result = testdir.runpytest()
     if sys.version_info[0] >= 3:
-        result.stdout.fnmatch_lines(['*test_hello*', "oh oh: ☺"])
+        result.stdout.fnmatch_lines(["*test_hello*", "oh oh: ☺"])
     else:
-        result.stdout.fnmatch_lines(['*test_hello*', "oh oh: *"])
-    assert 'def test_hello' not in result.stdout.str()
+        result.stdout.fnmatch_lines(["*test_hello*", "oh oh: *"])
+    assert "def test_hello" not in result.stdout.str()
 
 
 def test_pytest_no_tests_collected_exit_status(testdir):
     result = testdir.runpytest()
-    result.stdout.fnmatch_lines('*collected 0 items*')
+    result.stdout.fnmatch_lines("*collected 0 items*")
     assert result.ret == main.EXIT_NOTESTSCOLLECTED
 
-    testdir.makepyfile(test_foo="""
+    testdir.makepyfile(
+        test_foo="""
         def test_foo():
             assert 1
-    """)
+    """
+    )
     result = testdir.runpytest()
-    result.stdout.fnmatch_lines('*collected 1 item*')
-    result.stdout.fnmatch_lines('*1 passed*')
+    result.stdout.fnmatch_lines("*collected 1 item*")
+    result.stdout.fnmatch_lines("*1 passed*")
     assert result.ret == main.EXIT_OK
 
-    result = testdir.runpytest('-k nonmatch')
-    result.stdout.fnmatch_lines('*collected 1 item*')
-    result.stdout.fnmatch_lines('*1 deselected*')
+    result = testdir.runpytest("-k nonmatch")
+    result.stdout.fnmatch_lines("*collected 1 item*")
+    result.stdout.fnmatch_lines("*1 deselected*")
     assert result.ret == main.EXIT_NOTESTSCOLLECTED
 
 
 def test_exception_printing_skip():
     try:
         pytest.skip("hello")
     except pytest.skip.Exception:
         excinfo = _pytest._code.ExceptionInfo()
@@ -559,253 +647,305 @@ def test_exception_printing_skip():
 
 def test_importorskip(monkeypatch):
     importorskip = pytest.importorskip
 
     def f():
         importorskip("asdlkj")
 
     try:
-        sys = importorskip("sys")  # noqa
-        assert sys == py.std.sys
+        sysmod = importorskip("sys")
+        assert sysmod is sys
         # path = pytest.importorskip("os.path")
-        # assert path == py.std.os.path
+        # assert path == os.path
         excinfo = pytest.raises(pytest.skip.Exception, f)
         path = py.path.local(excinfo.getrepr().reprcrash.path)
         # check that importorskip reports the actual call
         # in this test the test_runner.py file
         assert path.purebasename == "test_runner"
         pytest.raises(SyntaxError, "pytest.importorskip('x y z')")
         pytest.raises(SyntaxError, "pytest.importorskip('x=y')")
-        mod = py.std.types.ModuleType("hello123")
+        mod = types.ModuleType("hello123")
         mod.__version__ = "1.3"
         monkeypatch.setitem(sys.modules, "hello123", mod)
-        pytest.raises(pytest.skip.Exception, """
+        pytest.raises(
+            pytest.skip.Exception,
+            """
             pytest.importorskip("hello123", minversion="1.3.1")
-        """)
+        """,
+        )
         mod2 = pytest.importorskip("hello123", minversion="1.3")
         assert mod2 == mod
     except pytest.skip.Exception:
         print(_pytest._code.ExceptionInfo())
         pytest.fail("spurious skip")
 
 
 def test_importorskip_imports_last_module_part():
     ospath = pytest.importorskip("os.path")
     assert os.path == ospath
 
 
 def test_importorskip_dev_module(monkeypatch):
     try:
-        mod = py.std.types.ModuleType("mockmodule")
-        mod.__version__ = '0.13.0.dev-43290'
-        monkeypatch.setitem(sys.modules, 'mockmodule', mod)
-        mod2 = pytest.importorskip('mockmodule', minversion='0.12.0')
+        mod = types.ModuleType("mockmodule")
+        mod.__version__ = "0.13.0.dev-43290"
+        monkeypatch.setitem(sys.modules, "mockmodule", mod)
+        mod2 = pytest.importorskip("mockmodule", minversion="0.12.0")
         assert mod2 == mod
-        pytest.raises(pytest.skip.Exception, """
-            pytest.importorskip('mockmodule1', minversion='0.14.0')""")
+        pytest.raises(
+            pytest.skip.Exception,
+            """
+            pytest.importorskip('mockmodule1', minversion='0.14.0')""",
+        )
     except pytest.skip.Exception:
         print(_pytest._code.ExceptionInfo())
         pytest.fail("spurious skip")
 
 
 def test_importorskip_module_level(testdir):
     """importorskip must be able to skip entire modules when used at module level"""
-    testdir.makepyfile('''
+    testdir.makepyfile(
+        """
         import pytest
         foobarbaz = pytest.importorskip("foobarbaz")
 
         def test_foo():
             pass
-    ''')
+    """
+    )
     result = testdir.runpytest()
-    result.stdout.fnmatch_lines(['*collected 0 items / 1 skipped*'])
+    result.stdout.fnmatch_lines(["*collected 0 items / 1 skipped*"])
 
 
 def test_pytest_cmdline_main(testdir):
-    p = testdir.makepyfile("""
+    p = testdir.makepyfile(
+        """
         import pytest
         def test_hello():
             assert 1
         if __name__ == '__main__':
            pytest.cmdline.main([__file__])
-    """)
+    """
+    )
     import subprocess
+
     popen = subprocess.Popen([sys.executable, str(p)], stdout=subprocess.PIPE)
     popen.communicate()
     ret = popen.wait()
     assert ret == 0
 
 
 def test_unicode_in_longrepr(testdir):
-    testdir.makeconftest("""
-        import py
-        def pytest_runtest_makereport(__multicall__):
-            rep = __multicall__.execute()
+    testdir.makeconftest(
+        """
+        # -*- coding: utf-8 -*-
+        import pytest
+        @pytest.hookimpl(hookwrapper=True)
+        def pytest_runtest_makereport():
+            outcome = yield
+            rep = outcome.get_result()
             if rep.when == "call":
-                rep.longrepr = py.builtin._totext("\\xc3\\xa4", "utf8")
-            return rep
-    """)
-    testdir.makepyfile("""
+                rep.longrepr = u'ä'
+    """
+    )
+    testdir.makepyfile(
+        """
         def test_out():
             assert 0
-    """)
+    """
+    )
     result = testdir.runpytest()
     assert result.ret == 1
     assert "UnicodeEncodeError" not in result.stderr.str()
 
 
 def test_failure_in_setup(testdir):
-    testdir.makepyfile("""
+    testdir.makepyfile(
+        """
         def setup_module():
             0/0
         def test_func():
             pass
-    """)
+    """
+    )
     result = testdir.runpytest("--tb=line")
     assert "def setup_module" not in result.stdout.str()
 
 
 def test_makereport_getsource(testdir):
-    testdir.makepyfile("""
+    testdir.makepyfile(
+        """
         def test_foo():
             if False: pass
             else: assert False
-    """)
+    """
+    )
     result = testdir.runpytest()
-    assert 'INTERNALERROR' not in result.stdout.str()
-    result.stdout.fnmatch_lines(['*else: assert False*'])
+    assert "INTERNALERROR" not in result.stdout.str()
+    result.stdout.fnmatch_lines(["*else: assert False*"])
 
 
 def test_makereport_getsource_dynamic_code(testdir, monkeypatch):
     """Test that exception in dynamically generated code doesn't break getting the source line."""
     import inspect
+
     original_findsource = inspect.findsource
 
     def findsource(obj, *args, **kwargs):
         # Can be triggered by dynamically created functions
-        if obj.__name__ == 'foo':
+        if obj.__name__ == "foo":
             raise IndexError()
         return original_findsource(obj, *args, **kwargs)
 
-    monkeypatch.setattr(inspect, 'findsource', findsource)
+    monkeypatch.setattr(inspect, "findsource", findsource)
 
-    testdir.makepyfile("""
+    testdir.makepyfile(
+        """
         import pytest
 
         @pytest.fixture
         def foo(missing):
             pass
 
         def test_fix(foo):
             assert False
-    """)
-    result = testdir.runpytest('-vv')
-    assert 'INTERNALERROR' not in result.stdout.str()
+    """
+    )
+    result = testdir.runpytest("-vv")
+    assert "INTERNALERROR" not in result.stdout.str()
     result.stdout.fnmatch_lines(["*test_fix*", "*fixture*'missing'*not found*"])
 
 
-def test_store_except_info_on_eror():
+def test_store_except_info_on_error():
     """ Test that upon test failure, the exception info is stored on
     sys.last_traceback and friends.
     """
-    # Simulate item that raises a specific exception
-    class ItemThatRaises(object):
-        nodeid = 'item_that_raises'
+    # Simulate item that might raise a specific exception, depending on `raise_error` class var
+    class ItemMightRaise(object):
+        nodeid = "item_that_raises"
+        raise_error = True
 
         def runtest(self):
-            raise IndexError('TEST')
+            if self.raise_error:
+                raise IndexError("TEST")
+
     try:
-        runner.pytest_runtest_call(ItemThatRaises())
+        runner.pytest_runtest_call(ItemMightRaise())
     except IndexError:
         pass
     # Check that exception info is stored on sys
     assert sys.last_type is IndexError
-    assert sys.last_value.args[0] == 'TEST'
+    assert sys.last_value.args[0] == "TEST"
     assert sys.last_traceback
 
+    # The next run should clear the exception info stored by the previous run
+    ItemMightRaise.raise_error = False
+    runner.pytest_runtest_call(ItemMightRaise())
+    assert sys.last_type is None
+    assert sys.last_value is None
+    assert sys.last_traceback is None
+
 
 def test_current_test_env_var(testdir, monkeypatch):
     pytest_current_test_vars = []
-    monkeypatch.setattr(sys, 'pytest_current_test_vars', pytest_current_test_vars, raising=False)
-    testdir.makepyfile('''
+    monkeypatch.setattr(
+        sys, "pytest_current_test_vars", pytest_current_test_vars, raising=False
+    )
+    testdir.makepyfile(
+        """
         import pytest
         import sys
         import os
 
         @pytest.fixture
         def fix():
             sys.pytest_current_test_vars.append(('setup', os.environ['PYTEST_CURRENT_TEST']))
             yield
             sys.pytest_current_test_vars.append(('teardown', os.environ['PYTEST_CURRENT_TEST']))
 
         def test(fix):
             sys.pytest_current_test_vars.append(('call', os.environ['PYTEST_CURRENT_TEST']))
-    ''')
+    """
+    )
     result = testdir.runpytest_inprocess()
     assert result.ret == 0
-    test_id = 'test_current_test_env_var.py::test'
-    assert pytest_current_test_vars == [
-        ('setup', test_id + ' (setup)'), ('call', test_id + ' (call)'), ('teardown', test_id + ' (teardown)')]
-    assert 'PYTEST_CURRENT_TEST' not in os.environ
+    test_id = "test_current_test_env_var.py::test"
+    assert (
+        pytest_current_test_vars
+        == [
+            ("setup", test_id + " (setup)"),
+            ("call", test_id + " (call)"),
+            ("teardown", test_id + " (teardown)"),
+        ]
+    )
+    assert "PYTEST_CURRENT_TEST" not in os.environ
 
 
 class TestReportContents(object):
     """
     Test user-level API of ``TestReport`` objects.
     """
 
     def getrunner(self):
         return lambda item: runner.runtestprotocol(item, log=False)
 
     def test_longreprtext_pass(self, testdir):
-        reports = testdir.runitem("""
+        reports = testdir.runitem(
+            """
             def test_func():
                 pass
-        """)
+        """
+        )
         rep = reports[1]
-        assert rep.longreprtext == ''
+        assert rep.longreprtext == ""
 
     def test_longreprtext_failure(self, testdir):
-        reports = testdir.runitem("""
+        reports = testdir.runitem(
+            """
             def test_func():
                 x = 1
                 assert x == 4
-        """)
+        """
+        )
         rep = reports[1]
-        assert 'assert 1 == 4' in rep.longreprtext
+        assert "assert 1 == 4" in rep.longreprtext
 
     def test_captured_text(self, testdir):
-        reports = testdir.runitem("""
+        reports = testdir.runitem(
+            """
             import pytest
             import sys
 
             @pytest.fixture
             def fix():
                 sys.stdout.write('setup: stdout\\n')
                 sys.stderr.write('setup: stderr\\n')
                 yield
                 sys.stdout.write('teardown: stdout\\n')
                 sys.stderr.write('teardown: stderr\\n')
                 assert 0
 
             def test_func(fix):
                 sys.stdout.write('call: stdout\\n')
                 sys.stderr.write('call: stderr\\n')
                 assert 0
-        """)
+        """
+        )
         setup, call, teardown = reports
-        assert setup.capstdout == 'setup: stdout\n'
-        assert call.capstdout == 'setup: stdout\ncall: stdout\n'
-        assert teardown.capstdout == 'setup: stdout\ncall: stdout\nteardown: stdout\n'
+        assert setup.capstdout == "setup: stdout\n"
+        assert call.capstdout == "setup: stdout\ncall: stdout\n"
+        assert teardown.capstdout == "setup: stdout\ncall: stdout\nteardown: stdout\n"
 
-        assert setup.capstderr == 'setup: stderr\n'
-        assert call.capstderr == 'setup: stderr\ncall: stderr\n'
-        assert teardown.capstderr == 'setup: stderr\ncall: stderr\nteardown: stderr\n'
+        assert setup.capstderr == "setup: stderr\n"
+        assert call.capstderr == "setup: stderr\ncall: stderr\n"
+        assert teardown.capstderr == "setup: stderr\ncall: stderr\nteardown: stderr\n"
 
     def test_no_captured_text(self, testdir):
-        reports = testdir.runitem("""
+        reports = testdir.runitem(
+            """
             def test_func():
                 pass
-        """)
+        """
+        )
         rep = reports[1]
-        assert rep.capstdout == ''
-        assert rep.capstderr == ''
+        assert rep.capstdout == ""
+        assert rep.capstderr == ""
--- a/third_party/python/pytest/testing/test_runner_xunit.py
+++ b/third_party/python/pytest/testing/test_runner_xunit.py
@@ -2,17 +2,18 @@
  test correct setup/teardowns at
  module, class, and instance level
 """
 from __future__ import absolute_import, division, print_function
 import pytest
 
 
 def test_module_and_function_setup(testdir):
-    reprec = testdir.inline_runsource("""
+    reprec = testdir.inline_runsource(
+        """
         modlevel = []
         def setup_module(module):
             assert not modlevel
             module.modlevel.append(42)
 
         def teardown_module(module):
             modlevel.pop()
 
@@ -25,60 +26,66 @@ def test_module_and_function_setup(testd
         def test_modlevel():
             assert modlevel[0] == 42
             assert test_modlevel.answer == 17
 
         class TestFromClass(object):
             def test_module(self):
                 assert modlevel[0] == 42
                 assert not hasattr(test_modlevel, 'answer')
-    """)
+    """
+    )
     rep = reprec.matchreport("test_modlevel")
     assert rep.passed
     rep = reprec.matchreport("test_module")
     assert rep.passed
 
 
 def test_module_setup_failure_no_teardown(testdir):
-    reprec = testdir.inline_runsource("""
+    reprec = testdir.inline_runsource(
+        """
         values = []
         def setup_module(module):
             values.append(1)
             0/0
 
         def test_nothing():
             pass
 
         def teardown_module(module):
             values.append(2)
-    """)
+    """
+    )
     reprec.assertoutcome(failed=1)
     calls = reprec.getcalls("pytest_runtest_setup")
     assert calls[0].item.module.values == [1]
 
 
 def test_setup_function_failure_no_teardown(testdir):
-    reprec = testdir.inline_runsource("""
+    reprec = testdir.inline_runsource(
+        """
         modlevel = []
         def setup_function(function):
             modlevel.append(1)
             0/0
 
         def teardown_function(module):
             modlevel.append(2)
 
         def test_func():
             pass
-    """)
+    """
+    )
     calls = reprec.getcalls("pytest_runtest_setup")
     assert calls[0].item.module.modlevel == [1]
 
 
 def test_class_setup(testdir):
-    reprec = testdir.inline_runsource("""
+    reprec = testdir.inline_runsource(
+        """
         class TestSimpleClassSetup(object):
             clslevel = []
             def setup_class(cls):
                 cls.clslevel.append(23)
 
             def teardown_class(cls):
                 cls.clslevel.pop()
 
@@ -87,78 +94,86 @@ def test_class_setup(testdir):
 
         class TestInheritedClassSetupStillWorks(TestSimpleClassSetup):
             def test_classlevel_anothertime(self):
                 assert self.clslevel == [23]
 
         def test_cleanup():
             assert not TestSimpleClassSetup.clslevel
             assert not TestInheritedClassSetupStillWorks.clslevel
-    """)
+    """
+    )
     reprec.assertoutcome(passed=1 + 2 + 1)
 
 
 def test_class_setup_failure_no_teardown(testdir):
-    reprec = testdir.inline_runsource("""
+    reprec = testdir.inline_runsource(
+        """
         class TestSimpleClassSetup(object):
             clslevel = []
             def setup_class(cls):
                 0/0
 
             def teardown_class(cls):
                 cls.clslevel.append(1)
 
             def test_classlevel(self):
                 pass
 
         def test_cleanup():
             assert not TestSimpleClassSetup.clslevel
-    """)
+    """
+    )
     reprec.assertoutcome(failed=1, passed=1)
 
 
 def test_method_setup(testdir):
-    reprec = testdir.inline_runsource("""
+    reprec = testdir.inline_runsource(
+        """
         class TestSetupMethod(object):
             def setup_method(self, meth):
                 self.methsetup = meth
             def teardown_method(self, meth):
                 del self.methsetup
 
             def test_some(self):
                 assert self.methsetup == self.test_some
 
             def test_other(self):
                 assert self.methsetup == self.test_other
-    """)
+    """
+    )
     reprec.assertoutcome(passed=2)
 
 
 def test_method_setup_failure_no_teardown(testdir):
-    reprec = testdir.inline_runsource("""
+    reprec = testdir.inline_runsource(
+        """
         class TestMethodSetup(object):
             clslevel = []
             def setup_method(self, method):
                 self.clslevel.append(1)
                 0/0
 
             def teardown_method(self, method):
                 self.clslevel.append(2)
 
             def test_method(self):
                 pass
 
         def test_cleanup():
             assert TestMethodSetup.clslevel == [1]
-    """)
+    """
+    )
     reprec.assertoutcome(failed=1, passed=1)
 
 
 def test_method_generator_setup(testdir):
-    reprec = testdir.inline_runsource("""
+    reprec = testdir.inline_runsource(
+        """
         class TestSetupTeardownOnInstance(object):
             def setup_class(cls):
                 cls.classsetup = True
 
             def setup_method(self, method):
                 self.methsetup = method
 
             def test_generate(self):
@@ -166,22 +181,24 @@ def test_method_generator_setup(testdir)
                 assert self.methsetup == self.test_generate
                 yield self.generated, 5
                 yield self.generated, 2
 
             def generated(self, value):
                 assert self.classsetup
                 assert self.methsetup == self.test_generate
                 assert value == 5
-    """)
+    """
+    )
     reprec.assertoutcome(passed=1, failed=1)
 
 
 def test_func_generator_setup(testdir):
-    reprec = testdir.inline_runsource("""
+    reprec = testdir.inline_runsource(
+        """
         import sys
 
         def setup_module(mod):
             print ("setup_module")
             mod.x = []
 
         def setup_function(fun):
             print ("setup_function")
@@ -194,93 +211,110 @@ def test_func_generator_setup(testdir):
         def test_one():
             assert x == [1]
             def check():
                 print ("check")
                 sys.stderr.write("e\\n")
                 assert x == [1]
             yield check
             assert x == [1]
-    """)
+    """
+    )
     rep = reprec.matchreport("test_one", names="pytest_runtest_logreport")
     assert rep.passed
 
 
 def test_method_setup_uses_fresh_instances(testdir):
-    reprec = testdir.inline_runsource("""
+    reprec = testdir.inline_runsource(
+        """
         class TestSelfState1(object):
             memory = []
             def test_hello(self):
                 self.memory.append(self)
 
             def test_afterhello(self):
                 assert self != self.memory[0]
-    """)
+    """
+    )
     reprec.assertoutcome(passed=2, failed=0)
 
 
 def test_setup_that_skips_calledagain(testdir):
-    p = testdir.makepyfile("""
+    p = testdir.makepyfile(
+        """
         import pytest
         def setup_module(mod):
             pytest.skip("x")
         def test_function1():
             pass
         def test_function2():
             pass
-    """)
+    """
+    )
     reprec = testdir.inline_run(p)
     reprec.assertoutcome(skipped=2)
 
 
 def test_setup_fails_again_on_all_tests(testdir):
-    p = testdir.makepyfile("""
+    p = testdir.makepyfile(
+        """
         import pytest
         def setup_module(mod):
             raise ValueError(42)
         def test_function1():
             pass
         def test_function2():
             pass
-    """)
+    """
+    )
     reprec = testdir.inline_run(p)
     reprec.assertoutcome(failed=2)
 
 
 def test_setup_funcarg_setup_when_outer_scope_fails(testdir):
-    p = testdir.makepyfile("""
+    p = testdir.makepyfile(
+        """
         import pytest
         def setup_module(mod):
             raise ValueError(42)
         @pytest.fixture
         def hello(request):
             raise ValueError("xyz43")
         def test_function1(hello):
             pass
         def test_function2(hello):
             pass
-    """)
+    """
+    )
     result = testdir.runpytest(p)
-    result.stdout.fnmatch_lines([
-        "*function1*",
-        "*ValueError*42*",
-        "*function2*",
-        "*ValueError*42*",
-        "*2 error*"
-    ])
+    result.stdout.fnmatch_lines(
+        [
+            "*function1*",
+            "*ValueError*42*",
+            "*function2*",
+            "*ValueError*42*",
+            "*2 error*",
+        ]
+    )
     assert "xyz43" not in result.stdout.str()
 
 
-@pytest.mark.parametrize('arg', ['', 'arg'])
-def test_setup_teardown_function_level_with_optional_argument(testdir, monkeypatch, arg):
+@pytest.mark.parametrize("arg", ["", "arg"])
+def test_setup_teardown_function_level_with_optional_argument(
+    testdir, monkeypatch, arg
+):
     """parameter to setup/teardown xunit-style functions parameter is now optional (#1728)."""
     import sys
+
     trace_setups_teardowns = []
-    monkeypatch.setattr(sys, 'trace_setups_teardowns', trace_setups_teardowns, raising=False)
-    p = testdir.makepyfile("""
+    monkeypatch.setattr(
+        sys, "trace_setups_teardowns", trace_setups_teardowns, raising=False
+    )
+    p = testdir.makepyfile(
+        """
         import pytest
         import sys
 
         trace = sys.trace_setups_teardowns.append
 
         def setup_module({arg}): trace('setup_module')
         def teardown_module({arg}): trace('teardown_module')
 
@@ -291,29 +325,28 @@ def test_setup_teardown_function_level_w
         def test_function_2(): pass
 
         class Test(object):
             def setup_method(self, {arg}): trace('setup_method')
             def teardown_method(self, {arg}): trace('teardown_method')
 
             def test_method_1(self): pass
             def test_method_2(self): pass
-    """.format(arg=arg))
+    """.format(
+            arg=arg
+        )
+    )
     result = testdir.inline_run(p)
     result.assertoutcome(passed=4)
 
     expected = [
-        'setup_module',
-
-        'setup_function',
-        'teardown_function',
-        'setup_function',
-        'teardown_function',
-
-        'setup_method',
-        'teardown_method',
-
-        'setup_method',
-        'teardown_method',
-
-        'teardown_module',
+        "setup_module",
+        "setup_function",
+        "teardown_function",
+        "setup_function",
+        "teardown_function",
+        "setup_method",
+        "teardown_method",
+        "setup_method",
+        "teardown_method",
+        "teardown_module",
     ]
     assert trace_setups_teardowns == expected
--- a/third_party/python/pytest/testing/test_session.py
+++ b/third_party/python/pytest/testing/test_session.py
@@ -1,27 +1,31 @@
 from __future__ import absolute_import, division, print_function
+
 import pytest
 
 from _pytest.main import EXIT_NOTESTSCOLLECTED
 
 
 class SessionTests(object):
+
     def test_basic_testitem_events(self, testdir):
-        tfile = testdir.makepyfile("""
+        tfile = testdir.makepyfile(
+            """
             def test_one():
                 pass
             def test_one_one():
                 assert 0
             def test_other():
                 raise ValueError(23)
             class TestClass(object):
                 def test_two(self, someargs):
                     pass
-        """)
+        """
+        )
         reprec = testdir.inline_run(tfile)
         passed, skipped, failed = reprec.listoutcomes()
         assert len(skipped) == 0
         assert len(passed) == 1
         assert len(failed) == 3
 
         def end(x):
             return x.nodeid.split("::")[-1]
@@ -31,124 +35,148 @@ class SessionTests(object):
         itemstarted = reprec.getcalls("pytest_itemcollected")
         assert len(itemstarted) == 4
         # XXX check for failing funcarg setup
         # colreports = reprec.getcalls("pytest_collectreport")
         # assert len(colreports) == 4
         # assert colreports[1].report.failed
 
     def test_nested_import_error(self, testdir):
-        tfile = testdir.makepyfile("""
+        tfile = testdir.makepyfile(
+            """
             import import_fails
             def test_this():
                 assert import_fails.a == 1
-        """, import_fails="""
+        """,
+            import_fails="""
             import does_not_work
             a = 1
-        """)
+        """,
+        )
         reprec = testdir.inline_run(tfile)
         values = reprec.getfailedcollections()
         assert len(values) == 1
         out = str(values[0].longrepr)
-        assert out.find('does_not_work') != -1
+        assert out.find("does_not_work") != -1
 
     def test_raises_output(self, testdir):
-        reprec = testdir.inline_runsource("""
+        reprec = testdir.inline_runsource(
+            """
             import pytest
             def test_raises_doesnt():
                 pytest.raises(ValueError, int, "3")
-        """)
+        """
+        )
         passed, skipped, failed = reprec.listoutcomes()
         assert len(failed) == 1
         out = failed[0].longrepr.reprcrash.message
         if not out.find("DID NOT RAISE") != -1:
             print(out)
             pytest.fail("incorrect raises() output")
 
     def test_generator_yields_None(self, testdir):
-        reprec = testdir.inline_runsource("""
+        reprec = testdir.inline_runsource(
+            """
             def test_1():
                 yield None
-        """)
+        """
+        )
         failures = reprec.getfailedcollections()
         out = failures[0].longrepr.reprcrash.message
-        i = out.find('TypeError')
+        i = out.find("TypeError")
         assert i != -1
 
     def test_syntax_error_module(self, testdir):
         reprec = testdir.inline_runsource("this is really not python")
         values = reprec.getfailedcollections()
         assert len(values) == 1
         out = str(values[0].longrepr)
-        assert out.find(str('not python')) != -1
+        assert out.find(str("not python")) != -1
 
     def test_exit_first_problem(self, testdir):
-        reprec = testdir.inline_runsource("""
+        reprec = testdir.inline_runsource(
+            """
             def test_one(): assert 0
             def test_two(): assert 0
-        """, '--exitfirst')
+        """,
+            "--exitfirst",
+        )
         passed, skipped, failed = reprec.countoutcomes()
         assert failed == 1
         assert passed == skipped == 0
 
     def test_maxfail(self, testdir):
-        reprec = testdir.inline_runsource("""
+        reprec = testdir.inline_runsource(
+            """
             def test_one(): assert 0
             def test_two(): assert 0
             def test_three(): assert 0
-        """, '--maxfail=2')
+        """,
+            "--maxfail=2",
+        )
         passed, skipped, failed = reprec.countoutcomes()
         assert failed == 2
         assert passed == skipped == 0
 
     def test_broken_repr(self, testdir):
-        p = testdir.makepyfile("""
+        p = testdir.makepyfile(
+            """
             import pytest
             class BrokenRepr1(object):
                 foo=0
                 def __repr__(self):
                     raise Exception("Ha Ha fooled you, I'm a broken repr().")
 
             class TestBrokenClass(object):
                 def test_explicit_bad_repr(self):
                     t = BrokenRepr1()
                     pytest.raises(Exception, 'repr(t)')
 
                 def test_implicit_bad_repr1(self):
                     t = BrokenRepr1()
                     assert t.foo == 1
 
-        """)
+        """
+        )
         reprec = testdir.inline_run(p)
         passed, skipped, failed = reprec.listoutcomes()
         assert len(failed) == 1
         out = failed[0].longrepr.reprcrash.message
-        assert out.find("""[Exception("Ha Ha fooled you, I'm a broken repr().") raised in repr()]""") != -1  # '
+        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(conftest="""
+        testdir.makepyfile(
+            conftest="""
             import pytest
             def pytest_collect_file():
                 pytest.skip("intentional")
-        """, test_file="""
+        """,
+            test_file="""
             def test_one(): pass
-        """)
+        """,
+        )
         try:
             reprec = testdir.inline_run(testdir.tmpdir)
         except pytest.skip.Exception:
             pytest.fail("wrong skipped caught")
         reports = reprec.getreports("pytest_collectreport")
         assert len(reports) == 1
         assert reports[0].skipped
 
 
 class TestNewSession(SessionTests):
 
     def test_order_of_execution(self, testdir):
-        reprec = testdir.inline_runsource("""
+        reprec = testdir.inline_runsource(
+            """
             values = []
             def test_1():
                 values.append(1)
             def test_2():
                 values.append(2)
             def test_3():
                 assert values == [1,2]
             class Testmygroup(object):
@@ -156,17 +184,18 @@ class TestNewSession(SessionTests):
                 def test_1(self):
                     self.reslist.append(1)
                 def test_2(self):
                     self.reslist.append(2)
                 def test_3(self):
                     self.reslist.append(3)
                 def test_4(self):
                     assert self.reslist == [1,2,1,2,3]
-        """)
+        """
+        )
         passed, skipped, failed = reprec.countoutcomes()
         assert failed == skipped == 0
         assert passed == 7
         # also test listnames() here ...
 
     def test_collect_only_with_various_situations(self, testdir):
         p = testdir.makepyfile(
             test_one="""
@@ -176,19 +205,19 @@ class TestNewSession(SessionTests):
                 class TestX(object):
                     def test_method_one(self):
                         pass
 
                 class TestY(TestX):
                     pass
             """,
             test_three="xxxdsadsadsadsa",
-            __init__=""
+            __init__="",
         )
-        reprec = testdir.inline_run('--collect-only', p.dirpath())
+        reprec = testdir.inline_run("--collect-only", p.dirpath())
 
         itemstarted = reprec.getcalls("pytest_itemcollected")
         assert len(itemstarted) == 3
         assert not reprec.getreports("pytest_runtest_logreport")
         started = reprec.getcalls("pytest_collectstart")
         finished = reprec.getreports("pytest_collectreport")
         assert len(started) == len(finished)
         assert len(started) == 7  # XXX extra TopCollector
@@ -208,48 +237,107 @@ class TestNewSession(SessionTests):
         testdir.makepyfile(test_one="xxxx", test_two="yyyy", test_third="zzz")
         reprec = testdir.inline_run("-x", "--maxfail=2", testdir.tmpdir)
         finished = reprec.getreports("pytest_collectreport")
         colfail = [x for x in finished if x.failed]
         assert len(colfail) == 2
 
 
 def test_plugin_specify(testdir):
-    pytest.raises(ImportError, """
+    pytest.raises(
+        ImportError,
+        """
             testdir.parseconfig("-p", "nqweotexistent")
-    """)
+    """,
+    )
     # pytest.raises(ImportError,
     #    "config.do_configure(config)"
     # )
 
 
 def test_plugin_already_exists(testdir):
     config = testdir.parseconfig("-p", "terminal")
-    assert config.option.plugins == ['terminal']
+    assert config.option.plugins == ["terminal"]
     config._do_configure()
     config._ensure_unconfigure()
 
 
 def test_exclude(testdir):
     hellodir = testdir.mkdir("hello")
     hellodir.join("test_hello.py").write("x y syntaxerror")
     hello2dir = testdir.mkdir("hello2")
     hello2dir.join("test_hello2.py").write("x y syntaxerror")
     testdir.makepyfile(test_ok="def test_pass(): pass")
     result = testdir.runpytest("--ignore=hello", "--ignore=hello2")
     assert result.ret == 0
     result.stdout.fnmatch_lines(["*1 passed*"])
 
 
+def test_deselect(testdir):
+    testdir.makepyfile(
+        test_a="""
+        import pytest
+        def test_a1(): pass
+        @pytest.mark.parametrize('b', range(3))
+        def test_a2(b): pass
+    """
+    )
+    result = testdir.runpytest(
+        "-v", "--deselect=test_a.py::test_a2[1]", "--deselect=test_a.py::test_a2[2]"
+    )
+    assert result.ret == 0
+    result.stdout.fnmatch_lines(["*2 passed, 2 deselected*"])
+    for line in result.stdout.lines:
+        assert not line.startswith(("test_a.py::test_a2[1]", "test_a.py::test_a2[2]"))
+
+
 def test_sessionfinish_with_start(testdir):
-    testdir.makeconftest("""
+    testdir.makeconftest(
+        """
         import os
         values = []
         def pytest_sessionstart():
             values.append(os.getcwd())
             os.chdir("..")
 
         def pytest_sessionfinish():
             assert values[0] == os.getcwd()
 
-    """)
+    """
+    )
     res = testdir.runpytest("--collect-only")
     assert res.ret == EXIT_NOTESTSCOLLECTED
+
+
+@pytest.mark.parametrize("path", ["root", "{relative}/root", "{environment}/root"])
+def test_rootdir_option_arg(testdir, monkeypatch, path):
+    monkeypatch.setenv("PY_ROOTDIR_PATH", str(testdir.tmpdir))
+    path = path.format(relative=str(testdir.tmpdir), environment="$PY_ROOTDIR_PATH")
+
+    rootdir = testdir.mkdir("root")
+    rootdir.mkdir("tests")
+    testdir.makepyfile(
+        """
+        import os
+        def test_one():
+            assert 1
+    """
+    )
+
+    result = testdir.runpytest("--rootdir={}".format(path))
+    result.stdout.fnmatch_lines(
+        ["*rootdir: {}/root, inifile:*".format(testdir.tmpdir), "*1 passed*"]
+    )
+
+
+def test_rootdir_wrong_option_arg(testdir):
+    testdir.makepyfile(
+        """
+        import os
+        def test_one():
+            assert 1
+    """
+    )
+
+    result = testdir.runpytest("--rootdir=wrong_dir")
+    result.stderr.fnmatch_lines(
+        ["*Directory *wrong_dir* not found. Check your '--rootdir' option.*"]
+    )
--- a/third_party/python/pytest/testing/test_skipping.py
+++ b/third_party/python/pytest/testing/test_skipping.py
@@ -2,692 +2,783 @@ from __future__ import absolute_import, 
 import pytest
 import sys
 
 from _pytest.skipping import MarkEvaluator, folded_skips, pytest_runtest_setup
 from _pytest.runner import runtestprotocol
 
 
 class TestEvaluator(object):
+
     def test_no_marker(self, testdir):
         item = testdir.getitem("def test_func(): pass")
-        evalskipif = MarkEvaluator(item, 'skipif')
+        evalskipif = MarkEvaluator(item, "skipif")
         assert not evalskipif
         assert not evalskipif.istrue()
 
     def test_marked_no_args(self, testdir):
-        item = testdir.getitem("""
+        item = testdir.getitem(
+            """
             import pytest
             @pytest.mark.xyz
             def test_func():
                 pass
-        """)
-        ev = MarkEvaluator(item, 'xyz')
+        """
+        )
+        ev = MarkEvaluator(item, "xyz")
         assert ev
         assert ev.istrue()
         expl = ev.getexplanation()
         assert expl == ""
         assert not ev.get("run", False)
 
     def test_marked_one_arg(self, testdir):
-        item = testdir.getitem("""
+        item = testdir.getitem(
+            """
             import pytest
             @pytest.mark.xyz("hasattr(os, 'sep')")
             def test_func():
                 pass
-        """)
-        ev = MarkEvaluator(item, 'xyz')
+        """
+        )
+        ev = MarkEvaluator(item, "xyz")
         assert ev
         assert ev.istrue()
         expl = ev.getexplanation()
         assert expl == "condition: hasattr(os, 'sep')"
 
-    @pytest.mark.skipif('sys.version_info[0] >= 3')
+    @pytest.mark.skipif("sys.version_info[0] >= 3")
     def test_marked_one_arg_unicode(self, testdir):
-        item = testdir.getitem("""
+        item = testdir.getitem(
+            """
             import pytest
             @pytest.mark.xyz(u"hasattr(os, 'sep')")
             def test_func():
                 pass
-        """)
-        ev = MarkEvaluator(item, 'xyz')
+        """
+        )
+        ev = MarkEvaluator(item, "xyz")
         assert ev
         assert ev.istrue()
         expl = ev.getexplanation()
         assert expl == "condition: hasattr(os, 'sep')"
 
     def test_marked_one_arg_with_reason(self, testdir):
-        item = testdir.getitem("""
+        item = testdir.getitem(
+            """
             import pytest
             @pytest.mark.xyz("hasattr(os, 'sep')", attr=2, reason="hello world")
             def test_func():
                 pass
-        """)
-        ev = MarkEvaluator(item, 'xyz')
+        """
+        )
+        ev = MarkEvaluator(item, "xyz")
         assert ev
         assert ev.istrue()
         expl = ev.getexplanation()
         assert expl == "hello world"
         assert ev.get("attr") == 2
 
     def test_marked_one_arg_twice(self, testdir):
         lines = [
-            '''@pytest.mark.skipif("not hasattr(os, 'murks')")''',
-            '''@pytest.mark.skipif("hasattr(os, 'murks')")'''
+            """@pytest.mark.skipif("not hasattr(os, 'murks')")""",
+            """@pytest.mark.skipif("hasattr(os, 'murks')")""",
         ]
         for i in range(0, 2):
-            item = testdir.getitem("""
+            item = testdir.getitem(
+                """
                 import pytest
                 %s
                 %s
                 def test_func():
                     pass
-            """ % (lines[i], lines[(i + 1) % 2]))
-            ev = MarkEvaluator(item, 'skipif')
+            """
+                % (lines[i], lines[(i + 1) % 2])
+            )
+            ev = MarkEvaluator(item, "skipif")
             assert ev
             assert ev.istrue()
             expl = ev.getexplanation()
             assert expl == "condition: not hasattr(os, 'murks')"
 
     def test_marked_one_arg_twice2(self, testdir):
-        item = testdir.getitem("""
+        item = testdir.getitem(
+            """
             import pytest
             @pytest.mark.skipif("hasattr(os, 'murks')")
             @pytest.mark.skipif("not hasattr(os, 'murks')")
             def test_func():
                 pass
-        """)
-        ev = MarkEvaluator(item, 'skipif')
+        """
+        )
+        ev = MarkEvaluator(item, "skipif")
         assert ev
         assert ev.istrue()
         expl = ev.getexplanation()
         assert expl == "condition: not hasattr(os, 'murks')"
 
     def test_marked_skip_with_not_string(self, testdir):
-        item = testdir.getitem("""
+        item = testdir.getitem(
+            """
             import pytest
             @pytest.mark.skipif(False)
             def test_func():
                 pass
-        """)
-        ev = MarkEvaluator(item, 'skipif')
+        """
+        )
+        ev = MarkEvaluator(item, "skipif")
         exc = pytest.raises(pytest.fail.Exception, ev.istrue)
         assert """Failed: you need to specify reason=STRING when using booleans as conditions.""" in exc.value.msg
 
     def test_skipif_class(self, testdir):
-        item, = testdir.getitems("""
+        item, = testdir.getitems(
+            """
             import pytest
             class TestClass(object):
                 pytestmark = pytest.mark.skipif("config._hackxyz")
                 def test_func(self):
                     pass
-        """)
+        """
+        )
         item.config._hackxyz = 3
-        ev = MarkEvaluator(item, 'skipif')
+        ev = MarkEvaluator(item, "skipif")
         assert ev.istrue()
         expl = ev.getexplanation()
         assert expl == "condition: config._hackxyz"
 
 
 class TestXFail(object):
 
-    @pytest.mark.parametrize('strict', [True, False])
+    @pytest.mark.parametrize("strict", [True, False])
     def test_xfail_simple(self, testdir, strict):
-        item = testdir.getitem("""
+        item = testdir.getitem(
+            """
             import pytest
             @pytest.mark.xfail(strict=%s)
             def test_func():
                 assert 0
-        """ % strict)
+        """
+            % strict
+        )
         reports = runtestprotocol(item, log=False)
         assert len(reports) == 3
         callreport = reports[1]
         assert callreport.skipped
         assert callreport.wasxfail == ""
 
     def test_xfail_xpassed(self, testdir):
-        item = testdir.getitem("""
+        item = testdir.getitem(
+            """
             import pytest
             @pytest.mark.xfail(reason="this is an xfail")
             def test_func():
                 assert 1
-        """)
+        """
+        )
         reports = runtestprotocol(item, log=False)
         assert len(reports) == 3
         callreport = reports[1]
         assert callreport.passed
         assert callreport.wasxfail == "this is an xfail"
 
+    def test_xfail_using_platform(self, testdir):
+        """
+        Verify that platform can be used with xfail statements.
+        """
+        item = testdir.getitem(
+            """
+            import pytest
+            @pytest.mark.xfail("platform.platform() == platform.platform()")
+            def test_func():
+                assert 0
+        """
+        )
+        reports = runtestprotocol(item, log=False)
+        assert len(reports) == 3
+        callreport = reports[1]
+        assert callreport.wasxfail
+
     def test_xfail_xpassed_strict(self, testdir):
-        item = testdir.getitem("""
+        item = testdir.getitem(
+            """
             import pytest
             @pytest.mark.xfail(strict=True, reason="nope")
             def test_func():
                 assert 1
-        """)
+        """
+        )
         reports = runtestprotocol(item, log=False)
         assert len(reports) == 3
         callreport = reports[1]
         assert callreport.failed
         assert callreport.longrepr == "[XPASS(strict)] nope"
         assert not hasattr(callreport, "wasxfail")
 
     def test_xfail_run_anyway(self, testdir):
-        testdir.makepyfile("""
+        testdir.makepyfile(
+            """
             import pytest
             @pytest.mark.xfail
             def test_func():
                 assert 0
             def test_func2():
                 pytest.xfail("hello")
-        """)
+        """
+        )
         result = testdir.runpytest("--runxfail")
-        result.stdout.fnmatch_lines([
-            "*def test_func():*",
-            "*assert 0*",
-            "*1 failed*1 pass*",
-        ])
+        result.stdout.fnmatch_lines(
+            ["*def test_func():*", "*assert 0*", "*1 failed*1 pass*"]
+        )
 
     def test_xfail_evalfalse_but_fails(self, testdir):
-        item = testdir.getitem("""
+        item = testdir.getitem(
+            """
             import pytest
             @pytest.mark.xfail('False')
             def test_func():
                 assert 0
-        """)
+        """
+        )
         reports = runtestprotocol(item, log=False)
         callreport = reports[1]
         assert callreport.failed
         assert not hasattr(callreport, "wasxfail")
-        assert 'xfail' in callreport.keywords
+        assert "xfail" in callreport.keywords
 
     def test_xfail_not_report_default(self, testdir):
-        p = testdir.makepyfile(test_one="""
+        p = testdir.makepyfile(
+            test_one="""
             import pytest
             @pytest.mark.xfail
             def test_this():
                 assert 0
-        """)
-        testdir.runpytest(p, '-v')
+        """
+        )
+        testdir.runpytest(p, "-v")
         # result.stdout.fnmatch_lines([
         #    "*HINT*use*-r*"
         # ])
 
     def test_xfail_not_run_xfail_reporting(self, testdir):
-        p = testdir.makepyfile(test_one="""
+        p = testdir.makepyfile(
+            test_one="""
             import pytest
             @pytest.mark.xfail(run=False, reason="noway")
             def test_this():
                 assert 0
             @pytest.mark.xfail("True", run=False)
             def test_this_true():
                 assert 0
             @pytest.mark.xfail("False", run=False, reason="huh")
             def test_this_false():
                 assert 1
-        """)
-        result = testdir.runpytest(p, '-rx', )
-        result.stdout.fnmatch_lines([
-            "*test_one*test_this*",
-            "*NOTRUN*noway",
-            "*test_one*test_this_true*",
-            "*NOTRUN*condition:*True*",
-            "*1 passed*",
-        ])
+        """
+        )
+        result = testdir.runpytest(p, "-rx")
+        result.stdout.fnmatch_lines(
+            [
+                "*test_one*test_this*",
+                "*NOTRUN*noway",
+                "*test_one*test_this_true*",
+                "*NOTRUN*condition:*True*",
+                "*1 passed*",
+            ]
+        )
 
     def test_xfail_not_run_no_setup_run(self, testdir):
-        p = testdir.makepyfile(test_one="""
+        p = testdir.makepyfile(
+            test_one="""
             import pytest
             @pytest.mark.xfail(run=False, reason="hello")
             def test_this():
                 assert 0
             def setup_module(mod):
                 raise ValueError(42)
-        """)
-        result = testdir.runpytest(p, '-rx', )
-        result.stdout.fnmatch_lines([
-            "*test_one*test_this*",
-            "*NOTRUN*hello",
-            "*1 xfailed*",
-        ])
+        """
+        )
+        result = testdir.runpytest(p, "-rx")
+        result.stdout.fnmatch_lines(
+            ["*test_one*test_this*", "*NOTRUN*hello", "*1 xfailed*"]
+        )
 
     def test_xfail_xpass(self, testdir):
-        p = testdir.makepyfile(test_one="""
+        p = testdir.makepyfile(
+            test_one="""
             import pytest
             @pytest.mark.xfail
             def test_that():
                 assert 1
-        """)
-        result = testdir.runpytest(p, '-rX')
-        result.stdout.fnmatch_lines([
-            "*XPASS*test_that*",
-            "*1 xpassed*"
-        ])
+        """
+        )
+        result = testdir.runpytest(p, "-rX")
+        result.stdout.fnmatch_lines(["*XPASS*test_that*", "*1 xpassed*"])
         assert result.ret == 0
 
     def test_xfail_imperative(self, testdir):
-        p = testdir.makepyfile("""
+        p = testdir.makepyfile(
+            """
             import pytest
             def test_this():
                 pytest.xfail("hello")
-        """)
+        """
+        )
         result = testdir.runpytest(p)
-        result.stdout.fnmatch_lines([
-            "*1 xfailed*",
-        ])
+        result.stdout.fnmatch_lines(["*1 xfailed*"])
         result = testdir.runpytest(p, "-rx")
-        result.stdout.fnmatch_lines([
-            "*XFAIL*test_this*",
-            "*reason:*hello*",
-        ])
+        result.stdout.fnmatch_lines(["*XFAIL*test_this*", "*reason:*hello*"])
         result = testdir.runpytest(p, "--runxfail")
         result.stdout.fnmatch_lines("*1 pass*")
 
     def test_xfail_imperative_in_setup_function(self, testdir):
-        p = testdir.makepyfile("""
+        p = testdir.makepyfile(
+            """
             import pytest
             def setup_function(function):
                 pytest.xfail("hello")
 
             def test_this():
                 assert 0
-        """)
+        """
+        )
         result = testdir.runpytest(p)
-        result.stdout.fnmatch_lines([
-            "*1 xfailed*",
-        ])
+        result.stdout.fnmatch_lines(["*1 xfailed*"])
         result = testdir.runpytest(p, "-rx")
-        result.stdout.fnmatch_lines([
-            "*XFAIL*test_this*",
-            "*reason:*hello*",
-        ])
+        result.stdout.fnmatch_lines(["*XFAIL*test_this*", "*reason:*hello*"])
         result = testdir.runpytest(p, "--runxfail")
-        result.stdout.fnmatch_lines("""
+        result.stdout.fnmatch_lines(
+            """
             *def test_this*
             *1 fail*
-        """)
+        """
+        )
 
     def xtest_dynamic_xfail_set_during_setup(self, testdir):
-        p = testdir.makepyfile("""
+        p = testdir.makepyfile(
+            """
             import pytest
             def setup_function(function):
                 pytest.mark.xfail(function)
             def test_this():
                 assert 0
             def test_that():
                 assert 1
-        """)
-        result = testdir.runpytest(p, '-rxX')
-        result.stdout.fnmatch_lines([
-            "*XFAIL*test_this*",
-            "*XPASS*test_that*",
-        ])
+        """
+        )
+        result = testdir.runpytest(p, "-rxX")
+        result.stdout.fnmatch_lines(["*XFAIL*test_this*", "*XPASS*test_that*"])
 
     def test_dynamic_xfail_no_run(self, testdir):
-        p = testdir.makepyfile("""
+        p = testdir.makepyfile(
+            """
             import pytest
             @pytest.fixture
             def arg(request):
                 request.applymarker(pytest.mark.xfail(run=False))
             def test_this(arg):
                 assert 0
-        """)
-        result = testdir.runpytest(p, '-rxX')
-        result.stdout.fnmatch_lines([
-            "*XFAIL*test_this*",
-            "*NOTRUN*",
-        ])
+        """
+        )
+        result = testdir.runpytest(p, "-rxX")
+        result.stdout.fnmatch_lines(["*XFAIL*test_this*", "*NOTRUN*"])
 
     def test_dynamic_xfail_set_during_funcarg_setup(self, testdir):
-        p = testdir.makepyfile("""
+        p = testdir.makepyfile(
+            """
             import pytest
             @pytest.fixture
             def arg(request):
                 request.applymarker(pytest.mark.xfail)
             def test_this2(arg):
                 assert 0
-        """)
+        """
+        )
         result = testdir.runpytest(p)
-        result.stdout.fnmatch_lines([
-            "*1 xfailed*",
-        ])
+        result.stdout.fnmatch_lines(["*1 xfailed*"])
 
-    @pytest.mark.parametrize('expected, actual, matchline',
-                             [('TypeError', 'TypeError', "*1 xfailed*"),
-                              ('(AttributeError, TypeError)', 'TypeError', "*1 xfailed*"),
-                              ('TypeError', 'IndexError', "*1 failed*"),
-                              ('(AttributeError, TypeError)', 'IndexError', "*1 failed*"),
-                              ])
+    @pytest.mark.parametrize(
+        "expected, actual, matchline",
+        [
+            ("TypeError", "TypeError", "*1 xfailed*"),
+            ("(AttributeError, TypeError)", "TypeError", "*1 xfailed*"),
+            ("TypeError", "IndexError", "*1 failed*"),
+            ("(AttributeError, TypeError)", "IndexError", "*1 failed*"),
+        ],
+    )
     def test_xfail_raises(self, expected, actual, matchline, testdir):
-        p = testdir.makepyfile("""
+        p = testdir.makepyfile(
+            """
             import pytest
             @pytest.mark.xfail(raises=%s)
             def test_raises():
                 raise %s()
-        """ % (expected, actual))
+        """
+            % (expected, actual)
+        )
         result = testdir.runpytest(p)
-        result.stdout.fnmatch_lines([
-            matchline,
-        ])
+        result.stdout.fnmatch_lines([matchline])
 
     def test_strict_sanity(self, testdir):
         """sanity check for xfail(strict=True): a failing test should behave
         exactly like a normal xfail.
         """
-        p = testdir.makepyfile("""
+        p = testdir.makepyfile(
+            """
             import pytest
             @pytest.mark.xfail(reason='unsupported feature', strict=True)
             def test_foo():
                 assert 0
-        """)
-        result = testdir.runpytest(p, '-rxX')
-        result.stdout.fnmatch_lines([
-            '*XFAIL*',
-            '*unsupported feature*',
-        ])
+        """
+        )
+        result = testdir.runpytest(p, "-rxX")
+        result.stdout.fnmatch_lines(["*XFAIL*", "*unsupported feature*"])
         assert result.ret == 0
 
-    @pytest.mark.parametrize('strict', [True, False])
+    @pytest.mark.parametrize("strict", [True, False])
     def test_strict_xfail(self, testdir, strict):
-        p = testdir.makepyfile("""
+        p = testdir.makepyfile(
+            """
             import pytest
 
             @pytest.mark.xfail(reason='unsupported feature', strict=%s)
             def test_foo():
                 with open('foo_executed', 'w'): pass  # make sure test executes
-        """ % strict)
-        result = testdir.runpytest(p, '-rxX')
+        """
+            % strict
+        )
+        result = testdir.runpytest(p, "-rxX")
         if strict:
-            result.stdout.fnmatch_lines([
-                '*test_foo*',
-                '*XPASS(strict)*unsupported feature*',
-            ])
+            result.stdout.fnmatch_lines(
+                ["*test_foo*", "*XPASS(strict)*unsupported feature*"]
+            )
         else:
-            result.stdout.fnmatch_lines([
-                '*test_strict_xfail*',
-                'XPASS test_strict_xfail.py::test_foo unsupported feature',
-            ])
+            result.stdout.fnmatch_lines(
+                [
+                    "*test_strict_xfail*",
+                    "XPASS test_strict_xfail.py::test_foo unsupported feature",
+                ]
+            )
         assert result.ret == (1 if strict else 0)
-        assert testdir.tmpdir.join('foo_executed').isfile()
+        assert testdir.tmpdir.join("foo_executed").isfile()
 
-    @pytest.mark.parametrize('strict', [True, False])
+    @pytest.mark.parametrize("strict", [True, False])
     def test_strict_xfail_condition(self, testdir, strict):
-        p = testdir.makepyfile("""
+        p = testdir.makepyfile(
+            """
             import pytest
 
             @pytest.mark.xfail(False, reason='unsupported feature', strict=%s)
             def test_foo():
                 pass
-        """ % strict)
-        result = testdir.runpytest(p, '-rxX')
-        result.stdout.fnmatch_lines('*1 passed*')
+        """
+            % strict
+        )
+        result = testdir.runpytest(p, "-rxX")
+        result.stdout.fnmatch_lines("*1 passed*")
         assert result.ret == 0
 
-    @pytest.mark.parametrize('strict', [True, False])
+    @pytest.mark.parametrize("strict", [True, False])
     def test_xfail_condition_keyword(self, testdir, strict):
-        p = testdir.makepyfile("""
+        p = testdir.makepyfile(
+            """
             import pytest
 
             @pytest.mark.xfail(condition=False, reason='unsupported feature', strict=%s)
             def test_foo():
                 pass
-        """ % strict)
-        result = testdir.runpytest(p, '-rxX')
-        result.stdout.fnmatch_lines('*1 passed*')
+        """
+            % strict
+        )
+        result = testdir.runpytest(p, "-rxX")
+        result.stdout.fnmatch_lines("*1 passed*")
         assert result.ret == 0
 
-    @pytest.mark.parametrize('strict_val', ['true', 'false'])
+    @pytest.mark.parametrize("strict_val", ["true", "false"])
     def test_strict_xfail_default_from_file(self, testdir, strict_val):
-        testdir.makeini('''
+        testdir.makeini(
+            """
             [pytest]
             xfail_strict = %s
-        ''' % strict_val)
-        p = testdir.makepyfile("""
+        """
+            % strict_val
+        )
+        p = testdir.makepyfile(
+            """
             import pytest
             @pytest.mark.xfail(reason='unsupported feature')
             def test_foo():
                 pass
-        """)
-        result = testdir.runpytest(p, '-rxX')
-        strict = strict_val == 'true'
-        result.stdout.fnmatch_lines('*1 failed*' if strict else '*1 xpassed*')
+        """
+        )
+        result = testdir.runpytest(p, "-rxX")
+        strict = strict_val == "true"
+        result.stdout.fnmatch_lines("*1 failed*" if strict else "*1 xpassed*")
         assert result.ret == (1 if strict else 0)
 
 
 class TestXFailwithSetupTeardown(object):
+
     def test_failing_setup_issue9(self, testdir):
-        testdir.makepyfile("""
+        testdir.makepyfile(
+            """
             import pytest
             def setup_function(func):
                 assert 0
 
             @pytest.mark.xfail
             def test_func():
                 pass
-        """)
+        """
+        )
         result = testdir.runpytest()
-        result.stdout.fnmatch_lines([
-            "*1 xfail*",
-        ])
+        result.stdout.fnmatch_lines(["*1 xfail*"])
 
     def test_failing_teardown_issue9(self, testdir):
-        testdir.makepyfile("""
+        testdir.makepyfile(
+            """
             import pytest
             def teardown_function(func):
                 assert 0
 
             @pytest.mark.xfail
             def test_func():
                 pass
-        """)
+        """
+        )
         result = testdir.runpytest()
-        result.stdout.fnmatch_lines([
-            "*1 xfail*",
-        ])
+        result.stdout.fnmatch_lines(["*1 xfail*"])
 
 
 class TestSkip(object):
+
     def test_skip_class(self, testdir):
-        testdir.makepyfile("""
+        testdir.makepyfile(
+            """
             import pytest
             @pytest.mark.skip
             class TestSomething(object):
                 def test_foo(self):
                     pass
                 def test_bar(self):
                     pass
 
             def test_baz():
                 pass
-        """)
+        """
+        )
         rec = testdir.inline_run()
         rec.assertoutcome(skipped=2, passed=1)
 
     def test_skips_on_false_string(self, testdir):
-        testdir.makepyfile("""
+        testdir.makepyfile(
+            """
             import pytest
             @pytest.mark.skip('False')
             def test_foo():
                 pass
-        """)
+        """
+        )
         rec = testdir.inline_run()
         rec.assertoutcome(skipped=1)
 
     def test_arg_as_reason(self, testdir):
-        testdir.makepyfile("""
+        testdir.makepyfile(
+            """
             import pytest
             @pytest.mark.skip('testing stuff')
             def test_bar():
                 pass
-        """)
-        result = testdir.runpytest('-rs')
-        result.stdout.fnmatch_lines([
-            "*testing stuff*",
-            "*1 skipped*",
-        ])
+        """
+        )
+        result = testdir.runpytest("-rs")
+        result.stdout.fnmatch_lines(["*testing stuff*", "*1 skipped*"])
 
     def test_skip_no_reason(self, testdir):
-        testdir.makepyfile("""
+        testdir.makepyfile(
+            """
             import pytest
             @pytest.mark.skip
             def test_foo():
                 pass
-        """)
-        result = testdir.runpytest('-rs')
-        result.stdout.fnmatch_lines([
-            "*unconditional skip*",
-            "*1 skipped*",
-        ])
+        """
+        )
+        result = testdir.runpytest("-rs")
+        result.stdout.fnmatch_lines(["*unconditional skip*", "*1 skipped*"])
 
     def test_skip_with_reason(self, testdir):
-        testdir.makepyfile("""
+        testdir.makepyfile(
+            """
             import pytest
             @pytest.mark.skip(reason="for lolz")
             def test_bar():
                 pass
-        """)
-        result = testdir.runpytest('-rs')
-        result.stdout.fnmatch_lines([
-            "*for lolz*",
-            "*1 skipped*",
-        ])
+        """
+        )
+        result = testdir.runpytest("-rs")
+        result.stdout.fnmatch_lines(["*for lolz*", "*1 skipped*"])
 
     def test_only_skips_marked_test(self, testdir):
-        testdir.makepyfile("""
+        testdir.makepyfile(
+            """
             import pytest
             @pytest.mark.skip
             def test_foo():
                 pass
             @pytest.mark.skip(reason="nothing in particular")
             def test_bar():
                 pass
             def test_baz():
                 assert True
-        """)
-        result = testdir.runpytest('-rs')
-        result.stdout.fnmatch_lines([
-            "*nothing in particular*",
-            "*1 passed*2 skipped*",
-        ])
+        """
+        )
+        result = testdir.runpytest("-rs")
+        result.stdout.fnmatch_lines(["*nothing in particular*", "*1 passed*2 skipped*"])
 
     def test_strict_and_skip(self, testdir):
-        testdir.makepyfile("""
+        testdir.makepyfile(
+            """
             import pytest
             @pytest.mark.skip
             def test_hello():
                 pass
-        """)
+        """
+        )
         result = testdir.runpytest("-rs")
-        result.stdout.fnmatch_lines([
-            "*unconditional skip*",
-            "*1 skipped*",
-        ])
+        result.stdout.fnmatch_lines(["*unconditional skip*", "*1 skipped*"])
 
 
 class TestSkipif(object):
+
     def test_skipif_conditional(self, testdir):
-        item = testdir.getitem("""
+        item = testdir.getitem(
+            """
             import pytest
             @pytest.mark.skipif("hasattr(os, 'sep')")
             def test_func():
                 pass
-        """)  # noqa
-        x = pytest.raises(pytest.skip.Exception, lambda:
-                          pytest_runtest_setup(item))
+        """
+        )
+        x = pytest.raises(pytest.skip.Exception, lambda: pytest_runtest_setup(item))
         assert x.value.msg == "condition: hasattr(os, 'sep')"
 
-    @pytest.mark.parametrize('params', [
-        '"hasattr(sys, \'platform\')"',
-        'True, reason="invalid platform"',
-    ])
+    @pytest.mark.parametrize(
+        "params", ["\"hasattr(sys, 'platform')\"", 'True, reason="invalid platform"']
+    )
     def test_skipif_reporting(self, testdir, params):
-        p = testdir.makepyfile(test_foo="""
+        p = testdir.makepyfile(
+            test_foo="""
             import pytest
             @pytest.mark.skipif(%(params)s)
             def test_that():
                 assert 0
-        """ % dict(params=params))
-        result = testdir.runpytest(p, '-s', '-rs')
-        result.stdout.fnmatch_lines([
-            "*SKIP*1*test_foo.py*platform*",
-            "*1 skipped*"
-        ])
+        """
+            % dict(params=params)
+        )
+        result = testdir.runpytest(p, "-s", "-rs")
+        result.stdout.fnmatch_lines(["*SKIP*1*test_foo.py*platform*", "*1 skipped*"])
         assert result.ret == 0
 
-    @pytest.mark.parametrize('marker, msg1, msg2', [
-        ('skipif', 'SKIP', 'skipped'),
-        ('xfail', 'XPASS', 'xpassed'),
-    ])
+    def test_skipif_using_platform(self, testdir):
+        item = testdir.getitem(
+            """
+            import pytest
+            @pytest.mark.skipif("platform.platform() == platform.platform()")
+            def test_func():
+                pass
+        """
+        )
+        pytest.raises(pytest.skip.Exception, lambda: pytest_runtest_setup(item))
+
+    @pytest.mark.parametrize(
+        "marker, msg1, msg2",
+        [("skipif", "SKIP", "skipped"), ("xfail", "XPASS", "xpassed")],
+    )
     def test_skipif_reporting_multiple(self, testdir, marker, msg1, msg2):
-        testdir.makepyfile(test_foo="""
+        testdir.makepyfile(
+            test_foo="""
             import pytest
             @pytest.mark.{marker}(False, reason='first_condition')
             @pytest.mark.{marker}(True, reason='second_condition')
             def test_foobar():
                 assert 1
-        """.format(marker=marker))
-        result = testdir.runpytest('-s', '-rsxX')
-        result.stdout.fnmatch_lines([
-            "*{msg1}*test_foo.py*second_condition*".format(msg1=msg1),
-            "*1 {msg2}*".format(msg2=msg2),
-        ])
+        """.format(
+                marker=marker
+            )
+        )
+        result = testdir.runpytest("-s", "-rsxX")
+        result.stdout.fnmatch_lines(
+            [
+                "*{msg1}*test_foo.py*second_condition*".format(msg1=msg1),
+                "*1 {msg2}*".format(msg2=msg2),
+            ]
+        )
         assert result.ret == 0
 
 
 def test_skip_not_report_default(testdir):
-    p = testdir.makepyfile(test_one="""
+    p = testdir.makepyfile(
+        test_one="""
         import pytest
         def test_this():
             pytest.skip("hello")
-    """)
-    result = testdir.runpytest(p, '-v')
-    result.stdout.fnmatch_lines([
-        # "*HINT*use*-r*",
-        "*1 skipped*",
-    ])
+    """
+    )
+    result = testdir.runpytest(p, "-v")
+    result.stdout.fnmatch_lines(
+        [
+            # "*HINT*use*-r*",
+            "*1 skipped*"
+        ]
+    )
 
 
 def test_skipif_class(testdir):
-    p = testdir.makepyfile("""
+    p = testdir.makepyfile(
+        """
         import pytest
 
         class TestClass(object):
             pytestmark = pytest.mark.skipif("True")
             def test_that(self):
                 assert 0
             def test_though(self):
                 assert 0
-    """)
+    """
+    )
     result = testdir.runpytest(p)
-    result.stdout.fnmatch_lines([
-        "*2 skipped*"
-    ])
+    result.stdout.fnmatch_lines(["*2 skipped*"])
 
 
 def test_skip_reasons_folding():
-    path = 'xyz'
+    path = "xyz"
     lineno = 3
     message = "justso"
     longrepr = (path, lineno, message)
 
     class X(object):
         pass
+
     ev1 = X()
     ev1.when = "execute"
     ev1.skipped = True
     ev1.longrepr = longrepr
 
     ev2 = X()
+    ev2.when = "execute"
     ev2.longrepr = longrepr
     ev2.skipped = True
 
-    values = folded_skips([ev1, ev2])
+    # ev3 might be a collection report
+    ev3 = X()
+    ev3.longrepr = longrepr
+    ev3.skipped = True
+
+    values = folded_skips([ev1, ev2, ev3])
     assert len(values) == 1
     num, fspath, lineno, reason = values[0]
-    assert num == 2
+    assert num == 3
     assert fspath == path
     assert lineno == lineno
     assert reason == message
 
 
 def test_skipped_reasons_functional(testdir):
     testdir.makepyfile(
         test_one="""
@@ -699,308 +790,405 @@ def test_skipped_reasons_functional(test
             class TestClass(object):
                 def test_method(self):
                     doskip()
        """,
         conftest="""
             import pytest
             def doskip():
                 pytest.skip('test')
-        """
+        """,
     )
-    result = testdir.runpytest('-rs')
-    result.stdout.fnmatch_lines([
-        "*SKIP*2*conftest.py:4: test",
-    ])
+    result = testdir.runpytest("-rs")
+    result.stdout.fnmatch_lines(["*SKIP*2*conftest.py:4: test"])
+    assert result.ret == 0
+
+
+def test_skipped_folding(testdir):
+    testdir.makepyfile(
+        test_one="""
+            import pytest
+            pytestmark = pytest.mark.skip("Folding")
+            def setup_function(func):
+                pass
+            def test_func():
+                pass
+            class TestClass(object):
+                def test_method(self):
+                    pass
+       """
+    )
+    result = testdir.runpytest("-rs")
+    result.stdout.fnmatch_lines(["*SKIP*2*test_one.py: Folding"])
     assert result.ret == 0
 
 
 def test_reportchars(testdir):
-    testdir.makepyfile("""
+    testdir.makepyfile(
+        """
         import pytest
         def test_1():
             assert 0
         @pytest.mark.xfail
         def test_2():
             assert 0
         @pytest.mark.xfail
         def test_3():
             pass
         def test_4():
             pytest.skip("four")
-    """)
+    """
+    )
     result = testdir.runpytest("-rfxXs")
-    result.stdout.fnmatch_lines([
-        "FAIL*test_1*",
-        "XFAIL*test_2*",
-        "XPASS*test_3*",
-        "SKIP*four*",
-    ])
+    result.stdout.fnmatch_lines(
+        ["FAIL*test_1*", "XFAIL*test_2*", "XPASS*test_3*", "SKIP*four*"]
+    )
 
 
 def test_reportchars_error(testdir):
     testdir.makepyfile(
         conftest="""
         def pytest_runtest_teardown():
             assert 0
         """,
         test_simple="""
         def test_foo():
             pass
-        """)
-    result = testdir.runpytest('-rE')
-    result.stdout.fnmatch_lines([
-        'ERROR*test_foo*',
-    ])
+        """,
+    )
+    result = testdir.runpytest("-rE")
+    result.stdout.fnmatch_lines(["ERROR*test_foo*"])
 
 
 def test_reportchars_all(testdir):
-    testdir.makepyfile("""
+    testdir.makepyfile(
+        """
         import pytest
         def test_1():
             assert 0
         @pytest.mark.xfail
         def test_2():
             assert 0
         @pytest.mark.xfail
         def test_3():
             pass
         def test_4():
             pytest.skip("four")
-    """)
+    """
+    )
     result = testdir.runpytest("-ra")
-    result.stdout.fnmatch_lines([
-        "FAIL*test_1*",
-        "SKIP*four*",
-        "XFAIL*test_2*",
-        "XPASS*test_3*",
-    ])
+    result.stdout.fnmatch_lines(
+        ["FAIL*test_1*", "SKIP*four*", "XFAIL*test_2*", "XPASS*test_3*"]
+    )
 
 
 def test_reportchars_all_error(testdir):
     testdir.makepyfile(
         conftest="""
         def pytest_runtest_teardown():
             assert 0
         """,
         test_simple="""
         def test_foo():
             pass
-        """)
-    result = testdir.runpytest('-ra')
-    result.stdout.fnmatch_lines([
-        'ERROR*test_foo*',
-    ])
+        """,
+    )
+    result = testdir.runpytest("-ra")
+    result.stdout.fnmatch_lines(["ERROR*test_foo*"])
 
 
 @pytest.mark.xfail("hasattr(sys, 'pypy_version_info')")
 def test_errors_in_xfail_skip_expressions(testdir):
-    testdir.makepyfile("""
+    testdir.makepyfile(
+        """
         import pytest
         @pytest.mark.skipif("asd")
         def test_nameerror():
             pass
         @pytest.mark.xfail("syntax error")
         def test_syntax():
             pass
 
         def test_func():
             pass
-    """)
+    """
+    )
     result = testdir.runpytest()
     markline = "                ^"
     if sys.platform.startswith("java"):
         # XXX report this to java
         markline = "*" + markline[8:]
-    result.stdout.fnmatch_lines([
-        "*ERROR*test_nameerror*",
-        "*evaluating*skipif*expression*",
-        "*asd*",
-        "*ERROR*test_syntax*",
-        "*evaluating*xfail*expression*",
-        "    syntax error",
-        markline,
-        "SyntaxError: invalid syntax",
-        "*1 pass*2 error*",
-    ])
+    result.stdout.fnmatch_lines(
+        [
+            "*ERROR*test_nameerror*",
+            "*evaluating*skipif*expression*",
+            "*asd*",
+            "*ERROR*test_syntax*",
+            "*evaluating*xfail*expression*",
+            "    syntax error",
+            markline,
+            "SyntaxError: invalid syntax",
+            "*1 pass*2 error*",
+        ]
+    )
 
 
 def test_xfail_skipif_with_globals(testdir):
-    testdir.makepyfile("""
+    testdir.makepyfile(
+        """
         import pytest
         x = 3
         @pytest.mark.skipif("x == 3")
         def test_skip1():
             pass
         @pytest.mark.xfail("x == 3")
         def test_boolean():
             assert 0
-    """)
+    """
+    )
     result = testdir.runpytest("-rsx")
-    result.stdout.fnmatch_lines([
-        "*SKIP*x == 3*",
-        "*XFAIL*test_boolean*",
-        "*x == 3*",
-    ])
+    result.stdout.fnmatch_lines(["*SKIP*x == 3*", "*XFAIL*test_boolean*", "*x == 3*"])
 
 
 def test_direct_gives_error(testdir):
-    testdir.makepyfile("""
+    testdir.makepyfile(
+        """
         import pytest
         @pytest.mark.skipif(True)
         def test_skip1():
             pass
-    """)
+    """
+    )
     result = testdir.runpytest()
-    result.stdout.fnmatch_lines([
-        "*1 error*",
-    ])
+    result.stdout.fnmatch_lines(["*1 error*"])
 
 
 def test_default_markers(testdir):
     result = testdir.runpytest("--markers")
-    result.stdout.fnmatch_lines([
-        "*skipif(*condition)*skip*",
-        "*xfail(*condition, reason=None, run=True, raises=None, strict=False)*expected failure*",
-    ])
+    result.stdout.fnmatch_lines(
+        [
+            "*skipif(*condition)*skip*",
+            "*xfail(*condition, reason=None, run=True, raises=None, strict=False)*expected failure*",
+        ]
+    )
 
 
 def test_xfail_test_setup_exception(testdir):
-    testdir.makeconftest("""
+    testdir.makeconftest(
+        """
             def pytest_runtest_setup():
                 0 / 0
-        """)
-    p = testdir.makepyfile("""
+        """
+    )
+    p = testdir.makepyfile(
+        """
             import pytest
             @pytest.mark.xfail
             def test_func():
                 assert 0
-        """)
+        """
+    )
     result = testdir.runpytest(p)
     assert result.ret == 0
-    assert 'xfailed' in result.stdout.str()
-    assert 'xpassed' not in result.stdout.str()
+    assert "xfailed" in result.stdout.str()
+    assert "xpassed" not in result.stdout.str()
 
 
 def test_imperativeskip_on_xfail_test(testdir):
-    testdir.makepyfile("""
+    testdir.makepyfile(
+        """
         import pytest
         @pytest.mark.xfail
         def test_that_fails():
             assert 0
 
         @pytest.mark.skipif("True")
         def test_hello():
             pass
-    """)
-    testdir.makeconftest("""
+    """
+    )
+    testdir.makeconftest(
+        """
         import pytest
         def pytest_runtest_setup(item):
             pytest.skip("abc")
-    """)
+    """
+    )
     result = testdir.runpytest("-rsxX")
-    result.stdout.fnmatch_lines_random("""
+    result.stdout.fnmatch_lines_random(
+        """
         *SKIP*abc*
         *SKIP*condition: True*
         *2 skipped*
-    """)
+    """
+    )
 
 
 class TestBooleanCondition(object):
+
     def test_skipif(self, testdir):
-        testdir.makepyfile("""
+        testdir.makepyfile(
+            """
             import pytest
             @pytest.mark.skipif(True, reason="True123")
             def test_func1():
                 pass
             @pytest.mark.skipif(False, reason="True123")
             def test_func2():
                 pass
-        """)
+        """
+        )
         result = testdir.runpytest()
-        result.stdout.fnmatch_lines("""
+        result.stdout.fnmatch_lines(
+            """
             *1 passed*1 skipped*
-        """)
+        """
+        )
 
     def test_skipif_noreason(self, testdir):
-        testdir.makepyfile("""
+        testdir.makepyfile(
+            """
             import pytest
             @pytest.mark.skipif(True)
             def test_func():
                 pass
-        """)
+        """
+        )
         result = testdir.runpytest("-rs")
-        result.stdout.fnmatch_lines("""
+        result.stdout.fnmatch_lines(
+            """
             *1 error*
-        """)
+        """
+        )
 
     def test_xfail(self, testdir):
-        testdir.makepyfile("""
+        testdir.makepyfile(
+            """
             import pytest
             @pytest.mark.xfail(True, reason="True123")
             def test_func():
                 assert 0
-        """)
+        """
+        )
         result = testdir.runpytest("-rxs")
-        result.stdout.fnmatch_lines("""
+        result.stdout.fnmatch_lines(
+            """
             *XFAIL*
             *True123*
             *1 xfail*
-        """)
+        """
+        )
 
 
 def test_xfail_item(testdir):
     # Ensure pytest.xfail works with non-Python Item
-    testdir.makeconftest("""
+    testdir.makeconftest(
+        """
         import pytest
 
         class MyItem(pytest.Item):
             nodeid = 'foo'
             def runtest(self):
                 pytest.xfail("Expected Failure")
 
         def pytest_collect_file(path, parent):
             return MyItem("foo", parent)
-    """)
+    """
+    )
     result = testdir.inline_run()
     passed, skipped, failed = result.listoutcomes()
     assert not failed
-    xfailed = [r for r in skipped if hasattr(r, 'wasxfail')]
+    xfailed = [r for r in skipped if hasattr(r, "wasxfail")]
     assert xfailed
 
 
 def test_module_level_skip_error(testdir):
     """
     Verify that using pytest.skip at module level causes a collection error
     """
-    testdir.makepyfile("""
+    testdir.makepyfile(
+        """
         import pytest
         @pytest.skip
         def test_func():
             assert True
-    """)
+    """
+    )
     result = testdir.runpytest()
-    result.stdout.fnmatch_lines(
-        "*Using pytest.skip outside of a test is not allowed*"
+    result.stdout.fnmatch_lines("*Using pytest.skip outside of a test is not allowed*")
+
+
+def test_module_level_skip_with_allow_module_level(testdir):
+    """
+    Verify that using pytest.skip(allow_module_level=True) is allowed
+    """
+    testdir.makepyfile(
+        """
+        import pytest
+        pytest.skip("skip_module_level", allow_module_level=True)
+
+        def test_func():
+            assert 0
+    """
     )
+    result = testdir.runpytest("-rxs")
+    result.stdout.fnmatch_lines("*SKIP*skip_module_level")
+
+
+def test_invalid_skip_keyword_parameter(testdir):
+    """
+    Verify that using pytest.skip() with unknown parameter raises an error
+    """
+    testdir.makepyfile(
+        """
+        import pytest
+        pytest.skip("skip_module_level", unknown=1)
+
+        def test_func():
+            assert 0
+    """
+    )
+    result = testdir.runpytest()
+    result.stdout.fnmatch_lines("*TypeError:*['unknown']*")
 
 
 def test_mark_xfail_item(testdir):
     # Ensure pytest.mark.xfail works with non-Python Item
-    testdir.makeconftest("""
+    testdir.makeconftest(
+        """
         import pytest
 
         class MyItem(pytest.Item):
             nodeid = 'foo'
             def setup(self):
                 marker = pytest.mark.xfail(True, reason="Expected failure")
                 self.add_marker(marker)
             def runtest(self):
                 assert False
 
         def pytest_collect_file(path, parent):
             return MyItem("foo", parent)
-    """)
+    """
+    )
     result = testdir.inline_run()
     passed, skipped, failed = result.listoutcomes()
     assert not failed
-    xfailed = [r for r in skipped if hasattr(r, 'wasxfail')]
+    xfailed = [r for r in skipped if hasattr(r, "wasxfail")]
     assert xfailed
+
+
+def test_summary_list_after_errors(testdir):
+    """Ensure the list of errors/fails/xfails/skips appears after tracebacks in terminal reporting."""
+    testdir.makepyfile(
+        """
+        import pytest
+        def test_fail():
+            assert 0
+    """
+    )
+    result = testdir.runpytest("-ra")
+    result.stdout.fnmatch_lines(
+        [
+            "=* FAILURES *=",
+            "*= short test summary info =*",
+            "FAIL test_summary_list_after_errors.py::test_fail",
+        ]
+    )
--- a/third_party/python/pytest/testing/test_terminal.py
+++ b/third_party/python/pytest/testing/test_terminal.py
@@ -1,672 +1,756 @@
 """
 terminal reporting of the full testing process.
 """
 from __future__ import absolute_import, division, print_function
 import collections
 import sys
 
-import _pytest._pluggy as pluggy
+import pluggy
 import _pytest._code
 import py
 import pytest
 from _pytest.main import EXIT_NOTESTSCOLLECTED
 from _pytest.terminal import TerminalReporter, repr_pythonversion, getreportopt
 from _pytest.terminal import build_summary_stats_line, _plugin_nameversions
 
 
-DistInfo = collections.namedtuple('DistInfo', ['project_name', 'version'])
+DistInfo = collections.namedtuple("DistInfo", ["project_name", "version"])
 
 
 class Option(object):
+
     def __init__(self, verbose=False, fulltrace=False):
         self.verbose = verbose
         self.fulltrace = fulltrace
 
     @property
     def args(self):
         values = []
         if self.verbose:
-            values.append('-v')
+            values.append("-v")
         if self.fulltrace:
-            values.append('--fulltrace')
+            values.append("--fulltrace")
         return values
 
 
-def pytest_generate_tests(metafunc):
-    if "option" in metafunc.fixturenames:
-        metafunc.addcall(id="default",
-                         funcargs={'option': Option(verbose=False)})
-        metafunc.addcall(id="verbose",
-                         funcargs={'option': Option(verbose=True)})
-        metafunc.addcall(id="quiet",
-                         funcargs={'option': Option(verbose=-1)})
-        metafunc.addcall(id="fulltrace",
-                         funcargs={'option': Option(fulltrace=True)})
+@pytest.fixture(
+    params=[
+        Option(verbose=False),
+        Option(verbose=True),
+        Option(verbose=-1),
+        Option(fulltrace=True),
+    ],
+    ids=["default", "verbose", "quiet", "fulltrace"],
+)
+def option(request):
+    return request.param
 
 
-@pytest.mark.parametrize('input,expected', [
-    ([DistInfo(project_name='test', version=1)], ['test-1']),
-    ([DistInfo(project_name='pytest-test', version=1)], ['test-1']),
-    ([
-        DistInfo(project_name='test', version=1),
-        DistInfo(project_name='test', version=1)
-    ], ['test-1']),
-], ids=['normal', 'prefix-strip', 'deduplicate'])
+@pytest.mark.parametrize(
+    "input,expected",
+    [
+        ([DistInfo(project_name="test", version=1)], ["test-1"]),
+        ([DistInfo(project_name="pytest-test", version=1)], ["test-1"]),
+        (
+            [
+                DistInfo(project_name="test", version=1),
+                DistInfo(project_name="test", version=1),
+            ],
+            ["test-1"],
+        ),
+    ],
+    ids=["normal", "prefix-strip", "deduplicate"],
+)
 def test_plugin_nameversion(input, expected):
     pluginlist = [(None, x) for x in input]
     result = _plugin_nameversions(pluginlist)
     assert result == expected
 
 
 class TestTerminal(object):
+
     def test_pass_skip_fail(self, testdir, option):
-        testdir.makepyfile("""
+        testdir.makepyfile(
+            """
             import pytest
             def test_ok():
                 pass
             def test_skip():
                 pytest.skip("xx")
             def test_func():
                 assert 0
-        """)
+        """
+        )
         result = testdir.runpytest(*option.args)
         if option.verbose:
-            result.stdout.fnmatch_lines([
-                "*test_pass_skip_fail.py::test_ok PASS*",
-                "*test_pass_skip_fail.py::test_skip SKIP*",
-                "*test_pass_skip_fail.py::test_func FAIL*",
-            ])
+            result.stdout.fnmatch_lines(
+                [
+                    "*test_pass_skip_fail.py::test_ok PASS*",
+                    "*test_pass_skip_fail.py::test_skip SKIP*",
+                    "*test_pass_skip_fail.py::test_func FAIL*",
+                ]
+            )
         else:
-            result.stdout.fnmatch_lines([
-                "*test_pass_skip_fail.py .sF"
-            ])
-        result.stdout.fnmatch_lines([
-            "    def test_func():",
-            ">       assert 0",
-            "E       assert 0",
-        ])
+            result.stdout.fnmatch_lines(["*test_pass_skip_fail.py .sF*"])
+        result.stdout.fnmatch_lines(
+            ["    def test_func():", ">       assert 0", "E       assert 0"]
+        )
 
     def test_internalerror(self, testdir, linecomp):
         modcol = testdir.getmodulecol("def test_one(): pass")
         rep = TerminalReporter(modcol.config, file=linecomp.stringio)
         excinfo = pytest.raises(ValueError, "raise ValueError('hello')")
         rep.pytest_internalerror(excinfo.getrepr())
-        linecomp.assert_contains_lines([
-            "INTERNALERROR> *ValueError*hello*"
-        ])
+        linecomp.assert_contains_lines(["INTERNALERROR> *ValueError*hello*"])
 
     def test_writeline(self, testdir, linecomp):
         modcol = testdir.getmodulecol("def test_one(): pass")
         rep = TerminalReporter(modcol.config, file=linecomp.stringio)
         rep.write_fspath_result(modcol.nodeid, ".")
         rep.write_line("hello world")
-        lines = linecomp.stringio.getvalue().split('\n')
+        lines = linecomp.stringio.getvalue().split("\n")
         assert not lines[0]
         assert lines[1].endswith(modcol.name + " .")
         assert lines[2] == "hello world"
 
     def test_show_runtest_logstart(self, testdir, linecomp):
         item = testdir.getitem("def test_func(): pass")
         tr = TerminalReporter(item.config, file=linecomp.stringio)
         item.config.pluginmanager.register(tr)
         location = item.reportinfo()
-        tr.config.hook.pytest_runtest_logstart(nodeid=item.nodeid,
-                                               location=location, fspath=str(item.fspath))
-        linecomp.assert_contains_lines([
-            "*test_show_runtest_logstart.py*"
-        ])
+        tr.config.hook.pytest_runtest_logstart(
+            nodeid=item.nodeid, location=location, fspath=str(item.fspath)
+        )
+        linecomp.assert_contains_lines(["*test_show_runtest_logstart.py*"])
 
     def test_runtest_location_shown_before_test_starts(self, testdir):
-        testdir.makepyfile("""
+        testdir.makepyfile(
+            """
             def test_1():
                 import time
                 time.sleep(20)
-        """)
+        """
+        )
         child = testdir.spawn_pytest("")
         child.expect(".*test_runtest_location.*py")
         child.sendeof()
         child.kill(15)
 
     def test_itemreport_subclasses_show_subclassed_file(self, testdir):
-        testdir.makepyfile(test_p1="""
+        testdir.makepyfile(
+            test_p1="""
             class BaseTests(object):
                 def test_p1(self):
                     pass
             class TestClass(BaseTests):
                 pass
-        """)
-        p2 = testdir.makepyfile(test_p2="""
+        """
+        )
+        p2 = testdir.makepyfile(
+            test_p2="""
             from test_p1 import BaseTests
             class TestMore(BaseTests):
                 pass
-        """)
+        """
+        )
         result = testdir.runpytest(p2)
-        result.stdout.fnmatch_lines([
-            "*test_p2.py .",
-            "*1 passed*",
-        ])
+        result.stdout.fnmatch_lines(["*test_p2.py .*", "*1 passed*"])
         result = testdir.runpytest("-v", p2)
-        result.stdout.fnmatch_lines([
-            "*test_p2.py::TestMore::test_p1* <- *test_p1.py*PASSED",
-        ])
+        result.stdout.fnmatch_lines(
+            ["*test_p2.py::TestMore::test_p1* <- *test_p1.py*PASSED*"]
+        )
 
     def test_itemreport_directclasses_not_shown_as_subclasses(self, testdir):
         a = testdir.mkpydir("a123")
-        a.join("test_hello123.py").write(_pytest._code.Source("""
+        a.join("test_hello123.py").write(
+            _pytest._code.Source(
+                """
             class TestClass(object):
                 def test_method(self):
                     pass
-        """))
+        """
+            )
+        )
         result = testdir.runpytest("-v")
         assert result.ret == 0
-        result.stdout.fnmatch_lines([
-            "*a123/test_hello123.py*PASS*",
-        ])
+        result.stdout.fnmatch_lines(["*a123/test_hello123.py*PASS*"])
         assert " <- " not in result.stdout.str()
 
     def test_keyboard_interrupt(self, testdir, option):
-        testdir.makepyfile("""
+        testdir.makepyfile(
+            """
             def test_foobar():
                 assert 0
             def test_spamegg():
                 import py; pytest.skip('skip me please!')
             def test_interrupt_me():
                 raise KeyboardInterrupt   # simulating the user
-        """)
+        """
+        )
 
         result = testdir.runpytest(*option.args, no_reraise_ctrlc=True)
-        result.stdout.fnmatch_lines([
-            "    def test_foobar():",
-            ">       assert 0",
-            "E       assert 0",
-            "*_keyboard_interrupt.py:6: KeyboardInterrupt*",
-        ])
+        result.stdout.fnmatch_lines(
+            [
+                "    def test_foobar():",
+                ">       assert 0",
+                "E       assert 0",
+                "*_keyboard_interrupt.py:6: KeyboardInterrupt*",
+            ]
+        )
         if option.fulltrace:
-            result.stdout.fnmatch_lines([
-                "*raise KeyboardInterrupt   # simulating the user*",
-            ])
+            result.stdout.fnmatch_lines(
+                ["*raise KeyboardInterrupt   # simulating the user*"]
+            )
         else:
-            result.stdout.fnmatch_lines([
-                "to show a full traceback on KeyboardInterrupt use --fulltrace"
-            ])
-        result.stdout.fnmatch_lines(['*KeyboardInterrupt*'])
+            result.stdout.fnmatch_lines(
+                ["(to show a full traceback on KeyboardInterrupt use --fulltrace)"]
+            )
+        result.stdout.fnmatch_lines(["*KeyboardInterrupt*"])
 
     def test_keyboard_in_sessionstart(self, testdir):
-        testdir.makeconftest("""
+        testdir.makeconftest(
+            """
             def pytest_sessionstart():
                 raise KeyboardInterrupt
-        """)
-        testdir.makepyfile("""
+        """
+        )
+        testdir.makepyfile(
+            """
             def test_foobar():
                 pass
-        """)
+        """
+        )
 
         result = testdir.runpytest(no_reraise_ctrlc=True)
         assert result.ret == 2
-        result.stdout.fnmatch_lines(['*KeyboardInterrupt*'])
+        result.stdout.fnmatch_lines(["*KeyboardInterrupt*"])
 
     def test_collect_single_item(self, testdir):
         """Use singular 'item' when reporting a single test item"""
-        testdir.makepyfile("""
+        testdir.makepyfile(
+            """
             def test_foobar():
                 pass
-        """)
+        """
+        )
         result = testdir.runpytest()
-        result.stdout.fnmatch_lines(['collected 1 item'])
+        result.stdout.fnmatch_lines(["collected 1 item"])
 
     def test_rewrite(self, testdir, monkeypatch):
         config = testdir.parseconfig()
         f = py.io.TextIO()
-        monkeypatch.setattr(f, 'isatty', lambda *args: True)
+        monkeypatch.setattr(f, "isatty", lambda *args: True)
         tr = TerminalReporter(config, f)
-        tr.writer.fullwidth = 10
-        tr.write('hello')
-        tr.rewrite('hey', erase=True)
-        assert f.getvalue() == 'hello' + '\r' + 'hey' + (7 * ' ')
+        tr._tw.fullwidth = 10
+        tr.write("hello")
+        tr.rewrite("hey", erase=True)
+        assert f.getvalue() == "hello" + "\r" + "hey" + (6 * " ")
 
 
 class TestCollectonly(object):
+
     def test_collectonly_basic(self, testdir):
-        testdir.makepyfile("""
+        testdir.makepyfile(
+            """
             def test_func():
                 pass
-        """)
-        result = testdir.runpytest("--collect-only",)
-        result.stdout.fnmatch_lines([
-            "<Module 'test_collectonly_basic.py'>",
-            "  <Function 'test_func'>",
-        ])
+        """
+        )
+        result = testdir.runpytest("--collect-only")
+        result.stdout.fnmatch_lines(
+            ["<Module 'test_collectonly_basic.py'>", "  <Function 'test_func'>"]
+        )
 
     def test_collectonly_skipped_module(self, testdir):
-        testdir.makepyfile("""
+        testdir.makepyfile(
+            """
             import pytest
             pytest.skip("hello")
-        """)
+        """
+        )
         result = testdir.runpytest("--collect-only", "-rs")
-        result.stdout.fnmatch_lines([
-            "*ERROR collecting*",
-        ])
+        result.stdout.fnmatch_lines(["*ERROR collecting*"])
 
     def test_collectonly_failed_module(self, testdir):
         testdir.makepyfile("""raise ValueError(0)""")
         result = testdir.runpytest("--collect-only")
-        result.stdout.fnmatch_lines([
-            "*raise ValueError*",
-            "*1 error*",
-        ])
+        result.stdout.fnmatch_lines(["*raise ValueError*", "*1 error*"])
 
     def test_collectonly_fatal(self, testdir):
-        testdir.makeconftest("""
+        testdir.makeconftest(
+            """
             def pytest_collectstart(collector):
                 assert 0, "urgs"
-        """)
+        """
+        )
         result = testdir.runpytest("--collect-only")
-        result.stdout.fnmatch_lines([
-            "*INTERNAL*args*"
-        ])
+        result.stdout.fnmatch_lines(["*INTERNAL*args*"])
         assert result.ret == 3
 
     def test_collectonly_simple(self, testdir):
-        p = testdir.makepyfile("""
+        p = testdir.makepyfile(
+            """
             def test_func1():
                 pass
             class TestClass(object):
                 def test_method(self):
                     pass
-        """)
+        """
+        )
         result = testdir.runpytest("--collect-only", p)
         # assert stderr.startswith("inserting into sys.path")
         assert result.ret == 0
-        result.stdout.fnmatch_lines([
-            "*<Module '*.py'>",
-            "* <Function 'test_func1'*>",
-            "* <Class 'TestClass'>",
-            # "*  <Instance '()'>",
-            "*   <Function 'test_method'*>",
-        ])
+        result.stdout.fnmatch_lines(
+            [
+                "*<Module '*.py'>",
+                "* <Function 'test_func1'*>",
+                "* <Class 'TestClass'>",
+                # "*  <Instance '()'>",
+                "*   <Function 'test_method'*>",
+            ]
+        )
 
     def test_collectonly_error(self, testdir):
         p = testdir.makepyfile("import Errlkjqweqwe")
         result = testdir.runpytest("--collect-only", p)
         assert result.ret == 2
-        result.stdout.fnmatch_lines(_pytest._code.Source("""
+        result.stdout.fnmatch_lines(
+            _pytest._code.Source(
+                """
             *ERROR*
             *ImportError*
             *No module named *Errlk*
             *1 error*
-        """).strip())
+        """
+            ).strip()
+        )
 
     def test_collectonly_missing_path(self, testdir):
         """this checks issue 115,
             failure in parseargs will cause session
             not to have the items attribute
         """
         result = testdir.runpytest("--collect-only", "uhm_missing_path")
         assert result.ret == 4
-        result.stderr.fnmatch_lines([
-            '*ERROR: file not found*',
-        ])
+        result.stderr.fnmatch_lines(["*ERROR: file not found*"])
 
     def test_collectonly_quiet(self, testdir):
         testdir.makepyfile("def test_foo(): pass")
         result = testdir.runpytest("--collect-only", "-q")
-        result.stdout.fnmatch_lines([
-            '*test_foo*',
-        ])
+        result.stdout.fnmatch_lines(["*test_foo*"])
 
     def test_collectonly_more_quiet(self, testdir):
         testdir.makepyfile(test_fun="def test_foo(): pass")
         result = testdir.runpytest("--collect-only", "-qq")
-        result.stdout.fnmatch_lines([
-            '*test_fun.py: 1*',
-        ])
+        result.stdout.fnmatch_lines(["*test_fun.py: 1*"])
 
 
 def test_repr_python_version(monkeypatch):
     try:
-        monkeypatch.setattr(sys, 'version_info', (2, 5, 1, 'final', 0))
+        monkeypatch.setattr(sys, "version_info", (2, 5, 1, "final", 0))
         assert repr_pythonversion() == "2.5.1-final-0"
-        py.std.sys.version_info = x = (2, 3)
+        sys.version_info = x = (2, 3)
         assert repr_pythonversion() == str(x)
     finally:
         monkeypatch.undo()  # do this early as pytest can get confused
 
 
 class TestFixtureReporting(object):
+
     def test_setup_fixture_error(self, testdir):
-        testdir.makepyfile("""
+        testdir.makepyfile(
+            """
             def setup_function(function):
                 print ("setup func")
                 assert 0
             def test_nada():
                 pass
-        """)
+        """
+        )
         result = testdir.runpytest()
-        result.stdout.fnmatch_lines([
-            "*ERROR at setup of test_nada*",
-            "*setup_function(function):*",
-            "*setup func*",
-            "*assert 0*",
-            "*1 error*",
-        ])
+        result.stdout.fnmatch_lines(
+            [
+                "*ERROR at setup of test_nada*",
+                "*setup_function(function):*",
+                "*setup func*",
+                "*assert 0*",
+                "*1 error*",
+            ]
+        )
         assert result.ret != 0
 
     def test_teardown_fixture_error(self, testdir):
-        testdir.makepyfile("""
+        testdir.makepyfile(
+            """
             def test_nada():
                 pass
             def teardown_function(function):
                 print ("teardown func")
                 assert 0
-        """)
+        """
+        )
         result = testdir.runpytest()
-        result.stdout.fnmatch_lines([
-            "*ERROR at teardown*",
-            "*teardown_function(function):*",
-            "*assert 0*",
-            "*Captured stdout*",
-            "*teardown func*",
-            "*1 passed*1 error*",
-        ])
+        result.stdout.fnmatch_lines(
+            [
+                "*ERROR at teardown*",
+                "*teardown_function(function):*",
+                "*assert 0*",
+                "*Captured stdout*",
+                "*teardown func*",
+                "*1 passed*1 error*",
+            ]
+        )
 
     def test_teardown_fixture_error_and_test_failure(self, testdir):
-        testdir.makepyfile("""
+        testdir.makepyfile(
+            """
             def test_fail():
                 assert 0, "failingfunc"
 
             def teardown_function(function):
                 print ("teardown func")
                 assert False
-        """)
+        """
+        )
         result = testdir.runpytest()
-        result.stdout.fnmatch_lines([
-            "*ERROR at teardown of test_fail*",
-            "*teardown_function(function):*",
-            "*assert False*",
-            "*Captured stdout*",
-            "*teardown func*",
-
-            "*test_fail*",
-            "*def test_fail():",
-            "*failingfunc*",
-            "*1 failed*1 error*",
-        ])
+        result.stdout.fnmatch_lines(
+            [
+                "*ERROR at teardown of test_fail*",
+                "*teardown_function(function):*",
+                "*assert False*",
+                "*Captured stdout*",
+                "*teardown func*",
+                "*test_fail*",
+                "*def test_fail():",
+                "*failingfunc*",
+                "*1 failed*1 error*",
+            ]
+        )
 
     def test_setup_teardown_output_and_test_failure(self, testdir):
         """ Test for issue #442 """
-        testdir.makepyfile("""
+        testdir.makepyfile(
+            """
             def setup_function(function):
                 print ("setup func")
 
             def test_fail():
                 assert 0, "failingfunc"
 
             def teardown_function(function):
                 print ("teardown func")
-        """)
+        """
+        )
         result = testdir.runpytest()
-        result.stdout.fnmatch_lines([
-            "*test_fail*",
-            "*def test_fail():",
-            "*failingfunc*",
-            "*Captured stdout setup*",
-            "*setup func*",
-            "*Captured stdout teardown*",
-            "*teardown func*",
-
-            "*1 failed*",
-        ])
+        result.stdout.fnmatch_lines(
+            [
+                "*test_fail*",
+                "*def test_fail():",
+                "*failingfunc*",
+                "*Captured stdout setup*",
+                "*setup func*",
+                "*Captured stdout teardown*",
+                "*teardown func*",
+                "*1 failed*",
+            ]
+        )
 
 
 class TestTerminalFunctional(object):
+
     def test_deselected(self, testdir):
-        testpath = testdir.makepyfile("""
+        testpath = testdir.makepyfile(
+            """
                 def test_one():
                     pass
                 def test_two():
                     pass
                 def test_three():
                     pass
            """
-                                      )
+        )
         result = testdir.runpytest("-k", "test_two:", testpath)
-        result.stdout.fnmatch_lines([
-            "*test_deselected.py ..",
-            "=* 1 test*deselected *=",
-        ])
+        result.stdout.fnmatch_lines(
+            ["collected 3 items / 1 deselected", "*test_deselected.py ..*"]
+        )
+        assert result.ret == 0
+
+    def test_show_deselected_items_using_markexpr_before_test_execution(self, testdir):
+        testdir.makepyfile(
+            """
+            import pytest
+
+            @pytest.mark.foo
+            def test_foobar():
+                pass
+
+            @pytest.mark.bar
+            def test_bar():
+                pass
+
+            def test_pass():
+                pass
+        """
+        )
+        result = testdir.runpytest("-m", "not foo")
+        result.stdout.fnmatch_lines(
+            [
+                "collected 3 items / 1 deselected",
+                "*test_show_des*.py ..*",
+                "*= 2 passed, 1 deselected in * =*",
+            ]
+        )
+        assert "= 1 deselected =" not in result.stdout.str()
         assert result.ret == 0
 
     def test_no_skip_summary_if_failure(self, testdir):
-        testdir.makepyfile("""
+        testdir.makepyfile(
+            """
             import pytest
             def test_ok():
                 pass
             def test_fail():
                 assert 0
             def test_skip():
                 pytest.skip("dontshow")
-        """)
+        """
+        )
         result = testdir.runpytest()
         assert result.stdout.str().find("skip test summary") == -1
         assert result.ret == 1
 
     def test_passes(self, testdir):
-        p1 = testdir.makepyfile("""
+        p1 = testdir.makepyfile(
+            """
             def test_passes():
                 pass
             class TestClass(object):
                 def test_method(self):
                     pass
-        """)
+        """
+        )
         old = p1.dirpath().chdir()
         try:
             result = testdir.runpytest()
         finally:
             old.chdir()
-        result.stdout.fnmatch_lines([
-            "test_passes.py ..",
-            "* 2 pass*",
-        ])
+        result.stdout.fnmatch_lines(["test_passes.py ..*", "* 2 pass*"])
         assert result.ret == 0
 
     def test_header_trailer_info(self, testdir):
-        testdir.makepyfile("""
+        testdir.makepyfile(
+            """
             def test_passes():
                 pass
-        """)
+        """
+        )
         result = testdir.runpytest()
-        verinfo = ".".join(map(str, py.std.sys.version_info[:3]))
-        result.stdout.fnmatch_lines([
-            "*===== test session starts ====*",
-            "platform %s -- Python %s*pytest-%s*py-%s*pluggy-%s" % (
-                py.std.sys.platform, verinfo,
-                pytest.__version__, py.__version__, pluggy.__version__),
-            "*test_header_trailer_info.py .",
-            "=* 1 passed*in *.[0-9][0-9] seconds *=",
-        ])
+        verinfo = ".".join(map(str, sys.version_info[:3]))
+        result.stdout.fnmatch_lines(
+            [
+                "*===== test session starts ====*",
+                "platform %s -- Python %s*pytest-%s*py-%s*pluggy-%s"
+                % (
+                    sys.platform,
+                    verinfo,
+                    pytest.__version__,
+                    py.__version__,
+                    pluggy.__version__,
+                ),
+                "*test_header_trailer_info.py .*",
+                "=* 1 passed*in *.[0-9][0-9] seconds *=",
+            ]
+        )
         if pytest.config.pluginmanager.list_plugin_distinfo():
-            result.stdout.fnmatch_lines([
-                "plugins: *",
-            ])
+            result.stdout.fnmatch_lines(["plugins: *"])
 
     def test_showlocals(self, testdir):
-        p1 = testdir.makepyfile("""
+        p1 = testdir.makepyfile(
+            """
             def test_showlocals():
                 x = 3
                 y = "x" * 5000
                 assert 0
-        """)
-        result = testdir.runpytest(p1, '-l')
-        result.stdout.fnmatch_lines([
-            # "_ _ * Locals *",
-            "x* = 3",
-            "y* = 'xxxxxx*"
-        ])
+        """
+        )
+        result = testdir.runpytest(p1, "-l")
+        result.stdout.fnmatch_lines(
+            [
+                # "_ _ * Locals *",
+                "x* = 3",
+                "y* = 'xxxxxx*",
+            ]
+        )
 
     def test_verbose_reporting(self, testdir, pytestconfig):
-        p1 = testdir.makepyfile("""
+        p1 = testdir.makepyfile(
+            """
             import pytest
             def test_fail():
                 raise ValueError()
             def test_pass():
                 pass
             class TestClass(object):
                 def test_skip(self):
                     pytest.skip("hello")
             def test_gen():
                 def check(x):
                     assert x == 1
                 yield check, 0
-        """)
-        result = testdir.runpytest(p1, '-v')
-        result.stdout.fnmatch_lines([
-            "*test_verbose_reporting.py::test_fail *FAIL*",
-            "*test_verbose_reporting.py::test_pass *PASS*",
-            "*test_verbose_reporting.py::TestClass::test_skip *SKIP*",
-            "*test_verbose_reporting.py::test_gen*0* *FAIL*",
-        ])
+        """
+        )
+        result = testdir.runpytest(p1, "-v")
+        result.stdout.fnmatch_lines(
+            [
+                "*test_verbose_reporting.py::test_fail *FAIL*",
+                "*test_verbose_reporting.py::test_pass *PASS*",
+                "*test_verbose_reporting.py::TestClass::test_skip *SKIP*",
+                "*test_verbose_reporting.py::test_gen*0* *FAIL*",
+            ]
+        )
         assert result.ret == 1
 
         if not pytestconfig.pluginmanager.get_plugin("xdist"):
             pytest.skip("xdist plugin not installed")
 
-        result = testdir.runpytest(p1, '-v', '-n 1')
-        result.stdout.fnmatch_lines([
-            "*FAIL*test_verbose_reporting.py::test_fail*",
-        ])
+        result = testdir.runpytest(p1, "-v", "-n 1")
+        result.stdout.fnmatch_lines(["*FAIL*test_verbose_reporting.py::test_fail*"])
         assert result.ret == 1
 
     def test_quiet_reporting(self, testdir):
         p1 = testdir.makepyfile("def test_pass(): pass")
-        result = testdir.runpytest(p1, '-q')
+        result = testdir.runpytest(p1, "-q")
         s = result.stdout.str()
-        assert 'test session starts' not in s
+        assert "test session starts" not in s
         assert p1.basename not in s
         assert "===" not in s
         assert "passed" in s
 
     def test_more_quiet_reporting(self, testdir):
         p1 = testdir.makepyfile("def test_pass(): pass")
-        result = testdir.runpytest(p1, '-qq')
+        result = testdir.runpytest(p1, "-qq")
         s = result.stdout.str()
-        assert 'test session starts' not in s
+        assert "test session starts" not in s
         assert p1.basename not in s
         assert "===" not in s
         assert "passed" not in s
 
     def test_report_collectionfinish_hook(self, testdir):
-        testdir.makeconftest("""
+        testdir.makeconftest(
+            """
             def pytest_report_collectionfinish(config, startdir, items):
                 return ['hello from hook: {0} items'.format(len(items))]
-        """)
-        testdir.makepyfile("""
+        """
+        )
+        testdir.makepyfile(
+            """
             import pytest
             @pytest.mark.parametrize('i', range(3))
             def test(i):
                 pass
-        """)
+        """
+        )
         result = testdir.runpytest()
-        result.stdout.fnmatch_lines([
-            "collected 3 items",
-            "hello from hook: 3 items",
-        ])
+        result.stdout.fnmatch_lines(["collected 3 items", "hello from hook: 3 items"])
 
 
 def test_fail_extra_reporting(testdir):
     testdir.makepyfile("def test_this(): assert 0")
     result = testdir.runpytest()
-    assert 'short test summary' not in result.stdout.str()
-    result = testdir.runpytest('-rf')
-    result.stdout.fnmatch_lines([
-        "*test summary*",
-        "FAIL*test_fail_extra_reporting*",
-    ])
+    assert "short test summary" not in result.stdout.str()
+    result = testdir.runpytest("-rf")
+    result.stdout.fnmatch_lines(["*test summary*", "FAIL*test_fail_extra_reporting*"])
 
 
 def test_fail_reporting_on_pass(testdir):
     testdir.makepyfile("def test_this(): assert 1")
-    result = testdir.runpytest('-rf')
-    assert 'short test summary' not in result.stdout.str()
+    result = testdir.runpytest("-rf")
+    assert "short test summary" not in result.stdout.str()
 
 
 def test_pass_extra_reporting(testdir):
     testdir.makepyfile("def test_this(): assert 1")
     result = testdir.runpytest()
-    assert 'short test summary' not in result.stdout.str()
-    result = testdir.runpytest('-rp')
-    result.stdout.fnmatch_lines([
-        "*test summary*",
-        "PASS*test_pass_extra_reporting*",
-    ])
+    assert "short test summary" not in result.stdout.str()
+    result = testdir.runpytest("-rp")
+    result.stdout.fnmatch_lines(["*test summary*", "PASS*test_pass_extra_reporting*"])
 
 
 def test_pass_reporting_on_fail(testdir):
     testdir.makepyfile("def test_this(): assert 0")
-    result = testdir.runpytest('-rp')
-    assert 'short test summary' not in result.stdout.str()
+    result = testdir.runpytest("-rp")
+    assert "short test summary" not in result.stdout.str()
 
 
 def test_pass_output_reporting(testdir):
-    testdir.makepyfile("""
+    testdir.makepyfile(
+        """
         def test_pass_output():
             print("Four score and seven years ago...")
-    """)
+    """
+    )
     result = testdir.runpytest()
-    assert 'Four score and seven years ago...' not in result.stdout.str()
-    result = testdir.runpytest('-rP')
-    result.stdout.fnmatch_lines([
-        "Four score and seven years ago...",
-    ])
+    assert "Four score and seven years ago..." not in result.stdout.str()
+    result = testdir.runpytest("-rP")
+    result.stdout.fnmatch_lines(["Four score and seven years ago..."])
 
 
 def test_color_yes(testdir):
     testdir.makepyfile("def test_this(): assert 1")
-    result = testdir.runpytest('--color=yes')
-    assert 'test session starts' in result.stdout.str()
-    assert '\x1b[1m' in result.stdout.str()
+    result = testdir.runpytest("--color=yes")
+    assert "test session starts" in result.stdout.str()
+    assert "\x1b[1m" in result.stdout.str()
 
 
 def test_color_no(testdir):
     testdir.makepyfile("def test_this(): assert 1")
-    result = testdir.runpytest('--color=no')
-    assert 'test session starts' in result.stdout.str()
-    assert '\x1b[1m' not in result.stdout.str()
+    result = testdir.runpytest("--color=no")
+    assert "test session starts" in result.stdout.str()
+    assert "\x1b[1m" not in result.stdout.str()
 
 
-@pytest.mark.parametrize('verbose', [True, False])
+@pytest.mark.parametrize("verbose", [True, False])
 def test_color_yes_collection_on_non_atty(testdir, verbose):
     """skip collect progress report when working on non-terminals.
     #1397
     """
-    testdir.makepyfile("""
+    testdir.makepyfile(
+        """
         import pytest
         @pytest.mark.parametrize('i', range(10))
         def test_this(i):
             assert 1
-    """)
-    args = ['--color=yes']
+    """
+    )
+    args = ["--color=yes"]
     if verbose:
-        args.append('-vv')
+        args.append("-vv")
     result = testdir.runpytest(*args)
-    assert 'test session starts' in result.stdout.str()
-    assert '\x1b[1m' in result.stdout.str()
-    assert 'collecting 10 items' not in result.stdout.str()
+    assert "test session starts" in result.stdout.str()
+    assert "\x1b[1m" in result.stdout.str()
+    assert "collecting 10 items" not in result.stdout.str()
     if verbose:
-        assert 'collecting ...' in result.stdout.str()
-    assert 'collected 10 items' in result.stdout.str()
+        assert "collecting ..." in result.stdout.str()
+    assert "collected 10 items" in result.stdout.str()
 
 
 def test_getreportopt():
-    class config(object):
-        class option(object):
+
+    class Config(object):
+
+        class Option(object):
             reportchars = ""
             disable_warnings = True
 
+        option = Option()
+
+    config = Config()
+
     config.option.reportchars = "sf"
     assert getreportopt(config) == "sf"
 
     config.option.reportchars = "sfxw"
     assert getreportopt(config) == "sfx"
 
     config.option.reportchars = "sfx"
     config.option.disable_warnings = False
@@ -674,294 +758,510 @@ def test_getreportopt():
 
     config.option.reportchars = "sfxw"
     config.option.disable_warnings = False
     assert getreportopt(config) == "sfxw"
 
 
 def test_terminalreporter_reportopt_addopts(testdir):
     testdir.makeini("[pytest]\naddopts=-rs")
-    testdir.makepyfile("""
+    testdir.makepyfile(
+        """
         import pytest
 
         @pytest.fixture
         def tr(request):
             tr = request.config.pluginmanager.getplugin("terminalreporter")
             return tr
         def test_opt(tr):
             assert tr.hasopt('skipped')
             assert not tr.hasopt('qwe')
-    """)
+    """
+    )
     result = testdir.runpytest()
-    result.stdout.fnmatch_lines([
-        "*1 passed*"
-    ])
+    result.stdout.fnmatch_lines(["*1 passed*"])
 
 
 def test_tbstyle_short(testdir):
-    p = testdir.makepyfile("""
+    p = testdir.makepyfile(
+        """
         import pytest
 
         @pytest.fixture
         def arg(request):
             return 42
         def test_opt(arg):
             x = 0
             assert x
-    """)
+    """
+    )
     result = testdir.runpytest("--tb=short")
     s = result.stdout.str()
-    assert 'arg = 42' not in s
-    assert 'x = 0' not in s
-    result.stdout.fnmatch_lines([
-        "*%s:8*" % p.basename,
-        "    assert x",
-        "E   assert*",
-    ])
+    assert "arg = 42" not in s
+    assert "x = 0" not in s
+    result.stdout.fnmatch_lines(["*%s:8*" % p.basename, "    assert x", "E   assert*"])
     result = testdir.runpytest()
     s = result.stdout.str()
-    assert 'x = 0' in s
-    assert 'assert x' in s
+    assert "x = 0" in s
+    assert "assert x" in s
 
 
 def test_traceconfig(testdir, monkeypatch):
     result = testdir.runpytest("--traceconfig")
-    result.stdout.fnmatch_lines([
-        "*active plugins*"
-    ])
+    result.stdout.fnmatch_lines(["*active plugins*"])
     assert result.ret == EXIT_NOTESTSCOLLECTED
 
 
 class TestGenericReporting(object):
     """ this test class can be subclassed with a different option
         provider to run e.g. distributed tests.
     """
 
     def test_collect_fail(self, testdir, option):
         testdir.makepyfile("import xyz\n")
         result = testdir.runpytest(*option.args)
-        result.stdout.fnmatch_lines([
-            "ImportError while importing*",
-            "*No module named *xyz*",
-            "*1 error*",
-        ])
+        result.stdout.fnmatch_lines(
+            ["ImportError while importing*", "*No module named *xyz*", "*1 error*"]
+        )
 
     def test_maxfailures(self, testdir, option):
-        testdir.makepyfile("""
+        testdir.makepyfile(
+            """
             def test_1():
                 assert 0
             def test_2():
                 assert 0
             def test_3():
                 assert 0
-        """)
+        """
+        )
         result = testdir.runpytest("--maxfail=2", *option.args)
-        result.stdout.fnmatch_lines([
-            "*def test_1():*",
-            "*def test_2():*",
-            "*!! Interrupted: stopping after 2 failures*!!*",
-            "*2 failed*",
-        ])
+        result.stdout.fnmatch_lines(
+            ["*def test_1():*", "*def test_2():*", "*2 failed*"]
+        )
 
     def test_tb_option(self, testdir, option):
-        testdir.makepyfile("""
+        testdir.makepyfile(
+            """
             import pytest
             def g():
                 raise IndexError
             def test_func():
                 print (6*7)
                 g()  # --calling--
-        """)
+        """
+        )
         for tbopt in ["long", "short", "no"]:
-            print('testing --tb=%s...' % tbopt)
-            result = testdir.runpytest('--tb=%s' % tbopt)
+            print("testing --tb=%s..." % tbopt)
+            result = testdir.runpytest("--tb=%s" % tbopt)
             s = result.stdout.str()
             if tbopt == "long":
-                assert 'print (6*7)' in s
+                assert "print (6*7)" in s
             else:
-                assert 'print (6*7)' not in s
+                assert "print (6*7)" not in s
             if tbopt != "no":
-                assert '--calling--' in s
-                assert 'IndexError' in s
+                assert "--calling--" in s
+                assert "IndexError" in s
             else:
-                assert 'FAILURES' not in s
-                assert '--calling--' not in s
-                assert 'IndexError' not in s
+                assert "FAILURES" not in s
+                assert "--calling--" not in s
+                assert "IndexError" not in s
 
     def test_tb_crashline(self, testdir, option):
-        p = testdir.makepyfile("""
+        p = testdir.makepyfile(
+            """
             import pytest
             def g():
                 raise IndexError
             def test_func1():
                 print (6*7)
                 g()  # --calling--
             def test_func2():
                 assert 0, "hello"
-        """)
+        """
+        )
         result = testdir.runpytest("--tb=line")
         bn = p.basename
-        result.stdout.fnmatch_lines([
-            "*%s:3: IndexError*" % bn,
-            "*%s:8: AssertionError: hello*" % bn,
-        ])
+        result.stdout.fnmatch_lines(
+            ["*%s:3: IndexError*" % bn, "*%s:8: AssertionError: hello*" % bn]
+        )
         s = result.stdout.str()
         assert "def test_func2" not in s
 
     def test_pytest_report_header(self, testdir, option):
-        testdir.makeconftest("""
+        testdir.makeconftest(
+            """
             def pytest_sessionstart(session):
                 session.config._somevalue = 42
             def pytest_report_header(config):
                 return "hello: %s" % config._somevalue
-        """)
-        testdir.mkdir("a").join("conftest.py").write("""
+        """
+        )
+        testdir.mkdir("a").join("conftest.py").write(
+            """
 def pytest_report_header(config, startdir):
     return ["line1", str(startdir)]
-""")
+"""
+        )
         result = testdir.runpytest("a")
-        result.stdout.fnmatch_lines([
-            "*hello: 42*",
-            "line1",
-            str(testdir.tmpdir),
-        ])
+        result.stdout.fnmatch_lines(["*hello: 42*", "line1", str(testdir.tmpdir)])
+
+    def test_show_capture(self, testdir):
+        testdir.makepyfile(
+            """
+            import sys
+            import logging
+            def test_one():
+                sys.stdout.write('!This is stdout!')
+                sys.stderr.write('!This is stderr!')
+                logging.warning('!This is a warning log msg!')
+                assert False, 'Something failed'
+        """
+        )
+
+        result = testdir.runpytest("--tb=short")
+        result.stdout.fnmatch_lines(
+            [
+                "!This is stdout!",
+                "!This is stderr!",
+                "*WARNING*!This is a warning log msg!",
+            ]
+        )
+
+        result = testdir.runpytest("--show-capture=all", "--tb=short")
+        result.stdout.fnmatch_lines(
+            [
+                "!This is stdout!",
+                "!This is stderr!",
+                "*WARNING*!This is a warning log msg!",
+            ]
+        )
+
+        stdout = testdir.runpytest("--show-capture=stdout", "--tb=short").stdout.str()
+        assert "!This is stderr!" not in stdout
+        assert "!This is stdout!" in stdout
+        assert "!This is a warning log msg!" not in stdout
+
+        stdout = testdir.runpytest("--show-capture=stderr", "--tb=short").stdout.str()
+        assert "!This is stdout!" not in stdout
+        assert "!This is stderr!" in stdout
+        assert "!This is a warning log msg!" not in stdout
+
+        stdout = testdir.runpytest("--show-capture=log", "--tb=short").stdout.str()
+        assert "!This is stdout!" not in stdout
+        assert "!This is stderr!" not in stdout
+        assert "!This is a warning log msg!" in stdout
+
+        stdout = testdir.runpytest("--show-capture=no", "--tb=short").stdout.str()
+        assert "!This is stdout!" not in stdout
+        assert "!This is stderr!" not in stdout
+        assert "!This is a warning log msg!" not in stdout
 
 
 @pytest.mark.xfail("not hasattr(os, 'dup')")
 def test_fdopen_kept_alive_issue124(testdir):
-    testdir.makepyfile("""
+    testdir.makepyfile(
+        """
         import os, sys
         k = []
         def test_open_file_and_keep_alive(capfd):
             stdout = os.fdopen(1, 'w', 1)
             k.append(stdout)
 
         def test_close_kept_alive_file():
             stdout = k.pop()
             stdout.close()
-    """)
+    """
+    )
     result = testdir.runpytest()
-    result.stdout.fnmatch_lines([
-        "*2 passed*"
-    ])
+    result.stdout.fnmatch_lines(["*2 passed*"])
 
 
 def test_tbstyle_native_setup_error(testdir):
-    testdir.makepyfile("""
+    testdir.makepyfile(
+        """
         import pytest
         @pytest.fixture
         def setup_error_fixture():
             raise Exception("error in exception")
 
         def test_error_fixture(setup_error_fixture):
             pass
-    """)
+    """
+    )
     result = testdir.runpytest("--tb=native")
-    result.stdout.fnmatch_lines([
-        '*File *test_tbstyle_native_setup_error.py", line *, in setup_error_fixture*'
-    ])
+    result.stdout.fnmatch_lines(
+        ['*File *test_tbstyle_native_setup_error.py", line *, in setup_error_fixture*']
+    )
 
 
 def test_terminal_summary(testdir):
-    testdir.makeconftest("""
+    testdir.makeconftest(
+        """
         def pytest_terminal_summary(terminalreporter, exitstatus):
             w = terminalreporter
             w.section("hello")
             w.line("world")
             w.line("exitstatus: {0}".format(exitstatus))
-    """)
+    """
+    )
     result = testdir.runpytest()
-    result.stdout.fnmatch_lines("""
+    result.stdout.fnmatch_lines(
+        """
         *==== hello ====*
         world
         exitstatus: 5
-    """)
+    """
+    )
 
 
 def test_terminal_summary_warnings_are_displayed(testdir):
     """Test that warnings emitted during pytest_terminal_summary are displayed.
     (#1305).
     """
-    testdir.makeconftest("""
+    testdir.makeconftest(
+        """
         def pytest_terminal_summary(terminalreporter):
             config = terminalreporter.config
             config.warn('C1', 'internal warning')
-    """)
-    result = testdir.runpytest('-rw')
-    result.stdout.fnmatch_lines([
-        '*internal warning',
-        '*== 1 warnings in *',
-    ])
-
-
-@pytest.mark.parametrize("exp_color, exp_line, stats_arg", [
-    # The method under test only cares about the length of each
-    # dict value, not the actual contents, so tuples of anything
-    # suffice
-
-    # Important statuses -- the highest priority of these always wins
-    ("red", "1 failed", {"failed": (1,)}),
-    ("red", "1 failed, 1 passed", {"failed": (1,), "passed": (1,)}),
-
-    ("red", "1 error", {"error": (1,)}),
-    ("red", "1 passed, 1 error", {"error": (1,), "passed": (1,)}),
-
-    # (a status that's not known to the code)
-    ("yellow", "1 weird", {"weird": (1,)}),
-    ("yellow", "1 passed, 1 weird", {"weird": (1,), "passed": (1,)}),
-
-    ("yellow", "1 warnings", {"warnings": (1,)}),
-    ("yellow", "1 passed, 1 warnings", {"warnings": (1,),
-                                        "passed": (1,)}),
-
-    ("green", "5 passed", {"passed": (1, 2, 3, 4, 5)}),
+    """
+    )
+    result = testdir.runpytest("-rw")
+    result.stdout.fnmatch_lines(
+        ["<undetermined location>", "*internal warning", "*== 1 warnings in *"]
+    )
+    assert "None" not in result.stdout.str()
 
 
-    # "Boring" statuses.  These have no effect on the color of the summary
-    # line.  Thus, if *every* test has a boring status, the summary line stays
-    # at its default color, i.e. yellow, to warn the user that the test run
-    # produced no useful information
-    ("yellow", "1 skipped", {"skipped": (1,)}),
-    ("green", "1 passed, 1 skipped", {"skipped": (1,), "passed": (1,)}),
-
-    ("yellow", "1 deselected", {"deselected": (1,)}),
-    ("green", "1 passed, 1 deselected", {"deselected": (1,), "passed": (1,)}),
-
-    ("yellow", "1 xfailed", {"xfailed": (1,)}),
-    ("green", "1 passed, 1 xfailed", {"xfailed": (1,), "passed": (1,)}),
-
-    ("yellow", "1 xpassed", {"xpassed": (1,)}),
-    ("green", "1 passed, 1 xpassed", {"xpassed": (1,), "passed": (1,)}),
-
-    # Likewise if no tests were found at all
-    ("yellow", "no tests ran", {}),
-
-    # Test the empty-key special case
-    ("yellow", "no tests ran", {"": (1,)}),
-    ("green", "1 passed", {"": (1,), "passed": (1,)}),
-
-
-    # A couple more complex combinations
-    ("red", "1 failed, 2 passed, 3 xfailed",
-        {"passed": (1, 2), "failed": (1,), "xfailed": (1, 2, 3)}),
-
-    ("green", "1 passed, 2 skipped, 3 deselected, 2 xfailed",
-        {"passed": (1,),
-         "skipped": (1, 2),
-         "deselected": (1, 2, 3),
-         "xfailed": (1, 2)}),
-])
+@pytest.mark.parametrize(
+    "exp_color, exp_line, stats_arg",
+    [
+        # The method under test only cares about the length of each
+        # dict value, not the actual contents, so tuples of anything
+        # suffice
+        # Important statuses -- the highest priority of these always wins
+        ("red", "1 failed", {"failed": (1,)}),
+        ("red", "1 failed, 1 passed", {"failed": (1,), "passed": (1,)}),
+        ("red", "1 error", {"error": (1,)}),
+        ("red", "1 passed, 1 error", {"error": (1,), "passed": (1,)}),
+        # (a status that's not known to the code)
+        ("yellow", "1 weird", {"weird": (1,)}),
+        ("yellow", "1 passed, 1 weird", {"weird": (1,), "passed": (1,)}),
+        ("yellow", "1 warnings", {"warnings": (1,)}),
+        ("yellow", "1 passed, 1 warnings", {"warnings": (1,), "passed": (1,)}),
+        ("green", "5 passed", {"passed": (1, 2, 3, 4, 5)}),
+        # "Boring" statuses.  These have no effect on the color of the summary
+        # line.  Thus, if *every* test has a boring status, the summary line stays
+        # at its default color, i.e. yellow, to warn the user that the test run
+        # produced no useful information
+        ("yellow", "1 skipped", {"skipped": (1,)}),
+        ("green", "1 passed, 1 skipped", {"skipped": (1,), "passed": (1,)}),
+        ("yellow", "1 deselected", {"deselected": (1,)}),
+        ("green", "1 passed, 1 deselected", {"deselected": (1,), "passed": (1,)}),
+        ("yellow", "1 xfailed", {"xfailed": (1,)}),
+        ("green", "1 passed, 1 xfailed", {"xfailed": (1,), "passed": (1,)}),
+        ("yellow", "1 xpassed", {"xpassed": (1,)}),
+        ("green", "1 passed, 1 xpassed", {"xpassed": (1,), "passed": (1,)}),
+        # Likewise if no tests were found at all
+        ("yellow", "no tests ran", {}),
+        # Test the empty-key special case
+        ("yellow", "no tests ran", {"": (1,)}),
+        ("green", "1 passed", {"": (1,), "passed": (1,)}),
+        # A couple more complex combinations
+        (
+            "red",
+            "1 failed, 2 passed, 3 xfailed",
+            {"passed": (1, 2), "failed": (1,), "xfailed": (1, 2, 3)},
+        ),
+        (
+            "green",
+            "1 passed, 2 skipped, 3 deselected, 2 xfailed",
+            {
+                "passed": (1,),
+                "skipped": (1, 2),
+                "deselected": (1, 2, 3),
+                "xfailed": (1, 2),
+            },
+        ),
+    ],
+)
 def test_summary_stats(exp_line, exp_color, stats_arg):
     print("Based on stats: %s" % stats_arg)
-    print("Expect summary: \"%s\"; with color \"%s\"" % (exp_line, exp_color))
+    print('Expect summary: "%s"; with color "%s"' % (exp_line, exp_color))
     (line, color) = build_summary_stats_line(stats_arg)
-    print("Actually got:   \"%s\"; with color \"%s\"" % (line, color))
+    print('Actually got:   "%s"; with color "%s"' % (line, color))
     assert line == exp_line
     assert color == exp_color
 
 
 def test_no_trailing_whitespace_after_inifile_word(testdir):
-    result = testdir.runpytest('')
-    assert 'inifile:\n' in result.stdout.str()
+    result = testdir.runpytest("")
+    assert "inifile:\n" in result.stdout.str()
+
+    testdir.makeini("[pytest]")
+    result = testdir.runpytest("")
+    assert "inifile: tox.ini\n" in result.stdout.str()
+
+
+class TestProgress(object):
+
+    @pytest.fixture
+    def many_tests_files(self, testdir):
+        testdir.makepyfile(
+            test_bar="""
+                import pytest
+                @pytest.mark.parametrize('i', range(10))
+                def test_bar(i): pass
+            """,
+            test_foo="""
+                import pytest
+                @pytest.mark.parametrize('i', range(5))
+                def test_foo(i): pass
+            """,
+            test_foobar="""
+                import pytest
+                @pytest.mark.parametrize('i', range(5))
+                def test_foobar(i): pass
+            """,
+        )
+
+    def test_zero_tests_collected(self, testdir):
+        """Some plugins (testmon for example) might issue pytest_runtest_logreport without any tests being
+        actually collected (#2971)."""
+        testdir.makeconftest(
+            """
+        def pytest_collection_modifyitems(items, config):
+            from _pytest.runner import CollectReport
+            for node_id in ('nodeid1', 'nodeid2'):
+                rep = CollectReport(node_id, 'passed', None, None)
+                rep.when = 'passed'
+                rep.duration = 0.1
+                config.hook.pytest_runtest_logreport(report=rep)
+        """
+        )
+        output = testdir.runpytest()
+        assert "ZeroDivisionError" not in output.stdout.str()
+        output.stdout.fnmatch_lines(["=* 2 passed in *="])
+
+    def test_normal(self, many_tests_files, testdir):
+        output = testdir.runpytest()
+        output.stdout.re_match_lines(
+            [
+                r"test_bar.py \.{10} \s+ \[ 50%\]",
+                r"test_foo.py \.{5} \s+ \[ 75%\]",
+                r"test_foobar.py \.{5} \s+ \[100%\]",
+            ]
+        )
+
+    def test_verbose(self, many_tests_files, testdir):
+        output = testdir.runpytest("-v")
+        output.stdout.re_match_lines(
+            [
+                r"test_bar.py::test_bar\[0\] PASSED \s+ \[  5%\]",
+                r"test_foo.py::test_foo\[4\] PASSED \s+ \[ 75%\]",
+                r"test_foobar.py::test_foobar\[4\] PASSED \s+ \[100%\]",
+            ]
+        )
+
+    def test_xdist_normal(self, many_tests_files, testdir):
+        pytest.importorskip("xdist")
+        output = testdir.runpytest("-n2")
+        output.stdout.re_match_lines([r"\.{20} \s+ \[100%\]"])
+
+    def test_xdist_verbose(self, many_tests_files, testdir):
+        pytest.importorskip("xdist")
+        output = testdir.runpytest("-n2", "-v")
+        output.stdout.re_match_lines_random(
+            [
+                r"\[gw\d\] \[\s*\d+%\] PASSED test_bar.py::test_bar\[1\]",
+                r"\[gw\d\] \[\s*\d+%\] PASSED test_foo.py::test_foo\[1\]",
+                r"\[gw\d\] \[\s*\d+%\] PASSED test_foobar.py::test_foobar\[1\]",
+            ]
+        )
 
-    testdir.makeini('[pytest]')
-    result = testdir.runpytest('')
-    assert 'inifile: tox.ini\n' in result.stdout.str()
+    def test_capture_no(self, many_tests_files, testdir):
+        output = testdir.runpytest("-s")
+        output.stdout.re_match_lines(
+            [r"test_bar.py \.{10}", r"test_foo.py \.{5}", r"test_foobar.py \.{5}"]
+        )
+
+        output = testdir.runpytest("--capture=no")
+        assert "%]" not in output.stdout.str()
+
+
+class TestProgressWithTeardown(object):
+    """Ensure we show the correct percentages for tests that fail during teardown (#3088)"""
+
+    @pytest.fixture
+    def contest_with_teardown_fixture(self, testdir):
+        testdir.makeconftest(
+            """
+            import pytest
+
+            @pytest.fixture
+            def fail_teardown():
+                yield
+                assert False
+        """
+        )
+
+    @pytest.fixture
+    def many_files(self, testdir, contest_with_teardown_fixture):
+        testdir.makepyfile(
+            test_bar="""
+                import pytest
+                @pytest.mark.parametrize('i', range(5))
+                def test_bar(fail_teardown, i):
+                    pass
+            """,
+            test_foo="""
+                import pytest
+                @pytest.mark.parametrize('i', range(15))
+                def test_foo(fail_teardown, i):
+                    pass
+            """,
+        )
+
+    def test_teardown_simple(self, testdir, contest_with_teardown_fixture):
+        testdir.makepyfile(
+            """
+            def test_foo(fail_teardown):
+                pass
+        """
+        )
+        output = testdir.runpytest()
+        output.stdout.re_match_lines([r"test_teardown_simple.py \.E\s+\[100%\]"])
+
+    def test_teardown_with_test_also_failing(
+        self, testdir, contest_with_teardown_fixture
+    ):
+        testdir.makepyfile(
+            """
+            def test_foo(fail_teardown):
+                assert False
+        """
+        )
+        output = testdir.runpytest()
+        output.stdout.re_match_lines(
+            [r"test_teardown_with_test_also_failing.py FE\s+\[100%\]"]
+        )
+
+    def test_teardown_many(self, testdir, many_files):
+        output = testdir.runpytest()
+        output.stdout.re_match_lines(
+            [r"test_bar.py (\.E){5}\s+\[ 25%\]", r"test_foo.py (\.E){15}\s+\[100%\]"]
+        )
+
+    def test_teardown_many_verbose(self, testdir, many_files):
+        output = testdir.runpytest("-v")
+        output.stdout.re_match_lines(
+            [
+                r"test_bar.py::test_bar\[0\] PASSED\s+\[  5%\]",
+                r"test_bar.py::test_bar\[0\] ERROR\s+\[  5%\]",
+                r"test_bar.py::test_bar\[4\] PASSED\s+\[ 25%\]",
+                r"test_bar.py::test_bar\[4\] ERROR\s+\[ 25%\]",
+            ]
+        )
+
+    def test_xdist_normal(self, many_files, testdir):
+        pytest.importorskip("xdist")
+        output = testdir.runpytest("-n2")
+        output.stdout.re_match_lines([r"[\.E]{40} \s+ \[100%\]"])
--- a/third_party/python/pytest/testing/test_tmpdir.py
+++ b/third_party/python/pytest/testing/test_tmpdir.py
@@ -2,23 +2,26 @@ from __future__ import absolute_import, 
 import sys
 import py
 import pytest
 
 from _pytest.tmpdir import tmpdir
 
 
 def test_funcarg(testdir):
-    testdir.makepyfile("""
+    testdir.makepyfile(
+        """
             def pytest_generate_tests(metafunc):
                 metafunc.addcall(id='a')
                 metafunc.addcall(id='b')
             def test_func(tmpdir): pass
-    """)
+    """
+    )
     from _pytest.tmpdir import TempdirFactory
+
     reprec = testdir.inline_run()
     calls = reprec.getcalls("pytest_runtest_setup")
     item = calls[0].item
     config = item.config
     tmpdirhandler = TempdirFactory(config)
     item._initrequest()
     p = tmpdir(item._request, tmpdirhandler)
     assert p.check()
@@ -27,162 +30,183 @@ def test_funcarg(testdir):
     item.name = "qwe/\\abc"
     p = tmpdir(item._request, tmpdirhandler)
     assert p.check()
     bn = p.basename.strip("0123456789")
     assert bn == "qwe__abc"
 
 
 def test_ensuretemp(recwarn):
-    d1 = pytest.ensuretemp('hello')
-    d2 = pytest.ensuretemp('hello')
+    d1 = pytest.ensuretemp("hello")
+    d2 = pytest.ensuretemp("hello")
     assert d1 == d2
     assert d1.check(dir=1)
 
 
 class TestTempdirHandler(object):
+
     def test_mktemp(self, testdir):
         from _pytest.tmpdir import TempdirFactory
+
         config = testdir.parseconfig()
         config.option.basetemp = testdir.mkdir("hello")
         t = TempdirFactory(config)
         tmp = t.mktemp("world")
         assert tmp.relto(t.getbasetemp()) == "world0"
         tmp = t.mktemp("this")
         assert tmp.relto(t.getbasetemp()).startswith("this")
         tmp2 = t.mktemp("this")
         assert tmp2.relto(t.getbasetemp()).startswith("this")
         assert tmp2 != tmp
 
 
 class TestConfigTmpdir(object):
+
     def test_getbasetemp_custom_removes_old(self, testdir):
         mytemp = testdir.tmpdir.join("xyz")
-        p = testdir.makepyfile("""
+        p = testdir.makepyfile(
+            """
             def test_1(tmpdir):
                 pass
-        """)
-        testdir.runpytest(p, '--basetemp=%s' % mytemp)
+        """
+        )
+        testdir.runpytest(p, "--basetemp=%s" % mytemp)
         mytemp.check()
         mytemp.ensure("hello")
 
-        testdir.runpytest(p, '--basetemp=%s' % mytemp)
+        testdir.runpytest(p, "--basetemp=%s" % mytemp)
         mytemp.check()
         assert not mytemp.join("hello").check()
 
 
 def test_basetemp(testdir):
     mytemp = testdir.tmpdir.mkdir("mytemp")
-    p = testdir.makepyfile("""
+    p = testdir.makepyfile(
+        """
         import pytest
         def test_1():
             pytest.ensuretemp("hello")
-    """)
-    result = testdir.runpytest(p, '--basetemp=%s' % mytemp)
+    """
+    )
+    result = testdir.runpytest(p, "--basetemp=%s" % mytemp)
     assert result.ret == 0
-    assert mytemp.join('hello').check()
+    assert mytemp.join("hello").check()
 
 
-@pytest.mark.skipif(not hasattr(py.path.local, 'mksymlinkto'),
-                    reason="symlink not available on this platform")
+@pytest.mark.skipif(
+    not hasattr(py.path.local, "mksymlinkto"),
+    reason="symlink not available on this platform",
+)
 def test_tmpdir_always_is_realpath(testdir):
     # the reason why tmpdir should be a realpath is that
     # when you cd to it and do "os.getcwd()" you will anyway
     # get the realpath.  Using the symlinked path can thus
     # easily result in path-inequality
     # XXX if that proves to be a problem, consider using
     # os.environ["PWD"]
     realtemp = testdir.tmpdir.mkdir("myrealtemp")
     linktemp = testdir.tmpdir.join("symlinktemp")
     linktemp.mksymlinkto(realtemp)
-    p = testdir.makepyfile("""
+    p = testdir.makepyfile(
+        """
         def test_1(tmpdir):
             import os
             assert os.path.realpath(str(tmpdir)) == str(tmpdir)
-    """)
-    result = testdir.runpytest("-s", p, '--basetemp=%s/bt' % linktemp)
+    """
+    )
+    result = testdir.runpytest("-s", p, "--basetemp=%s/bt" % linktemp)
     assert not result.ret
 
 
 def test_tmpdir_too_long_on_parametrization(testdir):
-    testdir.makepyfile("""
+    testdir.makepyfile(
+        """
         import pytest
         @pytest.mark.parametrize("arg", ["1"*1000])
         def test_some(arg, tmpdir):
             tmpdir.ensure("hello")
-    """)
+    """
+    )
     reprec = testdir.inline_run()
     reprec.assertoutcome(passed=1)
 
 
 def test_tmpdir_factory(testdir):
-    testdir.makepyfile("""
+    testdir.makepyfile(
+        """
         import pytest
         @pytest.fixture(scope='session')
         def session_dir(tmpdir_factory):
             return tmpdir_factory.mktemp('data', numbered=False)
         def test_some(session_dir):
             session_dir.isdir()
-    """)
+    """
+    )
     reprec = testdir.inline_run()
     reprec.assertoutcome(passed=1)
 
 
 def test_tmpdir_fallback_tox_env(testdir, monkeypatch):
     """Test that tmpdir works even if environment variables required by getpass
     module are missing (#1010).
     """
-    monkeypatch.delenv('USER', raising=False)
-    monkeypatch.delenv('USERNAME', raising=False)
-    testdir.makepyfile("""
+    monkeypatch.delenv("USER", raising=False)
+    monkeypatch.delenv("USERNAME", raising=False)
+    testdir.makepyfile(
+        """
         import pytest
         def test_some(tmpdir):
             assert tmpdir.isdir()
-    """)
+    """
+    )
     reprec = testdir.inline_run()
     reprec.assertoutcome(passed=1)
 
 
 @pytest.fixture
 def break_getuser(monkeypatch):
-    monkeypatch.setattr('os.getuid', lambda: -1)
+    monkeypatch.setattr("os.getuid", lambda: -1)
     # taken from python 2.7/3.4
-    for envvar in ('LOGNAME', 'USER', 'LNAME', 'USERNAME'):
+    for envvar in ("LOGNAME", "USER", "LNAME", "USERNAME"):
         monkeypatch.delenv(envvar, raising=False)
 
 
 @pytest.mark.usefixtures("break_getuser")
-@pytest.mark.skipif(sys.platform.startswith('win'), reason='no os.getuid on windows')
+@pytest.mark.skipif(sys.platform.startswith("win"), reason="no os.getuid on windows")
 def test_tmpdir_fallback_uid_not_found(testdir):
     """Test that tmpdir works even if the current process's user id does not
     correspond to a valid user.
     """
 
-    testdir.makepyfile("""
+    testdir.makepyfile(
+        """
         import pytest
         def test_some(tmpdir):
             assert tmpdir.isdir()
-    """)
+    """
+    )
     reprec = testdir.inline_run()
     reprec.assertoutcome(passed=1)
 
 
 @pytest.mark.usefixtures("break_getuser")
-@pytest.mark.skipif(sys.platform.startswith('win'), reason='no os.getuid on windows')
+@pytest.mark.skipif(sys.platform.startswith("win"), reason="no os.getuid on windows")
 def test_get_user_uid_not_found():
     """Test that get_user() function works even if the current process's
     user id does not correspond to a valid user (e.g. running pytest in a
     Docker container with 'docker run -u'.
     """
     from _pytest.tmpdir import get_user
+
     assert get_user() is None
 
 
-@pytest.mark.skipif(not sys.platform.startswith('win'), reason='win only')
+@pytest.mark.skipif(not sys.platform.startswith("win"), reason="win only")
 def test_get_user(monkeypatch):
     """Test that get_user() function works even if environment variables
     required by getpass module are missing from the environment on Windows
     (#1010).
     """
     from _pytest.tmpdir import get_user
-    monkeypatch.delenv('USER', raising=False)
-    monkeypatch.delenv('USERNAME', raising=False)
+
+    monkeypatch.delenv("USER", raising=False)
+    monkeypatch.delenv("USERNAME", raising=False)
     assert get_user() is None
--- a/third_party/python/pytest/testing/test_unittest.py
+++ b/third_party/python/pytest/testing/test_unittest.py
@@ -1,307 +1,336 @@
 from __future__ import absolute_import, division, print_function
 from _pytest.main import EXIT_NOTESTSCOLLECTED
 import pytest
 import gc
 
 
 def test_simple_unittest(testdir):
-    testpath = testdir.makepyfile("""
+    testpath = testdir.makepyfile(
+        """
         import unittest
         class MyTestCase(unittest.TestCase):
             def testpassing(self):
                 self.assertEqual('foo', 'foo')
             def test_failing(self):
                 self.assertEqual('foo', 'bar')
-    """)
+    """
+    )
     reprec = testdir.inline_run(testpath)
     assert reprec.matchreport("testpassing").passed
     assert reprec.matchreport("test_failing").failed
 
 
 def test_runTest_method(testdir):
-    testdir.makepyfile("""
+    testdir.makepyfile(
+        """
         import unittest
         class MyTestCaseWithRunTest(unittest.TestCase):
             def runTest(self):
                 self.assertEqual('foo', 'foo')
         class MyTestCaseWithoutRunTest(unittest.TestCase):
             def runTest(self):
                 self.assertEqual('foo', 'foo')
             def test_something(self):
                 pass
-        """)
+        """
+    )
     result = testdir.runpytest("-v")
-    result.stdout.fnmatch_lines("""
+    result.stdout.fnmatch_lines(
+        """
         *MyTestCaseWithRunTest::runTest*
         *MyTestCaseWithoutRunTest::test_something*
         *2 passed*
-    """)
+    """
+    )
 
 
 def test_isclasscheck_issue53(testdir):
-    testpath = testdir.makepyfile("""
+    testpath = testdir.makepyfile(
+        """
         import unittest
         class _E(object):
             def __getattr__(self, tag):
                 pass
         E = _E()
-    """)
+    """
+    )
     result = testdir.runpytest(testpath)
     assert result.ret == EXIT_NOTESTSCOLLECTED
 
 
 def test_setup(testdir):
-    testpath = testdir.makepyfile("""
+    testpath = testdir.makepyfile(
+        """
         import unittest
         class MyTestCase(unittest.TestCase):
             def setUp(self):
                 self.foo = 1
             def setup_method(self, method):
                 self.foo2 = 1
             def test_both(self):
                 self.assertEqual(1, self.foo)
                 assert self.foo2 == 1
             def teardown_method(self, method):
                 assert 0, "42"
 
-    """)
+    """
+    )
     reprec = testdir.inline_run("-s", testpath)
     assert reprec.matchreport("test_both", when="call").passed
     rep = reprec.matchreport("test_both", when="teardown")
-    assert rep.failed and '42' in str(rep.longrepr)
+    assert rep.failed and "42" in str(rep.longrepr)
 
 
 def test_setUpModule(testdir):
-    testpath = testdir.makepyfile("""
+    testpath = testdir.makepyfile(
+        """
         values = []
 
         def setUpModule():
             values.append(1)
 
         def tearDownModule():
             del values[0]
 
         def test_hello():
             assert values == [1]
 
         def test_world():
             assert values == [1]
-        """)
+        """
+    )
     result = testdir.runpytest(testpath)
-    result.stdout.fnmatch_lines([
-        "*2 passed*",
-    ])
+    result.stdout.fnmatch_lines(["*2 passed*"])
 
 
 def test_setUpModule_failing_no_teardown(testdir):
-    testpath = testdir.makepyfile("""
+    testpath = testdir.makepyfile(
+        """
         values = []
 
         def setUpModule():
             0/0
 
         def tearDownModule():
             values.append(1)
 
         def test_hello():
             pass
-    """)
+    """
+    )
     reprec = testdir.inline_run(testpath)
     reprec.assertoutcome(passed=0, failed=1)
     call = reprec.getcalls("pytest_runtest_setup")[0]
     assert not call.item.module.values
 
 
 def test_new_instances(testdir):
-    testpath = testdir.makepyfile("""
+    testpath = testdir.makepyfile(
+        """
         import unittest
         class MyTestCase(unittest.TestCase):
             def test_func1(self):
                 self.x = 2
             def test_func2(self):
                 assert not hasattr(self, 'x')
-    """)
+    """
+    )
     reprec = testdir.inline_run(testpath)
     reprec.assertoutcome(passed=2)
 
 
 def test_teardown(testdir):
-    testpath = testdir.makepyfile("""
+    testpath = testdir.makepyfile(
+        """
         import unittest
         class MyTestCase(unittest.TestCase):
             values = []
             def test_one(self):
                 pass
             def tearDown(self):
                 self.values.append(None)
         class Second(unittest.TestCase):
             def test_check(self):
                 self.assertEqual(MyTestCase.values, [None])
-    """)
+    """
+    )
     reprec = testdir.inline_run(testpath)
     passed, skipped, failed = reprec.countoutcomes()
     assert failed == 0, failed
     assert passed == 2
     assert passed + skipped + failed == 2
 
 
 def test_teardown_issue1649(testdir):
     """
     Are TestCase objects cleaned up? Often unittest TestCase objects set
     attributes that are large and expensive during setUp.
 
     The TestCase will not be cleaned up if the test fails, because it
     would then exist in the stackframe.
     """
-    testpath = testdir.makepyfile("""
+    testpath = testdir.makepyfile(
+        """
         import unittest
         class TestCaseObjectsShouldBeCleanedUp(unittest.TestCase):
             def setUp(self):
                 self.an_expensive_object = 1
             def test_demo(self):
                 pass
 
-    """)
+    """
+    )
     testdir.inline_run("-s", testpath)
     gc.collect()
     for obj in gc.get_objects():
-        assert type(obj).__name__ != 'TestCaseObjectsShouldBeCleanedUp'
+        assert type(obj).__name__ != "TestCaseObjectsShouldBeCleanedUp"
 
 
-@pytest.mark.skipif("sys.version_info < (2,7)")
 def test_unittest_skip_issue148(testdir):
-    testpath = testdir.makepyfile("""
+    testpath = testdir.makepyfile(
+        """
         import unittest
 
         @unittest.skip("hello")
         class MyTestCase(unittest.TestCase):
             @classmethod
             def setUpClass(self):
                 xxx
             def test_one(self):
                 pass
             @classmethod
             def tearDownClass(self):
                 xxx
-    """)
+    """
+    )
     reprec = testdir.inline_run(testpath)
     reprec.assertoutcome(skipped=1)
 
 
 def test_method_and_teardown_failing_reporting(testdir):
-    testdir.makepyfile("""
+    testdir.makepyfile(
+        """
         import unittest, pytest
         class TC(unittest.TestCase):
             def tearDown(self):
                 assert 0, "down1"
             def test_method(self):
                 assert False, "down2"
-    """)
+    """
+    )
     result = testdir.runpytest("-s")
     assert result.ret == 1
-    result.stdout.fnmatch_lines([
-        "*tearDown*",
-        "*assert 0*",
-        "*test_method*",
-        "*assert False*",
-        "*1 failed*1 error*",
-    ])
+    result.stdout.fnmatch_lines(
+        [
+            "*tearDown*",
+            "*assert 0*",
+            "*test_method*",
+            "*assert False*",
+            "*1 failed*1 error*",
+        ]
+    )
 
 
 def test_setup_failure_is_shown(testdir):
-    testdir.makepyfile("""
+    testdir.makepyfile(
+        """
         import unittest
         import pytest
         class TC(unittest.TestCase):
             def setUp(self):
                 assert 0, "down1"
             def test_method(self):
                 print ("never42")
                 xyz
-    """)
+    """
+    )
     result = testdir.runpytest("-s")
     assert result.ret == 1
-    result.stdout.fnmatch_lines([
-        "*setUp*",
-        "*assert 0*down1*",
-        "*1 failed*",
-    ])
-    assert 'never42' not in result.stdout.str()
+    result.stdout.fnmatch_lines(["*setUp*", "*assert 0*down1*", "*1 failed*"])
+    assert "never42" not in result.stdout.str()
 
 
 def test_setup_setUpClass(testdir):
-    testpath = testdir.makepyfile("""
+    testpath = testdir.makepyfile(
+        """
         import unittest
         import pytest
         class MyTestCase(unittest.TestCase):
             x = 0
             @classmethod
             def setUpClass(cls):
                 cls.x += 1
             def test_func1(self):
                 assert self.x == 1
             def test_func2(self):
                 assert self.x == 1
             @classmethod
             def tearDownClass(cls):
                 cls.x -= 1
         def test_teareddown():
             assert MyTestCase.x == 0
-    """)
+    """
+    )
     reprec = testdir.inline_run(testpath)
     reprec.assertoutcome(passed=3)
 
 
 def test_setup_class(testdir):
-    testpath = testdir.makepyfile("""
+    testpath = testdir.makepyfile(
+        """
         import unittest
         import pytest
         class MyTestCase(unittest.TestCase):
             x = 0
             def setup_class(cls):
                 cls.x += 1
             def test_func1(self):
                 assert self.x == 1
             def test_func2(self):
                 assert self.x == 1
             def teardown_class(cls):
                 cls.x -= 1
         def test_teareddown():
             assert MyTestCase.x == 0
-    """)
+    """
+    )
     reprec = testdir.inline_run(testpath)
     reprec.assertoutcome(passed=3)
 
 
-@pytest.mark.parametrize("type", ['Error', 'Failure'])
+@pytest.mark.parametrize("type", ["Error", "Failure"])
 def test_testcase_adderrorandfailure_defers(testdir, type):
-    testdir.makepyfile("""
+    testdir.makepyfile(
+        """
         from unittest import TestCase
         import pytest
         class MyTestCase(TestCase):
             def run(self, result):
                 excinfo = pytest.raises(ZeroDivisionError, lambda: 0/0)
                 try:
                     result.add%s(self, excinfo._excinfo)
                 except KeyboardInterrupt:
                     raise
                 except:
                     pytest.fail("add%s should not raise")
             def test_hello(self):
                 pass
-    """ % (type, type))
+    """
+        % (type, type)
+    )
     result = testdir.runpytest()
-    assert 'should not raise' not in result.stdout.str()
+    assert "should not raise" not in result.stdout.str()
 
 
-@pytest.mark.parametrize("type", ['Error', 'Failure'])
+@pytest.mark.parametrize("type", ["Error", "Failure"])
 def test_testcase_custom_exception_info(testdir, type):
-    testdir.makepyfile("""
+    testdir.makepyfile(
+        """
         from unittest import TestCase
         import py, pytest
         import _pytest._code
         class MyTestCase(TestCase):
             def run(self, result):
                 excinfo = pytest.raises(ZeroDivisionError, lambda: 0/0)
                 # we fake an incompatible exception info
                 from _pytest.monkeypatch import MonkeyPatch
@@ -312,79 +341,93 @@ def test_testcase_custom_exception_info(
                 mp.setattr(_pytest._code, 'ExceptionInfo', t)
                 try:
                     excinfo = excinfo._excinfo
                     result.add%(type)s(self, excinfo)
                 finally:
                     mp.undo()
             def test_hello(self):
                 pass
-    """ % locals())
+    """
+        % locals()
+    )
     result = testdir.runpytest()
-    result.stdout.fnmatch_lines([
-        "NOTE: Incompatible Exception Representation*",
-        "*ZeroDivisionError*",
-        "*1 failed*",
-    ])
+    result.stdout.fnmatch_lines(
+        [
+            "NOTE: Incompatible Exception Representation*",
+            "*ZeroDivisionError*",
+            "*1 failed*",
+        ]
+    )
 
 
 def test_testcase_totally_incompatible_exception_info(testdir):
-    item, = testdir.getitems("""
+    item, = testdir.getitems(
+        """
         from unittest import TestCase
         class MyTestCase(TestCase):
             def test_hello(self):
                 pass
-    """)
+    """
+    )
     item.addError(None, 42)
     excinfo = item._excinfo.pop(0)
-    assert 'ERROR: Unknown Incompatible' in str(excinfo.getrepr())
+    assert "ERROR: Unknown Incompatible" in str(excinfo.getrepr())
 
 
 def test_module_level_pytestmark(testdir):
-    testpath = testdir.makepyfile("""
+    testpath = testdir.makepyfile(
+        """
         import unittest
         import pytest
         pytestmark = pytest.mark.xfail
         class MyTestCase(unittest.TestCase):
             def test_func1(self):
                 assert 0
-    """)
+    """
+    )
     reprec = testdir.inline_run(testpath, "-s")
     reprec.assertoutcome(skipped=1)
 
 
 class TestTrialUnittest(object):
+
     def setup_class(cls):
         cls.ut = pytest.importorskip("twisted.trial.unittest")
         # on windows trial uses a socket for a reactor and apparently doesn't close it properly
         # https://twistedmatrix.com/trac/ticket/9227
-        cls.ignore_unclosed_socket_warning = ('-W', 'always')
+        cls.ignore_unclosed_socket_warning = ("-W", "always")
 
     def test_trial_testcase_runtest_not_collected(self, testdir):
-        testdir.makepyfile("""
+        testdir.makepyfile(
+            """
             from twisted.trial.unittest import TestCase
 
             class TC(TestCase):
                 def test_hello(self):
                     pass
-        """)
+        """
+        )
         reprec = testdir.inline_run(*self.ignore_unclosed_socket_warning)
         reprec.assertoutcome(passed=1)
-        testdir.makepyfile("""
+        testdir.makepyfile(
+            """
             from twisted.trial.unittest import TestCase
 
             class TC(TestCase):
                 def runTest(self):
                     pass
-        """)
+        """
+        )
         reprec = testdir.inline_run(*self.ignore_unclosed_socket_warning)
         reprec.assertoutcome(passed=1)
 
     def test_trial_exceptions_with_skips(self, testdir):
-        testdir.makepyfile("""
+        testdir.makepyfile(
+            """
             from twisted.trial import unittest
             import pytest
             class TC(unittest.TestCase):
                 def test_hello(self):
                     pytest.skip("skip_in_method")
                 @pytest.mark.skipif("sys.version_info != 1")
                 def test_hello2(self):
                     pass
@@ -405,34 +448,41 @@ class TestTrialUnittest(object):
                     pass
                 test_trial_todo_success.todo = "mytodo"
 
             class TC2(unittest.TestCase):
                 def setup_class(cls):
                     pytest.skip("skip_in_setup_class")
                 def test_method(self):
                     pass
-        """)
+        """
+        )
         from _pytest.compat import _is_unittest_unexpected_success_a_failure
+
         should_fail = _is_unittest_unexpected_success_a_failure()
         result = testdir.runpytest("-rxs", *self.ignore_unclosed_socket_warning)
-        result.stdout.fnmatch_lines_random([
-            "*XFAIL*test_trial_todo*",
-            "*trialselfskip*",
-            "*skip_in_setup_class*",
-            "*iwanto*",
-            "*i2wanto*",
-            "*sys.version_info*",
-            "*skip_in_method*",
-            "*1 failed*4 skipped*3 xfailed*" if should_fail else "*4 skipped*3 xfail*1 xpass*",
-        ])
+        result.stdout.fnmatch_lines_random(
+            [
+                "*XFAIL*test_trial_todo*",
+                "*trialselfskip*",
+                "*skip_in_setup_class*",
+                "*iwanto*",
+                "*i2wanto*",
+                "*sys.version_info*",
+                "*skip_in_method*",
+                "*1 failed*4 skipped*3 xfailed*"
+                if should_fail
+                else "*4 skipped*3 xfail*1 xpass*",
+            ]
+        )
         assert result.ret == (1 if should_fail else 0)
 
     def test_trial_error(self, testdir):
-        testdir.makepyfile("""
+        testdir.makepyfile(
+            """
             from twisted.trial.unittest import TestCase
             from twisted.internet.defer import Deferred
             from twisted.internet import reactor
 
             class TC(TestCase):
                 def test_one(self):
                     crash
 
@@ -456,91 +506,107 @@ class TestTrialUnittest(object):
                         reactor.callLater(0.3, f)
                         crash
 
                     d = Deferred()
                     d.addCallback(f)
                     reactor.callLater(0.3, d.callback, None)
                     return d
                 # will crash both at test time and at teardown
-        """)
+        """
+        )
         result = testdir.runpytest()
-        result.stdout.fnmatch_lines([
-            "*ERRORS*",
-            "*DelayedCalls*",
-            "*test_four*",
-            "*NameError*crash*",
-            "*test_one*",
-            "*NameError*crash*",
-            "*test_three*",
-            "*DelayedCalls*",
-            "*test_two*",
-            "*crash*",
-        ])
+        result.stdout.fnmatch_lines(
+            [
+                "*ERRORS*",
+                "*DelayedCalls*",
+                "*test_four*",
+                "*NameError*crash*",
+                "*test_one*",
+                "*NameError*crash*",
+                "*test_three*",
+                "*DelayedCalls*",
+                "*test_two*",
+                "*crash*",
+            ]
+        )
 
     def test_trial_pdb(self, testdir):
-        p = testdir.makepyfile("""
+        p = testdir.makepyfile(
+            """
             from twisted.trial import unittest
             import pytest
             class TC(unittest.TestCase):
                 def test_hello(self):
                     assert 0, "hellopdb"
-        """)
+        """
+        )
         child = testdir.spawn_pytest(p)
         child.expect("hellopdb")
         child.sendeof()
 
     def test_trial_testcase_skip_property(self, testdir):
-        testpath = testdir.makepyfile("""
+        testpath = testdir.makepyfile(
+            """
             from twisted.trial import unittest
             class MyTestCase(unittest.TestCase):
                 skip = 'dont run'
                 def test_func(self):
                     pass
-            """)
+            """
+        )
         reprec = testdir.inline_run(testpath, "-s")
         reprec.assertoutcome(skipped=1)
 
     def test_trial_testfunction_skip_property(self, testdir):
-        testpath = testdir.makepyfile("""
+        testpath = testdir.makepyfile(
+            """
             from twisted.trial import unittest
             class MyTestCase(unittest.TestCase):
                 def test_func(self):
                     pass
                 test_func.skip = 'dont run'
-            """)
+            """
+        )
         reprec = testdir.inline_run(testpath, "-s")
         reprec.assertoutcome(skipped=1)
 
     def test_trial_testcase_todo_property(self, testdir):
-        testpath = testdir.makepyfile("""
+        testpath = testdir.makepyfile(
+            """
             from twisted.trial import unittest
             class MyTestCase(unittest.TestCase):
                 todo = 'dont run'
                 def test_func(self):
                     assert 0
-            """)
+            """
+        )
         reprec = testdir.inline_run(testpath, "-s")
         reprec.assertoutcome(skipped=1)
 
     def test_trial_testfunction_todo_property(self, testdir):
-        testpath = testdir.makepyfile("""
+        testpath = testdir.makepyfile(
+            """
             from twisted.trial import unittest
             class MyTestCase(unittest.TestCase):
                 def test_func(self):
                     assert 0
                 test_func.todo = 'dont run'
-            """)
-        reprec = testdir.inline_run(testpath, "-s", *self.ignore_unclosed_socket_warning)
+            """
+        )
+        reprec = testdir.inline_run(
+            testpath, "-s", *self.ignore_unclosed_socket_warning
+        )
         reprec.assertoutcome(skipped=1)
 
 
 def test_djangolike_testcase(testdir):
     # contributed from Morten Breekevold
-    testdir.makepyfile("""
+    testdir.makepyfile(
+        """
         from unittest import TestCase, main
 
         class DjangoLikeTestCase(TestCase):
 
             def setUp(self):
                 print ("setUp()")
 
             def test_presetup_has_been_run(self):
@@ -570,133 +636,140 @@ def test_djangolike_testcase(testdir):
                     return
 
             def _pre_setup(self):
                 print ("_pre_setup()")
                 self.was_presetup = True
 
             def _post_teardown(self):
                 print ("_post_teardown()")
-    """)
+    """
+    )
     result = testdir.runpytest("-s")
     assert result.ret == 0
-    result.stdout.fnmatch_lines([
-        "*_pre_setup()*",
-        "*setUp()*",
-        "*test_thing()*",
-        "*tearDown()*",
-        "*_post_teardown()*",
-    ])
+    result.stdout.fnmatch_lines(
+        [
+            "*_pre_setup()*",
+            "*setUp()*",
+            "*test_thing()*",
+            "*tearDown()*",
+            "*_post_teardown()*",
+        ]
+    )
 
 
 def test_unittest_not_shown_in_traceback(testdir):
-    testdir.makepyfile("""
+    testdir.makepyfile(
+        """
         import unittest
         class t(unittest.TestCase):
             def test_hello(self):
                 x = 3
                 self.assertEqual(x, 4)
-    """)
+    """
+    )
     res = testdir.runpytest()
     assert "failUnlessEqual" not in res.stdout.str()
 
 
 def test_unorderable_types(testdir):
-    testdir.makepyfile("""
+    testdir.makepyfile(
+        """
         import unittest
         class TestJoinEmpty(unittest.TestCase):
             pass
 
         def make_test():
             class Test(unittest.TestCase):
                 pass
             Test.__name__ = "TestFoo"
             return Test
         TestFoo = make_test()
-    """)
+    """
+    )
     result = testdir.runpytest()
     assert "TypeError" not in result.stdout.str()
     assert result.ret == EXIT_NOTESTSCOLLECTED
 
 
 def test_unittest_typerror_traceback(testdir):
-    testdir.makepyfile("""
+    testdir.makepyfile(
+        """
         import unittest
         class TestJoinEmpty(unittest.TestCase):
             def test_hello(self, arg1):
                 pass
-    """)
+    """
+    )
     result = testdir.runpytest()
     assert "TypeError" in result.stdout.str()
     assert result.ret == 1
 
 
-@pytest.mark.skipif("sys.version_info < (2,7)")
-@pytest.mark.parametrize('runner', ['pytest', 'unittest'])
+@pytest.mark.parametrize("runner", ["pytest", "unittest"])
 def test_unittest_expected_failure_for_failing_test_is_xfail(testdir, runner):
-    script = testdir.makepyfile("""
+    script = testdir.makepyfile(
+        """
         import unittest
         class MyTestCase(unittest.TestCase):
             @unittest.expectedFailure
             def test_failing_test_is_xfail(self):
                 assert False
         if __name__ == '__main__':
             unittest.main()
-    """)
-    if runner == 'pytest':
+    """
+    )
+    if runner == "pytest":
         result = testdir.runpytest("-rxX")
-        result.stdout.fnmatch_lines([
-            "*XFAIL*MyTestCase*test_failing_test_is_xfail*",
-            "*1 xfailed*",
-        ])
+        result.stdout.fnmatch_lines(
+            ["*XFAIL*MyTestCase*test_failing_test_is_xfail*", "*1 xfailed*"]
+        )
     else:
         result = testdir.runpython(script)
-        result.stderr.fnmatch_lines([
-            "*1 test in*",
-            "*OK*(expected failures=1)*",
-        ])
+        result.stderr.fnmatch_lines(["*1 test in*", "*OK*(expected failures=1)*"])
     assert result.ret == 0
 
 
-@pytest.mark.skipif("sys.version_info < (2,7)")
-@pytest.mark.parametrize('runner', ['pytest', 'unittest'])
+@pytest.mark.parametrize("runner", ["pytest", "unittest"])
 def test_unittest_expected_failure_for_passing_test_is_fail(testdir, runner):
-    script = testdir.makepyfile("""
+    script = testdir.makepyfile(
+        """
         import unittest
         class MyTestCase(unittest.TestCase):
             @unittest.expectedFailure
             def test_passing_test_is_fail(self):
                 assert True
         if __name__ == '__main__':
             unittest.main()
-    """)
+    """
+    )
     from _pytest.compat import _is_unittest_unexpected_success_a_failure
+
     should_fail = _is_unittest_unexpected_success_a_failure()
-    if runner == 'pytest':
+    if runner == "pytest":
         result = testdir.runpytest("-rxX")
-        result.stdout.fnmatch_lines([
-            "*MyTestCase*test_passing_test_is_fail*",
-            "*1 failed*" if should_fail else "*1 xpassed*",
-        ])
+        result.stdout.fnmatch_lines(
+            [
+                "*MyTestCase*test_passing_test_is_fail*",
+                "*1 failed*" if should_fail else "*1 xpassed*",
+            ]
+        )
     else:
         result = testdir.runpython(script)
-        result.stderr.fnmatch_lines([
-            "*1 test in*",
-            "*(unexpected successes=1)*",
-        ])
+        result.stderr.fnmatch_lines(["*1 test in*", "*(unexpected successes=1)*"])
 
     assert result.ret == (1 if should_fail else 0)
 
 
-@pytest.mark.parametrize('fix_type, stmt', [
-    ('fixture', 'return'),
-    ('yield_fixture', 'yield'),
-])
+@pytest.mark.parametrize(
+    "fix_type, stmt", [("fixture", "return"), ("yield_fixture", "yield")]
+)
 def test_unittest_setup_interaction(testdir, fix_type, stmt):
-    testdir.makepyfile("""
+    testdir.makepyfile(
+        """
         import unittest
         import pytest
         class MyTestCase(unittest.TestCase):
             @pytest.{fix_type}(scope="class", autouse=True)
             def perclass(self, request):
                 request.cls.hello = "world"
                 {stmt}
             @pytest.{fix_type}(scope="function", autouse=True)
@@ -708,23 +781,27 @@ def test_unittest_setup_interaction(test
                 assert self.funcname == "test_method1"
                 assert self.hello == "world"
 
             def test_method2(self):
                 assert self.funcname == "test_method2"
 
             def test_classattr(self):
                 assert self.__class__.hello == "world"
-    """.format(fix_type=fix_type, stmt=stmt))
+    """.format(
+            fix_type=fix_type, stmt=stmt
+        )
+    )
     result = testdir.runpytest()
     result.stdout.fnmatch_lines("*3 passed*")
 
 
 def test_non_unittest_no_setupclass_support(testdir):
-    testpath = testdir.makepyfile("""
+    testpath = testdir.makepyfile(
+        """
         class TestFoo(object):
             x = 0
 
             @classmethod
             def setUpClass(cls):
                 cls.x = 1
 
             def test_method1(self):
@@ -732,23 +809,25 @@ def test_non_unittest_no_setupclass_supp
 
             @classmethod
             def tearDownClass(cls):
                 cls.x = 1
 
         def test_not_teareddown():
             assert TestFoo.x == 0
 
-    """)
+    """
+    )
     reprec = testdir.inline_run(testpath)
     reprec.assertoutcome(passed=2)
 
 
 def test_no_teardown_if_setupclass_failed(testdir):
-    testpath = testdir.makepyfile("""
+    testpath = testdir.makepyfile(
+        """
         import unittest
 
         class MyTestCase(unittest.TestCase):
             x = 0
 
             @classmethod
             def setUpClass(cls):
                 cls.x = 1
@@ -758,76 +837,156 @@ def test_no_teardown_if_setupclass_faile
                 cls.x = 10
 
             @classmethod
             def tearDownClass(cls):
                 cls.x = 100
 
         def test_notTornDown():
             assert MyTestCase.x == 1
-    """)
+    """
+    )
     reprec = testdir.inline_run(testpath)
     reprec.assertoutcome(passed=1, failed=1)
 
 
 def test_issue333_result_clearing(testdir):
-    testdir.makeconftest("""
-        def pytest_runtest_call(__multicall__, item):
-            __multicall__.execute()
+    testdir.makeconftest(
+        """
+        import pytest
+        @pytest.hookimpl(hookwrapper=True)
+        def pytest_runtest_call(item):
+            yield
             assert 0
-    """)
-    testdir.makepyfile("""
+    """
+    )
+    testdir.makepyfile(
+        """
         import unittest
         class TestIt(unittest.TestCase):
             def test_func(self):
                 0/0
-    """)
+    """
+    )
 
     reprec = testdir.inline_run()
     reprec.assertoutcome(failed=1)
 
 
-@pytest.mark.skipif("sys.version_info < (2,7)")
 def test_unittest_raise_skip_issue748(testdir):
-    testdir.makepyfile(test_foo="""
+    testdir.makepyfile(
+        test_foo="""
         import unittest
 
         class MyTestCase(unittest.TestCase):
             def test_one(self):
                 raise unittest.SkipTest('skipping due to reasons')
-    """)
-    result = testdir.runpytest("-v", '-rs')
-    result.stdout.fnmatch_lines("""
+    """
+    )
+    result = testdir.runpytest("-v", "-rs")
+    result.stdout.fnmatch_lines(
+        """
         *SKIP*[1]*test_foo.py*skipping due to reasons*
         *1 skipped*
-    """)
+    """
+    )
 
 
-@pytest.mark.skipif("sys.version_info < (2,7)")
 def test_unittest_skip_issue1169(testdir):
-    testdir.makepyfile(test_foo="""
+    testdir.makepyfile(
+        test_foo="""
         import unittest
 
         class MyTestCase(unittest.TestCase):
             @unittest.skip("skipping due to reasons")
             def test_skip(self):
                  self.fail()
-        """)
-    result = testdir.runpytest("-v", '-rs')
-    result.stdout.fnmatch_lines("""
+        """
+    )
+    result = testdir.runpytest("-v", "-rs")
+    result.stdout.fnmatch_lines(
+        """
         *SKIP*[1]*skipping due to reasons*
         *1 skipped*
-    """)
+    """
+    )
 
 
 def test_class_method_containing_test_issue1558(testdir):
-    testdir.makepyfile(test_foo="""
+    testdir.makepyfile(
+        test_foo="""
         import unittest
 
         class MyTestCase(unittest.TestCase):
             def test_should_run(self):
                 pass
             def test_should_not_run(self):
                 pass
             test_should_not_run.__test__ = False
-    """)
+    """
+    )
     reprec = testdir.inline_run()
     reprec.assertoutcome(passed=1)
+
+
+@pytest.mark.issue(3498)
+@pytest.mark.parametrize(
+    "base", ["six.moves.builtins.object", "unittest.TestCase", "unittest2.TestCase"]
+)
+def test_usefixtures_marker_on_unittest(base, testdir):
+    module = base.rsplit(".", 1)[0]
+    pytest.importorskip(module)
+    testdir.makepyfile(
+        conftest="""
+        import pytest
+
+        @pytest.fixture(scope='function')
+        def fixture1(request, monkeypatch):
+            monkeypatch.setattr(request.instance, 'fixture1', True )
+
+
+        @pytest.fixture(scope='function')
+        def fixture2(request, monkeypatch):
+            monkeypatch.setattr(request.instance, 'fixture2', True )
+
+        def node_and_marks(item):
+            print(item.nodeid)
+            for mark in item.iter_markers():
+                print("  ", mark)
+
+        @pytest.fixture(autouse=True)
+        def my_marks(request):
+            node_and_marks(request.node)
+
+        def pytest_collection_modifyitems(items):
+            for item in items:
+               node_and_marks(item)
+
+        """
+    )
+
+    testdir.makepyfile(
+        """
+        import pytest
+        import {module}
+
+        class Tests({base}):
+            fixture1 = False
+            fixture2 = False
+
+            @pytest.mark.usefixtures("fixture1")
+            def test_one(self):
+                assert self.fixture1
+                assert not self.fixture2
+
+            @pytest.mark.usefixtures("fixture1", "fixture2")
+            def test_two(self):
+                assert self.fixture1
+                assert self.fixture2
+
+
+    """.format(
+            module=module, base=base
+        )
+    )
+
+    result = testdir.runpytest("-s")
+    result.assert_outcomes(passed=2)
--- a/third_party/python/pytest/testing/test_warnings.py
+++ b/third_party/python/pytest/testing/test_warnings.py
@@ -1,225 +1,290 @@
 # -*- coding: utf8 -*-
 from __future__ import unicode_literals
 
 import sys
 
 import pytest
 
 
-WARNINGS_SUMMARY_HEADER = 'warnings summary'
+WARNINGS_SUMMARY_HEADER = "warnings summary"
 
 
 @pytest.fixture
 def pyfile_with_warnings(testdir, request):
     """
     Create a test file which calls a function in a module which generates warnings.
     """
     testdir.syspathinsert()
     test_name = request.function.__name__
-    module_name = test_name.lstrip('test_') + '_module'
-    testdir.makepyfile(**{
-        module_name: '''
+    module_name = test_name.lstrip("test_") + "_module"
+    testdir.makepyfile(
+        **{
+            module_name: """
             import warnings
             def foo():
                 warnings.warn(UserWarning("user warning"))
                 warnings.warn(RuntimeWarning("runtime warning"))
                 return 1
-        ''',
-        test_name: '''
+        """,
+            test_name: """
             import {module_name}
             def test_func():
                 assert {module_name}.foo() == 1
-        '''.format(module_name=module_name)
-    })
+        """.format(
+                module_name=module_name
+            ),
+        }
+    )
 
 
-@pytest.mark.filterwarnings('always')
+@pytest.mark.filterwarnings("always")
 def test_normal_flow(testdir, pyfile_with_warnings):
     """
     Check that the warnings section is displayed, containing test node ids followed by
     all warnings generated by that test node.
     """
     result = testdir.runpytest()
-    result.stdout.fnmatch_lines([
-        '*== %s ==*' % WARNINGS_SUMMARY_HEADER,
-
-        '*test_normal_flow.py::test_func',
-
-        '*normal_flow_module.py:3: UserWarning: user warning',
-        '*  warnings.warn(UserWarning("user warning"))',
-
-        '*normal_flow_module.py:4: RuntimeWarning: runtime warning',
-        '*  warnings.warn(RuntimeWarning("runtime warning"))',
-        '* 1 passed, 2 warnings*',
-    ])
-    assert result.stdout.str().count('test_normal_flow.py::test_func') == 1
+    result.stdout.fnmatch_lines(
+        [
+            "*== %s ==*" % WARNINGS_SUMMARY_HEADER,
+            "*test_normal_flow.py::test_func",
+            "*normal_flow_module.py:3: UserWarning: user warning",
+            '*  warnings.warn(UserWarning("user warning"))',
+            "*normal_flow_module.py:4: RuntimeWarning: runtime warning",
+            '*  warnings.warn(RuntimeWarning("runtime warning"))',
+            "* 1 passed, 2 warnings*",
+        ]
+    )
+    assert result.stdout.str().count("test_normal_flow.py::test_func") == 1
 
 
-@pytest.mark.filterwarnings('always')
+@pytest.mark.filterwarnings("always")
 def test_setup_teardown_warnings(testdir, pyfile_with_warnings):
-    testdir.makepyfile('''
+    testdir.makepyfile(
+        """
         import warnings
         import pytest
 
         @pytest.fixture
         def fix():
             warnings.warn(UserWarning("warning during setup"))
             yield
             warnings.warn(UserWarning("warning during teardown"))
 
         def test_func(fix):
             pass
-    ''')
+    """
+    )
     result = testdir.runpytest()
-    result.stdout.fnmatch_lines([
-        '*== %s ==*' % WARNINGS_SUMMARY_HEADER,
-
-        '*test_setup_teardown_warnings.py:6: UserWarning: warning during setup',
-        '*warnings.warn(UserWarning("warning during setup"))',
-
-        '*test_setup_teardown_warnings.py:8: UserWarning: warning during teardown',
-        '*warnings.warn(UserWarning("warning during teardown"))',
-        '* 1 passed, 2 warnings*',
-    ])
+    result.stdout.fnmatch_lines(
+        [
+            "*== %s ==*" % WARNINGS_SUMMARY_HEADER,
+            "*test_setup_teardown_warnings.py:6: UserWarning: warning during setup",
+            '*warnings.warn(UserWarning("warning during setup"))',
+            "*test_setup_teardown_warnings.py:8: UserWarning: warning during teardown",
+            '*warnings.warn(UserWarning("warning during teardown"))',
+            "* 1 passed, 2 warnings*",
+        ]
+    )
 
 
-@pytest.mark.parametrize('method', ['cmdline', 'ini'])
+@pytest.mark.parametrize("method", ["cmdline", "ini"])
 def test_as_errors(testdir, pyfile_with_warnings, method):
-    args = ('-W', 'error') if method == 'cmdline' else ()
-    if method == 'ini':
-        testdir.makeini('''
+    args = ("-W", "error") if method == "cmdline" else ()
+    if method == "ini":
+        testdir.makeini(
+            """
             [pytest]
             filterwarnings= error
-            ''')
+            """
+        )
     result = testdir.runpytest(*args)
-    result.stdout.fnmatch_lines([
-        'E       UserWarning: user warning',
-        'as_errors_module.py:3: UserWarning',
-        '* 1 failed in *',
-    ])
+    result.stdout.fnmatch_lines(
+        [
+            "E       UserWarning: user warning",
+            "as_errors_module.py:3: UserWarning",
+            "* 1 failed in *",
+        ]
+    )
 
 
-@pytest.mark.parametrize('method', ['cmdline', 'ini'])
+@pytest.mark.parametrize("method", ["cmdline", "ini"])
 def test_ignore(testdir, pyfile_with_warnings, method):
-    args = ('-W', 'ignore') if method == 'cmdline' else ()
-    if method == 'ini':
-        testdir.makeini('''
+    args = ("-W", "ignore") if method == "cmdline" else ()
+    if method == "ini":
+        testdir.makeini(
+            """
         [pytest]
         filterwarnings= ignore
-        ''')
+        """
+        )
 
     result = testdir.runpytest(*args)
-    result.stdout.fnmatch_lines([
-        '* 1 passed in *',
-    ])
+    result.stdout.fnmatch_lines(["* 1 passed in *"])
     assert WARNINGS_SUMMARY_HEADER not in result.stdout.str()
 
 
-@pytest.mark.skipif(sys.version_info < (3, 0),
-                    reason='warnings message is unicode is ok in python3')
-@pytest.mark.filterwarnings('always')
+@pytest.mark.skipif(
+    sys.version_info < (3, 0), reason="warnings message is unicode is ok in python3"
+)
+@pytest.mark.filterwarnings("always")
 def test_unicode(testdir, pyfile_with_warnings):
-    testdir.makepyfile('''
+    testdir.makepyfile(
+        """
         # -*- coding: utf8 -*-
         import warnings
         import pytest
 
 
         @pytest.fixture
         def fix():
             warnings.warn(u"测试")
             yield
 
         def test_func(fix):
             pass
-    ''')
+    """
+    )
     result = testdir.runpytest()
-    result.stdout.fnmatch_lines([
-        '*== %s ==*' % WARNINGS_SUMMARY_HEADER,
-        '*test_unicode.py:8: UserWarning: \u6d4b\u8bd5*',
-        '* 1 passed, 1 warnings*',
-    ])
+    result.stdout.fnmatch_lines(
+        [
+            "*== %s ==*" % WARNINGS_SUMMARY_HEADER,
+            "*test_unicode.py:8: UserWarning: \u6d4b\u8bd5*",
+            "* 1 passed, 1 warnings*",
+        ]
+    )
 
 
-@pytest.mark.skipif(sys.version_info >= (3, 0),
-                    reason='warnings message is broken as it is not str instance')
+@pytest.mark.skipif(
+    sys.version_info >= (3, 0),
+    reason="warnings message is broken as it is not str instance",
+)
 def test_py2_unicode(testdir, pyfile_with_warnings):
-    if getattr(sys, "pypy_version_info", ())[:2] == (5, 9) and sys.platform.startswith('win'):
+    if (
+        getattr(sys, "pypy_version_info", ())[:2] == (5, 9)
+        and sys.platform.startswith("win")
+    ):
         pytest.xfail("fails with unicode error on PyPy2 5.9 and Windows (#2905)")
-    testdir.makepyfile('''
+    testdir.makepyfile(
+        """
         # -*- coding: utf8 -*-
         import warnings
         import pytest
 
 
         @pytest.fixture
         def fix():
             warnings.warn(u"测试")
             yield
 
         @pytest.mark.filterwarnings('always')
         def test_func(fix):
             pass
-    ''')
+    """
+    )
     result = testdir.runpytest()
-    result.stdout.fnmatch_lines([
-        '*== %s ==*' % WARNINGS_SUMMARY_HEADER,
+    result.stdout.fnmatch_lines(
+        [
+            "*== %s ==*" % WARNINGS_SUMMARY_HEADER,
+            "*test_py2_unicode.py:8: UserWarning: \\u6d4b\\u8bd5",
+            '*warnings.warn(u"\u6d4b\u8bd5")',
+            "*warnings.py:*: UnicodeWarning: Warning is using unicode non*",
+            "* 1 passed, 2 warnings*",
+        ]
+    )
+
 
-        '*test_py2_unicode.py:8: UserWarning: \u6d4b\u8bd5',
-        '*warnings.warn(u"\u6d4b\u8bd5")',
-        '*warnings.py:*: UnicodeWarning: Warning is using unicode non*',
-        '* 1 passed, 2 warnings*',
-    ])
+def test_py2_unicode_ascii(testdir):
+    """Ensure that our warning about 'unicode warnings containing non-ascii messages'
+    does not trigger with ascii-convertible messages"""
+    testdir.makeini("[pytest]")
+    testdir.makepyfile(
+        """
+        import pytest
+        import warnings
+
+        @pytest.mark.filterwarnings('always')
+        def test_func():
+            warnings.warn(u"hello")
+    """
+    )
+    result = testdir.runpytest()
+    result.stdout.fnmatch_lines(
+        [
+            "*== %s ==*" % WARNINGS_SUMMARY_HEADER,
+            '*warnings.warn(u"hello")',
+            "* 1 passed, 1 warnings in*",
+        ]
+    )
 
 
 def test_works_with_filterwarnings(testdir):
     """Ensure our warnings capture does not mess with pre-installed filters (#2430)."""
-    testdir.makepyfile('''
+    testdir.makepyfile(
+        """
         import warnings
 
         class MyWarning(Warning):
             pass
 
         warnings.filterwarnings("error", category=MyWarning)
 
         class TestWarnings(object):
             def test_my_warning(self):
                 try:
                     warnings.warn(MyWarning("warn!"))
                     assert False
                 except MyWarning:
                     assert True
-    ''')
+    """
+    )
     result = testdir.runpytest()
-    result.stdout.fnmatch_lines([
-        '*== 1 passed in *',
-    ])
+    result.stdout.fnmatch_lines(["*== 1 passed in *"])
 
 
-@pytest.mark.parametrize('default_config', ['ini', 'cmdline'])
+@pytest.mark.parametrize("default_config", ["ini", "cmdline"])
 def test_filterwarnings_mark(testdir, default_config):
     """
     Test ``filterwarnings`` mark works and takes precedence over command line and ini options.
     """
-    if default_config == 'ini':
-        testdir.makeini("""
+    if default_config == "ini":
+        testdir.makeini(
+            """
             [pytest]
             filterwarnings = always
-        """)
-    testdir.makepyfile("""
+        """
+        )
+    testdir.makepyfile(
+        """
         import warnings
         import pytest
 
         @pytest.mark.filterwarnings('ignore::RuntimeWarning')
         def test_ignore_runtime_warning():
             warnings.warn(RuntimeWarning())
 
         @pytest.mark.filterwarnings('error')
         def test_warning_error():
             warnings.warn(RuntimeWarning())
 
         def test_show_warning():
             warnings.warn(RuntimeWarning())
-    """)
-    result = testdir.runpytest('-W always' if default_config == 'cmdline' else '')
-    result.stdout.fnmatch_lines(['*= 1 failed, 2 passed, 1 warnings in *'])
+    """
+    )
+    result = testdir.runpytest("-W always" if default_config == "cmdline" else "")
+    result.stdout.fnmatch_lines(["*= 1 failed, 2 passed, 1 warnings in *"])
+
+
+def test_non_string_warning_argument(testdir):
+    """Non-str argument passed to warning breaks pytest (#2956)"""
+    testdir.makepyfile(
+        """
+        import warnings
+        import pytest
+
+        def test():
+            warnings.warn(UserWarning(1, u'foo'))
+    """
+    )
+    result = testdir.runpytest("-W", "always")
+    result.stdout.fnmatch_lines(["*= 1 passed, 1 warnings in *"])
--- a/third_party/python/pytest/tox.ini
+++ b/third_party/python/pytest/tox.ini
@@ -1,150 +1,144 @@
 [tox]
 minversion = 2.0
 distshare = {homedir}/.tox/distshare
-# make sure to update environment list on appveyor.yml
+# make sure to update environment list in travis.yml and appveyor.yml
 envlist =
     linting
-    py26
     py27
-    py33
     py34
     py35
     py36
     py37
     pypy
-    {py27,py36}-{pexpect,xdist,trial,numpy}
+    {py27,py36}-{pexpect,xdist,trial,numpy,pluggymaster}
     py27-nobyte
     doctesting
-    py35-freeze
+    py36-freeze
     docs
 
 [testenv]
-commands = pytest --lsof -rfsxX {posargs:testing}
+commands = pytest --lsof -ra {posargs:testing}
 passenv = USER USERNAME
 deps =
-    hypothesis>=3.5.2
+    hypothesis>=3.56
     nose
     mock
     requests
 
-[testenv:py26]
-commands = pytest --lsof -rfsxX {posargs:testing}
-# pinning mock to last supported version for python 2.6
-deps =
-    hypothesis<3.0
-    nose
-    mock<1.1
-
 [testenv:py27-subprocess]
 changedir = .
 deps =
     pytest-xdist>=1.13
     mock
     nose
 commands =
-    pytest -n3 -rfsxX --runpytest=subprocess {posargs:testing}
+    pytest -n3 -ra --runpytest=subprocess {posargs:testing}
 
 
 [testenv:linting]
 skipsdist = True
 usedevelop = True
-basepython = python2.7
-deps =
-    flake8
-    # pygments required by rst-lint
-    pygments
-    restructuredtext_lint
-commands =
-    flake8 pytest.py _pytest testing
-    {envpython} scripts/check-rst.py
+basepython = python3.6
+deps = pre-commit
+commands = pre-commit run --all-files --show-diff-on-failure
 
 [testenv:py27-xdist]
 deps =
     pytest-xdist>=1.13
     mock
     nose
-    hypothesis>=3.5.2
+    hypothesis>=3.56
 changedir=testing
 commands =
-    pytest -n1 -rfsxX {posargs:.}
+    pytest -n8 -ra {posargs:.}
 
 [testenv:py36-xdist]
 deps = {[testenv:py27-xdist]deps}
-commands =
-    pytest -n3 -rfsxX {posargs:testing}
+commands = {[testenv:py27-xdist]commands}
 
 [testenv:py27-pexpect]
 changedir = testing
 platform = linux|darwin
 deps = pexpect
 commands =
-    pytest -rfsxX test_pdb.py test_terminal.py test_unittest.py
+    pytest -ra test_pdb.py test_terminal.py test_unittest.py
 
 [testenv:py36-pexpect]
-changedir = testing
-platform = linux|darwin
+changedir = {[testenv:py27-pexpect]changedir}
+platform = {[testenv:py27-pexpect]platform}
 deps = {[testenv:py27-pexpect]deps}
-commands =
-    pytest -rfsxX test_pdb.py test_terminal.py test_unittest.py
+commands = {[testenv:py27-pexpect]commands}
 
 [testenv:py27-nobyte]
 deps =
     pytest-xdist>=1.13
-    hypothesis>=3.5.2
+    hypothesis>=3.56
+    mock
 distribute = true
 changedir=testing
 setenv =
     PYTHONDONTWRITEBYTECODE=1
 commands =
-    pytest -n3 -rfsxX {posargs:.}
+    pytest -n3 -ra {posargs:.}
 
 [testenv:py27-trial]
 deps = twisted
 commands =
     pytest -ra {posargs:testing/test_unittest.py}
 
 [testenv:py36-trial]
 deps = {[testenv:py27-trial]deps}
-commands =
-    pytest -ra {posargs:testing/test_unittest.py}
+commands = {[testenv:py27-trial]commands}
 
 [testenv:py27-numpy]
-deps=numpy
+deps = numpy
 commands=
-  pytest -rfsxX {posargs:testing/python/approx.py}
+  pytest -ra {posargs:testing/python/approx.py}
 
 [testenv:py36-numpy]
-deps=numpy
-commands=
-  pytest -rfsxX {posargs:testing/python/approx.py}
+deps = {[testenv:py27-numpy]deps}
+commands = {[testenv:py27-numpy]commands}
+
+[testenv:py27-pluggymaster]
+setenv=
+    _PYTEST_SETUP_SKIP_PLUGGY_DEP=1
+deps =
+    {[testenv]deps}
+    git+https://github.com/pytest-dev/pluggy.git@master
+
+[testenv:py36-pluggymaster]
+setenv = {[testenv:py27-pluggymaster]setenv}
+deps = {[testenv:py27-pluggymaster]deps}
 
 [testenv:docs]
 skipsdist = True
 usedevelop = True
-basepython = python
 changedir = doc/en
 deps =
+    attrs
+    more-itertools
+    PyYAML
     sphinx
-    PyYAML
+    sphinxcontrib-trio
 
 commands =
     sphinx-build -W -b html . _build
 
 [testenv:doctesting]
 basepython = python
 usedevelop = True
 skipsdist = True
-# ensure the given pyargs cant mean anytrhing else
+# ensure the given pyargs can't mean anything else
 changedir = doc/
 deps =
     PyYAML
 commands =
-    pytest -rfsxX en
+    pytest -ra en
     pytest --doctest-modules --pyargs _pytest
 
 [testenv:regen]
 changedir = doc/en
 skipsdist = True
 basepython = python3.5
 deps =
     sphinx
@@ -158,24 +152,24 @@ commands =
     make regen
 
 [testenv:fix-lint]
 skipsdist = True
 usedevelop = True
 deps =
     autopep8
 commands =
-    autopep8 --in-place -r --max-line-length=120 --exclude=vendored_packages,test_source_multiline_block.py _pytest testing
+    autopep8 --in-place -r --max-line-length=120 --exclude=test_source_multiline_block.py _pytest testing setup.py pytest.py
 
 [testenv:jython]
 changedir = testing
 commands =
-    {envpython} {envbindir}/py.test-jython -rfsxX {posargs}
+    {envpython} {envbindir}/py.test-jython -ra {posargs}
 
-[testenv:py35-freeze]
+[testenv:py36-freeze]
 changedir = testing/freeze
 deps = pyinstaller
 commands =
     {envpython} create_executable.py
     {envpython} tox_run.py
 
 
 [testenv:coveralls]
@@ -188,30 +182,31 @@ deps =
 commands =
     coverage run --source=_pytest -m pytest testing
     coverage report -m
     coveralls
 
 [pytest]
 minversion = 2.0
 plugins = pytester
-#--pyargs --doctest-modules --ignore=.tox
-addopts = -rxsX -p pytester --ignore=testing/cx_freeze
+addopts = -ra -p pytester --ignore=testing/cx_freeze
 rsyncdirs = tox.ini pytest.py _pytest testing
 python_files = test_*.py *_test.py testing/*/*.py
 python_classes = Test Acceptance
 python_functions = test
 norecursedirs = .tox ja .hg cx_freeze_source
 xfail_strict=true
 filterwarnings =
     error
     # produced by path.local
     ignore:bad escape.*:DeprecationWarning:re
     # produced by path.readlines
     ignore:.*U.*mode is deprecated:DeprecationWarning
     # produced by pytest-xdist
     ignore:.*type argument to addoption.*:DeprecationWarning
     # produced by python >=3.5 on execnet (pytest-xdist)
     ignore:.*inspect.getargspec.*deprecated, use inspect.signature.*:DeprecationWarning
+    # ignore warning about package resolution using __spec__ or __package__
+    # should be a temporary solution, see #3061 for discussion
+    ignore:.*can't resolve package from __spec__ or __package__.*:ImportWarning
 
 [flake8]
 max-line-length = 120
-exclude = _pytest/vendored_packages/pluggy.py