Skip to content

Commit

Permalink
Configure flake8 to run on test code as well
Browse files Browse the repository at this point in the history
  • Loading branch information
jwodder committed Aug 11, 2020
1 parent 92474c7 commit fafd5ad
Show file tree
Hide file tree
Showing 9 changed files with 18 additions and 12 deletions.
2 changes: 1 addition & 1 deletion dandi/conftest.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
from .tests.fixtures import *
from .tests.fixtures import * # noqa: F401, F403
4 changes: 2 additions & 2 deletions dandi/support/tests/test_cache.py
Original file line number Diff line number Diff line change
Expand Up @@ -185,9 +185,9 @@ def func(path):
# must be running during conda build which blows up paths with
# _placehold_ers
pytest.skip("seems to be running on conda and hitting the limits")
assert outputs[0].stdout.strip().decode() == f"Running script.py.DONE"
assert outputs[0].stdout.strip().decode() == "Running script.py.DONE"
for o in outputs[1:]:
assert o.stdout.strip().decode() == f"DONE"
assert o.stdout.strip().decode() == "DONE"

cache.clear()

Expand Down
12 changes: 9 additions & 3 deletions dandi/support/tests/test_digests.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,9 @@ def test_digester(tmp_path):
"md5": "202cb962ac59075b964b07152d234b70",
"sha1": "40bd001563085fc35165329ea1ff5c5ecbdbbeef",
"sha256": "a665a45920422f9d417e4867efdc4fb8a04a1f3fff1fa07e998e86f7f7a27ae3",
"sha512": "3c9909afec25354d551dae21590bb26e38d53f2173b8d3dc3eee4c047e7ab1c1eb8b85103e3be7ba613b31bb5c9c36214dc9f14a42fd7a2fdb84856bca5c44c2",
"sha512": "3c9909afec25354d551dae21590bb26e38d53f2173b8d3dc3eee4c047e7a"
"b1c1eb8b85103e3be7ba613b31bb5c9c36214dc9f14a42fd7a2fdb84856b"
"ca5c44c2",
}

f = tmp_path / "0"
Expand All @@ -28,7 +30,9 @@ def test_digester(tmp_path):
"md5": "93b885adfe0da089cdf634904fd59f71",
"sha1": "5ba93c9db0cff93f52b521d7420e43f6eda2784f",
"sha256": "6e340b9cffb37a989ca544e6bb780a2c78901d3fb33738768511a30617afa01d",
"sha512": "b8244d028981d693af7b456af8efa4cad63d282e19ff14942c246e50d9351d22704a802a71c3580b6370de4ceb293c324a8423342557d4e5c38438f0e36910ee",
"sha512": "b8244d028981d693af7b456af8efa4cad63d282e19ff14942c246e50d935"
"1d22704a802a71c3580b6370de4ceb293c324a8423342557d4e5c38438f0"
"e36910ee",
}

f = tmp_path / "long.txt"
Expand All @@ -37,5 +41,7 @@ def test_digester(tmp_path):
"md5": "81b196e3d8a1db4dd2e89faa39614396",
"sha1": "5273ac6247322c3c7b4735a6d19fd4a5366e812f",
"sha256": "80028815b3557e30d7cbef1d8dbc30af0ec0858eff34b960d2839fd88ad08871",
"sha512": "684d23393eee455f44c13ab00d062980937a5d040259d69c6b291c983bf635e1d405ff1dc2763e433d69b8f299b3f4da500663b813ce176a43e29ffcc31b0159",
"sha512": "684d23393eee455f44c13ab00d062980937a5d040259d69c6b291c983bf6"
"35e1d405ff1dc2763e433d69b8f299b3f4da500663b813ce176a43e29ffc"
"c31b0159",
}
1 change: 1 addition & 0 deletions dandi/tests/fixtures.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@

lgr = get_logger()


# TODO: move into some common fixtures. We might produce a number of files
# and also carry some small ones directly in git for regression testing
@pytest.fixture(scope="session")
Expand Down
4 changes: 2 additions & 2 deletions dandi/tests/skip.py
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ def windows():
# return msg, missing_deps

# The following code is modified from the original ReproMan source:
### BEGIN MODIFIED CODE
# ### BEGIN MODIFIED CODE


def no_docker_commands():
Expand All @@ -121,7 +121,7 @@ def is_engine_running():
return "docker engine not running", not is_engine_running()


### END MODIFIED CODE
# ### END MODIFIED CODE


def no_network():
Expand Down
3 changes: 2 additions & 1 deletion dandi/tests/test_download.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,8 @@ def test_parse_dandi_url():
# new (v1? not yet tagged) web UI, and as it comes from a PR,
# so we need to provide yet another mapping to stock girder
s, a, aid = parse_dandi_url(
"https://refactor--gui-dandiarchive-org.netlify.app/#/file-browser/folder/5e9f9588b5c9745bad9f58fe"
"https://refactor--gui-dandiarchive-org.netlify.app/#/file-browser"
"/folder/5e9f9588b5c9745bad9f58fe"
)
assert s == "https://girder.dandiarchive.org"
assert (a, aid) == ("folder", ["5e9f9588b5c9745bad9f58fe"])
Expand Down
2 changes: 1 addition & 1 deletion dandi/tests/test_organize.py
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ def test_organize_nwb_test_data(nwb_test_data, tmpdir, clirunner, mode):
# with @map_to_click_exceptions we loose original str of message somehow
# although it is shown to the user - checked. TODO - figure it out
# assert "not containing all" in str(r.exc_info[1])
assert r.exit_code != 0, f"Must have aborted since many files lack subject_id"
assert r.exit_code != 0, "Must have aborted since many files lack subject_id"
assert not glob(op.join(outdir, "*")), "no files should have been populated"

r = clirunner.invoke(organize, cmd + ["--invalid", "warn"])
Expand Down
1 change: 0 additions & 1 deletion dandi/tests/test_utils.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import inspect
import os.path as op
import time
import datetime
import pytest
from ..utils import (
ensure_datetime,
Expand Down
1 change: 0 additions & 1 deletion setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,6 @@ max-line-length = 100
#ignore = D100,D101,D102,D103,D104,D105,D200,D201,D202,D204,D205,D208,D209,D210,D300,D301,D400,D401,D403,E24,E121,E123,E126,E226,E266,E402,E704,E731,F821,I100,I101,I201,N802,N803,N804,N806,W503,W504,W605
ignore = E203,W503
exclude =
*test*
*sphinx*
dandi/externals/*
*/__init__.py
Expand Down

0 comments on commit fafd5ad

Please sign in to comment.