From 74a103d65587de299ef0d17187f65dca41067e1b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tadej=20Borov=C5=A1ak?= Date: Sun, 13 Sep 2020 00:25:10 +0200 Subject: [PATCH] Remove em dash from the pytest configuration file On some systems (tested with official Debian Buster-based Python 3.6 docker image), setting the LC_ALL environment variable to en_US.UTF-8 will trigger Python into switching its preferred encoding to ASCII. If any python process tries to read a non-ASCII file in this scenario, it will terminate with an error. And this is exactly what happens to pytest when it tries to load its configuration that ansible-test supplies because the configuration contains an em dash. In order to bypass this issue, we replaced the em dash with a regular dash and things started working again. An alternative solution would be to replace the en_US.UTF-8 locale with something safer, but unfortunately, the en_US.UTF-8 is probably as safe as it gets. --- .../fragments/71739-remove-em-dash-from-pytest-config.yml | 4 ++++ test/lib/ansible_test/_data/pytest.ini | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) create mode 100644 changelogs/fragments/71739-remove-em-dash-from-pytest-config.yml diff --git a/changelogs/fragments/71739-remove-em-dash-from-pytest-config.yml b/changelogs/fragments/71739-remove-em-dash-from-pytest-config.yml new file mode 100644 index 00000000000..1688b6e95ab --- /dev/null +++ b/changelogs/fragments/71739-remove-em-dash-from-pytest-config.yml @@ -0,0 +1,4 @@ +minor_changes: +- ansible-test - Remove em dash from the Pytest configuration file in order to + be readable on systems where preferred encoding is ASCII. + (https://github.com/ansible/ansible/issues/71739) diff --git a/test/lib/ansible_test/_data/pytest.ini b/test/lib/ansible_test/_data/pytest.ini index 2ac564233c6..c1c38ff786c 100644 --- a/test/lib/ansible_test/_data/pytest.ini +++ b/test/lib/ansible_test/_data/pytest.ini @@ -3,7 +3,7 @@ xfail_strict = true mock_use_standalone_module = true # It was decided to stick with "legacy" (aka "xunit1") for now. # Currently used pytest versions all support xunit2 format too. -# Except the one used under Python 2.6 — it doesn't process this option +# Except the one used under Python 2.6 - it doesn't process this option # at all. Ref: # https://github.com/ansible/ansible/pull/66445#discussion_r372530176 junit_family = xunit1