Skip to content

Commit

Permalink
fix: dont load user config if running under pytest
Browse files Browse the repository at this point in the history
  • Loading branch information
kraanzu committed Nov 16, 2024
1 parent 8906153 commit f8e6bfc
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion dooit/ui/api/plug.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
from functools import partial
import os
import sys
from functools import partial
from collections import defaultdict
from pathlib import Path
from typing import TYPE_CHECKING, Callable, List, Type
Expand All @@ -24,6 +25,10 @@
DEFAULT_CONFIG = BASE_PATH / "utils" / "default_config.py"


def is_running_under_pytest() -> bool:
return "PYTEST_CURRENT_TEST" in os.environ


class PluginManager:
def __init__(self, api: "DooitAPI") -> None:
self.events: defaultdict[Type[DooitEvent], List[Callable]] = defaultdict(list)
Expand All @@ -33,6 +38,9 @@ def __init__(self, api: "DooitAPI") -> None:

def scan(self):
load_file(self, DEFAULT_CONFIG)
if is_running_under_pytest():
return

load_file(self, CONFIG_FOLDER / "config.py")

def _update_dooit_value(self, obj, *params):
Expand Down

0 comments on commit f8e6bfc

Please sign in to comment.