From 342d7b49dd4dc88e7f24eecf1ad53198fa1545af Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Adrien=20Verg=C3=A9?= Date: Wed, 28 Jun 2017 13:30:12 +0200 Subject: [PATCH] tests(cli): Create a temp test workspace only once Do not re-create it for every test in the class. --- tests/test_cli.py | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/tests/test_cli.py b/tests/test_cli.py index b1300a7..ad0749f 100644 --- a/tests/test_cli.py +++ b/tests/test_cli.py @@ -32,8 +32,11 @@ from tests.common import build_temp_workspace class CommandLineTestCase(unittest.TestCase): - def setUp(self): - self.wd = build_temp_workspace({ + @classmethod + def setUpClass(cls): + super(CommandLineTestCase, cls).setUpClass() + + cls.wd = build_temp_workspace({ # .yaml file at root 'a.yaml': '---\n' '- 1 \n' @@ -63,8 +66,11 @@ class CommandLineTestCase(unittest.TestCase): u'# الأَبْجَدِيَّة العَرَبِيَّة\n').encode('utf-8'), }) - def tearDown(self): - shutil.rmtree(self.wd) + @classmethod + def tearDownClass(cls): + super(CommandLineTestCase, cls).tearDownClass() + + shutil.rmtree(cls.wd) def test_find_files_recursively(self): self.assertEqual(