diff --git a/CONTRIBUTING.rst b/CONTRIBUTING.rst index 71dc04d913d..edf71dad7fa 100644 --- a/CONTRIBUTING.rst +++ b/CONTRIBUTING.rst @@ -206,12 +206,12 @@ but here is a simple overview: #. Run all the tests - You need to have Python 2.7 and 3.5 available in your system. Now + 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,py35 + $ tox -e linting,py27,py36 - This command will run tests via the "tox" tool against Python 2.7 and 3.5 + 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. @@ -223,9 +223,9 @@ but here is a simple overview: $ tox -e py27 -- --pdb - Or to only run tests in a particular test module on Python 3.5:: + Or to only run tests in a particular test module on Python 3.6:: - $ tox -e py35 -- testing/test_config.py + $ tox -e py36 -- testing/test_config.py #. Commit and push once your tests pass and you are happy with your change(s):: diff --git a/_pytest/_argcomplete.py b/_pytest/_argcomplete.py index 8fbbf266053..12040b53a0f 100644 --- a/_pytest/_argcomplete.py +++ b/_pytest/_argcomplete.py @@ -57,7 +57,7 @@ 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 diff --git a/_pytest/_code/__init__.py b/_pytest/_code/__init__.py index 3463c11eac7..815c13b42c2 100644 --- a/_pytest/_code/__init__.py +++ b/_pytest/_code/__init__.py @@ -1,4 +1,5 @@ """ python inspection/code generation API """ +from __future__ import absolute_import, division, print_function from .code import Code # noqa from .code import ExceptionInfo # noqa from .code import Frame # noqa diff --git a/_pytest/_code/_py2traceback.py b/_pytest/_code/_py2traceback.py index a830d9899ae..d45ee01fa79 100644 --- a/_pytest/_code/_py2traceback.py +++ b/_pytest/_code/_py2traceback.py @@ -2,6 +2,7 @@ # 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): diff --git a/_pytest/_code/code.py b/_pytest/_code/code.py index 6eceb0c7f3d..2f1ac7fb07d 100644 --- a/_pytest/_code/code.py +++ b/_pytest/_code/code.py @@ -1,3 +1,4 @@ +from __future__ import absolute_import, division, print_function import sys from inspect import CO_VARARGS, CO_VARKEYWORDS import re diff --git a/_pytest/_code/source.py b/_pytest/_code/source.py index fcec0f5ca7a..8e6148410a1 100644 --- a/_pytest/_code/source.py +++ b/_pytest/_code/source.py @@ -1,4 +1,4 @@ -from __future__ import generators +from __future__ import absolute_import, division, generators, print_function from bisect import bisect_right import sys diff --git a/_pytest/_pluggy.py b/_pytest/_pluggy.py index 87d32cf8dd1..6cc1d3d54a6 100644 --- a/_pytest/_pluggy.py +++ b/_pytest/_pluggy.py @@ -2,7 +2,7 @@ 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 diff --git a/_pytest/assertion/__init__.py b/_pytest/assertion/__init__.py index fe0653bb71e..edda0634506 100644 --- a/_pytest/assertion/__init__.py +++ b/_pytest/assertion/__init__.py @@ -1,6 +1,7 @@ """ support for presenting detailed information in failing assertions. """ +from __future__ import absolute_import, division, print_function import py import sys diff --git a/_pytest/assertion/rewrite.py b/_pytest/assertion/rewrite.py index 7408c47469f..484d5bd8be9 100644 --- a/_pytest/assertion/rewrite.py +++ b/_pytest/assertion/rewrite.py @@ -1,5 +1,5 @@ """Rewrite assertion AST to produce nice error messages""" - +from __future__ import absolute_import, division, print_function import ast import _ast import errno diff --git a/_pytest/assertion/truncate.py b/_pytest/assertion/truncate.py index 3c031b11f03..1e130635693 100644 --- a/_pytest/assertion/truncate.py +++ b/_pytest/assertion/truncate.py @@ -4,7 +4,7 @@ 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 diff --git a/_pytest/assertion/util.py b/_pytest/assertion/util.py index 7b4edb6fddd..06eda8d915d 100644 --- a/_pytest/assertion/util.py +++ b/_pytest/assertion/util.py @@ -1,4 +1,5 @@ """Utilities for assertion debugging""" +from __future__ import absolute_import, division, print_function import pprint import _pytest._code diff --git a/_pytest/cacheprovider.py b/_pytest/cacheprovider.py index 782fdadd9ba..0b8e71a71ab 100755 --- a/_pytest/cacheprovider.py +++ b/_pytest/cacheprovider.py @@ -4,7 +4,7 @@ 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 diff --git a/_pytest/capture.py b/_pytest/capture.py index 6a1cae41d49..c6fc80c0b55 100644 --- a/_pytest/capture.py +++ b/_pytest/capture.py @@ -2,7 +2,7 @@ per-test stdout/stderr capturing mechanism. """ -from __future__ import with_statement +from __future__ import absolute_import, division, print_function import contextlib import sys diff --git a/_pytest/compat.py b/_pytest/compat.py index 09df385d1de..b688ae50934 100644 --- a/_pytest/compat.py +++ b/_pytest/compat.py @@ -1,6 +1,7 @@ """ python version compatibility code """ +from __future__ import absolute_import, division, print_function import sys import inspect import types diff --git a/_pytest/config.py b/_pytest/config.py index 6a607c7e30d..92f9005b47f 100644 --- a/_pytest/config.py +++ b/_pytest/config.py @@ -1,4 +1,5 @@ """ command line options, ini-file and conftest.py processing. """ +from __future__ import absolute_import, division, print_function import argparse import shlex import traceback diff --git a/_pytest/debugging.py b/_pytest/debugging.py index c21e0977d8c..1e7dcad5d67 100644 --- a/_pytest/debugging.py +++ b/_pytest/debugging.py @@ -1,5 +1,5 @@ """ interactive debugging with PDB, the Python Debugger. """ -from __future__ import absolute_import +from __future__ import absolute_import, division, print_function import pdb import sys diff --git a/_pytest/deprecated.py b/_pytest/deprecated.py index 6edc475f6ea..e75ff099ee7 100644 --- a/_pytest/deprecated.py +++ b/_pytest/deprecated.py @@ -5,7 +5,7 @@ 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 MAIN_STR_ARGS = 'passing a string to pytest.main() is deprecated, ' \ 'pass a list of arguments instead.' diff --git a/_pytest/doctest.py b/_pytest/doctest.py index 4ee21b12dbf..f9299be723a 100644 --- a/_pytest/doctest.py +++ b/_pytest/doctest.py @@ -1,5 +1,5 @@ """ discover and run doctests in modules and test files.""" -from __future__ import absolute_import +from __future__ import absolute_import, division, print_function import traceback diff --git a/_pytest/fixtures.py b/_pytest/fixtures.py index c4d21635f18..a151d615dad 100644 --- a/_pytest/fixtures.py +++ b/_pytest/fixtures.py @@ -1,3 +1,4 @@ +from __future__ import absolute_import, division, print_function import sys from py._code.code import FormattedExcinfo diff --git a/_pytest/freeze_support.py b/_pytest/freeze_support.py index f78ccd298ef..6c212055969 100644 --- a/_pytest/freeze_support.py +++ b/_pytest/freeze_support.py @@ -2,6 +2,8 @@ Provides a function to report all internal modules for using freezing tools pytest """ +from __future__ import absolute_import, division, print_function + def pytest_namespace(): return {'freeze_includes': freeze_includes} @@ -42,4 +44,4 @@ def _iter_all_modules(package, prefix=''): for m in _iter_all_modules(os.path.join(path, name), prefix=name + '.'): yield prefix + m else: - yield prefix + name \ No newline at end of file + yield prefix + name diff --git a/_pytest/helpconfig.py b/_pytest/helpconfig.py index 6e66b11c483..abc792f7ef8 100644 --- a/_pytest/helpconfig.py +++ b/_pytest/helpconfig.py @@ -1,4 +1,6 @@ """ version info, help messages, tracing configuration. """ +from __future__ import absolute_import, division, print_function + import py import pytest import os, sys diff --git a/_pytest/junitxml.py b/_pytest/junitxml.py index e5f20b6f667..4bd334a1683 100644 --- a/_pytest/junitxml.py +++ b/_pytest/junitxml.py @@ -4,9 +4,11 @@ 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 """ -# 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 diff --git a/_pytest/main.py b/_pytest/main.py index f100b797462..3d7b456d2fd 100644 --- a/_pytest/main.py +++ b/_pytest/main.py @@ -1,4 +1,6 @@ """ core implementation of testing process: init, session, runtest loop. """ +from __future__ import absolute_import, division, print_function + import functools import os import sys diff --git a/_pytest/mark.py b/_pytest/mark.py index 582eb12773c..643f43ce065 100644 --- a/_pytest/mark.py +++ b/_pytest/mark.py @@ -1,4 +1,6 @@ """ generic mechanism for marking and selecting python functions. """ +from __future__ import absolute_import, division, print_function + import inspect from collections import namedtuple from operator import attrgetter diff --git a/_pytest/monkeypatch.py b/_pytest/monkeypatch.py index 30618cc5761..9151db3adc3 100644 --- a/_pytest/monkeypatch.py +++ b/_pytest/monkeypatch.py @@ -1,4 +1,5 @@ """ monkeypatching and mocking functionality. """ +from __future__ import absolute_import, division, print_function import os, sys import re diff --git a/_pytest/nose.py b/_pytest/nose.py index 03874686860..828a919f9b7 100644 --- a/_pytest/nose.py +++ b/_pytest/nose.py @@ -1,4 +1,5 @@ """ run test suites written for nose. """ +from __future__ import absolute_import, division, print_function import sys diff --git a/_pytest/pastebin.py b/_pytest/pastebin.py index 9f1cf90637b..6f3ce8feddd 100644 --- a/_pytest/pastebin.py +++ b/_pytest/pastebin.py @@ -1,4 +1,6 @@ """ submit failure or test session information to a pastebin service. """ +from __future__ import absolute_import, division, print_function + import pytest import sys import tempfile diff --git a/_pytest/pytester.py b/_pytest/pytester.py index 97fc62312e7..ee0e5bbe7fa 100644 --- a/_pytest/pytester.py +++ b/_pytest/pytester.py @@ -1,4 +1,6 @@ """ (disabled by default) support for testing pytest and pytest plugins. """ +from __future__ import absolute_import, division, print_function + import codecs import gc import os @@ -12,8 +14,6 @@ from weakref import WeakKeyDictionary -from py.builtin import print_ - from _pytest.capture import MultiCapture, SysCapture from _pytest._code import Source import py @@ -229,15 +229,15 @@ def assert_contains(self, entries): name, check = entries.pop(0) for ind, call in enumerate(self.calls[i:]): if call._name == name: - print_("NAMEMATCH", name, call) + print("NAMEMATCH", name, call) if eval(check, backlocals, call.__dict__): - print_("CHECKERMATCH", repr(check), "->", call) + print("CHECKERMATCH", repr(check), "->", call) else: - print_("NOCHECKERMATCH", repr(check), "-", call) + print("NOCHECKERMATCH", repr(check), "-", call) continue i += ind + 1 break - print_("NONAMEMATCH", name, "with", call) + print("NONAMEMATCH", name, "with", call) else: pytest.fail("could not find %r check %r" % (name, check)) @@ -924,8 +924,8 @@ 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())) + 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: @@ -951,7 +951,7 @@ def _run(self, *cmdargs): def _dump_lines(self, lines, fp): try: for line in lines: - py.builtin.print_(line, file=fp) + print(line, file=fp) except UnicodeEncodeError: print("couldn't print to %s because of encoding" % (fp,)) diff --git a/_pytest/python.py b/_pytest/python.py index 471a9563f02..7d94ed61a03 100644 --- a/_pytest/python.py +++ b/_pytest/python.py @@ -1,4 +1,5 @@ """ Python test discovery, setup and run of test functions. """ +from __future__ import absolute_import, division, print_function import fnmatch import inspect diff --git a/_pytest/recwarn.py b/_pytest/recwarn.py index 43f68ed1236..91cc85fdfbe 100644 --- a/_pytest/recwarn.py +++ b/_pytest/recwarn.py @@ -1,4 +1,6 @@ """ recording warnings during test function execution. """ +from __future__ import absolute_import, division, print_function + import inspect import _pytest._code diff --git a/_pytest/resultlog.py b/_pytest/resultlog.py index fc002598347..3e4b00cf9bb 100644 --- a/_pytest/resultlog.py +++ b/_pytest/resultlog.py @@ -1,6 +1,7 @@ """ log machine-parseable test session result information in a plain text file. """ +from __future__ import absolute_import, division, print_function import py import os @@ -61,9 +62,9 @@ def __init__(self, config, logfile): self.logfile = logfile # preferably line buffered def write_log_entry(self, testpath, lettercode, longrepr): - py.builtin.print_("%s %s" % (lettercode, testpath), file=self.logfile) + print("%s %s" % (lettercode, testpath), file=self.logfile) for line in longrepr.splitlines(): - py.builtin.print_(" %s" % line, file=self.logfile) + print(" %s" % line, file=self.logfile) def log_outcome(self, report, lettercode, longrepr): testpath = getattr(report, 'nodeid', None) diff --git a/_pytest/runner.py b/_pytest/runner.py index f17155dae35..4277f8ee3de 100644 --- a/_pytest/runner.py +++ b/_pytest/runner.py @@ -1,4 +1,6 @@ """ basic collect and runtest protocol implementations """ +from __future__ import absolute_import, division, print_function + import bdb import sys from time import time diff --git a/_pytest/setuponly.py b/_pytest/setuponly.py index 1752c575f54..15e195ad5a1 100644 --- a/_pytest/setuponly.py +++ b/_pytest/setuponly.py @@ -1,3 +1,5 @@ +from __future__ import absolute_import, division, print_function + import pytest import sys diff --git a/_pytest/setupplan.py b/_pytest/setupplan.py index f0853dee544..e11bd40698b 100644 --- a/_pytest/setupplan.py +++ b/_pytest/setupplan.py @@ -1,3 +1,5 @@ +from __future__ import absolute_import, division, print_function + import pytest diff --git a/_pytest/skipping.py b/_pytest/skipping.py index 86176acafe9..228c529359e 100644 --- a/_pytest/skipping.py +++ b/_pytest/skipping.py @@ -1,4 +1,6 @@ """ support for skip/xfail functions and markers. """ +from __future__ import absolute_import, division, print_function + import os import sys import traceback diff --git a/_pytest/terminal.py b/_pytest/terminal.py index b0794542634..4607b752eae 100644 --- a/_pytest/terminal.py +++ b/_pytest/terminal.py @@ -2,6 +2,8 @@ This is a good source for looking at the various reporting hooks. """ +from __future__ import absolute_import, division, print_function + from _pytest.main import EXIT_OK, EXIT_TESTSFAILED, EXIT_INTERRUPTED, \ EXIT_USAGEERROR, EXIT_NOTESTSCOLLECTED import pytest diff --git a/_pytest/tmpdir.py b/_pytest/tmpdir.py index 67f999e5aff..7c5fac17ca0 100644 --- a/_pytest/tmpdir.py +++ b/_pytest/tmpdir.py @@ -1,4 +1,6 @@ """ support for providing temporary directories to test functions. """ +from __future__ import absolute_import, division, print_function + import re import pytest diff --git a/_pytest/unittest.py b/_pytest/unittest.py index 276b9ba1621..5a8cb9d663a 100644 --- a/_pytest/unittest.py +++ b/_pytest/unittest.py @@ -1,5 +1,5 @@ """ discovery and running of std-library "unittest" style tests. """ -from __future__ import absolute_import +from __future__ import absolute_import, division, print_function import sys import traceback diff --git a/testing/acceptance_test.py b/testing/acceptance_test.py index 0d3fc101623..debda79ca34 100644 --- a/testing/acceptance_test.py +++ b/testing/acceptance_test.py @@ -1,4 +1,5 @@ # -*- coding: utf-8 -*- +from __future__ import absolute_import, division, print_function import os import sys diff --git a/testing/code/test_code.py b/testing/code/test_code.py index a1f31b4a983..479a2e7cc9f 100644 --- a/testing/code/test_code.py +++ b/testing/code/test_code.py @@ -1,3 +1,4 @@ +from __future__ import absolute_import, division, print_function import sys import _pytest._code diff --git a/testing/code/test_excinfo.py b/testing/code/test_excinfo.py index e2354ff5d7f..b7dafdb46b4 100644 --- a/testing/code/test_excinfo.py +++ b/testing/code/test_excinfo.py @@ -1,4 +1,5 @@ # -*- coding: utf-8 -*- +from __future__ import absolute_import, division, print_function import operator import _pytest @@ -369,7 +370,7 @@ def test_codepath_Queue_example(): def test_match_succeeds(): with pytest.raises(ZeroDivisionError) as excinfo: - 0 / 0 + 0 // 0 excinfo.match(r'.*zero.*') def test_match_raises_error(testdir): diff --git a/testing/code/test_source.py b/testing/code/test_source.py index c161f75f8d3..bdbc00d196b 100644 --- a/testing/code/test_source.py +++ b/testing/code/test_source.py @@ -1,6 +1,7 @@ # 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 sys import _pytest._code diff --git a/testing/deprecated_test.py b/testing/deprecated_test.py index 6473989e62d..ad2f2021db9 100644 --- a/testing/deprecated_test.py +++ b/testing/deprecated_test.py @@ -1,3 +1,4 @@ +from __future__ import absolute_import, division, print_function import pytest diff --git a/testing/python/collect.py b/testing/python/collect.py index e4069983a9b..e67b6bc8420 100644 --- a/testing/python/collect.py +++ b/testing/python/collect.py @@ -274,6 +274,7 @@ def test_gen(self): def test_order_of_execution_generator_same_codeline(self, testdir, tmpdir): o = testdir.makepyfile(""" + from __future__ import print_function def test_generative_order_of_execution(): import py, pytest test_list = [] @@ -283,8 +284,8 @@ def list_append(item): test_list.append(item) def assert_order_of_execution(): - py.builtin.print_('expected order', expected_list) - py.builtin.print_('but got ', test_list) + print('expected order', expected_list) + print('but got ', test_list) assert test_list == expected_list for i in expected_list: @@ -298,6 +299,7 @@ def assert_order_of_execution(): def test_order_of_execution_generator_different_codeline(self, testdir): o = testdir.makepyfile(""" + from __future__ import print_function def test_generative_tests_different_codeline(): import py, pytest test_list = [] @@ -313,8 +315,8 @@ def list_append_0(): test_list.append(0) def assert_order_of_execution(): - py.builtin.print_('expected order', expected_list) - py.builtin.print_('but got ', test_list) + print('expected order', expected_list) + print('but got ', test_list) assert test_list == expected_list yield list_append_0 diff --git a/testing/test_argcomplete.py b/testing/test_argcomplete.py index ed6db4c7851..6887c419cfb 100644 --- a/testing/test_argcomplete.py +++ b/testing/test_argcomplete.py @@ -1,4 +1,4 @@ -from __future__ import with_statement +from __future__ import absolute_import, division, print_function import py, pytest # test for _argcomplete but not specific for any application diff --git a/testing/test_assertion.py b/testing/test_assertion.py index e5c18b43aba..789352a7fcf 100644 --- a/testing/test_assertion.py +++ b/testing/test_assertion.py @@ -1,4 +1,5 @@ # -*- coding: utf-8 -*- +from __future__ import absolute_import, division, print_function import sys import textwrap diff --git a/testing/test_assertrewrite.py b/testing/test_assertrewrite.py index 047a2ac6edb..f4fc0c4640d 100644 --- a/testing/test_assertrewrite.py +++ b/testing/test_assertrewrite.py @@ -1,3 +1,4 @@ +from __future__ import absolute_import, division, print_function import glob import os import py_compile diff --git a/testing/test_cache.py b/testing/test_cache.py index c1b98489e22..47072e07e2a 100755 --- a/testing/test_cache.py +++ b/testing/test_cache.py @@ -1,3 +1,4 @@ +from __future__ import absolute_import, division, print_function import sys import _pytest diff --git a/testing/test_capture.py b/testing/test_capture.py index 28326fa73e9..aa2a3bae502 100644 --- a/testing/test_capture.py +++ b/testing/test_capture.py @@ -1,3 +1,4 @@ +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 @@ -13,7 +14,7 @@ from _pytest import capture from _pytest.capture import CaptureManager from _pytest.main import EXIT_NOTESTSCOLLECTED -from py.builtin import print_ + needsosdup = pytest.mark.xfail("not hasattr(os, 'dup')") @@ -711,7 +712,7 @@ def test_dupfile(tmpfile): assert nf != tmpfile assert nf.fileno() != tmpfile.fileno() assert nf not in flist - print_(i, end="", file=nf) + print(i, end="", file=nf) flist.append(nf) for i in range(5): f = flist[i] @@ -785,7 +786,7 @@ def test_simple_fail_second_start(self, tmpfile): def test_stderr(self): cap = capture.FDCapture(2) cap.start() - print_("hello", file=sys.stderr) + print("hello", file=sys.stderr) s = cap.snap() cap.done() assert s == "hello\n" diff --git a/testing/test_collection.py b/testing/test_collection.py index 8575aa63a37..c19fc0e72d3 100644 --- a/testing/test_collection.py +++ b/testing/test_collection.py @@ -1,3 +1,4 @@ +from __future__ import absolute_import, division, print_function import pytest, py from _pytest.main import Session, EXIT_NOTESTSCOLLECTED diff --git a/testing/test_compat.py b/testing/test_compat.py index 1736e8e2a8b..7b2251ef6f2 100644 --- a/testing/test_compat.py +++ b/testing/test_compat.py @@ -1,3 +1,4 @@ +from __future__ import absolute_import, division, print_function import sys import pytest diff --git a/testing/test_config.py b/testing/test_config.py index 171e9486eb1..94ad2b130c8 100644 --- a/testing/test_config.py +++ b/testing/test_config.py @@ -1,3 +1,4 @@ +from __future__ import absolute_import, division, print_function import py, pytest import _pytest._code diff --git a/testing/test_conftest.py b/testing/test_conftest.py index e9fd1927a95..db67a0cc8b4 100644 --- a/testing/test_conftest.py +++ b/testing/test_conftest.py @@ -1,3 +1,4 @@ +from __future__ import absolute_import, division, print_function from textwrap import dedent import _pytest._code diff --git a/testing/test_doctest.py b/testing/test_doctest.py index 429bb8de924..82597b47756 100644 --- a/testing/test_doctest.py +++ b/testing/test_doctest.py @@ -1,4 +1,5 @@ # encoding: utf-8 +from __future__ import absolute_import, division, print_function import sys import _pytest._code from _pytest.compat import MODULE_NOT_FOUND_ERROR diff --git a/testing/test_entry_points.py b/testing/test_entry_points.py index 370b9312926..6ca68b481fa 100644 --- a/testing/test_entry_points.py +++ b/testing/test_entry_points.py @@ -1,3 +1,4 @@ +from __future__ import absolute_import, division, print_function import pkg_resources import pytest diff --git a/testing/test_helpconfig.py b/testing/test_helpconfig.py index fc3c8fdf69e..6eecbfd373d 100644 --- a/testing/test_helpconfig.py +++ b/testing/test_helpconfig.py @@ -1,3 +1,4 @@ +from __future__ import absolute_import, division, print_function from _pytest.main import EXIT_NOTESTSCOLLECTED import pytest diff --git a/testing/test_junitxml.py b/testing/test_junitxml.py index a0f51fc71e8..3d07e54e557 100644 --- a/testing/test_junitxml.py +++ b/testing/test_junitxml.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- - +from __future__ import absolute_import, division, print_function from xml.dom import minidom import py import sys @@ -1028,4 +1028,4 @@ class Report(BaseReport): 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" \ No newline at end of file + assert (test_case.getAttribute('url') == test_url), "The URL did not get written to the xml" diff --git a/testing/test_mark.py b/testing/test_mark.py index 9474d103369..3bec1d0d0a6 100644 --- a/testing/test_mark.py +++ b/testing/test_mark.py @@ -1,3 +1,4 @@ +from __future__ import absolute_import, division, print_function import os import py, pytest @@ -673,7 +674,7 @@ def pytest_pycollect_makeitem(name): item.extra_keyword_matches.add("xxx") """) reprec = testdir.inline_run(p.dirpath(), '-s', '-k', keyword) - py.builtin.print_("keyword", repr(keyword)) + print("keyword", repr(keyword)) passed, skipped, failed = reprec.listoutcomes() assert len(passed) == 1 assert passed[0].nodeid.endswith("test_2") diff --git a/testing/test_monkeypatch.py b/testing/test_monkeypatch.py index 04a53d93ad8..1efcf7f95bf 100644 --- a/testing/test_monkeypatch.py +++ b/testing/test_monkeypatch.py @@ -1,3 +1,4 @@ +from __future__ import absolute_import, division, print_function import os import sys import textwrap diff --git a/testing/test_nose.py b/testing/test_nose.py index 11fb8317610..798badc1c9e 100644 --- a/testing/test_nose.py +++ b/testing/test_nose.py @@ -1,3 +1,4 @@ +from __future__ import absolute_import, division, print_function import pytest def setup_module(mod): diff --git a/testing/test_parseopt.py b/testing/test_parseopt.py index 03d71de4350..f990e8b0444 100644 --- a/testing/test_parseopt.py +++ b/testing/test_parseopt.py @@ -1,4 +1,4 @@ -from __future__ import with_statement +from __future__ import absolute_import, division, print_function import sys import os import py, pytest diff --git a/testing/test_pastebin.py b/testing/test_pastebin.py index f0d2a9ba2f7..3fe66e97210 100644 --- a/testing/test_pastebin.py +++ b/testing/test_pastebin.py @@ -1,4 +1,5 @@ # encoding: utf-8 +from __future__ import absolute_import, division, print_function import sys import pytest diff --git a/testing/test_pdb.py b/testing/test_pdb.py index 161b4f5f7d5..ec586208269 100644 --- a/testing/test_pdb.py +++ b/testing/test_pdb.py @@ -1,3 +1,4 @@ +from __future__ import absolute_import, division, print_function import sys import platform diff --git a/testing/test_pluginmanager.py b/testing/test_pluginmanager.py index 3214d868b0b..ec83897468d 100644 --- a/testing/test_pluginmanager.py +++ b/testing/test_pluginmanager.py @@ -1,4 +1,5 @@ # encoding: UTF-8 +from __future__ import absolute_import, division, print_function import pytest import py import os diff --git a/testing/test_pytester.py b/testing/test_pytester.py index 9c9b5637157..932427ad34a 100644 --- a/testing/test_pytester.py +++ b/testing/test_pytester.py @@ -1,3 +1,4 @@ +from __future__ import absolute_import, division, print_function import pytest import os from _pytest.pytester import HookRecorder diff --git a/testing/test_recwarn.py b/testing/test_recwarn.py index 1269af431e5..890d2ce0ae1 100644 --- a/testing/test_recwarn.py +++ b/testing/test_recwarn.py @@ -1,3 +1,4 @@ +from __future__ import absolute_import, division, print_function import warnings import re import py diff --git a/testing/test_resultlog.py b/testing/test_resultlog.py index c2f4a801c2d..cb083225ce5 100644 --- a/testing/test_resultlog.py +++ b/testing/test_resultlog.py @@ -1,3 +1,4 @@ +from __future__ import absolute_import, division, print_function import os import _pytest._code diff --git a/testing/test_runner.py b/testing/test_runner.py index 265e99d549b..51d430fc8bb 100644 --- a/testing/test_runner.py +++ b/testing/test_runner.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -from __future__ import with_statement +from __future__ import absolute_import, division, print_function import _pytest._code import os diff --git a/testing/test_runner_xunit.py b/testing/test_runner_xunit.py index 9bf15bd668d..92ba97202f8 100644 --- a/testing/test_runner_xunit.py +++ b/testing/test_runner_xunit.py @@ -1,6 +1,8 @@ -# -# test correct setup/teardowns at -# module, class, and instance level +""" + test correct setup/teardowns at + module, class, and instance level +""" +from __future__ import absolute_import, division, print_function import pytest diff --git a/testing/test_session.py b/testing/test_session.py index 66a0f59789b..d08f7b3e25f 100644 --- a/testing/test_session.py +++ b/testing/test_session.py @@ -1,3 +1,4 @@ +from __future__ import absolute_import, division, print_function import pytest from _pytest.main import EXIT_NOTESTSCOLLECTED diff --git a/testing/test_skipping.py b/testing/test_skipping.py index f621a010f41..5f25c3e6e54 100644 --- a/testing/test_skipping.py +++ b/testing/test_skipping.py @@ -1,3 +1,4 @@ +from __future__ import absolute_import, division, print_function import pytest import sys diff --git a/testing/test_terminal.py b/testing/test_terminal.py index d72f6a12b57..9d7a2d7d2a3 100644 --- a/testing/test_terminal.py +++ b/testing/test_terminal.py @@ -1,6 +1,7 @@ """ terminal reporting of the full testing process. """ +from __future__ import absolute_import, division, print_function import collections import sys diff --git a/testing/test_tmpdir.py b/testing/test_tmpdir.py index 32ac7633170..ccd70ed8bb0 100644 --- a/testing/test_tmpdir.py +++ b/testing/test_tmpdir.py @@ -1,3 +1,4 @@ +from __future__ import absolute_import, division, print_function import sys import py import pytest diff --git a/testing/test_unittest.py b/testing/test_unittest.py index 832ea08ccff..af9851997ad 100644 --- a/testing/test_unittest.py +++ b/testing/test_unittest.py @@ -1,3 +1,4 @@ +from __future__ import absolute_import, division, print_function from _pytest.main import EXIT_NOTESTSCOLLECTED import pytest import gc