Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
S
setuptools
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Jérome Perrin
setuptools
Commits
7068f1d4
Commit
7068f1d4
authored
Jun 03, 2018
by
Jason R. Coombs
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Split test into two and parameterize
parent
68f2ffd0
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
40 additions
and
27 deletions
+40
-27
setuptools/tests/test_glibc.py
setuptools/tests/test_glibc.py
+40
-27
No files found.
setuptools/tests/test_glibc.py
View file @
7068f1d4
import
warnings
import
pytest
from
setuptools.glibc
import
check_glibc_version
@
pytest
.
fixture
(
params
=
[
"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"
,
])
def
two_twenty
(
request
):
return
request
.
param
@
pytest
.
fixture
(
params
=
[
"asdf"
,
""
,
"foo.bar"
])
def
bad_string
(
request
):
return
request
.
param
class
TestGlibc
(
object
):
def
test_manylinux1_check_glibc_version
(
self
):
def
test_manylinux1_check_glibc_version
(
self
,
two_twenty
):
"""
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
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
)
def
test_bad_versions
(
self
,
bad_string
):
"""
For unparseable strings, warn and return False
"""
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
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment