~abentley/bzrtools/bzrtools.dev

« back to all changes in this revision

Viewing changes to test.py

  • Committer: Aaron Bentley
  • Date: 2005-12-14 14:33:05 UTC
  • Revision ID: abentley@panoramicfeedback.com-20051214143305-42718d97f27c03bd
Avoided leaving junk all over the place when running standalone tests.

Show diffs side-by-side

added added

removed removed

Lines of Context:
4
4
import sys
5
5
import os.path
6
6
import unittest
 
7
import tempfile
 
8
import shutil
7
9
path_prefix = []
8
10
if len(sys.argv) > 1:
9
11
    if sys.argv[1] in ("-h", "--help", ""):
20
22
    raise
21
23
suite = bzrtools.test_suite()
22
24
runner = unittest.TextTestRunner(verbosity=0)
23
 
result = runner.run(suite)
 
25
tempdir = tempfile.mkdtemp()
 
26
 
 
27
try:
 
28
    os.chdir(tempdir)
 
29
    result = runner.run(suite)
 
30
finally:
 
31
    shutil.rmtree(tempdir)
 
32
 
24
33
sys.exit({True: 0, False: 3}[result.wasSuccessful()])