<html><body><div style="color:#000; background-color:#fff; font-family:HelveticaNeue, Helvetica Neue, Helvetica, Arial, Lucida Grande, sans-serif;font-size:10pt"><div class="" style=""><span class="" style="">How careless of me. &nbsp;My apology.</span></div><div class="" style="color: rgb(0, 0, 0); font-size: 13px; font-family: HelveticaNeue, 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; font-style: normal; background-color: transparent;"><span class="" style="">Here is the command and result.</span></div><div style="color: rgb(0, 0, 0); font-size: 13px; font-family: HelveticaNeue, 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; font-style: normal; background-color: transparent;" class=""><span class="" style=""><br class="" style=""></span></div><div style="background-color: transparent;" class="">C:\cygwin64\home\cbannan\python&gt;coverage run TestClassForName.py</div><div style="background-color: transparent;"
 class="">Traceback (most recent call last):</div><div style="background-color: transparent;" class="">&nbsp; File "TestClassForName.py", line 6, in &lt;module&gt;</div><div style="background-color: transparent;" class="">&nbsp; &nbsp; from java.lang import Class</div><div style="background-color: transparent;" class=""><span class="" style=""></span></div><div style="background-color: transparent;" class="">ImportError: No module named java.lang</div><div class="" style=""></div><div class="" style="">&nbsp;</div><div class="" style="">Chris<br class="" style="">cmbannan@yahoo.com</div><div class="" style=""><br class="" style=""></div>  <div style="font-family: HelveticaNeue, Helvetica Neue, Helvetica, Arial, Lucida Grande, sans-serif; font-size: 10pt;" class=""> <div style="font-family: HelveticaNeue, Helvetica Neue, Helvetica, Arial, Lucida Grande, sans-serif; font-size: 12pt;" class=""> <div dir="ltr" class="" style=""> <hr size="1" class=""
 style="">  <font size="2" face="Arial" class="" style=""> <b class="" style=""><span style="font-weight:bold;" class="">From:</span></b> "testing-in-python-request@lists.idyll.org" &lt;testing-in-python-request@lists.idyll.org&gt;<br class="" style=""> <b class="" style=""><span style="font-weight: bold;" class="">To:</span></b> testing-in-python@lists.idyll.org <br class="" style=""> <b class="" style=""><span style="font-weight: bold;" class="">Sent:</span></b> Monday, August 4, 2014 11:18 AM<br class="" style=""> <b class="" style=""><span style="font-weight: bold;" class="">Subject:</span></b> testing-in-python Digest, Vol 91, Issue 2<br class="" style=""> </font> </div> <div class="" style=""><br class="" style="">Send testing-in-python mailing list submissions to<br class="" style="">&nbsp;&nbsp;&nbsp; <a ymailto="mailto:testing-in-python@lists.idyll.org" href="mailto:testing-in-python@lists.idyll.org" class=""
 style="">testing-in-python@lists.idyll.org</a><br class="" style=""><br class="" style="">To subscribe or unsubscribe via the World Wide Web, visit<br class="" style="">&nbsp;&nbsp;&nbsp; <a href="http://lists.idyll.org/listinfo/testing-in-python" target="_blank" class="" style="">http://lists.idyll.org/listinfo/testing-in-python</a><br class="" style="">or, via email, send a message with subject or body 'help' to<br class="" style="">&nbsp;&nbsp;&nbsp; <a ymailto="mailto:testing-in-python-request@lists.idyll.org" href="mailto:testing-in-python-request@lists.idyll.org" class="" style="">testing-in-python-request@lists.idyll.org</a><br class="" style=""><br class="" style="">You can reach the person managing the list at<br class="" style="">&nbsp;&nbsp;&nbsp; <a ymailto="mailto:testing-in-python-owner@lists.idyll.org" href="mailto:testing-in-python-owner@lists.idyll.org" class="" style="">testing-in-python-owner@lists.idyll.org</a><br class=""
 style=""><br class="" style="">When replying, please edit your Subject line so it is more specific<br class="" style="">than "Re: Contents of testing-in-python digest..."<br class="" style=""><br class="" style=""><br class="" style="">Today's Topics:<br class="" style=""><br class="" style="">&nbsp;  1. testfixtures 4.0.1 Released! (Chris Withers)<br class="" style="">&nbsp;  2. Cannot run coverage.exe against the jython (Chris Bannan)<br class="" style="">&nbsp;  3. Re: Cannot run coverage.exe against the jython (Ned Batchelder)<br class="" style=""><br class="" style=""><br class="" style="">----------------------------------------------------------------------<br class="" style=""><br class="" style="">Message: 1<br class="" style="">Date: Mon, 04 Aug 2014 12:43:29 +0100<br class="" style="">From: Chris Withers &lt;<a ymailto="mailto:chris@simplistix.co.uk" href="mailto:chris@simplistix.co.uk" class="" style="">chris@simplistix.co.uk</a>&gt;<br
 class="" style="">Subject: [TIP] testfixtures 4.0.1 Released!<br class="" style="">To: <a ymailto="mailto:testing-in-python@lists.idyll.org" href="mailto:testing-in-python@lists.idyll.org" class="" style="">testing-in-python@lists.idyll.org</a>, Python List<br class="" style="">&nbsp;&nbsp;&nbsp; &lt;<a ymailto="mailto:python-list@python.org" href="mailto:python-list@python.org" class="" style="">python-list@python.org</a>&gt;,&nbsp;&nbsp;&nbsp; <a ymailto="mailto:simplistix@googlegroups.com" href="mailto:simplistix@googlegroups.com" class="" style="">simplistix@googlegroups.com</a><br class="" style="">Message-ID: &lt;<a ymailto="mailto:53DF71E1.8050506@simplistix.co.uk" href="mailto:53DF71E1.8050506@simplistix.co.uk" class="" style="">53DF71E1.8050506@simplistix.co.uk</a>&gt;<br class="" style="">Content-Type: text/plain; charset=ISO-8859-1; format=flowed<br class="" style=""><br class="" style="">Hi All,<br class="" style=""><br class="" style="">I'm
 pleased to announce the release of testfixtures 4.0.1. This is a <br class="" style="">bugfix release that fixes the following two edge cases:<br class="" style=""><br class="" style="">- Fix bugs when string compared equal and options to compare()<br class="" style="">&nbsp;  were used.<br class="" style=""><br class="" style="">- Fix bug when strictly comparing two nested structures containing<br class="" style="">&nbsp;  identical objects.<br class="" style=""><br class="" style="">The package is on PyPI and a full list of all the links to docs, issue <br class="" style="">trackers and the like can be found here:<br class="" style=""><br class="" style=""><a href="http://www.simplistix.co.uk/software/python/testfixtures" target="_blank" class="" style="">http://www.simplistix.co.uk/software/python/testfixtures</a><br class="" style=""><br class="" style="">Any questions, please do ask on the Testing in Python list or on the <br class=""
 style="">Simplistix open source mailing list...<br class="" style=""><br class="" style="">cheers,<br class="" style=""><br class="" style="">Chris<br class="" style=""><br class="" style="">-- <br class="" style="">Simplistix - Content Management, Batch Processing &amp; Python Consulting<br class="" style="">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; - <a href="http://www.simplistix.co.uk/" target="_blank" class="" style="">http://www.simplistix.co.uk</a><br class="" style=""><br class="" style=""><br class="" style=""><br class="" style="">------------------------------<br class="" style=""><br class="" style="">Message: 2<br class="" style="">Date: Mon, 4 Aug 2014 07:19:51 -0700<br class="" style="">From: Chris Bannan &lt;<a ymailto="mailto:cmbannan@yahoo.com" href="mailto:cmbannan@yahoo.com" class="" style="">cmbannan@yahoo.com</a>&gt;<br class="" style="">Subject: [TIP] Cannot run coverage.exe against the jython<br class="" style="">To: "<a
 ymailto="mailto:testing-in-python@lists.idyll.org" href="mailto:testing-in-python@lists.idyll.org" class="" style="">testing-in-python@lists.idyll.org</a>"<br class="" style="">&nbsp;&nbsp;&nbsp; &lt;<a ymailto="mailto:testing-in-python@lists.idyll.org" href="mailto:testing-in-python@lists.idyll.org" class="" style="">testing-in-python@lists.idyll.org</a>&gt;<br class="" style="">Message-ID:<br class="" style="">&nbsp;&nbsp;&nbsp; &lt;<a ymailto="mailto:1407161991.89490.YahooMailNeo@web142405.mail.bf1.yahoo.com" href="mailto:1407161991.89490.YahooMailNeo@web142405.mail.bf1.yahoo.com" class="" style="">1407161991.89490.YahooMailNeo@web142405.mail.bf1.yahoo.com</a>&gt;<br class="" style="">Content-Type: text/plain; charset="iso-8859-1"<br class="" style=""><br class="" style="">I am a consultant working on some python testing tools for a Java Application.<br class="" style=""><br class="" style="">I am using Python 2.7, Jython 2.7b2 and Java 7 on Windows
 7<br class="" style=""><br class="" style="">Python is the language of choice for test scripting for my customer. ?<br class="" style="">Some of the tools require calling java classes. ??That is easy enough using Jython. ??<br class="" style="">But, I am struggling how to get code coverage data for the jython/python code. ?<br class="" style=""><br class="" style="">My command line for executing the Unit test is<br class="" style=""><br class="" style="">&nbsp;&nbsp;&nbsp; java -cp \jython2.7b2\jython.jar org.python.util.jython TestClassForName.py<br class="" style=""><br class="" style="">I cannot run coverage.exe against the python/jython below.<br class="" style="">The command line I am using is?<br class="" style="">coverage run TestClassForName.py<br class="" style=""><br class="" style="">Coverage does work for other python unittests<br class="" style="">Thanks in advance<br class="" style=""><br class="" style=""><br class="" style=""><br
 class="" style="">C Bannan<br class="" style=""><br class="" style=""><br class="" style=""><br class="" style="">&lt;code&gt;<br class="" style="">"""Unit test sample for Jython ?<br class="" style="">"""<br class="" style="">import unittest<br class="" style="">from java.lang import Class<br class="" style="">from java.lang import ClassNotFoundException<br class="" style=""><br class="" style="">class TestClassForName(unittest.TestCase):<br class="" style=""><br class="" style="">? ? def test_ShouldFailWithInvalidClassName(self):<br class="" style=""><br class="" style="">? ? ? ? return_value = load_class('java.lang.Spring')<br class="" style=""><br class="" style="">? ? ? ? self.assertEquals(return_value, 'failure')<br class="" style=""><br class="" style="">? ? def test_ShouldPassWithValidClassName(self):<br class="" style=""><br class="" style="">? ? ? ? return_value = load_class('java.lang.String')<br class="" style=""><br class="" style="">? ? ?
 ? self.assertEquals(return_value, 'success')<br class="" style=""><br class="" style="">def load_class(class_name):<br class="" style="">? ? try:<br class="" style="">? ? ? ? # for non Java folks, this causes 'class_name' to be loaded<br class="" style="">? ? ? ? jclass = Class.forName(class_name).newInstance()<br class="" style="">? ? ? ? return 'success'<br class="" style="">? ? except ClassNotFoundException as cnf_excp:<br class="" style="">? ? ? ? return 'failure' ? ? ? ?<br class="" style=""><br class="" style="">if __name__ == '__main__':<br class="" style="">? ? unittest.main()<br class="" style="">&lt;/code&gt;<br class="" style="">-------------- next part --------------<br class="" style="">An HTML attachment was scrubbed...<br class="" style="">URL: &lt;<a href="http://lists.idyll.org/pipermail/testing-in-python/attachments/20140804/07db1829/attachment.htm" target="_blank" class=""
 style="">http://lists.idyll.org/pipermail/testing-in-python/attachments/20140804/07db1829/attachment.htm</a>&gt;<br class="" style=""><br class="" style="">------------------------------<br class="" style=""><br class="" style="">Message: 3<br class="" style="">Date: Mon, 04 Aug 2014 11:18:33 -0400<br class="" style="">From: Ned Batchelder &lt;<a ymailto="mailto:ned@nedbatchelder.com" href="mailto:ned@nedbatchelder.com" class="" style="">ned@nedbatchelder.com</a>&gt;<br class="" style="">Subject: Re: [TIP] Cannot run coverage.exe against the jython<br class="" style="">To: <a ymailto="mailto:testing-in-python@lists.idyll.org" href="mailto:testing-in-python@lists.idyll.org" class="" style="">testing-in-python@lists.idyll.org</a><br class="" style="">Message-ID: &lt;<a ymailto="mailto:53DFA449.2090002@nedbatchelder.com" href="mailto:53DFA449.2090002@nedbatchelder.com" class="" style="">53DFA449.2090002@nedbatchelder.com</a>&gt;<br class=""
 style="">Content-Type: text/plain; charset="iso-8859-1"; Format="flowed"<br class="" style=""><br class="" style=""><br class="" style="">On 8/4/14 10:19 AM, Chris Bannan wrote:<br class="" style="">&gt; I am a consultant working on some python testing tools for a Java <br class="" style="">&gt; Application.<br class="" style="">&gt; I am using Python 2.7, Jython 2.7b2 and Java 7 on Windows 7<br class="" style="">&gt;<br class="" style="">&gt; Python is the language of choice for test scripting for my customer.<br class="" style="">&gt; Some of the tools require calling java classes. That is easy enough <br class="" style="">&gt; using Jython.<br class="" style="">&gt; But, I am struggling how to get code coverage data for the <br class="" style="">&gt; jython/python code.<br class="" style="">&gt;<br class="" style="">&gt; My command line for executing the Unit test is<br class="" style="">&gt; java -cp \jython2.7b2\jython.jar org.python.util.jython
 <br class="" style="">&gt; TestClassForName.py<br class="" style="">&gt;<br class="" style="">&gt; I cannot run coverage.exe against the python/jython below.<br class="" style="">&gt; The command line I am using is<br class="" style="">&gt; coverage run TestClassForName.py<br class="" style="">&gt;<br class="" style=""><br class="" style="">You show the command you're running, but you haven't shown what <br class="" style="">happens.&nbsp; How doesn't it work?<br class="" style=""><br class="" style="">&gt; Coverage does work for other python unittests<br class="" style="">&gt; Thanks in advance<br class="" style="">&gt;<br class="" style="">&gt; C Bannan<br class="" style="">&gt;<br class="" style="">&gt;<br class="" style="">&gt; &lt;code&gt;<br class="" style="">&gt; """Unit test sample for Jython<br class="" style="">&gt; """<br class="" style="">&gt; import unittest<br class="" style="">&gt; from java.lang import Class<br class="" style="">&gt;
 from java.lang import ClassNotFoundException<br class="" style="">&gt;<br class="" style="">&gt; class TestClassForName(unittest.TestCase):<br class="" style="">&gt;<br class="" style="">&gt;&nbsp; &nbsp;  def test_ShouldFailWithInvalidClassName(self):<br class="" style="">&gt;<br class="" style="">&gt;&nbsp; &nbsp; &nbsp; &nbsp;  return_value = load_class('java.lang.Spring')<br class="" style="">&gt;<br class="" style="">&gt; self.assertEquals(return_value, 'failure')<br class="" style="">&gt;<br class="" style="">&gt;&nbsp; &nbsp;  def test_ShouldPassWithValidClassName(self):<br class="" style="">&gt;<br class="" style="">&gt;&nbsp; &nbsp; &nbsp; &nbsp;  return_value = load_class('java.lang.String')<br class="" style="">&gt;<br class="" style="">&gt; self.assertEquals(return_value, 'success')<br class="" style="">&gt;<br class="" style="">&gt; def load_class(class_name):<br class="" style="">&gt;&nbsp; &nbsp;  try:<br class="" style="">&gt;&nbsp;
 &nbsp; &nbsp; &nbsp;  # for non Java folks, this causes 'class_name' to be loaded<br class="" style="">&gt;&nbsp; &nbsp; &nbsp; &nbsp;  jclass = Class.forName(class_name).newInstance()<br class="" style="">&gt;&nbsp; &nbsp; &nbsp; &nbsp;  return 'success'<br class="" style="">&gt;&nbsp; &nbsp;  except ClassNotFoundException as cnf_excp:<br class="" style="">&gt;&nbsp; &nbsp; &nbsp; &nbsp;  return 'failure'<br class="" style="">&gt;<br class="" style="">&gt; if __name__ == '__main__':<br class="" style="">&gt;&nbsp; &nbsp;  unittest.main()<br class="" style="">&gt; &lt;/code&gt;<br class="" style="">&gt;<br class="" style="">&gt;<br class="" style="">&gt;<br class="" style="">&gt;<br class="" style="">&gt; _______________________________________________<br class="" style="">&gt; testing-in-python mailing list<br class="" style="">&gt; <a ymailto="mailto:testing-in-python@lists.idyll.org" href="mailto:testing-in-python@lists.idyll.org" class=""
 style="">testing-in-python@lists.idyll.org</a><br class="" style="">&gt; <a href="http://lists.idyll.org/listinfo/testing-in-python" target="_blank" class="" style="">http://lists.idyll.org/listinfo/testing-in-python</a><br class="" style=""><br class="" style="">-------------- next part --------------<br class="" style="">An HTML attachment was scrubbed...<br class="" style="">URL: &lt;<a href="http://lists.idyll.org/pipermail/testing-in-python/attachments/20140804/ff761e2d/attachment.htm" target="_blank" class="" style="">http://lists.idyll.org/pipermail/testing-in-python/attachments/20140804/ff761e2d/attachment.htm</a>&gt;<br class="" style=""><br class="" style="">------------------------------<br class="" style=""><br class="" style="">_______________________________________________<br class="" style="">testing-in-python mailing list<br class="" style=""><a ymailto="mailto:testing-in-python@lists.idyll.org"
 href="mailto:testing-in-python@lists.idyll.org" class="" style="">testing-in-python@lists.idyll.org</a><br class="" style=""><a href="http://lists.idyll.org/listinfo/testing-in-python" target="_blank" class="" style="">http://lists.idyll.org/listinfo/testing-in-python</a><br class="" style=""><br class="" style=""><br class="" style="">End of testing-in-python Digest, Vol 91, Issue 2<br class="" style="">************************************************<br class="" style=""><br class="" style=""><br class="" style=""></div> </div> </div>  </div></body></html>