kombu: 5.3.x: pytest is failing (test units depend on each other)

+ /usr/bin/python3 -Bm pytest -ra --ignore t/unit/transport/test_pyro.py --ignore t/unit/transport/test_azureservicebus.py --ignore kombu/transport/azureservicebus.py
=========================================================================== test session starts ============================================================================
platform linux -- Python 3.8.9, pytest-6.2.4, py-1.10.0, pluggy-0.13.1
Using --randomly-seed=2939350551
rootdir: /home/tkloczko/rpmbuild/BUILD/kombu-5.1.0, configfile: setup.cfg, testpaths: t/unit/
plugins: forked-1.3.0, shutil-1.7.0, virtualenv-1.7.0, expect-1.1.0, httpbin-1.0.0, xdist-2.2.1, flake8-1.0.7, timeout-1.4.2, betamax-0.8.1, pyfakefs-4.4.0, freezegun-0.4.2, cases-3.4.6, case-1.5.3, isort-1.3.0, aspectlib-1.5.2, asyncio-0.15.1, toolbox-0.5, xprocess-0.17.1, aiohttp-0.3.0, checkdocs-2.7.0, mock-3.6.1, rerunfailures-9.1.1, requests-mock-1.9.3, Faker-8.4.0, cov-2.12.1, randomly-3.8.0, hypothesis-6.13.12
collected 1050 items / 10 skipped / 1040 selected

t/unit/asynchronous/test_timer.py ................                                                                                                                   [  1%]
t/unit/utils/test_time.py ........                                                                                                                                   [  2%]
t/unit/transport/test_memory.py ........                                                                                                                             [  3%]
t/unit/utils/test_debug.py ..                                                                                                                                        [  3%]
t/unit/test_matcher.py ...                                                                                                                                           [  3%]
t/unit/utils/test_imports.py .....                                                                                                                                   [  4%]
t/unit/asynchronous/http/test_http.py .............                                                                                                                  [  5%]
t/unit/utils/test_url.py ...................                                                                                                                         [  7%]
t/unit/asynchronous/test_semaphore.py .                                                                                                                              [  7%]
t/unit/transport/test_filesystem.py ..                                                                                                                               [  7%]
t/unit/utils/test_objects.py ..                                                                                                                                      [  7%]
t/unit/test_serialization.py .....F.........................                                                                                                         [ 10%]
t/unit/asynchronous/http/test_curl.py .........                                                                                                                      [ 11%]
t/unit/transport/test_sqlalchemy.py ...                                                                                                                              [ 11%]
t/unit/test_compat.py ......................                                                                                                                         [ 13%]
t/unit/transport/test_qpid.py ssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssss [ 26%]
ssssssssssssssssssssssssssssss                                                                                                                                       [ 29%]
t/unit/transport/test_base.py ..............................                                                                                                         [ 32%]
t/unit/test_log.py ....................                                                                                                                              [ 34%]
t/unit/utils/test_scheduling.py .......                                                                                                                              [ 34%]
t/unit/asynchronous/test_hub.py .............................................                                                                                        [ 39%]
t/unit/test_message.py ....                                                                                                                                          [ 39%]
t/unit/utils/test_compat.py ......                                                                                                                                   [ 40%]
t/unit/test_compression.py s.......s...                                                                                                                              [ 41%]
t/unit/utils/test_functional.py ..................................                                                                                                   [ 44%]
t/unit/test_connection.py .......................................................................................s.........s.                                        [ 53%]
t/unit/utils/test_encoding.py .........                                                                                                                              [ 54%]
t/unit/transport/virtual/test_base.py ..........................................................                                                                     [ 60%]
t/unit/transport/test_pyamqp.py ..................                                                                                                                   [ 61%]
t/unit/test_mixins.py ....................                                                                                                                           [ 63%]
t/unit/test_pools.py .F.......................                                                                                                                       [ 66%]
t/unit/utils/test_json.py ...........                                                                                                                                [ 67%]
t/unit/transport/virtual/test_exchange.py ............FFFF.........                                                                                                  [ 69%]
t/unit/utils/test_uuid.py ..                                                                                                                                         [ 69%]
t/unit/utils/test_div.py ..                                                                                                                                          [ 70%]
t/unit/test_exceptions.py .                                                                                                                                          [ 70%]
t/unit/test_common.py .............................                                                                                                                  [ 72%]
t/unit/test_clocks.py .....                                                                                                                                          [ 73%]
t/unit/test_pidbox.py F.......................                                                                                                                       [ 75%]
t/unit/utils/test_utils.py ......                                                                                                                                    [ 76%]
t/unit/transport/test_transport.py ....                                                                                                                              [ 76%]
t/unit/transport/test_redis.py ..............................................................................................                                        [ 85%]
t/unit/test_entity.py .......F..................................................                                                                                     [ 91%]
t/unit/test_messaging.py .............................................................F.                                                                             [ 97%]
t/unit/utils/test_amq_manager.py ...                                                                                                                                 [ 97%]
t/unit/test_simple.py ..................F.........                                                                                                                   [100%]

