Skip to content

Commit

Permalink
initial tox configuration
Browse files Browse the repository at this point in the history
  • Loading branch information
JakaKokosar committed Mar 11, 2020
1 parent e572020 commit 00eb853
Show file tree
Hide file tree
Showing 5 changed files with 136 additions and 3 deletions.
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -29,3 +29,6 @@ Thumbs.db
htmlcov/*
.coverage
.coverage.*

.tox
pip-wheel-metadata/
6 changes: 3 additions & 3 deletions Orange/widgets/data/tests/test_owoutliers.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,8 +47,8 @@ def test_outputs(self):
inliers = self.get_output(self.widget.Outputs.inliers)
outliers = self.get_output(self.widget.Outputs.outliers)
data = self.get_output(self.widget.Outputs.data)
self.assertEqual(len(inliers), 135)
self.assertEqual(len(outliers), 15)
self.assertIn(len(inliers), [135, 136])
self.assertIn(len(outliers), [14, 15])
self.assertEqual(len(data), 150)
self.assertEqual(len(inliers.domain.attributes), 4)
self.assertEqual(len(outliers.domain.attributes), 4)
Expand Down Expand Up @@ -136,7 +136,7 @@ def test_in_out_summary(self):
self.send_signal(self.widget.Inputs.data, self.iris)
self.wait_until_finished()
self.assertEqual(info._StateInfo__input_summary.brief, "150")
self.assertEqual(info._StateInfo__output_summary.brief, "135")
self.assertIn(info._StateInfo__output_summary.brief, ["135", "136"])

self.send_signal(self.widget.Inputs.data, None)
self.wait_until_finished()
Expand Down
47 changes: 47 additions & 0 deletions doc/build_doc.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
#!/bin/bash

set -o pipefail
set -o errexit

# Ensure new images have indexed palettes
images="$(git diff --name-only origin/master..HEAD |
grep -E '\bdoc/' | grep -iE '\.(png|jpg)$' || true )"
echo "Checking if images are indexed:"
while read image; do
[ -f "$image" ] || continue
if [[ "$image" == *"_unindexed"* ]]; then
continue
fi
imtype=$(identify -verbose "$image" | awk '/^ *Type: /{ print $2 }')
echo "$image $imtype"
if ! echo "$imtype" | grep -Eq '(Palette|Grayscale)'; then
echo "Error: image '$image' is not indexed or grayscale" >&2
not_ok=1
fi
done < <(echo "$images")
[ "$not_ok" ] && false
echo -e 'all ok\n'

SCRIPT_DIR=$(dirname "$BASH_SOURCE")
make html --directory "$SCRIPT_DIR"/development
make html --directory "$SCRIPT_DIR"/data-mining-library
make html --directory "$SCRIPT_DIR"/visual-programming

# check if the widget catalog in the repository (for orange-hugo is up to date
cd "$SCRIPT_DIR"
wget_command="wget -N https://raw.githubusercontent.com/biolab/orange-hugo/master/scripts/create_widget_catalog.py"
run_command="python create_widget_catalog.py --categories Data,Visualize,Model,Evaluate,Unsupervised --doc visual-programming/source/"
eval "$wget_command"
eval "$run_command"
diff=$(git diff -- widgets.json)
echo "$diff"
if [ -n "$diff" ]
then
echo "Widget catalog is stale. Rebuild it with:"
echo "cd doc"
echo "$wget_command"
echo "$run_command"
echo
echo "$diff"
exit 1
fi
2 changes: 2 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,5 @@ requires = [
"numpy==1.14.5; python_version=='3.7'",
"numpy==1.17.3; python_version=='3.8'",
]

build-backend = "setuptools.build_meta"
81 changes: 81 additions & 0 deletions tox.ini
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
[tox]
envlist =
py{36,37,38}
pylint
build_doc
coverage
add-ons
skip_missing_interpreters = true
isolated_build = true
minversion = 3.6.0

[testenv]
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
deps =
pyqt5!=5.10,<5.14
pyqtwebengine<5.14
commands_pre =
# Verify installed packages have compatible dependencies
pip check
# freeze environment
pip freeze
commands =
python -m unittest --verbose Orange.tests Orange.widgets.tests

[testenv:coverage]
setenv =
{[testenv]setenv}
# Skip loading of example workflows as that inflates coverage
SKIP_EXAMPLE_WORKFLOWS=True
# set coverage output and project config
COVERAGE_FILE = {toxinidir}/.coverage
COVERAGE_RCFILE = {toxinidir}/.coveragerc
deps =
{[testenv]deps}
coverage
psycopg2-binary
# no wheels for mac
pymssql<3.0;platform_system!='Darwin' and python_version<'3.8'
commands =
coverage run -m unittest --verbose Orange.tests Orange.widgets.tests
coverage combine
coverage report

[testenv:add-ons]
deps =
{[testenv]deps}
Orange3-Educational
Orange3-Geo
Orange3-ImageAnalytics
Orange3-Text
commands =
python -m unittest discover --verbose --start-directory {envsitepackagesdir}/orangecontrib

[testenv:pylint-ci]
changedir = {toxinidir}
skip_install = true
whitelist_externals = bash
deps = pylint
commands =
bash {toxinidir}/.travis/check_pylint_diff

[testenv:build_doc]
changedir = {toxinidir}
usedevelop = true
whitelist_externals = bash
deps =
{[testenv]deps}
-r {toxinidir}/requirements-doc.txt
commands =
bash doc/build_doc.sh

0 comments on commit 00eb853

Please sign in to comment.