Commits

Atsushi Odagiri committed dd066a2 Draft

testing

Comments (0)

Files changed (5)

addressbook/testing.py

+import pytest
+
+@pytest.fixture
+def models(request):
+    from sqlalchemy import create_engine
+    from . import models
+    engine = create_engine('sqlite:///')
+    models.init(engine)
+    def fin():
+        models.DBSession.remove()
+    request.addfinalizer(fin)
+    return models

addressbook/tests/__init__.py

+#

addressbook/tests/test_models.py

+from ..testing import models
+
+def test_it(models):
+    p = models.Person()
+    assert p.tags == []
+    p.tags = [u"a", u"b"]
+
+    assert p.tags == [u"a", u"b"]
+    assert p._tags[0].name == u"a"
 extensions = buildout-versions
 buildout_versions_file = versions.cfg
 allow-picked-versions = false
-parts = pyramid
-
+parts = 
+    pyramid
+    test
 versions = versions
 develop = .
 
 eggs = 
     pyramid
     addressbook
+
+[test]
+recipe = zc.recipe.egg
+eggs = 
+    ${pyramid:eggs}
+    pytest
 # Required by:
 # addressbook==0.0
 pyramid-fanstatic = 0.4
+
+# Added by Buildout Versions at 2013-01-29 20:52:09.395586
+py = 1.4.12
+pytest = 2.3.4