================================================================================= FAILURES =================================================================================
____________________________________________________________________ test_Serialization.test_yaml_loads ____________________________________________________________________

self = <t.unit.test_serialization.test_Serialization object at 0x7f0195258670>

    def test_yaml_loads(self):
        pytest.importorskip('yaml')
        register_yaml()
>       assert loads(
            yaml_data,
            content_type='application/x-yaml',
            content_encoding='utf-8') == py_data

t/unit/test_serialization.py:225:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

self = <kombu.serialization.SerializerRegistry object at 0x7f019637c820>
data = 'float: 3.1415926500000002\nint: 10\nlist: [george, jerry, elaine, cosmo]\nstring: The quick brown fox jumps over the lazy dog\nunicode: "Th\\xE9 quick brown fox jumps over th\\xE9 lazy dog"\n'
content_type = 'application/x-yaml', content_encoding = 'utf-8', accept = None, force = False, _trusted_content = frozenset({'application/data', 'application/text'})

    def loads(self, data, content_type, content_encoding,
              accept=None, force=False, _trusted_content=TRUSTED_CONTENT):
        """Decode serialized data.

        Deserialize a data stream as serialized using `dumps`
        based on `content_type`.

        Arguments:
            data (bytes, buffer, str): The message data to deserialize.

            content_type (str): The content-type of the data.
                (e.g., `application/json`).

            content_encoding (str): The content-encoding of the data.
                (e.g., `utf-8`, `binary`, or `us-ascii`).

            accept (Set): List of content-types to accept.

        Raises:
            ContentDisallowed: If the content-type is not accepted.

        Returns:
            Any: The unserialized data.
        """
        content_type = (bytes_to_str(content_type) if content_type
                        else 'application/data')
        if accept is not None:
            if content_type not in _trusted_content \
                    and content_type not in accept:
                raise self._for_untrusted_content(content_type, 'untrusted')
        else:
            if content_type in self._disabled_content_types and not force:
>               raise self._for_untrusted_content(content_type, 'disabled')
E               kombu.exceptions.ContentDisallowed: Refusing to deserialize disabled content of type yaml (application/x-yaml)

kombu/serialization.py:248: ContentDisallowed
_____________________________________________________________________ test_PoolGroup.test_Connections ______________________________________________________________________

self = <t.unit.test_pools.test_PoolGroup object at 0x7f01927e4610>

    def test_Connections(self):
        conn = Connection('memory://')
        p = pools.connections[conn]
        assert p
        assert isinstance(p, ConnectionPool)
>       assert p.connection is conn
E       assert <Connection: memory://localhost// at 0x7f01927e4880> is <Connection: memory://localhost// at 0x7f01927f08b0>
E        +  where <Connection: memory://localhost// at 0x7f01927e4880> = <kombu.connection.ConnectionPool object at 0x7f01927f0280>.connection

