, ,

Python tests unitaires

Voir aussi:

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 :

#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