Skip to content

Commit

Permalink
Moved calls to addCleanup before assertions in admin_scripts tests, s…
Browse files Browse the repository at this point in the history
…o that cleanup occurs even when tests fails.

git-svn-id: http://code.djangoproject.com/svn/django/trunk@17281 bcc190cf-cafb-0310-a4f2-bffc1f526a37
  • Loading branch information
aaugustin committed Dec 27, 2011
1 parent 12206bd commit ae0ce43
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions tests/regressiontests/admin_scripts/tests.py
Expand Up @@ -1377,9 +1377,9 @@ def test_simple_project(self):
testproject_dir = os.path.join(test_dir, 'testproject')

out, err = self.run_django_admin(args)
self.addCleanup(shutil.rmtree, testproject_dir)
self.assertNoOutput(err)
self.assertTrue(os.path.isdir(testproject_dir))
self.addCleanup(shutil.rmtree, testproject_dir)

# running again..
out, err = self.run_django_admin(args)
Expand All @@ -1392,10 +1392,10 @@ def test_simple_project_different_directory(self):
testproject_dir = os.path.join(test_dir, 'othertestproject')

out, err = self.run_django_admin(args)
self.addCleanup(shutil.rmtree, testproject_dir)
self.assertNoOutput(err)
self.assertTrue(os.path.isdir(os.path.join(testproject_dir, 'testproject')))
self.assertTrue(os.path.exists(os.path.join(testproject_dir, 'testproject', 'manage.py')))
self.addCleanup(shutil.rmtree, testproject_dir)

# running again..
out, err = self.run_django_admin(args)
Expand All @@ -1409,9 +1409,9 @@ def test_custom_project_template(self):
testproject_dir = os.path.join(test_dir, 'customtestproject')

out, err = self.run_django_admin(args)
self.addCleanup(shutil.rmtree, testproject_dir)
self.assertNoOutput(err)
self.assertTrue(os.path.isdir(testproject_dir))
self.addCleanup(shutil.rmtree, testproject_dir)
self.assertTrue(os.path.exists(os.path.join(testproject_dir, 'additional_dir')))

def test_custom_project_template_from_tarball_by_path(self):
Expand All @@ -1421,9 +1421,9 @@ def test_custom_project_template_from_tarball_by_path(self):
testproject_dir = os.path.join(test_dir, 'tarballtestproject')

out, err = self.run_django_admin(args)
self.addCleanup(shutil.rmtree, testproject_dir)
self.assertNoOutput(err)
self.assertTrue(os.path.isdir(testproject_dir))
self.addCleanup(shutil.rmtree, testproject_dir)
self.assertTrue(os.path.exists(os.path.join(testproject_dir, 'run.py')))

def test_custom_project_template_from_tarball_by_url(self):
Expand All @@ -1435,7 +1435,7 @@ def test_custom_project_template_from_tarball_by_url(self):
testproject_dir = os.path.join(test_dir, 'urltestproject')

out, err = self.run_django_admin(args)
self.addCleanup(shutil.rmtree, testproject_dir)
self.assertNoOutput(err)
self.assertTrue(os.path.isdir(testproject_dir))
self.addCleanup(shutil.rmtree, testproject_dir)
self.assertTrue(os.path.exists(os.path.join(testproject_dir, 'run.py')))

0 comments on commit ae0ce43

Please sign in to comment.