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

Unicode support problems (for spec files and in some situations for modules under test) #133

Open
Stvad opened this issue Feb 28, 2019 · 0 comments

Comments

@Stvad
Copy link

Stvad commented Feb 28, 2019

Mamba seems to be trying to read the spec files decoding them using ascii decoder leading to problems when spec file contain any unicode character.

Minimal example to reproduce:

from mamba import description, it

with description("Spec"):
    with it("Should not fail 🤔"):
        pass

This is going to lead to the following error when trying to run it:

Traceback (most recent call last):
  File "/Users/sitalov/Dropbox/SoftwareEngineering/Projects/Anki/CrowdAnki/test/mamba_runner.py", line 3, in <module>
    main()
  File "/Users/sitalov/.local/share/virtualenvs/CrowdAnki-uIF4Vw2q/lib/python3.6/site-packages/mamba/cli.py", line 18, in main
    runner.run()
  File "/Users/sitalov/.local/share/virtualenvs/CrowdAnki-uIF4Vw2q/lib/python3.6/site-packages/mamba/runners.py", line 29, in run
    modules = self.example_collector.modules()
  File "/Users/sitalov/.local/share/virtualenvs/CrowdAnki-uIF4Vw2q/lib/python3.6/site-packages/mamba/example_collector.py", line 25, in modules
    with self._load_module_from(path) as module:
  File "/Users/sitalov/.pyenv/versions/3.6.8/lib/python3.6/contextlib.py", line 81, in __enter__
    return next(self.gen)
  File "/Users/sitalov/.local/share/virtualenvs/CrowdAnki-uIF4Vw2q/lib/python3.6/site-packages/mamba/example_collector.py", line 57, in _load_module_from
    yield self._module_from_ast(name, path)
  File "/Users/sitalov/.local/share/virtualenvs/CrowdAnki-uIF4Vw2q/lib/python3.6/site-packages/mamba/example_collector.py", line 60, in _module_from_ast
    tree = self._parse_and_transform_ast(path)
  File "/Users/sitalov/.local/share/virtualenvs/CrowdAnki-uIF4Vw2q/lib/python3.6/site-packages/mamba/example_collector.py", line 82, in _parse_and_transform_ast
    tree = ast.parse(f.read(), filename=path)
  File "/Users/sitalov/.local/share/virtualenvs/CrowdAnki-uIF4Vw2q/lib/python3.6/encodings/ascii.py", line 26, in decode
    return codecs.ascii_decode(input, self.errors)[0]
UnicodeDecodeError: 'ascii' codec can't decode byte 0xf0 in position 90: ordinal not in range(128)
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

No branches or pull requests

1 participant