spacetelescope/pysiaf

Failure in test_write_jwst_siaf_xlsx and test_write_jwst_siaf_xml

Hellseher opened this issue · 0 comments

Hi,

Wile preparing this project for Guix I've faced with 2 test failures:

__________________________ test_write_jwst_siaf_xlsx ___________________________
[gw10] linux -- Python 3.10.7 /gnu/store/jh59fh48mcffyz5wmsjj0p96xkkflbz0-python-wrapper-3.10.7/bin/python

tmpdir = local('/tmp/guix-build-python-pysiaf-0.22.0.drv-0/pytest-of-nixbld/pytest-0/popen-gw10/test_write_jwst_siaf_xlsx0')

    @pytest.mark.skipif(ON_GITHUB_ACTIONS, reason="Don't want to write and remove dirs on GHA Server")
    def test_write_jwst_siaf_xlsx(tmpdir):
        """Basic test to check that JWST SIAF XLSX file is written out"""

        aperture = JwstAperture()
        aperture.AperName = 'MIRIM_FULL_OSS'
        aperture.InstrName = 'MIRI'
        aperture.VIdlParity = 1
        aperture.DetSciYAngle = 0
        aperture.DetSciParity = 1
        aperture_dict = {
            'MIRIM_FULL_OSS': aperture
        }
        aperture_collection = ApertureCollection(aperture_dict)
        filename = os.path.join(tmpdir, 'test_miri.xlsx')

>       write_jwst_siaf(aperture_collection, filename=filename,
                        file_format='xlsx', verbose=False)

pysiaf/tests/test_iando.py:62:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

aperture_collection = <pysiaf.siaf.ApertureCollection object at 0x7fff60c37460>                                                                                                                                                                                          [92/1868]
filename = '/tmp/guix-build-python-pysiaf-0.22.0.drv-0/pytest-of-nixbld/pytest-0/popen-gw10/test_write_jwst_siaf_xlsx0/test_miri.xlsx'
basepath = None, label = None, file_format = ['xlsx'], verbose = False

    def write_jwst_siaf(aperture_collection, filename=None, basepath=None, label=None,
                        file_format='xml', verbose=True):
        """Write the content of aperture_collection into xml and xlsx files that are PRD-compliant.

        Parameters
        ----------
        aperture_collection : ApertureCollection
            dictionary of apertures
        filename : str
            The file name and path if you do not wish to use the default naming
        basepath : str
            If you wish to use the default naming, basepath allows you to set the path where the file will be saved
        label : str
            Append default file name ("INSTR_SIAF") with this string
        file_format : str list
            one of ['xml', 'xlsx', 'csv', and formats supported by astropy Table.write]
        verbose

        Returns
        -------
        filenames : list
            list of the filenames written out

        .. todo:: test support of astropy Table.write formats (FITS not working)


        """
        if type(file_format) == str:
            file_format = [file_format]

        aperture_names = np.array([key for key in aperture_collection.apertures.keys()])
        instrument = aperture_collection.apertures[aperture_names[0]].InstrName

        if instrument == 'NIRCAM':
            instrument = 'NIRCam'
        elif instrument == 'NIRSPEC':
            instrument = 'NIRSpec'

        if (filename is not None) and (len(list(file_format)) != 1):
            raise RuntimeError('When filename is specified, only one output format is supported')

        if label is not None:
            name_seed = instrument + '_SIAF_{}'.format(label)
        else:
            name_seed = instrument + '_SIAF'

        filenames = []
        # hostname = os.uname()[1]
>       username = os.getlogin()
E       OSError: [Errno 6] No such device or address

pysiaf/iando/write.py:84: OSError
___________________________ test_write_jwst_siaf_xml ___________________________
[gw9] linux -- Python 3.10.7 /gnu/store/jh59fh48mcffyz5wmsjj0p96xkkflbz0-python-wrapper-3.10.7/bin/python

