Skip to content

Commit 023eef3

Browse files
authoredMay 29, 2018
update to latest black (#833)
👍 more checks and formats
1 parent 6edfab0 commit 023eef3

19 files changed

+54
-86
lines changed
 

‎.pre-commit-config.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
repos:
22
- repo: https://github.com/ambv/black
3-
rev: 18.4a4
3+
rev: 18.5b1
44
hooks:
55
- id: black
66
args: [--line-length=99, --safe]

‎doc/conf.py

+4-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,10 @@
66

77
sys.path.insert(0, os.path.dirname(__file__))
88
extensions = [
9-
"sphinx.ext.autodoc", "sphinx.ext.extlinks", "sphinx.ext.intersphinx", "sphinx.ext.viewcode"
9+
"sphinx.ext.autodoc",
10+
"sphinx.ext.extlinks",
11+
"sphinx.ext.intersphinx",
12+
"sphinx.ext.viewcode",
1013
]
1114

1215
project = u"tox"

‎setup.py

+5-1
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,11 @@ def main():
5252
install_requires=["py>=1.4.17", "pluggy>=0.3.0,<1.0", "six", "virtualenv>=1.11.2"],
5353
extras_require={
5454
"testing": [
55-
"pytest >= 3.0.0", "pytest-cov", "pytest-mock", "pytest-timeout", "pytest-xdist"
55+
"pytest >= 3.0.0",
56+
"pytest-cov",
57+
"pytest-mock",
58+
"pytest-timeout",
59+
"pytest-xdist",
5660
],
5761
"docs": ["sphinx >= 1.6.3, < 2", "towncrier >= 17.8.0"],
5862
"lint": ["pre-commit == 1.8.2"],

‎tests/test_config.py

+18-25
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,6 @@
2222

2323

2424
class TestVenvConfig:
25-
2625
def test_config_parsing_minimal(self, tmpdir, newconfig):
2726
config = newconfig(
2827
[],
@@ -172,7 +171,6 @@ def test_is_same_dep(self):
172171

173172

174173
class TestConfigPlatform:
175-
176174
def test_config_parse_platform(self, newconfig):
177175
config = newconfig(
178176
[],
@@ -223,7 +221,6 @@ def test_config_parse_platform_with_factors(self, newconfig, plat):
223221

224222

225223
class TestConfigPackage:
226-
227224
def test_defaults(self, tmpdir, newconfig):
228225
config = newconfig([], "")
229226
assert config.setupdir.realpath() == tmpdir.realpath()
@@ -256,7 +253,6 @@ def test_project_paths(self, tmpdir, newconfig):
256253

257254

258255
class TestParseconfig:
259-
260256
def test_search_parents(self, tmpdir):
261257
b = tmpdir.mkdir("a").mkdir("b")
262258
toxinipath = tmpdir.ensure("tox.ini")
@@ -293,7 +289,6 @@ def test_get_homedir(monkeypatch):
293289

294290

295291
class TestGetcontextname:
296-
297292
def test_blank(self, monkeypatch):
298293
monkeypatch.setattr(os, "environ", {})
299294
assert getcontextname() is None
@@ -436,7 +431,6 @@ def test_regression_issue595(self, newconfig):
436431

437432

438433
class TestIniParser:
439-
440434
def test_getstring_single(self, newconfig):
441435
config = newconfig(
442436
"""
@@ -705,7 +699,9 @@ def test_argvlist_quoted_posargs(self, newconfig):
705699
assert reader.getargvlist("key1") == []
706700
x = reader.getargvlist("key2")
707701
expected_deps = [
708-
["cmd1", "--foo-args=foo bar"], ["cmd2", "-f", "foo bar"], ["cmd3", "-f", "foo", "bar"]
702+
["cmd1", "--foo-args=foo bar"],
703+
["cmd2", "-f", "foo bar"],
704+
["cmd3", "-f", "foo", "bar"],
709705
]
710706
assert x == expected_deps
711707

@@ -816,7 +812,6 @@ def test_getbool(self, newconfig):
816812

817813

818814
class TestIniParserPrefix:
819-
820815
def test_basic_section_access(self, newconfig):
821816
config = newconfig(
822817
"""
@@ -873,7 +868,6 @@ def test_other_section_substitution(self, newconfig):
873868

874869

875870
class TestConfigTestEnv:
876-
877871
def test_commentchars_issue33(self, newconfig):
878872
config = newconfig(
879873
"""
@@ -1723,7 +1717,6 @@ def test_ignore_outcome(self, newconfig):
17231717

17241718

17251719
class TestGlobalOptions:
1726-
17271720
def test_notest(self, newconfig):
17281721
config = newconfig([], "")
17291722
assert not config.option.notest
@@ -1905,7 +1898,6 @@ def test_defaultenv_partial_override(self, newconfig):
19051898

19061899

19071900
class TestHashseedOption:
1908-
19091901
def _get_envconfigs(self, newconfig, args=None, tox_ini=None, make_hashseed=None):
19101902
if args is None:
19111903
args = []
@@ -2023,7 +2015,6 @@ def test_setenv_in_one_testenv(self, newconfig):
20232015

20242016

20252017
class TestSetenv:
2026-
20272018
def test_getdict_lazy(self, newconfig, monkeypatch):
20282019
monkeypatch.setenv("X", "2")
20292020
config = newconfig(
@@ -2196,7 +2187,6 @@ def test_setenv_cross_section_mixed(self, monkeypatch, newconfig):
21962187

21972188

21982189
class TestIndexServer:
2199-
22002190
def test_indexserver(self, newconfig):
22012191
config = newconfig(
22022192
"""
@@ -2248,7 +2238,6 @@ def test_multiple_homedir_relative_local_indexservers(self, newconfig):
22482238

22492239

22502240
class TestConfigConstSubstitutions:
2251-
22522241
@pytest.mark.parametrize("pathsep", [":", ";"])
22532242
def test_replace_pathsep_unix(self, monkeypatch, newconfig, pathsep):
22542243
monkeypatch.setattr("os.pathsep", pathsep)
@@ -2273,7 +2262,6 @@ def test_pathsep_regex(self):
22732262

22742263

22752264
class TestParseEnv:
2276-
22772265
def test_parse_recreate(self, newconfig):
22782266
inisource = ""
22792267
config = newconfig([], inisource)
@@ -2291,7 +2279,6 @@ def test_parse_recreate(self, newconfig):
22912279

22922280

22932281
class TestCmdInvocation:
2294-
22952282
def test_help(self, cmd):
22962283
result = cmd("-h")
22972284
assert not result.ret
@@ -2310,9 +2297,7 @@ def test_version_no_plugins(self):
23102297
assert "registered plugins:" not in version_info
23112298

23122299
def test_version_with_normal_plugin(self, monkeypatch):
2313-
23142300
def fake_normal_plugin_distinfo():
2315-
23162301
class MockModule:
23172302
__file__ = "some-file"
23182303

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

23332318
def test_version_with_fileless_module(self, monkeypatch):
2334-
23352319
def fake_no_file_plugin_distinfo():
2336-
23372320
class MockModule:
2338-
23392321
def __repr__(self):
23402322
return "some-repr"
23412323

@@ -2463,7 +2445,7 @@ def test_listenvs_all_verbose_description(self, cmd, initproj):
24632445
"additional environments:",
24642446
"docs -> generate documentation",
24652447
]
2466-
assert result.outlines[-len(expected):] == expected
2448+
assert result.outlines[-len(expected) :] == expected
24672449

24682450
def test_listenvs_all_verbose_description_no_additional_environments(self, cmd, initproj):
24692451
initproj(
@@ -2477,7 +2459,9 @@ def test_listenvs_all_verbose_description_no_additional_environments(self, cmd,
24772459
)
24782460
result = cmd("-av")
24792461
expected = [
2480-
"default environments:", "py27 -> [no description]", "py36 -> [no description]"
2462+
"default environments:",
2463+
"py27 -> [no description]",
2464+
"py36 -> [no description]",
24812465
]
24822466
assert result.out.splitlines()[-3:] == expected
24832467
assert "additional environments" not in result.out
@@ -2572,7 +2556,6 @@ def test_env_spec(cmdline, envlist):
25722556

25732557

25742558
class TestCommandParser:
2575-
25762559
def test_command_parser_for_word(self):
25772560
p = CommandParser("word")
25782561
assert list(p.words()) == ["word"]
@@ -2655,7 +2638,17 @@ def test_command_parsing_for_issue_10(self):
26552638
p = CommandParser(cmd)
26562639
parsed = list(p.words())
26572640
expected = [
2658-
"nosetests", " ", "-v", " ", "-a", " ", "!deferred", " ", "--with-doctest", " ", "[]"
2641+
"nosetests",
2642+
" ",
2643+
"-v",
2644+
" ",
2645+
"-a",
2646+
" ",
2647+
"!deferred",
2648+
" ",
2649+
"--with-doctest",
2650+
" ",
2651+
"[]",
26592652
]
26602653
assert parsed == expected
26612654

‎tests/test_interpreters.py

-8
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,6 @@ def communicate():
6060

6161

6262
def test_tox_get_python_executable():
63-
6463
class envconfig:
6564
basepython = sys.executable
6665
envname = "pyxx"
@@ -89,7 +88,6 @@ class envconfig:
8988

9089

9190
def test_find_executable_extra(monkeypatch):
92-
9391
@staticmethod
9492
def sysfind(_):
9593
return "hello"
@@ -113,9 +111,7 @@ def test_run_and_get_interpreter_info():
113111

114112

115113
class TestInterpreters:
116-
117114
def test_get_executable(self, interpreters):
118-
119115
class envconfig:
120116
basepython = sys.executable
121117
envname = "pyxx"
@@ -128,7 +124,6 @@ class envconfig:
128124
assert info.runnable
129125

130126
def test_get_executable_no_exist(self, interpreters):
131-
132127
class envconfig:
133128
basepython = "1lkj23"
134129
envname = "pyxx"
@@ -141,7 +136,6 @@ class envconfig:
141136
assert not info.runnable
142137

143138
def test_get_sitepackagesdir_error(self, interpreters):
144-
145139
class envconfig:
146140
basepython = sys.executable
147141
envname = "123"
@@ -184,7 +178,6 @@ def test_exec_failed():
184178

185179

186180
class TestInterpreterInfo:
187-
188181
@staticmethod
189182
def info(
190183
name="my-name",
@@ -215,7 +208,6 @@ def test_str(self):
215208

216209

217210
class TestNoInterpreterInfo:
218-
219211
def test_runnable(self):
220212
assert not NoInterpreterInfo("foo").runnable
221213
assert not NoInterpreterInfo("foo", executable=sys.executable).runnable

‎tests/test_pytest_plugins.py

+1-3
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@
1010

1111

1212
class TestInitProj:
13-
1413
@pytest.mark.parametrize(
1514
"kwargs", ({}, {"src_root": None}, {"src_root": ""}, {"src_root": "."})
1615
)
@@ -61,7 +60,6 @@ def test_broken_py_path_local_join_workaround_on_Windows(self, tmpdir, initproj,
6160

6261

6362
class TestPathParts:
64-
6563
@pytest.mark.parametrize(
6664
"input, expected",
6765
(
@@ -81,7 +79,7 @@ def test_path_parts(self, input, expected):
8179
def test_on_py_path(self):
8280
cwd_parts = _path_parts(py.path.local())
8381
folder_parts = _path_parts(py.path.local("a/b/c"))
84-
assert folder_parts[len(cwd_parts):] == ["a", "b", "c"]
82+
assert folder_parts[len(cwd_parts) :] == ["a", "b", "c"]
8583

8684

8785
@pytest.mark.parametrize(

‎tests/test_quickstart.py

+8-1
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,12 @@
1515
ALL_PY_ENVS_AS_STRING = ", ".join(tox.PYTHON.QUICKSTART_PY_ENVS)
1616
ALL_PY_ENVS_WO_LAST_AS_STRING = ", ".join(tox.PYTHON.QUICKSTART_PY_ENVS[:-1])
1717
SIGNS_OF_SANITY = (
18-
"tox.readthedocs.io", "[tox]", "[testenv]", "envlist = ", "deps =", "commands ="
18+
"tox.readthedocs.io",
19+
"[tox]",
20+
"[testenv]",
21+
"envlist = ",
22+
"deps =",
23+
"commands =",
1924
)
2025
"""A bunch of elements to be expected in the generated config as marker for basic sanity"""
2126

@@ -44,6 +49,7 @@ def __call__(self, prompt):
4449

4550
class _cnf:
4651
"""Handle files and args for different test scenarios."""
52+
4753
SOME_CONTENT = "dontcare"
4854

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

112118
class _exp:
113119
"""Holds test expectations and a user scenario description."""
120+
114121
STANDARD_EPECTATIONS = [ALL_PY_ENVS_AS_STRING, "pytest", "pytest"]
115122

116123
def __init__(self, name, exp=None):

‎tests/test_venv.py

-4
Original file line numberDiff line numberDiff line change
@@ -455,7 +455,6 @@ def test_install_python3(newmocksession):
455455

456456

457457
class TestCreationConfig:
458-
459458
def test_basic(self, newconfig, mocksession, tmpdir):
460459
config = newconfig([], "")
461460
envconfig = config.envconfigs["python"]
@@ -588,7 +587,6 @@ def test_develop_recreation(self, newconfig, mocksession):
588587

589588

590589
class TestVenvTest:
591-
592590
def test_envbindir_path(self, newmocksession, monkeypatch):
593591
monkeypatch.setenv("PIP_RESPECT_VIRTUALENV", "1")
594592
mocksession = newmocksession(
@@ -813,7 +811,6 @@ def test_tox_testenv_create(newmocksession):
813811
log = []
814812

815813
class Plugin:
816-
817814
@tox.hookimpl
818815
def tox_testenv_create(self, action, venv):
819816
assert isinstance(action, tox.session.Action)
@@ -845,7 +842,6 @@ def test_tox_testenv_pre_post(newmocksession):
845842
log = []
846843

847844
class Plugin:
848-
849845
@tox.hookimpl
850846
def tox_runtest_pre(self):
851847
log.append("started")

‎tests/test_z_cmdline.py

-2
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,6 @@ def test_report_protocol(newconfig):
2727
)
2828

2929
class Popen:
30-
3130
def __init__(self, *args, **kwargs):
3231
pass
3332

@@ -82,7 +81,6 @@ def test__resolve_pkg_doubledash(tmpdir, mocksession):
8281

8382

8483
class TestSession:
85-
8684
def test_make_sdist(self, initproj):
8785
initproj(
8886
"example123-0.5",

0 commit comments

Comments
 (0)
Please sign in to comment.