[med-svn] [Git][med-team/python-schema-salad][master] better fix for case sensitive test
Michael R. Crusoe
gitlab at salsa.debian.org
Fri Aug 16 11:47:55 BST 2019
Michael R. Crusoe pushed to branch master at Debian Med / python-schema-salad
Commits:
11efbd68 by Michael R. Crusoe at 2019-08-16T10:46:45Z
better fix for case sensitive test
- - - - -
2 changed files:
- debian/changelog
- debian/patches/lower-case.patch
Changes:
=====================================
debian/changelog
=====================================
@@ -1,3 +1,9 @@
+python-schema-salad (4.5.20190815125611-2) unstable; urgency=medium
+
+ * debian/patches/lower-case.patch: better fix
+
+ -- Michael R. Crusoe <michael.crusoe at gmail.com> Fri, 16 Aug 2019 12:43:50 +0200
+
python-schema-salad (4.5.20190815125611-1) unstable; urgency=medium
* New upstream version
=====================================
debian/patches/lower-case.patch
=====================================
@@ -1,33 +1,55 @@
-commit 1c0f3ca43a957ff137fe3683c4e7d90964f5f71e
+commit b88e74f8c4c041f1d4d15c56193b07dcddb95400
Author: Michael R. Crusoe <michael.crusoe at gmail.com>
-Date: Fri Aug 16 11:44:59 2019 +0200
+Date: Fri Aug 16 12:25:07 2019 +0200
- do not lower case the path
+ 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..2476ef8 100644
+index 04f6605..26f2f8a 100644
--- a/schema_salad/tests/test_ref_resolver.py
+++ b/schema_salad/tests/test_ref_resolver.py
-@@ -171,19 +171,19 @@ def test_import_list():
+@@ -13,6 +13,9 @@ from requests import Session
+ 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()))
+
+ @pytest.fixture
+ def tmp_dir_fixture(request):
+@@ -170,24 +173,27 @@ def test_import_list():
+
def test_fetch_inject_id():
++ lower = lambda s : s.lower()
++ if is_fs_case_sensitive(os.path.dirname(get_data("schema_salad/tests/inject-id1.yml"))):
++ lower = lambda a : a
l1 = Loader({"id": "@id"})
- furi1 = file_uri(get_data("schema_salad/tests/inject-id1.yml")).lower()
+ furi1 = file_uri(get_data("schema_salad/tests/inject-id1.yml"))
r1, _ = l1.resolve_ref(furi1)
assert {"id": furi1 + "#foo", "bar": "baz"} == r1
- assert [furi1, furi1 + "#foo"] == sorted(list(k.lower() for k in l1.idx.keys()))
+- assert [furi1, furi1 + "#foo"] == sorted(list(k.lower() for k in l1.idx.keys()))
++ assert [lower(furi1), furi1 + "#foo"] == sorted(list(lower(k) for k in l1.idx.keys()))
l2 = Loader({"id": "@id"})
- furi2 = file_uri(get_data("schema_salad/tests/inject-id2.yml")).lower()
+ furi2 = file_uri(get_data("schema_salad/tests/inject-id2.yml"))
r2, _ = l2.resolve_ref(furi2)
assert {"id": furi2, "bar": "baz"} == r2
- assert [furi2] == sorted(list(k.lower() for k in l2.idx.keys()))
+- assert [furi2] == sorted(list(k.lower() for k in l2.idx.keys()))
++ assert [lower(furi2)] == sorted(list(lower(k) for k in l2.idx.keys()))
l3 = Loader({"id": "@id"})
- furi3 = file_uri(get_data("schema_salad/tests/inject-id3.yml")).lower()
+ furi3 = file_uri(get_data("schema_salad/tests/inject-id3.yml"))
r3, _ = l3.resolve_ref(furi3)
assert {"id": "http://example.com", "bar": "baz"} == r3
- assert [furi3, "http://example.com"] == sorted(
+- assert [furi3, "http://example.com"] == sorted(
+- list(k.lower() for k in l3.idx.keys())
++ assert [lower(furi3), "http://example.com"] == sorted(
++ list(lower(k) for k in l3.idx.keys())
+ )
+
+
View it on GitLab: https://salsa.debian.org/med-team/python-schema-salad/commit/11efbd68c101bbf754ad59a1de0afd341d65f9b7
--
View it on GitLab: https://salsa.debian.org/med-team/python-schema-salad/commit/11efbd68c101bbf754ad59a1de0afd341d65f9b7
You're receiving this email because of your account on salsa.debian.org.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://alioth-lists.debian.net/pipermail/debian-med-commit/attachments/20190816/f8a9feb7/attachment-0001.html>
More information about the debian-med-commit
mailing list