Commit a173270e by Calen Pennington

Fix pylint-identified issues in i18n_tests

parent e7caf9b0
...@@ -28,6 +28,8 @@ class TestGenerate(TestCase): ...@@ -28,6 +28,8 @@ class TestGenerate(TestCase):
@classmethod @classmethod
def setUpClass(cls): def setUpClass(cls):
super(TestGenerate, cls).setUpClass()
sys.stderr.write( sys.stderr.write(
"\nThis test tests that i18n extraction (`paver i18n_extract`) works properly. " "\nThis test tests that i18n extraction (`paver i18n_extract`) works properly. "
"If you experience failures, please check that all instances of `gettext` and " "If you experience failures, please check that all instances of `gettext` and "
...@@ -53,6 +55,8 @@ class TestGenerate(TestCase): ...@@ -53,6 +55,8 @@ class TestGenerate(TestCase):
super(TestGenerate, cls).tearDownClass() super(TestGenerate, cls).tearDownClass()
def setUp(self): def setUp(self):
super(TestGenerate, self).setUp()
# Subtract 1 second to help comparisons with file-modify time succeed, # Subtract 1 second to help comparisons with file-modify time succeed,
# since os.path.getmtime() is not millisecond-accurate # since os.path.getmtime() is not millisecond-accurate
self.start_time = datetime.now(UTC) - timedelta(seconds=1) self.start_time = datetime.now(UTC) - timedelta(seconds=1)
...@@ -83,8 +87,9 @@ class TestGenerate(TestCase): ...@@ -83,8 +87,9 @@ class TestGenerate(TestCase):
path = os.path.join(CONFIGURATION.get_messages_dir(locale), mofile) path = os.path.join(CONFIGURATION.get_messages_dir(locale), mofile)
exists = os.path.exists(path) exists = os.path.exists(path)
self.assertTrue(exists, msg='Missing file in locale %s: %s' % (locale, mofile)) self.assertTrue(exists, msg='Missing file in locale %s: %s' % (locale, mofile))
self.assertTrue( self.assertGreaterEqual(
datetime.fromtimestamp(os.path.getmtime(path), UTC) >= self.start_time, datetime.fromtimestamp(os.path.getmtime(path), UTC),
self.start_time,
msg='File not recently modified: %s' % path msg='File not recently modified: %s' % path
) )
# Segmenting means that the merge headers don't work they way they # Segmenting means that the merge headers don't work they way they
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment