<html>
<head>
<meta content="text/html; charset=ISO-8859-1"
http-equiv="Content-Type">
</head>
<body bgcolor="#FFFFFF" text="#000000">
On 8/4/14 3:26 PM, Chris Bannan wrote:<br>
<blockquote
cite="mid:1407180373.32446.YahooMailNeo@web142403.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 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>
</blockquote>
Looks like coverage is running with CPython rather than with Jython
perhaps.<br>
<br>
Details of running coverage under Jython are here:
<a class="moz-txt-link-freetext" href="http://www.jython.org/devguide/coverage.html">http://www.jython.org/devguide/coverage.html</a><br>
<br>
--Ned.<br>
<blockquote
cite="mid:1407180373.32446.YahooMailNeo@web142403.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 class="" style=""> </div>
<div class="" style="">Chris<br class="" style="">
<a class="moz-txt-link-abbreviated" href="mailto:cmbannan@yahoo.com">cmbannan@yahoo.com</a></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 class="" style="" size="1"> <font class="" style=""
face="Arial" size="2"> <b class="" style=""><span
style="font-weight:bold;" class="">From:</span></b>
<a class="moz-txt-link-rfc2396E" href="mailto:testing-in-python-request@lists.idyll.org">"testing-in-python-request@lists.idyll.org"</a>
<a class="moz-txt-link-rfc2396E" href="mailto:testing-in-python-request@lists.idyll.org"><testing-in-python-request@lists.idyll.org></a><br
class="" style="">
<b class="" style=""><span style="font-weight: bold;"
class="">To:</span></b>
<a class="moz-txt-link-abbreviated" href="mailto:testing-in-python@lists.idyll.org">testing-in-python@lists.idyll.org</a> <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 moz-do-not-send="true"
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 moz-do-not-send="true"
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 moz-do-not-send="true"
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 moz-do-not-send="true"
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 moz-do-not-send="true"
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 moz-do-not-send="true"
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 moz-do-not-send="true"
ymailto="mailto:python-list@python.org"
href="mailto:python-list@python.org" class="" style="">python-list@python.org</a>>,
<a moz-do-not-send="true"
ymailto="mailto:simplistix@googlegroups.com"
href="mailto:simplistix@googlegroups.com" class=""
style="">simplistix@googlegroups.com</a><br class=""
style="">
Message-ID: <<a moz-do-not-send="true"
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 moz-do-not-send="true"
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 moz-do-not-send="true"
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 moz-do-not-send="true"
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 moz-do-not-send="true"
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 moz-do-not-send="true"
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 moz-do-not-send="true"
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 moz-do-not-send="true"
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 moz-do-not-send="true"
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 moz-do-not-send="true"
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 moz-do-not-send="true"
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 moz-do-not-send="true"
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 moz-do-not-send="true"
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 moz-do-not-send="true"
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 moz-do-not-send="true"
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 moz-do-not-send="true"
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>
<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>