mirror of
https://github.com/jrnl-org/jrnl.git
synced 2025-07-02 23:06:13 +02:00
Move config file unit test to unit test dir and use pytext path fixture instead of current directory to find test data
This commit is contained in:
parent
9d1b8918e1
commit
31354ba669
1 changed files with 9 additions and 4 deletions
|
@ -1,16 +1,21 @@
|
||||||
import pytest
|
import pytest
|
||||||
|
import os
|
||||||
|
|
||||||
from jrnl.install import find_alt_config
|
from jrnl.install import find_alt_config
|
||||||
|
|
||||||
|
|
||||||
def test_find_alt_config():
|
def test_find_alt_config(request):
|
||||||
work_config_path = "features/data/configs/work-config.yaml"
|
work_config_path = os.path.join(
|
||||||
|
request.fspath.dirname, "..", "data", "configs", "basic_onefile.yaml"
|
||||||
|
)
|
||||||
found_alt_config = find_alt_config(work_config_path)
|
found_alt_config = find_alt_config(work_config_path)
|
||||||
assert found_alt_config == work_config_path
|
assert found_alt_config == work_config_path
|
||||||
|
|
||||||
|
|
||||||
def test_find_alt_config_not_exist():
|
def test_find_alt_config_not_exist(request):
|
||||||
bad_config_path = "features/data/configs/not-existing-config.yaml"
|
bad_config_path = os.path.join(
|
||||||
|
request.fspath.dirname, "..", "data", "configs", "not-existing-config.yaml"
|
||||||
|
)
|
||||||
with pytest.raises(SystemExit) as ex:
|
with pytest.raises(SystemExit) as ex:
|
||||||
found_alt_config = find_alt_config(bad_config_path)
|
found_alt_config = find_alt_config(bad_config_path)
|
||||||
assert found_alt_config is not None
|
assert found_alt_config is not None
|
Loading…
Add table
Add a link
Reference in a new issue