Skip to content

Commit

Permalink
update to latest black
Browse files Browse the repository at this point in the history
  • Loading branch information
gaborbernat committed May 29, 2018
1 parent 6edfab0 commit fcad71e
Show file tree
Hide file tree
Showing 18 changed files with 53 additions and 86 deletions.
2 changes: 1 addition & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
repos:
- repo: https://github.com/ambv/black
rev: 18.4a4
rev: 18.5b1
hooks:
- id: black
args: [--line-length=99, --safe]
Expand Down
5 changes: 4 additions & 1 deletion doc/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,10 @@

sys.path.insert(0, os.path.dirname(__file__))
extensions = [
"sphinx.ext.autodoc", "sphinx.ext.extlinks", "sphinx.ext.intersphinx", "sphinx.ext.viewcode"
"sphinx.ext.autodoc",
"sphinx.ext.extlinks",
"sphinx.ext.intersphinx",
"sphinx.ext.viewcode",
]

project = u"tox"
Expand Down
6 changes: 5 additions & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,11 @@ def main():
install_requires=["py>=1.4.17", "pluggy>=0.3.0,<1.0", "six", "virtualenv>=1.11.2"],
extras_require={
"testing": [
"pytest >= 3.0.0", "pytest-cov", "pytest-mock", "pytest-timeout", "pytest-xdist"
"pytest >= 3.0.0",
"pytest-cov",
"pytest-mock",
"pytest-timeout",
"pytest-xdist",
],
"docs": ["sphinx >= 1.6.3, < 2", "towncrier >= 17.8.0"],
"lint": ["pre-commit == 1.8.2"],
Expand Down
43 changes: 18 additions & 25 deletions tests/test_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@


class TestVenvConfig:

def test_config_parsing_minimal(self, tmpdir, newconfig):
config = newconfig(
[],
Expand Down Expand Up @@ -172,7 +171,6 @@ def test_is_same_dep(self):


class TestConfigPlatform:

def test_config_parse_platform(self, newconfig):
config = newconfig(
[],
Expand Down Expand Up @@ -223,7 +221,6 @@ def test_config_parse_platform_with_factors(self, newconfig, plat):


class TestConfigPackage:

def test_defaults(self, tmpdir, newconfig):
config = newconfig([], "")
assert config.setupdir.realpath() == tmpdir.realpath()
Expand Down Expand Up @@ -256,7 +253,6 @@ def test_project_paths(self, tmpdir, newconfig):


class TestParseconfig:

def test_search_parents(self, tmpdir):
b = tmpdir.mkdir("a").mkdir("b")
toxinipath = tmpdir.ensure("tox.ini")
Expand Down Expand Up @@ -293,7 +289,6 @@ def test_get_homedir(monkeypatch):


class TestGetcontextname:

def test_blank(self, monkeypatch):
monkeypatch.setattr(os, "environ", {})
assert getcontextname() is None
Expand Down Expand Up @@ -436,7 +431,6 @@ def test_regression_issue595(self, newconfig):


class TestIniParser:

def test_getstring_single(self, newconfig):
config = newconfig(
"""
Expand Down Expand Up @@ -705,7 +699,9 @@ def test_argvlist_quoted_posargs(self, newconfig):
assert reader.getargvlist("key1") == []
x = reader.getargvlist("key2")
expected_deps = [
["cmd1", "--foo-args=foo bar"], ["cmd2", "-f", "foo bar"], ["cmd3", "-f", "foo", "bar"]
["cmd1", "--foo-args=foo bar"],
["cmd2", "-f", "foo bar"],
["cmd3", "-f", "foo", "bar"],
]
assert x == expected_deps

Expand Down Expand Up @@ -816,7 +812,6 @@ def test_getbool(self, newconfig):


class TestIniParserPrefix:

def test_basic_section_access(self, newconfig):
config = newconfig(
"""
Expand Down Expand Up @@ -873,7 +868,6 @@ def test_other_section_substitution(self, newconfig):


class TestConfigTestEnv:

def test_commentchars_issue33(self, newconfig):
config = newconfig(
"""
Expand Down Expand Up @@ -1723,7 +1717,6 @@ def test_ignore_outcome(self, newconfig):


class TestGlobalOptions:

def test_notest(self, newconfig):
config = newconfig([], "")
assert not config.option.notest
Expand Down Expand Up @@ -1905,7 +1898,6 @@ def test_defaultenv_partial_override(self, newconfig):


class TestHashseedOption:

def _get_envconfigs(self, newconfig, args=None, tox_ini=None, make_hashseed=None):
if args is None:
args = []
Expand Down Expand Up @@ -2023,7 +2015,6 @@ def test_setenv_in_one_testenv(self, newconfig):


class TestSetenv:

def test_getdict_lazy(self, newconfig, monkeypatch):
monkeypatch.setenv("X", "2")
config = newconfig(
Expand Down Expand Up @@ -2196,7 +2187,6 @@ def test_setenv_cross_section_mixed(self, monkeypatch, newconfig):


class TestIndexServer:

def test_indexserver(self, newconfig):
config = newconfig(
"""
Expand Down Expand Up @@ -2248,7 +2238,6 @@ def test_multiple_homedir_relative_local_indexservers(self, newconfig):


class TestConfigConstSubstitutions:

@pytest.mark.parametrize("pathsep", [":", ";"])
def test_replace_pathsep_unix(self, monkeypatch, newconfig, pathsep):
monkeypatch.setattr("os.pathsep", pathsep)
Expand All @@ -2273,7 +2262,6 @@ def test_pathsep_regex(self):


class TestParseEnv:

def test_parse_recreate(self, newconfig):
inisource = ""
config = newconfig([], inisource)
Expand All @@ -2291,7 +2279,6 @@ def test_parse_recreate(self, newconfig):


class TestCmdInvocation:

def test_help(self, cmd):
result = cmd("-h")
assert not result.ret
Expand All @@ -2310,9 +2297,7 @@ def test_version_no_plugins(self):
assert "registered plugins:" not in version_info

def test_version_with_normal_plugin(self, monkeypatch):

def fake_normal_plugin_distinfo():

class MockModule:
__file__ = "some-file"

Expand All @@ -2331,11 +2316,8 @@ class MockEggInfo:
assert "1.0" in version_info

def test_version_with_fileless_module(self, monkeypatch):

def fake_no_file_plugin_distinfo():

class MockModule:

def __repr__(self):
return "some-repr"

Expand Down Expand Up @@ -2463,7 +2445,7 @@ def test_listenvs_all_verbose_description(self, cmd, initproj):
"additional environments:",
"docs -> generate documentation",
]
assert result.outlines[-len(expected):] == expected
assert result.outlines[-len(expected) :] == expected

def test_listenvs_all_verbose_description_no_additional_environments(self, cmd, initproj):
initproj(
Expand All @@ -2477,7 +2459,9 @@ def test_listenvs_all_verbose_description_no_additional_environments(self, cmd,
)
result = cmd("-av")
expected = [
"default environments:", "py27 -> [no description]", "py36 -> [no description]"
"default environments:",
"py27 -> [no description]",
"py36 -> [no description]",
]
assert result.out.splitlines()[-3:] == expected
assert "additional environments" not in result.out
Expand Down Expand Up @@ -2572,7 +2556,6 @@ def test_env_spec(cmdline, envlist):


class TestCommandParser:

def test_command_parser_for_word(self):
p = CommandParser("word")
assert list(p.words()) == ["word"]
Expand Down Expand Up @@ -2655,7 +2638,17 @@ def test_command_parsing_for_issue_10(self):
p = CommandParser(cmd)
parsed = list(p.words())
expected = [
"nosetests", " ", "-v", " ", "-a", " ", "!deferred", " ", "--with-doctest", " ", "[]"
"nosetests",
" ",
"-v",
" ",
"-a",
" ",
"!deferred",
" ",
"--with-doctest",
" ",
"[]",
]
assert parsed == expected

Expand Down
8 changes: 0 additions & 8 deletions tests/test_interpreters.py
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,6 @@ def communicate():


def test_tox_get_python_executable():

class envconfig:
basepython = sys.executable
envname = "pyxx"
Expand Down Expand Up @@ -89,7 +88,6 @@ class envconfig:


def test_find_executable_extra(monkeypatch):

@staticmethod
def sysfind(_):
return "hello"
Expand All @@ -113,9 +111,7 @@ def test_run_and_get_interpreter_info():


class TestInterpreters:

def test_get_executable(self, interpreters):

class envconfig:
basepython = sys.executable
envname = "pyxx"
Expand All @@ -128,7 +124,6 @@ class envconfig:
assert info.runnable

def test_get_executable_no_exist(self, interpreters):

class envconfig:
basepython = "1lkj23"
envname = "pyxx"
Expand All @@ -141,7 +136,6 @@ class envconfig:
assert not info.runnable

def test_get_sitepackagesdir_error(self, interpreters):

class envconfig:
basepython = sys.executable
envname = "123"
Expand Down Expand Up @@ -184,7 +178,6 @@ def test_exec_failed():


class TestInterpreterInfo:

@staticmethod
def info(
name="my-name",
Expand Down Expand Up @@ -215,7 +208,6 @@ def test_str(self):


class TestNoInterpreterInfo:

def test_runnable(self):
assert not NoInterpreterInfo("foo").runnable
assert not NoInterpreterInfo("foo", executable=sys.executable).runnable
Expand Down
4 changes: 1 addition & 3 deletions tests/test_pytest_plugins.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@


class TestInitProj:

@pytest.mark.parametrize(
"kwargs", ({}, {"src_root": None}, {"src_root": ""}, {"src_root": "."})
)
Expand Down Expand Up @@ -61,7 +60,6 @@ def test_broken_py_path_local_join_workaround_on_Windows(self, tmpdir, initproj,


class TestPathParts:

@pytest.mark.parametrize(
"input, expected",
(
Expand All @@ -81,7 +79,7 @@ def test_path_parts(self, input, expected):
def test_on_py_path(self):
cwd_parts = _path_parts(py.path.local())
folder_parts = _path_parts(py.path.local("a/b/c"))
assert folder_parts[len(cwd_parts):] == ["a", "b", "c"]
assert folder_parts[len(cwd_parts) :] == ["a", "b", "c"]


@pytest.mark.parametrize(
Expand Down
9 changes: 8 additions & 1 deletion tests/test_quickstart.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,12 @@
ALL_PY_ENVS_AS_STRING = ", ".join(tox.PYTHON.QUICKSTART_PY_ENVS)
ALL_PY_ENVS_WO_LAST_AS_STRING = ", ".join(tox.PYTHON.QUICKSTART_PY_ENVS[:-1])
SIGNS_OF_SANITY = (
"tox.readthedocs.io", "[tox]", "[testenv]", "envlist = ", "deps =", "commands ="
"tox.readthedocs.io",
"[tox]",
"[testenv]",
"envlist = ",
"deps =",
"commands =",
)
"""A bunch of elements to be expected in the generated config as marker for basic sanity"""

Expand Down Expand Up @@ -44,6 +49,7 @@ def __call__(self, prompt):

class _cnf:
"""Handle files and args for different test scenarios."""

SOME_CONTENT = "dontcare"

def __init__(self, exists=False, names=None, pass_path=False):
Expand Down Expand Up @@ -111,6 +117,7 @@ def _alternative_content(self):

class _exp:
"""Holds test expectations and a user scenario description."""

STANDARD_EPECTATIONS = [ALL_PY_ENVS_AS_STRING, "pytest", "pytest"]

def __init__(self, name, exp=None):
Expand Down
4 changes: 0 additions & 4 deletions tests/test_venv.py
Original file line number Diff line number Diff line change
Expand Up @@ -455,7 +455,6 @@ def test_install_python3(newmocksession):


class TestCreationConfig:

def test_basic(self, newconfig, mocksession, tmpdir):
config = newconfig([], "")
envconfig = config.envconfigs["python"]
Expand Down Expand Up @@ -588,7 +587,6 @@ def test_develop_recreation(self, newconfig, mocksession):


class TestVenvTest:

def test_envbindir_path(self, newmocksession, monkeypatch):
monkeypatch.setenv("PIP_RESPECT_VIRTUALENV", "1")
mocksession = newmocksession(
Expand Down Expand Up @@ -813,7 +811,6 @@ def test_tox_testenv_create(newmocksession):
log = []

class Plugin:

@tox.hookimpl
def tox_testenv_create(self, action, venv):
assert isinstance(action, tox.session.Action)
Expand Down Expand Up @@ -845,7 +842,6 @@ def test_tox_testenv_pre_post(newmocksession):
log = []

class Plugin:

@tox.hookimpl
def tox_runtest_pre(self):
log.append("started")
Expand Down
2 changes: 0 additions & 2 deletions tests/test_z_cmdline.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@ def test_report_protocol(newconfig):
)

class Popen:

def __init__(self, *args, **kwargs):
pass

Expand Down Expand Up @@ -82,7 +81,6 @@ def test__resolve_pkg_doubledash(tmpdir, mocksession):


class TestSession:

def test_make_sdist(self, initproj):
initproj(
"example123-0.5",
Expand Down
Loading

0 comments on commit fcad71e

Please sign in to comment.