astropy / astropy/astroquery

BUG: cadc uploads doesn't close file

Open
#2,538 1 comment 0 reactions 0 assignees View on GitHub
bug cadc
Dominant language
Python
Stars
791
Forks
451
Avg merge
1d 3h
Merged PRs (30d)
4

Description

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})
```

Contributor guide

Open the contributing guide

Research direction

Start with the CADC upload path exercised by Cadc.exec_sync(..., uploads=...), then compare it with the upload-file handling described by the narrative-doc testcase. Reproduce the warning or error using the example and add coverage alongside the uploads test planned in #2520; done means the uploaded file is closed without the regression and the test passes.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
api
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.