|
32 | 32 | from unittest import TextTestRunner
|
33 | 33 |
|
34 | 34 | from easybuild.tools.config import module_classes
|
35 |
| -from easybuild.tools.docs import avail_cfgfile_constants, avail_easyconfig_licenses, gen_easyblocks_overview_rst |
36 |
| -from easybuild.tools.docs import list_easyblocks, list_software, list_toolchains |
| 35 | +from easybuild.tools.docs import avail_cfgfile_constants, avail_easyconfig_constants, avail_easyconfig_licenses |
| 36 | +from easybuild.tools.docs import gen_easyblocks_overview_rst, list_easyblocks, list_software, list_toolchains |
37 | 37 | from easybuild.tools.docs import md_title_and_table, rst_title_and_table
|
38 | 38 | from easybuild.tools.options import EasyBuildOptions
|
39 | 39 | from easybuild.tools.utilities import import_available_modules, mk_md_table, mk_rst_table
|
@@ -636,6 +636,49 @@ def test_avail_cfgfile_constants(self):
|
636 | 636 | regex = re.compile(pattern, re.M)
|
637 | 637 | self.assertTrue(regex.search(txt_rst), "Pattern '%s' should be found in: %s" % (regex.pattern, txt_rst))
|
638 | 638 |
|
| 639 | + def test_avail_easyconfig_constants(self): |
| 640 | + """ |
| 641 | + Test avail_easyconfig_constants to generate overview of constants that can be used in easyconfig files. |
| 642 | + """ |
| 643 | + txt_patterns = [ |
| 644 | + r"^Constants that can be used in easyconfigs", |
| 645 | + r"^\s*ARCH: .* \(CPU architecture of current system \(aarch64, x86_64, ppc64le, ...\)\)", |
| 646 | + r"^\s*OS_PKG_OPENSSL_DEV: \('openssl-devel', 'libssl-dev', 'libopenssl-devel'\) " |
| 647 | + r"\(OS packages providing openSSL developement support\)", |
| 648 | + ] |
| 649 | + |
| 650 | + txt = avail_easyconfig_constants() |
| 651 | + for pattern in txt_patterns: |
| 652 | + regex = re.compile(pattern, re.M) |
| 653 | + self.assertTrue(regex.search(txt), "Pattern '%s' should be found in: %s" % (regex.pattern, txt)) |
| 654 | + |
| 655 | + txt = avail_easyconfig_constants(output_format='txt') |
| 656 | + for pattern in txt_patterns: |
| 657 | + regex = re.compile(pattern, re.M) |
| 658 | + self.assertTrue(regex.search(txt), "Pattern '%s' should be found in: %s" % (regex.pattern, txt)) |
| 659 | + |
| 660 | + md_patterns = [ |
| 661 | + r"^## Constants that can be used in easyconfigs", |
| 662 | + r"^``ARCH``\s*\|``.*``\s*\|CPU architecture of current system \(aarch64, x86_64, ppc64le, ...\)$", |
| 663 | + r"^``OS_PKG_OPENSSL_DEV``\s*\|``\('openssl-devel', 'libssl-dev', 'libopenssl-devel'\)``\s*\|" |
| 664 | + r"OS packages providing openSSL developement support$", |
| 665 | + ] |
| 666 | + txt_md = avail_easyconfig_constants(output_format='md') |
| 667 | + for pattern in md_patterns: |
| 668 | + regex = re.compile(pattern, re.M) |
| 669 | + self.assertTrue(regex.search(txt_md), "Pattern '%s' should be found in: %s" % (regex.pattern, txt_md)) |
| 670 | + |
| 671 | + rst_patterns = [ |
| 672 | + r"^Constants that can be used in easyconfigs\n-{41}", |
| 673 | + r"^``ARCH``\s*``.*``\s*CPU architecture of current system \(aarch64, x86_64, ppc64le, ...\)$", |
| 674 | + r"^``OS_PKG_OPENSSL_DEV``\s*``\('openssl-devel', 'libssl-dev', 'libopenssl-devel'\)``\s*" |
| 675 | + r"OS packages providing openSSL developement support$", |
| 676 | + ] |
| 677 | + txt_rst = avail_easyconfig_constants(output_format='rst') |
| 678 | + for pattern in rst_patterns: |
| 679 | + regex = re.compile(pattern, re.M) |
| 680 | + self.assertTrue(regex.search(txt_rst), "Pattern '%s' should be found in: %s" % (regex.pattern, txt_rst)) |
| 681 | + |
639 | 682 | def test_mk_table(self):
|
640 | 683 | """
|
641 | 684 | Tests for mk_*_table functions.
|
|
0 commit comments