4 # Copyright (C) 2010-2018 CEA/DEN
6 # This library is free software; you can redistribute it and/or
7 # modify it under the terms of the GNU Lesser General Public
8 # License as published by the Free Software Foundation; either
9 # version 2.1 of the License.
11 # This library is distributed in the hope that it will be useful,
12 # but WITHOUT ANY WARRANTY; without even the implied warranty of
13 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 # Lesser General Public License for more details.
16 # You should have received a copy of the GNU Lesser General Public
17 # License along with this library; if not, write to the Free Software
18 # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
22 initialize PATH etc... for salomeTools unittest test files
26 https://docs.python.org/2/library/os.html
27 os.environ mapping is captured the first time the os module is imported,
28 typically during Python startup as part of processing site.py.
29 Changes to the environment made after this time are not reflected
30 in os.environ, except for changes made by modifying os.environ directly.
32 On some platforms, including FreeBSD and Mac OS X,
33 setting environ may cause memory leaks.
40 # get path to salomeTools sources directory parent
41 satdir = os.path.dirname(os.path.dirname(os.path.realpath(__file__)))
43 # sys.stderr.write("INFO : initializeTest needs '%s' in sys.path:\n%s\n" % (satdir, PP.pformat(sys.path)))
45 if satdir not in sys.path:
46 # get path to salomeTools sources FIRST as prepend
47 # Make the src & commands package accessible from all test code
48 sys.path.insert(0, satdir)
50 WARNING : sys.path not set for salomeTools, fixed for you:
52 sys.path:\n%s\n""" % (satdir, PP.pformat(sys.path)))
53 # os.environ PATH is not set...
54 # supposedly useful only for subprocess launch from sat
55 # see https://docs.python.org/2/library/os.html
56 # On some platforms, including FreeBSD and Mac OS X,
57 # setting environ may cause memory leaks.
58 # sys.stderr.write("os.environ PATH:\n%s\n" % PP.pformat(os.environ["PATH"].split(":")))
59 sys.stderr.write("INFO : to fix this message type:\n 'export PYTHONPATH=%s:${PYTHONPATH}'\n" % satdir)