Skip to content

Commit

Permalink
Bump pre-commit, fix errors (#1586)
Browse files Browse the repository at this point in the history
Signed-off-by: Bernat Gabor <bgabor8@bloomberg.net>
  • Loading branch information
gaborbernat committed May 20, 2020
1 parent e62d69c commit a1ccb95
Show file tree
Hide file tree
Showing 48 changed files with 463 additions and 429 deletions.
123 changes: 74 additions & 49 deletions .pre-commit-config.yaml
@@ -1,52 +1,77 @@
---
default_language_version:
# force all unspecified python hooks to run python3
python: python3
repos:
- repo: https://github.com/psf/black
rev: 19.10b0
hooks:
- id: black
args: [--safe]
language_version: python3.8
- repo: https://github.com/asottile/blacken-docs
rev: v1.6.0
hooks:
- id: blacken-docs
additional_dependencies: [black==19.10b0]
language_version: python3.8
- repo: https://github.com/asottile/seed-isort-config
rev: v2.1.1
hooks:
- id: seed-isort-config
args: [--application-directories, "src:."]
- repo: https://github.com/pre-commit/mirrors-isort
rev: v4.3.21
hooks:
- id: isort
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v2.5.0
hooks:
- id: trailing-whitespace
- id: end-of-file-fixer
- id: check-yaml
- id: debug-statements
- id: flake8
additional_dependencies: ["flake8-bugbear == 20.1.4"]
language_version: python3.8
- repo: https://github.com/asottile/pyupgrade
rev: v2.3.0
hooks:
- id: pyupgrade
- repo: https://github.com/pre-commit/pygrep-hooks
rev: v1.5.1
hooks:
- id: rst-backticks
- repo: local
hooks:
- id: changelogs-rst
name: changelog filenames
language: fail
entry: 'changelog files must be named ####.(bugfix|feature|deprecation|breaking|doc|misc).rst'
exclude: ^docs/changelog/(\d+\.(bugfix|feature|deprecation|breaking|doc|misc).rst|README.rst|template.jinja2)
files: ^docs/changelog/
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v3.0.1
hooks:
- id: check-ast
- id: check-builtin-literals
- id: check-docstring-first
- id: check-merge-conflict
- id: check-yaml
- id: check-toml
- id: debug-statements
- id: end-of-file-fixer
- id: trailing-whitespace
- repo: https://github.com/asottile/add-trailing-comma
rev: v2.0.1
hooks:
- id: add-trailing-comma
- repo: https://github.com/asottile/pyupgrade
rev: v2.4.3
hooks:
- id: pyupgrade
- repo: https://github.com/asottile/seed-isort-config
rev: v2.1.1
hooks:
- id: seed-isort-config
args:
- --application-directories
- .:src
- repo: https://github.com/pre-commit/mirrors-isort
rev: v4.3.21
hooks:
- id: isort
- repo: https://github.com/ambv/black
rev: 19.10b0
hooks:
- id: black
args:
- --safe
language_version: python3.8
- repo: https://github.com/asottile/blacken-docs
rev: v1.7.0
hooks:
- id: blacken-docs
additional_dependencies:
- black==19.10b0
language_version: python3.8
- repo: https://github.com/pre-commit/pygrep-hooks
rev: v1.5.1
hooks:
- id: rst-backticks
- repo: https://github.com/asottile/setup-cfg-fmt
rev: v1.9.0
hooks:
- id: setup-cfg-fmt
args:
- --min-py3-version
- '3.4'
- repo: https://gitlab.com/pycqa/flake8
rev: 3.8.1
hooks:
- id: flake8
additional_dependencies:
- flake8-bugbear == 20.1.2
language_version: python3.8
- repo: local
hooks:
- id: changelogs-rst
name: changelog filenames
language: fail
entry: >-
changelog files must be named
####.(bugfix|feature|deprecation|breaking|doc|misc).rst
exclude: >-
^docs/changelog/(\d+\.(bugfix|feature|deprecation|breaking|doc|misc).rst|README.rst|template.jinja2)
files: ^docs/changelog/
6 changes: 3 additions & 3 deletions docs/conf.py
Expand Up @@ -32,10 +32,10 @@ def generate_draft_news():
path.write_text(re.sub(pattern, replacement, path.read_text()))
env = os.environ.copy()
env["PATH"] += os.pathsep.join(
[os.path.dirname(sys.executable)] + env["PATH"].split(os.pathsep)
[os.path.dirname(sys.executable)] + env["PATH"].split(os.pathsep),
)
changelog = subprocess.check_output(
["towncrier", "--draft", "--version", "DRAFT"], cwd=str(ROOT_SRC_TREE_DIR), env=env
["towncrier", "--draft", "--version", "DRAFT"], cwd=str(ROOT_SRC_TREE_DIR), env=env,
).decode("utf-8")
if "No significant changes" in changelog:
content = ""
Expand Down Expand Up @@ -77,7 +77,7 @@ def generate_draft_news():
"fixed_sidebar": "false",
}
html_sidebars = {
"**": ["about.html", "localtoc.html", "relations.html", "searchbox.html", "donate.html"]
"**": ["about.html", "localtoc.html", "relations.html", "searchbox.html", "donate.html"],
}
html_show_sourcelink = False
html_static_path = ["_static"]
Expand Down
75 changes: 37 additions & 38 deletions setup.cfg
@@ -1,77 +1,76 @@
# -*- coding: utf-8 -*-
[metadata]
name = tox
description = tox is a generic virtualenv management and test command line tool
long_description = file: README.md
long_description_content_type = text/markdown
keywords = virtual, environments, isolated, testing
maintainer = Bernat Gabor, Oliver Bestwalter, Anthony Asottile
author = Holger Krekel, Oliver Bestwalter, Bernát Gábor and others
maintainer-email = tox-dev@python.org
url = http://tox.readthedocs.org
project_urls =
Source=https://github.com/tox-dev/tox
Tracker=https://github.com/tox-dev/tox/issues
platforms = any
author = Holger Krekel, Oliver Bestwalter, Bernát Gábor and others
license = MIT
license_file = LICENSE
platforms = any
classifiers =
Development Status :: 5 - Production/Stable
Framework :: tox
Intended Audience :: Developers
License :: OSI Approved :: MIT License
Operating System :: POSIX
Operating System :: Microsoft :: Windows
Operating System :: MacOS :: MacOS X
Topic :: Software Development :: Testing
Topic :: Software Development :: Libraries
Topic :: Utilities
Operating System :: Microsoft :: Windows
Operating System :: POSIX
Programming Language :: Python :: 2
Programming Language :: Python :: 2.7
Programming Language :: Python :: 3
Programming Language :: Python :: 3.5
Programming Language :: Python :: 3.6
Programming Language :: Python :: 3.7
Programming Language :: Python :: 3.8
Topic :: Software Development :: Libraries
Topic :: Software Development :: Testing
Topic :: Utilities
keywords = virtual, environments, isolated, testing
maintainer = Bernat Gabor, Oliver Bestwalter, Anthony Asottile
maintainer-email = tox-dev@python.org
project_urls =
Source=https://github.com/tox-dev/tox
Tracker=https://github.com/tox-dev/tox/issues

