mirror of
https://github.com/tahoe-lafs/tahoe-lafs.git
synced 2025-01-19 11:16:24 +00:00
Merge pull request #236 from daira/2725.timezone-test.0
Fix tests on platforms without time.tzset (e.g. Windows)
This commit is contained in:
commit
186f6d4a59
@ -195,6 +195,9 @@ class TimezoneMixin(object):
|
||||
self.addCleanup(restoreTimezone)
|
||||
tzset_if_possible()
|
||||
|
||||
def have_working_tzset(self):
|
||||
return hasattr(time, 'tzset')
|
||||
|
||||
|
||||
try:
|
||||
import win32file
|
||||
|
@ -932,6 +932,10 @@ class TimeFormat(unittest.TestCase, TimezoneMixin):
|
||||
# time_format.iso_utc_time_to_localseconds() breaks if the timezone is
|
||||
# Europe/London. (As soon as this unit test is done then I'll change
|
||||
# that implementation to something that works even in this case...)
|
||||
|
||||
if not self.have_working_tzset():
|
||||
raise unittest.SkipTest("This test can't be run on a platform without time.tzset().")
|
||||
|
||||
self.setTimezone("Europe/London")
|
||||
return self._help_test_epoch()
|
||||
|
||||
|
@ -634,10 +634,25 @@ class Web(WebMixin, WebErrorMixin, testutil.StallMixin, testutil.ReallyEqualMixi
|
||||
self.failUnlessIn(u'<td>fake_nickname \u263A</td>', res_u)
|
||||
self.failUnlessIn(u'<div class="nickname">other_nickname \u263B</div>', res_u)
|
||||
self.failUnlessIn(u'Connected to <span>1</span>\n of <span>2</span> known storage servers', res_u)
|
||||
self.failUnless(re.search(u'<div class="status-indicator"><img (src="img/connected-yes.png" |alt="Connected" ){2}/></div>\n <a( class="timestamp"| title="1970-01-01 13:00:10"){2}>1d\u00A00h\u00A00m\u00A050s</a>', res_u), repr(res_u))
|
||||
self.failUnless(re.search(u'<div class="status-indicator"><img (src="img/connected-no.png" |alt="Disconnected" ){2}/></div>\n <a( class="timestamp"| title="1970-01-01 13:00:25"){2}>1d\u00A00h\u00A00m\u00A035s</a>', res_u), repr(res_u))
|
||||
self.failUnless(re.search(u'<td class="service-last-received-data"><a( class="timestamp"| title="1970-01-01 13:00:30"){2}>1d\u00A00h\u00A00m\u00A030s</a></td>', res_u), repr(res_u))
|
||||
self.failUnless(re.search(u'<td class="service-last-received-data"><a( class="timestamp"| title="1970-01-01 13:00:35"){2}>1d\u00A00h\u00A00m\u00A025s</a></td>', res_u), repr(res_u))
|
||||
def timestamp(t):
|
||||
return (u'"%s"' % (t,)) if self.have_working_tzset() else u'"[^"]*"'
|
||||
self.failUnless(re.search(
|
||||
u'<div class="status-indicator"><img (src="img/connected-yes.png" |alt="Connected" ){2}/>'
|
||||
u'</div>\n <a( class="timestamp"| title=%s){2}>1d\u00A00h\u00A00m\u00A050s</a>'
|
||||
% timestamp(u'1970-01-01 13:00:10'), res_u), repr(res_u))
|
||||
self.failUnless(re.search(
|
||||
u'<div class="status-indicator"><img (src="img/connected-no.png" |alt="Disconnected" ){2}/>'
|
||||
u'</div>\n <a( class="timestamp"| title=%s){2}>1d\u00A00h\u00A00m\u00A035s</a>'
|
||||
% timestamp(u'1970-01-01 13:00:25'), res_u), repr(res_u))
|
||||
self.failUnless(re.search(
|
||||
u'<td class="service-last-received-data"><a( class="timestamp"| title=%s){2}>'
|
||||
u'1d\u00A00h\u00A00m\u00A030s</a></td>'
|
||||
% timestamp(u'1970-01-01 13:00:30'), res_u), repr(res_u))
|
||||
self.failUnless(re.search(
|
||||
u'<td class="service-last-received-data"><a( class="timestamp"| title=%s){2}>'
|
||||
u'1d\u00A00h\u00A00m\u00A025s</a></td>'
|
||||
% timestamp(u'1970-01-01 13:00:35'), res_u), repr(res_u))
|
||||
|
||||
self.failUnlessIn(u'\u00A9 <a href="https://tahoe-lafs.org/">Tahoe-LAFS Software Foundation', res_u)
|
||||
self.failUnlessIn('<td><h3>Available</h3></td>', res)
|
||||
self.failUnlessIn('123.5kB', res)
|
||||
|
Loading…
Reference in New Issue
Block a user