473,666 Members | 2,337 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Problems running coverage.py

Hi,

I am using coverage.py to check the code coverage for some of my Python
scripts.

For a particular script which uses 'exit' calls, I am getting the following
error when I invoke the script with the -x option for coverage.

Error in sys.exitfunc:
Traceback (most recent call last):
File "D:\Python23\li b\atexit.py", line 20, in _run_exitfuncs
func(*targs, **kargs)
File "D:\Python23\Li b\site-packages\covera ge.py", line 207, in save
cache = open(self.cache , 'wb')
TypeError: an integer is required

Looks like coverage.py is not able to record the coverage data on calling
exit.
Does anybody know how to solve this?

Thanks,
Vijay
Jul 18 '05 #1
1 1585

Vijay> For a particular script which uses 'exit' calls, I am getting the
Vijay> following error when I invoke the script with the -x option for
Vijay> coverage.

Vijay> Error in sys.exitfunc:
Vijay> Traceback (most recent call last):
Vijay> File "D:\Python23\li b\atexit.py", line 20, in _run_exitfuncs
Vijay> func(*targs, **kargs)
Vijay> File "D:\Python23\Li b\site-packages\covera ge.py", line 207, in save
Vijay> cache = open(self.cache , 'wb')
Vijay> TypeError: an integer is required

Vijay> Looks like coverage.py is not able to record the coverage data on
Vijay> calling exit. Does anybody know how to solve this?

Just a wild-ass guess, but I suspect there's a module imported like

from somemodule import *

which dumped an "open" symbol into the global namespace, thus hiding the
open() builtin. You might try adding this line

print open

right before the call to open() to see if you're getting the builtin open or
not.

--
Skip Montanaro
Got spam? http://www.spambayes.org/
sk**@pobox.com
Jul 18 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

5
2010
by: Richard Wesley | last post by:
I am using coverage.py to run my unit test suite to check for missing tests. It mostly works, but for some mysterious reason, some of the files can't be found because they are not in the same directory as configure.py and unit_test.py. But only SOME of them. Anyone have any ideas? -- - rmgw
6
2366
by: tjm | last post by:
Pure coverage from Rational is the only coverage tool I've been able to find for C#, and I don't really want to pay what Rational charges for something as simple as a coverage tool. So, I'd like to try to write my own, but I'm having trouble getting started. The way I see it, I need to do the following… 1) Create a debugger object or something similar that will allow me to step through my code. 2) Start a process to run through my...
4
2325
by: O. Zimmermann | last post by:
Hello, I am looking for a tool to process torough UNIT and COVERAGE testing over 60 and more functions of a "critical" embedded application written in C. I found IPL's Cantata++ but we don't seem to really need all the power of this software. I think some other tool out there could provide me with the basic testing I want with less expense. Ease of use (ie. time) is important.
7
3047
by: patrickmee | last post by:
Hi all, The database that our php applications are running on is getting a major clean up. RI will be enforced, normalization and all that good stuff. Our QA department have a set of regression plans but I don't know how complete they are. Neither do they :( My idea would be to have them run through their plans on an application
2
1777
by: Orin | last post by:
Hi, I have a problem in using coverage.py module in my project: ../cov -c Traceback (most recent call last): File "./cov", line 10, in ? coverage.the_coverage.command_line(sys.argv) File "/usr/lib/python2.4/site-packages/coverage.py", line 363, in command_line self.collect() File "/usr/lib/python2.4/site-packages/coverage.py", line 467, in
5
4276
by: ev | last post by:
Hello, We are looking for any testing tool that is capable of checking code coverage for C,C ++ and Java code. Or at least for C and C++. We want to know how much (percentage) of our code written on C/C++ is covered in terms of function calls and line calls. We tried Rational PureCoverage. It's excellent but has some limitations in our case. Any idea would be greatly appreciated.
0
790
by: python | last post by:
Looking for feedback from people using a coverage checking utility. I've found two - wondering if there's any feature that would recommend one of these utilities vs. another (or argue for the use of both utilities). Coverage.py http://nedbatchelder.com/code/modules/coverage.html and Pycover
2
1781
by: Steve | last post by:
Hi guys, I have a test solution (called TP2) which is checked in to a Team Project (also called TP2). The solution contains: * DLL (containing a single test class) * Unit Test project (which trivially tests the class in the DLL) * ASP.NET application (which exposes simple web-service and a single ASPX page, both of which use the class in DLL) * Windows application (which calls the simple web-service above)
2
2298
by: innes | last post by:
I can't find anything on this in the VS2008 help (searching for 'coverage' returns no results). Can anyone confirm that VS2008's code coverage functionality doesnt extend to working on C++/CLI assemblies, apart from the least useful type (/clr:safe)? I think I saw that last detail somewhere on the internet. Thanks.
0
8440
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8352
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8780
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
8549
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8636
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
7378
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6189
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
4358
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
1763
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.