
Brief summary of the modifications: * Use six for compatibility with both Python 2 and 3; * Replace UserDict.DictMixin with collections.MutableMapping; * Fix relative imports; * Use test-requirements.txt for requirements that are common to both Python 2 and 3, and test-requirements-py{2,3}.txt for version-specific requirements; * Miscellaneous fixes. * Use a specific test_db_py3.cfg file for Python 3, that only runs tests on sqlite. Thanks to Victor Stinner who co-wrote this patch. Change-Id: Ia6dc536c39d274924c21fd5bb619e8e5721e04c4 Co-Authored-By: Victor Stinner <victor.stinner@enovance.com>
19 lines
542 B
Python
19 lines
542 B
Python
import os
|
|
import sys
|
|
|
|
from six.moves import reload_module as reload
|
|
|
|
def import_path(fullpath):
|
|
""" Import a file with full path specification. Allows one to
|
|
import from anywhere, something __import__ does not do.
|
|
"""
|
|
# http://zephyrfalcon.org/weblog/arch_d7_2002_08_31.html
|
|
path, filename = os.path.split(fullpath)
|
|
filename, ext = os.path.splitext(filename)
|
|
sys.path.append(path)
|
|
module = __import__(filename)
|
|
reload(module) # Might be out of date during tests
|
|
del sys.path[-1]
|
|
return module
|
|
|