405405``1.4``|``GCC/4.6.3``, ``system``
406406``1.5``|``foss/2018a``, ``intel/2018a``""" % {'gcc_descr' : GCC_DESCR , 'gzip_descr' : GZIP_DESCR }
407407
408+ LIST_SOFTWARE_SIMPLE_MD = """# List of supported software
409+
410+ EasyBuild supports 2 different software packages (incl. toolchains, bundles):
411+
412+ [g](#g)
413+
414+
415+ ## G
416+
417+ * GCC
418+ * gzip"""
419+
420+ LIST_SOFTWARE_DETAILED_MD = """# List of supported software
421+
422+ EasyBuild supports 2 different software packages (incl. toolchains, bundles):
423+
424+ [g](#g)
425+
426+
427+ ## G
428+
429+
430+ [GCC](#gcc) - [gzip](#gzip)
431+
432+
433+ ### GCC
434+
435+ %(gcc_descr)s
436+
437+ *homepage*: <http://gcc.gnu.org/>
438+
439+ version |toolchain
440+ ---------|----------
441+ ``4.6.3``|``system``
442+
443+ ### gzip
444+
445+ %(gzip_descr)s
446+
447+ *homepage*: <http://www.gzip.org/>
448+
449+ version|toolchain
450+ -------|-------------------------------
451+ ``1.4``|``GCC/4.6.3``, ``system``
452+ ``1.5``|``foss/2018a``, ``intel/2018a``""" % {'gcc_descr' : GCC_DESCR , 'gzip_descr' : GZIP_DESCR }
453+
454+ LIST_SOFTWARE_SIMPLE_JSON = """[
455+ {
456+ "name": "GCC"
457+ },
458+ {
459+ "name": "gzip"
460+ }
461+ ]"""
462+
463+ LIST_SOFTWARE_DETAILED_JSON = """[
464+ {
465+ "description": "%(gcc_descr)s",
466+ "homepage": "http://gcc.gnu.org/",
467+ "name": "GCC",
468+ "toolchain": "system",
469+ "version": "4.6.3",
470+ "versionsuffix": ""
471+ },
472+ {
473+ "description": "%(gzip_descr)s",
474+ "homepage": "http://www.gzip.org/",
475+ "name": "gzip",
476+ "toolchain": "GCC/4.6.3",
477+ "version": "1.4",
478+ "versionsuffix": ""
479+ },
480+ {
481+ "description": "%(gzip_descr)s",
482+ "homepage": "http://www.gzip.org/",
483+ "name": "gzip",
484+ "toolchain": "system",
485+ "version": "1.4",
486+ "versionsuffix": ""
487+ },
488+ {
489+ "description": "%(gzip_descr)s",
490+ "homepage": "http://www.gzip.org/",
491+ "name": "gzip",
492+ "toolchain": "foss/2018a",
493+ "version": "1.5",
494+ "versionsuffix": ""
495+ },
496+ {
497+ "description": "%(gzip_descr)s",
498+ "homepage": "http://www.gzip.org/",
499+ "name": "gzip",
500+ "toolchain": "intel/2018a",
501+ "version": "1.5",
502+ "versionsuffix": ""
503+ }
504+ ]""" % {'gcc_descr' : GCC_DESCR , 'gzip_descr' : GZIP_DESCR }
505+
408506
409507class DocsTest (EnhancedTestCase ):
410508
@@ -541,6 +639,9 @@ def test_license_docs(self):
541639 regex = re .compile (r"^``GPLv3``\s*|The GNU General Public License" , re .M )
542640 self .assertTrue (regex .search (lic_docs ), "%s found in: %s" % (regex .pattern , lic_docs ))
543641
642+ # expect NotImplementedError for JSON output
643+ self .assertRaises (NotImplementedError , avail_easyconfig_licenses , output_format = 'json' )
644+
544645 def test_list_easyblocks (self ):
545646 """
546647 Tests for list_easyblocks function
@@ -569,6 +670,9 @@ def test_list_easyblocks(self):
569670 txt = list_easyblocks (list_easyblocks = 'detailed' , output_format = 'md' )
570671 self .assertEqual (txt , LIST_EASYBLOCKS_DETAILED_MD % {'topdir' : topdir_easyblocks })
571672
673+ # expect NotImplementedError for JSON output
674+ self .assertRaises (NotImplementedError , list_easyblocks , output_format = 'json' )
675+
572676 def test_list_software (self ):
573677 """Test list_software* functions."""
574678 build_options = {
@@ -587,6 +691,9 @@ def test_list_software(self):
587691 self .assertEqual (list_software (output_format = 'md' ), LIST_SOFTWARE_SIMPLE_MD )
588692 self .assertEqual (list_software (output_format = 'md' , detailed = True ), LIST_SOFTWARE_DETAILED_MD )
589693
694+ self .assertEqual (list_software (output_format = 'json' ), LIST_SOFTWARE_SIMPLE_JSON )
695+ self .assertEqual (list_software (output_format = 'json' , detailed = True ), LIST_SOFTWARE_DETAILED_JSON )
696+
590697 # GCC/4.6.3 is installed, no gzip module installed
591698 txt = list_software (output_format = 'txt' , detailed = True , only_installed = True )
592699 self .assertTrue (re .search (r'^\* GCC' , txt , re .M ))
@@ -690,6 +797,10 @@ def test_list_toolchains(self):
690797 regex = re .compile (pattern , re .M )
691798 self .assertTrue (regex .search (txt_rst ), "Pattern '%s' should be found in: %s" % (regex .pattern , txt_rst ))
692799
800+ # expect NotImplementedError for json output format
801+ with self .assertRaises (NotImplementedError ):
802+ list_toolchains (output_format = 'json' )
803+
693804 def test_avail_cfgfile_constants (self ):
694805 """
695806 Test avail_cfgfile_constants to generate overview of constants that can be used in a configuration file.
@@ -734,6 +845,10 @@ def test_avail_cfgfile_constants(self):
734845 regex = re .compile (pattern , re .M )
735846 self .assertTrue (regex .search (txt_rst ), "Pattern '%s' should be found in: %s" % (regex .pattern , txt_rst ))
736847
848+ # expect NotImplementedError for json output format
849+ with self .assertRaises (NotImplementedError ):
850+ avail_cfgfile_constants (option_parser .go_cfg_constants , output_format = 'json' )
851+
737852 def test_avail_easyconfig_constants (self ):
738853 """
739854 Test avail_easyconfig_constants to generate overview of constants that can be used in easyconfig files.
@@ -777,6 +892,10 @@ def test_avail_easyconfig_constants(self):
777892 regex = re .compile (pattern , re .M )
778893 self .assertTrue (regex .search (txt_rst ), "Pattern '%s' should be found in: %s" % (regex .pattern , txt_rst ))
779894
895+ # expect NotImplementedError for json output format
896+ with self .assertRaises (NotImplementedError ):
897+ avail_easyconfig_constants (output_format = 'json' )
898+
780899 def test_avail_easyconfig_templates (self ):
781900 """
782901 Test avail_easyconfig_templates to generate overview of templates that can be used in easyconfig files.
@@ -827,6 +946,10 @@ def test_avail_easyconfig_templates(self):
827946 regex = re .compile (pattern , re .M )
828947 self .assertTrue (regex .search (txt_rst ), "Pattern '%s' should be found in: %s" % (regex .pattern , txt_rst ))
829948
949+ # expect NotImplementedError for json output format
950+ with self .assertRaises (NotImplementedError ):
951+ avail_easyconfig_templates (output_format = 'json' )
952+
830953 def test_avail_toolchain_opts (self ):
831954 """
832955 Test avail_toolchain_opts to generate overview of supported toolchain options.
@@ -911,6 +1034,12 @@ def test_avail_toolchain_opts(self):
9111034 regex = re .compile (pattern , re .M )
9121035 self .assertTrue (regex .search (txt_rst ), "Pattern '%s' should be found in: %s" % (regex .pattern , txt_rst ))
9131036
1037+ # expect NotImplementedError for json output format
1038+ with self .assertRaises (NotImplementedError ):
1039+ avail_toolchain_opts ('foss' , output_format = 'json' )
1040+ with self .assertRaises (NotImplementedError ):
1041+ avail_toolchain_opts ('intel' , output_format = 'json' )
1042+
9141043 def test_mk_table (self ):
9151044 """
9161045 Tests for mk_*_table functions.
0 commit comments