|
36 | 36 | import sys |
37 | 37 | import tempfile |
38 | 38 | from test.framework.utilities import EnhancedTestCase |
| 39 | +from test.framework.package import mock_fpm |
39 | 40 | from unittest import TestLoader |
40 | 41 | from unittest import main as unittestmain |
41 | 42 | from vsc.utils.fancylogger import setLogLevelDebug, logToScreen |
|
46 | 47 | from easybuild.tools.config import get_module_syntax |
47 | 48 | from easybuild.tools.filetools import mkdir, read_file, which, write_file |
48 | 49 | from easybuild.tools.modules import modules_tool |
| 50 | +from easybuild.tools.version import VERSION as EASYBUILD_VERSION |
49 | 51 |
|
50 | 52 |
|
51 | 53 | class ToyBuildTest(EnhancedTestCase): |
@@ -970,6 +972,39 @@ def test_module_only(self): |
970 | 972 | modtxt = read_file(toy_mod + '.lua') |
971 | 973 | self.assertTrue(re.search('load.*ictce/4.1.13', modtxt), "load statement for ictce/4.1.13 found in module") |
972 | 974 |
|
| 975 | + def test_package(self): |
| 976 | + """Test use of --package and accompanying package configuration settings.""" |
| 977 | + mock_fpm(self.test_prefix) |
| 978 | + pkgpath = os.path.join(self.test_prefix, 'pkgs') |
| 979 | + |
| 980 | + extra_args = [ |
| 981 | + '--experimental', |
| 982 | + '--package', |
| 983 | + '--package-release=321', |
| 984 | + '--package-tool=fpm', |
| 985 | + '--package-type=foo', |
| 986 | + '--packagepath=%s' % pkgpath, |
| 987 | + ] |
| 988 | + |
| 989 | + self.test_toy_build(extra_args=extra_args) |
| 990 | + |
| 991 | + toypkg = os.path.join(pkgpath, 'toy-0.0-eb-%s.321.foo' % EASYBUILD_VERSION) |
| 992 | + self.assertTrue(os.path.exists(toypkg), "%s is there" % toypkg) |
| 993 | + |
| 994 | + def test_package_skip(self): |
| 995 | + """Test use of --package with --skip.""" |
| 996 | + mock_fpm(self.test_prefix) |
| 997 | + pkgpath = os.path.join(self.test_prefix, 'packages') # default path |
| 998 | + |
| 999 | + self.test_toy_build(['--packagepath=%s' % pkgpath]) |
| 1000 | + self.assertFalse(os.path.exists(pkgpath), "%s is not created without use of --package" % pkgpath) |
| 1001 | + |
| 1002 | + self.test_toy_build(extra_args=['--experimental', '--package', '--skip'], verify=False) |
| 1003 | + |
| 1004 | + toypkg = os.path.join(pkgpath, 'toy-0.0-eb-%s.1.rpm' % EASYBUILD_VERSION) |
| 1005 | + self.assertTrue(os.path.exists(toypkg), "%s is there" % toypkg) |
| 1006 | + |
| 1007 | + |
973 | 1008 | def suite(): |
974 | 1009 | """ return all the tests in this file """ |
975 | 1010 | return TestLoader().loadTestsFromTestCase(ToyBuildTest) |
|
0 commit comments