| 1 |
import sys |
| 2 |
sys.path.append(sys.argv[1]) |
| 3 |
|
| 4 |
# import compiled python module depending on version of python we are running with |
| 5 |
if sys.version_info[0] == 2: |
| 6 |
import python2_module |
| 7 |
|
| 8 |
if sys.version_info[0] == 3: |
| 9 |
import python3_module |
| 10 |
|
| 11 |
|
| 12 |
def run(): |
| 13 |
msg = 'howdy' |
| 14 |
if sys.version_info[0] == 2: |
| 15 |
w = python2_module.World() |
| 16 |
|
| 17 |
if sys.version_info[0] == 3: |
| 18 |
w = python3_module.World() |
| 19 |
|
| 20 |
w.set(msg) |
| 21 |
|
| 22 |
assert msg == w.greet() |
| 23 |
version_string = str(sys.version_info[0]) + "." + str(sys.version_info[1]) |
| 24 |
assert version_string == w.version() |
| 25 |
|
| 26 |
if __name__ == '__main__': |
| 27 |
run() |