tests(cli): Create a temp test workspace only once

Do not re-create it for every test in the class.
pull/60/head
Adrien Vergé 8 years ago
parent 7d638d47b9
commit 342d7b49dd

@ -32,8 +32,11 @@ from tests.common import build_temp_workspace
class CommandLineTestCase(unittest.TestCase): class CommandLineTestCase(unittest.TestCase):
def setUp(self): @classmethod
self.wd = build_temp_workspace({ def setUpClass(cls):
super(CommandLineTestCase, cls).setUpClass()
cls.wd = build_temp_workspace({
# .yaml file at root # .yaml file at root
'a.yaml': '---\n' 'a.yaml': '---\n'
'- 1 \n' '- 1 \n'
@ -63,8 +66,11 @@ class CommandLineTestCase(unittest.TestCase):
u'# الأَبْجَدِيَّة العَرَبِيَّة\n').encode('utf-8'), u'# الأَبْجَدِيَّة العَرَبِيَّة\n').encode('utf-8'),
}) })
def tearDown(self): @classmethod
shutil.rmtree(self.wd) def tearDownClass(cls):
super(CommandLineTestCase, cls).tearDownClass()
shutil.rmtree(cls.wd)
def test_find_files_recursively(self): def test_find_files_recursively(self):
self.assertEqual( self.assertEqual(

Loading…
Cancel
Save