Hi guys,
I am new to scrapy and I am trying to build an example project to play
around a bit. I have managed to build a spider that submits forms and
navigates multiple pages to find the items I want. I also integrated with a
Django application using DjangoItem. I run the spider and everything works
like a charm. Now I am trying to test my spider. I wanted to unit test the
spider prior to take a look at the constraints framework so I get a feeling
of what I can do with both approaches.
I just hardcode a webpage response and try to run the spider on it. I get
the error below when trying to run the tests. If I comment out the
DjangoItem definition and declare a regular scrapy.Item instead, it runs
the tests ok.
Is there any recommended way to unit test when using DjangoItem? I am
missing something?
Thanks!
Marcela
Traceback (most recent call last):
File "/usr/lib/python2.7/runpy.py", line 162, in _run_module_as_main
"__main__", fname, loader, pkg_name)
File "/usr/lib/python2.7/runpy.py", line 72, in _run_code
exec code in run_globals
File "/usr/lib/python2.7/unittest/__main__.py", line 12, in <module>
main(module=None)
File "/usr/lib/python2.7/unittest/main.py", line 94, in __init__
self.parseArgs(argv)
File "/usr/lib/python2.7/unittest/main.py", line 149, in parseArgs
self.createTests()
File "/usr/lib/python2.7/unittest/main.py", line 158, in createTests
self.module)
File "/usr/lib/python2.7/unittest/loader.py", line 130, in
loadTestsFromNames
suites = [self.loadTestsFromName(name, module) for name in names]
File "/usr/lib/python2.7/unittest/loader.py", line 100, in
loadTestsFromName
parent, obj = obj, getattr(obj, part)
AttributeError: 'module' object has no attribute 'tests'
--
You received this message because you are subscribed to the Google Groups
"scrapy-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/scrapy-users.
For more options, visit https://groups.google.com/d/optout.