Skip to content

Commit

Permalink
Better organization of cleanup tests involving Unicode filenames and …
Browse files Browse the repository at this point in the history
…dir names.
  • Loading branch information
audreyfeldroy committed Aug 19, 2013
1 parent 5e23deb commit adbd7e6
Showing 1 changed file with 21 additions and 12 deletions.
33 changes: 21 additions & 12 deletions tests/test_cleanup.py
Expand Up @@ -11,7 +11,12 @@
from __future__ import unicode_literals
import os
import shutil
import unittest
import sys

if sys.version_info[:2] < (2, 7):
import unittest2 as unittest
else:
import unittest

from cookiecutter import cleanup, exceptions

Expand All @@ -28,17 +33,6 @@ def test_remove_repo(self):
self.assertTrue(os.path.isfile('tests/fake-project/README.rst'))
self.assertFalse(os.path.exists('tests/fake-repo'))

def test_remove_repo_unicode(self):
if os.path.supports_unicode_filenames:
success = cleanup.remove_repo(
repo_dir='tests/fake-repööö',
generated_project='fake-pröööject'
)
self.assertTrue(success)
self.assertTrue(os.path.isdir('tests/fake-pröööject'))
self.assertTrue(os.path.isfile('tests/fake-pröööject/README.rst'))
self.assertFalse(os.path.exists('tests/fake-repööö'))

def test_remove_repo_bad(self):
self.assertRaises(
exceptions.MissingProjectDir,
Expand All @@ -52,6 +46,21 @@ def tearDown(self):
os.mkdir('tests/fake-repo')
shutil.move('tests/fake-project', 'tests/fake-repo/fake-project')


class TestCleanupUnicode(unittest.TestCase):

def test_remove_repo_unicode(self):
if os.path.supports_unicode_filenames:
success = cleanup.remove_repo(
repo_dir='tests/fake-repööö',
generated_project='fake-pröööject'
)
self.assertTrue(success)
self.assertTrue(os.path.isdir('tests/fake-pröööject'))
self.assertTrue(os.path.isfile('tests/fake-pröööject/README.rst'))
self.assertFalse(os.path.exists('tests/fake-repööö'))

def tearDown(self):
if os.path.supports_unicode_filenames:
if not os.path.exists('tests/fake-repööö'):
os.mkdir('tests/fake-repööö')
Expand Down

0 comments on commit adbd7e6

Please sign in to comment.