Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Moved calls to addCleanup before assertions in admin_scripts tests, s…

…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...
commit ae0ce4373ff63fac22f4673928f2cf4378cb54e0 1 parent 12206bd
@aaugustin aaugustin authored
Showing with 5 additions and 5 deletions.
  1. +5 −5 tests/regressiontests/admin_scripts/tests.py
View
10 tests/regressiontests/admin_scripts/tests.py
@@ -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)
@@ -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)
@@ -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):
@@ -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):
@@ -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')))
Please sign in to comment.
Something went wrong with that request. Please try again.