cta-observatory / training-material

Contains training material for ctapipe bootcamp
1 stars 12 forks source link

make test in ctapipe gives failure #4

Open mdpunch opened 7 years ago

mdpunch commented 7 years ago

make test gives failures at a certain point:

ctapipe/visualization/tests/test_mpl.py::test_array_display PASSED

============================================================ FAILURES =============================================================
__________________________________________________ test_traitlets_config_to_fits __________________________________________________

    def test_traitlets_config_to_fits():
        backup = sys.argv
        full_config_name = get_path('config.json')
        sys.argv = ['test_json_2_fits.py', '--config_file='+full_config_name]
        app = MyApp()
        app.initialize()
        app.start()
>       assert(app.traitlets_config_to_fits() == True)

ctapipe/utils/tests/test_json_2_fits.py:126: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
ctapipe/utils/tests/test_json_2_fits.py:114: in traitlets_config_to_fits
    return traitlets_config_to_fits( self.config,'config_to_fits.fits',clobber=True)
ctapipe/utils/json2fits.py:42: in traitlets_config_to_fits
    hduList.writeto(fits_filename, clobber=clobber)
/scr/punch/miniconda3/envs/cta/lib/python3.5/site-packages/astropy/io/fits/hdu/hdulist.py:671: in writeto
    self.verify(option=output_verify)
/scr/punch/miniconda3/envs/cta/lib/python3.5/site-packages/astropy/io/fits/verify.py:74: in verify
    errs = self._verify(opt)
/scr/punch/miniconda3/envs/cta/lib/python3.5/site-packages/astropy/io/fits/hdu/hdulist.py:924: in _verify
    result = hdu._verify(option)
/scr/punch/miniconda3/envs/cta/lib/python3.5/site-packages/astropy/io/fits/hdu/table.py:774: in _verify
    errs = super(TableHDU, self)._verify(option=option)
/scr/punch/miniconda3/envs/cta/lib/python3.5/site-packages/astropy/io/fits/hdu/table.py:538: in _verify
    errs = super(_TableBaseHDU, self)._verify(option=option)
/scr/punch/miniconda3/envs/cta/lib/python3.5/site-packages/astropy/io/fits/hdu/base.py:1770: in _verify
    errs = super(ExtensionHDU, self)._verify(option=option)
/scr/punch/miniconda3/envs/cta/lib/python3.5/site-packages/astropy/io/fits/hdu/base.py:1208: in _verify
    errs.append(card._verify(option))
/scr/punch/miniconda3/envs/cta/lib/python3.5/site-packages/astropy/io/fits/card.py:1373: in _verify
    keyword, valuecomment = self._split()
/scr/punch/miniconda3/envs/cta/lib/python3.5/site-packages/astropy/io/fits/card.py:1087: in _split
    image = self.image
/scr/punch/miniconda3/envs/cta/lib/python3.5/site-packages/astropy/io/fits/card.py:767: in image
    self._image = self._format_image()
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

self = ('config_file', '/scr/punch/CTA/CTA_Pipelines/ctasoft/ctapipe/ctapipe-extra/datasets/config.json', '')

    def _format_image(self):
        keyword = self._format_keyword()

        value = self._format_value()
        is_commentary = keyword.strip() in self._commentary_keywords
        if is_commentary:
            comment = ''
        else:
            comment = self._format_comment()

        # equal sign string
        # by default use the standard value indicator even for HIERARCH cards;
        # later we may abbreviate it if necessary
        delimiter = VALUE_INDICATOR
        if is_commentary:
            delimiter = ''

        # put all parts together
        output = ''.join([keyword, delimiter, value, comment])

        # For HIERARCH cards we can save a bit of space if necessary by
        # removing the space between the keyword and the equals sign; I'm
        # guessing this is part of the HIEARCH card specification
        keywordvalue_length = len(keyword) + len(delimiter) + len(value)
        if (keywordvalue_length > self.length and
                keyword.startswith('HIERARCH')):
            if (keywordvalue_length == self.length + 1 and keyword[-1] == ' '):
                output = ''.join([keyword[:-1], delimiter, value, comment])
            else:
                # I guess the HIERARCH card spec is incompatible with CONTINUE
                # cards
                raise ValueError('The keyword %s with its value is too long' %
>                                self.keyword)
E               ValueError: The keyword config_file with its value is too long

/scr/punch/miniconda3/envs/cta/lib/python3.5/site-packages/astropy/io/fits/card.py:1236: ValueError
_________________________________________________________ test_jsonToFits _________________________________________________________

    def test_jsonToFits():
        backup = sys.argv
        full_config_name = get_path('config.json')
        sys.argv = ['test_json_2_fits.py', '--config_file='+full_config_name]
        app = MyApp()
        app.initialize()
        app.start()
>       assert(app.jsonToFits() == True)
E       assert <bound method MyApp.jsonToFits of <ctapipe.utils.tests.test_json_2_fits.MyApp object at 0x7f5b3753b470>>() == True
E        +  where <bound method MyApp.jsonToFits of <ctapipe.utils.tests.test_json_2_fits.MyApp object at 0x7f5b3753b470>> = <ctapipe.utils.tests.test_json_2_fits.MyApp object at 0x7f5b3753b470>.jsonToFits

ctapipe/utils/tests/test_json_2_fits.py:136: AssertionError
------------------------------------------------------ Captured stderr call -------------------------------------------------------
No such file or directory:'/scr/punch/CTA/CTA_Pipelines/ctasoft/ctapipe/ctapipe-extra/datasets/config.json'
============================================== 2 failed, 51 passed in 62.76 seconds ===============================================
Makefile:35: recipe for target 'test' failed
make: *** [test] Error 1
jacquemier commented 7 years ago

This is due to ctapipe-extra/datasets/config.json' file is missing Running the following command should remove the issue,

prompt$> make init

mdpunch commented 7 years ago

Tried that, now I get a new error:

_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

self = ('config_file', '/scr/punch/CTA/CTA_Pipelines/ctasoft/ctapipe/ctapipe-extra/datasets/config.json', '')

    def _format_image(self):
        keyword = self._format_keyword()

        value = self._format_value()
        is_commentary = keyword.strip() in self._commentary_keywords
        if is_commentary:
            comment = ''
        else:
            comment = self._format_comment()

        # equal sign string
        # by default use the standard value indicator even for HIERARCH cards;
        # later we may abbreviate it if necessary
        delimiter = VALUE_INDICATOR
        if is_commentary:
            delimiter = ''

        # put all parts together
        output = ''.join([keyword, delimiter, value, comment])

        # For HIERARCH cards we can save a bit of space if necessary by
        # removing the space between the keyword and the equals sign; I'm
        # guessing this is part of the HIEARCH card specification
        keywordvalue_length = len(keyword) + len(delimiter) + len(value)
        if (keywordvalue_length > self.length and
                keyword.startswith('HIERARCH')):
            if (keywordvalue_length == self.length + 1 and keyword[-1] == ' '):
                output = ''.join([keyword[:-1], delimiter, value, comment])
            else:
                # I guess the HIERARCH card spec is incompatible with CONTINUE
                # cards
                raise ValueError('The keyword %s with its value is too long' %
>                                self.keyword)
E               ValueError: The keyword config_file with its value is too long

/scr/punch/miniconda3/envs/cta/lib/python3.5/site-packages/astropy/io/fits/card.py:1236: ValueError
------------------------------------------------------ Captured stderr call -------------------------------------------------------
[MyApp] WARNING | Config option `another` not recognized by `MyApp`.
============================================== 1 failed, 52 passed in 37.63 seconds ===============================================
Makefile:35: recipe for target 'test' failed
make: *** [test] Error 1