[ Date Prev][ Date Next][ Thread Prev][ Thread Next][ Date Index][ Thread Index]
Add to PYTHONPATH for tests?
- To: qmtest@xxxxxxxxxxxxxxxx
- Subject: Add to PYTHONPATH for tests?
- From: Gary Oberbrunner <garyo@xxxxxxxxxxx>
- Date: Fri, 27 Jul 2007 17:04:37 -0400
I'm subclassing Test, and I'd like to execute some python tests via the shell.
However I need them to have the QMTest dir in their PYTHONPATH. Is there a
QMtest-approved way to tweak PYTHONPATH, or should I just do this:
class Test(test.Test):
"""Simple test that runs a python script and checks the status
to determine whether the test passes."""
...
def Run(self, context, result):
"""Run the test"
env = os.environ.copy()
env['PYTHONPATH'] = os.path.join(os.getcwd(), 'QMTest')
args = [context.get('python', sys.executable), self.script]
command = RedirectedExecutable()
status = command.Run(args, env)
...
Any hints?
--
Gary Oberbrunner
|