Exemple #1
0
head, tail = os.path.split(PACKAGE_HOME)
if tail == 'tests':
    PACKAGE_HOME = os.path.join(PACKAGE_HOME, '..')

i18ndir = os.path.normpath(PACKAGE_HOME)

tests = []
products = []
pots = {}
pot_catalogs = {}
pot_lens = {}

if HAVE_i18n:

    for potFile in getPotFiles(path=i18ndir):
        product = getProductFromPath(potFile)
        if product not in products:
            products.append(product)
        if product not in pot_catalogs:
            cat = catalog.MessageCatalog(filename=potFile)
            cat_len = len(cat)
            pots.update({product: potFile})
            pot_catalogs.update({product: cat})
            pot_lens.update({product: cat_len})

    for product in products:

        class TestOnePOT(PotTestCase.PotTestCase):
            product = product
            pot = pots[product]
GLOBALS = globals()
PACKAGE_HOME = package_home(GLOBALS)

head, tail = os.path.split(PACKAGE_HOME)
if tail == 'tests':
    PACKAGE_HOME = os.path.join(PACKAGE_HOME, '..')

i18ndir = os.path.normpath(PACKAGE_HOME)

tests=[]
products=[]
pots={}
pot_catalogs={}
pot_lens={}

for potFile in getPotFiles(path=i18ndir):
    product = getProductFromPath(potFile)
    if product not in products:
        products.append(product)
    if product not in pot_catalogs:
        cat = catalog.MessageCatalog(filename=potFile)
        cat_len = len(cat)
        pots.update({product: potFile})
        pot_catalogs.update({product: cat})
        pot_lens.update({product: cat_len})

for product in products:
    class TestOnePOT(PotTestCase.PotTestCase):
        product = product
        pot = pots[product]
    tests.append(TestOnePOT)