generated from jCloud/repository-template
Feat(python-generator): output directory creation #37
No files matched your search
@@ -6,6 +6,7 @@
|
|||||||
|
|
||||||
- CLI for `jcloud-docsgen` that can be called without `python3 -m ...`
|
- CLI for `jcloud-docsgen` that can be called without `python3 -m ...`
|
||||||
- CI pipeline to generate API reference on every push or merge on `main`
|
- CI pipeline to generate API reference on every push or merge on `main`
|
||||||
|
- Python generator output directory creation
|
||||||
|
|
||||||
### Changed
|
### Changed
|
||||||
|
|
||||||
|
|||||||
@@ -1124,6 +1124,8 @@ class PythonDocumentationGenerator:
|
|||||||
documentation directory.
|
documentation directory.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
self.docs_directory.mkdir(parents=True, exist_ok=True)
|
||||||
|
|
||||||
_generate_package_namespace_documentation(
|
_generate_package_namespace_documentation(
|
||||||
PythonPackageNamespace('src', self.namespace()),
|
PythonPackageNamespace('src', self.namespace()),
|
||||||
self.docs_directory,
|
self.docs_directory,
|
||||||
|
|||||||
@@ -16,6 +16,8 @@ import pathlib
|
|||||||
|
|
||||||
import pytest
|
import pytest
|
||||||
|
|
||||||
|
import tempfile
|
||||||
|
|
||||||
from src.jcloud_docsgen.core.python import PythonDocumentationGenerator
|
from src.jcloud_docsgen.core.python import PythonDocumentationGenerator
|
||||||
from src.jcloud_docsgen.core.python.namespaces import (
|
from src.jcloud_docsgen.core.python.namespaces import (
|
||||||
PythonModuleNamespace,
|
PythonModuleNamespace,
|
||||||
@@ -119,3 +121,26 @@ def test_generate_documentation(dir, expectdir):
|
|||||||
allow_tables=True,
|
allow_tables=True,
|
||||||
allow_html=False,
|
allow_html=False,
|
||||||
).generate_documentation() # simplify the tests
|
).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()
|
||||||
Reference in new issue
Block a user