youknowone/ring

[BUG] pytest assertion error

Closed this issue · 2 comments

$ python --version
Python 3.6.2

$ pytest -vv

...

=================================== FAILURES ===================================
_____________________________ test_ring_key[bytes] _____________________________

value = b'bytes'

    @pytest.mark.parametrize('value', [
        1,
        0,
        True,
        False,
        u'str',
        b'bytes',
        ['list', 'with', 'values'],
        {'dict': 'also', 'matters': '!'},
        set(['set', 'should', 'be', 'ordered']),
    ])
    def test_ring_key(value):
        # test only with real cache backends. dict doesn't help this
        @ring.func.memcache(memcache_client)
        def simple(key):
            return key
    
>       assert simple(value) == value  # cache miss
E       AssertionError: assert 'bytes' == b'bytes'
E        +  where 'bytes' = <ring.func_sync.wrapper_class.<locals>.Ring object at 0x7f8cc39a2128>(b'bytes')

tests/test_func_sync.py:137: AssertionError
===================== 1 failed, 40 passed in 1.62 seconds ======================
$ python
import ring, memcache

mc = memcache.Client(['127.0.0.1:11211'])

@ring.func.memcache(mc)
def simple(key):
    return key

value = b'bytes'
print(value, simple(value))
# b'bytes' b'bytes

Did you install python-memcached manually, instead of installing python3-memcached?

If you keep going to meet the problem, please reopen the issue.