From f7283ad18e7599ddb9094e40be12a7c9464fe194 Mon Sep 17 00:00:00 2001 From: Pablo Hoffman Date: Mon, 25 Oct 2010 14:56:33 -0200 Subject: [PATCH] skip lxml selector tests if lxml is not available. refs #147 --- scrapy/tests/test_selector_lxml.py | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) 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"""