Skip to content

Commit b5e78e4

Browse files
committed
fixup! #350 Simplify tests with better default env var: APPDATA
1 parent 1de20ba commit b5e78e4

File tree

1 file changed

+16
-6
lines changed

1 file changed

+16
-6
lines changed

tests/test_config.py

Lines changed: 16 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import contextlib
22
import logging
33
import os
4+
import platform
45
import random
56
import re
67
import textwrap
@@ -10,23 +11,32 @@
1011

1112
import pytest
1213

13-
from openeo.config import get_user_config_dir, get_user_data_dir, ClientConfig, ConfigLoader, get_config, \
14-
get_config_option
14+
from openeo.config import (
15+
ClientConfig,
16+
ConfigLoader,
17+
get_config,
18+
get_config_option,
19+
get_user_config_dir,
20+
get_user_data_dir,
21+
)
22+
23+
24+
DATA_ROOT_DIR = Path(__file__).parent / "data"
1525

1626

1727
def test_get_user_config_dir():
1828
if platform.system() == "Windows":
19-
expected = Path(__file__).parent / "data/user_dirs/AppData/Roaming/openeo-python-client"
29+
expected = DATA_ROOT_DIR / "user_dirs/AppData/Roaming/openeo-python-client"
2030
else:
21-
expected = Path(__file__).parent / "data/user_dirs/config/openeo-python-client"
31+
expected = DATA_ROOT_DIR / "user_dirs/config/openeo-python-client"
2232
assert get_user_config_dir() == expected
2333

2434

2535
def test_get_user_data_dir():
2636
if platform.system() == "Windows":
27-
expected = Path(__file__).parent / "data/user_dirs/AppData/Roaming/openeo-python-client"
37+
expected = DATA_ROOT_DIR / "user_dirs/AppData/Roaming/openeo-python-client"
2838
else:
29-
expected = Path(__file__).parent / "data/user_dirs/data/openeo-python-client"
39+
expected = DATA_ROOT_DIR / "user_dirs/data/openeo-python-client"
3040
assert get_user_data_dir() == expected
3141

3242

0 commit comments

Comments
 (0)