Skip to content
This repository has been archived by the owner on Jun 5, 2023. It is now read-only.

AttributeError: 'int' object has no attribute 'iteritems' #156

Open
marcelometal opened this issue Mar 4, 2019 · 0 comments
Open

AttributeError: 'int' object has no attribute 'iteritems' #156

marcelometal opened this issue Mar 4, 2019 · 0 comments

Comments

@marcelometal
Copy link

I tried to build this package, but tests failed:

platform linux2 -- Python 2.7.16rc1, pytest-3.10.1, py-1.7.0, pluggy-0.8.0
rootdir: /home/metal/debian/pyres, inifile:
plugins: celery-4.2.1
collected 78 items / 1 deselected

tests/test_failure.py .....                                              [  6%]
tests/test_failure_multi.py ..........                                   [ 19%]
tests/test_horde.py .......                                              [ 28%]
tests/test_jobs.py ....                                                  [ 33%]
tests/test_json.py ...                                                   [ 37%]
tests/test_resq.py ..............                                        [ 55%]
tests/test_schedule.py FFFFF..                                           [ 64%]
tests/test_stats.py ....                                                 [ 70%]
tests/test_worker.py .............FF........                             [100%]

=================================== FAILURES ===================================
________________ ScheduleTests.test_delayed_queue_schedule_size ________________

self = <tests.test_schedule.ScheduleTests testMethod=test_delayed_queue_schedule_size>

    def test_delayed_queue_schedule_size(self):
        d = datetime.datetime.now() + datetime.timedelta(days=1)
        d2 = d + datetime.timedelta(days=1)
        d3 = d
        key = int(time.mktime(d.timetuple()))
        key2 = int(time.mktime(d2.timetuple()))
>       self.resq.enqueue_at(d, Basic,"test1")

tests/test_schedule.py:28: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
pyres/__init__.py:279: in enqueue_at
    self.enqueue_at_from_string(datetime, class_name, klass.queue, *args, **kwargs)
pyres/__init__.py:289: in enqueue_at_from_string
    self.delayed_push(datetime, payload)
pyres/__init__.py:294: in delayed_push
    self.redis.zadd('resque:delayed_queue_schedule', key, key)
/usr/lib/python2.7/dist-packages/redis/client.py:2320: in zadd
    for pair in iteritems(mapping):
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

x = 1551808378

    def iteritems(x):
>       return x.iteritems()
E       AttributeError: 'int' object has no attribute 'iteritems'

/usr/lib/python2.7/dist-packages/redis/_compat.py:81: AttributeError
__________________ ScheduleTests.test_delayed_timestamp_size ___________________

self = <tests.test_schedule.ScheduleTests testMethod=test_delayed_timestamp_size>

    def test_delayed_timestamp_size(self):
        d = datetime.datetime.now() + datetime.timedelta(days=1)
        d2 = d + datetime.timedelta(days=1)
        key = int(time.mktime(d.timetuple()))
        key2 = int(time.mktime(d2.timetuple()))
>       self.resq.enqueue_at(d, Basic,"test1")

tests/test_schedule.py:38: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
pyres/__init__.py:279: in enqueue_at
    self.enqueue_at_from_string(datetime, class_name, klass.queue, *args, **kwargs)
pyres/__init__.py:289: in enqueue_at_from_string
    self.delayed_push(datetime, payload)
pyres/__init__.py:294: in delayed_push
    self.redis.zadd('resque:delayed_queue_schedule', key, key)
/usr/lib/python2.7/dist-packages/redis/client.py:2320: in zadd
    for pair in iteritems(mapping):
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

x = 1551808378

    def iteritems(x):
>       return x.iteritems()
E       AttributeError: 'int' object has no attribute 'iteritems'

/usr/lib/python2.7/dist-packages/redis/_compat.py:81: AttributeError
________________________ ScheduleTests.test_enqueue_at _________________________

self = <tests.test_schedule.ScheduleTests testMethod=test_enqueue_at>

    def test_enqueue_at(self):
        d = datetime.datetime.now() + datetime.timedelta(days=1)
        d2 = d + datetime.timedelta(days=1)
        key = int(time.mktime(d.timetuple()))
        key2 = int(time.mktime(d2.timetuple()))
>       self.resq.enqueue_at(d, Basic,"test1")

tests/test_schedule.py:14: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
pyres/__init__.py:279: in enqueue_at
    self.enqueue_at_from_string(datetime, class_name, klass.queue, *args, **kwargs)
pyres/__init__.py:289: in enqueue_at_from_string
    self.delayed_push(datetime, payload)
pyres/__init__.py:294: in delayed_push
    self.redis.zadd('resque:delayed_queue_schedule', key, key)
