<html><body><div style="color:#000; background-color:#fff; font-family:verdana, helvetica, sans-serif;font-size:10pt">Hi,<br><br><div>In order to append sys.argv to ERROR, i have:</div><div><br></div><div>"setup.py"</div><div>-------------------------<br></div><div>import sys<br>try:<br> import ez_setup<br> ez_setup.use_setuptools()<br>except ImportError:<br> pass<br><br>from setuptools import setup<br><br>setup(<br> name='Context Traceback plugin',<br> version='0.5',<br> author='Kamal Ahmed',<br> author_email = 'k.a@ts.com',<br> description = 'Append argv to Traceback plugin',<br> license = '2011',<br>
py_modules = ['plugin_argv'],<br> entry_points = {<br> 'nose.plugins': [<br> 'plugin_argv= plugin_argv:pluginargv'<br> ]<br> }<br><br> )<br>-------------------------------------------------<br>"plugin_argv.py"</div><div>-------------------------------------------------<br></div><div>"""<br>This plugin adds argv to tracebacks<br>"""<br> <br>import os<br>from nose.plugins import Plugin<br>from nose.inspector import inspect_traceback<br><br>class pluginargv(Plugin):<br> """<br> Plugin that appends argv to Traceback.<br> """<br> score = 600 # before capture<br> <br> def
options(self, parser, env=os.environ):<br> parser.add_option(<br> "--argv-append", <br> action="store_true",<br> default=env.get('NOSE_ARGV_ERRORS'),<br> dest="argvErrors", help="Add argv to error"<br> " output by attempting to evaluate failed"<br> " asserts [NOSE_ARGV_ERRORS]")<br><br> def
configure(self, options, conf):<br> if not self.can_configure:<br> return<br> self.enabled = options.argvErrors<br> self.conf = conf<br><br> def formatFailure(self, test, err):<br> """Add detail from traceback inspection to error message of a failure.<br> """<br> ec, ev, tb, arg = err<br> tbinfo = inspect_traceback(tb)<br> test.tbinfo = tbinfo<br> for arg in sys.argv:<br> if arg ==
'--mysql':<br> return (ec, '\n'.join([str(ev), tbinfo]), tb, 'myql')<br> elif arg == '--psql':<br> return (ec, '\n'.join([str(ev), tbinfo]), tb, 'psql')<br><br></div><div>-------------------------------------------------------------------------------------------<br></div><div>But, i am not getting any sys.argv in the traceback, could you give me any hint ? if possible ?</div><div><br>i am using --mysql in the command line <br><br></div><div>Thanks,</div><div>-Kamal.</div><br></div></body></html>