tmpdir = local('/tmp/guix-build-python-pysiaf-0.22.0.drv-0/pytest-of-nixbld/pytest-0/popen-gw9/test_write_jwst_siaf_xml0')

    @pytest.mark.skipif(ON_GITHUB_ACTIONS, reason="Don't want to write and remove dirs on GHA Server")
    def test_write_jwst_siaf_xml(tmpdir):
        """Basic test to check that JWST SIAF XML file is written out"""

        aperture = JwstAperture()
        aperture.AperName = 'MIRIM_FULL_OSS'
        aperture.InstrName = 'MIRI'
        aperture.VIdlParity = 1
        aperture.DetSciYAngle = 0
        aperture.DetSciParity = 1
        aperture_dict = {
            'MIRIM_FULL_OSS': aperture
        }
        aperture_collection = ApertureCollection(aperture_dict)
        filename = os.path.join(tmpdir, 'test_miri.xml')

>       write_jwst_siaf(aperture_collection, filename=filename,
                        file_format='xml', verbose=False)

pysiaf/tests/test_iando.py:37:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

aperture_collection = <pysiaf.siaf.ApertureCollection object at 0x7fff60c23460>
filename = '/tmp/guix-build-python-pysiaf-0.22.0.drv-0/pytest-of-nixbld/pytest-0/popen-gw9/test_write_jwst_siaf_xml0/test_miri.xml'
basepath = None, label = None, file_format = ['xml'], verbose = False

    def write_jwst_siaf(aperture_collection, filename=None, basepath=None, label=None,
                        file_format='xml', verbose=True):
        """Write the content of aperture_collection into xml and xlsx files that are PRD-compliant.

        Parameters
        ----------
        aperture_collection : ApertureCollection
            dictionary of apertures
        filename : str
            The file name and path if you do not wish to use the default naming
        basepath : str
            If you wish to use the default naming, basepath allows you to set the path where the file will be saved
        label : str
            Append default file name ("INSTR_SIAF") with this string
        file_format : str list
            one of ['xml', 'xlsx', 'csv', and formats supported by astropy Table.write]
        verbose

        Returns
        -------
        filenames : list
            list of the filenames written out

        .. todo:: test support of astropy Table.write formats (FITS not working)


        """
        if type(file_format) == str:
            file_format = [file_format]

        aperture_names = np.array([key for key in aperture_collection.apertures.keys()])
        instrument = aperture_collection.apertures[aperture_names[0]].InstrName

        if instrument == 'NIRCAM':
            instrument = 'NIRCam'
        elif instrument == 'NIRSPEC':
            instrument = 'NIRSpec'

        if (filename is not None) and (len(list(file_format)) != 1):
            raise RuntimeError('When filename is specified, only one output format is supported')

        if label is not None:
            name_seed = instrument + '_SIAF_{}'.format(label)
        else:
            name_seed = instrument + '_SIAF'

        filenames = []
        # hostname = os.uname()[1]
>       username = os.getlogin()
E       OSError: [Errno 6] No such device or address

pysiaf/iando/write.py:84: OSError
=========================== short test summary info ============================
FAILED pysiaf/tests/test_iando.py::test_write_jwst_siaf_xlsx - OSError: [Errn...
FAILED pysiaf/tests/test_iando.py::test_write_jwst_siaf_xml - OSError: [Errno...
================= 2 failed, 30 passed, 128 warnings in 18.76s ===================

pysiaf - soruce was taken from PyPI archive https://files.pythonhosted.org/packages/93/4c/56ae214918ca8fd15073ef7a32cedab5b0b6edcd622016669d15664f5174/pysiaf-0.22.0.tar.gz

Inputs from the first level:

  • python-pytest@7.1.3
  • python-pytest-xdist@2.5.0
  • python-astropy@6.0.0
  • python-lxml@4.9.1
  • python-matplotlib@3.8.2
  • python-numpy@1.23.2
  • python-numpydoc@1.5.0
  • python-openpyxl@3.0.9
  • python-requests@2.28.1
  • python-scipy@1.12.0