From e5f823a3a7b5b28718b6a210e1823096526b5229 Mon Sep 17 00:00:00 2001 From: Anthony Sottile Date: Tue, 29 Jan 2019 21:11:15 -0800 Subject: [PATCH 1/2] fixes for flake8 3.7 --- .pre-commit-config.yaml | 3 +++ src/_pytest/fixtures.py | 4 ++-- src/_pytest/logging.py | 2 +- src/_pytest/mark/structures.py | 4 ++-- src/_pytest/runner.py | 2 +- 5 files changed, 9 insertions(+), 6 deletions(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index be0881649..7b2e05643 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -21,6 +21,9 @@ repos: - id: debug-statements exclude: _pytest/debugging.py language_version: python3 +- repo: https://gitlab.com/pycqa/flake8 + rev: 3.7.0 + hooks: - id: flake8 language_version: python3 - repo: https://github.com/asottile/reorder_python_imports diff --git a/src/_pytest/fixtures.py b/src/_pytest/fixtures.py index fe7d53637..a2b340588 100644 --- a/src/_pytest/fixtures.py +++ b/src/_pytest/fixtures.py @@ -307,8 +307,8 @@ class FuncFixtureInfo(object): # fixture names specified via usefixtures and via autouse=True in fixture # definitions. initialnames = attr.ib(type=tuple) - names_closure = attr.ib() # type: List[str] - name2fixturedefs = attr.ib() # type: List[str, List[FixtureDef]] + names_closure = attr.ib() # List[str] + name2fixturedefs = attr.ib() # List[str, List[FixtureDef]] def prune_dependency_tree(self): """Recompute names_closure from initialnames and name2fixturedefs diff --git a/src/_pytest/logging.py b/src/_pytest/logging.py index 45fd5950d..0c47b8b51 100644 --- a/src/_pytest/logging.py +++ b/src/_pytest/logging.py @@ -217,7 +217,7 @@ class LogCaptureFixture(object): """Creates a new funcarg.""" self._item = item # dict of log name -> log level - self._initial_log_levels = {} # type: Dict[str, int] + self._initial_log_levels = {} # Dict[str, int] def _finalize(self): """Finalizes the fixture. diff --git a/src/_pytest/mark/structures.py b/src/_pytest/mark/structures.py index 49695b56f..c8a25d156 100644 --- a/src/_pytest/mark/structures.py +++ b/src/_pytest/mark/structures.py @@ -143,9 +143,9 @@ class Mark(object): #: name of the mark name = attr.ib(type=str) #: positional arguments of the mark decorator - args = attr.ib() # type: List[object] + args = attr.ib() # List[object] #: keyword arguments of the mark decorator - kwargs = attr.ib() # type: Dict[str, object] + kwargs = attr.ib() # Dict[str, object] def combined_with(self, other): """ diff --git a/src/_pytest/runner.py b/src/_pytest/runner.py index 538e13403..8357991fe 100644 --- a/src/_pytest/runner.py +++ b/src/_pytest/runner.py @@ -204,7 +204,7 @@ class CallInfo(object): """ Result/Exception info a function invocation. """ _result = attr.ib() - # type: Optional[ExceptionInfo] + # Optional[ExceptionInfo] excinfo = attr.ib() start = attr.ib() stop = attr.ib() From acece2369761ec95c83dffa435c023d62a89023f Mon Sep 17 00:00:00 2001 From: Anthony Sottile Date: Tue, 29 Jan 2019 21:13:32 -0800 Subject: [PATCH 2/2] pre-commit autoupdate --- .pre-commit-config.yaml | 10 +++++----- src/_pytest/config/__init__.py | 2 +- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 7b2e05643..36ecf79b8 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -1,7 +1,7 @@ exclude: doc/en/example/py2py3/test_py2.py repos: - repo: https://github.com/ambv/black - rev: 18.6b4 + rev: 18.9b0 hooks: - id: black args: [--safe, --quiet] @@ -13,7 +13,7 @@ repos: additional_dependencies: [black==18.9b0] language_version: python3 - repo: https://github.com/pre-commit/pre-commit-hooks - rev: v2.0.0 + rev: v2.1.0 hooks: - id: trailing-whitespace - id: end-of-file-fixer @@ -27,17 +27,17 @@ repos: - id: flake8 language_version: python3 - repo: https://github.com/asottile/reorder_python_imports - rev: v1.3.3 + rev: v1.3.5 hooks: - id: reorder-python-imports args: ['--application-directories=.:src'] - repo: https://github.com/asottile/pyupgrade - rev: v1.10.1 + rev: v1.11.1 hooks: - id: pyupgrade args: [--keep-percent-format] - repo: https://github.com/pre-commit/pygrep-hooks - rev: v1.1.0 + rev: v1.2.0 hooks: - id: rst-backticks - repo: local diff --git a/src/_pytest/config/__init__.py b/src/_pytest/config/__init__.py index 051eda79d..23e09ff40 100644 --- a/src/_pytest/config/__init__.py +++ b/src/_pytest/config/__init__.py @@ -437,7 +437,7 @@ class PytestPluginManager(PluginManager): and not self._using_pyargs ): from _pytest.deprecated import ( - PYTEST_PLUGINS_FROM_NON_TOP_LEVEL_CONFTEST + PYTEST_PLUGINS_FROM_NON_TOP_LEVEL_CONFTEST, ) fail(