[pytest-dev] Could I print “current line and statement” to stdout in pytest?

徐荣中 xurongzhong at gmail.com
Mon Feb 25 11:38:45 CET 2013


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('\nInside Setup')
def test_something_quick():
    snmp_set(node1)
    print "\n test_something_quick"
def test_another():
    pass

2013/2/25 Ronny Pfannschmidt <Ronny.Pfannschmidt at gmx.de>

> 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
>> Pytest-dev at python.org
>> http://mail.python.org/**mailman/listinfo/pytest-dev<http://mail.python.org/mailman/listinfo/pytest-dev>
>>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/pytest-dev/attachments/20130225/90c7677d/attachment.html>


More information about the Pytest-dev mailing list