Skip to content

Commit

Permalink
Merge pull request #190 from biolab/maintenance
Browse files Browse the repository at this point in the history
maintenance, tox, github actions
  • Loading branch information
PrimozGodec authored Jan 20, 2021
2 parents 70e1a3e + 9763a3b commit b24ea84
Show file tree
Hide file tree
Showing 11 changed files with 172 additions and 134 deletions.
94 changes: 94 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,94 @@
name: Test

on:
push:
branches:
- master
pull_request:
branches:
- master

jobs:
build:
runs-on: ${{ matrix.os }}
continue-on-error: ${{ matrix.experimental }}
timeout-minutes: 15
name: ${{ matrix.name }} (${{ matrix.os }}, ${{ matrix.python-version }})
strategy:
fail-fast: false
matrix:
os: [ubuntu-18.04, macos-10.15, windows-2016]
python-version: [3.7, 3.8]
tox_env: [py-orange-released]
experimental: [false]
name: [Released]
include:
- os: windows-2019
python-version: 3.8
tox_env: py-orange-released
experimental: true
name: Windows10
- os: macos-11.0
python-version: 3.8
tox_env: py-orange-released
experimental: true
name: Big Sur

- os: windows-2016
python-version: 3.7
tox_env: py-orange-oldest
experimental: false
name: Oldest
- os: macos-10.15
python-version: 3.7
tox_env: py-orange-oldest
name: Oldest
experimental: false
- os: ubuntu-18.04
python-version: 3.7
tox_env: py-orange-oldest
name: Oldest
experimental: false

- os: windows-2016
python-version: 3.8
tox_env: py-orange-latest
experimental: false
name: Latest
- os: macos-10.15
python-version: 3.8
tox_env: py-orange-latest
experimental: false
name: Latest
- os: ubuntu-18.04
python-version: 3.8
tox_env: py-orange-latest
experimental: false
name: Latest

steps:
- uses: actions/checkout@v2
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python-version }}

- name: Install dependencies
run: |
python -m pip install --upgrade pip
python -m pip install --upgrade tox tox-pip-version
- name: Test with Tox
run: |
tox -e ${{ matrix.tox_env }}
env:
QT_QPA_PLATFORM: offscreen

- name: Upload code coverage
if: |
matrix.python-version == '3.8' &&
matrix.os == 'ubuntu-18.04' &&
matrix.tox_env == 'py-orange-released'
run: |
pip install codecov
codecov
58 changes: 0 additions & 58 deletions .travis.yml

This file was deleted.

14 changes: 0 additions & 14 deletions .travis/install_orange.sh

This file was deleted.

39 changes: 0 additions & 39 deletions .travis/install_pyqt.sh

This file was deleted.

7 changes: 2 additions & 5 deletions MANIFEST.in
Original file line number Diff line number Diff line change
@@ -1,7 +1,4 @@
recursive-include doc Makefile *.bat *.json *.md *.png *.py *.rst
recursive-include orangecontrib/imageanalytics *.svg *.png *.jpg

include requirements.txt
include README.md
include LICENSE.txt
include about.md
include *.py *.txt
include *.py *.txt *.pypi *.md *.yml *.ini .coveragerc
5 changes: 4 additions & 1 deletion orangecontrib/imageanalytics/widgets/owsaveimages.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@


from AnyQt.QtWidgets import QFileDialog, QGridLayout, QMessageBox
from AnyQt.QtCore import Qt
from AnyQt.QtCore import Qt, QSize

from Orange.data.table import Table
from Orange.widgets import gui, widget
Expand Down Expand Up @@ -396,6 +396,9 @@ def onDeleteWidget(self):
self.shutdown()
super().onDeleteWidget()

def sizeHint(self):
return QSize(500, 450)


