Skip to content

Commit

Permalink
Pin linters and upgrade black
Browse files Browse the repository at this point in the history
Adapt to new black style and avoid future unintended changes through
pinned versions.
  • Loading branch information
languitar committed Sep 6, 2020
1 parent 3fe67e0 commit a59e738
Show file tree
Hide file tree
Showing 2 changed files with 50 additions and 24 deletions.
52 changes: 39 additions & 13 deletions test_passgithelper.py
Expand Up @@ -106,15 +106,19 @@ def test_smoke(self):


@pytest.mark.parametrize(
"xdg_dir", [None], indirect=True,
"xdg_dir",
[None],
indirect=True,
)
def test_parse_mapping_file_missing(xdg_dir):
with pytest.raises(RuntimeError):
passgithelper.parse_mapping(None)


@pytest.mark.parametrize(
"xdg_dir", ["test_data/smoke"], indirect=True,
"xdg_dir",
["test_data/smoke"],
indirect=True,
)
def test_parse_mapping_from_xdg(xdg_dir):
config = passgithelper.parse_mapping(None)
Expand All @@ -138,7 +142,9 @@ def test_skip(self, monkeypatch, capsys):
assert not err

@pytest.mark.parametrize(
"xdg_dir", ["test_data/smoke"], indirect=True,
"xdg_dir",
["test_data/smoke"],
indirect=True,
)
def test_smoke_resolve(self, xdg_dir, monkeypatch, mocker, capsys):
monkeypatch.setattr(
Expand All @@ -161,7 +167,9 @@ def test_smoke_resolve(self, xdg_dir, monkeypatch, mocker, capsys):
assert out == "password=narf\n"

@pytest.mark.parametrize(
"xdg_dir", ["test_data/smoke"], indirect=True,
"xdg_dir",
["test_data/smoke"],
indirect=True,
)
def test_path_used_if_present_fails(self, xdg_dir, monkeypatch, caplog):
monkeypatch.setattr(
Expand All @@ -182,7 +190,9 @@ def test_path_used_if_present_fails(self, xdg_dir, monkeypatch, caplog):
]

@pytest.mark.parametrize(
"xdg_dir", ["test_data/with-path"], indirect=True,
"xdg_dir",
["test_data/with-path"],
indirect=True,
)
def test_path_used_if_present(self, xdg_dir, monkeypatch, mocker, capsys):
monkeypatch.setattr(
Expand All @@ -207,7 +217,9 @@ def test_path_used_if_present(self, xdg_dir, monkeypatch, mocker, capsys):
assert out == "password=narf\n"

@pytest.mark.parametrize(
"xdg_dir", ["test_data/wildcard"], indirect=True,
"xdg_dir",
["test_data/wildcard"],
indirect=True,
)
def test_wildcard_matching(self, xdg_dir, monkeypatch, mocker, capsys):
monkeypatch.setattr(
Expand Down Expand Up @@ -235,7 +247,9 @@ def test_wildcard_matching(self, xdg_dir, monkeypatch, mocker, capsys):
assert out == "password=narf-wildcard\n"

@pytest.mark.parametrize(
"xdg_dir", ["test_data/with-username"], indirect=True,
"xdg_dir",
["test_data/with-username"],
indirect=True,
)
def test_username_provided(self, xdg_dir, monkeypatch, mocker, capsys):
monkeypatch.setattr(
Expand All @@ -259,7 +273,9 @@ def test_username_provided(self, xdg_dir, monkeypatch, mocker, capsys):
assert out == "password=password\nusername=username\n"

@pytest.mark.parametrize(
"xdg_dir", ["test_data/with-username"], indirect=True,
"xdg_dir",
["test_data/with-username"],
indirect=True,
)
def test_username_skipped_if_provided(self, xdg_dir, monkeypatch, mocker, capsys):
monkeypatch.setattr(
Expand All @@ -284,7 +300,9 @@ def test_username_skipped_if_provided(self, xdg_dir, monkeypatch, mocker, capsys
assert out == "password=password\n"

@pytest.mark.parametrize(
"xdg_dir", ["test_data/with-username"], indirect=True,
"xdg_dir",
["test_data/with-username"],
indirect=True,
)
def test_custom_mapping_used(self, xdg_dir, monkeypatch, mocker, capsys):
# this would fail for the default file from with-username
Expand All @@ -308,7 +326,9 @@ def test_custom_mapping_used(self, xdg_dir, monkeypatch, mocker, capsys):
assert out == "password=narf\n"

@pytest.mark.parametrize(
"xdg_dir", ["test_data/with-username-skip"], indirect=True,
"xdg_dir",
["test_data/with-username-skip"],
indirect=True,
)
def test_prefix_skipping(self, xdg_dir, monkeypatch, mocker, capsys):
monkeypatch.setattr(
Expand All @@ -331,7 +351,9 @@ def test_prefix_skipping(self, xdg_dir, monkeypatch, mocker, capsys):
assert out == "password=xyz\nusername=tester\n"

@pytest.mark.parametrize(
"xdg_dir", ["test_data/unknown-username-extractor"], indirect=True,
"xdg_dir",
["test_data/unknown-username-extractor"],
indirect=True,
)
def test_select_unknown_extractor(self, xdg_dir, monkeypatch, capsys):
monkeypatch.setattr(
Expand All @@ -347,7 +369,9 @@ def test_select_unknown_extractor(self, xdg_dir, monkeypatch, capsys):
passgithelper.main(["get"])

@pytest.mark.parametrize(
"xdg_dir", ["test_data/regex-extraction"], indirect=True,
"xdg_dir",
["test_data/regex-extraction"],
indirect=True,
)
def test_regex_username_selection(self, xdg_dir, monkeypatch, mocker, capsys):
monkeypatch.setattr(
Expand All @@ -372,7 +396,9 @@ def test_regex_username_selection(self, xdg_dir, monkeypatch, mocker, capsys):
assert out == "password=xyz\nusername=tester\n"

@pytest.mark.parametrize(
"xdg_dir", ["test_data/entry-name-extraction"], indirect=True,
"xdg_dir",
["test_data/entry-name-extraction"],
indirect=True,
)
def test_entry_name_is_user(self, xdg_dir, monkeypatch, mocker, capsys):
monkeypatch.setattr(
Expand Down
22 changes: 11 additions & 11 deletions tox.ini
Expand Up @@ -31,17 +31,17 @@ commands =
[testenv:check]
deps =
flake8
flake8-black
flake8-docstrings
flake8-per-file-ignores
flake8-import-order
flake8-print
flake8-string-format
pep8-naming
flake8-comprehensions
flake8-bugbear
flake8-builtins
mypy
flake8-black~=0.1.0
flake8-bugbear~=20.1.0
flake8-builtins~=0.1.0
flake8-comprehensions~=3.2.0
flake8-docstrings~=1.5.0
flake8-import-order~=0.18.0
flake8-print~=3.1.0
flake8-string-format~=0.2.0
pep8-naming~=0.9.0
mypy==0.761
black==20.8b0
commands =
{envbindir}/python -V
{envbindir}/flake8 {posargs}
Expand Down

0 comments on commit a59e738

Please sign in to comment.