~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/tests/__init__.py

  • Committer: Robert Collins
  • Date: 2007-03-07 01:14:11 UTC
  • mfrom: (2321 +trunk)
  • mto: (2321.1.1 integration)
  • mto: This revision was merged to the branch mainline in revision 2322.
  • Revision ID: robertc@robertcollins.net-20070307011411-0cmmc8atx67v3nv7
Merge bzr.dev.

Show diffs side-by-side

added added

removed removed

Lines of Context:
476
476
                else:
477
477
                    test_root = test_root.encode(
478
478
                        sys.getfilesystemencoding())
479
 
                osutils.rmtree(test_root)
 
479
                try:
 
480
                    osutils.rmtree(test_root)
 
481
                except OSError, e:
 
482
                    if sys.platform == 'win32' and e.errno == errno.EACCES:
 
483
                        print >>sys.stderr, ('Permission denied: '
 
484
                                             'unable to remove testing dir '
 
485
                                             '%s' % os.path.basename(test_root))
 
486
                    else:
 
487
                        raise
480
488
        else:
481
489
            note("Failed tests working directories are in '%s'\n", test_root)
482
490
        TestCaseWithMemoryTransport.TEST_ROOT = None
820
828
        new_env = {
821
829
            'BZR_HOME': None, # Don't inherit BZR_HOME to all the tests.
822
830
            'HOME': os.getcwd(),
823
 
            'APPDATA': os.getcwd(),
 
831
            'APPDATA': None,  # bzr now use Win32 API and don't rely on APPDATA
824
832
            'BZR_EMAIL': None,
825
833
            'BZREMAIL': None, # may still be present in the environment
826
834
            'EMAIL': None,
912
920
                logfile.close()
913
921
            if not keep_log_file:
914
922
                self._log_contents = log_contents
915
 
                os.remove(self._log_file_name)
 
923
                try:
 
924
                    os.remove(self._log_file_name)
 
925
                except OSError, e:
 
926
                    if sys.platform == 'win32' and e.errno == errno.EACCES:
 
927
                        print >>sys.stderr, ('Unable to delete log file '
 
928
                                             ' %r' % self._log_file_name)
 
929
                    else:
 
930
                        raise
916
931
            return log_contents
917
932
        else:
918
933
            return "DELETED log file to reduce memory footprint"
1458
1473
 
1459
1474
    def overrideEnvironmentForTesting(self):
1460
1475
        os.environ['HOME'] = self.test_home_dir
1461
 
        os.environ['APPDATA'] = self.test_home_dir
 
1476
        os.environ['BZR_HOME'] = self.test_home_dir
1462
1477
        
1463
1478
    def setUp(self):
1464
1479
        super(TestCaseWithMemoryTransport, self).setUp()