if __name__ == "__main__": # pragma: no cover
WidgetPreview(OWSaveImages).run(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ def test_skipped_images(self):
table[:, "Images"] = "http://www.none.com/image.jpg"

self.send_signal(self.widget.Inputs.images, table)
skipped = self.get_output(self.widget.Outputs.skipped_images)
skipped = self.get_output(self.widget.Outputs.skipped_images, wait=10000)

self.assertIsInstance(skipped, Table)
self.assertEqual(len(skipped), len(table))
Expand Down Expand Up @@ -123,7 +123,7 @@ def test_embedder_changed(self):

self.assertEqual(w.cb_embedder.currentText(), "VGG-19")

output = self.get_output(self.widget.Outputs.embeddings)
output = self.get_output(self.widget.Outputs.embeddings, wait=10000)
self.assertIsInstance(output, Table)
self.assertEqual(len(output), len(table))
# 4096 shows that output is really by VGG-19
Expand Down
20 changes: 10 additions & 10 deletions orangecontrib/imageanalytics/widgets/tests/test_owsaveimages.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,6 @@
from orangecontrib.imageanalytics.widgets.owsaveimages import OWSaveImages, \
SUPPORTED_FILE_FORMATS

# Yay, MS Windows!
# This is not the proper general way to do it, but it's simplest and sufficient
# Short name is suitable for the function's purpose


def _raise_error(*args):
raise IOError
Expand Down Expand Up @@ -242,23 +238,24 @@ def test_scale(self):
# test image size, since size not set the original image size is used
image_path = os.path.join(dirname, "Day7", "D7-Series037_z06.png")

im = Image.open(image_path)
size = im.size
with Image.open(image_path) as im:
size = im.size
self.assertTupleEqual((512, 512), size)

# enable scale
self.widget.controls.use_scale.setChecked(True)
self.wait_until_finished()
im = Image.open(image_path)
size = im.size
with Image.open(image_path) as im:
size = im.size

# one of the scale is used, non of the preset scale is (512, 512)
self.assertFalse((512, 512) == size)

# change scale
simulate.combobox_activate_index(self.widget.controls.scale_index, 1)
self.wait_until_finished()
im = Image.open(image_path)
size = im.size
with Image.open(image_path) as im:
size = im.size
# second option is squeezenet with scale 227x227
self.assertTupleEqual((227, 227), size)

Expand Down Expand Up @@ -318,6 +315,9 @@ def test_format(self):
"D7-0503-12-2-bone-inj-d7-3-0020-m1.{}".format(f))
self.assertTrue(os.path.isfile(image_path))

def test_minimum_size(self):
pass


@unittest.skipUnless(sys.platform in ("darwin", "win32"),
"Test for native dialog on Windows and macOS")
Expand Down
3 changes: 3 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[build-system]
requires = ["setuptools", "wheel"]
build-backend = "setuptools.build_meta"
15 changes: 10 additions & 5 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -68,11 +68,11 @@

def include_documentation(local_dir, install_dir):
global DATA_FILES
if 'bdist_wheel' in sys.argv and not path.exists(local_dir):
print("Directory '{}' does not exist. "
"Please build documentation before running bdist_wheel."
.format(path.abspath(local_dir)))
sys.exit(0)
# if 'bdist_wheel' in sys.argv and not path.exists(local_dir):
# print("Directory '{}' does not exist. "
# "Please build documentation before running bdist_wheel."
# .format(path.abspath(local_dir)))
# sys.exit(0)
doc_files = []
for dirpath, dirs, files in walk(local_dir):
doc_files.append((dirpath.replace(local_dir, install_dir),
Expand All @@ -98,6 +98,11 @@ def include_documentation(local_dir, install_dir):
keywords=KEYWORDS,
classifiers=CLASSIFIERS,
install_requires=INSTALL_REQUIRES,
extras_require={
'test': [
'coverage',
],
},
namespace_packages=['orangecontrib'],
entry_points=ENTRY_POINTS,
)
47 changes: 47 additions & 0 deletions tox.ini
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
[tox]
envlist =
py{37,38}-orange-{oldest, latest, released}
skip_missing_interpreters = true
isolated_build = true
toxworkdir={env:TOX_WORK_DIR:.tox}

[testenv]
# must use latest pip (version 20.3.1 enables Big Sur support - https://github.com/pypa/pip/issues/9138)
pip_version = pip
extras = test
passenv = *
# we MUST changedir to avoid installed being shadowed by working dir
# https://github.com/tox-dev/tox/issues/54
# https://github.com/tox-dev/tox/issues/514
changedir =
{envsitepackagesdir}
setenv =
# Raise deprecations as errors in our tests
ORANGE_DEPRECATIONS_ERROR=y
# Need this otherwise unittest installs a warning filter that overrides
# our desire to have OrangeDeprecationWarnings raised
PYTHONWARNINGS=module
# set coverage output and project config
COVERAGE_FILE = {toxinidir}/.coverage
COVERAGE_RCFILE = {toxinidir}/.coveragerc
deps =
pyqt5==5.12.*
pyqtwebengine==5.12.*
oldest: scikit-learn~=0.22.0
oldest: orange3==3.25.0
# Use newer canvas-core and widget-base to avoid segfaults on windows
oldest: orange-canvas-core==0.1.9 ; sys_platform != 'win32'
oldest: orange-canvas-core==0.1.15 ; sys_platform == 'win32'
oldest: orange-widget-base==4.5.0 ; sys_platform != 'win32'
oldest: orange-widget-base==4.9.0 ; sys_platform == 'win32'
latest: git+git://github.com/biolab/orange3.git#egg=orange3
latest: git+git://github.com/biolab/orange-canvas-core.git#egg=orange-canvas-core
latest: git+git://github.com/biolab/orange-widget-base.git#egg=orange-widget-base
commands_pre =
# Verify installed packages have compatible dependencies
pip check
# freeze environment
pip freeze
commands =
coverage run -m unittest discover -v --start-directory orangecontrib/imageanalytics
coverage report

0 comments on commit b24ea84

Please sign in to comment.