Skip to content

Commit

Permalink
Merge pull request #43 from ymyzk/black
Browse files Browse the repository at this point in the history
Introduce black
  • Loading branch information
ymyzk authored Nov 6, 2020
2 parents 4300237 + 9af0e8d commit a063112
Show file tree
Hide file tree
Showing 4 changed files with 279 additions and 241 deletions.
4 changes: 4 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,7 @@ requires = [
"wheel >= 0.29.0",
]
build-backend = 'setuptools.build_meta'

[tool.black]
# py39 is not supported yet
target-version = ["py27", "py35", "py36", "py37", "py38"]
11 changes: 9 additions & 2 deletions setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ tox =

[options.extras_require]
testing =
black; python_version>='3.6'
flake8 >= 3, <4
pytest >= 4.0.0, <6
pytest-cov >= 2, <3
Expand All @@ -72,6 +73,7 @@ minversion = 3.7
isolated_build = true
skip_missing_interpreters = true
envlist =
black
flake8
py{27,35,36,37,38,39}-tox{312,315,latest}

Expand All @@ -81,7 +83,7 @@ python =
3.5: py35
3.6: py36
3.7: py37
3.8: py38, flake8
3.8: py38, black, flake8
3.9: py39

[testenv]
Expand All @@ -92,8 +94,13 @@ deps =
extras = testing
commands = pytest --cov=tox_gh_actions --cov-append --cov-branch {posargs:tests}

[testenv:black]
commands = black --check src/ tests/ setup.py
extras = testing
description = run black under {basepython}

[testenv:flake8]
commands = flake8 src/ tests/
commands = flake8 src/ tests/ setup.py
extras = testing
description = run flake8 under {basepython}

Expand Down
5 changes: 3 additions & 2 deletions src/tox_gh_actions/plugin.py
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ def get_python_version():
if "PyPy" in sys.version:
return "pypy" + str(sys.version_info[0])
# Assuming running on CPython
return '.'.join([str(i) for i in sys.version_info[:2]])
return ".".join([str(i) for i in sys.version_info[:2]])


def is_running_on_actions():
Expand Down Expand Up @@ -135,6 +135,7 @@ def is_env_specified(config):
# which is licensed under MIT LICENSE
# https://github.com/tox-dev/tox-travis/blob/0.12/LICENSE


def parse_dict(value):
# type: (str) -> Dict[str, str]
"""Parse a dict value from the tox config.
Expand All @@ -151,5 +152,5 @@ def parse_dict(value):
}
"""
lines = [line.strip() for line in value.strip().splitlines()]
pairs = [line.split(':', 1) for line in lines if line]
pairs = [line.split(":", 1) for line in lines if line]
return dict((k.strip(), v.strip()) for k, v in pairs)
Loading

0 comments on commit a063112

Please sign in to comment.