summaryrefslogtreecommitdiffstats
path: root/test cases/frameworks/1 boost/test_python_module.py
blob: 8ef96d2ffef452d90ed9bc3dd2b548d0e3d9d200 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
import sys
sys.path.append(sys.argv[1])

# import compiled python module depending on version of python we are running with
if sys.version_info[0] == 2:
    import python2_module

if sys.version_info[0] == 3:
    import python3_module


def run():
    msg = 'howdy'
    if sys.version_info[0] == 2:
        w = python2_module.World()

    if sys.version_info[0] == 3:
        w = python3_module.World()

    w.set(msg)

    assert msg == w.greet()
    version_string = str(sys.version_info[0]) + "." + str(sys.version_info[1])
    assert version_string == w.version()

if __name__ == '__main__':
    run()