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

Upgrade to Thumbor 7 (and Python 3) #41

Draft
wants to merge 11 commits into
base: master
Choose a base branch
from
23 changes: 23 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
name: build
on: [push, pull_request]
jobs:
build:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
image-tag:
- 37
- 38
- 39
- 310
container: thumbororg/thumbor-test:${{ matrix.image-tag }}
steps:
- name: Checkout repository
uses: actions/checkout@v2
- name: Setup
run: make setup
- name: Run unit tests
run: make unit
- name: Run integration tests
run: make integration
19 changes: 0 additions & 19 deletions .travis.yml

This file was deleted.

12 changes: 9 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,14 +1,20 @@
black:
@black .

isort:
@isort .

test: unit integration

unit:
@coverage run --branch `which nosetests` -vvvv --with-yanc -s tests/unit/
@coverage report -m
@-pytest -sv --cov=opencv_engine tests/unit/
@-coverage report -m

coverage-html: unit
@coverage html -d cover

integration:
@`which nosetests` -vvvv --with-yanc -s tests/integration/
@pytest -sv tests/integration/

setup:
@pip install -U -e .\[tests\]
Expand Down
52 changes: 16 additions & 36 deletions integration_tests/__init__.py
Original file line number Diff line number Diff line change
@@ -1,38 +1,34 @@
import os.path

from tornado.testing import AsyncHTTPTestCase
from tornado.ioloop import IOLoop
from shutil import which

from thumbor.app import ThumborServiceApp
from thumbor.importer import Importer
from thumbor.config import Config
from thumbor.context import Context, ServerParameters
from .urls_helpers import single_dataset # , combined_dataset
from thumbor.utils import which
from thumbor.importer import Importer
from tornado.testing import AsyncHTTPTestCase


class EngineCase(AsyncHTTPTestCase):

def get_app(self):
cfg = Config(SECURITY_KEY='ACME-SEC')
cfg = Config(SECURITY_KEY="ACME-SEC")
server_params = ServerParameters(None, None, None, None, None, None)
server_params.gifsicle_path = which('gifsicle')
server_params.gifsicle_path = which("gifsicle")

cfg.DETECTORS = [
'thumbor.detectors.face_detector',
'thumbor.detectors.profile_detector',
'thumbor.detectors.glasses_detector',
'thumbor.detectors.feature_detector',
"thumbor.detectors.face_detector",
"thumbor.detectors.profile_detector",
"thumbor.detectors.glasses_detector",
"thumbor.detectors.feature_detector",
]
cfg.STORAGE = 'thumbor.storages.no_storage'
cfg.LOADER = 'thumbor.loaders.file_loader'
cfg.FILE_LOADER_ROOT_PATH = os.path.join(os.path.dirname(__file__), 'imgs')
cfg.ENGINE = getattr(self, 'engine', None)
cfg.STORAGE = "thumbor.storages.no_storage"
cfg.LOADER = "thumbor.loaders.file_loader"
cfg.FILE_LOADER_ROOT_PATH = os.path.join(os.path.dirname(__file__), "imgs")
cfg.ENGINE = getattr(self, "engine", None)
cfg.USE_GIFSICLE_ENGINE = True
cfg.FFMPEG_PATH = which('ffmpeg')
cfg.FFMPEG_PATH = which("ffmpeg")
cfg.ENGINE_THREADPOOL_SIZE = 10
cfg.OPTIMIZERS = [
'thumbor.optimizers.gifv',
"thumbor.optimizers.gifv",
]
if not cfg.ENGINE:
return None
Expand All @@ -42,21 +38,5 @@ def get_app(self):
ctx = Context(server_params, cfg, importer)
application = ThumborServiceApp(ctx)

application.debug = True
return application

def get_new_ioloop(self):
return IOLoop.instance()

def retrieve(self, url):
self.http_client.fetch(self.get_url(url), self.stop)
return self.wait(timeout=30)

def exec_single_params(self):
if not self._app:
return True
single_dataset(self.retrieve)

# def test_combined_params__with_pil(self):
# if not self._app:
# return True
# combined_dataset(self.retrieve)
2 changes: 1 addition & 1 deletion integration_tests/pil_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@


class PILTest(EngineCase):
engine = 'thumbor.engines.pil'
engine = "thumbor.engines.pil"

def test_single_params(self):
self.exec_single_params()
Loading