Skip to content

Commit

Permalink
Update pytest config (#5576)
Browse files Browse the repository at this point in the history
Ignores some warnings outside Holoviews and moves the configuration to pyproject.

I added flaky to test examples because it sometimes gives this Runtime error `Kernel died before replying to kernel_info`. 

Also, ignoring some warnings emitted by the latest numpy release (1.24).
  • Loading branch information
hoxbro authored Jan 2, 2023
1 parent 1077a7c commit b1395fa
Show file tree
Hide file tree
Showing 6 changed files with 24 additions and 14 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ jobs:
if: matrix.python-version == '3.11'
run: |
conda activate test-environment
pytest -n auto --dist loadscope --nbval-lax examples/reference/elements
pytest -n auto --dist loadscope --nbval-lax examples/reference/elements --force-flaky
- name: codecov
run: |
conda activate test-environment
Expand Down
2 changes: 1 addition & 1 deletion holoviews/core/util.py
Original file line number Diff line number Diff line change
Expand Up @@ -2010,7 +2010,7 @@ def bound_range(vals, density, time_unit='us'):
invert = True
if not density:
with warnings.catch_warnings():
warnings.filterwarnings('ignore', r'invalid value encountered in double_scalars')
warnings.filterwarnings('ignore', r'invalid value encountered in (double_scalars|scalar divide)')
full_precision_density = compute_density(low, high, len(vals)-1)
with np.errstate(over='ignore'):
density = round(full_precision_density, sys.float_info.dig)
Expand Down
19 changes: 19 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,22 @@ requires = [
"pyct >=0.4.4",
"setuptools >=30.3.0",
]

[tool.pytest.ini_options]
addopts = "-p no:dash"
filterwarnings = [
# Numpy warning triggered in Bokeh, when timedelta or datetime numpy scalar are compared to a numerical scalar
"ignore:elementwise comparison failed:DeprecationWarning:bokeh.core.property.bases",
"ignore:dropping variables using `drop` will be deprecated; using drop_vars is encouraged:PendingDeprecationWarning:xarray.core.dataarray",
# 2022-12-27: Plotly don't use packagings version yet
"ignore:distutils Version classes are deprecated:DeprecationWarning:plotly.graph_objs",
# 2022-12-27: A weird warning which could be related to Datashader
"ignore:Please use `append` from the:DeprecationWarning:pickle",
# 2022-12-27: Warnings which should be fixed in Panel
"ignore:make_current is deprecated; start the event loop first:DeprecationWarning:panel.io.server",
# 2023-01-02: Numpy 1.24 warnings
"ignore:`.+?` is a deprecated alias for `.+?`.:DeprecationWarning:bokeh", # https://github.com/bokeh/bokeh/pull/12690
"ignore:`.+?` is a deprecated alias for `.+?`.:DeprecationWarning:cupy", # https://github.com/cupy/cupy/issues/7211
"ignore:`.+?` is a deprecated alias for `.+?`.:DeprecationWarning:plotly.express.imshow_utils", # https://github.com/plotly/plotly.py/pull/3997
"ignore:`.+?` is a deprecated alias for `.+?`.:DeprecationWarning:skimage.util.dtype", # https://github.com/scikit-image/scikit-image/pull/6637
]
11 changes: 0 additions & 11 deletions pytest.ini

This file was deleted.

1 change: 1 addition & 0 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@
'pytest',
'pytest-cov',
'pytest-xdist',
'flaky',
'matplotlib >=3',
'nbconvert',
'bokeh',
Expand Down
3 changes: 2 additions & 1 deletion tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -28,10 +28,11 @@ commands = pytest holoviews --cov=./holoviews -vv
[_examples]
description = Test that default examples run
deps = .[examples_tests]
commands = pytest -n auto --dist loadscope --nbval-lax examples -k "not Plotting_with_Bokeh and not 17-Dashboards and not Plots_and_Renderers"
commands = pytest -n auto --dist loadscope --nbval-lax examples -k "not Plotting_with_Bokeh and not 17-Dashboards and not Plots_and_Renderers" --force-flaky
# 'Plotting_with_Bokeh' needs selenium, phantomjs, firefox and geckodriver to save a png picture.
# '17-Dashboards' can give a timeout error.
# 'Plots_and_Renderers' can give file not found here.
# --force-flaky is because of "RuntimeError: Kernel died before replying to kernel_info"

[_all_recommended]
description = Run all recommended tests
Expand Down

0 comments on commit b1395fa

Please sign in to comment.