-
Notifications
You must be signed in to change notification settings - Fork 221
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
Step file generated from powershell throws error on collection - not UTF-8 encoded #656
Comments
hi, I don't have a windows installation, please provide a MVCE, together with the generated file as an attachment. |
Create venv in VSCode - Python 3.12.1 (tags/v3.12.1:2305ca5, Dec 7 2023, 22:03:25) [MSC v.1937 64 bit (AMD64)] on win32 |
@youtux I noticed that Should we enforce utf-8, such as:
@Vic152 , does this fix the issue? I'm not a Windows user, so apologies!
|
I don't think that's the issue, but rather that power shell configures the output file from the shell redirection to be encoded in utf16-le by default. Unfortunately i also don't have a windows machine to confirm it. Maybe @Vic152 can confirm? |
Aha! That was my second thought, so hopefully the suggestion I made will resolve it by forcing the output to be UTF8 |
Generate in powershell with: with: pytest-bdd generate features/installer.feature > installer_step_definitions/test_installer_steps.py
Run with: pytest
OBS: During test collection error occurs as below. The same file
test_installer_steps.py
created in VS code and the same code pasted from Notepad++ works.Note: If I create file by hand and overwrite it by auto generated file this happens:
Original encoding
When I convert to UTF-8 it works fine or if I run in cmd
VS Code encoding is UTF-8
ENV:
VS Code
Python 3.12
packages
Package Version
colorama 0.4.6
iniconfig 2.0.0
Mako 1.3.0
MarkupSafe 2.1.3
packaging 23.2
parse 1.19.1
parse-type 0.6.2
pip 23.3.1
pluggy 1.3.0
pytest 7.4.3
pytest-bdd 7.0.0
six 1.16.0
typing_extensions 4.8.0
.venv\Lib\site-packages_pytest\assertion\rewrite.py:359:
The text was updated successfully, but these errors were encountered: