Skip to content

Commit f14c335

Browse files
committed
Added unit tests
1 parent c37e6d7 commit f14c335

File tree

11 files changed

+81
-6
lines changed

11 files changed

+81
-6
lines changed
Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +0,0 @@
1-
"""
2-
Blah blah blah
3-
"""

source/mkdocstrings_python_generator/files_generator.py

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -114,9 +114,6 @@ def discover_python_files(base_dir: Path, source_dir: Path, ignore: List[str]) -
114114
yield from discover_python_files(base_dir, file, ignore)
115115

116116
elif file.is_file() and file.suffix == ".py":
117-
if file.name == "__main__.py":
118-
log.debug(f"Skipping {str(file)} all __main__ entrypoints are ignored")
119-
continue
120117
if not file.read_text().strip():
121118
log.debug(f"Skipping empty file {str(file)} ")
122119
continue

source/tests/conftest.py

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
import pytest
2+
from pathlib import Path
3+
4+
from mkdocstrings_python_generator.files_generator import FilesGenerator
5+
6+
7+
@pytest.fixture(scope='session')
8+
def example_files() -> Path:
9+
return Path(__file__).parent / "example"
10+
11+
12+
@pytest.fixture()
13+
def files_generator(tmp_path: Path) -> FilesGenerator:
14+
generator = FilesGenerator(str(tmp_path / "destination"), use_directory_urls=True)
15+
yield generator
16+
generator.cleanup()

source/tests/example/__init__.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
"""This is not empty"""

source/tests/example/bar.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
"""This is not empty"""

source/tests/example/foo.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
"""This is not empty"""

source/tests/example/sub_package/__init__.py

Whitespace-only changes.
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
"""This is not empty"""
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
"""This is not empty"""
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
"""This is not empty"""

0 commit comments

Comments
 (0)