28

I have already visited Preferred Python unit-testing framework. I am not just looking at Python Unit Testing Framework, but also code coverage with respect to unit tests. So far I have only come across coverage.py. Is there any better option?

An interesting option for me is to integrate cpython, unit testing of Python code and code coverage of Python code with Visual Studio 2008 through plugins (something similar to IronPython Studio). What can be done to achieve this? I look forward to suggestions.

3
  • 6
    Maybe you could define "better". What do you want to do that coverage.py doesn't do? How do you need it to be better? Commented Nov 7, 2008 at 16:06
  • I was referring to Limitations (section 4 of nedbatchelder.com/code/modules/rees-coverage.html) when I mentioned "better". Commented Nov 9, 2008 at 15:15
  • 1
    I'd add that integration of coverage.py with IDEs (Eclipse, in my particular case) would be great. Commented Nov 11, 2008 at 22:17

7 Answers 7

5

We use this Django coverage integration, but instead of using the default coverage.py reporting, we generate some simple HTML: Colorize Python source using the built-in tokenizer.

Sign up to request clarification or add additional context in comments.

Comments

4

PyDev seems to allow code coverage from within Eclipse.

I've yet to find how to integrate that with my own (rather complex) build process, so I use Ned Batchelder's coverage.py at the command line.

1 Comment

2

There is also figleaf which I think is based on Ned Batchelder's coverage.py. We use nose as the driver for the testing. It all works pretty well. We write our unit tests using the built-in unittest and doctest modules.

Comments

2

NetBeans' new Python support has tightly integrated code coverage support - more info here.

Comments

1

If you want interactive code coverage, where you can see your coverage stats change in real time, take a look at Python Coverage Validator.

Comments

0

Testoob has a neat "--coverage" command-line option to generate a coverage report.

3 Comments

Orip, which branch of Testoob has the --coverage option? I've 1.13 release currently installed, but it doesn't seem to have that option there. Cheers H
Ah, ignore that. Wasn't reading the docs correctly. For other interested parties, use the following syntax: testoob --coverage=normal test_file.py types of coverage are silent, slim, normal, massive, or xml
@howard: glad you like it :) There's a new version with some coverage improvements coming out soon.
0

PyCharm has a feature to see coverage: https://www.jetbrains.com/help/pycharm/coverage-settings.html:

enter image description here

To run with coverage:

enter image description here

Result:

File coverage:

enter image description here

Branch coverage:

enter image description here

Tested with PyCharm 2023.3.1.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.