FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

Refactor tests to remove the embedded git by SandrineP · Pull Request #32 · QuantStack/git2cpp · GitHub

Repository navigation

2 changes: 1 addition & 1 deletion src/subcommand/commit_subcommand.cpp
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#include <git2.h>
#include <unistd.h>

#include "commit_subcommand.hpp"
#include "../subcommand/commit_subcommand.hpp"
#include "../wrapper/index_wrapper.hpp"
#include "../wrapper/repository_wrapper.hpp"

Expand Down
22 changes: 19 additions & 3 deletions test/conftest.py
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
import os
from pathlib import Path
import pytest
import subprocess


# Fixture to run test in current tmp_path
@pytest.fixture
Expand All @@ -15,7 +17,21 @@ def git2cpp_path():
return Path(__file__).parent.parent / 'build' / 'git2cpp'

@pytest.fixture
def rename_git():
os.rename("test/data/status_data/embedded_git/", "test/data/status_data/.git/")
def xtl_clone(git2cpp_path):
url = 'https://github.com/xtensor-stack/xtl.git'
clone_working_dir = 'test/data'

clone_cmd = [git2cpp_path, 'clone', url]
subprocess.run(clone_cmd, capture_output=True, cwd = clone_working_dir, text=True)

yield
os.rename("test/data/status_data/.git/", "test/data/status_data/embedded_git/")

cleanup_cmd = ['rm', '-rf', 'xtl']
subprocess.run(cleanup_cmd, capture_output=True, cwd = clone_working_dir, text=True)

@pytest.fixture
def git_config(monkeypatch):
monkeypatch.setenv("GIT_AUTHOR_NAME", "Jane Doe")
monkeypatch.setenv("GIT_AUTHOR_EMAIL", "jane.doe@blabla.com")
monkeypatch.setenv("GIT_COMMITTER_NAME", "Jane Doe")
monkeypatch.setenv("GIT_COMMITTER_EMAIL", "jane.doe@blabla.com")
Empty file.

This file was deleted.

1 change: 0 additions & 1 deletion test/data/status_data/embedded_git/HEAD

This file was deleted.

5 changes: 0 additions & 5 deletions test/data/status_data/embedded_git/config

This file was deleted.

1 change: 0 additions & 1 deletion test/data/status_data/embedded_git/description

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

Loading

Back | FazBrowse Home | New Git URL