Skip to content

BUG: cadc uploads doesn't close file #2538

Open
@bsipocz

Description

@bsipocz

The following doesn't close the upload file causing a warning/error. There is a testcase for it in the narrative docs, but apparently the uploads kwarg isn't covered by the tests (I'll add a test for it in #2520, albeit with an xfail).

This issue is most likely an upstream pyvo issue, but nevertheless I report here, too.

        from astroquery.cadc import Cadc
        cadc = Cadc()
        # save a few observations on a local file
        output_file = Path(tmp_path, 'my_observations.xml')
        cadc.exec_sync("SELECT TOP 3 observationID FROM caom2.Observation",
                       output_file=output_file)

        # now use them to join with the remote table
        results = cadc.exec_sync(
            "SELECT o.observationID, intent FROM caom2.Observation o JOIN "
            "tap_upload.test_upload tu ON o.observationID=tu.observationID",
            uploads={'test_upload': output_file})

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions