<html>
<head>
<meta content="text/html; charset=utf-8" http-equiv="Content-Type">
</head>
<body text="#000000" bgcolor="#FFFFFF">
thanks!!!<br>
<br>
your suggestion was very helpful.<br>
to use<b> item.rep_call.outcome</b> and not <b>report.outcome</b><br>
<br>
<br>
<br>
def pytest_runtest_makereport(__multicall__, item, call):<br>
<br>
report = __multicall__.execute()<br>
setattr(item, "rep_" + report.when, report)<br>
if call.when == "teardown" :<br>
try:<br>
item.config.logger.info2((item.rep_call.outcome))<br>
except:<br>
pass<br>
return report<br>
<br>
<br>
<div class="moz-cite-prefix">On 17/09/14 17:50, Ayelet Regev wrote:<br>
</div>
<blockquote cite="mid:54199FB3.1040204@fabrixsystems.com"
type="cite">
<meta content="text/html; charset=utf-8" http-equiv="Content-Type">
i am using this hook...<br>
<br>
i have 1 test with 2 configurations provided using
item._request.cfg<br>
<br>
then when im running the tests using xdist, i see that
"slaveoutput["exitstatus"] is aware of the failure. but
report.outcome climing both have "passed"<br>
<br>
<br>
<br>
def test_cm_delete(request):<br>
cfg = request.cfg<br>
if cfg.get("channel_name") == "working_20":<br>
assert True<br>
else:<br>
assert False<br>
<br>
<br>
def pytest_runtest_makereport(__multicall__, item, call):<br>
report = __multicall__.execute()<br>
if call.when == "teardown" :<br>
try:<br>
<b>item.config.logger.info2("item %s with cfg %s -
Report OUTCOME : %s" %
(item.name,item._request.cfg,report.outcome))</b><br>
except:<br>
pass<br>
return report<br>
<br>
<br>
def pytest_testnodedown(node, error):<br>
<b> node.config.logger.info2("slaveoutput of node %s" %
(node.slaveoutput))</b><br>
<br>
<br>
<br>
<br>
<br>
log:<br>
<br>
<br>
[2014-09-17 17:44:56,209][MainThread] Run-test: test_cm_delete -
[{'comment': u'ChannelMapname', 'name': u'channel_name',
'defaultvalue': u'bbbbbb', 'value': u'working_21', 'choices':
u'functionnametosendtoknownURLwithargsofactivityandfuncname',
'type': u'string'}]<br>
[2014-09-17 17:44:56,217][MainThread] Teardown: test_cm_delete -
[{'comment': u'ChannelMapname', 'name': u'channel_name',
'defaultvalue': u'bbbbbb', 'value': u'working_21', 'choices':
u'functionnametosendtoknownURLwithargsofactivityandfuncname',
'type': u'string'}]<br>
[2014-09-17 17:44:56,218][MainThread] <b>item test_cm_delete with
cfg {u'channel_name': u'working_21'} - Report OUTCOME : passed</b><br>
[2014-09-17 17:44:56,225][MainThread] <b>slaveoutput of node
{'exitstatus': 1}</b><br>
[2014-09-17 17:45:00,218][MainThread] Run-test: test_cm_delete -
[{'comment': u'ChannelMapname', 'name': u'channel_name',
'defaultvalue': u'aaaaaaaaaaaaa', 'value': u'working_20',
'choices': u'functionname to send to known URL with args of
activity and funcname', 'type': u'string'}]<br>
[2014-09-17 17:45:00,219][MainThread] Teardown: test_cm_delete -
[{'comment': u'ChannelMapname', 'name': u'channel_name',
'defaultvalue': u'aaaaaaaaaaaaa', 'value': u'working_20',
'choices': u'functionname to send to known URL with args of
activity and funcname', 'type': u'string'}]<br>
[2014-09-17 17:45:00,220][MainThread] <b>item test_cm_delete with
cfg {u'channel_name': u'working_20'} - Report OUTCOME : passed</b><br>
[2014-09-17 17:45:00,226][MainThread]<b> slaveoutput of node
{'exitstatus': 0}</b><br>
<br>
<br>
console output:<br>
<br>
platform linux2 -- Python 2.7.6 -- py-1.4.23 -- pytest-2.6.1 --
/usr/bin/python<br>
plugins: xdist, timeout, cov<br>
[gw0] linux2 Python 2.7.6 cwd:
/home/ayelet/Scripts/sysu/root/var/sysu/cache/Activities<br>
[gw1] linux2 Python 2.7.6 cwd:
/home/ayelet/Scripts/sysu/root/var/sysu/cache/Activities<br>
[gw0] Python 2.7.6 (default, Mar 22 2014, 22:59:56) -- [GCC
4.8.2]<br>
[gw1] Python 2.7.6 (default, Mar 22 2014, 22:59:56) -- [GCC
4.8.2]<br>
gw0 [2] / gw1 [2]<br>
scheduling tests via LoadScheduling<br>
<br>
Ingest/ChannelMap/delete_cm/test_delete_cm.py::test_cm_delete <br>
<b>[gw0] FAILED
Ingest/ChannelMap/delete_cm/test_delete_cm.py::test_cm_delete </b><b><br>
</b><b>[gw1] PASSED
Ingest/ChannelMap/delete_cm/test_delete_cm.py::test_cm_delete </b><br>
<br>
============================================================================
FAILURES
=============================================================================<br>
_________________________________________________________________________
test_cm_delete
__________________________________________________________________________<br>
[gw0] linux2 -- Python 2.7.6 /usr/bin/python<br>
request = <FixtureRequest for <Function
'test_cm_delete'>><br>
<br>
def test_cm_delete(request):<br>
cfg = request.cfg<br>
servers_data = request.config.properties["Servers"]<br>
#request.config.logger.info2("AYELET WAS HERE %s" % (cfg))<br>
request.basa = "BASA"<br>
#assert delete_cm(cfg,servers_data) == 200<br>
if cfg.get("channel_name") == "working_20":<br>
assert True<br>
else:<br>
> assert False<br>
E assert False<br>
<br>
Ingest/ChannelMap/delete_cm/test_delete_cm.py:22: AssertionError<br>
<b>===============================================================
1 failed, 1 passed in 6.23 seconds
================================================================</b><br>
<br>
<br>
<br>
<br>
<div class="moz-cite-prefix">On 17/09/14 17:28, Holger Krekel
wrote:<br>
</div>
<blockquote
cite="mid:61efc209-91dd-4910-8004-9eb62b84e532@email.android.com"
type="cite">You might adapt this example: <a
moz-do-not-send="true"
href="http://pytest.org/latest/example/simple.html#making-test-result-information-available-in-fixtures">http://pytest.org/latest/example/simple.html#making-test-result-information-available-in-fixtures</a><br>
<br>
<div class="gmail_quote">On September 17, 2014 3:18:05 PM CEST,
Ayelet Regev <a moz-do-not-send="true"
class="moz-txt-link-rfc2396E"
href="mailto:ayelet@fabrixsystems.com"><ayelet@fabrixsystems.com></a>
wrote:
<blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt
0.8ex; border-left: 1px solid rgb(204, 204, 204);
padding-left: 1ex;">
<pre class="k9mail">Hi,
I want to be able to get the result from each item at teardown.
What should i look for?
</pre>
</blockquote>
</div>
<br>
-- <br>
Sent from my Android device with K-9 Mail. Please excuse my
brevity. </blockquote>
<br>
<pre class="moz-signature" cols="72">--
Best Regards,
Ayelet Regev Dabah
Email: <a moz-do-not-send="true" class="moz-txt-link-abbreviated" href="mailto:ayelet@fabrixsystems.com">ayelet@fabrixsystems.com</a></pre>
</blockquote>
<br>
<pre class="moz-signature" cols="72">--
Best Regards,
Ayelet Regev Dabah
Email: <a class="moz-txt-link-abbreviated" href="mailto:ayelet@fabrixsystems.com">ayelet@fabrixsystems.com</a></pre>
</body>
</html>