[MRG] Fix tests for Travis-CI build #570
Conversation
Finally passing! |
Link(url='http://www.google.com/something', text=''), | ||
]) | ||
self.assertEqual( | ||
set([link for link in lx.extract_links(self.response)]), |
kmike
Jan 30, 2014
Member
is comparing sets still necessary? I.e. is the order of links link extractor produces semi-random?
is comparing sets still necessary? I.e. is the order of links link extractor produces semi-random?
redapple
Jan 30, 2014
Author
Contributor
should not. let's see...
should not. let's see...
@@ -5,6 +5,7 @@ | |||
|
|||
from scrapy.link import Link | |||
from .sgml import SgmlLinkExtractor | |||
from scrapy.utils.python import unique |
kmike
Jan 30, 2014
Member
is this import used?
is this import used?
redapple
Jan 30, 2014
Author
Contributor
not anymore no
not anymore no
kmike
Jan 30, 2014
Member
and that's good :) it fixes a bug where unique=False had no effect on RegexLinkExtractor
and that's good :) it fixes a bug where unique=False had no effect on RegexLinkExtractor
|
||
class XmlItemExporterTest(BaseItemExporterTest): | ||
|
||
def _get_exporter(self, **kwargs): | ||
return XmlItemExporter(self.output, **kwargs) | ||
|
||
def assertXmlEqual(self, first, second, msg=None): |
redapple
Jan 30, 2014
Author
Contributor
hey, that's nice :)
hey, that's nice :)
redapple
Jan 30, 2014
Author
Contributor
sadly, this didn't work (or I missed something)
[https://travis-ci.org/scrapy/scrapy/builds/17937034]
sadly, this didn't work (or I missed something)
[https://travis-ci.org/scrapy/scrapy/builds/17937034]
kmike
Jan 30, 2014
Member
Yep - the XML is different. Attribute order in XML doesn't matter, but element order does; it seems that our XmlItemExported exports fields in some random order, and tests show that. So this assert shouldn't be named assertXmlEqual
because it checks that two xml snippets with all children sorted are equal, not that two xml snippets are equal.
Yep - the XML is different. Attribute order in XML doesn't matter, but element order does; it seems that our XmlItemExported exports fields in some random order, and tests show that. So this assert shouldn't be named assertXmlEqual
because it checks that two xml snippets with all children sorted are equal, not that two xml snippets are equal.
redapple
Jan 30, 2014
Author
Contributor
assertXmlEquivalent
?
assertXmlEquivalent
?
kmike
Jan 31, 2014
Member
Yes, this name looks fine. Another option is to sort fields by key on export, and it has some advantages (easier testing, maybe better diffs), but that's out of the scope here.
Yes, this name looks fine. Another option is to sort fields by key on export, and it has some advantages (easier testing, maybe better diffs), but that's out of the scope here.
[MRG] Fix tests for Travis-CI build
you're welcome @dangra |
scrapy.tests.test_contrib_exporter.XmlItemExporterTest
still need work