Skip to content

Scrapy, a fast high-level web crawling & scraping framework for Python.

skip lxml selector tests if lxml is not available. refs #147

Pablo Hoffmanf7283ad18e75
diff --git a/scrapy/tests/test_selector_lxml.py b/scrapy/tests/test_selector_lxml.py
index 2c977431f..8a079ef1e 100644
--- a/scrapy/tests/test_selector_lxml.py
+++ b/scrapy/tests/test_selector_lxml.py
@@ -1,16 +1,25 @@
# TODO: we should merge these tests with test_selector_libxml2.py
import re
-import unittest
import weakref
+from twisted.trial import unittest
+
from scrapy.http import TextResponse, HtmlResponse, XmlResponse
-from scrapy.selector.lxmlsel import XmlXPathSelector, HtmlXPathSelector, \
- XPathSelector
+nolxml = False
+try:
+ from scrapy.selector.lxmlsel import XmlXPathSelector, HtmlXPathSelector, \
+ XPathSelector
+except ImportError:
+ nolxml = True
+
from scrapy.utils.test import libxml2debug
class XPathSelectorTestCase(unittest.TestCase):
+ if nolxml:
+ skip = "lxml not available"
+
@libxml2debug
def test_selector_simple(self):
"""Simple selector tests"""