/usr/lib/python2.7/dist-packages/redis/client.py:2320: in zadd
    for pair in iteritems(mapping):
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

x = 1551808378

    def iteritems(x):
>       return x.iteritems()
E       AttributeError: 'int' object has no attribute 'iteritems'

/usr/lib/python2.7/dist-packages/redis/_compat.py:81: AttributeError
__________________ ScheduleTests.test_next_delayed_timestamp ___________________

self = <tests.test_schedule.ScheduleTests testMethod=test_next_delayed_timestamp>

    def test_next_delayed_timestamp(self):
        d = datetime.datetime.now() + datetime.timedelta(days=-1)
        d2 = d + datetime.timedelta(days=-2)
        key = int(time.mktime(d.timetuple()))
        key2 = int(time.mktime(d2.timetuple()))
>       self.resq.enqueue_at(d, Basic,"test1")

tests/test_schedule.py:48: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
pyres/__init__.py:279: in enqueue_at
    self.enqueue_at_from_string(datetime, class_name, klass.queue, *args, **kwargs)
pyres/__init__.py:289: in enqueue_at_from_string
    self.delayed_push(datetime, payload)
pyres/__init__.py:294: in delayed_push
    self.redis.zadd('resque:delayed_queue_schedule', key, key)
/usr/lib/python2.7/dist-packages/redis/client.py:2320: in zadd
    for pair in iteritems(mapping):
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

x = 1551635578

    def iteritems(x):
>       return x.iteritems()
E       AttributeError: 'int' object has no attribute 'iteritems'

/usr/lib/python2.7/dist-packages/redis/_compat.py:81: AttributeError
__________________ ScheduleTests.test_next_item_for_timestamp __________________

self = <tests.test_schedule.ScheduleTests testMethod=test_next_item_for_timestamp>

    def test_next_item_for_timestamp(self):
        d = datetime.datetime.now() + datetime.timedelta(days=-1)
        d2 = d + datetime.timedelta(days=-2)
        #key = int(time.mktime(d.timetuple()))
        #key2 = int(time.mktime(d2.timetuple()))
>       self.resq.enqueue_at(d, Basic,"test1")

tests/test_schedule.py:58: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
pyres/__init__.py:279: in enqueue_at
    self.enqueue_at_from_string(datetime, class_name, klass.queue, *args, **kwargs)
pyres/__init__.py:289: in enqueue_at_from_string
    self.delayed_push(datetime, payload)
pyres/__init__.py:294: in delayed_push
    self.redis.zadd('resque:delayed_queue_schedule', key, key)
/usr/lib/python2.7/dist-packages/redis/client.py:2320: in zadd
    for pair in iteritems(mapping):
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

x = 1551635578

    def iteritems(x):
>       return x.iteritems()
E       AttributeError: 'int' object has no attribute 'iteritems'

/usr/lib/python2.7/dist-packages/redis/_compat.py:81: AttributeError
_________________ WorkerTests.test_retries_give_up_eventually __________________

self = <tests.test_worker.WorkerTests testMethod=test_retries_give_up_eventually>

    def test_retries_give_up_eventually(self):
        now = datetime.datetime.now()
        self.set_current_time(now)
        worker = Worker(['basic'])
        scheduler = Scheduler()
    
        # queue up a job that will fail for 60 seconds
        self.resq.enqueue(RetryOnExceptionJob,
                now + datetime.timedelta(seconds=60))
        worker.process()
>       assert worker.get_failed() == 0
E       AssertionError: assert 1 == 0
E        +  where 1 = <bound method Worker.get_failed of <pyres.worker.Worker object at 0x7faf93a161d0>>()
E        +    where <bound method Worker.get_failed of <pyres.worker.Worker object at 0x7faf93a161d0>> = <pyres.worker.Worker object at 0x7faf93a161d0>.get_failed

