Skip to content

Commit

Permalink
add the lock file to the project setup
Browse files Browse the repository at this point in the history
  • Loading branch information
amhellmund committed Dec 29, 2024
1 parent d0e9c75 commit bad4eb6
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
3 changes: 3 additions & 0 deletions src/cpp_dev/project/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@
from pathlib import Path
from textwrap import dedent

from cpp_dev.project.lockfile import create_initial_lock_file

from .config import create_project_config
from .constants import compose_include_file, compose_source_file
from .types import ProjectConfig
Expand All @@ -26,6 +28,7 @@ def setup_project(
"""
project_dir = _validate_project_dir(parent_dir, project_config.name)
create_project_config(project_dir, project_config)
create_initial_lock_file(project_dir)
_create_project_files(project_dir, project_config.name)
return project_dir

Expand Down
9 changes: 8 additions & 1 deletion src/tests/cpp_dev/project/test_setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@
from pathlib import Path

from cpp_dev.project.config import load_project_config
from cpp_dev.project.constants import compose_project_config_file, compose_project_lock_file
from cpp_dev.project.lockfile import load_lock_file
from cpp_dev.project.setup import setup_project
from cpp_dev.project.types import ProjectConfig, SemanticVersion

Expand All @@ -29,13 +31,18 @@ def test_setup_project(tmp_path: Path) -> None:
assert project_dir.exists()
assert project_dir == tmp_path / project_config.name

assert (project_dir / "cpp-dev.yaml").exists()
assert compose_project_config_file(project_dir).exists()

config = load_project_config(project_dir)
assert config == project_config

assert len(config.dependencies) == 0
assert len(config.dev_dependencies) == 0
assert len(config.cpd_dependencies) == 0

assert compose_project_lock_file(project_dir).exists()
locked_dependencies = load_lock_file(project_dir)
assert len(locked_dependencies.packages) == 0

assert (project_dir / "include" / project_config.name / f"{project_config.name}.hpp").exists()
assert (project_dir / "src" / f"{project_config.name}.cpp").exists()
Expand Down

0 comments on commit bad4eb6

Please sign in to comment.