378
378
# Instead blackbox.test_locale should check for localized
379
379
# dates once they do occur in output strings.
381
def test_format_date_with_offset_in_original_timezone(self):
382
self.assertEqual("Thu 1970-01-01 00:00:00 +0000",
383
osutils.format_date_with_offset_in_original_timezone(0))
384
self.assertEqual("Fri 1970-01-02 03:46:40 +0000",
385
osutils.format_date_with_offset_in_original_timezone(100000))
386
self.assertEqual("Fri 1970-01-02 05:46:40 +0200",
387
osutils.format_date_with_offset_in_original_timezone(100000, 7200))
381
389
def test_local_time_offset(self):
382
390
"""Test that local_time_offset() returns a sane value."""
383
391
offset = osutils.local_time_offset()
1848
1856
class TestConcurrency(tests.TestCase):
1859
super(TestConcurrency, self).setUp()
1860
orig = osutils._cached_local_concurrency
1862
osutils._cached_local_concurrency = orig
1863
self.addCleanup(restore)
1850
1865
def test_local_concurrency(self):
1851
1866
concurrency = osutils.local_concurrency()
1852
1867
self.assertIsInstance(concurrency, int)
1869
def test_local_concurrency_environment_variable(self):
1870
os.environ['BZR_CONCURRENCY'] = '2'
1871
self.assertEqual(2, osutils.local_concurrency(use_cache=False))
1872
os.environ['BZR_CONCURRENCY'] = '3'
1873
self.assertEqual(3, osutils.local_concurrency(use_cache=False))
1874
os.environ['BZR_CONCURRENCY'] = 'foo'
1875
self.assertEqual(1, osutils.local_concurrency(use_cache=False))
1877
def test_option_concurrency(self):
1878
os.environ['BZR_CONCURRENCY'] = '1'
1879
self.run_bzr('rocks --concurrency 42')
1880
# Command line overrides envrionment variable
1881
self.assertEquals('42', os.environ['BZR_CONCURRENCY'])
1882
self.assertEquals(42, osutils.local_concurrency(use_cache=False))
1855
1885
class TestFailedToLoadExtension(tests.TestCase):