tests/test_worker.py:285: AssertionError
------------------------------ Captured log call -------------------------------
worker.py                  273 ERROR    (Job{basic} | tests.RetryOnExceptionJob | [datetime.datetime(2019, 3, 4, 14, 54, 3)]) failed: 'int' object has no attribute 'iteritems'
Traceback (most recent call last):
  File "/home/metal/debian/pyres/.pybuild/cpython2_2.7_pyres/build/pyres/worker.py", line 256, in process
    return job.perform()
  File "/home/metal/debian/pyres/.pybuild/cpython2_2.7_pyres/build/pyres/job.py", line 88, in perform
    if not self.retry(payload_class, args):
  File "/home/metal/debian/pyres/.pybuild/cpython2_2.7_pyres/build/pyres/job.py", line 126, in retry
    **{'first_attempt':first_attempt})
  File "/home/metal/debian/pyres/.pybuild/cpython2_2.7_pyres/build/pyres/__init__.py", line 279, in enqueue_at
    self.enqueue_at_from_string(datetime, class_name, klass.queue, *args, **kwargs)
  File "/home/metal/debian/pyres/.pybuild/cpython2_2.7_pyres/build/pyres/__init__.py", line 289, in enqueue_at_from_string
    self.delayed_push(datetime, payload)
  File "/home/metal/debian/pyres/.pybuild/cpython2_2.7_pyres/build/pyres/__init__.py", line 294, in delayed_push
    self.redis.zadd('resque:delayed_queue_schedule', key, key)
  File "/usr/lib/python2.7/dist-packages/redis/client.py", line 2320, in zadd
    for pair in iteritems(mapping):
  File "/usr/lib/python2.7/dist-packages/redis/_compat.py", line 81, in iteritems
    return x.iteritems()
AttributeError: 'int' object has no attribute 'iteritems'
_____________________ WorkerTests.test_retry_on_exception ______________________

self = <tests.test_worker.WorkerTests testMethod=test_retry_on_exception>

    def test_retry_on_exception(self):
        now = datetime.datetime.now()
        self.set_current_time(now)
        worker = Worker(['basic'])
        scheduler = Scheduler()
    
        # queue up a job that will fail for 30 seconds
        self.resq.enqueue(RetryOnExceptionJob,
                now + datetime.timedelta(seconds=30))
        worker.process()
>       assert worker.get_failed() == 0
E       AssertionError: assert 1 == 0
E        +  where 1 = <bound method Worker.get_failed of <pyres.worker.Worker object at 0x7faf93c19d10>>()
E        +    where <bound method Worker.get_failed of <pyres.worker.Worker object at 0x7faf93c19d10>> = <pyres.worker.Worker object at 0x7faf93c19d10>.get_failed

tests/test_worker.py:191: AssertionError
------------------------------ Captured log call -------------------------------
worker.py                  273 ERROR    (Job{basic} | tests.RetryOnExceptionJob | [datetime.datetime(2019, 3, 4, 14, 53, 33)]) failed: 'int' object has no attribute 'iteritems'
Traceback (most recent call last):
  File "/home/metal/debian/pyres/.pybuild/cpython2_2.7_pyres/build/pyres/worker.py", line 256, in process
    return job.perform()
  File "/home/metal/debian/pyres/.pybuild/cpython2_2.7_pyres/build/pyres/job.py", line 88, in perform
    if not self.retry(payload_class, args):
  File "/home/metal/debian/pyres/.pybuild/cpython2_2.7_pyres/build/pyres/job.py", line 126, in retry
    **{'first_attempt':first_attempt})
  File "/home/metal/debian/pyres/.pybuild/cpython2_2.7_pyres/build/pyres/__init__.py", line 279, in enqueue_at
    self.enqueue_at_from_string(datetime, class_name, klass.queue, *args, **kwargs)
  File "/home/metal/debian/pyres/.pybuild/cpython2_2.7_pyres/build/pyres/__init__.py", line 289, in enqueue_at_from_string
    self.delayed_push(datetime, payload)
  File "/home/metal/debian/pyres/.pybuild/cpython2_2.7_pyres/build/pyres/__init__.py", line 294, in delayed_push
    self.redis.zadd('resque:delayed_queue_schedule', key, key)
  File "/usr/lib/python2.7/dist-packages/redis/client.py", line 2320, in zadd
    for pair in iteritems(mapping):
  File "/usr/lib/python2.7/dist-packages/redis/_compat.py", line 81, in iteritems
    return x.iteritems()
AttributeError: 'int' object has no attribute 'iteritems'
=============================== warnings summary ===============================
tests/test_failure_multi.py:10
  /home/metal/debian/pyres/.pybuild/cpython2_2.7_pyres/build/tests/test_failure_multi.py:10: PytestWarning: cannot collect test class 'TestBackend' because it has a __init__ constructor
    class TestBackend(BaseBackend):

-- Docs: https://docs.pytest.org/en/latest/warnings.html
======== 7 failed, 70 passed, 1 deselected, 1 warnings in 38.09 seconds ========
E: pybuild pybuild:338: test: plugin distutils failed with: exit code=1: cd /home/metal/debian/pyres/.pybuild/cpython2_2.7_pyres/build; python2.7 -m pytest -k 'not test_worker_pids'

@marcelometal marcelometal changed the title AttributeError: 'int' object has no attribute 'iteritems' (test_worker.py) AttributeError: 'int' object has no attribute 'iteritems' Mar 4, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant