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:
parent
80bd8f238a
commit
912f69df4d
51
conftest.py
Normal file
51
conftest.py
Normal 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")
|
@ -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>
|
||||
|
||||
|
@ -18,19 +18,19 @@
|
||||
|
||||
%define skip_python2 1
|
||||
%define skip_python36 1
|
||||
# tests suite disabled by default. See below.
|
||||
%bcond_with tests
|
||||
%bcond_without tests
|
||||
Name: python-bokeh
|
||||
Version: 2.4.0
|
||||
Release: 0
|
||||
Summary: Statistical interactive HTML plots for Python
|
||||
License: BSD-3-Clause
|
||||
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 Pillow >= 7.1.0}
|
||||
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 packaging >= 16.8}
|
||||
BuildRequires: %{python_module python-dateutil >= 2.1}
|
||||
@ -56,13 +56,14 @@ BuildArch: noarch
|
||||
%if %{with tests}
|
||||
BuildRequires: %{python_module beautifulsoup4}
|
||||
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 networkx}
|
||||
BuildRequires: %{python_module pydot}
|
||||
BuildRequires: %{python_module pytest-asyncio}
|
||||
BuildRequires: %{python_module pytest}
|
||||
BuildRequires: %{python_module requests}
|
||||
BuildRequires: %{python_module selenium}
|
||||
BuildRequires: nodejs >= 14
|
||||
%endif
|
||||
# /SECTION
|
||||
%python_subpackages
|
||||
@ -75,6 +76,15 @@ with interactivity over large or streaming datasets.
|
||||
|
||||
%prep
|
||||
%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
|
||||
%python_build
|
||||
@ -93,9 +103,20 @@ with interactivity over large or streaming datasets.
|
||||
|
||||
%if %{with tests}
|
||||
%check
|
||||
# Running the test suite (with datafiles from the GitHub archive) fails
|
||||
# due to missing server/client setups, chromedriver, selenium etc.
|
||||
%pytest -k 'not (selenium or sampledata)'
|
||||
# GUI based selenium with chromedriver setup within OBS is hard/impossible
|
||||
deselectmarker="selenium"
|
||||
# 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
|
||||
|
||||
%post
|
||||
|
Loading…
Reference in New Issue
Block a user