Skip to content

TST: 2 tests fail for mivot #701

Description

@yurivict
============================================================================== FAILURES ===============================================================================
_________________________________________________________________________ test_all_properties _________________________________________________________________________

    @pytest.mark.usefixtures("mocked_fps_grvs", "mocked_fps_grp")
    @pytest.mark.skipif(not check_astropy_version(), reason="need astropy 6+")
    def test_all_properties():
        votable_filename = get_pkg_data_filename("data/test.mango_annoter.xml")
    
        votable = parse(votable_filename)
        builder = InstancesFromModels(votable, dmid="DR3Name")
        # pylint: disable=E501
        builder.add_query_origin(
            {"service_protocol": "ASU",
              "request_date": "2024-03-21T15:16:08",
              "request": ("https://vizier.cds.unistra.fr/viz-bin/votable?-oc.form=dec&-out.max=5&"
                          "-out.add=_r&-out.add=_RAJ,_DEJ&-sort=_r&-c.eq=J2000&-c.r=  2&"
                          "-c.u=arcmin&-c.geom=r&-source=I/355/gaiadr3&-order=I&"
                          "-out.orig=standard&-out=DR3Name&-out=RA_ICRS&-out=DE_ICRS&"
                          "-out=Source&-out=e_RA_ICRS&-out=e_DE_ICRS&-out=Plx&"
                          "-out=e_Plx&-out=PM&-out=pmRA&-out=e_pmRA&-out=pmDE&"
                          "-out=e_pmDE&-out=RADEcor&-out=RAPlxcor&-out=RApmRAcor&"
                          "-out=RApmDEcor&-out=DEPlxcor&-out=DEpmRAcor&-out=DEpmDEcor&"
                          "-out=PlxpmRAcor&-out=PlxpmDEcor&-out=pmRApmDEcor&-out=RV&"
                          "-out=e_RV&-out=Vbroad&-out=GRVSmag&-out=QSO&-out=Gal&-out=NSS&"
                          "-out=XPcont&-out=XPsamp&-out=RVS&-out=EpochPh&-out=EpochRV&"
                          "-out=MCMCGSP&-out=MCMCMSC&-out=And&-out=Teff&-out=logg&"
                          "-out=[Fe/H]&-out=Dist&-out=A0&-out=HIP&-out=PS1&-out=SDSS13&"
                          "-out=SKYM2&-out=TYC2&-out=URAT1&-out=AllWISE&-out=APASS9&"
                          "-out=GSC23&-out=RAVE5&-out=2MASS&-out=RAVE6&-out=RAJ2000&"
                          "-out=DEJ2000&"),
              "contact": "cds-question@unistra.fr",
              "server_software": "7.33.3",
              "publisher": "CDS",
              "dataOrigin": [{"ivoid": "ivo://cds.vizier/i/355",
                             "creators": ["Gaia collaboration"],
                             "cites": "bibcode:2022yCat.1355....0G, ""doi:10.26093/cds/vizier.1355",
                             "original_date": "2022",
                             "reference_url": "https://cdsarc.cds.unistra.fr/viz-bin/cat/I/355",
                             "rights_uri": "https://cds.unistra.fr/vizier-org/licences_vizier.html",
                             "articles": [{"identifier": "doi:10.1051/0004-6361/202039657e]",
                                           "editor": "A&A"}]
                             }]
              })
        add_color(builder)
        add_photometry(builder)
        add_epoch_positon(builder)
>       builder.pack_into_votable()

pyvo/mivot/tests/test_mango_annoter.py:155: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
pyvo/mivot/writer/instances_from_models.py:721: in pack_into_votable
    self._annotation.build_mivot_block()
