{{tag>Brouillon Code Python}} = Python tests unitaires Voir aussi: * unittest (moins pratique que pytest) * [[https://medium.com/python-in-plain-english/unit-testing-in-python-tox-and-nox-833e4bbce729]] Source : http://sametmax.com/un-gros-guide-bien-gras-sur-les-tests-unitaires-en-python-partie-3/ Voir aussi les différents types de test : * Tests unitaires (au format unittest ou pytest) : units * Tests d’intégration : integration * Tests syntaxique : sanity #pip3 install pytest apt-get install python3-pytest Voir aussi : Testinfra ''test_plop.py'' #! /usr/bin/python3 # coding: utf-8 #import pytest from func import plop def test_plop(): assert foo == bar pytest-3 == Autre ''~/swift/.unittests'' #!/bin/bash TOP_DIR=$(dirname $(realpath "$0")) cd $TOP_DIR/test/unit nosetests --exe --with-coverage --cover-package swift --cover-erase --cover-branches --cover-html --cover-html-dir="$TOP_DIR"/cover $@ rvalue=$? rm -f .coverage cd - exit $rvalue $ dpkg -S /usr/bin/nosetests python-nose: /usr/bin/nosetests