1115
1115
:raises AssertionError: If the expected and actual stat values differ
1116
1116
other than by atime.
1118
self.assertEqual(expected.st_size, actual.st_size)
1119
self.assertEqual(expected.st_mtime, actual.st_mtime)
1120
self.assertEqual(expected.st_ctime, actual.st_ctime)
1121
self.assertEqual(expected.st_dev, actual.st_dev)
1122
self.assertEqual(expected.st_ino, actual.st_ino)
1123
self.assertEqual(expected.st_mode, actual.st_mode)
1118
self.assertEqual(expected.st_size, actual.st_size,
1119
'st_size did not match')
1120
self.assertEqual(expected.st_mtime, actual.st_mtime,
1121
'st_mtime did not match')
1122
self.assertEqual(expected.st_ctime, actual.st_ctime,
1123
'st_ctime did not match')
1124
if sys.platform != 'win32':
1125
# On Win32 both 'dev' and 'ino' cannot be trusted. In python2.4 it
1126
# is 'dev' that varies, in python 2.5 (6?) it is st_ino that is
1127
# odd. Regardless we shouldn't actually try to assert anything
1128
# about their values
1129
self.assertEqual(expected.st_dev, actual.st_dev,
1130
'st_dev did not match')
1131
self.assertEqual(expected.st_ino, actual.st_ino,
1132
'st_ino did not match')
1133
self.assertEqual(expected.st_mode, actual.st_mode,
1134
'st_mode did not match')
1125
1136
def assertLength(self, length, obj_with_len):
1126
1137
"""Assert that obj_with_len is of length length."""
2464
2475
return branchbuilder.BranchBuilder(branch=branch)
2466
2477
def overrideEnvironmentForTesting(self):
2467
os.environ['HOME'] = self.test_home_dir
2468
os.environ['BZR_HOME'] = self.test_home_dir
2478
test_home_dir = self.test_home_dir
2479
if isinstance(test_home_dir, unicode):
2480
test_home_dir = test_home_dir.encode(sys.getfilesystemencoding())
2481
os.environ['HOME'] = test_home_dir
2482
os.environ['BZR_HOME'] = test_home_dir
2470
2484
def setUp(self):
2471
2485
super(TestCaseWithMemoryTransport, self).setUp()
3321
3335
if not os.path.isfile(bzr_path):
3322
3336
# We are probably installed. Assume sys.argv is the right file
3323
3337
bzr_path = sys.argv[0]
3338
bzr_path = [bzr_path]
3339
if sys.platform == "win32":
3340
# if we're on windows, we can't execute the bzr script directly
3341
bzr_path = [sys.executable] + bzr_path
3324
3342
fd, test_list_file_name = tempfile.mkstemp()
3325
3343
test_list_file = os.fdopen(fd, 'wb', 1)
3326
3344
for test in process_tests:
3327
3345
test_list_file.write(test.id() + '\n')
3328
3346
test_list_file.close()
3330
argv = [bzr_path, 'selftest', '--load-list', test_list_file_name,
3348
argv = bzr_path + ['selftest', '--load-list', test_list_file_name,
3332
3350
if '--no-plugins' in sys.argv:
3333
3351
argv.append('--no-plugins')