Skip to content

Commit

Permalink
Use Python 3.12 for core test (#5909)
Browse files Browse the repository at this point in the history
  • Loading branch information
hoxbro authored Oct 11, 2023
1 parent 6386616 commit 52edaf9
Show file tree
Hide file tree
Showing 7 changed files with 47 additions and 25 deletions.
42 changes: 26 additions & 16 deletions .github/workflows/test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ env:
SETUPTOOLS_ENABLE_FEATURES: "legacy-editable"
DISPLAY: ":99.0"
PYTHONIOENCODING: "utf-8"
MPLBACKEND: "Agg"
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
OMP_NUM_THREADS: 1
OPENBLAS_NUM_THREADS: 1
Expand Down Expand Up @@ -63,7 +62,7 @@ jobs:
python-version: ${{ matrix.python-version }}
channel-priority: strict
channels: pyviz/label/dev,conda-forge,nodefaults
envs: "-o flakes -o tests -o examples_tests -o test_ci"
envs: "-o flakes -o tests -o examples_tests -o tests_ci"
cache: true
conda-update: true
id: install
Expand Down Expand Up @@ -109,7 +108,7 @@ jobs:
name: ui_test_suite
python-version: ${{ matrix.python-version }}
channels: pyviz/label/dev,bokeh,conda-forge,nodefaults
envs: "-o recommended -o tests -o build -o test_ci"
envs: "-o recommended -o tests -o build -o tests_ci"
cache: true
playwright: true
id: install
Expand All @@ -135,7 +134,7 @@ jobs:
fail-fast: false
matrix:
os: ['ubuntu-latest']
python-version: ['3.11']
python-version: ['3.12']
timeout-minutes: 120
defaults:
run:
Expand All @@ -144,25 +143,36 @@ jobs:
DESC: "Python ${{ matrix.python-version }}, ${{ matrix.os }} core tests"
PYTHON_VERSION: ${{ matrix.python-version }}
steps:
- uses: holoviz-dev/holoviz_tasks/[email protected]
# Add back when this works on Python 3.12
# - uses: holoviz-dev/holoviz_tasks/[email protected]
# with:
# name: core_test_suite
# python-version: ${{ matrix.python-version }}
# # channel-priority: strict
# channels: pyviz/label/dev,conda-forge,nodefaults
# envs: "-o tests_core -o tests_ci"
# cache: true
# conda-update: true
# id: install
- uses: actions/checkout@v3
with:
name: core_test_suite
python-version: ${{ matrix.python-version }}
channel-priority: strict
channels: pyviz/label/dev,conda-forge,nodefaults
envs: "-o tests_core -o test_ci"
cache: true
conda-update: true
id: install
fetch-depth: "100"
- name: Fetch unshallow
run: git fetch --prune --tags --unshallow -f
- uses: actions/setup-python@v4
with:
python-version: 3.12
- run: |
python -m pip install -ve '.[tests_core, tests_ci]'
- name: bokeh sampledata
run: |
conda activate test-environment
# conda activate test-environment
bokeh sampledata
- name: Check packages latest version
run: |
conda activate test-environment
# conda activate test-environment
python scripts/check_latest_packages.py
- name: doit test_unit
run: |
conda activate test-environment
# conda activate test-environment
pytest holoviews
2 changes: 1 addition & 1 deletion holoviews/core/util.py
Original file line number Diff line number Diff line change
Expand Up @@ -929,7 +929,7 @@ def isfinite(val):
if pandas_version >= Version('1.0.0'):
if finite is pd.NA:
return False
return finite & (~pd.isna(val))
return finite & ~pd.isna(np.asarray(val))
return finite


Expand Down
11 changes: 8 additions & 3 deletions holoviews/tests/conftest.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import contextlib

import pytest

from panel.tests.conftest import server_cleanup, port, pytest_addoption, pytest_configure, optional_markers # noqa
Expand All @@ -21,13 +23,16 @@ def pytest_collection_modifyitems(config, items):
items[:] = selected


try:
with contextlib.suppress(ImportError):
import matplotlib as mpl
mpl.use('agg')


with contextlib.suppress(Exception):
# From Dask 2023.7,1 they now automatic convert strings
# https://docs.dask.org/en/stable/changelog.html#v2023-7-1
import dask
dask.config.set({"dataframe.convert-string": False})
except Exception:
pass


@pytest.fixture
Expand Down
6 changes: 4 additions & 2 deletions holoviews/tests/plotting/matplotlib/test_renderer.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,13 +56,15 @@ def test_get_size_row_plot(self):
with style.context("default"):
plot = self.renderer.get_plot(self.image1 + self.image2)
w, h = self.renderer.get_size(plot)
self.assertEqual((w, h), (576, 257))
# Depending on the backend the height may be slightly different
assert (w, h) == (576, 257) or (w, h) == (576, 259)

def test_get_size_column_plot(self):
with style.context("default"):
plot = self.renderer.get_plot((self.image1 + self.image2).cols(1))
w, h = self.renderer.get_size(plot)
self.assertEqual((w, h), (288, 509))
# Depending on the backend the height may be slightly different
assert (w, h) == (288, 509) or (w, h) == (288, 511)

def test_get_size_grid_plot(self):
grid = GridSpace({(i, j): self.image1 for i in range(3) for j in range(3)})
Expand Down
4 changes: 4 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,10 @@ filterwarnings = [
"ignore:Deprecated call to `pkg_resources.+?'sphinxcontrib:DeprecationWarning",
# 2023-09: See https://github.com/python-streamz/streamz/issues/460
"ignore: pkg_resources is deprecated as an API:DeprecationWarning:streamz.plugins",
# 2023-10: Datetime's utctimestamp() and utcnow() is deprecated in Python 3.12
"ignore:datetime.datetime.utcfromtimestamp():DeprecationWarning:dateutil.tz.tz",
"ignore:datetime.datetime.utcfromtimestamp():DeprecationWarning:bokeh", # https://github.com/bokeh/bokeh/issues/13125
"ignore:datetime.datetime.utcnow():DeprecationWarning:bokeh", # https://github.com/bokeh/bokeh/issues/13125
]

[tool.coverage]
Expand Down
5 changes: 3 additions & 2 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,6 @@
'bokeh >=3.1',
'pillow',
'plotly >=4.0',
'dash >=1.16',
'ipython >=5.4.0',
]

Expand All @@ -57,9 +56,10 @@
'selenium',
'spatialpandas',
'datashader >=0.11.1',
'dash >=1.16',
]

extras_require['test_ci'] = [
extras_require['tests_ci'] = [
'codecov',
"pytest-github-actions-annotate-failures",
]
Expand Down Expand Up @@ -181,6 +181,7 @@ def get_setup_version(reponame):
"Programming Language :: Python :: 3.9",
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
"Programming Language :: Python :: 3.12",
"Operating System :: OS Independent",
"Intended Audience :: Science/Research",
"Intended Audience :: Developers",
Expand Down
2 changes: 1 addition & 1 deletion tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

[tox]
# python version test group extra envs extra commands
envlist = {py38,py39,py310,py311}-{unit,ui,examples,all_recommended,simple}-{default}-{dev,pkg}
envlist = {py38,py39,py310,py311,py312}-{unit,ui,examples,all_recommended,simple}-{default}-{dev,pkg}

[_simple]
description = Install holoviews without any optional dependencies
Expand Down

0 comments on commit 52edaf9

Please sign in to comment.