language: python
python:
  - "3.4"
sudo: false
branches:
  only:
    - master
install:
- make develop
- pip install python-coveralls
script:
- make testcov
after_success:
- coveralls
notifications:
    irc:
        channels:
            - "irc.freenode.net#ideascube"
        on_success: change
        on_failure: always
    email: false
addons:
  apt:
    packages:
    - autoconf
    - automake
    - libdbus-glib-1-dev
    - libtool

language: python
python:
  - "3.4"
env:
  - LC_ALL=en_US.UTF-8
  - LC_ALL=C
sudo: false
branches:
  only:
    - master
install:
- make develop
- pip install python-coveralls
script:
- make testcov
after_success:
- coveralls
notifications:
    irc:
        channels:
            - "irc.freenode.net#ideascube"
        on_success: change
        on_failure: always
    email: false
addons:
  apt:
    packages:
    - autoconf
    - automake
    - libdbus-glib-1-dev
    - libtool

Use a non-UTF8 locale to run the tests
Use a non-UTF8 locale to run the tests

The default encoding on Python 3 is the one from the current locale.
This almost always means UTF-8, at least for our target deployment
(Debian Jessie with a UTF-8 locale)

And that's a great thing. It's not necessary to think about encoding
issues most of the time, and that's liberating.

However, BSF manages the boxes in two ways.

The first is to connect to them from their (usually Debian, Ubuntu or
Mint) workstations with SSH, through a bastion. The default
configuration for the SSH client on these OS makes the remote session
use the locale of the local session (usually fr_FR.UTF8).

But on Debian, not all locales are installed by default. This means that
the remote session will try to use a locale (from the local session)
which is not installed on the server.

When that happens, the session falls back to the C locale, for which the
default encoding is ASCII.

The second management method is through a NetworkManager dispatcher
script, which runs ansible-pull to get the latest ansiblecube state and
run it. This also tends to run in a C locale, for which the default
encoding is ASCII.

This means that in Ideascube we can't be our usual lazy Python
developers and assume a UTF-8 encoding. We must instead start specifying
explicitly the correct encoding.

This commit makes sure we run the tests under the C locale, and
therefore with the ASCII default encoding, to catch lots of these
issues.

It won't catch all of them, but it will help us eliminate some of them
and get into the habit of always explicitly specifying the UTF-8
encoding.

And when we find an issue in production which wasn't caught by tests, we
can add more tests to prevent it from coming back.
