-
-
Notifications
You must be signed in to change notification settings - Fork 56
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Due to mypy, it's not possible to patch the value, so just be lenient…
… in access.
- Loading branch information
Showing
2 changed files
with
7 additions
and
17 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,23 +1,13 @@ | ||
import builtins | ||
import sys | ||
|
||
import pytest | ||
|
||
def pytest_configure(): | ||
add_future_flags() | ||
|
||
class Flags: | ||
warn_default_encoding = 0 | ||
|
||
def __getattr__(self, *args): | ||
return getattr(sys.flags, *args) | ||
|
||
|
||
@pytest.fixture(scope="session") | ||
def monkeysession(): | ||
with pytest.MonkeyPatch.context() as mp: | ||
yield mp | ||
|
||
|
||
@pytest.fixture(scope="session", autouse=True) | ||
def future_flags(monkeysession): | ||
def add_future_flags(): | ||
if sys.version_info > (3, 10): | ||
return | ||
monkeysession.setattr(sys, 'flags', Flags()) | ||
|
||
builtins.EncodingWarning = type('EncodingWarning', (Warning,), {}) |
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