@@ -20,6 +20,8 @@ import operator
import os
import re
import git
from pathlib import Path
import pytest
@@ -422,3 +424,19 @@ def test_books_loader():
def test_books_loader_without_books():
assert config_mod.Config().books_loader() is None
def test_books_repo(tmp_path):
repo_path = tmp_path / 'books_repo'
expected = git.Repo.init(repo_path)
config = config_mod.Config()
config.load_string(f'[Beancount]\nbooks dir = {repo_path}')
assert config.books_repo() == expected
def test_books_repo_no_dir():
assert config.books_repo() is None
def test_books_dir_not_repo():
config.load_string(f'[Beancount]\nbooks dir = {os.devnull}')