Skip to content

Commit

Permalink
Add testing for python 3.9 and 3.10 (#288)
Browse files Browse the repository at this point in the history
* Test Python 3.9 and 3.10

* Make 3.10 a string

* Bump pytest version for Python 3.10

* Switch from pep8 to flake8

* Add flake8 to requirements-test.txt with pinned version

* Make changes to conform to flake8

* Add quotes to all Python versions
  • Loading branch information
tddough98 committed Dec 8, 2021
1 parent 98d095f commit 98b5ddc
Show file tree
Hide file tree
Showing 11 changed files with 17 additions and 24 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/tests.yaml
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down
3 changes: 2 additions & 1 deletion convert.py
Expand Up @@ -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()
3 changes: 0 additions & 3 deletions deepcell_label/__init__.py
Expand Up @@ -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
Expand Down
8 changes: 4 additions & 4 deletions deepcell_label/blueprints_test.py
Expand Up @@ -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


Expand All @@ -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


Expand All @@ -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


Expand All @@ -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


Expand Down
1 change: 0 additions & 1 deletion deepcell_label/exporters_test.py
@@ -1,6 +1,5 @@
"""Tests for exporters.py"""

import pytest
import io

from deepcell_label import models
Expand Down
1 change: 0 additions & 1 deletion deepcell_label/imgutils_test.py
Expand Up @@ -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
Expand Down
5 changes: 2 additions & 3 deletions deepcell_label/label_test.py
Expand Up @@ -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)
Expand Down Expand Up @@ -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'])
1 change: 0 additions & 1 deletion 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

Expand Down
4 changes: 1 addition & 3 deletions deepcell_label/loaders_test.py
Expand Up @@ -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
Expand Down
6 changes: 3 additions & 3 deletions pytest.ini
Expand Up @@ -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 W503

# 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
5 changes: 3 additions & 2 deletions requirements-test.txt
@@ -1,11 +1,12 @@
pytest>=5.2,<6
pytest~=6.2.5
pytest-cov==2.5.1
pytest-mock
pytest-pep8
pytest-flake8
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

0 comments on commit 98b5ddc

Please sign in to comment.