Commit b8a98631 authored by Carlos Ramos Carreño's avatar Carlos Ramos Carreño Committed by Kirill Smelkov

lib/zodb: tests: Do not import NEO globally.

NEO is still not ported to Python 3.
Importing NEO globally thus makes pytest tests fail during the
assert-rewritting step:
```python
../../venvs/wendelin.core/lib/python3.9/site-packages/_pytest/assertion/rewrite.py:178: in exec_module
    exec(co, module.__dict__)
lib/tests/test_zodb.py:36: in <module>
    from neo.client.Storage import Storage as NEOStorage
../neoppod/neo/client/__init__.py:52: in <module>
    from . import app # set up signal handlers early enough to do it in the main thread
E     File "/srv/slapgrid/slappart66/git/neoppod/neo/client/app.py", line 356
E       except NEOStorageReadRetry, e:
E                                 ^
E   SyntaxError: invalid syntax
```

A MR adding enough support to not fail at import time is proposed in
neoppod!24 .
However, that MR will not be reviewed until the vacation period is over.

In the meantime, and as a previous step to make running NEO tests
optional, the import has been moved inside the function loading NEO.
Thus, only the tests that require NEO will fail.

--------
kirr:

Add TODO to revert to import NEO globally after lab.nexedi.com/nexedi/neoppod/-/merge_requests/24 is landed.

/reviewed-by @kirr
/reviewed-on !27
parent d640c701
...@@ -33,7 +33,6 @@ from golang import defer, func ...@@ -33,7 +33,6 @@ from golang import defer, func
from pytest import raises from pytest import raises
import pytest; xfail = pytest.mark.xfail import pytest; xfail = pytest.mark.xfail
from ZEO.ClientStorage import ClientStorage as ZEOStorage from ZEO.ClientStorage import ClientStorage as ZEOStorage
from neo.client.Storage import Storage as NEOStorage
import os import os
from six.moves.urllib.parse import quote_plus from six.moves.urllib.parse import quote_plus
...@@ -494,6 +493,8 @@ def test_zstor_2zurl(tmpdir, neo_ssl_dict): ...@@ -494,6 +493,8 @@ def test_zstor_2zurl(tmpdir, neo_ssl_dict):
# neo returns new NEO client for specified cluster name and master address. # neo returns new NEO client for specified cluster name and master address.
# NOTE, similarly to ZEO, the client is returned without waiting until server nodes are connected. # NOTE, similarly to ZEO, the client is returned without waiting until server nodes are connected.
def neo(cluster_name, master_addr, ssl=0): def neo(cluster_name, master_addr, ssl=0):
# TODO revert to import neo globally after lab.nexedi.com/nexedi/neoppod/-/merge_requests/24 is landed
from neo.client.Storage import Storage as NEOStorage
kwargs = dict(master_nodes=master_addr, name=cluster_name) kwargs = dict(master_nodes=master_addr, name=cluster_name)
if ssl: if ssl:
kwargs.update(neo_ssl_dict) kwargs.update(neo_ssl_dict)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment