forked from pool/python-testtools
26 lines
754 B
Diff
26 lines
754 B
Diff
![]() |
--- a/testtools/tests/test_compat.py
|
||
|
+++ b/testtools/tests/test_compat.py
|
||
|
@@ -3,7 +3,10 @@
|
||
|
"""Tests for miscellaneous compatibility functions"""
|
||
|
|
||
|
import io
|
||
|
-import linecache2 as linecache
|
||
|
+try:
|
||
|
+ import linecache2 as linecache
|
||
|
+except ImportError:
|
||
|
+ import linecache
|
||
|
import os
|
||
|
import sys
|
||
|
import tempfile
|
||
|
--- a/testtools/compat.py
|
||
|
+++ b/testtools/compat.py
|
||
|
@@ -31,7 +31,7 @@ from extras import try_import, try_impor
|
||
|
BytesIO = try_imports(['StringIO.StringIO', 'io.BytesIO'])
|
||
|
StringIO = try_imports(['StringIO.StringIO', 'io.StringIO'])
|
||
|
# To let setup.py work, make this a conditional import.
|
||
|
-linecache = try_import('linecache2')
|
||
|
+linecache = try_imports(['linecache2', 'linecache'])
|
||
|
|
||
|
try:
|
||
|
from testtools import _compat2x as _compat
|