[options]
packages = find:
python_requires = >=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*, !=3.4.*
install_requires =
importlib-metadata >= 0.12, <2;python_version<"3.8"
packaging >= 14
pluggy >= 0.12.0, <1
py >= 1.4.17, <2
six >= 1.14.0, <2 # required when virtualenv>=20
virtualenv >= 16.0.0, !=20.0.0, !=20.0.1, !=20.0.2, !=20.0.3, !=20.0.4, !=20.0.5, !=20.0.6, !=20.0.7
toml >=0.9.4
filelock >= 3.0.0, <4
colorama >= 0.4.1 ;platform_system=="Windows"

[options.packages.find]
where = src
filelock>=3.0.0
packaging>=14
pluggy>=0.12.0
py>=1.4.17
six>=1.14.0 # required when virtualenv>=20
toml>=0.9.4
virtualenv!=20.0.0,!=20.0.1,!=20.0.2,!=20.0.3,!=20.0.4,!=20.0.5,!=20.0.6,!=20.0.7,>=16.0.0
colorama>=0.4.1 ;platform_system=="Windows"
importlib-metadata>=0.12,<2;python_version<"3.8"
python_requires = >=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*, !=3.4.*

[options.entry_points]
console_scripts =
tox=tox:cmdline
tox-quickstart=tox._quickstart:main

