so am i asuming it correct that you want *python* to print line numbers
and statements as it executes your code, since py.test tests executing
are just python code running

you can do that by implementing a own trace function (sys.settrace) and
hooking into pytest_runtest_call for example

On 02/25/2013 11:38 AM, 徐荣中 wrote:
> In test steps:
> I want to py.test to print line number and statment when excecute step. 
> Example, put "line 11: snmp_set(node)" when excecut "snmp_set(node1)", 
> Is it possible?
> 
> @pytest.mark.webtest
> @pytest.mark.high
> def test_send_http():
> mylogger.info <http://mylogger.info>('\nInside Setup')
> def test_something_quick():
> snmp_set(node1)
> print "\n test_something_quick"
> def test_another():
> pass
> 
> 2013/2/25 Ronny Pfannschmidt <[email protected] 
> <mailto:[email protected]>>
> 
>     in what context ?
> 
>     On 02/25/2013 11:23 AM, 徐荣中 wrote:
> 
>         Could I print "current line and statement" to |stdout| in
>         |pytest|? I
> 
>         want to modify |pytest| files to achieve the following:
> 
>         |line9: snmp_get(node1.1)
>         line10: snmp_set(nod1.2)|
> 
> 
>         Anyone can tell me where to modify?
> 
>         Thanks!
> 
> 
> 
>         _________________________________________________
>         Pytest-dev mailing list
>         [email protected] <mailto:[email protected]>
>         http://mail.python.org/__mailman/listinfo/pytest-dev
>         <http://mail.python.org/mailman/listinfo/pytest-dev>
> 
> 
> 

_______________________________________________
Pytest-dev mailing list
[email protected]
http://mail.python.org/mailman/listinfo/pytest-dev

Reply via email to