Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(627)

Side by Side Diff: testing_support/trial_dir.py

Issue 8688011: Move auto_stub.py from commit-queue (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/tools/depot_tools
Patch Set: Created 9 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « testing_support/auto_stub.py ('k') | tests/subprocess2_test.py » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 #!/usr/bin/env python
2 # Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 # Copyright (c) 2011 The Chromium Authors. All rights reserved.
3 # Use of this source code is governed by a BSD-style license that can be 2 # Use of this source code is governed by a BSD-style license that can be
4 # found in the LICENSE file. 3 # found in the LICENSE file.
5 4
6 5
7 import atexit 6 import atexit
8 import logging 7 import logging
9 import os 8 import os
10 import sys 9 import sys
11 import tempfile 10 import tempfile
12 import unittest 11
12 from testing_support import auto_stub
13 13
14 import gclient_utils 14 import gclient_utils
15 15
16 16
17 class TrialDir(object): 17 class TrialDir(object):
18 """Manages a temporary directory. 18 """Manages a temporary directory.
19 19
20 On first object creation, TrialDir.TRIAL_ROOT will be set to a new temporary 20 On first object creation, TrialDir.TRIAL_ROOT will be set to a new temporary
21 directory created in /tmp or the equivalent. It will be deleted on process 21 directory created in /tmp or the equivalent. It will be deleted on process
22 exit unless TrialDir.SHOULD_LEAK is set to True. 22 exit unless TrialDir.SHOULD_LEAK is set to True.
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
72 self.trial.set_up() 72 self.trial.set_up()
73 73
74 def tearDown(self): 74 def tearDown(self):
75 self.trial.tear_down() 75 self.trial.tear_down()
76 76
77 @property 77 @property
78 def root_dir(self): 78 def root_dir(self):
79 return self.trial.root_dir 79 return self.trial.root_dir
80 80
81 81
82 class TestCase(unittest.TestCase, TrialDirMixIn): 82 class TestCase(auto_stub.TestCase, TrialDirMixIn):
83 """Base unittest class that cleans off a trial directory in tearDown().""" 83 """Base unittest class that cleans off a trial directory in tearDown()."""
84 def setUp(self): 84 def setUp(self):
85 unittest.TestCase.setUp(self) 85 auto_stub.TestCase.setUp(self)
86 TrialDirMixIn.setUp(self) 86 TrialDirMixIn.setUp(self)
87 87
88 def tearDown(self): 88 def tearDown(self):
89 TrialDirMixIn.tearDown(self) 89 TrialDirMixIn.tearDown(self)
90 unittest.TestCase.tearDown(self) 90 auto_stub.TestCase.tearDown(self)
91 91
92 92
93 if '-l' in sys.argv: 93 if '-l' in sys.argv:
94 # See SHOULD_LEAK definition in TrialDir for its purpose. 94 # See SHOULD_LEAK definition in TrialDir for its purpose.
95 TrialDir.SHOULD_LEAK = True 95 TrialDir.SHOULD_LEAK = True
96 print 'Leaking!' 96 print 'Leaking!'
97 sys.argv.remove('-l') 97 sys.argv.remove('-l')
OLDNEW
« no previous file with comments | « testing_support/auto_stub.py ('k') | tests/subprocess2_test.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698