Skip to content

Commit

Permalink
Update test versions. (IDSIA#892)
Browse files Browse the repository at this point in the history
* Update test versions.

* Fix numpy version.

* Fix python version for tensorflow 2.11 and add some more python version tests.

* Fix flake8 errors.

* Get some more infos why py 3.11 is failing.

* Fix python 3.11 exception cpaturing.

* Missing escape.
  • Loading branch information
jnphilipp authored Nov 30, 2022
1 parent e7bc7a7 commit c0b9d02
Show file tree
Hide file tree
Showing 5 changed files with 105 additions and 15 deletions.
6 changes: 3 additions & 3 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
fail_fast: true
repos:
- repo: https://github.com/psf/black
rev: 22.3.0
rev: 22.10.0
hooks:
- id: black
language_version: python3
- repo: https://gitlab.com/pycqa/flake8
rev: 4.0.1
- repo: https://github.com/pycqa/flake8
rev: 6.0.0
hooks:
- id: flake8
exclude: ^(tests|examples|docs)/.*
Expand Down
72 changes: 68 additions & 4 deletions azure-pipelines.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,10 @@ jobs:
IMAGE_NAME: 'windows-latest'
PYTHON_VERSION: '3.10'
TOX_CMD: 'py310'
Windows py311:
IMAGE_NAME: 'windows-latest'
PYTHON_VERSION: '3.11'
TOX_CMD: 'py311'
OSX py38:
IMAGE_NAME: 'macOS-latest'
PYTHON_VERSION: '3.8'
Expand All @@ -27,6 +31,10 @@ jobs:
IMAGE_NAME: 'macOS-latest'
PYTHON_VERSION: '3.10'
TOX_CMD: 'py310'
OSX py311:
IMAGE_NAME: 'macOS-latest'
PYTHON_VERSION: '3.11'
TOX_CMD: 'py311'
Linux py38:
IMAGE_NAME: 'ubuntu-latest'
PYTHON_VERSION: '3.8'
Expand All @@ -39,6 +47,10 @@ jobs:
IMAGE_NAME: 'ubuntu-latest'
PYTHON_VERSION: '3.10'
TOX_CMD: 'py310'
Linux py311:
IMAGE_NAME: 'ubuntu-latest'
PYTHON_VERSION: '3.11'
TOX_CMD: 'py311'
Linux numpy_120:
IMAGE_NAME: 'ubuntu-latest'
PYTHON_VERSION: '3.9'
Expand All @@ -55,6 +67,10 @@ jobs:
IMAGE_NAME: 'ubuntu-latest'
PYTHON_VERSION: '3.10'
TOX_CMD: 'numpy-123'
Linux numpy_124:
IMAGE_NAME: 'ubuntu-latest'
PYTHON_VERSION: '3.11'
TOX_CMD: 'numpy-124'
Linux tensorflow_27:
IMAGE_NAME: 'ubuntu-latest'
PYTHON_VERSION: '3.8'
Expand All @@ -67,22 +83,62 @@ jobs:
IMAGE_NAME: 'ubuntu-latest'
PYTHON_VERSION: '3.10'
TOX_CMD: 'tensorflow-29'
Linux setup:
Linux tensorflow_210:
IMAGE_NAME: 'ubuntu-latest'
PYTHON_VERSION: '3.10'
TOX_CMD: 'tensorflow-210'
Linux tensorflow_211:
IMAGE_NAME: 'ubuntu-latest'
PYTHON_VERSION: '3.10'
TOX_CMD: 'tensorflow-211'
Linux setup 3.9:
IMAGE_NAME: 'ubuntu-latest'
PYTHON_VERSION: '3.9'
TOX_CMD: 'setup'
Linux flake8:
Linux setup 3.10:
IMAGE_NAME: 'ubuntu-latest'
PYTHON_VERSION: '3.10'
TOX_CMD: 'setup'
Linux setup 3.11:
IMAGE_NAME: 'ubuntu-latest'
PYTHON_VERSION: '3.11'
TOX_CMD: 'setup'
Linux flake8 3.9:
IMAGE_NAME: 'ubuntu-latest'
PYTHON_VERSION: '3.9'
TOX_CMD: 'flake8'
Linux black:
Linux flake8 3.10:
IMAGE_NAME: 'ubuntu-latest'
PYTHON_VERSION: '3.10'
TOX_CMD: 'flake8'
Linux flake8 3.11:
IMAGE_NAME: 'ubuntu-latest'
PYTHON_VERSION: '3.11'
TOX_CMD: 'flake8'
Linux black 3.9:
IMAGE_NAME: 'ubuntu-latest'
PYTHON_VERSION: '3.9'
TOX_CMD: 'black'
Linux coverage:
Linux black 3.10:
IMAGE_NAME: 'ubuntu-latest'
PYTHON_VERSION: '3.10'
TOX_CMD: 'black'
Linux black 3.11:
IMAGE_NAME: 'ubuntu-latest'
PYTHON_VERSION: '3.11'
TOX_CMD: 'black'
Linux coverage 3.9:
IMAGE_NAME: 'ubuntu-latest'
PYTHON_VERSION: '3.9'
TOX_CMD: 'coverage'
Linux coverage 3.10:
IMAGE_NAME: 'ubuntu-latest'
PYTHON_VERSION: '3.10'
TOX_CMD: 'coverage'
Linux coverage 3.11:
IMAGE_NAME: 'ubuntu-latest'
PYTHON_VERSION: '3.11'
TOX_CMD: 'coverage'
pool:
vmImage: $(IMAGE_NAME)
steps:
Expand All @@ -107,3 +163,11 @@ jobs:
inputs:
versionSpec: '3.10'
- bash: bash ./tests/check_pre_commit.sh
- job: test_pre_commit_311
pool:
vmImage: 'ubuntu-latest'
steps:
- task: UsePythonVersion@0
inputs:
versionSpec: '3.11'
- bash: bash ./tests/check_pre_commit.sh
2 changes: 1 addition & 1 deletion setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ pep8ignore =
dist/* ALL
sacred.egg-info/* ALL
[flake8]
ignore = D100,D101,D102,D103,D104,D105,D203,D401,F821,E722,E203,E501,N818 \
ignore = D100,D101,D102,D103,D104,D105,D203,D401,F821,E722,E203,E501,N818,
# flake8 default ignores:
E121,E123,E126,E226,E24,E704,W503,W504
max-complexity = 10
Expand Down
12 changes: 6 additions & 6 deletions tests/test_exceptions.py
Original file line number Diff line number Diff line change
Expand Up @@ -151,12 +151,12 @@ def test_chained_error():
except SacredError as e:
st = format_sacred_error(e, "usage")
assert re.match(
r"Traceback \(most recent calls WITHOUT Sacred internals\):\n File "
+ r"\"[^\"]+?test_exceptions.py\", line \d+, in test_chained_error\n "
+ r"print\(1 / 0\)\nZeroDivisionError: division by zero\n\nThe above "
+ r"exception was the direct cause of the following exception:\n\nTraceback "
+ r"\(most recent calls WITHOUT Sacred internals\):\n File \"[^\"]+?"
+ r"test_exceptions.py\", line \d+, in test_chained_error\n raise "
r"Traceback \(most recent calls WITHOUT Sacred internals\):\s+File "
+ r"\"[^\"]+?test_exceptions.py\", line \d+, in test_chained_error\s+"
+ r"print\(1 / 0\)\n(\s+~~\^~~\s+)?ZeroDivisionError: division by zero\n\n"
+ r"The above exception was the direct cause of the following exception:\n"
+ r"\nTraceback \(most recent calls WITHOUT Sacred internals\):\s+File "
+ r"\"[^\"]+?test_exceptions.py\", line \d+, in test_chained_error\s+raise "
+ r"SacredError\(\"Something bad happened\"\) from e\nsacred.utils."
+ r"SacredError: Something bad happened\n",
st,
Expand Down
28 changes: 27 additions & 1 deletion tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
# and then run "tox" from this directory.

[tox]
envlist = py38, py39, py310, setup, flake8, numpy-120, numpy-121, numpy-122, numpy-123, tensorflow-26, tensorflow-27, tensorflow-28, tensorflow-29
envlist = py38, py39, py310, py311, setup, flake8, numpy-120, numpy-121, numpy-122, numpy-123, numpy-124, tensorflow-26, tensorflow-27, tensorflow-28, tensorflow-29, tensorflow-210, tensorflow-211

[testenv]
deps =
Expand Down Expand Up @@ -45,6 +45,14 @@ deps =
commands =
pytest tests/test_config {posargs}

[testenv:numpy-124]
basepython = python
deps =
-rdev-requirements.txt
numpy~=1.24.0rc1
commands =
pytest tests/test_config {posargs}

[testenv:tensorflow-115]
basepython = python
deps =
Expand Down Expand Up @@ -90,6 +98,24 @@ commands =
pytest tests/test_stflow tests/test_optional.py \
{posargs}

[testenv:tensorflow-210]
basepython = python
deps =
-rdev-requirements.txt
tensorflow~=2.10.0
commands =
pytest tests/test_stflow tests/test_optional.py \
{posargs}

[testenv:tensorflow-211]
basepython = python
deps =
-rdev-requirements.txt
tensorflow~=2.11.0
commands =
pytest tests/test_stflow tests/test_optional.py \
{posargs}

[testenv:setup]
basepython = python
deps =
Expand Down

0 comments on commit c0b9d02

Please sign in to comment.