[pypy-issue] [issue1187] call to isinstance(...) in __sub__(self, other) in lib_pypy/datetime.py draws error in test

Ian Delaney tracker at bugs.pypy.org
Wed Jun 20 15:48:37 CEST 2012


New submission from Ian Delaney <della5 at iinet.com.au>:

1 single test fails out of 876 tests (pretty good really) in test suite of 
celery-2.5.5.

 * Testing of dev-python/celery-2.5.5 with PyPy 1.9 (Python 2.7)...
................................................................................................................................................................................................................SSSSSSSSSSSSSSSSSE..............................
* Tokyo Tyrant not installed. Will not execute related tests.
SSSSS.............................................S.S..........S...........SSSSSS...S...............SSSS............................SSSSSSSSSSSSSSSSSS.......................................................................................................................................................................................................................................................................................................................................................................Traceback
(most recent call last):
  File
"/mnt/gen2/TmpDir/portage/dev-python/celery-2.5.5/work/celery-2.5.5/celery/utils/timer2.py",
line 190, in apply_entry
    entry()
  File "/usr/lib64/pypy1.9/site-packages/mock.py", line 983, in __call__
    return _mock_self._mock_call(*args, **kwargs)
  File "/usr/lib64/pypy1.9/site-packages/mock.py", line 1038, in _mock_call
    raise effect
ValueError
...............................................................................................................................................................................................
======================================================================
ERROR: test_cleanup (celery.tests.test_backends.test_mongodb.TestBackendMongoDb)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/usr/lib64/pypy1.9/site-packages/mock.py", line 1224, in patched
    return func(*args, **keywargs)
  File
"/mnt/gen2/TmpDir/portage/dev-python/celery-2.5.5/work/celery-2.5.5/celery/tests/test_backends/test_mongodb.py",
line 275, in test_cleanup
    self.backend.cleanup()
  File
"/mnt/gen2/TmpDir/portage/dev-python/celery-2.5.5/work/celery-2.5.5/celery/backends/mongodb.py",
line 203, in cleanup
    "$lt": self.app.now() - self.expires,
  File "/usr/lib64/pypy1.9/lib_pypy/datetime.py", line 1859, in __sub__
    if not isinstance(other, datetime):
TypeError: isinstance() arg 2 must be a class, type, or tuple of classes and types

----------------------------------------------------------------------
Ran 876 tests in 29.598s

FAILED (SKIP=54, errors=1)
 * ERROR: dev-python/celery-2.5.5 failed (test phase)

---------------------------------------------------------------
from celery-2.5.5/celery/utils/timer2.py
----------------------------------------------------------------
class Timer(Thread):
    Entry = Entry
    Schedule = Schedule

    running = False
    on_tick = None
    _timer_count = count(1).next

    def __init__(self, schedule=None, on_error=None, on_tick=None, **kwargs):
        self.schedule = schedule or self.Schedule(on_error=on_error)
        self.on_tick = on_tick or self.on_tick

        Thread.__init__(self)
        self._is_shutdown = Event()
        self._is_stopped = Event()
        self.mutex = Lock()
        self.logger = logging.getLogger("timer2.Timer")
        self.not_empty = Condition(self.mutex)
        self.setDaemon(True)
        self.setName("Timer-%s" % (self._timer_count(), ))

    def apply_entry(self, entry):
        try:
            entry()
        except Exception, exc:
           exc_info = sys.exc_info()
            try:
                if not self.schedule.handle_error(exc_info):
                    warnings.warn(TimedFunctionFailed(repr(exc))),
                    sys.stderr.write("Error in timer: %r\n" % (exc, ))
                    traceback.print_exception(exc_info[0],
                                              exc_info[1],
                                              exc_info[2],
                                              None, sys.__stderr__)
            finally:
                del(exc_info)

---------------------------------------------------------------------
from celery-2.5.5/celery/tests/test_backends/test_mongodb.py
---------------------------------------------------------------------
    @patch("celery.backends.mongodb.MongoBackend._get_database")
    def test_cleanup(self, mock_get_database):
        self.backend.mongodb_taskmeta_collection = MONGODB_COLLECTION

        mock_database = MagicMock(spec=['__getitem__', '__setitem__'])
        mock_collection = Mock()

        mock_get_database.return_value = mock_database
        mock_database.__getitem__.return_value = mock_collection

        self.backend.cleanup()

        mock_get_database.assert_called_once_with()
        mock_database.__getitem__.assert_called_once_with(
            MONGODB_COLLECTION)
        mock_collection.assert_called_once()

valid also for pypy-1.8

----------------------------------------------------------------------
Ran 876 tests in 29.527s

FAILED (SKIP=54, errors=1)
 * ERROR: dev-python/celery-2.5.5 failed (test phase):
 *   Testing failed with PyPy 1.8 (Python 2.7) in testing() function

----------
messages: 4471
nosy: idella5, pypy-issue
priority: performance bug
release: 0.9
status: chatting
title: call to isinstance(...) in __sub__(self, other) in lib_pypy/datetime.py draws error in test

________________________________________
PyPy bug tracker <tracker at bugs.pypy.org>
<https://bugs.pypy.org/issue1187>
________________________________________


More information about the pypy-issue mailing list