t/unit/test_pools.py:151: AssertionError
---------------------------------------------------------------------------- Captured log call -----------------------------------------------------------------------------
WARNING  kombu.connection:connection.py:631 No hostname was supplied. Reverting to default 'localhost'
WARNING  kombu.connection:connection.py:631 No hostname was supplied. Reverting to default 'localhost'
WARNING  kombu.connection:connection.py:631 No hostname was supplied. Reverting to default 'localhost'
WARNING  kombu.connection:connection.py:631 No hostname was supplied. Reverting to default 'localhost'
___________________________________________________ test_TopicMultibind.test_lookup[eFoo-stock.us.nasdaq-None-expected0] ___________________________________________________

self = <t.unit.transport.virtual.test_exchange.test_TopicMultibind object at 0x7f019348f7f0>, exchange = 'eFoo', routing_key = 'stock.us.nasdaq', default = None
expected = {'rFoo'}

    @pytest.mark.parametrize('exchange,routing_key,default,expected', [
        ('eFoo', 'stock.us.nasdaq', None, {'rFoo'}),
        ('eFoo', 'stock.europe.OSE', None, {'rFoo'}),
        ('eFoo', 'stockxeuropexOSE', None, {'rFoo'}),
        ('eFoo', 'candy.schleckpulver.snap_crackle', None, {'rFoo'}),
    ])
    def test_lookup(self, exchange, routing_key, default, expected):
>       assert self.e._compiled
E       assert {}
E        +  where {} = <kombu.transport.virtual.exchange.TopicExchange object at 0x7f019348f940>._compiled
E        +    where <kombu.transport.virtual.exchange.TopicExchange object at 0x7f019348f940> = <t.unit.transport.virtual.test_exchange.test_TopicMultibind object at 0x7f019348f7f0>.e

t/unit/transport/virtual/test_exchange.py:129: AssertionError
__________________________________________________ test_TopicMultibind.test_lookup[eFoo-stockxeuropexOSE-None-expected2] ___________________________________________________

self = <t.unit.transport.virtual.test_exchange.test_TopicMultibind object at 0x7f019348f280>, exchange = 'eFoo', routing_key = 'stockxeuropexOSE', default = None
expected = {'rFoo'}

    @pytest.mark.parametrize('exchange,routing_key,default,expected', [
        ('eFoo', 'stock.us.nasdaq', None, {'rFoo'}),
        ('eFoo', 'stock.europe.OSE', None, {'rFoo'}),
        ('eFoo', 'stockxeuropexOSE', None, {'rFoo'}),
        ('eFoo', 'candy.schleckpulver.snap_crackle', None, {'rFoo'}),
    ])
    def test_lookup(self, exchange, routing_key, default, expected):
>       assert self.e._compiled
E       assert {}
E        +  where {} = <kombu.transport.virtual.exchange.TopicExchange object at 0x7f0193406130>._compiled
E        +    where <kombu.transport.virtual.exchange.TopicExchange object at 0x7f0193406130> = <t.unit.transport.virtual.test_exchange.test_TopicMultibind object at 0x7f019348f280>.e

t/unit/transport/virtual/test_exchange.py:129: AssertionError
__________________________________________ test_TopicMultibind.test_lookup[eFoo-candy.schleckpulver.snap_crackle-None-expected3] ___________________________________________

self = <t.unit.transport.virtual.test_exchange.test_TopicMultibind object at 0x7f0193406df0>, exchange = 'eFoo', routing_key = 'candy.schleckpulver.snap_crackle'
default = None, expected = {'rFoo'}

    @pytest.mark.parametrize('exchange,routing_key,default,expected', [
        ('eFoo', 'stock.us.nasdaq', None, {'rFoo'}),
        ('eFoo', 'stock.europe.OSE', None, {'rFoo'}),
        ('eFoo', 'stockxeuropexOSE', None, {'rFoo'}),
        ('eFoo', 'candy.schleckpulver.snap_crackle', None, {'rFoo'}),
    ])
    def test_lookup(self, exchange, routing_key, default, expected):
>       assert self.e._compiled
E       assert {}
E        +  where {} = <kombu.transport.virtual.exchange.TopicExchange object at 0x7f0193406ca0>._compiled
E        +    where <kombu.transport.virtual.exchange.TopicExchange object at 0x7f0193406ca0> = <t.unit.transport.virtual.test_exchange.test_TopicMultibind object at 0x7f0193406df0>.e

