Disable settings for testing

This commit is contained in:
Ivan Habunek 2023-06-28 14:55:28 +02:00
parent 38487a0774
commit 7da372e4a8
No known key found for this signature in database
GPG Key ID: CDBD63C43A30BB95
2 changed files with 11 additions and 0 deletions

View File

@ -26,6 +26,11 @@ from toot.exceptions import ApiError, ConsoleError
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
DATABASE_DSN = os.getenv("TOOT_TEST_DATABASE_DSN")

View File

@ -8,6 +8,8 @@ from toot import get_config_dir
from typing import Optional, Type
DISABLE_SETTINGS = False
TOOT_SETTINGS_FILE_NAME = "settings.toml"
@ -16,6 +18,10 @@ def get_settings_path():
def load_settings() -> dict:
# Used for testing without config file
if DISABLE_SETTINGS:
return {}
path = get_settings_path()
if not exists(path):