11import sqlalchemy as sa
22from sqlalchemy .testing .suite import *
33from sqlalchemy .testing .suite import ComponentReflectionTest as _ComponentReflectionTest
4+ from sqlalchemy .testing .suite import ExceptionTest as _ExceptionTest
45
56from sqlalchemy import inspect
67from sqlalchemy .testing import eq_
1011from sqlalchemy import MetaData
1112
1213
13- # SQLAlchemy < 1.1 doesn't implement CompoundSelectTest
14- from sqlalchemy import __version__
15- major , minor = [int (i ) for i in __version__ .split ('.' )[:2 ]]
16- if major < 1 or (major == 1 and minor < 1 ):
17- class _CompoundSelectTest :
18- pass
19- else :
20- from sqlalchemy .testing .suite import CompoundSelectTest as _CompoundSelectTest
21-
22-
2314class ComponentReflectionTest (_ComponentReflectionTest ):
2415 @testing .requires .foreign_key_constraint_reflection
2516 def test_get_foreign_keys (self ):
@@ -139,15 +130,22 @@ def define_reflected_tables(cls, metadata, schema):
139130 cls .define_temp_tables (metadata )
140131
141132
142- class CompoundSelectTest ( _CompoundSelectTest ):
133+ class ExceptionTest ( _ExceptionTest ):
143134 """
144- Disable tests here since we don't support order by within unions
135+ overriding this since a bug in test suite:
145136
146- https://www.monetdb .org/bugzilla/show_bug.cgi?id=6434
137+ https://gerrit.sqlalchemy .org/#/c/576/
147138 """
139+ @requirements .duplicate_key_raises_integrity_error
140+ def test_integrity_error (self ):
148141
149- def test_distinct_selectable_in_unions (self ):
150- pass
142+ def inner ():
143+ with config .db .begin () as conn :
144+ conn .execute (self .tables .manual_pk .insert (), {'id' : 1 , 'data' : 'd1' })
145+ conn .execute (self .tables .manual_pk .insert (), {'id' : 1 , 'data' : 'd1' })
146+
147+ assert_raises (
148+ exc .IntegrityError ,
149+ inner
150+ )
151151
152- def test_limit_offset_aliased_selectable_in_unions (self ):
153- pass
0 commit comments