goa/test/pytestconf.py
changeset 0 b97547f5f1fa
child 1977 606923dff11b
equal deleted inserted replaced
-1:000000000000 0:b97547f5f1fa
       
     1 """this pytestconf automatically adds the mx's python version in the PYTHONPATH
       
     2 """
       
     3 import sys
       
     4 import os.path as osp
       
     5 
       
     6 import cubicweb
       
     7 # remove 'mx' modules imported by cubicweb
       
     8 for modname in sys.modules.keys(): 
       
     9     if modname.startswith('mx'):
       
    10         sys.modules.pop(modname)
       
    11 
       
    12 # this is where mx should get imported from
       
    13 mxpath = osp.abspath(osp.join(osp.dirname(cubicweb.__file__), 'embedded'))
       
    14 sys.path.insert(1, mxpath)
       
    15 
       
    16 # make sure the correct mx is imported
       
    17 import mx
       
    18 assert osp.dirname(mx.__file__) == osp.join(mxpath, 'mx'), '%s != %s' % (osp.dirname(mx.__file__), mxpath)