Add __future__ imports to all pytest modules
This prevents silly errors from creeping in Python 2 when testing in Python 3
This commit is contained in:
parent
7684b3af7b
commit
42a5d6bdfa
|
@ -57,7 +57,7 @@ If things do not work right away:
|
|||
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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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):
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
from __future__ import absolute_import, division, print_function
|
||||
import sys
|
||||
from inspect import CO_VARARGS, CO_VARKEYWORDS
|
||||
import re
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
from __future__ import generators
|
||||
from __future__ import absolute_import, division, generators, print_function
|
||||
|
||||
from bisect import bisect_right
|
||||
import sys
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
"""
|
||||
support for presenting detailed information in failing assertions.
|
||||
"""
|
||||
from __future__ import absolute_import, division, print_function
|
||||
import py
|
||||
import sys
|
||||
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -4,7 +4,7 @@ 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
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
"""Utilities for assertion debugging"""
|
||||
from __future__ import absolute_import, division, print_function
|
||||
import pprint
|
||||
|
||||
import _pytest._code
|
||||
|
|
|
@ -4,7 +4,7 @@ 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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
"""
|
||||
python version compatibility code
|
||||
"""
|
||||
from __future__ import absolute_import, division, print_function
|
||||
import sys
|
||||
import inspect
|
||||
import types
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
||||
|
|
|
@ -5,7 +5,7 @@ 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
|
||||
|
||||
MAIN_STR_ARGS = 'passing a string to pytest.main() is deprecated, ' \
|
||||
'pass a list of arguments instead.'
|
||||
|
|
|
@ -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
|
||||
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
from __future__ import absolute_import, division, print_function
|
||||
import sys
|
||||
|
||||
from py._code.code import FormattedExcinfo
|
||||
|
|
|
@ -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
|
||||
yield prefix + name
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
""" monkeypatching and mocking functionality. """
|
||||
from __future__ import absolute_import, division, print_function
|
||||
|
||||
import os, sys
|
||||
import re
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
""" run test suites written for nose. """
|
||||
from __future__ import absolute_import, division, print_function
|
||||
|
||||
import sys
|
||||
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -1,4 +1,6 @@
|
|||
""" recording warnings during test function execution. """
|
||||
from __future__ import absolute_import, division, print_function
|
||||
|
||||
import inspect
|
||||
|
||||
import _pytest._code
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -1,3 +1,5 @@
|
|||
from __future__ import absolute_import, division, print_function
|
||||
|
||||
import pytest
|
||||
import sys
|
||||
|
||||
|
|
|
@ -1,3 +1,5 @@
|
|||
from __future__ import absolute_import, division, print_function
|
||||
|
||||
import pytest
|
||||
|
||||
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -1,4 +1,6 @@
|
|||
""" support for providing temporary directories to test functions. """
|
||||
from __future__ import absolute_import, division, print_function
|
||||
|
||||
import re
|
||||
|
||||
import pytest
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
from __future__ import absolute_import, division, print_function
|
||||
import os
|
||||
import sys
|
||||
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
from __future__ import absolute_import, division, print_function
|
||||
import sys
|
||||
|
||||
import _pytest._code
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
from __future__ import absolute_import, division, print_function
|
||||
|
||||
import operator
|
||||
import _pytest
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
from __future__ import absolute_import, division, print_function
|
||||
import pytest
|
||||
|
||||
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
from __future__ import absolute_import, division, print_function
|
||||
import sys
|
||||
import textwrap
|
||||
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
from __future__ import absolute_import, division, print_function
|
||||
import glob
|
||||
import os
|
||||
import py_compile
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
from __future__ import absolute_import, division, print_function
|
||||
import sys
|
||||
|
||||
import _pytest
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
from __future__ import absolute_import, division, print_function
|
||||
import pytest, py
|
||||
|
||||
from _pytest.main import Session, EXIT_NOTESTSCOLLECTED
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
from __future__ import absolute_import, division, print_function
|
||||
import sys
|
||||
|
||||
import pytest
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
from __future__ import absolute_import, division, print_function
|
||||
import py, pytest
|
||||
|
||||
import _pytest._code
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
from __future__ import absolute_import, division, print_function
|
||||
from textwrap import dedent
|
||||
|
||||
import _pytest._code
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
from __future__ import absolute_import, division, print_function
|
||||
import pkg_resources
|
||||
|
||||
import pytest
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
from __future__ import absolute_import, division, print_function
|
||||
from _pytest.main import EXIT_NOTESTSCOLLECTED
|
||||
import pytest
|
||||
|
||||
|
|
|
@ -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 @@ def test_url_property(testdir):
|
|||
|
||||
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"
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
from __future__ import absolute_import, division, print_function
|
||||
import os
|
||||
|
||||
import py, pytest
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
from __future__ import absolute_import, division, print_function
|
||||
import os
|
||||
import sys
|
||||
import textwrap
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
from __future__ import absolute_import, division, print_function
|
||||
import pytest
|
||||
|
||||
def setup_module(mod):
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
from __future__ import with_statement
|
||||
from __future__ import absolute_import, division, print_function
|
||||
import sys
|
||||
import os
|
||||
import py, pytest
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
# encoding: utf-8
|
||||
from __future__ import absolute_import, division, print_function
|
||||
import sys
|
||||
import pytest
|
||||
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
from __future__ import absolute_import, division, print_function
|
||||
import sys
|
||||
import platform
|
||||
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
# encoding: UTF-8
|
||||
from __future__ import absolute_import, division, print_function
|
||||
import pytest
|
||||
import py
|
||||
import os
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
from __future__ import absolute_import, division, print_function
|
||||
import pytest
|
||||
import os
|
||||
from _pytest.pytester import HookRecorder
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
from __future__ import absolute_import, division, print_function
|
||||
import warnings
|
||||
import re
|
||||
import py
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
from __future__ import absolute_import, division, print_function
|
||||
import os
|
||||
|
||||
import _pytest._code
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
||||
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
from __future__ import absolute_import, division, print_function
|
||||
import pytest
|
||||
|
||||
from _pytest.main import EXIT_NOTESTSCOLLECTED
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
from __future__ import absolute_import, division, print_function
|
||||
import pytest
|
||||
import sys
|
||||
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
"""
|
||||
terminal reporting of the full testing process.
|
||||
"""
|
||||
from __future__ import absolute_import, division, print_function
|
||||
import collections
|
||||
import sys
|
||||
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
from __future__ import absolute_import, division, print_function
|
||||
import sys
|
||||
import py
|
||||
import pytest
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
from __future__ import absolute_import, division, print_function
|
||||
from _pytest.main import EXIT_NOTESTSCOLLECTED
|
||||
import pytest
|
||||
import gc
|
||||
|
|
Loading…
Reference in New Issue