1
0

Accepting request 1066414 from devel:languages:python

OBS-URL: https://build.opensuse.org/request/show/1066414
OBS-URL: https://build.opensuse.org/package/show/openSUSE:Factory/python-pyquery?expand=0&rev=21
This commit is contained in:
2023-02-19 17:18:28 +00:00
committed by Git OBS Bridge
3 changed files with 52 additions and 4 deletions

View File

@@ -0,0 +1,38 @@
---
tests/test_pyquery.py | 11 ++++++++---
1 file changed, 8 insertions(+), 3 deletions(-)
--- a/tests/test_pyquery.py
+++ b/tests/test_pyquery.py
@@ -7,9 +7,12 @@ import time
from lxml import etree
from pyquery.pyquery import PyQuery as pq, no_default
from pyquery.openers import HAS_REQUEST
-from webtest import http
-from webtest.debugapp import debug_app
-from unittest import TestCase
+from unittest import TestCase, skipIf
+try:
+ from webtest import http
+ from webtest.debugapp import debug_app
+except (ImportError, ModuleNotFoundError):
+ http = None
sys.path.insert(0, os.path.dirname(os.path.dirname(__file__)))
@@ -835,6 +838,7 @@ class TestXMLNamespace(TestCase):
self.assertEqual(repr(val), repr('b'))
+@skipIf(http is None, "Cannot test without WebTest")
class TestWebScrapping(TestCase):
def setUp(self):
@@ -879,6 +883,7 @@ class TestWebScrappingEncoding(TestCase)
self.assertEqual(d('#pt-login').text(), u'Войти')
+@skipIf(http is None, "Cannot test without WebTest")
class TestWebScrappingTimeouts(TestCase):
def setUp(self):

View File

@@ -1,3 +1,9 @@
-------------------------------------------------------------------
Fri Feb 17 16:46:13 UTC 2023 - Matej Cepl <mcepl@suse.com>
- Add make_webtest_optional.patch to allow testing without
WebTest module.
-------------------------------------------------------------------
Fri Aug 19 11:41:24 UTC 2022 - Ben Greiner <code@bnavigator.de>

View File

@@ -1,7 +1,7 @@
#
# spec file
#
# Copyright (c) 2022 SUSE LLC
# Copyright (c) 2023 SUSE LLC
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
@@ -16,7 +16,6 @@
#
%{?!python_module:%define python_module() python3-%{**}}
%define skip_python2 1
%global flavor @BUILD_FLAVOR@%{nil}
%if "%{flavor}" == "test"
@@ -34,6 +33,9 @@ License: BSD-3-Clause
Group: Development/Languages/Python
URL: https://pypi.python.org/pypi/pyquery
Source: https://files.pythonhosted.org/packages/source/p/pyquery/pyquery-%{version}.tar.gz
# PATCH-FIX-OPENSUSE make_webtest_optional.patch mcepl@suse.com
# Make it possible to run test suite (albeit partial) without WebTest module
Patch0: make_webtest_optional.patch
BuildRequires: %{python_module cssselect > 0.7.9}
BuildRequires: %{python_module lxml >= 2.1}
BuildRequires: %{python_module setuptools}
@@ -44,9 +46,11 @@ Requires: python-lxml >= 2.1
BuildArch: noarch
%if %{with test}
BuildRequires: %{python_module WebOb > 1.1.9}
BuildRequires: %{python_module WebTest}
BuildRequires: %{python_module pytest}
BuildRequires: %{python_module requests}
%if 0%{?suse_version} > 1550
BuildRequires: %{python_module WebTest}
%endif
%endif
%python_subpackages
@@ -56,7 +60,7 @@ as much as possible the similar to jQuery. Pyquery uses lxml for fast
XML and HTML manipulation.
%prep
%setup -q -n pyquery-%{version}
%autosetup -p1 -n pyquery-%{version}
%build
%python_build