Skip to content

Commit 8e5d739

Browse files
committed
Moved to new param for GlobalConfig
1 parent 8608a10 commit 8e5d739

File tree

2 files changed

+9
-2
lines changed

2 files changed

+9
-2
lines changed

test/conftest.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,16 @@
22
import sys
33
import pytest
44

5+
# These tests assumes the green-metrics-tool directory lives side by side with the examples-repository
6+
CURRENT_DIR = os.path.dirname(os.path.abspath(__file__))
7+
ROOT_DIR = os.path.abspath(f"{CURRENT_DIR}/../")
8+
GMT_TEST_DIR = os.path.abspath(f"{CURRENT_DIR}/../../green-metrics-tool/tests")
9+
510
## VERY IMPORTANT to override the config file here
611
## otherwise it will automatically connect to non-test DB and delete all your real data
712
from lib.global_config import GlobalConfig
813
from lib.db import DB
9-
GlobalConfig().override_config(config_name='test-config.yml')
14+
GlobalConfig().override_config(config_location=f"{GMT_TEST_DIR}/test-config.yml")
1015

1116
def pytest_addoption(parser):
1217
parser.addoption("--name", action="store")

test/smoke_test.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@
66
# These tests assumes the green-metrics-tool directory lives side by side with the examples-repository
77
CURRENT_DIR = os.path.dirname(os.path.abspath(__file__))
88
ROOT_DIR = os.path.abspath(f"{CURRENT_DIR}/../")
9+
GMT_TEST_DIR = os.path.abspath(f"{CURRENT_DIR}/../../green-metrics-tool/tests")
10+
911
sys.path.append(f"{CURRENT_DIR}/../../green-metrics-tool")
1012
sys.path.append(f"{CURRENT_DIR}/../../green-metrics-tool/tools")
1113
sys.path.append(f"{CURRENT_DIR}/../../green-metrics-tool/lib")
@@ -17,7 +19,7 @@
1719
from db import DB
1820

1921
#pylint: disable=expression-not-assigned
20-
GlobalConfig(config_name='test-config.yml').config
22+
GlobalConfig(config_location=f"{GMT_TEST_DIR}/test-config.yml").config
2123

2224
def example_directories():
2325
example_dirs = []

0 commit comments

Comments
 (0)