Accepting request 921132 from home:bnavigator:branches:devel:languages:python:numeric

- Bokeh requires Python >= 3.7:  disable failing Leap builds
- Reactivate test suite (at least the unit tests packaged in the
  sdist) by adding conftest.py from the github archive

OBS-URL: https://build.opensuse.org/request/show/921132
OBS-URL: https://build.opensuse.org/package/show/devel:languages:python:numeric/python-bokeh?expand=0&rev=54
This commit is contained in:
Matej Cepl 2021-09-23 11:26:04 +00:00 committed by Git OBS Bridge
parent 80bd8f238a
commit 912f69df4d
3 changed files with 88 additions and 9 deletions

51
conftest.py Normal file
View File

@ -0,0 +1,51 @@
#-----------------------------------------------------------------------------
# Copyright (c) 2012 - 2021, Anaconda, Inc., and Bokeh Contributors.
# All rights reserved.
#
# The full license is in the file LICENSE.txt, distributed with this software.
#-----------------------------------------------------------------------------
pytest_plugins = (
"bokeh._testing.plugins.ipython",
"bokeh._testing.plugins.managed_server_loop",
"bokeh._testing.plugins.networkx",
"bokeh._testing.plugins.pandas",
)
# Standard library imports
from inspect import iscoroutinefunction
from typing import List
# External imports
import _pytest
import pytest
def pytest_collection_modifyitems(items: List[_pytest.nodes.Item]) -> None:
for item in items:
if iscoroutinefunction(item.obj):
item.add_marker(pytest.mark.asyncio)
# Unfortunately these seem to all need to be centrally defined at the top level
def pytest_addoption(parser: _pytest.config.argparsing.Parser) -> None:
# plugins/selenium
parser.addoption(
"--driver", choices=('chrome', 'firefox', 'safari'), default='chrome', help='webdriver implementation')
# plugins/bokeh_server
parser.addoption(
"--bokeh-port", dest="bokeh_port", type=int, default=5006, help="port on which Bokeh server resides"
)
# plugins/jupyter_notebook
parser.addoption(
"--notebook-port", type=int, default=6007, help="port on which Jupyter Notebook server resides"
)
parser.addoption(
"--examples-log-file", dest="log_file", metavar="path", action="store", default='examples.log', help="where to write the complete log"
)
parser.addoption(
"--no-js", action="store_true", default=False,
help="only run python code and skip js")

View File

@ -1,3 +1,10 @@
-------------------------------------------------------------------
Thu Sep 23 09:54:47 UTC 2021 - Ben Greiner <code@bnavigator.de>
- Bokeh requires Python >= 3.7: disable failing Leap builds
- Reactivate test suite (at least the unit tests packaged in the
sdist) by adding conftest.py from the github archive
------------------------------------------------------------------- -------------------------------------------------------------------
Thu Sep 23 09:53:47 UTC 2021 - Matej Cepl <mcepl@suse.com> Thu Sep 23 09:53:47 UTC 2021 - Matej Cepl <mcepl@suse.com>

View File

@ -18,19 +18,19 @@
%define skip_python2 1 %define skip_python2 1
%define skip_python36 1 %define skip_python36 1
# tests suite disabled by default. See below. %bcond_without tests
%bcond_with tests
Name: python-bokeh Name: python-bokeh
Version: 2.4.0 Version: 2.4.0
Release: 0 Release: 0
Summary: Statistical interactive HTML plots for Python Summary: Statistical interactive HTML plots for Python
License: BSD-3-Clause License: BSD-3-Clause
URL: https://github.com/bokeh/bokeh/ URL: https://github.com/bokeh/bokeh/
Source: https://files.pythonhosted.org/packages/source/b/bokeh/bokeh-%{version}.tar.gz Source0: https://files.pythonhosted.org/packages/source/b/bokeh/bokeh-%{version}.tar.gz
Source1: https://github.com/bokeh/bokeh/raw/%{version}/conftest.py
BuildRequires: %{python_module Jinja2 >= 2.9} BuildRequires: %{python_module Jinja2 >= 2.9}
BuildRequires: %{python_module Pillow >= 7.1.0} BuildRequires: %{python_module Pillow >= 7.1.0}
BuildRequires: %{python_module PyYAML >= 3.10} BuildRequires: %{python_module PyYAML >= 3.10}
BuildRequires: %{python_module devel} BuildRequires: %{python_module base >= 3.7}
BuildRequires: %{python_module numpy >= 1.11.3} BuildRequires: %{python_module numpy >= 1.11.3}
BuildRequires: %{python_module packaging >= 16.8} BuildRequires: %{python_module packaging >= 16.8}
BuildRequires: %{python_module python-dateutil >= 2.1} BuildRequires: %{python_module python-dateutil >= 2.1}
@ -56,13 +56,14 @@ BuildArch: noarch
%if %{with tests} %if %{with tests}
BuildRequires: %{python_module beautifulsoup4} BuildRequires: %{python_module beautifulsoup4}
BuildRequires: %{python_module flaky} BuildRequires: %{python_module flaky}
# Note: If you manage to activate the test suite, try to patch external mock out.
BuildRequires: %{python_module mock}
BuildRequires: %{python_module nbconvert} BuildRequires: %{python_module nbconvert}
BuildRequires: %{python_module networkx} BuildRequires: %{python_module networkx}
BuildRequires: %{python_module pydot}
BuildRequires: %{python_module pytest-asyncio}
BuildRequires: %{python_module pytest} BuildRequires: %{python_module pytest}
BuildRequires: %{python_module requests} BuildRequires: %{python_module requests}
BuildRequires: %{python_module selenium} BuildRequires: %{python_module selenium}
BuildRequires: nodejs >= 14
%endif %endif
# /SECTION # /SECTION
%python_subpackages %python_subpackages
@ -75,6 +76,15 @@ with interactivity over large or streaming datasets.
%prep %prep
%autosetup -p1 -n bokeh-%{version} %autosetup -p1 -n bokeh-%{version}
# add conftest.py for pytest fixtures
cp %{SOURCE1} .
# remove external mock in favor of unittest.mock
find tests -name '*.py' -exec \
sed -i {} \
-e 's/^import mock/from unittest import mock/' \
-e 's/^from mock import mock/from unittest import mock/' \
-e 's/^from mock import/from unittest.mock import/' \
';'
%build %build
%python_build %python_build
@ -93,9 +103,20 @@ with interactivity over large or streaming datasets.
%if %{with tests} %if %{with tests}
%check %check
# Running the test suite (with datafiles from the GitHub archive) fails # GUI based selenium with chromedriver setup within OBS is hard/impossible
# due to missing server/client setups, chromedriver, selenium etc. deselectmarker="selenium"
%pytest -k 'not (selenium or sampledata)' # sampledata: no download
deselectmarker+=" or sampledata"
# npm can't build inside obs without network
deselectname="test_ext_commands"
# testfile not packaged in sdist
deselectname+=" or test_with_INLINE_resources"
deselectname+=" or test_with_CDN_resources"
# does not expect pytest-$binsuffix
deselectname+=" or test_detect_current_filename"
# no browser installed
deselectname+=" or test_webdriver"
%pytest -m "not ($deselectmarker)" -k "not ($deselectname)"
%endif %endif
%post %post