1
2 from translate import storage
3
4 import os
5 import os.path
6
7 import py.test
8
9 from translate.storage import statsdb, factory
10 from translate.misc import wStringIO
11 from translate.filters import checks
12 import warnings
13
14 fr_terminology_extract = """
15 msgid ""
16 msgstr ""
17 "Project-Id-Version: GnomeGlossary\n"
18 "POT-Creation-Date: 2002-05-22 23:40+0200\n"
19 "PO-Revision-Date: 2002-05-22 23:38+0200\n"
20 "Last-Translator: Christophe Merlet (RedFox) <christophe@merlet.net>\n"
21 "Language-Team: GNOME French Team <gnomefr@traduc.org>\n"
22 "MIME-Version: 1.0\n"
23 "Content-Type: text/plain; charset=ISO-8859-1\n"
24 "Content-Transfer-Encoding: 8bit\n"
25
26 #. "English Definition"
27 msgid "Term"
28 msgstr "Terme"
29
30 #. "To terminate abruptly a processing activity in a computer system because it is impossible or undesirable for the activity to procees."
31 msgid "abort"
32 msgstr "annuler"
33 """
34
35 jtoolkit_extract = """
36 msgid ""
37 msgstr ""
38 "Project-Id-Version: PACKAGE VERSION\n"
39 "Report-Msgid-Bugs-To: \n"
40 "POT-Creation-Date: 2005-06-13 14:54-0500\n"
41 "PO-Revision-Date: 2007-05-04 19:54+0200\n"
42 "Last-Translator: F Wolff <friedel@translate.org.za>\n"
43 "Language-Team: LANGUAGE <LL@li.org>\n"
44 "MIME-Version: 1.0\n"
45 "Content-Type: text/plain; charset=UTF-8\n"
46 "Content-Transfer-Encoding: 8bit\n"
47 "Plural-Forms: nplurals=2; plural=(n != 1);\n"
48 "X-Generator: Pootle 1.0rc1\n"
49 "Generated-By: pygettext.py 1.5\n"
50
51 #: web/server.py:57
52 #, python-format
53 #, fuzzy
54 msgid "Login for %s"
55 msgstr "Meld aan vir %s"
56
57 #: web/server.py:91
58 msgid "Cancel this action and start a new session"
59 msgstr "Kanselleer hierdie aksie en begin 'n nuwe sessie"
60
61 #: web/server.py:92
62 msgid "Instead of confirming this action, log out and start from scratch"
63 msgstr "Meld af en begin op nuut eerder as om hierdie aksie te bevestig."
64
65 #: web/server.py:97
66 #, fuzzy
67 msgid "Exit application"
68 msgstr "Verlaat toepassing"
69
70 #: web/server.py:98
71 msgid "Exit this application and return to the parent application"
72 msgstr "Verlaat hierdie toepassing en gaan terug na die ouertoepassing"
73
74 #: web/server.py:105
75 msgid ", please confirm login"
76 msgstr ""
77 """
78
80 for dirpath, _, filenames in os.walk(path):
81 for filename in filenames:
82 os.remove(os.path.join(dirpath, filename))
83 os.removedirs(path)
84
87 if os.path.exists(path):
88 rm_rf(path)
89
91 return os.path.realpath("%s_%s" % (self.__class__.__name__, method.__name__))
92
94 """Allocates a unique self.filename for the method, making sure it doesn't exist"""
95 self.path = self.get_test_path(method)
96 self.remove_dirs(self.path)
97 os.makedirs(self.path)
98
100 """Makes sure that if self.filename was created by the method, it is cleaned up"""
101 self.remove_dirs(self.path)
102
109
115
123
128
130 f, cache = self.setup_file_and_db(jtoolkit_extract)
131 s = cache.filestats(f.filename, checks.UnitChecker())
132 assert s['translated'] == [2, 3, 5]
133 assert s['fuzzy'] == [1, 4]
134 assert s['untranslated'] == [6]
135 assert s['total'] == [1, 2, 3, 4, 5, 6]
136
138 cache.cur.execute("""
139 SELECT fileid, st_mtime, st_size FROM files
140 WHERE path=?;""", (os.path.realpath(filename),))
141 return cache.cur.fetchone()
142
147
152
157