/brz/remove-bazaar

To get this branch, use:
bzr branch http://gegoxaren.bato24.eu/bzr/brz/remove-bazaar

« back to all changes in this revision

Viewing changes to bzrlib/tests/__init__.py

  • Committer: Martin von Gagern
  • Date: 2010-04-22 07:18:02 UTC
  • mfrom: (5171 +trunk)
  • mto: This revision was merged to the branch mainline in revision 5240.
  • Revision ID: martin.vgagern@gmx.net-20100422071802-utv4o54js0zyp5xv
mergeĀ fromĀ trunk

Show diffs side-by-side

added added

removed removed

Lines of Context:
489
489
        return self._shortened_test_description(test)
490
490
 
491
491
    def report_error(self, test, err):
492
 
        self.ui.note('ERROR: %s\n    %s\n' % (
 
492
        self.stream.write('ERROR: %s\n    %s\n' % (
493
493
            self._test_description(test),
494
494
            err[1],
495
495
            ))
496
496
 
497
497
    def report_failure(self, test, err):
498
 
        self.ui.note('FAIL: %s\n    %s\n' % (
 
498
        self.stream.write('FAIL: %s\n    %s\n' % (
499
499
            self._test_description(test),
500
500
            err[1],
501
501
            ))
3212
3212
            try:
3213
3213
                ProtocolTestCase.run(self, result)
3214
3214
            finally:
3215
 
                os.waitpid(self.pid, os.WNOHANG)
 
3215
                os.waitpid(self.pid, 0)
3216
3216
 
3217
3217
    test_blocks = partition_tests(suite, concurrency)
3218
3218
    for process_tests in test_blocks:
3276
3276
        bzr_path = [bzr_path]
3277
3277
        if sys.platform == "win32":
3278
3278
            # if we're on windows, we can't execute the bzr script directly
3279
 
            bzr_path = [sys.executable] + bzr_path
 
3279
            # and we have to enable unbuffered binary stdout/stderr so that
 
3280
            # automatic CRLF conversion doesn't corrupt the subunit streams
 
3281
            bzr_path = [sys.executable, '-u'] + bzr_path
3280
3282
        fd, test_list_file_name = tempfile.mkstemp()
3281
3283
        test_list_file = os.fdopen(fd, 'wb', 1)
3282
3284
        for test in process_tests:
4435
4437
            return result
4436
4438
except ImportError:
4437
4439
    pass
 
4440
 
 
4441
class _PosixPermissionsFeature(Feature):
 
4442
 
 
4443
    def _probe(self):
 
4444
        def has_perms():
 
4445
            # create temporary file and check if specified perms are maintained.
 
4446
            import tempfile
 
4447
 
 
4448
            write_perms = stat.S_IRUSR | stat.S_IWUSR | stat.S_IXUSR
 
4449
            f = tempfile.mkstemp(prefix='bzr_perms_chk_')
 
4450
            fd, name = f
 
4451
            os.close(fd)
 
4452
            os.chmod(name, write_perms)
 
4453
 
 
4454
            read_perms = os.stat(name).st_mode & 0777
 
4455
            os.unlink(name)
 
4456
            return (write_perms == read_perms)
 
4457
 
 
4458
        return (os.name == 'posix') and has_perms()
 
4459
 
 
4460
    def feature_name(self):
 
4461
        return 'POSIX permissions support'
 
4462
 
 
4463
posix_permissions_feature = _PosixPermissionsFeature()