提交 0840c24a authored 作者: Olivier Delalleau's avatar Olivier Delalleau

Added test for new OSX nvcc args to be removed

上级 686b6271
...@@ -25,16 +25,26 @@ def test_remove_python_framework_dir(): ...@@ -25,16 +25,26 @@ def test_remove_python_framework_dir():
# as otherwise it is difficult to do it properly. # as otherwise it is difficult to do it properly.
try: try:
warnings.catch_warnings warnings.catch_warnings
test_warning = True
except AttributeError: except AttributeError:
return test_warning = False
cmd.append('Frameworks/Python.framework/Versions/2.6/Python') if test_warning:
# Python 2.4 "emulation" of `with` statement. It is necessary even if this cmd.append('Frameworks/Python.framework/Versions/2.6/Python')
# code is not executed, because using `with` would result in a SyntaxError. # Python 2.4 "emulation" of `with` statement. It is necessary even if this
with_context = warnings.catch_warnings(record=True) # code is not executed, because using `with` would result in a SyntaxError.
record = with_context.__enter__() with_context = warnings.catch_warnings(record=True)
try: record = with_context.__enter__()
assert remove_python_framework_dir(cmd) == cmd[0:-3] + cmd[-2:-1] try:
assert len(record) == 1 assert remove_python_framework_dir(cmd) == cmd[0:-3] + cmd[-2:-1]
assert 'remove_python_framework_dir' in str(record[0].message) assert len(record) == 1
finally: assert 'remove_python_framework_dir' in str(record[0].message)
with_context.__exit__(None, None, None) finally:
with_context.__exit__(None, None, None)
# Now test some more typical arguments that should be caught by the regex.
for arg_to_remove in [
'/Library/Frameworks/EPD64.framework/Versions/7.1/Python',
'/Library/Frameworks/Python.framework/Versions/7.2/Python',
]:
# Make sure those arguments are removed.
assert not remove_python_framework_dir([arg_to_remove])
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论