🚀 Big News: Socket Acquires Coana to Bring Reachability Analysis to Every Appsec Team.Learn more
Socket
DemoInstallSign in
Socket

fullcoverage

Package Overview
Dependencies
Maintainers
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

fullcoverage

Cheat and get 100% test coverage

0.1.0
PyPI
Maintainers
1

fullcoverage — Cheat and get 100% test coverage

|sources| |pypi| |build| |documentation| |license|

.. warning::

In case this is not clear enough: *this module is a joke !* Do not use it. It is not dangerous; it is just useless.

Nowadays, every trendy project has a collection of shiny littel badges. They look great, but they can be hard to get. This modules is here to help you to get the 100 % test coverage badge, without any effort.

.. contents:: :local: :backlinks: none

What's new?

See changelog <https://git.framasoft.org/spalax/fullcoverage/blob/master/CHANGELOG.md>_.

Download and install

  • From sources:

    • Download: https://pypi.python.org/pypi/fullcoverage

    • Install (in a virtualenv, if you do not want to mess with your distribution installation system)::

      python3 setup.py install
      
  • From pip::

    pip install fullcoverage

  • Quick and dirty Debian (and Ubuntu?) package

    This requires stdeb <https://github.com/astraw/stdeb>_ to be installed::

    python3 setup.py --command-packages=stdeb.command bdist_deb
    sudo dpkg -i deb_dist/fullcoverage-<VERSION>_all.deb
    

How-to

Let's say you want to get you module foobar thoroughly covered.

#. Install fullcoverage::

pip install fullcoverage

#. Enable this plugin. That is, in the .coveragerc file of foobar, have the lines::

[run]
plugins = fullcoverage.plugin

#. Optionnaly, if you want to restrict the test report to your module, you can add, in the same .coveragerc file::

[fullcoverage.plugin]
source = foobar

#. If you already have tests that import all of foobar submodules, that's it. Otherwise, somewhere in your tests, have the following lines import everything in your module::

import foobar
import fullcoverage

fullcoverage.import_all(foobar)

#. That's it! You can now run your tests::

coverage run --source foobar -m unittest
coverage report --fail-under=100

Bugs and Limitations

  • This does not work with doctest. Please feel free to send a patch <http://git.framasoft.org/spalax/fullcoverage/issues/new>__.
  • This only works with python 3.5. Please feel free to send a patch <http://git.framasoft.org/spalax/fullcoverage/issues/new>__.
  • Even though tests cover 100 % of your module, it may still contain bugs.

FAQ

  • Isn't it dangerous? Are you running every line of a module to get 100 % test coverage? What if you run a line shutil.rmtree('/') ?

This plugins does not run random line of codes. It imports every plugin that is to be covered, but it cheats coverage into thinking they were thoroughly tested, without testing anything. If your module is safe to import, it is safe to use fullcoverage. If your module is not safe to import, fix your module.

  • If your plugin is so great, why aren't you showing off with one of those 100 % coverage badges?

Well, fullcoverage is hosted on a Gitlab instance <http://git.framasoft.org/spalax/fullcoverage>, which does not provide those badges yet <https://gitlab.com/gitlab-org/gitlab-ce/issues/3714>. But this plugin is implemented to test itself, and it is thoroughly covered by tests <https://git.framasoft.org/spalax/fullcoverage/builds>_.

.. |documentation| image:: http://readthedocs.org/projects/fullcoverage/badge :target: http://fullcoverage.readthedocs.org .. |pypi| image:: https://img.shields.io/pypi/v/fullcoverage.svg :target: http://pypi.python.org/pypi/fullcoverage .. |license| image:: https://img.shields.io/pypi/l/fullcoverage.svg :target: http://www.gnu.org/licenses/gpl-3.0.html .. |sources| image:: https://img.shields.io/badge/sources-fullcoverage-brightgreen.svg :target: http://git.framasoft.org/spalax/fullcoverage .. |build| image:: https://git.framasoft.org/spalax/fullcoverage/badges/master/build.svg :target: https://git.framasoft.org/spalax/fullcoverage/builds

FAQs

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts