Disable settings for testing
This commit is contained in:
parent
38487a0774
commit
7da372e4a8
|
@ -26,6 +26,11 @@ from toot.exceptions import ApiError, ConsoleError
|
||||||
from toot.output import print_out
|
from toot.output import print_out
|
||||||
|
|
||||||
|
|
||||||
|
def pytest_configure(config):
|
||||||
|
import toot.settings
|
||||||
|
toot.settings.DISABLE_SETTINGS = True
|
||||||
|
|
||||||
|
|
||||||
# Mastodon database name, used to confirm user registration without having to click the link
|
# Mastodon database name, used to confirm user registration without having to click the link
|
||||||
DATABASE_DSN = os.getenv("TOOT_TEST_DATABASE_DSN")
|
DATABASE_DSN = os.getenv("TOOT_TEST_DATABASE_DSN")
|
||||||
|
|
||||||
|
|
|
@ -8,6 +8,8 @@ from toot import get_config_dir
|
||||||
from typing import Optional, Type
|
from typing import Optional, Type
|
||||||
|
|
||||||
|
|
||||||
|
DISABLE_SETTINGS = False
|
||||||
|
|
||||||
TOOT_SETTINGS_FILE_NAME = "settings.toml"
|
TOOT_SETTINGS_FILE_NAME = "settings.toml"
|
||||||
|
|
||||||
|
|
||||||
|
@ -16,6 +18,10 @@ def get_settings_path():
|
||||||
|
|
||||||
|
|
||||||
def load_settings() -> dict:
|
def load_settings() -> dict:
|
||||||
|
# Used for testing without config file
|
||||||
|
if DISABLE_SETTINGS:
|
||||||
|
return {}
|
||||||
|
|
||||||
path = get_settings_path()
|
path = get_settings_path()
|
||||||
|
|
||||||
if not exists(path):
|
if not exists(path):
|
||||||
|
|
Loading…
Reference in New Issue