-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- settings forward - fixed provided instance when using set_instance
- Loading branch information
Showing
7 changed files
with
155 additions
and
26 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,4 +1,4 @@ | ||
# SPDX-FileCopyrightText: 2024-present alex <[email protected]> | ||
# | ||
# SPDX-License-Identifier: BSD-3-Clauses | ||
__version__ = "0.0.7" | ||
__version__ = "0.0.8" |
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
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 |
---|---|---|
@@ -0,0 +1,32 @@ | ||
import sys | ||
from pathlib import Path | ||
|
||
import pytest | ||
|
||
|
||
@pytest.fixture(autouse=True, scope="function") | ||
def cleanup(): | ||
for p in (Path(__file__).parent / "targets").iterdir(): | ||
sys.modules.pop(f"tests.targets.{p.stem}", None) | ||
yield | ||
|
||
|
||
def test_settings_basic(): | ||
import tests.targets.module_full as mod | ||
from tests.targets.settings import Settings, hurray | ||
|
||
new_settings = Settings(preloads=[], extensions=[]) | ||
|
||
old_settings = mod.monkay.settings | ||
settings_path = mod.monkay._settings_definition | ||
assert isinstance(settings_path, str) | ||
assert mod.monkay.settings is old_settings | ||
mod.monkay.settings = new_settings | ||
assert mod.monkay.settings is new_settings | ||
|
||
mod.monkay.settings = lambda: old_settings | ||
assert mod.monkay.settings is old_settings | ||
# auto generated settings | ||
mod.monkay.settings = Settings | ||
mod.monkay.settings = "tests.targets.settings:hurray" | ||
assert mod.monkay.settings is hurray |