Merge pull request 'Feature(python-generator): output directory creation' (#37) from feature/ensure-output-dir-exists into main

Reviewed-on: #37
This commit was merged in pull request #37.
This commit is contained in:
jakob.scheid authored and Gitea committed 2026-09-22 17:11:04 +02:00
commit d0ea392f62
3 files changed
+28

No files matched your search

+1
View File
@@ -6,6 +6,7 @@
- CLI for `jcloud-docsgen` that can be called without `python3 -m ...`
- CI pipeline to generate API reference on every push or merge on `main`
- Python generator output directory creation
### Changed
+2
View File
@@ -1124,6 +1124,8 @@ class PythonDocumentationGenerator:
documentation directory.
"""
self.docs_directory.mkdir(parents=True, exist_ok=True)
_generate_package_namespace_documentation(
PythonPackageNamespace('src', self.namespace()),
self.docs_directory,
@@ -16,6 +16,8 @@ import pathlib
import pytest
import tempfile
from src.jcloud_docsgen.core.python import PythonDocumentationGenerator
from src.jcloud_docsgen.core.python.namespaces import (
PythonModuleNamespace,
@@ -119,3 +121,26 @@ def test_generate_documentation(dir, expectdir):
allow_tables=True,
allow_html=False,
).generate_documentation() # simplify the tests
def test_creates_directory():
with tempfile.TemporaryDirectory() as output_dir:
output_dir = pathlib.Path(output_dir)
with tempfile.TemporaryDirectory() as project_dir:
project_dir = pathlib.Path(project_dir)
# The directory of the package
package_dir = project_dir / 'src' / 'pkg'
assert not package_dir.exists()
package_dir.mkdir(parents=True, exist_ok=True)
# The actual output directory directory
docs_dir = output_dir / 'docs' / 'reference'
# It should not exist
assert not docs_dir.exists()
docs_generator = PythonDocumentationGenerator(
project_dir, docs_dir
)
docs_generator.generate_documentation()
assert docs_dir.exists()