Commit c25b7946 authored by Denis Laxalde's avatar Denis Laxalde
Browse files

[devtools] Make dependency on backports.tempfile (Python2) optional

The package may not be available in all systems (e.g. no Debian package exist
at the moment), and we should not crash with ImportError when importing
testlib from client code. Follow up on a6dc650bc230 where the dependency was
introduced.
parent 18e7b9829471
......@@ -57,7 +57,11 @@ if sys.version_info[:2] < (3, 4):
from unittest2 import TestCase
if not hasattr(TestCase, 'subTest'):
raise ImportError('no subTest support in available unittest2')
from backports.tempfile import TemporaryDirectory # noqa
try:
from backports.tempfile import TemporaryDirectory # noqa
except ImportError:
# backports.tempfile not available
TemporaryDirectory = None
else:
from unittest import TestCase
from tempfile import TemporaryDirectory # noqa
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment