You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cassandra.apache.org by "Brandon Williams (Jira)" <ji...@apache.org> on 2023/03/27 17:23:00 UTC
[jira] [Updated] (CASSANDRA-18369) Importing cassandra driver causes modern pytest to fail in certain circumstances
[ https://issues.apache.org/jira/browse/CASSANDRA-18369?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Brandon Williams updated CASSANDRA-18369:
-----------------------------------------
Resolution: Invalid
Status: Resolved (was: Triage Needed)
You need to report this to the python driver project: https://github.com/datastax/python-driver
We don't cover the drivers here (yet.)
> Importing cassandra driver causes modern pytest to fail in certain circumstances
> --------------------------------------------------------------------------------
>
> Key: CASSANDRA-18369
> URL: https://issues.apache.org/jira/browse/CASSANDRA-18369
> Project: Cassandra
> Issue Type: Bug
> Reporter: Jarek Potiuk
> Priority: Normal
>
> When collecting on running test without exclusion on Pytest test name, importing cassandra driver causes a very strangely looking error:
>
> {quote}# from cassandra.cluster import Cluster
> # cassandra/cluster.py:48: in init cassandra.cluster
> # ???
> # cassandra/connection.py:40: in init cassandra.connection
> # ???
> # cassandra/protocol.py:698: in genexpr
> # ???
> # cassandra/protocol.py:698: in genexpr
> # ???
> # E KeyError: '@py_builtins'{quote}
> This happened for Apache Airflow when we wanted to enable pytest collection to include all files, rather than only "test_*.py" files, because we found that there were at least few modules in airlfow that did not start with "test".
> It turned out that the culprit was Assert Rewrite done by pytest that tried to rewrite "type_codes.py" module of Cassandra.
> One of the ways to avoid the problem is to disable assert rewrite by "–assert=plain". However then asserts are not as useful. Better solution (PR is coming) is to add PYTEST_DONT_REWRITE in the docstring:
> https://docs.pytest.org/en/latest/how-to/assert.html#disabling-assert-rewriting
> For now we are mitigating that issue in Airflow by manually patching cassandra code, however better solution will be to add the PYTEST_DONT_REWRITE directive directly in Cassandra's Python driver's repository.
> Fix is coming.
--
This message was sent by Atlassian Jira
(v8.20.10#820010)
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@cassandra.apache.org
For additional commands, e-mail: commits-help@cassandra.apache.org