requirements/babel-test/babel-input.py
Andreas Jaeger e3305bf513 Babel Integration tests
With Babel 2.2 and then with Babel 2.3.2 and 2.3.3 releases, the
OpenStack infra scripts broke and uncovered bugs in the upstream
Babel release. The infra scripts run in post and periodic queues, so
failures here are not directly visible. With Babel 2.3.x invalid strings
were send to the translation server, and we had to recover old content
to fix this.

Let's add some Babel integration tests that can be run whenever the
upper-constraints file changes so that any new Babel release will be at
least minimally tested.

The shell script babel-test.sh runs a simple extraction of strings to
translate from a simple input file. It uses the same commands that the
infra scripts run and handles the two different cases of extraction of
the normal strings and extraction of the non-standard log-level strings.

The script then compares the new content with previously created good
content.

Once this change is in, we will run this test whenever
upper-constraints.txt file changes.

Needed-By: I15fa6a706323615d6072d8acaa859fea9bf35883
Change-Id: Iab7844ba748ecd84ec07ad4280b2317bd626fe9a
2016-04-24 17:21:18 -05:00

32 lines
1.0 KiB
Python

# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.
"""Test input for Babel"""
from oslo.i18n import _
from oslo.i18n import _LE
from oslo_log import log as logging
LOG = logging.getLogger(__name__)
def just_testing():
"""Just some random commands for Babel to extract strings from"""
LOG.exception(_LE("LE translated string1"))
LOG.exception(_LE("LE translated string2"))
print(_("Normal translated string1"))
# Translators: Comment for string2
print(_("Normal translated string2"))