pyvo/utils/prototype.py:150: in wrapper
    return function(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^
pyvo/mivot/writer/annotations.py:196: in build_mivot_block
    self.check_xml()
pyvo/utils/prototype.py:150: in wrapper
    return function(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^
pyvo/mivot/writer/annotations.py:306: in check_xml
    schema = xmlschema.XMLSchema11(os.path.dirname(__file__) + "/mivot-v1.xsd")
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
/usr/local/lib/python3.11/site-packages/xmlschema/validators/schemas.py:481: in __init__
    self.maps.loader.load_declared_schemas(self)
/usr/local/lib/python3.11/site-packages/xmlschema/loaders.py:149: in load_declared_schemas
    self.import_namespace(schema, namespace, url)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

self = <xmlschema.loaders.SchemaLoader object at 0x64f97b7d130>, schema = XMLSchema11(name='mivot-v1.xsd', namespace='http://www.ivoa.net/xml/mivot')
namespace = 'http://www.ivoa.net/xml/VOTable/v1.3', location = 'http://www.ivoa.net/xml/VOTable/v1.3'

    def import_namespace(self, schema: SchemaType,
                         namespace: str,
                         location: Optional[str] = None) -> None:
        import_error: Optional[Exception] = None
        locations = self.get_locations(namespace, location)
    
        for url in locations:
            try:
                logger.info("Import namespace %r from %r", namespace, url)
                self.import_schema(schema, namespace, url, schema.base_url)
            except (OSError, XMLResourceBlocked, XMLResourceForbidden) as err:
                # It's not an error if the location access fails (ref. section 4.2.6.2):
                #   https://www.w3.org/TR/2012/REC-xmlschema11-1-20120405/#composition-schemaImport
                #
                # Also consider block or defuse of XML data as a location access fail.
                self.missing_locations.add(url)
                logger.debug('%s', err)
                if import_error is None:
                    import_error = err
            except (XMLSchemaParseError, XMLSchemaTypeError, XMLResourceParseError) as err:
                if namespace:
                    msg = _("import of namespace {!r} failed: {}").format(namespace, err)
                else:
                    msg = _("import of chameleon schema failed: {}").format(err)
    
                if isinstance(err, (XMLSchemaParseError, XMLResourceParseError)):
                    schema.parse_error(msg)
                else:
                    raise type(err)(msg)
    
            except XMLSchemaValueError as err:
                schema.parse_error(err)
            else:
                logger.info("Namespace %r imported from %r", namespace, url)
                break
        else:
            if import_error is not None:
                msg = _("Import of namespace {!r} from {!r} failed: {}.")
                schema.warnings.append(msg.format(namespace, locations, str(import_error)))
>               warnings.warn(schema.warnings[-1], XMLSchemaImportWarning, stacklevel=4)
E               xmlschema.validators.exceptions.XMLSchemaImportWarning: Import of namespace 'http://www.ivoa.net/xml/VOTable/v1.3' from ['http://www.ivoa.net/xml/VOTable/v1.3'] failed: can't access to resource 'http://www.ivoa.net/xml/VOTable/v1.3': An attempt was made to connect to the internet by a test that was not marked `remote_data`. The requested host was: www.ivoa.net.

/usr/local/lib/python3.11/site-packages/xmlschema/loaders.py:244: XMLSchemaImportWarning
-------------------------------------------------------------------------- Captured log call --------------------------------------------------------------------------
WARNING  root:instances_from_models.py:210 An instance with dmid=GAIA_GAIA3_Grvs_AB has already been stored in GLOBALS: skip
WARNING  root:instances_from_models.py:77 Ref frame spaceRefFrame is not in ['eq_FK4', 'FK4', 'eq_FK5', 'FK5', 'ICRS', 'GALACTIC', 'SUPER_GALACTIC', 'ECLIPTIC'], make sure there is no typo
WARNING  root:instances_from_models.py:77 Ref frame refPosition is not in ['BARYCENTER', 'GEOCENTER', 'TOPOCENTER'], make sure there is no typo
_________________________________________________________________ test_extraction_from_votable_header _________________________________________________________________

    @pytest.mark.skipif(not check_astropy_version(), reason="need astropy 6+")
    def test_extraction_from_votable_header():
        """ test that the automatic mapping extraction is well connected with the annoter
        """
        votable_filename = get_pkg_data_filename("data/test.header_extraction.1.xml")
    
        votable = parse(votable_filename)
        builder = InstancesFromModels(votable, dmid="URAT1")
        builder.extract_frames()
        builder.extract_data_origin()
        epoch_position_mapping = builder.extract_epoch_position_parameters()
        builder.add_mango_epoch_position(**epoch_position_mapping)
>       builder.pack_into_votable()

pyvo/mivot/tests/test_mango_annoter.py:174: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
pyvo/mivot/writer/instances_from_models.py:721: in pack_into_votable
    self._annotation.build_mivot_block()
pyvo/utils/prototype.py:150: in wrapper
    return function(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^
pyvo/mivot/writer/annotations.py:196: in build_mivot_block
    self.check_xml()
pyvo/utils/prototype.py:150: in wrapper
    return function(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^
pyvo/mivot/writer/annotations.py:306: in check_xml
    schema = xmlschema.XMLSchema11(os.path.dirname(__file__) + "/mivot-v1.xsd")
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
/usr/local/lib/python3.11/site-packages/xmlschema/validators/schemas.py:481: in __init__
    self.maps.loader.load_declared_schemas(self)
/usr/local/lib/python3.11/site-packages/xmlschema/loaders.py:149: in load_declared_schemas
    self.import_namespace(schema, namespace, url)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

self = <xmlschema.loaders.SchemaLoader object at 0x64f97b7c820>, schema = XMLSchema11(name='mivot-v1.xsd', namespace='http://www.ivoa.net/xml/mivot')
namespace = 'http://www.ivoa.net/xml/VOTable/v1.3', location = 'http://www.ivoa.net/xml/VOTable/v1.3'

    def import_namespace(self, schema: SchemaType,
                         namespace: str,
                         location: Optional[str] = None) -> None:
        import_error: Optional[Exception] = None
        locations = self.get_locations(namespace, location)
    
        for url in locations:
            try:
                logger.info("Import namespace %r from %r", namespace, url)
                self.import_schema(schema, namespace, url, schema.base_url)
            except (OSError, XMLResourceBlocked, XMLResourceForbidden) as err:
                # It's not an error if the location access fails (ref. section 4.2.6.2):
                #   https://www.w3.org/TR/2012/REC-xmlschema11-1-20120405/#composition-schemaImport
                #
                # Also consider block or defuse of XML data as a location access fail.
                self.missing_locations.add(url)
                logger.debug('%s', err)
                if import_error is None:
                    import_error = err
            except (XMLSchemaParseError, XMLSchemaTypeError, XMLResourceParseError) as err:
                if namespace:
                    msg = _("import of namespace {!r} failed: {}").format(namespace, err)
                else:
                    msg = _("import of chameleon schema failed: {}").format(err)
    
                if isinstance(err, (XMLSchemaParseError, XMLResourceParseError)):
                    schema.parse_error(msg)
                else:
                    raise type(err)(msg)
    
            except XMLSchemaValueError as err:
                schema.parse_error(err)
            else:
                logger.info("Namespace %r imported from %r", namespace, url)
                break
        else:
            if import_error is not None:
                msg = _("Import of namespace {!r} from {!r} failed: {}.")
                schema.warnings.append(msg.format(namespace, locations, str(import_error)))
>               warnings.warn(schema.warnings[-1], XMLSchemaImportWarning, stacklevel=4)
E               xmlschema.validators.exceptions.XMLSchemaImportWarning: Import of namespace 'http://www.ivoa.net/xml/VOTable/v1.3' from ['http://www.ivoa.net/xml/VOTable/v1.3'] failed: can't access to resource 'http://www.ivoa.net/xml/VOTable/v1.3': An attempt was made to connect to the internet by a test that was not marked `remote_data`. The requested host was: www.ivoa.net.

/usr/local/lib/python3.11/site-packages/xmlschema/loaders.py:244: XMLSchemaImportWarning
-------------------------------------------------------------------------- Captured log call --------------------------------------------------------------------------
WARNING  root:instances_from_models.py:302 A spaceSys instance with dmid=_spaceframe_ICRS_BARYCENTER has already been stored in GLOBALS: skip
WARNING  root:instances_from_models.py:302 A spaceSys instance with dmid=_spaceframe_eq_FK5_J2000_BARYCENTER has already been stored in GLOBALS: skip
======================================================================= short test summary info =======================================================================
SKIPPED [63] ../../../../../local/lib/python3.11/site-packages/pytest_remotedata/plugin.py:81: need --remote-data option to run
======================================================== 2 failed, 398 passed, 63 skipped, 1 xfailed in 10.04s ========================================================
*** Error code 1

Version: 1.7
Python-3.11
FreeBSd 14.3

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions