Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
- #650 Install pre-commit hooks on rope repository (@lieryan)
- #655 Remove unused __init__() methods (@edreamleo, @lieryan)
- #674 Fix/supress all mypy complaints
- #687 Fix autoimport not scanning packages recursively (@lieryan)


# Release 1.7.0
Expand Down
2 changes: 1 addition & 1 deletion rope/contrib/autoimport/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ def get_files(
yield ModuleFile(package.path, package.path.stem, underlined, False)
else:
assert package.path
for file in package.path.glob("*.py"):
for file in package.path.glob("**/*.py"):
if file.name == "__init__.py":
yield ModuleFile(
file,
Expand Down
12 changes: 12 additions & 0 deletions ropetest/contrib/autoimport/utilstest.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
"""Tests for autoimport utility functions, written in pytest"""

from pathlib import Path

from rope.contrib.autoimport import utils
from rope.contrib.autoimport.defs import Package, PackageType, Source

Expand Down Expand Up @@ -57,3 +59,13 @@ def test_get_package_tuple_compiled(compiled_lib):
assert Package(
lib_name, Source.STANDARD, lib_path, PackageType.COMPILED
) == utils.get_package_tuple(lib_path)


def test_get_files(project, mod1, pkg1, mod2):
root: Package = utils.get_package_tuple(project.root.pathlib)
paths = [m.filepath.relative_to(project.root.pathlib) for m in utils.get_files(root)]
assert set(paths) == {
Path("mod1.py"),
Path("pkg1/__init__.py"),
Path("pkg1/mod2.py"),
}