This commit is contained in:
Steve Strassmann
2013-04-26 15:25:00 -04:00
parent d9381eccf2
commit 1ca763844b
2 changed files with 16 additions and 8 deletions

View File

@@ -1,11 +1,13 @@
import os import os, polib
from unittest import TestCase from unittest import TestCase
from datetime import datetime from datetime import datetime, timedelta
import polib
import extract import extract
from execute import SOURCE_MSGS_DIR from execute import SOURCE_MSGS_DIR
# Make sure setup runs only once
SETUP_HAS_RUN = False
class TestExtract(TestCase): class TestExtract(TestCase):
""" """
Tests functionality of i18n/extract.py Tests functionality of i18n/extract.py
@@ -13,11 +15,21 @@ class TestExtract(TestCase):
generated_files = ('django-partial.po', 'djangojs.po', 'mako.po') generated_files = ('django-partial.po', 'djangojs.po', 'mako.po')
def setUp(self): def setUp(self):
global SETUP_HAS_RUN
# 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() - timedelta(seconds=1) self.start_time = datetime.now() - timedelta(seconds=1)
super(TestExtract, self).setUp()
if not SETUP_HAS_RUN:
self.run_main()
SETUP_HAS_RUN = True
def run_main(self):
# Run extraction script. Warning, this takes 1 minute or more # Run extraction script. Warning, this takes 1 minute or more
print "***********************"
print "***********************"
print "***********************"
extract.main() extract.main()
def get_files (self): def get_files (self):

View File

@@ -1,11 +1,7 @@
import os import os, string, random
import string
import polib
import random
from unittest import TestCase from unittest import TestCase
from datetime import datetime, timedelta from datetime import datetime, timedelta
import generate import generate
from execute import get_config, messages_dir, SOURCE_MSGS_DIR, SOURCE_LOCALE from execute import get_config, messages_dir, SOURCE_MSGS_DIR, SOURCE_LOCALE