Skip to content

Commit

Permalink
Bugfix: Collect instances didn't work with Windows paths (#50)
Browse files Browse the repository at this point in the history
* Bugfix: Collect instances didn't work with Windows paths

* Use os.path.sep instead of literals
  • Loading branch information
adrianschneider94 committed May 27, 2021
1 parent 2e9cce2 commit 60e7cbf
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/alembic_utils/experimental/_collect_instances.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import importlib
import os
from pathlib import Path
from types import ModuleType
from typing import Generator, List, Type, TypeVar
Expand Down Expand Up @@ -41,7 +42,7 @@ def walk_modules(module: ModuleType) -> Generator[ModuleType, None, None]:
# Example: elt.settings
module_import_path = str(module_path)[
len(str(top_path)) - len(top_module.__name__) :
].replace("/", ".")[:-3]
].replace(os.path.sep, ".")[:-3]

module = importlib.import_module(module_import_path)
yield module
Expand Down

0 comments on commit 60e7cbf

Please sign in to comment.