forked from pool/python-pyquery
Accepting request 1066413 from home:dirkmueller:acdc
- Add make_webtest_optional.patch to allow testing without WebTest module. OBS-URL: https://build.opensuse.org/request/show/1066413 OBS-URL: https://build.opensuse.org/package/show/devel:languages:python/python-pyquery?expand=0&rev=40
This commit is contained in:
38
make_webtest_optional.patch
Normal file
38
make_webtest_optional.patch
Normal 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):
|
Reference in New Issue
Block a user