~launchpad-results/launchpad-results/trunk

« back to all changes in this revision

Viewing changes to lib/lpresults/storage/testing/cases.py

  • Committer: Marc Tardif
  • Date: 2012-03-21 22:32:04 UTC
  • Revision ID: marc.tardif@canonical.com-20120321223204-8g7mvzzwmh8ifbrt
Added support for getting systems from a person (LP #899361)

Show diffs side-by-side

added added

removed removed

Lines of Context:
18
18
 
19
19
class TempfileTestCase(unittest.TestCase):
20
20
 
21
 
    def __init__(self, *args, **kwargs):
22
 
        super(TempfileTestCase, self).__init__(*args, **kwargs)
 
21
    def setUp(self):
 
22
        super(TempfileTestCase, self).setUp()
23
23
 
24
24
        self._tempfiles = []
25
25
 
 
26
    def tearDown(self):
 
27
        super(TempfileTestCase, self).tearDown()
 
28
 
 
29
        for path in self._tempfiles:
 
30
            if os.path.isfile(path):
 
31
                os.unlink(path)
 
32
            elif os.path.isdir(path):
 
33
                shutil.rmtree(path)
 
34
 
26
35
    def makeFile(
27
36
        self, prefix="tmp", suffix="", basename=None,
28
37
        dirname=None, path=None, content=None):
66
75
        self._tempfiles.append(path)
67
76
        return path
68
77
 
69
 
    def tearDown(self):
70
 
        super(TempfileTestCase, self).tearDown()
71
 
 
72
 
        for path in self._tempfiles:
73
 
            if os.path.isfile(path):
74
 
                os.unlink(path)
75
 
            elif os.path.isdir(path):
76
 
                shutil.rmtree(path)
77
 
 
78
78
 
79
79
class TestCase(TempfileTestCase):
80
80