From 42212b8cb07cf71adb317cc8fe34cb435136ad44 Mon Sep 17 00:00:00 2001 From: Kevin Veen-Birkenbach Date: Fri, 5 Dec 2025 20:20:33 +0100 Subject: [PATCH] Add Nix configuration defaults and new shallow-clone integration test - Enable 'nix-command' and 'flakes' globally via flake.nix nixConfig - Improve .gitignore by excluding *.log files - Add integration test for shallow clone mode using pkgmgr install pipeline - Ensures pkgmgr works end-to-end inside test container with --clone-mode shallow See: https://chatgpt.com/share/69332bc4-a128-800f-a69c-fdc24c4cc7fe --- .gitignore | 5 +- flake.nix | 4 ++ ...test_integration_install_pkgmgr_shallow.py | 46 +++++++++++++++++++ 3 files changed, 54 insertions(+), 1 deletion(-) create mode 100644 tests/integration/test_integration_install_pkgmgr_shallow.py diff --git a/.gitignore b/.gitignore index a00cab2..f38cda7 100644 --- a/.gitignore +++ b/.gitignore @@ -27,4 +27,7 @@ build/ Thumbs.db # Nix Cache to speed up tests -.nix/ \ No newline at end of file +.nix/ + +# Ignore logs +*.log \ No newline at end of file diff --git a/flake.nix b/flake.nix index f5023fa..4289366 100644 --- a/flake.nix +++ b/flake.nix @@ -1,6 +1,10 @@ { description = "Nix flake for Kevin's package-manager tool"; + nixConfig = { + extra-experimental-features = [ "nix-command" "flakes" ]; + }; + inputs = { nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable"; }; diff --git a/tests/integration/test_integration_install_pkgmgr_shallow.py b/tests/integration/test_integration_install_pkgmgr_shallow.py new file mode 100644 index 0000000..8e04329 --- /dev/null +++ b/tests/integration/test_integration_install_pkgmgr_shallow.py @@ -0,0 +1,46 @@ +""" +Integration test: install all configured repositories using +--clone-mode shallow (HTTPS shallow clone) and --no-verification. + +This test is intended to be run inside the Docker container where: + - network access is available, + - the config/config.yaml is present, + - and it is safe to perform real git operations. + +It passes if the command completes without raising an exception. +""" + +import runpy +import sys +import unittest + + +class TestIntegrationInstallAllShallow(unittest.TestCase): + def test_install_all_repositories_shallow(self): + """ + Run: pkgmgr install --all --clone-mode shallow --no-verification + + This will perform real installations/clones inside the container. + The test succeeds if no exception is raised. + """ + original_argv = sys.argv + try: + sys.argv = [ + "pkgmgr", + "install", + "pkgmgr", + "--clone-mode", + "shallow", + "--no-verification", + ] + + # Execute main.py as if it was called from CLI. + # This will run the full install pipeline inside the container. + runpy.run_module("main", run_name="__main__") + + finally: + sys.argv = original_argv + + +if __name__ == "__main__": + unittest.main()