---
+#---------------------------
+variables:
+ TEST_LOCALES: 'en_US.UTF-8 de_DE.UTF-8'
+
+#---------------------------
.setup-python-environment:
before_script:
- locale -a
echo -e "\e[0Ksection_end:$( date +%s ):install_additional\r\e[0K"
- |
if test -f /etc/locale.gen; then
- echo "/etc/locale.gen:"
- grep -P -v '^\s*(#.*)?$' /etc/locale.gen || true
- echo "<-- EOF"
- fi
- - |
- if grep 'en_US.UTF-8' /etc/locale.gen; then
- sed -i -e 's/# en_US.UTF-8 UTF-8/en_US.UTF-8 UTF-8/' /etc/locale.gen
+ echo "/etc/locale.gen:"
+ grep -P -v '^\s*(#.*)?$' /etc/locale.gen || true
+ echo "<-- EOF"
else
- echo 'en_US.UTF-8 UTF-8' >> /etc/locale.gen
+ echo "Creating /etc/locale.gen ..."
+ echo "en_US.UTF-8 UTF-8" > /etc/locale.gen
fi
- |
- if grep 'de_DE.UTF-8' /etc/locale.gen; then
- sed -i -e 's/# de_DE.UTF-8 UTF-8/de_DE.UTF-8 UTF-8/' /etc/locale.gen
+ echo
+ echo "Configuring locales:"
+ if [[ -n "${TEST_LOCALES}" ]] ; then
+ if echo "${TEST_LOCALES}" | grep -w 'en_US.UTF-8' >/dev/null ; then
+ USED_LOCALES="${TEST_LOCALES}"
+ else
+ USED_LOCALES="en_US.UTF-8 ${TEST_LOCALES}"
+ fi
else
- echo 'de_DE.UTF-8 UTF-8' >> /etc/locale.gen
+ USED_LOCALES="en_US.UTF-8"
fi
+ for locale in ${USED_LOCALES} ; do
+ echo " * ${locale}"
+ if grep -w "${locale}" /etc/locale.gen >/dev/null ; then
+ sed -i -e "s/# *${locale} *UTF-8/${locale} UTF-8/" /etc/locale.gen
+ else
+ echo "${locale} UTF-8" >> /etc/locale.gen
+ fi
+ done
+ echo
+ echo "/etc/locale.gen:"
+ grep -P -v '^\s*(#.*)?$' /etc/locale.gen || true
+ echo "<-- EOF"
- |
echo -e "\e[0Ksection_start:$( date +%s ):locale_gen[collapsed=true]\r\e[0KGenerate locales ..."
locale-gen
---
+#---------------------------
+variables:
+ TEST_LOCALES: 'en_US.UTF-8 de_DE.UTF-8'
+
+#---------------------------
.exec-python-tests:
stage: test
rules:
pip install --upgrade --upgrade-strategy eager pytest
echo -e "\e[0Ksection_end:$( date +%s ):install_pytest\r\e[0K"
- pip list --format columns
- - pytest --verbose
+ - |
+ if [[ -n "${TEST_LOCALES}" ]] ; then
+ if echo "${TEST_LOCALES}" | grep -w 'en_US.UTF-8' >/dev/null ; then
+ USED_LOCALES="${TEST_LOCALES}"
+ else
+ USED_LOCALES="en_US.UTF-8 ${TEST_LOCALES}"
+ fi
+ else
+ USED_LOCALES="en_US.UTF-8"
+ fi
+ for locale in ${USED_LOCALES} ; do
+ echo
+ echo "Executing pytest for locale '${locale}' ..."
+ export LC_ALL="${locale}"
+ export LANG="${locale}"
+ export LANGUAGE=$( echo "${locale}" | cut -d. -f1 )
+ locale
+ echo
+ pytest --verbose
+ done
# vim: et tabstop=2 expandtab shiftwidth=2 softtabstop=2 list