From bad4eb6600ba0fc156b4bec2e2965b77bc3cf301 Mon Sep 17 00:00:00 2001 From: Andi Hellmund Date: Sun, 29 Dec 2024 23:52:29 +0100 Subject: [PATCH] add the lock file to the project setup --- src/cpp_dev/project/setup.py | 3 +++ src/tests/cpp_dev/project/test_setup.py | 9 ++++++++- 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/src/cpp_dev/project/setup.py b/src/cpp_dev/project/setup.py index f60432e..eeb27c1 100644 --- a/src/cpp_dev/project/setup.py +++ b/src/cpp_dev/project/setup.py @@ -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 @@ -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 diff --git a/src/tests/cpp_dev/project/test_setup.py b/src/tests/cpp_dev/project/test_setup.py index 31d4c28..f4fc0c2 100644 --- a/src/tests/cpp_dev/project/test_setup.py +++ b/src/tests/cpp_dev/project/test_setup.py @@ -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 @@ -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()