<html>
<head>
<meta content="text/html; charset=ISO-8859-1"
http-equiv="Content-Type">
</head>
<body bgcolor="#FFFFFF" text="#000000">
<br>
<div class="moz-cite-prefix">On 8/4/14 10:19 AM, Chris Bannan wrote:<br>
</div>
<blockquote
cite="mid:1407161991.89490.YahooMailNeo@web142405.mail.bf1.yahoo.com"
type="cite">
<div style="color:#000; background-color:#fff;
font-family:HelveticaNeue, Helvetica Neue, Helvetica, Arial,
Lucida Grande, sans-serif;font-size:10pt">
<div id="yiv1168000802" class="" style="">
<div class="" style="">
<div style="background-color: rgb(255, 255, 255);" class="">
<div id="yiv1168000802yui_3_16_0_7_1407155359467_4"
class="" style="color: rgb(0, 0, 0); font-family:
HelveticaNeue, 'Helvetica Neue', Helvetica, Arial,
'Lucida Grande', sans-serif; font-size: 10pt;"><span
style="font-size: 10pt;" class="">I am a consultant
working on some python testing tools for a Java
Application.</span><br style="">
</div>
<div id="yiv1168000802yui_3_16_0_7_1407155359467_4"
class="" style="color: rgb(0, 0, 0); font-family:
HelveticaNeue, 'Helvetica Neue', Helvetica, Arial,
'Lucida Grande', sans-serif; font-size: 10pt;"><span
style="font-size: 10pt;" class="">I am using Python
2.7, Jython 2.7b2 and Java 7 on Windows 7</span></div>
<div id="yiv1168000802yui_3_16_0_7_1407155359467_4"
class="" style="color: rgb(0, 0, 0); font-family:
HelveticaNeue, 'Helvetica Neue', Helvetica, Arial,
'Lucida Grande', sans-serif; font-size: 10pt;"><span
style="font-size: 10pt;" class=""><br class=""
style="">
</span></div>
<div id="yiv1168000802yui_3_16_0_7_1407155359467_4"
class="" style="color: rgb(0, 0, 0); font-family:
HelveticaNeue, 'Helvetica Neue', Helvetica, Arial,
'Lucida Grande', sans-serif; font-size: 10pt;"><span
style="background-color: transparent;" class="">Python
is the language of choice for test scripting for my
customer. </span></div>
<div id="yiv1168000802yui_3_16_0_7_1407155359467_4"
class="" style="color: rgb(0, 0, 0); font-family:
HelveticaNeue, 'Helvetica Neue', Helvetica, Arial,
'Lucida Grande', sans-serif; font-size: 10pt;"><span
style="background-color: transparent;" class="">Some
of the tools require calling java classes. </span><span
style="background-color: transparent;" class="">That
is easy enough using Jython. </span></div>
<div id="yiv1168000802yui_3_16_0_7_1407155359467_4"
style="color: rgb(0, 0, 0); font-family: HelveticaNeue,
'Helvetica Neue', Helvetica, Arial, 'Lucida Grande',
sans-serif; font-size: 13px; font-style: normal;
background-color: transparent;" class=""><span class=""
style="">But, I am struggling how to get code coverage
data for the jython/python code. </span></div>
<div id="yiv1168000802yui_3_16_0_7_1407155359467_4"
style="color: rgb(0, 0, 0); font-family: HelveticaNeue,
'Helvetica Neue', Helvetica, Arial, 'Lucida Grande',
sans-serif; font-size: 13px; font-style: normal;
background-color: transparent;" class=""><span
id="yiv1168000802yui_3_16_0_7_1407155359467_28"
class="" style=""><br class="" style="">
</span></div>
<div id="yiv1168000802yui_3_16_0_7_1407155359467_4"
style="color: rgb(0, 0, 0); font-family: HelveticaNeue,
'Helvetica Neue', Helvetica, Arial, 'Lucida Grande',
sans-serif; font-size: 13px; font-style: normal;
background-color: transparent;" class=""><span
style="background-color: transparent;" class="">My
command line for executing the Unit test is</span><br
class="" style="">
</div>
<div id="yiv1168000802yui_3_16_0_7_1407155359467_4"
style="background-color: transparent;" class="">
<div id="yiv1168000802yui_3_16_0_7_1407155359467_4"
class="" style="color: rgb(0, 0, 0); font-family:
HelveticaNeue, 'Helvetica Neue', Helvetica, Arial,
'Lucida Grande', sans-serif; font-size: 13px;
font-style: normal;"><span class="" style=""><span
class="Apple-tab-span" style="white-space:pre"> </span>java
-cp \jython2.7b2\jython.jar org.python.util.jython
TestClassForName.py</span></div>
<div class="" style="color: rgb(0, 0, 0); font-family:
HelveticaNeue, 'Helvetica Neue', Helvetica, Arial,
'Lucida Grande', sans-serif; font-size: 13px;
font-style: normal;"><br>
</div>
<div class="" style="color: rgb(0, 0, 0); font-family:
HelveticaNeue, 'Helvetica Neue', Helvetica, Arial,
'Lucida Grande', sans-serif; font-size: 13px;
font-style: normal;">I cannot run coverage.exe against
the python/jython below.</div>
<div class="" style="color: rgb(0, 0, 0); font-family:
HelveticaNeue, 'Helvetica Neue', Helvetica, Arial,
'Lucida Grande', sans-serif; font-size: 13px;
font-style: normal;">The command line I am using is </div>
<div class="" style=""><span class="" style="color:
rgb(0, 0, 0); font-family: HelveticaNeue, 'Helvetica
Neue', Helvetica, Arial, 'Lucida Grande',
sans-serif; font-size: 13px; font-style: normal;
white-space: pre;"> </span><span
style="background-color: transparent;" class="">coverage
run TestClassForName.py</span></div>
<div class="" style=""><span style="background-color:
transparent;" class=""><br class="" style="">
</span></div>
</div>
</div>
</div>
</div>
</div>
</blockquote>
<br>
You show the command you're running, but you haven't shown what
happens. How doesn't it work?<br>
<br>
<blockquote
cite="mid:1407161991.89490.YahooMailNeo@web142405.mail.bf1.yahoo.com"
type="cite">
<div style="color:#000; background-color:#fff;
font-family:HelveticaNeue, Helvetica Neue, Helvetica, Arial,
Lucida Grande, sans-serif;font-size:10pt">
<div id="yiv1168000802" class="" style="">
<div class="" style="">
<div style="background-color: rgb(255, 255, 255);" class="">
<div id="yiv1168000802yui_3_16_0_7_1407155359467_4"
style="background-color: transparent;" class="">
<div class="" style=""><span style="background-color:
transparent;" class="">Coverage does work for other
python unittests</span></div>
<div class="" style=""><span style="font-size: 10pt;
background-color: transparent;">Thanks in advance</span><br>
</div>
<div class="" style=""><span style="background-color:
transparent;" class="">
<div id="yiv1168000802yui_3_16_0_7_1407155359467_8"
class="" style="font-size: 10pt;"><br class=""
style="">
</div>
<div id="yiv1168000802yui_3_16_0_7_1407155359467_10"
class="" style="font-size: 10pt;">C Bannan<br
class="" style="">
</div>
<div id="yiv1168000802yui_3_16_0_7_1407155359467_10"
class="" style="font-size: 10pt;"><br>
</div>
<div id="yiv1168000802yui_3_16_0_7_1407155359467_10"
class="" style="font-size: 10pt;"><br>
</div>
</span></div>
<div class="" style="color: rgb(0, 0, 0); font-family:
HelveticaNeue, 'Helvetica Neue', Helvetica, Arial,
'Lucida Grande', sans-serif; font-size: 13px;
font-style: normal;"><span class="" style=""><code></span></div>
<div class="" style="">"""Unit test sample for Jython </div>
<div class="" style="">"""</div>
<div class="" style="">import unittest</div>
<div class="" style="">from java.lang import Class</div>
<div class="" style="">from java.lang import
ClassNotFoundException</div>
<div class="" style=""><br class="" style="">
</div>
<div class="" style="">class
TestClassForName(unittest.TestCase):</div>
<div class="" style=""><br class="" style="">
</div>
<div class="" style=""> def
test_ShouldFailWithInvalidClassName(self):</div>
<div class="" style=""><br class="" style="">
</div>
<div class="" style=""> return_value =
load_class('java.lang.Spring')</div>
<div class="" style=""><br class="" style="">
</div>
<div class="" style="">
self.assertEquals(return_value, 'failure')</div>
<div class="" style=""><br class="" style="">
</div>
<div class="" style=""> def
test_ShouldPassWithValidClassName(self):</div>
<div class="" style=""><br class="" style="">
</div>
<div class="" style=""> return_value =
load_class('java.lang.String')</div>
<div class="" style=""><br class="" style="">
</div>
<div class="" style="">
self.assertEquals(return_value, 'success')</div>
<div class="" style=""><br class="" style="">
</div>
<div class="" style="">def load_class(class_name):</div>
<div class="" style=""> try:</div>
<div class="" style=""> # for non Java folks,
this causes 'class_name' to be loaded</div>
<div class="" style=""> jclass =
Class.forName(class_name).newInstance()</div>
<div class="" style=""> return 'success'</div>
<div class="" style=""> except ClassNotFoundException
as cnf_excp:</div>
<div class="" style=""> return 'failure' </div>
<div class="" style=""><br class="" style="">
</div>
<div class="" style="">if __name__ == '__main__':</div>
<div class="" style=""> unittest.main()</div>
<div class="" style="color: rgb(0, 0, 0); font-family:
HelveticaNeue, 'Helvetica Neue', Helvetica, Arial,
'Lucida Grande', sans-serif; font-size: 13px;
font-style: normal;"><span class="" style=""></code></span></div>
<div class="" style="color: rgb(0, 0, 0); font-family:
HelveticaNeue, 'Helvetica Neue', Helvetica, Arial,
'Lucida Grande', sans-serif; font-size: 13px;
font-style: normal;"><span class="" style=""> </span></div>
</div>
<div id="yiv1168000802yui_3_16_0_7_1407155359467_8"
class="" style="color: rgb(0, 0, 0); font-family:
HelveticaNeue, 'Helvetica Neue', Helvetica, Arial,
'Lucida Grande', sans-serif; font-size: 10pt;"><br
class="" style="">
</div>
<div id="yiv1168000802yui_3_16_0_7_1407155359467_8"
class="" style="color: rgb(0, 0, 0); font-family:
HelveticaNeue, 'Helvetica Neue', Helvetica, Arial,
'Lucida Grande', sans-serif; font-size: 10pt;">
<div id="yiv1168000802yui_3_16_0_7_1407155359467_4"
class="" style=""><br class="" style="">
</div>
</div>
</div>
</div>
</div>
</div>
<br>
<fieldset class="mimeAttachmentHeader"></fieldset>
<br>
<pre wrap="">_______________________________________________
testing-in-python mailing list
<a class="moz-txt-link-abbreviated" href="mailto:testing-in-python@lists.idyll.org">testing-in-python@lists.idyll.org</a>
<a class="moz-txt-link-freetext" href="http://lists.idyll.org/listinfo/testing-in-python">http://lists.idyll.org/listinfo/testing-in-python</a>
</pre>
</blockquote>
<br>
</body>
</html>