t/unit/transport/virtual/test_exchange.py:129: AssertionError
__________________________________________________ test_TopicMultibind.test_lookup[eFoo-stock.europe.OSE-None-expected1] ___________________________________________________

self = <t.unit.transport.virtual.test_exchange.test_TopicMultibind object at 0x7f0193410370>, exchange = 'eFoo', routing_key = 'stock.europe.OSE', default = None
expected = {'rFoo'}

    @pytest.mark.parametrize('exchange,routing_key,default,expected', [
        ('eFoo', 'stock.us.nasdaq', None, {'rFoo'}),
        ('eFoo', 'stock.europe.OSE', None, {'rFoo'}),
        ('eFoo', 'stockxeuropexOSE', None, {'rFoo'}),
        ('eFoo', 'candy.schleckpulver.snap_crackle', None, {'rFoo'}),
    ])
    def test_lookup(self, exchange, routing_key, default, expected):
>       assert self.e._compiled
E       assert {}
E        +  where {} = <kombu.transport.virtual.exchange.TopicExchange object at 0x7f0193410550>._compiled
E        +    where <kombu.transport.virtual.exchange.TopicExchange object at 0x7f0193410550> = <t.unit.transport.virtual.test_exchange.test_TopicMultibind object at 0x7f0193410370>.e

t/unit/transport/virtual/test_exchange.py:129: AssertionError
__________________________________________________________________________ test_Mailbox.test_call __________________________________________________________________________

self = <t.unit.test_pidbox.test_Mailbox object at 0x7f019346aca0>

    def test_call(self):
        assert self.bound.call(['some_node'], 'mymethod') == 'COLLECTED'
        consumer = self.node.Consumer()
>       assert is_call(self.get_next(consumer))

t/unit/test_pidbox.py:331:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

message = None

    def is_call(message):
>       return message['method'] and message['reply_to']
E       TypeError: 'NoneType' object is not subscriptable

t/unit/test_pidbox.py:18: TypeError
_______________________________________________________________ test_Queue.test_basic_get__accept_disallowed _______________________________________________________________

self = <t.unit.test_entity.test_Queue object at 0x7f0192a07fa0>

    def test_basic_get__accept_disallowed(self):
        conn = Connection('memory://')
        q = Queue('foo', exchange=self.exchange)
        p = Producer(conn)
        p.publish(
            {'complex': object()},
            declare=[q], exchange=self.exchange, serializer='pickle',
        )

        message = q(conn).get(no_ack=True)
        assert message is not None

        with pytest.raises(q.ContentDisallowed):
>           message.decode()
E           Failed: DID NOT RAISE <class 'kombu.exceptions.ContentDisallowed'>

t/unit/test_entity.py:259: Failed
______________________________________________________________ test_Consumer.test_accept__content_disallowed _______________________________________________________________

self = <t.unit.test_messaging.test_Consumer object at 0x7f01928cc0a0>

    def test_accept__content_disallowed(self):
        conn = Connection('memory://')
        q = Queue('foo', exchange=self.exchange)
        p = conn.Producer()
        p.publish(
            {'complex': object()},
            declare=[q], exchange=self.exchange, serializer='pickle',
        )

        callback = Mock(name='callback')
        with conn.Consumer(queues=[q], callbacks=[callback]) as consumer:
            with pytest.raises(consumer.ContentDisallowed):
>               conn.drain_events(timeout=1)
E               Failed: DID NOT RAISE <class 'kombu.exceptions.ContentDisallowed'>

t/unit/test_messaging.py:305: Failed
_______________________________________________________________________ test_SimpleQueue.test_clear ________________________________________________________________________

self = <t.unit.test_simple.test_SimpleQueue object at 0x7f01928d8d90>

    def test_clear(self):
        q = self.Queue('test_clear', no_ack=True)

        for i in range(10):
            q.put({'hello': 'SimplePurge%d' % (i,)})

