Changeset 516 for elixir/trunk
- Timestamp:
- 11/13/09 11:06:20 (3 years ago)
- Location:
- elixir/trunk/tests
- Files:
-
- 2 modified
-
test_abstract.py (modified) (2 diffs)
-
test_custombase.py (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
elixir/trunk/tests/test_abstract.py
r515 r516 12 12 13 13 def setup(): 14 # this is an ugly hack because globally defined entities of other tests 15 # (a.*, b.*, db1.* and db2.*) leak into this one because of nosetests 16 # habit of importing all modules before running the first test. 17 # test_abstract is usually the first test to be run, so it gets all the 14 # this is an ugly hack because globally defined entities of other tests 15 # (a.*, b.*, db1.* and db2.*) leak into this one because of nosetests 16 # habit of importing all modules before running the first test. 17 # test_abstract is usually the first test to be run, so it gets all the 18 18 # crap. 19 19 cleanup_all() … … 196 196 session.commit() 197 197 198 -
elixir/trunk/tests/test_custombase.py
r510 r516 4 4 5 5 from elixir import * 6 import elixir 6 7 7 8 def setup(): … … 182 183 assert TestA._descriptor.identity == 'test_a' 183 184 185 def test_base_custom_collection(self): 186 global A, B 187 188 collection = elixir.collection.RelativeEntityCollection() 189 190 class Base(object): 191 __metaclass__ = EntityMeta 192 using_options_defaults(collection=collection) 193 194 class A(Base): 195 b = ManyToOne('B') 196 197 class B(Base): 198 a = OneToOne('A') 199 200 assert not elixir.entities 201 assert A.table is None 202 assert B.table is None 203 204 setup_entities(collection) 205 206 assert A.table is not None 207 assert B.table is not None 208 209 del A 210 del B 211 212 def test_base_custom_session(self): 213 from sqlalchemy.orm import sessionmaker 214 215 class Base(object): 216 __metaclass__ = EntityMeta 217 using_options_defaults(session=None) 218 219 class A(Base): 220 b = ManyToOne('B') 221 222 class B(Base): 223 a = OneToOne('A') 224 225 setup_all(True) 226 227 a = A() 228 229 assert a not in elixir.session 230 231 session = sessionmaker()() 232 session.add(a) 233 assert a in session 234
