Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Unit tests in Python [closed]

Tags:

Does Python have a unit testing framework compatible with the standard xUnit style of test framework? If so, what is it, where is it, and is it any good?

like image 397
Sam McAfee Avatar asked Aug 31 '08 05:08

Sam McAfee


People also ask

Where do Python unit tests go?

unittest discovery will find all test in package folder.

Which item in Python will stop a unit test abruptly?

An exception object is created when a Python script raises an exception. If the script explicitly doesn't handle the exception, the program will be forced to terminate abruptly.

What are unit tests Python?

A unit test is a test that checks a single component of code, usually modularized as a function, and ensures that it performs as expected. Unit tests are an important part of regression testing to ensure that the code still functions as expected after making changes to the code and helps ensure code stability.


1 Answers

Python has several testing frameworks, including unittest, doctest, and nose. The most xUnit-like is unittest, which is documented on Python.org.

  • unittest documentation
  • doctest documentation
like image 191
John Millikin Avatar answered Sep 20 '22 09:09

John Millikin