| Total Complexity | 6 |
| Total Lines | 21 |
| Duplicated Lines | 0 % |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | """ |
||
| 19 | class PytestMayaPlugin(object): |
||
| 20 | |||
| 21 | def pytest_sessionstart(self): |
||
| 22 | import maya.standalone |
||
| 23 | maya.standalone.initialize() |
||
| 24 | |||
| 25 | # If testing a maya module make sure PYTHONPATH and sys.path are |
||
| 26 | # identical |
||
| 27 | realsyspath = [os.path.realpath(path) for path in sys.path] |
||
| 28 | pythonpath = os.environ.get('PYTHONPATH', '') |
||
| 29 | for p in pythonpath.split(os.pathsep): |
||
| 30 | p = os.path.realpath(p) |
||
| 31 | if p not in realsyspath: |
||
| 32 | sys.path.insert(0, p) |
||
| 33 | |||
| 34 | def pytest_sessionfinish(self): |
||
| 35 | import maya.standalone |
||
| 36 | from maya import cmds |
||
| 37 | # Starting Maya 2016, we have to call uninitialize |
||
| 38 | if float(cmds.about(v=True)) >= 2016.0: |
||
| 39 | maya.standalone.uninitialize() |
||
| 40 | |||
| 49 |