From a0a77d6a8d74eb06d0ff7a5da25c48371fc4df62 Mon Sep 17 00:00:00 2001 From: tddough98 <40068392+tddough98@users.noreply.github.com> Date: Tue, 7 Dec 2021 14:34:10 -0800 Subject: [PATCH 1/7] Test Python 3.9 and 3.10 --- .github/workflows/tests.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/tests.yaml b/.github/workflows/tests.yaml index 0b75cd789..61bf70eaa 100644 --- a/.github/workflows/tests.yaml +++ b/.github/workflows/tests.yaml @@ -60,7 +60,7 @@ jobs: strategy: matrix: - python-version: [3.7, 3.8] + python-version: [3.7, 3.8, 3.9, 3.10] steps: - uses: actions/checkout@v2 From 5ffba92a06bf42ba6f18ec6327646c2a9367fab2 Mon Sep 17 00:00:00 2001 From: tddough98 <40068392+tddough98@users.noreply.github.com> Date: Tue, 7 Dec 2021 14:36:40 -0800 Subject: [PATCH 2/7] Make 3.10 a string --- .github/workflows/tests.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/tests.yaml b/.github/workflows/tests.yaml index 61bf70eaa..b16889be4 100644 --- a/.github/workflows/tests.yaml +++ b/.github/workflows/tests.yaml @@ -60,7 +60,7 @@ jobs: strategy: matrix: - python-version: [3.7, 3.8, 3.9, 3.10] + python-version: [3.7, 3.8, 3.9, '3.10'] steps: - uses: actions/checkout@v2 From cd91a4a13e9f1e58e116d880dfa7c3d7eed9b744 Mon Sep 17 00:00:00 2001 From: tddough98 <40068392+tddough98@users.noreply.github.com> Date: Tue, 7 Dec 2021 14:43:20 -0800 Subject: [PATCH 3/7] Bump pytest version for Python 3.10 --- requirements-test.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/requirements-test.txt b/requirements-test.txt index b2edf2d9b..11c1d6667 100644 --- a/requirements-test.txt +++ b/requirements-test.txt @@ -1,4 +1,4 @@ -pytest>=5.2,<6 +pytest~=6.2.5 pytest-cov==2.5.1 pytest-mock pytest-pep8 From 07dd7b43d19b97e4cd26c96cd320404f723de3d3 Mon Sep 17 00:00:00 2001 From: tddough98 <40068392+tddough98@users.noreply.github.com> Date: Tue, 7 Dec 2021 16:42:42 -0800 Subject: [PATCH 4/7] Switch from pep8 to flake8 --- .github/workflows/tests.yaml | 2 +- pytest.ini | 6 +++--- requirements-test.txt | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/.github/workflows/tests.yaml b/.github/workflows/tests.yaml index b16889be4..6fcb48bdf 100644 --- a/.github/workflows/tests.yaml +++ b/.github/workflows/tests.yaml @@ -89,7 +89,7 @@ jobs: - name: Run PyTest run: | - pytest deepcell_label --cov deepcell_label --pep8 + pytest deepcell_label --cov deepcell_label --flake8 - name: Coveralls if: env.COVERALLS_REPO_TOKEN != null diff --git a/pytest.ini b/pytest.ini index 0a2bad792..51f6c448b 100644 --- a/pytest.ini +++ b/pytest.ini @@ -25,7 +25,7 @@ norecursedirs= # E731 do not assign a lambda expression, use a def # W503 line break occurred before a binary operator -pep8ignore=* E731 +flake8-ignore=* E731 -# Enable line length testing with maximum line length of 80 -pep8maxlinelength = 100 +# Enable line length testing with maximum line length of 100 +flake8-max-line-length = 100 diff --git a/requirements-test.txt b/requirements-test.txt index 11c1d6667..6edc93067 100644 --- a/requirements-test.txt +++ b/requirements-test.txt @@ -1,7 +1,7 @@ pytest~=6.2.5 pytest-cov==2.5.1 pytest-mock -pytest-pep8 +pytest-flake8 pytest-flask pytest-flask-sqlalchemy pytest-lazy-fixture From 097e24a2a16463aac5e2efcc4f0aa3f8384e3586 Mon Sep 17 00:00:00 2001 From: tddough98 <40068392+tddough98@users.noreply.github.com> Date: Tue, 7 Dec 2021 16:50:09 -0800 Subject: [PATCH 5/7] Add flake8 to requirements-test.txt with pinned version --- requirements-test.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/requirements-test.txt b/requirements-test.txt index 6edc93067..3de8444e4 100644 --- a/requirements-test.txt +++ b/requirements-test.txt @@ -6,6 +6,7 @@ pytest-flask pytest-flask-sqlalchemy pytest-lazy-fixture fakeredis +flake8<4 # Pin flake8 to version 3 to prevent StringIO error (see tholo/pytest-flake8#81) six>=1.12 coveralls>3,<3.3.0 responses From 0247a834e452731e31ea0cb69090b7455da46c08 Mon Sep 17 00:00:00 2001 From: tddough98 <40068392+tddough98@users.noreply.github.com> Date: Tue, 7 Dec 2021 17:05:44 -0800 Subject: [PATCH 6/7] Make changes to conform to flake8 --- convert.py | 3 ++- deepcell_label/__init__.py | 3 --- deepcell_label/blueprints_test.py | 8 ++++---- deepcell_label/exporters_test.py | 1 - deepcell_label/imgutils_test.py | 1 - deepcell_label/label_test.py | 5 ++--- deepcell_label/labelmaker_test.py | 1 - deepcell_label/loaders_test.py | 4 +--- pytest.ini | 2 +- 9 files changed, 10 insertions(+), 18 deletions(-) diff --git a/convert.py b/convert.py index 47ba320ec..9dc9cdaa5 100644 --- a/convert.py +++ b/convert.py @@ -80,7 +80,8 @@ def main(): dest = file.parent / file.stem data_utils.trks_to_trk_folder(str(file), str(dest)) else: - raise NotImplemented + raise NotImplementedError + if __name__ == "__main__": main() diff --git a/deepcell_label/__init__.py b/deepcell_label/__init__.py index 7abb45b81..0b49ba7c3 100644 --- a/deepcell_label/__init__.py +++ b/deepcell_label/__init__.py @@ -3,10 +3,7 @@ from __future__ import division from __future__ import print_function -import logging - from flask import Flask -from flask.logging import default_handler from flask_cors import CORS from flask_compress import Compress from flask_dropzone import Dropzone diff --git a/deepcell_label/blueprints_test.py b/deepcell_label/blueprints_test.py index 4d1132d8d..bde801a11 100644 --- a/deepcell_label/blueprints_test.py +++ b/deepcell_label/blueprints_test.py @@ -86,7 +86,7 @@ def test_redo(client): def test_create_project(client, mocker): mocker.patch('deepcell_label.blueprints.loaders.URLLoader', lambda *args: DummyLoader()) - response = client.post(f'/api/project') + response = client.post('/api/project') assert response.status_code == 200 @@ -95,7 +95,7 @@ def test_create_project_dropped_npz(client): np.savez(npz, X=np.zeros((1, 1, 1, 1)), y=np.ones((1, 1, 1, 1))) npz.seek(0) data = {'file': (npz, 'test.npz')} - response = client.post(f'/api/project/dropped', data=data, content_type='multipart/form-data') + response = client.post('/api/project/dropped', data=data, content_type='multipart/form-data') assert response.status_code == 200 @@ -105,7 +105,7 @@ def test_create_project_dropped_tiff(client): writer.save(np.zeros((1, 1, 1, 1))) tifffile.seek(0) data = {'file': (tifffile, 'test.tiff')} - response = client.post(f'/api/project/dropped', data=data, content_type='multipart/form-data') + response = client.post('/api/project/dropped', data=data, content_type='multipart/form-data') assert response.status_code == 200 @@ -115,7 +115,7 @@ def test_create_project_dropped_png(client): img.save(png, format="png") png.seek(0) data = {'file': (png, 'test.png')} - response = client.post(f'/api/project/dropped', data=data, content_type='multipart/form-data') + response = client.post('/api/project/dropped', data=data, content_type='multipart/form-data') assert response.status_code == 200 diff --git a/deepcell_label/exporters_test.py b/deepcell_label/exporters_test.py index 3deb1c6bf..147a27980 100644 --- a/deepcell_label/exporters_test.py +++ b/deepcell_label/exporters_test.py @@ -1,6 +1,5 @@ """Tests for exporters.py""" -import pytest import io from deepcell_label import models diff --git a/deepcell_label/imgutils_test.py b/deepcell_label/imgutils_test.py index 177e1180d..fb655f3dc 100644 --- a/deepcell_label/imgutils_test.py +++ b/deepcell_label/imgutils_test.py @@ -4,7 +4,6 @@ from skimage.io import imread import numpy as np -import pytest from deepcell_label import imgutils from deepcell_label import models diff --git a/deepcell_label/label_test.py b/deepcell_label/label_test.py index 12ca6f7b9..8d0d0b67b 100644 --- a/deepcell_label/label_test.py +++ b/deepcell_label/label_test.py @@ -66,7 +66,6 @@ def test_action_new_single_cell(self, app): cell = 1 feature = 0 expected_new_label = 2 - frame = 0 with app.app_context(): edit.action_new_single_cell(cell) @@ -474,5 +473,5 @@ def test_action_new_track(self, app): assert cell not in edit.frame[..., feature] assert expected_new_cell in edit.frame[..., feature] assert expected_new_cell in edit.labels.cell_ids[feature] - assert prev_track['frames'] == (tracks[cell]['frames'] + - tracks[expected_new_cell]['frames']) + assert prev_track['frames'] == (tracks[cell]['frames'] + + tracks[expected_new_cell]['frames']) diff --git a/deepcell_label/labelmaker_test.py b/deepcell_label/labelmaker_test.py index 1175101b4..1cabff74c 100644 --- a/deepcell_label/labelmaker_test.py +++ b/deepcell_label/labelmaker_test.py @@ -1,7 +1,6 @@ """Tests for labelmaker.py""" import numpy as np -import pytest from deepcell_label.labelmaker import LabelInfoMaker diff --git a/deepcell_label/loaders_test.py b/deepcell_label/loaders_test.py index d6d3b754f..484599141 100644 --- a/deepcell_label/loaders_test.py +++ b/deepcell_label/loaders_test.py @@ -5,14 +5,12 @@ import io import zipfile -import pytest - import numpy as np import responses from PIL import Image from tifffile import TiffWriter -from deepcell_label.loaders import URLLoader, FileLoader +from deepcell_label.loaders import URLLoader @responses.activate diff --git a/pytest.ini b/pytest.ini index 51f6c448b..f15912bf1 100644 --- a/pytest.ini +++ b/pytest.ini @@ -25,7 +25,7 @@ norecursedirs= # E731 do not assign a lambda expression, use a def # W503 line break occurred before a binary operator -flake8-ignore=* E731 +flake8-ignore=* E731 W503 # Enable line length testing with maximum line length of 100 flake8-max-line-length = 100 From 37b317e2a1fbcd4647ac96507725280cba488690 Mon Sep 17 00:00:00 2001 From: tddough98 <40068392+tddough98@users.noreply.github.com> Date: Wed, 8 Dec 2021 12:02:48 -0800 Subject: [PATCH 7/7] Add quotes to all Python versions --- .github/workflows/tests.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/tests.yaml b/.github/workflows/tests.yaml index 6fcb48bdf..1c24e7034 100644 --- a/.github/workflows/tests.yaml +++ b/.github/workflows/tests.yaml @@ -60,7 +60,7 @@ jobs: strategy: matrix: - python-version: [3.7, 3.8, 3.9, '3.10'] + python-version: ['3.7', '3.8', '3.9', '3.10'] steps: - uses: actions/checkout@v2