[Debian-astro-maintainers] Bug#1012125: astroquery: Autopkgtests failure due to trying to write to /usr/lib

Simon Chopin simon.chopin at canonical.com
Tue May 31 08:46:12 BST 2022


Source: astroquery
Version: 0.4.1+dfsg-7
Followup-For: Bug #1012125
X-Debbugs-Cc: simon.chopin at canonical.com
Control: tags -1 patch

Attached is a debdiff addressing the issue
-------------- next part --------------
diff -Nru astroquery-0.4.6+dfsg/debian/changelog astroquery-0.4.6+dfsg/debian/changelog
--- astroquery-0.4.6+dfsg/debian/changelog	2022-04-30 13:31:11.000000000 +0200
+++ astroquery-0.4.6+dfsg/debian/changelog	2022-05-24 11:30:56.000000000 +0200
@@ -1,3 +1,11 @@
+astroquery (0.4.6+dfsg-2ubuntu1) kinetic; urgency=medium
+
+  * d/p/Move-tests-files-to-tmp-for-user-to-have-write-acces.patch: Move
+    temp test files to a temp dir where the user has write access.
+    (Closes: #1012125, LP: #1976295)
+
+ -- Alexandre Ghiti <alexandre.ghiti at canonical.com>  Tue, 24 May 2022 11:30:56 +0200
+
 astroquery (0.4.6+dfsg-2) unstable; urgency=medium
 
   * Add missing autopkgtest dependencies (Closes: #1010195)
diff -Nru astroquery-0.4.6+dfsg/debian/patches/Move-tests-files-to-tmp-for-user-to-have-write-acces.patch astroquery-0.4.6+dfsg/debian/patches/Move-tests-files-to-tmp-for-user-to-have-write-acces.patch
--- astroquery-0.4.6+dfsg/debian/patches/Move-tests-files-to-tmp-for-user-to-have-write-acces.patch	1970-01-01 01:00:00.000000000 +0100
+++ astroquery-0.4.6+dfsg/debian/patches/Move-tests-files-to-tmp-for-user-to-have-write-acces.patch	2022-05-24 11:30:56.000000000 +0200
@@ -0,0 +1,50 @@
+From 8dc33bd53dfd30117940a436b626311660a8e0c7 Mon Sep 17 00:00:00 2001
+From: Alexandre Ghiti <alexandre.ghiti at canonical.com>
+Date: Tue, 24 May 2022 10:54:00 +0200
+Subject: [PATCH] Move tests files to tmp for user to have write access
+
+---
+ astroquery/esa/hubble/tests/test_esa_hubble.py | 13 +++++++++----
+ 1 file changed, 9 insertions(+), 4 deletions(-)
+
+diff --git a/astroquery/esa/hubble/tests/test_esa_hubble.py b/astroquery/esa/hubble/tests/test_esa_hubble.py
+index 107bff8..6e08385 100644
+--- a/astroquery/esa/hubble/tests/test_esa_hubble.py
++++ b/astroquery/esa/hubble/tests/test_esa_hubble.py
+@@ -24,6 +24,7 @@ from astropy import coordinates
+ from unittest.mock import MagicMock
+ from astropy.table.table import Table
+ import shutil
++import tempfile
+ 
+ 
+ def data_path(filename):
+@@ -35,8 +36,10 @@ def get_mockreturn(method, request, url, params, *args, **kwargs):
+     file = 'm31.vot'
+     if 'OBSERVATION_ID' in params:
+         file = params['OBSERVATION_ID'] + ".vot"
+-    response = data_path(file)
+-    shutil.copy(response + '.test', response)
++    initial_response = data_path(file)
++    tmp_dir = tempfile.mkdtemp()
++    response = os.path.join(tmp_dir, file)
++    shutil.copy(initial_response + '.test', response)
+     return response
+ 
+ 
+@@ -54,8 +57,10 @@ def get_cone_mockreturn(method, request, url, params, *args, **kwargs):
+     file = data_path('cone_search_m31_5.vot')
+     if 'OBSERVATION_ID' in params:
+         file = params['OBSERVATION_ID'] + ".vot"
+-    response = data_path(file)
+-    shutil.copy(response + '.test', response)
++    filename = os.path.basename(file)
++    tmp_dir = tempfile.mkdtemp()
++    response = os.path.join(tmp_dir, filename)
++    shutil.copy(file + '.test', response)
+     return response
+ 
+ 
+-- 
+2.34.1
+
diff -Nru astroquery-0.4.6+dfsg/debian/patches/series astroquery-0.4.6+dfsg/debian/patches/series
--- astroquery-0.4.6+dfsg/debian/patches/series	2022-04-09 17:50:45.000000000 +0200
+++ astroquery-0.4.6+dfsg/debian/patches/series	2022-05-24 11:30:56.000000000 +0200
@@ -2,3 +2,4 @@
 no_auto_use_astropy_helpers.patch
 nvas_nonfree_imfits_test.patch
 fix_duplicate_examples_section
+Move-tests-files-to-tmp-for-user-to-have-write-acces.patch


More information about the Debian-astro-maintainers mailing list