Coder Social home page Coder Social logo

py-asynq's People

Contributors

glf9832 avatar ryancartoon avatar

Stargazers

 avatar  avatar  avatar

Watchers

 avatar

Forkers

glf9832

py-asynq's Issues

pytest failed

========================================================================================================= test session starts ==========================================================================================================
platform linux -- Python 3.9.15, pytest-5.4.3, py-1.11.0, pluggy-0.13.1
rootdir: /home/greene/workspace/py-asynq
collected 1 item

tests/test_asynq_py.py F                                                                                                                                                                                                         [100%]

=============================================================================================================== FAILURES ===============================================================================================================
______________________________________________________________________________________________________ test_asynq_client_enqueue _______________________________________________________________________________________________________

redis_conn = Redis<ConnectionPool<Connection<host=localhost,port=6379,db=0>>>

    def test_asynq_client_enqueue(redis_conn):
        asynq_client = AsynqClient(redis_conn)
        msg_id = str(uuid4())
        queue_name = "test_queue_name"
        msg_type = "test_type"
        payload = dict(foo="bar")
        msg = asynq_client.gen_msg(queue_name, msg_type, payload)
        msg.id = msg_id

        try:
            asynq_client.enqueue(msg)

            # asynq:{test_queue_name}:t:e6adba7b-018f-4912-9b3f-ad97fe00f00c  hash
            # asynq:{test_queue_name}:pending list

            task_info_key = "asynq:{%s}:t:%s" % (msg.queue, msg.id)
            pending_task_key = "asynq:{%s}:pending" % (msg.queue)

            task_info = redis_conn.hgetall(task_info_key)
            task_ids = redis_conn.lrange(pending_task_key, 0, -1)

            assert task_info[b'state'] == b'pending'
            assert task_info[b'msg'] == msg.SerializeToString()
>           assert task_ids == [msg_id.encode()]
E           AssertionError: assert [b'14d8499c-d...d56a01a88993'] == [b'14d8499c-d...4bdc10ca1ca9']
E             Left contains 3 more items, first extra item: b'24b754c3-3b84-44a7-ae69-5b459026a2a1'
E             Use -v to get the full diff

tests/test_asynq_py.py:29: AssertionError

During handling of the above exception, another exception occurred:

redis_conn = Redis<ConnectionPool<Connection<host=localhost,port=6379,db=0>>>

    def test_asynq_client_enqueue(redis_conn):
        asynq_client = AsynqClient(redis_conn)
        msg_id = str(uuid4())
        queue_name = "test_queue_name"
        msg_type = "test_type"
        payload = dict(foo="bar")
        msg = asynq_client.gen_msg(queue_name, msg_type, payload)
        msg.id = msg_id

        try:
            asynq_client.enqueue(msg)

            # asynq:{test_queue_name}:t:e6adba7b-018f-4912-9b3f-ad97fe00f00c  hash
            # asynq:{test_queue_name}:pending list

            task_info_key = "asynq:{%s}:t:%s" % (msg.queue, msg.id)
            pending_task_key = "asynq:{%s}:pending" % (msg.queue)

            task_info = redis_conn.hgetall(task_info_key)
            task_ids = redis_conn.lrange(pending_task_key, 0, -1)

            assert task_info[b'state'] == b'pending'
            assert task_info[b'msg'] == msg.SerializeToString()
            assert task_ids == [msg_id.encode()]

        finally:
>           redis_conn.delete(task_info_key, task_ids)

tests/test_asynq_py.py:32:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
../../.cache/pypoetry/virtualenvs/asynq-py-MNhgrnTM-py3.9/lib/python3.9/site-packages/redis/commands/core.py:1611: in delete
    return self.execute_command("DEL", *names)
../../.cache/pypoetry/virtualenvs/asynq-py-MNhgrnTM-py3.9/lib/python3.9/site-packages/redis/client.py:1258: in execute_command
    return conn.retry.call_with_retry(
../../.cache/pypoetry/virtualenvs/asynq-py-MNhgrnTM-py3.9/lib/python3.9/site-packages/redis/retry.py:46: in call_with_retry
    return do()
../../.cache/pypoetry/virtualenvs/asynq-py-MNhgrnTM-py3.9/lib/python3.9/site-packages/redis/client.py:1259: in <lambda>
    lambda: self._send_command_parse_response(
../../.cache/pypoetry/virtualenvs/asynq-py-MNhgrnTM-py3.9/lib/python3.9/site-packages/redis/client.py:1234: in _send_command_parse_response
    conn.send_command(*args)
../../.cache/pypoetry/virtualenvs/asynq-py-MNhgrnTM-py3.9/lib/python3.9/site-packages/redis/connection.py:788: in send_command
    self.pack_command(*args), check_health=kwargs.get("check_health", True)
../../.cache/pypoetry/virtualenvs/asynq-py-MNhgrnTM-py3.9/lib/python3.9/site-packages/redis/connection.py:846: in pack_command
    for arg in map(self.encoder.encode, args):
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

self = <redis.connection.Encoder object at 0x7f410e94b820>, value = [b'14d8499c-de1f-40d7-87c8-4bdc10ca1ca9', b'24b754c3-3b84-44a7-ae69-5b459026a2a1', b'948dd765-8aef-464f-85a2-8ac95a34b78d', b'3faf5ec1-91d6-4a95-9211-d56a01a88993']

    def encode(self, value):
        "Return a bytestring or bytes-like representation of the value"
        if isinstance(value, (bytes, memoryview)):
            return value
        elif isinstance(value, bool):
            # special case bool since it is a subclass of int
            raise DataError(
                "Invalid input of type: 'bool'. Convert to a "
                "bytes, string, int or float first."
            )
        elif isinstance(value, (int, float)):
            value = repr(value).encode()
        elif not isinstance(value, str):
            # a value we don't know how to deal with. throw an error
            typename = type(value).__name__
>           raise DataError(
                f"Invalid input of type: '{typename}'. "
                f"Convert to a bytes, string, int or float first."
            )
E           redis.exceptions.DataError: Invalid input of type: 'list'. Convert to a bytes, string, int or float first.

../../.cache/pypoetry/virtualenvs/asynq-py-MNhgrnTM-py3.9/lib/python3.9/site-packages/redis/connection.py:107: DataError
======================================================================================================= short test summary info ========================================================================================================
FAILED tests/test_asynq_py.py::test_asynq_client_enqueue - redis.exceptions.DataError: Invalid input of type: 'list'. Convert to a bytes, string, int or float first.
========================================================================================================== 1 failed in 0.49s ===================================

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.