Skip to content

Commit e79572c

Browse files
committed
Test that saving async Tap jobs respects verbose
The added test reveals that for async jobs the `astroquery/utils/tap/model/job.Job.save_results()` method prints messages about having saved the results regardless of the `verbose` setting.
1 parent bb92dd1 commit e79572c

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

astroquery/utils/tap/model/tests/test_job.py

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ def test_job_basic():
3535
job.get_results()
3636

3737

38-
def test_job_get_results():
38+
def test_job_get_results(capsys, tmpdir):
3939
job = Job(async_job=True)
4040
jobid = "12345"
4141
outputFormat = "votable"
@@ -82,6 +82,14 @@ def test_job_get_results():
8282
if cn not in res.colnames:
8383
pytest.fail(f"{cn} column name not found: {res.colnames}")
8484

85+
# Regression test for #2299; messages were printed even with `verbose=False`
86+
capsys.readouterr()
87+
job._Job__resultInMemory = False
88+
job.save_results(verbose=False)
89+
assert 'Saving results to:' not in capsys.readouterr().out
90+
job.save_results(verbose=True)
91+
assert 'Saving results to:' in capsys.readouterr().out
92+
8593

8694
def test_job_phase():
8795
job = Job(async_job=True)

0 commit comments

Comments
 (0)