Commit 367abe4c authored by André Anjos's avatar André Anjos 💬

[tests] Use tearDownModule from common to erase test_prefix directory after the end of tests

parent ed3373c8
......@@ -34,10 +34,9 @@ import simplejson as json
from django.contrib.auth.models import User
from django.conf import settings
from beat.web.dataformats.models import DataFormat
from beat.web.common.testutils import BaseTestCase
from beat.web.team.models import Team
from ...dataformats.models import DataFormat
from ...common.testutils import BaseTestCase, tearDownModule
from ...team.models import Team
from ..models import Algorithm
......
......@@ -27,7 +27,8 @@
from django.contrib.auth.models import User
from beat.web.libraries.models import Library
from ...libraries.models import Library
from ...common.testutils import tearDownModule
from ..models import Algorithm
......
......@@ -32,7 +32,8 @@ from django.contrib.auth.models import User
from django.conf import settings
from django.core.urlresolvers import reverse
from beat.web.dataformats.models import DataFormat
from ...dataformats.models import DataFormat
from ...common.testutils import tearDownModule
import beat.core.algorithm
......
......@@ -27,8 +27,9 @@
from django.contrib.auth.models import User
from beat.web.team.models import Team
from beat.web.dataformats.models import DataFormat
from ...team.models import Team
from ...dataformats.models import DataFormat
from ...common.testutils import tearDownModule
from ..models import Algorithm
......
......@@ -29,6 +29,7 @@
from ..models import Algorithm
from .core import AlgorithmsAccessibilityFunctionsBase
from ...common.testutils import tearDownModule
class NotSharedAlgorithm_CheckAccessibilityFunction(AlgorithmsAccessibilityFunctionsBase):
......
......@@ -46,7 +46,7 @@ from ..dataformats.models import DataFormat
from ..toolchains.models import Toolchain
from ..databases.models import Database
from ..common.testutils import BaseTestCase
from ..common.testutils import BaseTestCase, tearDownModule
class AttestationsAPIBase(BaseTestCase):
......
......@@ -40,7 +40,7 @@ from django.test import TestCase
from guardian.shortcuts import get_perms
from ..common.testutils import BaseTestCase as APITestCase
from ..common.testutils import BaseTestCase as APITestCase, tearDownModule
from ..experiments.models import Experiment, Block
from ..algorithms.models import Algorithm
from ..utils.management.commands import install
......@@ -234,13 +234,6 @@ PRIORITY_QUEUES = {
}
def tearDownModule():
if os.path.exists(settings.CACHE_ROOT):
shutil.rmtree(settings.CACHE_ROOT)
if os.path.exists(settings.PREFIX):
shutil.rmtree(settings.PREFIX)
class CancelAllExperimentsAPI(APITestCase):
def setUp(self):
......
......@@ -38,17 +38,17 @@ import simplejson as json
from .models import Shareable
class BaseTestCase(TestCase):
class Meta:
model = None
def tearDownModule():
if os.path.exists(settings.CACHE_ROOT):
shutil.rmtree(settings.CACHE_ROOT)
if os.path.exists(settings.PREFIX):
shutil.rmtree(settings.PREFIX)
def tearDown(self):
if os.path.exists(settings.CACHE_ROOT):
shutil.rmtree(settings.CACHE_ROOT)
if os.path.exists(settings.PREFIX):
shutil.rmtree(settings.PREFIX)
class BaseTestCase(TestCase):
class Meta:
model = None
def checkObjectDBSharingPreferences(self, contribution, reference):
......
......@@ -35,8 +35,8 @@ from django.contrib.auth.models import User
from ..models import DataFormat
from beat.web.team.models import Team
from beat.web.common.testutils import BaseTestCase
from ...team.models import Team
from ...common.testutils import BaseTestCase, tearDownModule
class DataFormatsAccessibilityFunctionsBase(BaseTestCase):
......
......@@ -33,6 +33,8 @@ from django.test import TestCase
from django.conf import settings
from django.contrib.auth.models import User
from ...common.testutils import tearDownModule
from beat.core.dataformat import Storage, DataFormat as CoreDataFormat
from ..models import DataFormat
......
......@@ -32,6 +32,7 @@ from django.contrib.auth.models import User
from django.conf import settings
from django.core.urlresolvers import reverse
from ...common.testutils import tearDownModule
from ..models import DataFormat
from core import DataFormatsAPIBase, DataFormatSharingAPIBase
......
......@@ -28,6 +28,7 @@
from core import DataFormatsAccessibilityFunctionsBase
from ...common.testutils import tearDownModule
from ..models import DataFormat
class NotSharedDataFormat_CheckAccessibilityFunction(DataFormatsAccessibilityFunctionsBase):
......
......@@ -50,7 +50,7 @@ from ..backend.models import Queue
from ..attestations.models import Attestation
from ..databases.models import Database
from ..common.testutils import BaseTestCase
from ..common.testutils import BaseTestCase, tearDownModule
HASHES = {
'addition1': 'ff59a471cec5c17b45d1dfa5aff3ed897ee2d7ed87de205365b372be1c726c87',
......
......@@ -34,10 +34,10 @@ import simplejson as json
from django.contrib.auth.models import User
from django.conf import settings
from beat.web.dataformats.models import DataFormat
from ...dataformats.models import DataFormat
from beat.web.common.testutils import BaseTestCase
from beat.web.team.models import Team
from ...common.testutils import BaseTestCase, tearDownModule
from ...team.models import Team
from ..models import Library
......
......@@ -34,6 +34,8 @@ from django.core.urlresolvers import reverse
import beat.core.library
from ...common.testutils import tearDownModule
from ..models import Library
from .core import LibrariesAPIBase
......
......@@ -27,7 +27,8 @@
from django.contrib.auth.models import User
from beat.web.team.models import Team
from ...common.testutils import tearDownModule
from ...team.models import Team
from ..models import Library
......
......@@ -26,6 +26,8 @@
###############################################################################
from ...common.testutils import tearDownModule
from ..models import Library
from .core import LibrariesAccessibilityFunctionsBase
......
......@@ -47,6 +47,7 @@ from ..plotters.models import Plotter
from ..plotters.models import PlotterParameter
from ..common.models import Shareable
from ..common.testutils import tearDownModule
from ..backend.models import Environment
from ..backend.models import Queue
......
......@@ -34,6 +34,7 @@ from django.contrib.auth.models import User
import simplejson as json
from ..common.testutils import tearDownModule
from .models import Team
from .serializers import SimpleTeamSerializer
......@@ -221,8 +222,8 @@ class TeamAddMemberTestCase(TeamTestCase):
'is_owner': True,
'accessibility': 'public',
'members': [
self.johndoe.username,
self.jackdoe.username,
self.johndoe.username,
]
}
......
......@@ -40,7 +40,7 @@ import beat.core.toolchain
from .models import Toolchain
from ..common.models import Shareable
from ..common.testutils import BaseTestCase
from ..common.testutils import BaseTestCase, tearDownModule
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment