-
Notifications
You must be signed in to change notification settings - Fork 9
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
File encodings can not be defined when opening files for content tests #161
Comments
Another good catch. Currently our use case for pytest-workflow is only on linux where everything is UTF-8 encoded. For frequent platform-hoppers this might be an issue. I will put this on the backlog until somebody reports an actual crash. . Does this cause errors for you at the moment? |
I can imagine pytest-workflow to be useful in a multi-language setting and there someone might have to work with files in various encodings. Having said that the issue arose in a context where a control character popped up in a log file that was tested with a contains clause. Because the control character ('\x14') can not be validly decoded in utf-8, this lead to the test failure although the failing decoding was on a later line that the contains string. |
Okay. I will have a look at it. I want to maintain the current behavior when no encoding is given, but I think it should be easy enough to add an optional |
The latest development version should have the fix. Can you check if the problem still remains? |
Fixed in the newest release 2.0.0. |
It would probably be nice if one could pass file encodings to the tests to make sure the files are read with the right encoding.
The way it is set up now open will infer the encoding with
locale.getpreferredencoding(False)
. However, if a process produces a file in another encoding, tests will inadvertently break.pytest-workflow/src/pytest_workflow/content_tests.py
Line 148 in ef7f312
The text was updated successfully, but these errors were encountered: