Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use Python 3.12 for core test #5909

Merged
merged 20 commits into from
Oct 11, 2023
Merged
Show file tree
Hide file tree
Changes from 17 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
41 changes: 25 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,35 @@ jobs:
DESC: "Python ${{ matrix.python-version }}, ${{ matrix.os }} core tests"
PYTHON_VERSION: ${{ matrix.python-version }}
steps:
- uses: holoviz-dev/holoviz_tasks/install@v0.1a17
# Add back when this works on Python 3.12
# - uses: holoviz-dev/holoviz_tasks/install@v0.1a17
# 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
- 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))
Copy link
Member Author

@hoxbro hoxbro Oct 10, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

From this Python 3.12 warning: Bitwise inversion '~' on bool is deprecated. This returns the bitwise inversion of the underlying int object and is usually not what you expect from negating a bool. Use the 'not' operator for boolean negation or ~int(x) if you really want the bitwise inversion of the underlying int.

And val sometimes could be None or a tuple of None.
image

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
3 changes: 3 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,9 @@ 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.utctimestamp() 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
]

[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',
'pillow',
'plotly >=4.0',
'dash >=1.16',
Copy link
Member Author

@hoxbro hoxbro Sep 27, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not a core-test package. Moved it down to tests.

'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 @@ -184,6 +184,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
Loading