From c98f7e3737ce5eaa5b06251a6a2cb54a658518b5 Mon Sep 17 00:00:00 2001 From: Kenneth Hoste Date: Mon, 29 Jun 2015 16:57:01 +0200 Subject: [PATCH] kickstart tests for quote_str/dump --- test/framework/easyconfig.py | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/test/framework/easyconfig.py b/test/framework/easyconfig.py index 6454cf1087..dbc8cdcaa8 100644 --- a/test/framework/easyconfig.py +++ b/test/framework/easyconfig.py @@ -55,6 +55,7 @@ from easybuild.tools.module_naming_scheme.toolchain import det_toolchain_compilers, det_toolchain_mpi from easybuild.tools.module_naming_scheme.utilities import det_full_ec_version from easybuild.tools.systemtools import get_shared_lib_ext +from easybuild.tools.utilities import quote_str from test.framework.utilities import find_full_path @@ -1132,6 +1133,25 @@ def test_hide_hidden_deps(self): self.assertEqual(ec['hiddendependencies'][0]['full_mod_name'], 'toy/.0.0-deps') self.assertEqual(ec['dependencies'], []) + def test_quote_str(self): + """Test quote_str function.""" + self.assertEqual(quote_str('foo'), '"foo"') + # FIXME: add more test cases + + def test_dump(self): + """Test EasyConfig's dump() method.""" + test_ecs_dir = os.path.join(os.path.dirname(os.path.abspath(__file__)), 'easyconfigs') + + test_ec = os.path.join(self.test_prefix, 'test.eb') + + ec = EasyConfig(os.path.join(test_ecs_dir, 'toy-0.0.eb')) + ec.dump(test_ec) + ectxt = read_file(test_ec) + version_regex = re.compile('^version = "0.0"', re.M) + self.assertTrue(version_regex.search(ectxt)) + # FIXME: add more test cases (using easyconfigs available in test/framework/easyconfigs) + + def suite(): """ returns all the testcases in this module """ return TestLoader().loadTestsFromTestCase(EasyConfigTest)