From 5a6f89265b547ffa97e32debd8673d4476c137b1 Mon Sep 17 00:00:00 2001 From: Monty Taylor Date: Wed, 6 Feb 2013 17:01:30 +1100 Subject: [PATCH] Use testtools instead of unittest or unittest2. As part of the move towards testr and parallel test running, we start to use testtools and fixtures to make the test suite resilient and more pedantic. Part of blueprint grizzly-testtools Change-Id: I90250de9fe21237db34f6a50b89b15863e270aa5 --- HACKING.rst | 8 +++++++- setup.cfg | 1 - tools/test-requires | 3 ++- 3 files changed, 9 insertions(+), 3 deletions(-) diff --git a/HACKING.rst b/HACKING.rst index 0423c41e1..4333d2568 100644 --- a/HACKING.rst +++ b/HACKING.rst @@ -66,9 +66,9 @@ Example:: import random import StringIO import time - import unittest import eventlet + import testtools import webob.exc import quantum.api.networks @@ -199,6 +199,12 @@ bug that had no unit test, a new passing unit test should be added. If a submitted bug fix does have a unit test, be sure to add a new one that fails without the patch and passes with the patch. +All unittest classes must ultimately inherit from testtools.TestCase. +All setUp and tearDown methods must upcall using the super() method. +tearDown methods should be avoided and addCleanup calls should be preferred. +Never manually create tempfiles. Always use the tempfile fixtures from +the fixture library to ensure that they are cleaned up. + openstack-common ---------------- diff --git a/setup.cfg b/setup.cfg index 565cba388..55e13ead0 100644 --- a/setup.cfg +++ b/setup.cfg @@ -9,7 +9,6 @@ source-dir = doc/source # tissue http://pypi.python.org/pypi/tissue (pep8 checker) # openstack-nose https://github.com/jkoelker/openstack-nose verbosity=2 -detailed-errors=1 cover-package = quantum cover-html = true cover-erase = true diff --git a/tools/test-requires b/tools/test-requires index 0f7f2acd6..d86688ea4 100644 --- a/tools/test-requires +++ b/tools/test-requires @@ -2,6 +2,7 @@ Babel>=0.9.6 cliff coverage distribute>=0.6.24 +fixtures>=0.3.12 mock>=1.0b1 mox==0.5.3 nose @@ -10,7 +11,7 @@ nosexcover openstack.nose_plugin pep8 sphinx>=1.1.2 -unittest2 +testtools>=0.9.27 webtest==1.3.3 # Packages for the Cisco Plugin ###############################