branch = False in .coveragerc ignored

Issue #352 invalid
Victor RENE created an issue

Hi, I used http://nedbatchelder.com/code/coverage/config.html to get a basic feel for how to use the configuration file. I need to support "NotImplementedError" for an abstract class. Before that I was launching nosetests and did not get branch output in the report.

After adding branch = False, I get branch output in the report which is not the expected output, and messes up my post-parsing to sort the coverage by percentage.

Not sure yet where the issue lies, it might be that nose is not compatible with this config file, but something is wrong. I run Python 2.7.9 (on Windows 7-64), coverage 3.7. Any help is appreciated. Regards.

Comments (9)

  1. Victor RENE reporter

    UPDATE: Fixed it by deleting .noseids and .coverage files. It's a caching issue. It's likely that there is no check on a change in .coveragerc to clean up the cached results.

  2. Ned Batchelder repo owner

    @victor-rene Can you provide an example of the wrong output you get? Also, could you add the --debug=config switch to your coverage command and show the output?

  3. Ned Batchelder repo owner

    If you can explain the steps that led to the bad behavior, I'd love to understand it better. Thanks.

  4. Victor RENE reporter

    I already explained everthing but I guess I wasn't clear enough. 1. Generate html output and noseids as normal without using ".coveragerc" > No branch output 2. Create ".coveragerc" with branch = False and generate cover again > Branch output appears despite branch = False 3. Delete ".noseids" and ".coverage" and run again > Branch output disappear As I said above, it's a caching issue. When a ".coveragerc" file is added, cached ".noseids" and ".coverage" files interfere with the config set in ".coveragerc"

  5. Ned Batchelder repo owner

    Feel free to re-open this if you think it is still a problem, and can provide more details.

  6. Ned Batchelder repo owner

    This is what I did to try to reproduce it:

    $ cat > prog.py
    if 1:
      print(2)
    print(3)
    $ coverage run prog.py
    2
    3
    $ coverage html
    $ open htmlcov/index.html
    $ # no branch information in report
    $ cat > .coveragerc
    [run]
    branch = False
    $ coverage run prog.py
    2
    3
    $ coverage html
    $ open htmlcov/index.html
    $ # still no branch information in report
    

    @victor-rene: perhaps you are using the nose coverage plugin? Maybe it is causing your problem.

  7. Ned Batchelder repo owner

    Honestly, I don't know how the nose plugin works, and would rather people didn't use it... :)

  8. Victor RENE reporter

    @ned Alright, I will forward the issue to the nose tracking system. I apologize for confusing responsabilities. You offered great support, many thanks.

  9. Log in to comment