diff options
author | Christian Heimes <cheimes@redhat.com> | 2018-11-07 11:52:27 +0100 |
---|---|---|
committer | Christian Heimes <cheimes@redhat.com> | 2018-11-07 13:11:48 +0100 |
commit | 0a5a7bdef7c300cb8f8a8128ce6cf5b115683cbe (patch) | |
tree | b50bde081b4f8dd56acfe3d707116d139aa69186 | |
parent | b8007e14ccf1d49f1c255df6344972fbe040810d (diff) | |
download | freeipa-0a5a7bdef7c300cb8f8a8128ce6cf5b115683cbe.tar.gz freeipa-0a5a7bdef7c300cb8f8a8128ce6cf5b115683cbe.tar.xz freeipa-0a5a7bdef7c300cb8f8a8128ce6cf5b115683cbe.zip |
Fix test_cli_fsencoding on Python 3.7
Starting with Python 3.7, PEP 538 addresses the locale issue. Python now
supports UTF-8 file system encoding with non-UTF-8 C locale.
See: https://docs.python.org/3/whatsnew/3.7.html#whatsnew37-pep538
See: https://pagure.io/freeipa/issue/5887
Signed-off-by: Christian Heimes <cheimes@redhat.com>
Reviewed-By: Alexander Bokovoy <abokovoy@redhat.com>
-rw-r--r-- | ipatests/test_cmdline/test_cli.py | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/ipatests/test_cmdline/test_cli.py b/ipatests/test_cmdline/test_cli.py index d4d2f2b20..056f3e1ec 100644 --- a/ipatests/test_cmdline/test_cli.py +++ b/ipatests/test_cmdline/test_cli.py @@ -340,8 +340,14 @@ def test_cli_fsencoding(): env=env, ) out, err = p.communicate() - assert p.returncode > 0, (out, err) - assert b'System encoding must be UTF-8' in err, (out, err) + + if sys.version_info >= (3, 7): + # Python 3.7+ has PEP 538: Legacy C Locale Coercion + assert p.returncode == 0, (out, err) + else: + # Python 3.6 does not support UTF-8 fs encoding with non-UTF LC + assert p.returncode != 0, (out, err) + assert b'System encoding must be UTF-8' in err, (out, err) IPA_NOT_CONFIGURED = b'IPA is not configured on this system' |