Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Does not run tests on Python 2 #20

Closed
icemac opened this issue Aug 23, 2019 · 1 comment · Fixed by #21
Closed

Does not run tests on Python 2 #20

icemac opened this issue Aug 23, 2019 · 1 comment · Fixed by #21

Comments

@icemac
Copy link

icemac commented Aug 23, 2019

I stepped in the debugger through find_captures, it did not find a single region on Python 2. So no tests are run.

def find_captures(document):
while True:
regions = document.find_regions(CAPTURE_DIRECTIVE)
if not regions:
break

This is even visible on TravisCI (I activated verbose mode in my fork so the test names are shown):

@icemac
Copy link
Author

icemac commented Aug 23, 2019

I digged a bit deeper into the code and found the actual problem here:

with io.open(abs_path, 'rt', newline=None) as fp:
contents = fp.read()
if not isinstance(contents, str):
# Python 2, we read unicode, but we really need a str
contents = str.encode("utf-8")
document = manuel.Document(
contents, location=abs_path)

On Python 2 the contents are always 'utf-8', see line 187.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant