Si vous constatez la perte de tickets, de commentaires ou de projets, veuillez consulter la page https://status.framasoft.org/incident/626.

Commit 182363b5 authored by Julien Pivotto's avatar Julien Pivotto

Fix (and write) tests

Signed-off-by: Julien Pivotto's avatarJulien Pivotto <roidelapluie@inuits.eu>
parent c18dcbf0
......@@ -30,8 +30,10 @@ class Pox:
return 0
def regen_pofiles(self, generate_pot=True):
logging.debug('Regenerating pofiles')
for dirpath, _, filenames in os.walk('.'):
if 'locale.pot' in filenames:
logging.debug('Found potfiles in %s' % dirpath)
logging.debug('Pot in %s' % dirpath)
potfiles = self.get_pot_files(filenames)
for potfilename in potfiles:
......@@ -48,8 +50,8 @@ class Pox:
subprocess.call(command)
except:
pass
if len(potfiles) > 1:
command = ['msgcat'] + potfiles + ['-o'] + os.path.join(dirpath, 'locale.pot')
if len(potfiles) > 0:
command = ['msgcat'] + potfiles + ['-o', os.path.join(dirpath, 'locale.pot')]
logging.info('Running %s' % ' '.join(command))
subprocess.call(command)
try:
......@@ -60,7 +62,7 @@ class Pox:
pass
pofiles = self.get_po_files(filenames)
for pofile in pofiles:
command = ['msgmerge', '-U', os.path.join(dirpath, pofile), os.path.join(dirpath, 'locale.pot')]
command = ['msgmerge', '--backup=off', '-U', os.path.join(dirpath, pofile), os.path.join(dirpath, 'locale.pot')]
logging.info('Running %s' % ' '.join(command))
subprocess.call(command)
try:
......@@ -69,6 +71,7 @@ class Pox:
subprocess.call(command)
except:
pass
logging.debug('End Of Regenerating pofiles')
def walk_into_dirs(self, generate_pot=False):
os.chdir(self.directory)
......
......@@ -4,7 +4,7 @@ set -e
results=$(mktemp)
exitcode=0
for i in tests/*;
for i in tests/a tests/b tests/c tests/d;
do
name="$(basename $i)"
echo "-------------${name//?/-}"
......@@ -13,7 +13,7 @@ do
echo
tmpdir="$(mktemp -d)"
cp -rv $i/input/ "$tmpdir"
./pox.py "$tmpdir/input"
./pox.py pre-commit "$tmpdir/input"
echo "Comparing $tmpdir/input and $i/output"
if diff -r "$tmpdir/input" "$i/output"
then
......@@ -24,6 +24,26 @@ do
fi
echo
done
for i in tests/e;
do
name="$(basename $i)"
echo "-------------${name//?/-}"
echo "Running test $name"
echo "-------------${name//?/-}"
echo
tmpdir="$(mktemp -d)"
cp -rv $i/input/ "$tmpdir"
./pox.py post-update "$tmpdir/input"
echo "Comparing $tmpdir/input and $i/output"
if diff -I Language:.fr -I POT-Creation-Date -ur "$tmpdir/input" "$i/output"
then
echo -e "Test $(basename $i) \e[1;32mSUCCESS\e[0m" | tee -a "$results"
else
echo -e "Test $(basename $i) \e[1;31mFAILURE\e[0m" | tee -a "$results"
exitcode=1
fi
echo
done
echo "------------"
echo "Test Results"
echo "------------"
......
#, fuzzy
msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2016-07-17 21:07+0200\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"X-Generator: Translate Toolkit 1.13.0\n"
#: index.en.xhtml+html.head.title:3
msgid "This is a test"
msgstr ""
#: index.en.xhtml+html.body.p:6
msgid "This is a test of the ToX project."
msgstr ""
#: index.en.xhtml+html.body.p:7
msgid "This too."
msgstr ""
<html>
<head>
<title>This is a fest</title>
</head>
<body>
<p>This is a test of the ToX project.</p>
<p>This too.</p>
</body>
</html>
msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2016-07-17 21:07+0200\n"
"PO-Revision-Date: 2016-07-17 21:08+0200\n"
"Last-Translator: <roidelapluie@localhost>\n"
"Language-Team: French\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"X-Generator: Translate Toolkit 1.13.0\n"
"Language: fr\n"
"Plural-Forms: nplurals=2; plural=(n > 1);\n"
#: index.en.xhtml+html.head.title:3
msgid "This is a test"
msgstr ""
#: index.en.xhtml+html.body.p:6
msgid "This is a test of the ToX project."
msgstr ""
#: index.en.xhtml+html.body.p:7
msgid "This too."
msgstr ""
#, fuzzy
msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2016-07-17 21:07+0200\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"X-Generator: Translate Toolkit 1.13.0\n"
#: index.en.xhtml+html.head.title:3
msgid "This is a test"
msgstr ""
#: index.en.xhtml+html.body.p:6
msgid "This is a test of the ToX project."
msgstr ""
#: index.en.xhtml+html.body.p:7
msgid "This too."
msgstr ""
#, fuzzy
msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2016-07-17 21:07+0200\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"X-Generator: Translate Toolkit 1.13.0\n"
#: ./index.en.xhtml+html.head.title:3
msgid "This is a fest"
msgstr ""
#: ./index.en.xhtml+html.body.p:6
msgid "This is a test of the ToX project."
msgstr ""
#: ./index.en.xhtml+html.body.p:7
msgid "This too."
msgstr ""
<html>
<head>
<title>This is a fest</title>
</head>
<body>
<p>This is a test of the ToX project.</p>
<p>This too.</p>
</body>
</html>
msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2016-07-17 21:07+0200\n"
"PO-Revision-Date: 2016-07-17 21:08+0200\n"
"Last-Translator: <roidelapluie@localhost>\n"
"Language-Team: French\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"X-Generator: Translate Toolkit 1.13.0\n"
"Language: fr\n"
"Plural-Forms: nplurals=2; plural=(n > 1);\n"
#: index.en.xhtml+html.head.title:3
msgid "This is a fest"
msgstr ""
#: index.en.xhtml+html.body.p:6
msgid "This is a test of the ToX project."
msgstr ""
#: index.en.xhtml+html.body.p:7
msgid "This too."
msgstr ""
#, fuzzy
msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2016-07-17 21:07+0200\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"X-Generator: Translate Toolkit 1.13.0\n"
#: index.en.xhtml+html.head.title:3
msgid "This is a fest"
msgstr ""
#: index.en.xhtml+html.body.p:6
msgid "This is a test of the ToX project."
msgstr ""
#: index.en.xhtml+html.body.p:7
msgid "This too."
msgstr ""
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