From 5c39fa4b9a2c43d94d1eef68ac24f1d0099d219a Mon Sep 17 00:00:00 2001 From: Bryan Newbold Date: Thu, 23 Jul 2020 15:28:40 -0700 Subject: simple lint (flake8) fixes in tests The pytest fixture syntax interacts weirdly with flake8 tests, so ignore the "redefinition" and "unused variable" errors more carefully for .py files under ./tests/ --- python/.flake8 | 2 +- python/tests/api_editgroups.py | 1 - python/tests/api_entity_state.py | 2 +- python/tests/api_releases.py | 2 +- python/tests/import_ingest.py | 2 +- 5 files changed, 4 insertions(+), 5 deletions(-) diff --git a/python/.flake8 b/python/.flake8 index 34f6131c..bb1baa71 100644 --- a/python/.flake8 +++ b/python/.flake8 @@ -10,4 +10,4 @@ max-line-length = 120 per-file-ignores = */__init__.py: F401 tests/*.py: F401,F811 - tests/transform_csl.py: W291 + tests/transform_csl.py: F401,F811,W291 diff --git a/python/tests/api_editgroups.py b/python/tests/api_editgroups.py index 142687c2..b4420b29 100644 --- a/python/tests/api_editgroups.py +++ b/python/tests/api_editgroups.py @@ -98,7 +98,6 @@ def test_editgroup_auto_batch(api): def test_batch_params(api): - eg = quick_eg(api) c1 = CreatorEntity(display_name="test auto_batch") c2 = CreatorEntity(display_name="test another auto_batch") diff --git a/python/tests/api_entity_state.py b/python/tests/api_entity_state.py index d5ba6301..4b49083e 100644 --- a/python/tests/api_entity_state.py +++ b/python/tests/api_entity_state.py @@ -359,7 +359,7 @@ def test_self_redirect(api): c1_redirect = CreatorEntity(redirect=c1.ident) eg = quick_eg(api) with pytest.raises(fatcat_openapi_client.rest.ApiException): - merge_edit = api.update_creator(eg.editgroup_id, c1.ident, c1_redirect) + api.update_creator(eg.editgroup_id, c1.ident, c1_redirect) def test_wip_redirect(api): diff --git a/python/tests/api_releases.py b/python/tests/api_releases.py index c4c05ea6..9c70f655 100644 --- a/python/tests/api_releases.py +++ b/python/tests/api_releases.py @@ -177,7 +177,7 @@ def test_empty_fields(api): title="something", contribs=[ReleaseContrib(raw_name="somebody")], ext_ids=ReleaseExtIds()) - r1edit = api.create_release(eg.editgroup_id, r1) + api.create_release(eg.editgroup_id, r1) with pytest.raises(fatcat_openapi_client.rest.ApiException): r2 = ReleaseEntity(title="", ext_ids=ReleaseExtIds()) diff --git a/python/tests/import_ingest.py b/python/tests/import_ingest.py index ebe2923c..4a46232a 100644 --- a/python/tests/import_ingest.py +++ b/python/tests/import_ingest.py @@ -63,7 +63,7 @@ def test_ingest_importer_stage(ingest_importer, api): eg = quick_eg(api) r1 = api.lookup_release(doi="10.123/abc") r1.release_stage = row['release_stage'] - c1 = api.update_release(eg.editgroup_id, r1.ident, r1) + api.update_release(eg.editgroup_id, r1.ident, r1) api.accept_editgroup(eg.editgroup_id) # set ingest request stage -- cgit v1.2.3