]> git.ipfire.org Git - thirdparty/sqlalchemy/sqlalchemy.git/commitdiff
- Reverted the change for :ticket:`3060` - this is a unit of work
authorMike Bayer <mike_mp@zzzcomputing.com>
Mon, 23 Jun 2014 22:38:23 +0000 (18:38 -0400)
committerMike Bayer <mike_mp@zzzcomputing.com>
Mon, 23 Jun 2014 22:42:54 +0000 (18:42 -0400)
fix that is updated more comprehensively in 1.0 via :ticket:`3061`.
The fix in :ticket:`3060` unfortunately produces a new issue whereby
an eager load of a many-to-one attribute can produce an event
that is interpreted into an attribute change.

doc/build/changelog/changelog_09.rst
lib/sqlalchemy/testing/__init__.py
test/orm/test_unitofworkv2.py

index 832b067ddcb46b952671347570c15b3c2e5d4a25..adc109680aa6811243b5300bc7210a03cc31d8e9 100644 (file)
     .. include:: changelog_07.rst
         :start-line: 5
 
+.. changelog::
+    :version: 0.9.6
+    :released:
+
+    .. change::
+        :tags: bug, orm
+        :tickets: 3060
+
+        Reverted the change for :ticket:`3060` - this is a unit of work
+        fix that is updated more comprehensively in 1.0 via :ticket:`3061`.
+        The fix in :ticket:`3060` unfortunately produces a new issue whereby
+        an eager load of a many-to-one attribute can produce an event
+        that is interpreted into an attribute change.
+
 .. changelog::
     :version: 0.9.5
     :released: June 23, 2014
         which reverts the more patchwork version of the fix as it exists
         in 0.9.5.
 
+        .. note::
+
+            This change has been **REVERTED** in 0.9.6.   The full fix
+            will be in version 1.0 of SQLAlchemy.
+
+
     .. change::
         :tags: bug, orm
         :versions: 1.0.0
index 95490643220d9f383e2de189766721adcf488c08..c03c6f349f09533dd445dcb5a43f49126980dd11 100644 (file)
@@ -11,7 +11,7 @@ from . import config
 
 from .exclusions import db_spec, _is_excluded, fails_if, skip_if, future,\
     fails_on, fails_on_everything_except, skip, only_on, exclude, \
-    against as _against, _server_version, only_if
+    against as _against, _server_version, only_if, fails
 
 
 def against(*queries):
index 00cc044bfa37f1c4ce9f2d2d3680952d6f43b4c7..787c104e7e537f6ab87d690d2c7cce9b8b28d358 100644 (file)
@@ -1314,6 +1314,7 @@ class RowswitchM2OTest(fixtures.MappedTest):
         mapper(C, c)
         return A, B, C
 
+    @testing.fails()
     def test_set_none_replaces_m2o(self):
         # we have to deal here with the fact that a
         # get of an unset attribute implicitly sets it to None
@@ -1337,6 +1338,7 @@ class RowswitchM2OTest(fixtures.MappedTest):
         sess.commit()
         assert a1.bs[0].c is None
 
+    @testing.fails()
     def test_set_none_w_get_replaces_m2o(self):
         A, B, C = self._fixture()
         sess = Session()
@@ -1389,6 +1391,25 @@ class RowswitchM2OTest(fixtures.MappedTest):
         sess.commit()
         assert a1.bs[0].data is None
 
+    def test_joinedload_doesnt_produce_bogus_event(self):
+        A, B, C = self._fixture()
+        sess = Session()
+
+        c1 = C()
+        sess.add(c1)
+        sess.flush()
+
+        b1 = B()
+        sess.add(b1)
+        sess.commit()
+
+        # test that was broken by #3060
+        from sqlalchemy.orm import joinedload
+        b1 = sess.query(B).options(joinedload("c")).first()
+        b1.cid = c1.id
+        sess.flush()
+
+        assert b1.cid == c1.id
 
 
 class BasicStaleChecksTest(fixtures.MappedTest):