[Ironpython-users] Code coverage for Ironpython scripts
Anand Kumar
anand.kr.p at gmail.com
Fri May 9 10:53:03 CEST 2014
I am using PTVS along with Visual studio2010 to try coverage.py. I
attached the py files used to try. i got the below exception when i
run mathunittest.py file from VS2010.
Please let me know what should i do to make it work.
<string>:1: DeprecationWarning: object.__new__() takes no parameters
Traceback (most recent call last):
File "<string>", line 4, in <module>
File "C:\Program Files (x86)\IronPython
2.7\lib\site-packages\coverage\control.py", line 403, in start
self.collector.start()
File "C:\Program Files (x86)\IronPython
2.7\lib\site-packages\coverage\collector.py", line 288, in start
threading.settrace(self._installation_trace)
File "C:\Program Files (x86)\IronPython
2.7\lib\site-packages\coverage\collector.py", line 83, in _trace
tracename = self.should_trace(filename, frame)
File "C:\Program Files (x86)\IronPython
2.7\lib\site-packages\coverage\control.py", line 296, in _should_trace
canonical, reason = self._should_trace_with_reason(filename, frame)
File "C:\Program Files (x86)\IronPython
2.7\lib\site-packages\coverage\control.py", line 253, in
_should_trace_with_reason
dunder_file = frame.f_globals.get('__file__')
AttributeError: 'NoneType' object has no attribute 'get'
On Fri, May 9, 2014 at 2:16 PM, Jeff Hardy <jdhardy at gmail.com> wrote:
> On Fri, May 9, 2014 at 5:09 AM, Anand Kumar <anand.kr.p at gmail.com> wrote:
> > Hi,
> > Is there any code coverage tool identified for Iron python? If so please
> let
> > me know the tool. If not, please let me know when it will be available.
>
> I don't know of any that explicitly support it. I'm not sure what
> would be needed to make coverage.py work if it doesn't; I'm not sure
> if it's even been tried.
>
> - Jeff
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/ironpython-users/attachments/20140509/6468a048/attachment.html>
-------------- next part --------------
#import clr
#from System import Math
def CompareMax(a,b):
normalResult = None
if(a==b):
normalResult = 0
elif (a<b):
normalResult = b
else:
normalResult = a
return True
#mathResult = Math.Max(a,b)
#if(normalResult == mathResult):
# return True
#else:
# return False
-------------- next part --------------
import coverage
cov = coverage.coverage()
cov.start()
print "start"
import unittest
from CoverageToolEvaluation import *
class TestMath(unittest.TestCase):
"""description of class"""
def testAequalsB(self):
val = CompareMax(5,5)
self.assertTrue(val,"Math value is not equal")
print "before calling main"
print __name__
if __name__ == "__main__":
print "main"
unittest.main()
print __file__
suite = unittest.TestLoader().loadTestsFromTestCase(TestMath)
unittest.TextTestRunner(verbosity=2).run(suite)
cov.stop()
cov.save()
cov.html_report(directory='covhtml')
print "end"
More information about the Ironpython-users
mailing list