-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Update
pytest.ini
for EncodingWarning
from external libraries
+ avoid getpreferredencoding when possible
- Loading branch information
Showing
3 changed files
with
23 additions
and
16 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,15 @@ | ||
import locale | ||
import sys | ||
|
||
import pytest | ||
|
||
|
||
__all__ = ['fail_on_ascii'] | ||
|
||
|
||
is_ascii = locale.getpreferredencoding() == 'ANSI_X3.4-1968' | ||
locale_encoding = ( | ||
locale.getencoding() | ||
if sys.version_info >= (3, 11) | ||
else locale.getpreferredencoding(False) | ||
) | ||
is_ascii = locale_encoding == 'ANSI_X3.4-1968' | ||
fail_on_ascii = pytest.mark.xfail(is_ascii, reason="Test fails in this locale") |