I have completely shifted to pytest now, but it was standard unittest module that I started, like many others.
Pytest is simple, intuitive and easy to work with but it always have to be installed as an additional package, sometime installing new things is not possible. (like on rigid office installations :()
So for that unittest, the standard package is a good option..
Apart from the usual unittests things, I have found the followings useful for real world unit testing of apps.
Putting them here as a reference
@unittest.skip("NotDef.")
def test_gauss_lobatto_quadrature(self):
pass
@unittest.expectedFailure
def test_mc_orthogonality(self):
super(TestLaguerreAlpha0Function,self).test_mc_orthogonality()
The following decorators and exception implement test skipping and expected failures:
@unittest.skip(reason)
Unconditionally skip the decorated test. reason should describe why the test is being skipped.
@unittest.skipIf(condition, reason)
Skip the decorated test if condition is true.
@unittest.skipUnless(condition, reason)¶
Skip the decorated test unless condition is true.
@unittest.expectedFailure
Mark the test as an expected failure. If the test fails it will be considered a success. If the test passes, it will be considered a failure.
What other things will you add to this list?
Pingback: Two of the Most Important Reason for Testing are … | SukhbinderSingh.com