Total Complexity | 2 |
Total Lines | 28 |
Duplicated Lines | 0 % |
Changes | 0 |
1 | """Collection of tests around character encodings.""" |
||
2 | import codecs |
||
3 | import locale |
||
4 | import sys |
||
5 | |||
6 | import pytest |
||
7 | |||
8 | PY3 = sys.version_info[0] == 3 |
||
9 | |||
10 | |||
11 | @pytest.mark.skipif(not PY3, reason='Only necessary on Python3') |
||
12 | def test_not_ascii(): |
||
13 | """Make sure that the systems preferred encoding is not `ascii`. |
||
14 | |||
15 | Otherwise `click` is raising a RuntimeError for Python3. For a detailed |
||
16 | description of this very problem please consult the following gist: |
||
17 | https://gist.github.com/hackebrot/937245251887197ef542 |
||
18 | |||
19 | This test also checks that `tox.ini` explicitly copies the according |
||
20 | system environment variables to the test environments. |
||
21 | """ |
||
22 | try: |
||
23 | preferred_encoding = locale.getpreferredencoding() |
||
24 | fs_enc = codecs.lookup(preferred_encoding).name |
||
25 | except Exception: |
||
26 | fs_enc = 'ascii' |
||
27 | assert fs_enc != 'ascii' |
||
28 |