Skip to content

Commit

Permalink
Stop using six; fixes #504. Get tests running with newer ZODB that ha…
Browse files Browse the repository at this point in the history
…s removed a bunch of tests apparently.
  • Loading branch information
jamadden committed Oct 11, 2024
1 parent d0bb72c commit 3e6ed51
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 12 deletions.
2 changes: 1 addition & 1 deletion CHANGES.rst
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
to support newer compilers like GCC 13.
- Compile in C++ 11 mode instead of whatever the compiler default was
(sometimes C++ 03), because the latter is deprecated by Boost.

- Stop relying on an undeclared dependency on ``six``. See :issue:`504`.

4.0.0 (2023-12-11)
==================
Expand Down
6 changes: 1 addition & 5 deletions src/relstorage/adapters/locker.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@

import abc
import sys
import six


from relstorage._compat import ABC
Expand Down Expand Up @@ -277,10 +276,7 @@ def reraise_commit_lock_error(self, cursor, lock_stmt, kind):
val = kind(message)
val.__relstorage_cause__ = v
del v
six.reraise(
kind,
val,
sys.exc_info()[2])
raise val.with_traceback(sys.exc_info()[2])

# MySQL allows aggregates in the top level to use FOR UPDATE,
# but PostgreSQL does not, so we have to use the second form.
Expand Down
10 changes: 9 additions & 1 deletion src/relstorage/tests/hptestbase.py
Original file line number Diff line number Diff line change
Expand Up @@ -480,6 +480,9 @@ def __tid_clock_needs_care(self):
return getattr(adapter, 'RS_TEST_TXN_PACK_NEEDS_SLEEP', False)

def __maybe_ignore_monotonic(self, cls, method_name):
if not hasattr(super(), method_name):
raise unittest.SkipTest('Method ' + method_name + ' not available')

if not self.__tid_clock_needs_care():
return getattr(super(), method_name)()

Expand Down Expand Up @@ -523,6 +526,8 @@ def checkLoadBeforeOld(self):
'checkLoadBeforeOld')

def checkSimpleHistory(self):
if not hasattr(super(), 'checkSimpleHistory'):
raise unittest.SkipTest('No test checkSimpleHistory')
if not self.__tid_clock_needs_care():
return super().checkSimpleHistory() # pylint:disable=no-member
# This assumes that the `time` value in the storage.history()
Expand Down Expand Up @@ -605,7 +610,10 @@ def _run_with_storage_packing_at_packtime(self,
find_packtime):
# Ignore the pack timestamp given. Execute `find_packtime(storage)`
# instead and use that.
meth = getattr(super(), methname)
try:
meth = getattr(super(), methname)
except AttributeError:
raise unittest.SkipTest('No method ' + methname) from None
if not self.__tid_clock_needs_care():
return meth()

Expand Down
13 changes: 8 additions & 5 deletions src/relstorage/tests/reltestbase.py
Original file line number Diff line number Diff line change
Expand Up @@ -225,9 +225,12 @@ def __thread_safe_wrapper(self):
self._storage = orig_storage

def __generic_wrapped_test(self, meth_name):
meth = getattr(
super(),
meth_name)
try:
meth = getattr(
super(),
meth_name)
except AttributeError:
self.skipTest('No method ' + meth_name)
try:
with self.__thread_safe_wrapper():
meth()
Expand Down Expand Up @@ -1119,11 +1122,11 @@ def checkBTreesLengthStress(self): # pylint:disable=too-complex
from ZODB.ConflictResolution import logger as CRLogger
from BTrees.Length import Length
import BTrees
from six import reraise

def log_err(*args, **kwargs): # pylint:disable=unused-argument
import sys
reraise(*sys.exc_info())
_t, v, _tb = sys.exc_info()
raise v

CRLogger.debug = log_err
CRLogger.exception = log_err
Expand Down

0 comments on commit 3e6ed51

Please sign in to comment.