ignore rxconfig not in cwd
This commit is contained in:
parent
bffff01acb
commit
1fa0fbeb16
@ -9,6 +9,7 @@ import inspect
|
|||||||
import os
|
import os
|
||||||
import sys
|
import sys
|
||||||
import urllib.parse
|
import urllib.parse
|
||||||
|
from importlib.util import find_spec
|
||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
from typing import (
|
from typing import (
|
||||||
TYPE_CHECKING,
|
TYPE_CHECKING,
|
||||||
@ -810,8 +811,11 @@ def get_config(reload: bool = False) -> Config:
|
|||||||
sys.path.insert(0, os.getcwd())
|
sys.path.insert(0, os.getcwd())
|
||||||
# only import the module if it exists. If a module spec exists then
|
# only import the module if it exists. If a module spec exists then
|
||||||
# the module exists.
|
# the module exists.
|
||||||
spec = importlib.util.find_spec(constants.Config.MODULE) # type: ignore
|
spec = find_spec(constants.Config.MODULE) # type: ignore
|
||||||
if not spec:
|
cwd = Path(os.getcwd())
|
||||||
|
if not spec or (
|
||||||
|
spec.origin is not None and not Path(spec.origin).is_relative_to(cwd)
|
||||||
|
):
|
||||||
# we need this condition to ensure that a ModuleNotFound error is not thrown when
|
# we need this condition to ensure that a ModuleNotFound error is not thrown when
|
||||||
# running unit/integration tests.
|
# running unit/integration tests.
|
||||||
return Config(app_name="")
|
return Config(app_name="")
|
||||||
|
Loading…
Reference in New Issue
Block a user