Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Switch tox to using package dependencies #140

Merged
merged 7 commits into from
Dec 24, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ jobs:
build:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
python-version: [ '3.7', '3.8', '3.9', '3.10', '3.11' ]
name: Python ${{ matrix.python-version }} sample
Expand All @@ -24,7 +25,7 @@ jobs:
- uses: actions/cache@v3
with:
path: ${{ env.pythonLocation }}
key: ${{ env.pythonLocation }}-${{ hashFiles('setup.py') }}
key: ${{ env.pythonLocation }}-${{ hashFiles('setup.py') }}-u22

- name: Install dependencies
run: |
Expand Down
3 changes: 2 additions & 1 deletion iiif_prezi3/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

from pydantic import AnyUrl, BaseModel


class Base(BaseModel):

class Config:
Expand All @@ -10,7 +11,7 @@ class Config:
copy_on_model_validation = False
smart_union = True
# Allow us to use the field name like service.id rather than service.@id
allow_population_by_field_name = True
allow_population_by_field_name = True

def __getattribute__(self, prop):
val = super(Base, self).__getattribute__(prop)
Expand Down
1 change: 0 additions & 1 deletion tests/test_basic.py
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,5 @@ def testLabel(self):
self.assertEqual(manifest.label['en'][0], 'default label', 'Unexpected label for manifest')



if __name__ == '__main__':
unittest.main()
6 changes: 3 additions & 3 deletions tests/test_canvas_helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,9 @@ def setUp(self):

def test_add_image(self):
anno_page = self.canvas.add_image(
'http://iiif.example.org/prezi/Image/0',
'http://iiif.example.org/prezi/Annotation/0',
height=400)
'http://iiif.example.org/prezi/Image/0',
'http://iiif.example.org/prezi/Annotation/0',
height=400)
self.assertTrue(isinstance(anno_page, AnnotationPage), '`add_image` should return an AnnotationPage')
self.assertEqual(len(self.canvas.items), 1)
self.assertEqual(anno_page.items[0].id, 'http://iiif.example.org/prezi/Annotation/0')
Expand Down
39 changes: 19 additions & 20 deletions tests/test_create_canvas_from_iiif.py
Original file line number Diff line number Diff line change
Expand Up @@ -75,25 +75,25 @@ def test_create_canvas_from_iiif_v2(self, mockrequest_get):
mockrequest_get.return_value = mockresponse
# set mock to return minimal image api response
mockresponse.json.return_value = {
"@context": "http://iiif.io/api/image/2/context.json",
"@id": "https://iiif.io/api/image/2.1/example/reference/918ecd18c2592080851777620de9bcb5-gottingen",
"height": 3024,
"profile": [
"http://iiif.io/api/image/2/level1.json",
{
"formats": [ "jpg", "png" ],
"qualities": [ "default", "color", "gray" ]
}
],
"protocol": "http://iiif.io/api/image",
"tiles": [
{
"height": 512,
"scaleFactors": [ 1, 2, 4 ],
"width": 512
}
],
"width": 4032
"@context": "http://iiif.io/api/image/2/context.json",
"@id": "https://iiif.io/api/image/2.1/example/reference/918ecd18c2592080851777620de9bcb5-gottingen",
"height": 3024,
"profile": [
"http://iiif.io/api/image/2/level1.json",
{
"formats": ["jpg", "png"],
"qualities": ["default", "color", "gray"]
}
],
"protocol": "http://iiif.io/api/image",
"tiles": [
{
"height": 512,
"scaleFactors": [1, 2, 4],
"width": 512
}
],
"width": 4032
}

canvas = self.manifest.create_canvas_from_iiif(image_info_url, label={'en': ['Canvas label']})
Expand Down Expand Up @@ -125,4 +125,3 @@ def test_create_canvas_from_iiif_v2(self, mockrequest_get):
self.assertEqual(service.id, image_id)
self.assertEqual(service.profile, "http://iiif.io/api/image/2/level1.json")
self.assertEqual(service.type, "ImageService2")

15 changes: 1 addition & 14 deletions tox.ini
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
[tox]
envlist = py37, py38, py39, py310, py311, linting
skipsdist = True

[gh-actions]
python =
Expand All @@ -11,24 +10,12 @@ python =
3.11: py311

[testenv]
deps =
pydantic
Pillow
requests

skip_install = True
commands =
python -m unittest discover -s tests

[testenv:linting]
basepython = python3
deps =
autopep8
isort
flake8-docstrings
flake8-isort
flake8
skip_install = true
extras = dev
commands =
isort .
autopep8 --in-place --recursive --exclude skeleton.py --ignore E501 .
Expand Down