[Debian-med-packaging] Bug#935680: lower-case.patch: fix to also work under autopkgtest conditions

Steve Langasek steve.langasek at canonical.com
Sun Aug 25 07:19:24 BST 2019


Package: python-schema-salad
Version: 4.5.20190815125611-2
Severity: serious
Tags: patch
Justification: blocks testing migration
User: ubuntu-devel at lists.ubuntu.com
Usertags: origin-ubuntu eoan ubuntu-patch

Hi Michael,

The autopkgtests of the latest python-schema-salad fail because
debian/patches/lower-case.patch requires the test dir to be writable, and
this is not the case when the tests are installed to the system under /usr
and the autopkgtests are run as non-root.

Attached is a patch that works around this by catching the PermissionError
exception.

Alternatively, you could work around this by adding a Restrictions: needs-root
to debian/tests/control.

Cheers,
-- 
Steve Langasek                   Give me a lever long enough and a Free OS
Debian Developer                   to set it on, and I can move the world.
Ubuntu Developer                                   https://www.debian.org/
slangasek at ubuntu.com                                     vorlon at debian.org
-------------- next part --------------
diff -Nru python-schema-salad-4.5.20190815125611/debian/patches/lower-case.patch python-schema-salad-4.5.20190815125611/debian/patches/lower-case.patch
--- python-schema-salad-4.5.20190815125611/debian/patches/lower-case.patch	2019-08-16 03:43:50.000000000 -0700
+++ python-schema-salad-4.5.20190815125611/debian/patches/lower-case.patch	2019-08-24 23:14:17.000000000 -0700
@@ -4,21 +4,24 @@
 
     only be case insensitive when needed
 
-diff --git a/schema_salad/tests/test_ref_resolver.py b/schema_salad/tests/test_ref_resolver.py
-index 04f6605..26f2f8a 100644
---- a/schema_salad/tests/test_ref_resolver.py
-+++ b/schema_salad/tests/test_ref_resolver.py
-@@ -13,6 +13,9 @@ from requests import Session
+Index: python-schema-salad-4.5.20190815125611/schema_salad/tests/test_ref_resolver.py
+===================================================================
+--- python-schema-salad-4.5.20190815125611.orig/schema_salad/tests/test_ref_resolver.py
++++ python-schema-salad-4.5.20190815125611/schema_salad/tests/test_ref_resolver.py
+@@ -13,6 +13,12 @@
  from schema_salad.ref_resolver import DefaultFetcher, Loader, file_uri
  from schema_salad.tests.util import get_data
  
 +def is_fs_case_sensitive(path):  # https://stackoverflow.com/a/36612604/1585509
-+    with tempfile.NamedTemporaryFile(prefix='TmP',dir=path) as tmp_file:
-+        return(not os.path.exists(tmp_file.name.lower()))
++    try:
++        with tempfile.NamedTemporaryFile(prefix='TmP',dir=path) as tmp_file:
++            return(not os.path.exists(tmp_file.name.lower()))
++    except PermissionError:
++        return True
  
  @pytest.fixture
  def tmp_dir_fixture(request):
-@@ -170,24 +173,27 @@ def test_import_list():
+@@ -170,24 +176,27 @@
  
  
  def test_fetch_inject_id():


More information about the Debian-med-packaging mailing list