]> git.ipfire.org Git - thirdparty/sqlalchemy/sqlalchemy.git/commitdiff
Add instructions to install nose adn NB that it won't happen by magic
authorChris Withers <chris@simplistix.co.uk>
Wed, 7 Apr 2010 17:09:21 +0000 (18:09 +0100)
committerChris Withers <chris@simplistix.co.uk>
Wed, 7 Apr 2010 17:09:21 +0000 (18:09 +0100)
README.unittests
test/ext/test_declarative.py

index dee34a106b9d321d38fe1b2b71545e06de59c013..dd2f6ab1bdad4463ffb9245fee38edc49c514cb0 100644 (file)
@@ -13,6 +13,13 @@ http://somethingaboutorange.com/mrl/projects/nose/0.11.1/index.html
 SQLAlchemy implements a nose plugin that must be present when tests are run.
 This plugin is available when SQLAlchemy is installed via setuptools.
 
+NB: You will need to manually install nose, it is unlikely to be pulled
+    down as a dependency of installing SQLAlchemy.
+
+    Nose can be installed with:
+
+    $ easy_install nose
+
 INSTANT TEST RUNNER
 -------------------
 
index 67e650c34f5542facaadfc3638805015005af9c8..4fa59a62d5d1ceb35f289c2b23f545c2fe13364d 100644 (file)
@@ -2101,6 +2101,27 @@ class DeclarativeMixinTest(DeclarativeTestBase):
         assert class_mapper(Person).polymorphic_on is Person.__table__.c.type
         eq_(class_mapper(Engineer).polymorphic_identity, 'Engineer')
         
+    def test_mapper_args_classproperty_three(self):
+
+        class Person(Base):
+            __tablename__ = 'people'
+            id = Column(Integer, primary_key=True)
+            discriminator = Column('type', String(50))
+            @classproperty
+            def __mapper_args__(cls):
+                if cls.__name__=='Person':
+                    return dict(polymorphic_on=cls.discriminator)
+                else:
+                    return dict(polymorphic_identity=cls.__name__)
+
+        class Engineer(Person):
+            pass
+
+        compile_mappers()
+
+        assert class_mapper(Person).polymorphic_on is Person.__table__.c.type
+        eq_(class_mapper(Engineer).polymorphic_identity, 'Engineer')
+
     def test_table_args_composite(self):
 
         class MyMixin1: