diff --git a/.gitignore b/.gitignore index 45250c9f6..201c11366 100644 --- a/.gitignore +++ b/.gitignore @@ -13,3 +13,4 @@ dist/ build/ MANIFEST .vagrant/ +dj_local_conf.json diff --git a/.travis.yml b/.travis.yml index c52c11a1d..b48cbc6cc 100644 --- a/.travis.yml +++ b/.travis.yml @@ -3,6 +3,7 @@ env: - DJ_TEST_HOST="127.0.0.1" DJ_TEST_USER="root" DJ_TEST_PASSWORD="" DJ_HOST="127.0.0.1" DJ_USER="root" DJ_PASSWORD="" python: - "3.4" + - "3.5" services: mysql install: - pip install -r requirements.txt diff --git a/datajoint/base_relation.py b/datajoint/base_relation.py index 4920307dd..a2834e7ff 100644 --- a/datajoint/base_relation.py +++ b/datajoint/base_relation.py @@ -357,7 +357,7 @@ def delete(self): do_delete = False # indicate if there is anything to delete if config['safemode']: print('The contents of the following tables are about to be deleted:') - for relation in relations.values(): + for relation in list(relations.values()): count = len(relation) if count: do_delete = True diff --git a/tests/test_cascading_delete.py b/tests/test_cascading_delete.py index fa499ba1e..917748cec 100644 --- a/tests/test_cascading_delete.py +++ b/tests/test_cascading_delete.py @@ -24,6 +24,15 @@ def test_delete_tree(): A().delete() assert_false(A() or B() or B.C() or D() or E() or E.F(), 'incomplete delete') + @staticmethod + def test_stepwise_delete(): + assert_false(dj.config['safemode'], 'safemode must be off for testing') #TODO: just turn it off instead of warning + assert_true(L() and A() and B() and B.C(), 'schema population failed as a precondition to test') + B.C().delete() + assert_false(B.C(), 'failed to delete child tables') + B().delete() + assert_false(B(), 'failed to delete the parent table following child table deletion') + @staticmethod def test_delete_tree_restricted(): assert_false(dj.config['safemode'], 'safemode must be off for testing')