<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. 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>coverage run TestClassForName.py</div><div style="background-color: transparent;"
class="">Traceback (most recent call last):</div><div style="background-color: transparent;" class=""> File "TestClassForName.py", line 6, in <module></div><div style="background-color: transparent;" class=""> 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=""> </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" <testing-in-python-request@lists.idyll.org><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=""> <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=""> <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=""> <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=""> <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=""> 1. testfixtures 4.0.1 Released! (Chris Withers)<br class="" style=""> 2. Cannot run coverage.exe against the jython (Chris Bannan)<br class="" style=""> 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 <<a ymailto="mailto:chris@simplistix.co.uk" href="mailto:chris@simplistix.co.uk" class="" style="">chris@simplistix.co.uk</a>><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=""> <<a ymailto="mailto:python-list@python.org" href="mailto:python-list@python.org" class="" style="">python-list@python.org</a>>, <a ymailto="mailto:simplistix@googlegroups.com" href="mailto:simplistix@googlegroups.com" class="" style="">simplistix@googlegroups.com</a><br class="" style="">Message-ID: <<a ymailto="mailto:53DF71E1.8050506@simplistix.co.uk" href="mailto:53DF71E1.8050506@simplistix.co.uk" class="" style="">53DF71E1.8050506@simplistix.co.uk</a>><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=""> were used.<br class="" style=""><br class="" style="">- Fix bug when strictly comparing two nested structures containing<br class="" style=""> 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 & Python Consulting<br class="" style=""> - <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 <<a ymailto="mailto:cmbannan@yahoo.com" href="mailto:cmbannan@yahoo.com" class="" style="">cmbannan@yahoo.com</a>><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=""> <<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:<br class="" style=""> <<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>><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=""> 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=""><code><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=""></code><br class="" style="">-------------- next part --------------<br class="" style="">An HTML attachment was scrubbed...<br class="" style="">URL: <<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>><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 <<a ymailto="mailto:ned@nedbatchelder.com" href="mailto:ned@nedbatchelder.com" class="" style="">ned@nedbatchelder.com</a>><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: <<a ymailto="mailto:53DFA449.2090002@nedbatchelder.com" href="mailto:53DFA449.2090002@nedbatchelder.com" class="" style="">53DFA449.2090002@nedbatchelder.com</a>><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="">> I am a consultant working on some python testing tools for a Java <br class="" style="">> Application.<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 <br class="" style="">> using Jython.<br class="" style="">> But, I am struggling how to get code coverage data for the <br class="" style="">> jython/python code.<br class="" style="">><br class="" style="">> My command line for executing the Unit test is<br class="" style="">> java -cp \jython2.7b2\jython.jar org.python.util.jython
<br class="" style="">> 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=""><br class="" style="">You show the command you're running, but you haven't shown what <br class="" style="">happens. How doesn't it work?<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="">> C Bannan<br class="" style="">><br class="" style="">><br class="" style="">> <code><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="">> </code><br class="" style="">><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="">-------------- next part --------------<br class="" style="">An HTML attachment was scrubbed...<br class="" style="">URL: <<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>><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>