bbangert / beaker

WSGI middleware for sessions and caching
https://beaker.readthedocs.org/
Other
524 stars 143 forks source link

Failing tests with "ValueError: unsupported pickle protocol: 4" #172

Open mcepl opened 5 years ago

mcepl commented 5 years ago
======================================================================
ERROR: tests.test_database.test_has_key
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/usr/lib/python2.7/site-packages/nose/case.py", line 197, in runTest
    self.test(*self.arg)
  File "/home/abuild/rpmbuild/BUILD/beaker-1.10.1/tests/test_database.py", line 59, in test_has_key
    cache.set_value("test", o)
  File "/home/abuild/rpmbuild/BUILD/beaker-1.10.1/beaker/cache.py", line 317, in put
    self._get_value(key, **kw).set_value(value)
  File "/home/abuild/rpmbuild/BUILD/beaker-1.10.1/beaker/container.py", line 409, in set_value
    self.namespace.acquire_write_lock()
  File "/home/abuild/rpmbuild/BUILD/beaker-1.10.1/beaker/container.py", line 223, in acquire_write_lock
    self.open('c', checkcount=True, replace=replace)
  File "/home/abuild/rpmbuild/BUILD/beaker-1.10.1/beaker/container.py", line 240, in open
    self.do_open(flags, replace)
  File "/home/abuild/rpmbuild/BUILD/beaker-1.10.1/beaker/ext/database.py", line 132, in do_open
    self.hash = result['data']
  File "/usr/lib64/python2.7/site-packages/sqlalchemy/sql/sqltypes.py", line 1588, in process
    return loads(value)
ValueError: unsupported pickle protocol: 4

======================================================================
ERROR: tests.test_database.test_has_key_multicache
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/usr/lib/python2.7/site-packages/nose/case.py", line 197, in runTest
    self.test(*self.arg)
  File "/home/abuild/rpmbuild/BUILD/beaker-1.10.1/tests/test_database.py", line 70, in test_has_key_multicache
    cache.set_value("test", o)
  File "/home/abuild/rpmbuild/BUILD/beaker-1.10.1/beaker/cache.py", line 317, in put
    self._get_value(key, **kw).set_value(value)
  File "/home/abuild/rpmbuild/BUILD/beaker-1.10.1/beaker/container.py", line 409, in set_value
    self.namespace.acquire_write_lock()
  File "/home/abuild/rpmbuild/BUILD/beaker-1.10.1/beaker/container.py", line 223, in acquire_write_lock
    self.open('c', checkcount=True, replace=replace)
  File "/home/abuild/rpmbuild/BUILD/beaker-1.10.1/beaker/container.py", line 240, in open
    self.do_open(flags, replace)
  File "/home/abuild/rpmbuild/BUILD/beaker-1.10.1/beaker/ext/database.py", line 132, in do_open
    self.hash = result['data']
  File "/usr/lib64/python2.7/site-packages/sqlalchemy/sql/sqltypes.py", line 1588, in process
    return loads(value)
ValueError: unsupported pickle protocol: 4

======================================================================
ERROR: tests.test_database.test_clear
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/usr/lib/python2.7/site-packages/nose/case.py", line 197, in runTest
    self.test(*self.arg)
  File "/home/abuild/rpmbuild/BUILD/beaker-1.10.1/tests/test_database.py", line 80, in test_clear
    cache.set_value("test", o)
  File "/home/abuild/rpmbuild/BUILD/beaker-1.10.1/beaker/cache.py", line 317, in put
    self._get_value(key, **kw).set_value(value)
  File "/home/abuild/rpmbuild/BUILD/beaker-1.10.1/beaker/container.py", line 409, in set_value
    self.namespace.acquire_write_lock()
  File "/home/abuild/rpmbuild/BUILD/beaker-1.10.1/beaker/container.py", line 223, in acquire_write_lock
    self.open('c', checkcount=True, replace=replace)
  File "/home/abuild/rpmbuild/BUILD/beaker-1.10.1/beaker/container.py", line 240, in open
    self.do_open(flags, replace)
  File "/home/abuild/rpmbuild/BUILD/beaker-1.10.1/beaker/ext/database.py", line 132, in do_open
    self.hash = result['data']
  File "/usr/lib64/python2.7/site-packages/sqlalchemy/sql/sqltypes.py", line 1588, in process
    return loads(value)
ValueError: unsupported pickle protocol: 4

======================================================================
ERROR: tests.test_database.test_unicode_keys
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/usr/lib/python2.7/site-packages/nose/case.py", line 197, in runTest
    self.test(*self.arg)
  File "/home/abuild/rpmbuild/BUILD/beaker-1.10.1/tests/test_database.py", line 88, in test_unicode_keys
    cache.set_value(u_('hiŏ'), o)
  File "/home/abuild/rpmbuild/BUILD/beaker-1.10.1/beaker/cache.py", line 317, in put
    self._get_value(key, **kw).set_value(value)
  File "/home/abuild/rpmbuild/BUILD/beaker-1.10.1/beaker/container.py", line 409, in set_value
    self.namespace.acquire_write_lock()
  File "/home/abuild/rpmbuild/BUILD/beaker-1.10.1/beaker/container.py", line 223, in acquire_write_lock
    self.open('c', checkcount=True, replace=replace)
  File "/home/abuild/rpmbuild/BUILD/beaker-1.10.1/beaker/container.py", line 240, in open
    self.do_open(flags, replace)
  File "/home/abuild/rpmbuild/BUILD/beaker-1.10.1/beaker/ext/database.py", line 132, in do_open
    self.hash = result['data']
  File "/usr/lib64/python2.7/site-packages/sqlalchemy/sql/sqltypes.py", line 1588, in process
    return loads(value)
ValueError: unsupported pickle protocol: 4

----------------------------------------------------------------------
Ran 142 tests in 146.912s

FAILED (errors=4, skipped=1)
Test failed: <unittest.runner.TextTestResult run=142 errors=4 failures=0>
error: Test failed: <unittest.runner.TextTestResult run=142 errors=4 failures=0>

Full build log is also available. Version of python-SQLAlchemy is 1.3.1.

amol- commented 5 years ago

Have you by chance changed the version of Python you were running the test suite against between two runs? If I remember correctly the sqlite database is not always cleaned up and a previous test run on Python3 might for example leave behind a database file that contains data stored in a format that Python2.7 doesn't understand.

mcepl commented 5 years ago

Have you by chance changed the version of Python you were running the test suite against between two runs? If I remember correctly the sqlite database is not always cleaned up and a previous test run on Python3 might for example leave behind a database file that contains data stored in a format that Python2.7 doesn't understand.

That might be the problem. Where is that database so that I can remove it before the run?

mcepl commented 5 years ago

Yes, rm -fv tests/test.db helped, but still I think it is a bug in your test suite, that it doesn't clean up after itself.

amol- commented 5 years ago

Yeah, that needs to be addressed, but is not a major priority because in fact the test suite handles this fine. The problem only arises if you try to switch python environments.