Skip to content

Commit

Permalink
fix unit tests and extend them a bit
Browse files Browse the repository at this point in the history
  • Loading branch information
boegel committed Feb 11, 2013
1 parent a2a0c98 commit 263674e
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 6 deletions.
2 changes: 1 addition & 1 deletion easybuild/test/easyconfig.py
Original file line number Diff line number Diff line change
Expand Up @@ -478,7 +478,7 @@ def runTest(self):
self.assertEqual(ec['toolchain'], {'name': tcname, 'version': tcver})
# can't check for key 'foo', because EasyConfig ignores parameter names it doesn't know about
txt = open(res[1], "r").read()
self.assertTrue(re.search("foo = '%s'" % specs['foo'], txt))
self.assertTrue(re.search('foo = "%s"' % specs['foo'], txt))
os.remove(res[1])

# should pick correct version, i.e. not newer than what's specified, if a choice needs to be made
Expand Down
13 changes: 8 additions & 5 deletions easybuild/test/modulegenerator.py
Original file line number Diff line number Diff line change
Expand Up @@ -77,15 +77,15 @@ def runTest(self):
desc = self.modgen.get_description()
self.assertEqual(desc, expected)

# test loadModule
# test load_module
expected = """
if { ![is-loaded name/version] } {
module load name/version
}
"""
self.assertEqual(expected, self.modgen.load_module("name", "version"))

# test unloadModule
# test unload_module
expected = """
if { ![is-loaded name/version] } {
if { [is-loaded name] } {
Expand All @@ -95,7 +95,7 @@ def runTest(self):
"""
self.assertEqual(expected, self.modgen.unload_module("name", "version"))

# test prependPaths
# test prepend_paths
expected = """prepend-path key $root/path1
prepend-path key $root/path2
"""
Expand All @@ -110,8 +110,11 @@ def runTest(self):
self.modgen.prepend_paths, "key2", ["bar", "/tmp/foo"])


# test setEnvironment
self.assertEqual("setenv\tkey\t\tvalue\n", self.modgen.set_environment("key", "value"))
# test set_environment
self.assertEqual('setenv\tkey\t\t"value"\n', self.modgen.set_environment("key", "value"))
self.assertEqual("setenv\tkey\t\t'va\"lue'\n", self.modgen.set_environment("key", 'va"lue'))
self.assertEqual('setenv\tkey\t\t"va\'lue"\n', self.modgen.set_environment("key", "va'lue"))
self.assertEqual('setenv\tkey\t\t"""va"l\'ue"""\n', self.modgen.set_environment("key", """va"l'ue"""))

def tearDown(self):
"""cleanup"""
Expand Down

0 comments on commit 263674e

Please sign in to comment.