Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

tests: Fix them for ZODB >= 5.6.0 #13

Merged
merged 1 commit into from
Nov 16, 2021

Conversation

navytux
Copy link
Contributor

@navytux navytux commented Nov 15, 2021

If test class does not indicate that underlying storage supports
extension_bytes (see zopefoundation/ZODB#207),
then ZODB.tests.IteratorStorage will verify that extension_bytes is
computed from extension instead of taken from on-storage raw value:

https://github.com/zopefoundation/ZODB/blob/5.6.0-48-gbc13ca74b/src/ZODB/tests/IteratorStorage.py#L93-L115

However when underlying storage supports extension_bytes, so is
zlibstorage that wraps it.

Many classes in zc.zlibstorage tests inherit from classes test classes
for FileStorage

https://github.com/zopefoundation/zc.zlibstorage/blob/1.2.0-4-g51cca6b/src/zc/zlibstorage/tests.py#L314-L338

Those classes will have .use_extension_bytes properly set because ZODB
sets so for FileStorageTests:

https://github.com/zopefoundation/ZODB/blob/5.6.0-48-gbc13ca74b/src/ZODB/tests/testFileStorage.py#L44-L62

However for tests that inherit from ZEO tests, .use_extension_bytes is
not uniformly set for ZEO over FileStorage, and so with ZODB >= 5.6.0
zc.zlibstorage fails with

Failure in test checkTransactionExtensionFromIterator (zc.zlibstorage.tests.FileStorageClientZlibZEOServerZlibTests)
Traceback (most recent call last):
  File "/usr/lib/python2.7/unittest/case.py", line 329, in run
    testMethod()
  File "/home/kirr/src/wendelin/z/ZODB/src/ZODB/tests/IteratorStorage.py", line 115, in checkTransactionExtensionFromIterator
    self.assertNotEqual(extension_bytes, txn.extension_bytes)
  File "/usr/lib/python2.7/unittest/case.py", line 522, in assertNotEqual
    raise self.failureException(msg)
AssertionError: '\x80\x03}q\x01U\x03fooK\x01s.' == '\x80\x03}q\x01U\x03fooK\x01s.'

and

Failure in test checkTransactionExtensionFromIterator (zc.zlibstorage.tests.FileStorageClientZlibZEOZlibTests)
Traceback (most recent call last):
  File "/usr/lib/python2.7/unittest/case.py", line 329, in run
    testMethod()
  File "/home/kirr/src/wendelin/z/ZODB/src/ZODB/tests/IteratorStorage.py", line 115, in checkTransactionExtensionFromIterator
    self.assertNotEqual(extension_bytes, txn.extension_bytes)
  File "/usr/lib/python2.7/unittest/case.py", line 522, in assertNotEqual
    raise self.failureException(msg)
AssertionError: '\x80\x03}q\x01U\x03fooK\x01s.' == '\x80\x03}q\x01U\x03fooK\x01s.'

Fix it similarly to zopefoundation/ZEO@db24ed2f

If test class does not indicate that underlying storage supports
extension_bytes (see zopefoundation/ZODB#207),
then ZODB.tests.IteratorStorage will verify that extension_bytes is
computed from extension instead of taken from on-storage raw value:

https://github.com/zopefoundation/ZODB/blob/5.6.0-48-gbc13ca74b/src/ZODB/tests/IteratorStorage.py#L93-L115

However when underlying storage supports extension_bytes, so is
zlibstorage that wraps it.

Many classes in zc.zlibstorage tests inherit from classes test classes
for FileStorage

https://github.com/zopefoundation/zc.zlibstorage/blob/1.2.0-4-g51cca6b/src/zc/zlibstorage/tests.py#L314-L338

Those classes will have .use_extension_bytes properly set because ZODB
sets so for FileStorageTests:

https://github.com/zopefoundation/ZODB/blob/5.6.0-48-gbc13ca74b/src/ZODB/tests/testFileStorage.py#L44-L62

However for tests that inherit from ZEO tests, .use_extension_bytes is
not uniformly set for ZEO over FileStorage, and so with ZODB >= 5.6.0
zc.zlibstorage fails with

    Failure in test checkTransactionExtensionFromIterator (zc.zlibstorage.tests.FileStorageClientZlibZEOServerZlibTests)
    Traceback (most recent call last):
      File "/usr/lib/python2.7/unittest/case.py", line 329, in run
        testMethod()
      File "/home/kirr/src/wendelin/z/ZODB/src/ZODB/tests/IteratorStorage.py", line 115, in checkTransactionExtensionFromIterator
        self.assertNotEqual(extension_bytes, txn.extension_bytes)
      File "/usr/lib/python2.7/unittest/case.py", line 522, in assertNotEqual
        raise self.failureException(msg)
    AssertionError: '\x80\x03}q\x01U\x03fooK\x01s.' == '\x80\x03}q\x01U\x03fooK\x01s.'

and

    Failure in test checkTransactionExtensionFromIterator (zc.zlibstorage.tests.FileStorageClientZlibZEOZlibTests)
    Traceback (most recent call last):
      File "/usr/lib/python2.7/unittest/case.py", line 329, in run
        testMethod()
      File "/home/kirr/src/wendelin/z/ZODB/src/ZODB/tests/IteratorStorage.py", line 115, in checkTransactionExtensionFromIterator
        self.assertNotEqual(extension_bytes, txn.extension_bytes)
      File "/usr/lib/python2.7/unittest/case.py", line 522, in assertNotEqual
        raise self.failureException(msg)
    AssertionError: '\x80\x03}q\x01U\x03fooK\x01s.' == '\x80\x03}q\x01U\x03fooK\x01s.'

Fix it similarly to zopefoundation/ZEO@db24ed2f
This was referenced Nov 15, 2021
@icemac
Copy link
Member

icemac commented Nov 16, 2021

Sounds plausible. I am bit confused why the tests did not run, but I'll merge the PR and we'll see.
Thank you for this PR and the time you invested to resolve the issue.

@icemac icemac merged commit dc7931a into zopefoundation:master Nov 16, 2021
@icemac
Copy link
Member

icemac commented Nov 16, 2021

Okay, I am probably still sleeping: The tests did not run because #12 is not yet merged.

@navytux navytux deleted the y/fix-tests branch November 16, 2021 07:27
@navytux
Copy link
Contributor Author

navytux commented Nov 16, 2021

@icemac, you are welcome and thanks for merging.
Yes, the tests did not run because at this branch it was still configured to use Travis CI.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants