Skip to content
This repository has been archived by the owner on Mar 18, 2022. It is now read-only.

Commit

Permalink
Better test
Browse files Browse the repository at this point in the history
- Run only on python2
- Mark as fail
  • Loading branch information
stsewd committed Mar 6, 2018
1 parent e856a28 commit 2d0b0e5
Showing 1 changed file with 9 additions and 11 deletions.
20 changes: 9 additions & 11 deletions readthedocs_build/config/test_find.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
import os

import pytest
import six

from .find import find_all, find_one
from ..testing.utils import apply_fs

Expand Down Expand Up @@ -77,16 +80,11 @@ def test_find_multiple_files(tmpdir):
]


@pytest.mark.skipif(not six.PY2, reason='Only for python2')
@pytest.mark.xfail(raises=UnicodeDecodeError)
def test_find_unicode_path(tmpdir):
base_path = os.path.abspath('integration_tests/bad_encode_project')
try:
path = find_one(base_path, ('readthedocs.yml',))
# When python3
assert path == ''
except Exception as e:
# When python2
assert isinstance(e, UnicodeDecodeError)

unicode_base_path = base_path.decode('utf-8')
path = find_one(unicode_base_path, ('readthedocs.yml',))
assert path == ''
unicode_base_path = base_path.decode('utf-8')
path = find_one(unicode_base_path, ('readthedocs.yml',))
assert path == ''
assert False, 'The UnicodeDecodeError was not raised'

0 comments on commit 2d0b0e5

Please sign in to comment.