[options.extras_require]
testing =
freezegun >= 0.3.11, <1
pathlib2 >= 2.3.3, <3
pytest >= 4.0.0, <6
pytest-cov >= 2.5.1, <3
pytest-mock >= 1.10.0, <2
pytest-xdist >= 1.22.2, <2
pytest-randomly >= 1.0.0, <4
psutil >= 5.6.1, < 6; python_version != "3.4"
flaky >= 3.4.0, < 4
docs =
sphinx >= 2.0.0, < 3
sphinx >= 2.0.0
towncrier >= 18.5.0
pygments-github-lexers >= 0.0.5
sphinxcontrib-autoprogram >= 0.1.5
testing =
freezegun >= 0.3.11
pathlib2 >= 2.3.3
pytest >= 4.0.0
pytest-cov >= 2.5.1
pytest-mock >= 1.10.0
pytest-xdist >= 1.22.2
pytest-randomly >= 1.0.0
psutil >= 5.6.1; python_version != "3.4"
flaky >= 3.4.0

[options.packages.find]
where = src

[bdist_wheel]
universal = 1
2 changes: 1 addition & 1 deletion setup.py
Expand Up @@ -12,7 +12,7 @@
from __future__ import unicode_literals
__version__ = {version!r}
"""
""",
).lstrip(),
},
package_dir={"": "src"},
Expand Down
26 changes: 13 additions & 13 deletions src/tox/_pytestplugin.py
Expand Up @@ -183,7 +183,7 @@ def outlines(self):

def __repr__(self):
res = "RunResult(ret={}, args={!r}, out=\n{}\n, err=\n{})".format(
self.ret, self.args, self.out, self.err
self.ret, self.args, self.out, self.err,
)
if six.PY2:
return res.encode("UTF-8")
Expand All @@ -197,13 +197,13 @@ def assert_success(self, is_run_test_env=True):
msg = self.output()
assert self.ret == 0, msg
if is_run_test_env:
assert any(" congratulations :)" == l for l in reversed(self.outlines)), msg
assert any(" congratulations :)" == line for line in reversed(self.outlines)), msg

def assert_fail(self, is_run_test_env=True):
msg = self.output()
assert self.ret, msg
if is_run_test_env:
assert not any(" congratulations :)" == l for l in reversed(self.outlines)), msg
assert not any(" congratulations :)" == line for line in reversed(self.outlines)), msg


class ReportExpectMock:
Expand Down Expand Up @@ -233,8 +233,8 @@ def getnext(self, cat):
newindex += 1
raise LookupError(
"looking for {!r}, no reports found at >={:d} in {!r}".format(
cat, self._index + 1, self.instance.reported_lines
)
cat, self._index + 1, self.instance.reported_lines,
),
)

def expect(self, cat, messagepattern="*", invert=False):
Expand All @@ -251,14 +251,14 @@ def expect(self, cat, messagepattern="*", invert=False):
if fnmatch(lmsg, messagepattern):
if invert:
raise AssertionError(
"found {}({!r}), didn't expect it".format(cat, messagepattern)
"found {}({!r}), didn't expect it".format(cat, messagepattern),
)
return
if not invert:
raise AssertionError(
"looking for {}({!r}), no reports found at >={:d} in {!r}".format(
cat, messagepattern, self._index + 1, self.instance.reported_lines
)
cat, messagepattern, self._index + 1, self.instance.reported_lines,
),
)

def not_expect(self, cat, messagepattern="*"):
Expand Down Expand Up @@ -381,7 +381,7 @@ def initproj_(nameversion, filedefs=None, src_root=".", add_missing_setup_py=Tru
base = tmpdir.join(name)
src_root_path = _path_join(base, src_root)
assert base == src_root_path or src_root_path.relto(
base
base,
), "`src_root` must be the constructed project folder or its direct or indirect subfolder"

base.ensure(dir=1)
Expand All @@ -403,7 +403,7 @@ def initproj_(nameversion, filedefs=None, src_root=".", add_missing_setup_py=Tru
)
""".format(
**locals()
)
),
},
)
if not _filedefs_contains(base, filedefs, src_root_path.join(name)):
Expand All @@ -414,11 +414,11 @@ def initproj_(nameversion, filedefs=None, src_root=".", add_missing_setup_py=Tru
"__init__.py": textwrap.dedent(
'''
""" module {} """
__version__ = {!r}'''
__version__ = {!r}''',
)
.strip()
.format(name, version)
}
.format(name, version),
},
},
)
manifestlines = [
Expand Down

0 comments on commit a1ccb95

Please sign in to comment.