summaryrefslogtreecommitdiff
path: root/setuptools/tests/test_glibc.py
diff options
context:
space:
mode:
authorJeremy Bowman <jbowman@edx.org>2018-05-16 18:00:44 -0400
committerJeremy Bowman <jbowman@edx.org>2018-05-16 18:08:53 -0400
commit736ed24e9dbf4528f7b3aa531d8d418b648f98a6 (patch)
tree4a1b3dfe25deb4bdcf16813be0f10eeb684eded5 /setuptools/tests/test_glibc.py
parent1252d1b3b34261acd6c8051c4fe97f206a7118b7 (diff)
downloadpython-setuptools-git-736ed24e9dbf4528f7b3aa531d8d418b648f98a6.tar.gz
Add tests for PEP 425 support
Diffstat (limited to 'setuptools/tests/test_glibc.py')
-rw-r--r--setuptools/tests/test_glibc.py37
1 files changed, 37 insertions, 0 deletions
diff --git a/setuptools/tests/test_glibc.py b/setuptools/tests/test_glibc.py
new file mode 100644
index 00000000..9cb97964
--- /dev/null
+++ b/setuptools/tests/test_glibc.py
@@ -0,0 +1,37 @@
+import warnings
+
+from setuptools.glibc import check_glibc_version
+
+
+class TestGlibc(object):
+ def test_manylinux1_check_glibc_version(self):
+ """
+ Test that the check_glibc_version function is robust against weird
+ glibc version strings.
+ """
+ for two_twenty in ["2.20",
+ # used by "linaro glibc", see gh-3588
+ "2.20-2014.11",
+ # weird possibilities that I just made up
+ "2.20+dev",
+ "2.20-custom",
+ "2.20.1",
+ ]:
+ assert check_glibc_version(two_twenty, 2, 15)
+ assert check_glibc_version(two_twenty, 2, 20)
+ assert not check_glibc_version(two_twenty, 2, 21)
+ assert not check_glibc_version(two_twenty, 3, 15)
+ assert not check_glibc_version(two_twenty, 1, 15)
+
+ # For strings that we just can't parse at all, we should warn and
+ # return false
+ for bad_string in ["asdf", "", "foo.bar"]:
+ with warnings.catch_warnings(record=True) as ws:
+ warnings.filterwarnings("always")
+ assert not check_glibc_version(bad_string, 2, 5)
+ for w in ws:
+ if "Expected glibc version with" in str(w.message):
+ break
+ else:
+ # Didn't find the warning we were expecting
+ assert False