Commit 7a27321d by Chris Jerdonek

Only pull in 2to3-related modules when running Python 3.x.

parent e226768a
...@@ -5,14 +5,18 @@ Exposes a get_doctests() function for the project's test harness. ...@@ -5,14 +5,18 @@ Exposes a get_doctests() function for the project's test harness.
""" """
from lib2to3.main import main as lib2to3main
import doctest import doctest
import os import os
import pkgutil import pkgutil
from shutil import copyfile
import sys import sys
import traceback import traceback
if sys.version_info >= (3,):
# Then pull in modules needed for 2to3 conversion. The modules
# below are not necessarily available in older versions of Python.
from lib2to3.main import main as lib2to3main # new in Python 2.6?
from shutil import copyfile
from pystache.tests.common import PACKAGE_DIR, TEXT_DOCTEST_PATHS from pystache.tests.common import PACKAGE_DIR, TEXT_DOCTEST_PATHS
...@@ -38,8 +42,7 @@ def get_doctests(text_file_dir): ...@@ -38,8 +42,7 @@ def get_doctests(text_file_dir):
# #
paths = [os.path.normpath(os.path.join(text_file_dir, path)) for path in TEXT_DOCTEST_PATHS] paths = [os.path.normpath(os.path.join(text_file_dir, path)) for path in TEXT_DOCTEST_PATHS]
py_version = sys.version_info if sys.version_info >= (3,):
if py_version >= (3,):
paths = _convert_paths(paths) paths = _convert_paths(paths)
suites = [] suites = []
......
Markdown is supported
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