diff options
| author | HiFiPHile <[email protected]> | 2026-09-02 15:34:10 +0200 |
|---|---|---|
| committer | HiFiPHile <[email protected]> | 2026-09-02 15:34:10 +0200 |
| commit | d705b828e2da1eeaceddf6f504cb12778b68a63f (patch) | |
| tree | 638fde9ce89cc1c8bee57fe34c5c8895e2635a74 /test/hil | |
| parent | 4ef2dcfb4695ec9b3241c0cf48f0d1ab736907c7 (diff) | |
fix issue on existing dependency directory without .gitdocs/worktree-reuse-workflow
Signed-off-by: HiFiPHile <[email protected]>
Diffstat (limited to 'test/hil')
| -rw-r--r-- | test/hil/test/test_ci_select.py | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/test/hil/test/test_ci_select.py b/test/hil/test/test_ci_select.py index 22fbde17b..a43348edc 100644 --- a/test/hil/test/test_ci_select.py +++ b/test/hil/test/test_ci_select.py @@ -2598,5 +2598,28 @@ class TestGetDepsExampleShim(unittest.TestCase): self.assertEqual(r.returncode, 0, r.stderr) +class TestGetDepsExistingDirectory(unittest.TestCase): + def test_directory_without_git_metadata_is_initialized(self): + from tempfile import TemporaryDirectory + from unittest import mock + import get_deps + + with TemporaryDirectory() as top: + dep = pathlib.Path(top, 'lib', 'dep') + dep.mkdir(parents=True) + result = subprocess.CompletedProcess([], 0, stdout=b'parent-head\n') + with mock.patch.object(get_deps, 'TOP', pathlib.Path(top)), \ + mock.patch.dict(get_deps.deps_all, + {'lib/dep': ['https://example.invalid/dep.git', + '0123456789abcdef', 'test']}, + clear=True), \ + mock.patch.object(get_deps, 'run_cmd', return_value=result) as run: + self.assertEqual(get_deps.get_a_dep('lib/dep'), 0) + + commands = [call.args[0] for call in run.call_args_list] + self.assertTrue(commands[0].endswith(' init'), commands) + self.assertFalse(any(' reset --hard' in command for command in commands), commands) + + if __name__ == '__main__': unittest.main(verbosity=1) |
