scrapy / itemloaders

Library to populate items using XPath and CSS with a convenient API
BSD 3-Clause "New" or "Revised" License
44 stars 16 forks source link

[NestedItemTest.test_scrapy_item] test failing on python 3.9 #46

Closed chriscconte closed 3 years ago

chriscconte commented 3 years ago

Hello, I'm getting a failed test on my machine, specifically the NestedItemTest.test_scrapy_item

============================================================================ test session starts =============================================================================
platform darwin -- Python 3.9.0, pytest-6.2.4, py-1.10.0, pluggy-0.13.1
rootdir: /Users/chrisconte/itemloaders
plugins: Faker-8.6.0, anyio-2.1.0, betamax-0.8.1
collected 81 items                                                                                                                                                           

test_base_loader.py ......................................                                                                                                             [ 46%]
test_loader_initialization.py ..........                                                                                                                               [ 59%]
test_nested_items.py ...F                                                                                                                                              [ 64%]
test_nested_loader.py .....                                                                                                                                            [ 70%]
test_output_processor.py ..                                                                                                                                            [ 72%]
test_processors.py .....                                                                                                                                               [ 79%]
test_select_jmes.py .                                                                                                                                                  [ 80%]
test_selector_loader.py ..............                                                                                                                                 [ 97%]
test_utils_misc.py .                                                                                                                                                   [ 98%]
test_utils_python.py .                                                                                                                                                 [100%]

================================================================================== FAILURES ==================================================================================
______________________________________________________________________ NestedItemTest.test_scrapy_item _______________________________________________________________________

self = <test_nested_items.NestedItemTest testMethod=test_scrapy_item>

    def test_scrapy_item(self):
        try:
            from scrapy import Field, Item
        except ImportError:
            self.skipTest("Cannot import Field or Item from scrapy")

        class TestItem(Item):
            foo = Field()

>       self._test_item(TestItem(foo='bar'))

test_nested_items.py:50: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
test_nested_items.py:12: in _test_item
    self.assertEqual(il.load_item(), {'item_list': [item]})
E   AssertionError: {'item_list': ['foo']} != {'item_list': [{'foo': 'bar'}]}
E   - {'item_list': ['foo']}
E   + {'item_list': [{'foo': 'bar'}]}
E   ?                +     ++++++++
========================================================================== short test summary info ===========================================================================
FAILED test_nested_items.py::NestedItemTest::test_scrapy_item - AssertionError: {'item_list': ['foo']} != {'item_list': [{'foo': 'bar'}]}
======================================================================== 1 failed, 80 passed in 1.55s ======================================================================
chriscconte commented 3 years ago

Never mind, I updated to the latest item loaders release and you fixed it. Thanks!