On Wed, Oct 18, 2017 at 9:23 AM, Gijs Molenaar <gijsmolen...@gmail.com> wrote:
> hi!
>
> I'm trying to understand the intentions of this test better:
>
> https://github.com/zzzeek/sqlalchemy/blob/master/lib/sqlalchemy/testing/suite/test_dialect.py#L30
>
> The test checks if a integrity error is raised when a duplicate key is
> inserted. In the case of the MonetDB dialect this exception is raised. But
> then the test still fails. This is because the context manager initiated by
> 'with config.db.begin() ' tries to commit the transaction when exiting the
> context. This fails, which I guess is correct. Isn't there a mistake in the
> test?

so the only database I deal with that is strict about this is
Postgresql, which even in the FAQ includes an example of how to
generate the "current transaction is aborted, commands ignored until
end of transaction block" error.   It is not generating that here, but
if I do this, then it does:

diff --git a/lib/sqlalchemy/testing/suite/test_dialect.py
b/lib/sqlalchemy/testing/suite/test_dialect.py
index 5dd1f0501..eef4c4a71 100644
--- a/lib/sqlalchemy/testing/suite/test_dialect.py
+++ b/lib/sqlalchemy/testing/suite/test_dialect.py
@@ -42,6 +42,10 @@ class ExceptionTest(fixtures.TablesTest):
                 {'id': 1, 'data': 'd1'}
             )

+            conn.execute(
+                self.tables.manual_pk.insert(),
+                {'id': 2, 'data': 'd1'}
+            )

 class AutocommitTest(fixtures.TablesTest):


so yes that's a bug.   An unticketed fix is in the pipeline at
https://gerrit.sqlalchemy.org/576.




>
> related issue on the MonetDB dialect issue tracker:
>
> https://github.com/gijzelaerr/sqlalchemy-monetdb/issues/17
>
> --
> SQLAlchemy -
> The Python SQL Toolkit and Object Relational Mapper
>
> http://www.sqlalchemy.org/
>
> To post example code, please provide an MCVE: Minimal, Complete, and
> Verifiable Example. See http://stackoverflow.com/help/mcve for a full
> description.
> ---
> You received this message because you are subscribed to the Google Groups
> "sqlalchemy" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to sqlalchemy+unsubscr...@googlegroups.com.
> To post to this group, send email to sqlalchemy@googlegroups.com.
> Visit this group at https://groups.google.com/group/sqlalchemy.
> For more options, visit https://groups.google.com/d/optout.

-- 
SQLAlchemy - 
The Python SQL Toolkit and Object Relational Mapper

http://www.sqlalchemy.org/

To post example code, please provide an MCVE: Minimal, Complete, and Verifiable 
Example.  See  http://stackoverflow.com/help/mcve for a full description.
--- 
You received this message because you are subscribed to the Google Groups 
"sqlalchemy" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sqlalchemy+unsubscr...@googlegroups.com.
To post to this group, send email to sqlalchemy@googlegroups.com.
Visit this group at https://groups.google.com/group/sqlalchemy.
For more options, visit https://groups.google.com/d/optout.

Reply via email to