Skip to content

Commit 7c1cfab

Browse files
committed
refactor tests to remove the embedded git
1 parent 94b9870 commit 7c1cfab

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

46 files changed

+111
-981
lines changed

src/subcommand/commit_subcommand.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
#include <git2.h>
22
#include <unistd.h>
33

4-
#include "commit_subcommand.hpp"
4+
#include "../subcommand/commit_subcommand.hpp"
55
#include "../wrapper/index_wrapper.hpp"
66
#include "../wrapper/repository_wrapper.hpp"
77

test/conftest.py

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
import os
22
from pathlib import Path
33
import pytest
4+
import subprocess
5+
46

57
# Fixture to run test in current tmp_path
68
@pytest.fixture
@@ -15,7 +17,14 @@ def git2cpp_path():
1517
return Path(__file__).parent.parent / 'build' / 'git2cpp'
1618

1719
@pytest.fixture
18-
def rename_git():
19-
os.rename("test/data/status_data/embedded_git/", "test/data/status_data/.git/")
20+
def xtl_clone(git2cpp_path):
21+
url = 'https://github.com/xtensor-stack/xtl.git'
22+
clone_working_dir = 'test/data'
23+
24+
clone_cmd = [git2cpp_path, 'clone', url]
25+
subprocess.run(clone_cmd, capture_output=True, cwd = clone_working_dir, text=True)
26+
2027
yield
21-
os.rename("test/data/status_data/.git/", "test/data/status_data/embedded_git/")
28+
29+
cleanup_cmd = ['rm', '-rf', 'xtl']
30+
subprocess.run(cleanup_cmd, capture_output=True, cwd = clone_working_dir, text=True)

test/data/status_data/embedded_git/COMMIT_EDITMSG

Lines changed: 0 additions & 1 deletion
This file was deleted.

test/data/status_data/embedded_git/HEAD

Lines changed: 0 additions & 1 deletion
This file was deleted.

test/data/status_data/embedded_git/config

Lines changed: 0 additions & 5 deletions
This file was deleted.

test/data/status_data/embedded_git/description

Lines changed: 0 additions & 1 deletion
This file was deleted.

test/data/status_data/embedded_git/hooks/applypatch-msg.sample

Lines changed: 0 additions & 15 deletions
This file was deleted.

test/data/status_data/embedded_git/hooks/commit-msg.sample

Lines changed: 0 additions & 24 deletions
This file was deleted.

test/data/status_data/embedded_git/hooks/fsmonitor-watchman.sample

Lines changed: 0 additions & 174 deletions
This file was deleted.

test/data/status_data/embedded_git/hooks/post-update.sample

Lines changed: 0 additions & 8 deletions
This file was deleted.

0 commit comments

Comments
 (0)