Edgewall Software
Modify

Opened 15 years ago

Closed 15 years ago

#509 closed defect (fixed)

ZeroDivisionError in code coverage calculation if no interesting lines found

Reported by: Felix Schwarz <felix.schwarz@…> Owned by: osimons
Priority: major Milestone: 0.6
Component: Build slave Version: dev
Keywords: Cc: andrea.tomasini@…
Operating System:

Description

[ERROR   ] Internal error in build step 'test'
Traceback (most recent call last):
  File "/usr/lib/python2.4/site-packages/bitten/slave.py", line 328, in _execute_step
    for type, category, generator, output in \
  File "/usr/lib/python2.4/site-packages/bitten/recipe.py", line 228, in execute
    ctxt.run(self, child.namespace, child.name, child.attr)
  File "/usr/lib/python2.4/site-packages/bitten/recipe.py", line 106, in run
    function(self, **args)
  File "/usr/lib/python2.4/site-packages/bitten/build/pythontools.py", line 403, in figleaf
    percentage = int(round(len(covered_lines) * 100 / len(interesting_lines)))
ZeroDivisionError: float division
[WARNING ] Stopping build due to failure 

This happens in a file like this:

# license header

__version__ = '1.0'
__name__ = 'foo'

FOO_VALUE = 42

Interesting lines is 0 but there are some lines in the coverage data.

Attachments (1)

bitten-fix_exception_when_file_contains_no_interesting_lines.patch (584 bytes) - added by Felix Schwarz <felix.schwarz@…> 15 years ago.
skip file if no interesting lines were found

Download all attachments as: .zip

Change History (3)

Changed 15 years ago by Felix Schwarz <felix.schwarz@…>

skip file if no interesting lines were found

comment:1 Changed 15 years ago by osimons

  • Milestone changed from 0.6.1 to 0.6
  • Owner set to osimons

Makes sense. I'll commit the patch.

comment:2 Changed 15 years ago by osimons

  • Resolution set to fixed
  • Status changed from new to closed

Thanks! Committed in [799]. Will merge to 0.6.x.

Add Comment

Modify Ticket

Change Properties
Set your email in Preferences
Action
as closed The owner will remain osimons.
The resolution will be deleted. Next status will be 'reopened'.
Author


E-mail address and user name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.