Skip to content

Commit

Permalink
Test
Browse files Browse the repository at this point in the history
  • Loading branch information
adrienverge committed Jul 17, 2020
1 parent 8b758d4 commit 8426fdd
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 7 deletions.
1 change: 1 addition & 0 deletions .travis.yml
Expand Up @@ -12,6 +12,7 @@ install:
- pip install pyyaml coveralls flake8 flake8-import-order doc8
- if [[ $TRAVIS_PYTHON_VERSION != 2* ]]; then pip install sphinx; fi
- pip install .
- sudo rm -rf /usr/lib/locale/*
script:
- if [[ $TRAVIS_PYTHON_VERSION != nightly ]]; then flake8 .; fi
- if [[ $TRAVIS_PYTHON_VERSION != 2* ]]; then doc8 $(git ls-files '*.rst'); fi
Expand Down
3 changes: 2 additions & 1 deletion tests/common.py
Expand Up @@ -57,7 +57,8 @@ def build_temp_workspace(files):
tempdir = tempfile.mkdtemp(prefix='yamllint-tests-')

for path, content in files.items():
path = os.path.join(tempdir, path)
path = path if isinstance(path, bytes) else path.encode()
path = os.path.join(tempdir.encode(), path)
if not os.path.exists(os.path.dirname(path)):
os.makedirs(os.path.dirname(path))

Expand Down
26 changes: 20 additions & 6 deletions tests/test_cli.py
Expand Up @@ -86,12 +86,26 @@ def setUpClass(cls):
'no-yaml.json': '---\n'
'key: value\n',
# non-ASCII chars
'non-ascii/éçäγλνπ¥/utf-8': (
u'---\n'
u'- hétérogénéité\n'
u'# 19.99 €\n'
u'- お早う御座います。\n'
u'# الأَبْجَدِيَّة العَرَبِيَّة\n').encode('utf-8'),
# The following bytes work even on systems where C-UTF-8 is not
# available. They are the representation of:
# 'non-ascii/éçäγλνπ¥/utf-8':
# u'---\n'
# u'- hétérogénéité\n'
# u'# 19.99 €\n'
# u'- お早う御座います。\n'
# u'# الأَبْجَدِيَّة العَرَبِيَّة\n'
# b'non-ascii/\xc3\xa9\xc3\xa7\xc3\xa4\xce\xb3\xce\xbb\xce\xbd\xcf'
# b'\x80\xc2\xa5/utf-8': (
u'non-ascii/éçäγλνπ¥/utf-8'.encode('utf-8'): (
b'---\n'
b'- h\xc3\xa9t\xc3\xa9rog\xc3\xa9n\xc3\xa9it\xc3\xa9\n'
b'# 19.99 \xe2\x82\xac\n'
b'- \xe3\x81\x8a\xe6\x97\xa9\xe3\x81\x86\xe5\xbe\xa1\xe5\xba'
b'\xa7\xe3\x81\x84\xe3\x81\xbe\xe3\x81\x99\xe3\x80\x82\n'
b'# \xd8\xa7\xd9\x84\xd8\xa3\xd9\x8e\xd8\xa8\xd9\x92\xd8\xac'
b'\xd9\x8e\xd8\xaf\xd9\x90\xd9\x8a\xd9\x8e\xd9\x91\xd8\xa9 '
b'\xd8\xa7\xd9\x84\xd8\xb9\xd9\x8e\xd8\xb1\xd9\x8e\xd8\xa8\xd9'
b'\x90\xd9\x8a\xd9\x8e\xd9\x91\xd8\xa9\n'),
# dos line endings yaml
'dos.yml': '---\r\n'
'dos: true',
Expand Down

0 comments on commit 8426fdd

Please sign in to comment.