diff -r 336570412918 ckan/lib/create_test_data.py
a
|
b
|
|
415 | 415 | model.Session.execute(sql) |
416 | 416 | model.repo.commit_and_remove() |
417 | 417 | for pkg_name in self.pkg_names: |
| 418 | model.Session().autoflush = False |
418 | 419 | pkg = model.Package.by_name(unicode(pkg_name)) |
419 | 420 | if pkg: |
420 | 421 | pkg.purge() |
… |
… |
|
432 | 433 | pkg.purge() |
433 | 434 | for grp in rev.groups: |
434 | 435 | grp.purge() |
| 436 | model.Session.commit() |
435 | 437 | model.Session.delete(rev) |
436 | 438 | for user_name in self.user_names: |
437 | 439 | user = model.User.by_name(unicode(user_name)) |
diff -r 336570412918 ckan/model/domain_object.py
a
|
b
|
|
75 | 75 | self.Session.delete(self) |
76 | 76 | |
77 | 77 | def purge(self): |
| 78 | self.Session().autoflush = False |
78 | 79 | if hasattr(self, '__revisioned__'): # only for versioned objects ... |
79 | 80 | # this actually should auto occur due to cascade relationships but |
80 | 81 | # ... |
diff -r 336570412918 ckan/tests/forms/test_group.py
a
|
b
|
|
10 | 10 | |
11 | 11 | @classmethod |
12 | 12 | def teardown_class(self): |
13 | | ckan.tests.CreateTestData.delete() |
| 13 | model.repo.clean_db() |
14 | 14 | |
15 | 15 | def test_1(self): |
16 | 16 | group = model.Group.by_name(u'roger') |
diff -r 336570412918 ckan/tests/functional/api/test_model.py
a
|
b
|
|
363 | 363 | def teardown(self): |
364 | 364 | for relationship in self.anna.get_relationships(): |
365 | 365 | relationship.purge() |
| 366 | model.Session.commit() |
366 | 367 | relationships = self.anna.get_relationships() |
367 | 368 | assert relationships == [], "There are still some relationships: %s" % relationships |
368 | 369 | |
diff -r 336570412918 ckan/tests/functional/test_group.py
a
|
b
|
|
39 | 39 | |
40 | 40 | @classmethod |
41 | 41 | def teardown_class(self): |
42 | | CreateTestData.delete() |
| 42 | model.repo.clean_db() |
43 | 43 | |
44 | 44 | def test_mainmenu(self): |
45 | 45 | offset = url_for(controller='home', action='index') |
diff -r 336570412918 ckan/tests/models/test_harvesting.py
a
|
b
|
|
22 | 22 | self.gemini = GeminiExamples() |
23 | 23 | |
24 | 24 | def teardown(self): |
25 | | if self.document: |
26 | | self.delete(self.document) |
27 | | for document in HarvestedDocument.filter(): |
28 | | document.delete() |
29 | | if self.job: |
30 | | self.delete(self.job) |
31 | | if self.source: |
32 | | self.delete(self.source) |
33 | | self.commit_remove() |
34 | | self.purge_package_by_name('00a743bf-cca4-4c19-a8e5-e64f7edbcadd') |
35 | | super(HarvesterTestCase, self).teardown() |
36 | 25 | model.repo.clean_db() |
37 | 26 | |
38 | 27 | def create_fixture(self, domain_type, **kwds): |