scrapinghub / scrapy-autounit

Automatic unit test generation for Scrapy.
BSD 3-Clause "New" or "Revised" License
55 stars 13 forks source link

Filter spider attributes #77

Closed mabelvj closed 4 years ago

mabelvj commented 4 years ago

I am facing one issue where I am recording tests for spiders that store complex objects with memory addresses.

When I run the tests I get an error about the objects being different for the fixture and the output of the callback.

I propose we could add a filter or reuse AUTOUNIT_SKIPPED_FIELDS to avoid checking those attributes.

fcanobrash commented 4 years ago

Hi @mabelvj, thanks for working in this. There's an ongoing refactoring here https://github.com/scrapinghub/scrapy-autounit/tree/refactoring that actually covers this memory addresses issue. I hope we can merge and release these changes by the end of June.

teledyn commented 4 years ago

any update on this issue? I have the same problem, needing to exclude spider attributes that are object references. The strategy in #78 would be quite sufficient while we wait for a refactoring!

I am using scrapy-autounit==0.0.27 as fetched via pip

As mentioned in the PR, I'd be quite happy with an equivalent to AUTOUNIT_SKIPPED_FIELDS :)

fcanobrash commented 4 years ago

Fixed in v0.0.28. The new AUTOUNIT_DONT_TEST_SPIDER_ATTRS can be used achieve this behavior. Please don't forget to run autounit update as soon as you install v0.0.28 to update your current tests and fixtures.