Merge remote-tracking branch 'origin/master' into merge-master

This commit is contained in:
Anthony Sottile 2018-10-25 18:00:39 -07:00
commit 777e9e1e17
113 changed files with 750 additions and 454 deletions

View File

@ -23,6 +23,11 @@ repos:
language_version: python3
- id: flake8
language_version: python3
- repo: https://github.com/asottile/reorder_python_imports
rev: v1.3.2
hooks:
- id: reorder-python-imports
args: ['--application-directories=.:src']
- repo: https://github.com/asottile/pyupgrade
rev: v1.8.0
hooks:

View File

@ -2,7 +2,6 @@
# 2.7.5 3.3.2
# FilesCompleter 75.1109 69.2116
# FastFilesCompleter 0.7383 1.0760
import timeit
imports = [

View File

@ -1,4 +1,5 @@
from six.moves import range
import pytest

View File

@ -0,0 +1 @@
Revert patching of ``sys.breakpointhook`` since it appears to do nothing.

View File

@ -0,0 +1 @@
Fix bug where the warning summary at the end of the test session was not showing the test where the warning was originated.

View File

@ -0,0 +1 @@
Apply an import sorter (``reorder-python-imports``) to the codebase.

View File

@ -1,19 +1,17 @@
# 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 Comment
from pygments.token import Error
from pygments.token import Generic
from pygments.token import Keyword
from pygments.token import Literal
from pygments.token import Name
from pygments.token import Number
from pygments.token import Operator
from pygments.token import Other
from pygments.token import Punctuation
from pygments.token import String
from pygments.token import Whitespace
class FlaskyStyle(Style):

View File

@ -10,17 +10,15 @@
#
# All configuration values have a default; values that are commented out
# serve to show the default.
# 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 datetime
import os
import sys
import datetime
from _pytest import __version__ as version

View File

@ -1,7 +1,8 @@
from pytest import raises
import _pytest._code
import six
import _pytest._code
from pytest import raises
def otherfunc(a, b):
assert a == b

View File

@ -1,6 +1,7 @@
import pytest
import py
import pytest
mydir = py.path.local(__file__).dirpath()

View File

@ -5,6 +5,7 @@ serialization via the pickle module.
import textwrap
import py
import pytest
pythonlist = ["python2.7", "python3.4", "python3.5"]

View File

@ -1,5 +1,4 @@
# content of conftest.py
import pytest

View File

@ -1,4 +1,5 @@
import sys
import pytest
py3 = sys.version_info[0] >= 3

View File

@ -1,4 +1,5 @@
import json
import py
import requests

View File

@ -2,9 +2,13 @@
Invoke development tasks.
"""
import argparse
from colorama import init, Fore
from pathlib import Path
from subprocess import check_output, check_call, call
from subprocess import call
from subprocess import check_call
from subprocess import check_output
from colorama import Fore
from colorama import init
def announce(version):

View File

@ -1,4 +1,5 @@
import os
from setuptools import setup

View File

@ -53,9 +53,12 @@ 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
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import os
import sys
from glob import glob

View File

@ -1,11 +1,14 @@
""" python inspection/code generation API """
from __future__ import absolute_import, division, print_function
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from .code import Code # noqa
from .code import ExceptionInfo # noqa
from .code import Frame # noqa
from .code import Traceback # noqa
from .code import filter_traceback # noqa
from .code import Frame # noqa
from .code import getrawcode # noqa
from .source import Source # noqa
from .code import Traceback # noqa
from .source import compile_ as compile # noqa
from .source import getfslineno # noqa
from .source import Source # noqa

View File

@ -2,8 +2,13 @@
# CHANGES:
# - some_str is replaced, trying to create unicode strings
#
from __future__ import absolute_import, division, print_function, unicode_literals
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals
import types
from six import text_type

View File

@ -1,19 +1,27 @@
from __future__ import absolute_import, division, print_function
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import inspect
import pprint
import re
import sys
import traceback
from inspect import CO_VARARGS, CO_VARKEYWORDS
from inspect import CO_VARARGS
from inspect import CO_VARKEYWORDS
from weakref import ref
import attr
import pluggy
import re
from weakref import ref
import _pytest
from _pytest.compat import _PY2, _PY3, PY35, safe_str
from six import text_type
import py
import six
from six import text_type
import _pytest
from _pytest.compat import _PY2
from _pytest.compat import _PY3
from _pytest.compat import PY35
from _pytest.compat import safe_str
builtin_repr = repr

View File

@ -1,15 +1,18 @@
from __future__ import absolute_import, division, print_function
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import ast
from ast import PyCF_ONLY_AST as _AST_FLAG
from bisect import bisect_right
import inspect
import linecache
import sys
import six
import inspect
import textwrap
import tokenize
from ast import PyCF_ONLY_AST as _AST_FLAG
from bisect import bisect_right
import py
import six
cpy_compile = compile

View File

@ -1,13 +1,17 @@
"""
support for presenting detailed information in failing assertions.
"""
from __future__ import absolute_import, division, print_function
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import sys
import six
from _pytest.assertion import util
from _pytest.assertion import rewrite
from _pytest.assertion import truncate
from _pytest.assertion import util
def pytest_addoption(parser):

View File

@ -1,13 +1,15 @@
"""Rewrite assertion AST to produce nice error messages"""
from __future__ import absolute_import, division, print_function
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import ast
import errno
import itertools
import imp
import itertools
import marshal
import os
import re
import six
import string
import struct
import sys
@ -15,11 +17,12 @@ import types
import atomicwrites
import py
import six
from _pytest.assertion import util
from _pytest.pathlib import PurePath
from _pytest.compat import spec_from_file_location
from _pytest.pathlib import fnmatch_ex
from _pytest.pathlib import PurePath
# pytest caches rewritten pycs in __pycache__.
if hasattr(imp, "get_tag"):

View File

@ -4,7 +4,10 @@ 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
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import os
import six

View File

@ -1,10 +1,14 @@
"""Utilities for assertion debugging"""
from __future__ import absolute_import, division, print_function
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import pprint
import _pytest._code
import py
import six
import _pytest._code
from ..compat import Sequence
u = six.text_type

View File

@ -4,18 +4,22 @@ 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 __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import json
from collections import OrderedDict
import attr
import py
import six
import attr
import pytest
import json
from .compat import _PY2 as PY2
from .pathlib import Path, resolve_from_str, rmtree
from .pathlib import Path
from .pathlib import resolve_from_str
from .pathlib import rmtree
README_CONTENT = u"""\
# pytest cache directory #

View File

@ -2,17 +2,20 @@
per-test stdout/stderr capturing mechanism.
"""
from __future__ import absolute_import, division, print_function
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import collections
import contextlib
import sys
import os
import io
import os
import sys
from io import UnsupportedOperation
from tempfile import TemporaryFile
import six
import pytest
from _pytest.compat import CaptureIO

View File

@ -1,7 +1,9 @@
"""
python version compatibility code
"""
from __future__ import absolute_import, division, print_function
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import codecs
import functools
@ -11,11 +13,12 @@ import sys
from contextlib import contextmanager
import py
import six
from six import text_type
import _pytest
from _pytest.outcomes import TEST_OUTCOME, fail
from six import text_type
import six
from _pytest.outcomes import fail
from _pytest.outcomes import TEST_OUTCOME
try:
import enum

View File

@ -1,28 +1,35 @@
""" command line options, ini-file and conftest.py processing. """
from __future__ import absolute_import, division, print_function
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import argparse
import copy
import inspect
import os
import shlex
import sys
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 py
import six
from pluggy import HookimplMarker
from pluggy import HookspecMarker
from pluggy import PluginManager
import _pytest._code
import _pytest.hookspec # the extension point definitions
import _pytest.assertion
from pluggy import PluginManager, HookimplMarker, HookspecMarker
from _pytest._code import ExceptionInfo, filter_traceback
import _pytest.hookspec # the extension point definitions
from .exceptions import PrintHelp
from .exceptions import UsageError
from .findpaths import determine_setup
from .findpaths import exists
from _pytest._code import ExceptionInfo
from _pytest._code import filter_traceback
from _pytest.compat import lru_cache
from _pytest.compat import safe_str
from .exceptions import UsageError, PrintHelp
from .findpaths import determine_setup, exists
from _pytest.outcomes import Skipped
hookimpl = HookimplMarker("pytest")
hookspec = HookspecMarker("pytest")

View File

@ -1,11 +1,10 @@
import six
import warnings
import argparse
from gettext import gettext as _
import sys as _sys
import warnings
from gettext import gettext as _
import py
import six
from ..main import EXIT_USAGEERROR

View File

@ -1,5 +1,7 @@
import py
import os
import py
from .exceptions import UsageError

View File

@ -1,7 +1,8 @@
""" interactive debugging with PDB, the Python Debugger. """
from __future__ import absolute_import, division, print_function
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import os
import pdb
import sys
from doctest import UnexpectedException
@ -9,13 +10,6 @@ from doctest import UnexpectedException
from _pytest import outcomes
from _pytest.config import hookimpl
try:
from builtins import breakpoint # noqa
SUPPORTS_BREAKPOINT_BUILTIN = True
except ImportError:
SUPPORTS_BREAKPOINT_BUILTIN = False
def pytest_addoption(parser):
group = parser.getgroup("general")
@ -53,20 +47,12 @@ def pytest_configure(config):
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

View File

@ -8,14 +8,13 @@ be removed when the time comes.
All constants defined in this module should be either PytestWarning instances or UnformattedWarning
in case of warnings which need to format their messages.
"""
from __future__ import absolute_import, division, print_function
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from _pytest.warning_types import (
UnformattedWarning,
RemovedInPytest4Warning,
PytestDeprecationWarning,
)
from _pytest.warning_types import PytestDeprecationWarning
from _pytest.warning_types import RemovedInPytest4Warning
from _pytest.warning_types import UnformattedWarning
MAIN_STR_ARGS = RemovedInPytest4Warning(

View File

@ -1,12 +1,16 @@
""" discover and run doctests in modules and test files."""
from __future__ import absolute_import, division, print_function
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import traceback
import sys
import platform
import sys
import traceback
import pytest
from _pytest._code.code import ExceptionInfo, ReprFileLocation, TerminalRepr
from _pytest._code.code import ExceptionInfo
from _pytest._code.code import ReprFileLocation
from _pytest._code.code import TerminalRepr
from _pytest.fixtures import FixtureRequest

View File

@ -1,39 +1,42 @@
from __future__ import absolute_import, division, print_function
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import functools
import inspect
import sys
import warnings
from collections import OrderedDict, deque, defaultdict
import six
from more_itertools import flatten
from collections import defaultdict
from collections import deque
from collections import OrderedDict
import attr
import py
import six
from more_itertools import flatten
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,
get_real_method,
_PytestWrapper,
)
from _pytest.deprecated import FIXTURE_FUNCTION_CALL, FIXTURE_NAMED_REQUEST
from _pytest.outcomes import fail, TEST_OUTCOME
from _pytest.compat import _format_args
from _pytest.compat import _PytestWrapper
from _pytest.compat import exc_clear
from _pytest.compat import FuncargnamesCompatAttr
from _pytest.compat import get_real_func
from _pytest.compat import get_real_method
from _pytest.compat import getfslineno
from _pytest.compat import getfuncargnames
from _pytest.compat import getimfunc
from _pytest.compat import getlocation
from _pytest.compat import is_generator
from _pytest.compat import isclass
from _pytest.compat import NOTSET
from _pytest.compat import safe_getattr
from _pytest.deprecated import FIXTURE_FUNCTION_CALL
from _pytest.deprecated import FIXTURE_NAMED_REQUEST
from _pytest.outcomes import fail
from _pytest.outcomes import TEST_OUTCOME
FIXTURE_MSG = 'fixtures cannot have "pytest_funcarg__" prefix and be decorated with @pytest.fixture:\n{}'

View File

@ -2,7 +2,9 @@
Provides a function to report all internal modules for using freezing tools
pytest
"""
from __future__ import absolute_import, division, print_function
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
def freeze_includes():

View File

@ -1,13 +1,17 @@
""" version info, help messages, tracing configuration. """
from __future__ import absolute_import, division, print_function
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import py
import pytest
from _pytest.config import PrintHelp
import os
import sys
from argparse import Action
import py
import pytest
from _pytest.config import PrintHelp
class HelpAction(Action):
"""This is an argparse Action that will raise an exception in

View File

@ -1,6 +1,6 @@
""" hook specifications for pytest plugins, invoked from main.py and builtin plugins. """
from pluggy import HookspecMarker
from .deprecated import PYTEST_NAMESPACE

View File

@ -8,14 +8,18 @@ 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
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import functools
import py
import os
import re
import sys
import time
import py
import pytest
from _pytest import nodes
from _pytest.config import filename_arg

View File

@ -1,15 +1,18 @@
""" Access and control log capturing. """
from __future__ import absolute_import, division, print_function
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import logging
from contextlib import contextmanager
import re
from contextlib import contextmanager
import py
import six
import pytest
from _pytest.compat import dummy_context_manager
from _pytest.config import create_terminal_writer
import pytest
import py
DEFAULT_LOG_FORMAT = "%(filename)-25s %(lineno)4d %(levelname)-8s %(message)s"
@ -263,7 +266,7 @@ class LogCaptureFixture(object):
@property
def record_tuples(self):
"""Returns a list of a striped down version of log records intended
"""Returns a list of a stripped down version of log records intended
for use in assertion comparison.
The format of the tuple is:
@ -330,7 +333,7 @@ class LogCaptureFixture(object):
def caplog(request):
"""Access and control log capturing.
Captured logs are available through the following methods::
Captured logs are available through the following properties/methods::
* caplog.text -> string containing formatted log output
* caplog.records -> list of logging.LogRecord instances

View File

@ -1,19 +1,22 @@
""" core implementation of testing process: init, session, runtest loop. """
from __future__ import absolute_import, division, print_function
from __future__ import absolute_import
from __future__ import division
from __future__ import 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
import six
from _pytest.config import directory_arg, UsageError, hookimpl
import _pytest._code
from _pytest import nodes
from _pytest.config import directory_arg
from _pytest.config import hookimpl
from _pytest.config import UsageError
from _pytest.outcomes import exit
from _pytest.runner import collect_one_node

View File

@ -1,18 +1,20 @@
""" generic mechanism for marking and selecting python functions. """
from __future__ import absolute_import, division, print_function
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from .legacy import matchkeyword
from .legacy import matchmark
from .structures import EMPTY_PARAMETERSET_OPTION
from .structures import get_empty_parameterset_mark
from .structures import Mark
from .structures import MARK_GEN
from .structures import MarkDecorator
from .structures import MarkGenerator
from .structures import MarkInfo
from .structures import ParameterSet
from .structures import transfer_markers
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",

View File

@ -1,10 +1,12 @@
import os
import six
import sys
import platform
import sys
import traceback
from ..outcomes import fail, TEST_OUTCOME
import six
from ..outcomes import fail
from ..outcomes import TEST_OUTCOME
def cached_eval(config, expr, d):

View File

@ -2,9 +2,10 @@
this is a place where we put datastructures used by legacy apis
we hope ot remove
"""
import attr
import keyword
import attr
from _pytest.config import UsageError

View File

@ -5,12 +5,15 @@ from functools import reduce
from operator import attrgetter
import attr
from _pytest.outcomes import fail
from ..deprecated import MARK_PARAMETERSET_UNPACKING, MARK_INFO_ATTRIBUTE
from ..compat import NOTSET, getfslineno, MappingMixin
from six.moves import map
from ..compat import getfslineno
from ..compat import MappingMixin
from ..compat import NOTSET
from ..deprecated import MARK_INFO_ATTRIBUTE
from ..deprecated import MARK_PARAMETERSET_UNPACKING
from _pytest.outcomes import fail
EMPTY_PARAMETERSET_OPTION = "empty_parameter_set_mark"

View File

@ -1,9 +1,11 @@
""" monkeypatching and mocking functionality. """
from __future__ import absolute_import, division, print_function
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import os
import sys
import re
import sys
import warnings
from contextlib import contextmanager

View File

@ -1,18 +1,20 @@
from __future__ import absolute_import, division, print_function
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import os
import warnings
import six
import py
import attr
import py
import six
import _pytest
import _pytest._code
from _pytest.compat import getfslineno
from _pytest.mark.structures import MarkInfo
from _pytest.mark.structures import NodeKeywords
from _pytest.outcomes import fail
from _pytest.mark.structures import NodeKeywords, MarkInfo
SEP = "/"
tracebackcutdir = py.path.local(_pytest.__file__).dirpath()

View File

@ -1,9 +1,13 @@
""" run test suites written for nose. """
from __future__ import absolute_import, division, print_function
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import sys
from _pytest import unittest, runner, python
from _pytest import python
from _pytest import runner
from _pytest import unittest
from _pytest.config import hookimpl

View File

@ -2,7 +2,10 @@
exception classes and constants handling test outcomes
as well as functions creating them
"""
from __future__ import absolute_import, division, print_function
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import sys

View File

@ -1,11 +1,15 @@
""" submit failure or test session information to a pastebin service. """
from __future__ import absolute_import, division, print_function
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import pytest
import six
import sys
import tempfile
import six
import pytest
def pytest_addoption(parser):
group = parser.getgroup("terminal reporting")

View File

@ -1,18 +1,21 @@
import os
import errno
import atexit
import operator
import six
import sys
from functools import reduce
import uuid
from six.moves import map
import itertools
import shutil
from os.path import expanduser, expandvars, isabs, sep
from posixpath import sep as posix_sep
import errno
import fnmatch
import itertools
import operator
import os
import shutil
import sys
import uuid
from functools import reduce
from os.path import expanduser
from os.path import expandvars
from os.path import isabs
from os.path import sep
from posixpath import sep as posix_sep
import six
from six.moves import map
from .compat import PY36

View File

@ -1,5 +1,7 @@
"""(disabled by default) support for testing pytest and pytest plugins."""
from __future__ import absolute_import, division, print_function
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import codecs
import gc
@ -7,23 +9,25 @@ 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
from _pytest.main import Session, EXIT_INTERRUPTED, EXIT_OK
from _pytest.assertion.rewrite import AssertionRewritingHook
from _pytest.pathlib import Path
from _pytest.compat import safe_str
import py
import six
import pytest
from _pytest._code import Source
from _pytest.assertion.rewrite import AssertionRewritingHook
from _pytest.capture import MultiCapture
from _pytest.capture import SysCapture
from _pytest.compat import safe_str
from _pytest.main import EXIT_INTERRUPTED
from _pytest.main import EXIT_OK
from _pytest.main import Session
from _pytest.pathlib import Path
IGNORE_PAM = [ # filenames added when obtaining details about the current user
u"/var/lib/sss/mc/passwd"

View File

@ -1,50 +1,48 @@
""" Python test discovery, setup and run of test functions. """
from __future__ import absolute_import, division, print_function
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import collections
import fnmatch
import inspect
import sys
import os
import collections
import sys
import warnings
from textwrap import dedent
import py
import six
from _pytest.main import FSHookProxy
from _pytest.config import hookimpl
import _pytest
from _pytest._code import filter_traceback
from _pytest import deprecated
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,
getimfunc,
)
from _pytest._code import filter_traceback
from _pytest.compat import ascii_escaped
from _pytest.compat import enum
from _pytest.compat import get_default_arg_names
from _pytest.compat import get_real_func
from _pytest.compat import getfslineno
from _pytest.compat import getimfunc
from _pytest.compat import getlocation
from _pytest.compat import is_generator
from _pytest.compat import isclass
from _pytest.compat import isfunction
from _pytest.compat import NoneType
from _pytest.compat import NOTSET
from _pytest.compat import REGEX_TYPE
from _pytest.compat import safe_getattr
from _pytest.compat import safe_str
from _pytest.compat import STRING_TYPES
from _pytest.config import hookimpl
from _pytest.main import FSHookProxy
from _pytest.mark.structures import get_unpacked_marks
from _pytest.mark.structures import normalize_mark_list
from _pytest.mark.structures import transfer_markers
from _pytest.outcomes import fail
from _pytest.mark.structures import (
transfer_markers,
get_unpacked_marks,
normalize_mark_list,
)
from _pytest.warning_types import RemovedInPytest4Warning, PytestWarning
from _pytest.warning_types import PytestWarning
from _pytest.warning_types import RemovedInPytest4Warning
def pyobj_property(name):

View File

@ -1,20 +1,20 @@
import math
import pprint
import sys
from numbers import Number
from decimal import Decimal
from numbers import Number
import six
from six.moves import zip, filterfalse
from more_itertools.more import always_iterable
from six.moves import filterfalse
from six.moves import zip
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
from _pytest.compat import isclass
from _pytest.compat import Mapping
from _pytest.compat import Sequence
from _pytest.compat import STRING_TYPES
from _pytest.outcomes import fail
BASE_TYPE = (type, STRING_TYPES)

View File

@ -1,15 +1,16 @@
""" recording warnings during test function execution. """
from __future__ import absolute_import, division, print_function
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import inspect
import _pytest._code
import re
import sys
import warnings
import six
import _pytest._code
from _pytest.fixtures import yield_fixture
from _pytest.outcomes import fail

View File

@ -1,4 +1,5 @@
import py
from _pytest._code.code import TerminalRepr

View File

@ -1,10 +1,13 @@
""" log machine-parseable test session result information in a plain
text file.
"""
from __future__ import absolute_import, division, print_function
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import os
import py
import os
def pytest_addoption(parser):

View File

@ -1,5 +1,7 @@
""" basic collect and runtest protocol implementations """
from __future__ import absolute_import, division, print_function
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import bdb
import os
@ -7,10 +9,14 @@ import sys
from time import time
import six
from _pytest._code.code import ExceptionInfo
from _pytest.outcomes import skip, Skipped, TEST_OUTCOME
from .reports import TestReport, CollectReport, CollectErrorRepr
from .reports import CollectErrorRepr
from .reports import CollectReport
from .reports import TestReport
from _pytest._code.code import ExceptionInfo
from _pytest.outcomes import skip
from _pytest.outcomes import Skipped
from _pytest.outcomes import TEST_OUTCOME
#
# pytest plugin hooks

View File

@ -1,7 +1,10 @@
from __future__ import absolute_import, division, print_function
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import sys
import pytest
import sys
def pytest_addoption(parser):

View File

@ -1,4 +1,6 @@
from __future__ import absolute_import, division, print_function
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import pytest

View File

@ -1,9 +1,13 @@
""" support for skip/xfail functions and markers. """
from __future__ import absolute_import, division, print_function
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from _pytest.config import hookimpl
from _pytest.mark.evaluate import MarkEvaluator
from _pytest.outcomes import fail, skip, xfail
from _pytest.outcomes import fail
from _pytest.outcomes import skip
from _pytest.outcomes import xfail
def pytest_addoption(parser):

View File

@ -2,8 +2,11 @@
This is a good source for looking at the various reporting hooks.
"""
from __future__ import absolute_import, division, print_function
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import argparse
import itertools
import platform
import sys
@ -17,16 +20,11 @@ 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
from _pytest.main import EXIT_INTERRUPTED
from _pytest.main import EXIT_NOTESTSCOLLECTED
from _pytest.main import EXIT_OK
from _pytest.main import EXIT_TESTSFAILED
from _pytest.main import EXIT_USAGEERROR
class MoreQuietAction(argparse.Action):
@ -736,11 +734,10 @@ class TerminalReporter(object):
# legacy warnings show their location explicitly, while standard warnings look better without
# it because the location is already formatted into the message
warning_records = list(warning_records)
is_legacy = warning_records[0].legacy
if location and is_legacy:
if location:
self._tw.line(str(location))
for w in warning_records:
if is_legacy:
if location:
lines = w.message.splitlines()
indented = "\n".join(" " + x for x in lines)
message = indented.rstrip()

View File

@ -1,22 +1,23 @@
""" support for providing temporary directories to test functions. """
from __future__ import absolute_import, division, print_function
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import os
import re
import pytest
import py
from _pytest.monkeypatch import MonkeyPatch
import attr
import tempfile
import warnings
from .pathlib import (
Path,
make_numbered_dir,
make_numbered_dir_with_cleanup,
ensure_reset_dir,
LOCK_TIMEOUT,
)
import attr
import py
import pytest
from .pathlib import ensure_reset_dir
from .pathlib import LOCK_TIMEOUT
from .pathlib import make_numbered_dir
from .pathlib import make_numbered_dir_with_cleanup
from .pathlib import Path
from _pytest.monkeypatch import MonkeyPatch
@attr.s

View File

@ -1,15 +1,21 @@
""" discovery and running of std-library "unittest" style tests. """
from __future__ import absolute_import, division, print_function
from __future__ import absolute_import
from __future__ import division
from __future__ import 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.compat import getimfunc
from _pytest.config import hookimpl
from _pytest.outcomes import fail
from _pytest.outcomes import skip
from _pytest.outcomes import xfail
from _pytest.python import Class
from _pytest.python import Function
from _pytest.python import Module
from _pytest.python import transfer_markers
def pytest_pycollect_makeitem(collector, name, obj):

View File

@ -1,11 +1,12 @@
from __future__ import absolute_import, division, print_function
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import sys
import warnings
from contextlib import contextmanager
import pytest
from _pytest import compat

View File

@ -2,30 +2,44 @@
"""
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.assertion import register_assert_rewrite
from _pytest.config import cmdline
from _pytest.config import hookimpl
from _pytest.config import hookspec
from _pytest.config import main
from _pytest.config import UsageError
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 Package, Module, Class, Instance, Function, Generator
from _pytest.python_api import approx, raises
from _pytest.warning_types import (
PytestWarning,
PytestDeprecationWarning,
RemovedInPytest4Warning,
PytestExperimentalApiWarning,
)
from _pytest.fixtures import fixture
from _pytest.fixtures import yield_fixture
from _pytest.freeze_support import freeze_includes
from _pytest.main import Session
from _pytest.mark import MARK_GEN as mark
from _pytest.mark import param
from _pytest.nodes import Collector
from _pytest.nodes import File
from _pytest.nodes import Item
from _pytest.outcomes import exit
from _pytest.outcomes import fail
from _pytest.outcomes import importorskip
from _pytest.outcomes import skip
from _pytest.outcomes import xfail
from _pytest.python import Class
from _pytest.python import Function
from _pytest.python import Generator
from _pytest.python import Instance
from _pytest.python import Module
from _pytest.python import Package
from _pytest.python_api import approx
from _pytest.python_api import raises
from _pytest.recwarn import deprecated_call
from _pytest.recwarn import warns
from _pytest.warning_types import PytestDeprecationWarning
from _pytest.warning_types import PytestExperimentalApiWarning
from _pytest.warning_types import PytestWarning
from _pytest.warning_types import RemovedInPytest4Warning
set_trace = __pytestPDB.set_trace

View File

@ -1,15 +1,19 @@
# -*- coding: utf-8 -*-
from __future__ import absolute_import, division, print_function
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import os
import sys
import textwrap
import types
import py
import six
import py
import pytest
from _pytest.main import EXIT_NOTESTSCOLLECTED, EXIT_USAGEERROR
from _pytest.main import EXIT_NOTESTSCOLLECTED
from _pytest.main import EXIT_USAGEERROR
def prepend_pythonpath(*dirs):

View File

@ -1,13 +1,15 @@
# coding: utf-8
from __future__ import absolute_import, division, print_function
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import sys
from six import text_type
from test_excinfo import TWMock
import _pytest._code
import pytest
from six import text_type
from test_excinfo import TWMock
try:
import mock

View File

@ -1,24 +1,25 @@
# -*- coding: utf-8 -*-
from __future__ import absolute_import, division, print_function
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import operator
import os
import sys
import textwrap
import _pytest
import py
import pytest
import six
from _pytest._code.code import (
ExceptionInfo,
FormattedExcinfo,
ReprExceptionInfo,
ExceptionChainRepr,
)
from six.moves import queue
import py
import six
from six.moves import queue
from test_source import astonly
import _pytest
import pytest
from _pytest._code.code import ExceptionChainRepr
from _pytest._code.code import ExceptionInfo
from _pytest._code.code import FormattedExcinfo
from _pytest._code.code import ReprExceptionInfo
try:
import importlib
except ImportError:

View File

@ -2,13 +2,17 @@
# 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
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import inspect
import sys
import six
import _pytest._code
import pytest
import six
from _pytest._code import Source
from _pytest._code.source import ast

View File

@ -1,4 +1,6 @@
from __future__ import absolute_import, division, print_function
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import os

View File

@ -1,6 +1,7 @@
import pytest
import pprint
import pytest
def pytest_generate_tests(metafunc):
if "arg1" in metafunc.fixturenames:

View File

@ -1,6 +1,7 @@
import pytest
import unittest
import pytest
@pytest.fixture(params=[1, 2])
def two(request):

View File

@ -1,6 +1,7 @@
import logging
import py.io
from _pytest.logging import ColoredLevelFormatter

View File

@ -1,6 +1,6 @@
# -*- coding: utf-8 -*-
import re
import os
import re
from io import open
import six

View File

@ -1,13 +1,14 @@
# encoding: utf-8
import doctest
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
from operator import eq
from operator import ne
import pytest
from pytest import approx
inf, nan = float("inf"), float("nan")

View File

@ -3,10 +3,11 @@ import sys
import textwrap
import pytest
from _pytest.pytester import get_public_names
from _pytest.fixtures import FixtureLookupError, FixtureRequest
from _pytest import fixtures
from _pytest.fixtures import FixtureLookupError
from _pytest.fixtures import FixtureRequest
from _pytest.pathlib import Path
from _pytest.pytester import get_public_names
def test_getfuncargnames():

View File

@ -1,14 +1,16 @@
# -*- coding: utf-8 -*-
import re
import sys
import attr
import textwrap
import pytest
from _pytest import python, fixtures
import attr
import hypothesis
from hypothesis import strategies
import pytest
from _pytest import fixtures
from _pytest import python
PY3 = sys.version_info >= (3, 0)

View File

@ -1,7 +1,8 @@
from _pytest.outcomes import Failed
import pytest
import sys
import pytest
from _pytest.outcomes import Failed
class TestRaises(object):
def test_raises(self):

View File

@ -1,6 +1,10 @@
from __future__ import absolute_import, division, print_function
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import subprocess
import sys
import pytest
# test for _argcomplete but not specific for any application

View File

@ -1,14 +1,18 @@
# -*- coding: utf-8 -*-
from __future__ import absolute_import, division, print_function
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import sys
import textwrap
import _pytest.assertion as plugin
import py
import pytest
import six
from _pytest.assertion import util
import _pytest.assertion as plugin
import pytest
from _pytest.assertion import truncate
from _pytest.assertion import util
PY3 = sys.version_info >= (3, 0)

View File

@ -1,5 +1,7 @@
# -*- coding: utf-8 -*-
from __future__ import absolute_import, division, print_function
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import glob
import os
@ -8,17 +10,16 @@ import stat
import sys
import textwrap
import zipfile
import py
import pytest
import six
import _pytest._code
import pytest
from _pytest.assertion import util
from _pytest.assertion.rewrite import (
rewrite_asserts,
PYTEST_TAG,
AssertionRewritingHook,
)
from _pytest.assertion.rewrite import AssertionRewritingHook
from _pytest.assertion.rewrite import PYTEST_TAG
from _pytest.assertion.rewrite import rewrite_asserts
from _pytest.main import EXIT_NOTESTSCOLLECTED
ast = pytest.importorskip("ast")

View File

@ -1,12 +1,15 @@
from __future__ import absolute_import, division, print_function
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import os
import shutil
import sys
import textwrap
import py
import pytest
import os
import shutil
pytest_plugins = ("pytester",)

View File

@ -1,22 +1,26 @@
# -*- coding: utf-8 -*-
from __future__ import absolute_import, division, print_function
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
# note: py.io capture tests where copied from
# pylib 1.4.20.dev2 (rev 13d9af95547e)
import pickle
import contextlib
import os
import pickle
import sys
import textwrap
from io import UnsupportedOperation
import py
import pytest
import contextlib
from six import text_type
import pytest
from _pytest import capture
from _pytest.capture import CaptureManager
from _pytest.main import EXIT_NOTESTSCOLLECTED
# note: py.io capture tests where copied from
# pylib 1.4.20.dev2 (rev 13d9af95547e)
needsosdup = pytest.mark.skipif(
not hasattr(os, "dup"), reason="test needs os.dup, not available on this platform"

View File

@ -1,10 +1,15 @@
from __future__ import absolute_import, division, print_function
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import pprint
import sys
import textwrap
import pytest
from _pytest.main import Session, EXIT_NOTESTSCOLLECTED, _in_venv
import pytest
from _pytest.main import _in_venv
from _pytest.main import EXIT_NOTESTSCOLLECTED
from _pytest.main import Session
class TestCollector(object):

View File

@ -1,11 +1,17 @@
from __future__ import absolute_import, division, print_function
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import sys
from functools import wraps
import six
import pytest
from _pytest.compat import is_generator, get_real_func, safe_getattr, _PytestWrapper
from _pytest.compat import _PytestWrapper
from _pytest.compat import get_real_func
from _pytest.compat import is_generator
from _pytest.compat import safe_getattr
from _pytest.outcomes import OutcomeException

View File

@ -1,11 +1,16 @@
from __future__ import absolute_import, division, print_function
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import sys
import textwrap
import pytest
import _pytest._code
from _pytest.config.findpaths import getcfg, get_common_ancestor, determine_setup
import pytest
from _pytest.config import _iter_rewritable_modules
from _pytest.config.findpaths import determine_setup
from _pytest.config.findpaths import get_common_ancestor
from _pytest.config.findpaths import getcfg
from _pytest.main import EXIT_NOTESTSCOLLECTED

View File

@ -1,10 +1,16 @@
from __future__ import absolute_import, division, print_function
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import textwrap
import py
import pytest
from _pytest.config import PytestPluginManager
from _pytest.main import EXIT_NOTESTSCOLLECTED, EXIT_OK, EXIT_USAGEERROR
from _pytest.main import EXIT_NOTESTSCOLLECTED
from _pytest.main import EXIT_OK
from _pytest.main import EXIT_USAGEERROR
@pytest.fixture(scope="module", params=["global", "inpackage"])

View File

@ -1,10 +1,16 @@
# encoding: utf-8
from __future__ import absolute_import, division, print_function
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import sys
import textwrap
from _pytest.compat import MODULE_NOT_FOUND_ERROR
from _pytest.doctest import DoctestItem, DoctestModule, DoctestTextfile
import pytest
from _pytest.compat import MODULE_NOT_FOUND_ERROR
from _pytest.doctest import DoctestItem
from _pytest.doctest import DoctestModule
from _pytest.doctest import DoctestTextfile
class TestDoctests(object):

View File

@ -1,4 +1,7 @@
from __future__ import absolute_import, division, print_function
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import pkg_resources
import pytest

View File

@ -1,6 +1,9 @@
from __future__ import absolute_import, division, print_function
from _pytest.main import EXIT_NOTESTSCOLLECTED
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import pytest
from _pytest.main import EXIT_NOTESTSCOLLECTED
def test_version(testdir, pytestconfig):

View File

@ -1,12 +1,16 @@
# -*- coding: utf-8 -*-
from __future__ import absolute_import, division, print_function
from xml.dom import minidom
import py
import sys
import os
from _pytest.junitxml import LogXML
import pytest
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import os
import sys
from xml.dom import minidom
import py
import pytest
from _pytest.junitxml import LogXML
from _pytest.reports import BaseReport

View File

@ -1,4 +1,7 @@
from __future__ import absolute_import, division, print_function
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import os
import sys

View File

@ -1,8 +1,10 @@
import py
import subprocess
import sys
import pytest
import py
import _pytest
import pytest
MODSET = [
x

View File

@ -1,4 +1,7 @@
from __future__ import absolute_import, division, print_function
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import os
import sys
import textwrap

View File

@ -1,5 +1,4 @@
import pytest
from _pytest import nodes

View File

@ -1,4 +1,7 @@
from __future__ import absolute_import, division, print_function
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import pytest

View File

@ -1,8 +1,13 @@
from __future__ import absolute_import, division, print_function
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import argparse
import sys
import os
import sys
import py
import pytest
from _pytest.config import argparsing as parseopt

View File

@ -1,6 +1,10 @@
# encoding: utf-8
from __future__ import absolute_import, division, print_function
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import sys
import pytest

View File

@ -3,7 +3,6 @@ import sys
import py
import pytest
from _pytest.pathlib import fnmatch_ex

Some files were not shown because too many files have changed in this diff Show More