1 # -*- coding: utf-8 -*-
3 # Copyright (c) 2010-2013 Cidadania S. Coop. Galega
5 # This file is part of e-cidadania.
7 # e-cidadania is free software: you can redistribute it and/or modify
8 # it under the terms of the GNU General Public License as published by
9 # the Free Software Foundation, either version 3 of the License, or
10 # (at your option) any later version.
12 # e-cidadania is distributed in the hope that it will be useful,
13 # but WITHOUT ANY WARRANTY; without even the implied warranty of
14 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 # GNU General Public License for more details.
17 # You should have received a copy of the GNU General Public License
18 # along with e-cidadania. If not, see <http://www.gnu.org/licenses/>.
20 from nose
.plugins
import Plugin
22 from django
.core
import management
26 """Flushes the default test database.
28 management
.call_command('flush', verbosity
=0, interactive
=False)
31 class DatabaseFlushPlugin(Plugin
):
32 """Nose plugin to flush the database after every test.
34 The instances of models generated in one test may cause other tests to fail.
35 So it is necessary to clear the test database after every test.
38 name
= 'DatabaseFlushPlugin'
41 def options(self
, parser
, env
):
42 return Plugin
.options(self
, parser
, env
)
44 def configure(self
, parser
, env
):
45 Plugin
.configure(self
, parser
, env
)
48 def afterTest(self
, test
):