>       assert q.clear() == 10
E       assert 20 == 10
E        +  where 20 = <bound method SimpleBase.clear of <kombu.simple.SimpleQueue object at 0x7f01929b4610>>()
E        +    where <bound method SimpleBase.clear of <kombu.simple.SimpleQueue object at 0x7f01929b4610>> = <kombu.simple.SimpleQueue object at 0x7f01929b4610>.clear

t/unit/test_simple.py:89: AssertionError
========================================================================= short test summary info ==========================================================================
SKIPPED [4] t/unit/asynchronous/aws/case.py:5: could not import 'boto3': No module named 'boto3'
SKIPPED [1] t/unit/transport/test_SQS.py:21: could not import 'boto3': No module named 'boto3'
SKIPPED [1] t/unit/transport/test_consul.py:9: could not import 'consul': No module named 'consul'
SKIPPED [1] t/unit/transport/test_etcd.py:9: could not import 'etcd': No module named 'etcd'
SKIPPED [1] t/unit/transport/test_librabbitmq.py:5: could not import 'librabbitmq': No module named 'librabbitmq'
SKIPPED [1] t/unit/transport/test_mongodb.py:10: could not import 'pymongo': No module named 'pymongo'
SKIPPED [1] t/unit/transport/test_zookeeper.py:5: could not import 'kazoo': No module named 'kazoo'
SKIPPED [164] t/unit/transport/test_qpid.py: Not supported in Python3
SKIPPED [1] t/unit/test_compression.py:66: could not import 'zstandard': No module named 'zstandard'
SKIPPED [1] t/unit/test_compression.py:29: could not import 'zstandard': No module named 'zstandard'
SKIPPED [1] t/unit/test_connection.py:104: TODO: urllib cannot parse ipv6 urls
SKIPPED [1] t/unit/test_connection.py:52: could not import 'pymongo': No module named 'pymongo'
FAILED t/unit/test_serialization.py::test_Serialization::test_yaml_loads - kombu.exceptions.ContentDisallowed: Refusing to deserialize disabled content of type yaml (app...
FAILED t/unit/test_pools.py::test_PoolGroup::test_Connections - assert <Connection: memory://localhost// at 0x7f01927e4880> is <Connection: memory://localhost// at 0x7f0...
FAILED t/unit/transport/virtual/test_exchange.py::test_TopicMultibind::test_lookup[eFoo-stock.us.nasdaq-None-expected0] - assert {}
FAILED t/unit/transport/virtual/test_exchange.py::test_TopicMultibind::test_lookup[eFoo-stockxeuropexOSE-None-expected2] - assert {}
FAILED t/unit/transport/virtual/test_exchange.py::test_TopicMultibind::test_lookup[eFoo-candy.schleckpulver.snap_crackle-None-expected3] - assert {}
FAILED t/unit/transport/virtual/test_exchange.py::test_TopicMultibind::test_lookup[eFoo-stock.europe.OSE-None-expected1] - assert {}
FAILED t/unit/test_pidbox.py::test_Mailbox::test_call - TypeError: 'NoneType' object is not subscriptable
FAILED t/unit/test_entity.py::test_Queue::test_basic_get__accept_disallowed - Failed: DID NOT RAISE <class 'kombu.exceptions.ContentDisallowed'>
FAILED t/unit/test_messaging.py::test_Consumer::test_accept__content_disallowed - Failed: DID NOT RAISE <class 'kombu.exceptions.ContentDisallowed'>
FAILED t/unit/test_simple.py::test_SimpleQueue::test_clear - assert 20 == 10
=============================================================== 10 failed, 872 passed, 178 skipped in 19.02s ===============================================================

About this issue

  • Original URL
  • State: open
  • Created 3 years ago
  • Comments: 21 (10 by maintainers)

Most upvoted comments

Yes. This is a long standing bug of the test suite. Some tests just depend on each other. Could you edit this issue to reflect that?

If that is true use pytest-randomly + https://github.com/mrbean-bremen/pytest-find-dependencies/ shoud help expose all those points where one unit depends on what does other one.