Salome HOME
A way to deal with environment modules.
[tools/yacsgen.git] / Examples / test_compo.py
1 #! /usr/bin/env python
2 # -*- coding: utf-8 -*-
3 # This test executes the coupling.xml schema found in the current directory
4 # and verifies the execution state.
5 import unittest
6
7 import os
8 import sys
9
10 import imp
11
12 class TestCompo(unittest.TestCase):
13   def setUp(self):
14     # creat study and load catalogs
15     import SALOMERuntime
16     SALOMERuntime.RuntimeSALOME_setRuntime()
17     salome_runtime = SALOMERuntime.getSALOMERuntime()
18     
19     import salome
20     salome.salome_init()
21     
22     mc = salome.naming_service.Resolve('/Kernel/ModulCatalog')
23     ior = salome.orb.object_to_string(mc)
24     session_catalog = salome_runtime.loadCatalog("session", ior)
25     salome_runtime.addCatalog(session_catalog)
26
27   def test_exec_scheme(self):
28     import pilot
29     import loader
30
31     xmlLoader = loader.YACSLoader()
32     try:
33       p = xmlLoader.load("coupling.xml")
34     except IOError as ex:
35       self.fail("IO exception:" + ex);
36     self.assertTrue(p.isValid())
37     e = pilot.ExecutorSwig()
38     e.RunW(p)
39     self.assertEqual(p.getEffectiveState(), pilot.DONE)
40     
41   def tearDown(self):
42       pass
43   
44 if __name__ == '__main__':
45     unittest.main()