Files
RustPython/tests/snippets/import.py
Daniel Watkins da34b86a9c Implement PYTHONPATH
This modifies the import logic to use sys.path, and uses PYTHONPATH to
generate the initial contents of sys.path.
2018-08-24 22:55:30 -04:00

28 lines
723 B
Python

import import_target, import_target as aliased
from import_target import func, other_func
from import_target import func as aliased_func, other_func as aliased_other_func
assert import_target.X == import_target.func()
assert import_target.X == func()
assert import_target.Y == other_func()
assert import_target.X == aliased.X
assert import_target.Y == aliased.Y
assert import_target.X == aliased_func()
assert import_target.Y == aliased_other_func()
# TODO: Once we can determine current directory, use that to construct this
# path:
#import sys
#sys.path.append("snippets/import_directory")
#import nested_target
#try:
# X
#except NameError:
# pass
#else:
# raise AssertionError('X should not be imported')