Skip to content

Commit

Permalink
Fix #172 (#174)
Browse files Browse the repository at this point in the history
  • Loading branch information
Alex-Sichkar authored Apr 18, 2020
1 parent 1b6ee7c commit 534a45c
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions split_settings/tools.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
import inspect
import os
import sys
import types
from importlib.util import module_from_spec, spec_from_file_location

__all__ = ('optional', 'include') # noqa: WPS410

Expand Down Expand Up @@ -114,8 +114,10 @@ def include(*args: str, **kwargs) -> None: # noqa: WPS210, WPS231, C901
rel_path[:rel_path.rfind('.')].replace('/', '.'),
)

module = types.ModuleType(str(module_name))
module.__file__ = included_file # noqa: WPS609
spec = spec_from_file_location(
module_name, included_file,
)
module = module_from_spec(spec)
sys.modules[module_name] = module
if saved_included_file:
scope[_INCLUDED_FILE] = saved_included_file
Expand Down

0 comments on commit 534a45c

Please sign in to comment.