(self)
| 118 | go2() |
| 119 | |
| 120 | def test_merge_load(self): |
| 121 | Parent = self.classes.Parent |
| 122 | |
| 123 | sess = fixture_session() |
| 124 | sess2 = fixture_session() |
| 125 | p1 = sess.get(Parent, 1) |
| 126 | p1.children |
| 127 | |
| 128 | # preloading of collection took this down from 1728 to 1192 |
| 129 | # using sqlite3 the C extension took it back up to approx. 1257 |
| 130 | # (py2.6) |
| 131 | |
| 132 | sess2.connection() # autobegin |
| 133 | |
| 134 | # use a huge variance on this because it really changes quite randomly |
| 135 | # on different Python verrsions / CPUs etc. |
| 136 | @profiling.function_call_count(variance=0.50) |
| 137 | def go(): |
| 138 | sess2.merge(p1) |
| 139 | |
| 140 | go() |
| 141 | |
| 142 | # one more time, count the SQL |
| 143 | |
| 144 | def go2(): |
| 145 | sess2.merge(p1) |
| 146 | |
| 147 | sess2 = sessionmaker(testing.db)() |
| 148 | self.assert_sql_count(testing.db, go2, 2) |
| 149 | |
| 150 | |
| 151 | class LoadManyToOneFromIdentityTest(fixtures.MappedTest): |
nothing calls this directly
no test coverage detected