~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to testsweet.py

  • Committer: Robert Collins
  • Date: 2005-08-23 10:44:48 UTC
  • mto: (974.1.50) (1185.1.10) (1092.3.1)
  • mto: This revision was merged to the branch mainline in revision 1139.
  • Revision ID: robertc@robertcollins.net-20050823104448-fb5d448e7a5a8ee3
relace runTest with test_foo in blackbox tests

Show diffs side-by-side

added added

removed removed

Lines of Context:
162
162
        import os
163
163
        self._make_test_root()
164
164
        self._currentdir = os.getcwdu()
165
 
        self.test_dir = os.path.join(self.TEST_ROOT, self.__class__.__name__)
 
165
        self.test_dir = os.path.join(self.TEST_ROOT, self.id())
166
166
        os.mkdir(self.test_dir)
167
167
        os.chdir(self.test_dir)
168
168
        
174
174
    def formcmd(self, cmd):
175
175
        if isinstance(cmd, basestring):
176
176
            cmd = cmd.split()
177
 
 
178
177
        if cmd[0] == 'bzr':
179
178
            cmd[0] = self.BZRPATH
180
179
            if self.OVERRIDE_PYTHON:
181
180
                cmd.insert(0, self.OVERRIDE_PYTHON)
182
 
 
183
181
        self.log('$ %r' % cmd)
184
 
 
185
182
        return cmd
186
183
 
187
 
 
188
184
    def runcmd(self, cmd, retcode=0):
189
185
        """Run one command and check the return code.
190
186
 
199
195
        except ImportError, e:
200
196
            _need_subprocess()
201
197
            raise
202
 
 
203
 
 
204
198
        cmd = self.formcmd(cmd)
205
 
 
206
199
        self.log('$ ' + ' '.join(cmd))
207
200
        actual_retcode = call(cmd, stdout=self.TEST_LOG, stderr=self.TEST_LOG)
208
 
 
209
201
        if retcode != actual_retcode:
210
202
            raise CommandFailed("test failed: %r returned %d, expected %d"
211
203
                                % (cmd, actual_retcode, retcode))
212
204
 
213
 
 
214
205
    def backtick(self, cmd, retcode=0):
215
206
        """Run a command and return its output"""
216
207
        try: