File tree Expand file tree Collapse file tree 2 files changed +9
-2
lines changed Expand file tree Collapse file tree 2 files changed +9
-2
lines changed Original file line number Diff line number Diff line change 2
2
import sys
3
3
import pytest
4
4
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
+
5
10
## VERY IMPORTANT to override the config file here
6
11
## otherwise it will automatically connect to non-test DB and delete all your real data
7
12
from lib .global_config import GlobalConfig
8
13
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" )
10
15
11
16
def pytest_addoption (parser ):
12
17
parser .addoption ("--name" , action = "store" )
Original file line number Diff line number Diff line change 6
6
# These tests assumes the green-metrics-tool directory lives side by side with the examples-repository
7
7
CURRENT_DIR = os .path .dirname (os .path .abspath (__file__ ))
8
8
ROOT_DIR = os .path .abspath (f"{ CURRENT_DIR } /../" )
9
+ GMT_TEST_DIR = os .path .abspath (f"{ CURRENT_DIR } /../../green-metrics-tool/tests" )
10
+
9
11
sys .path .append (f"{ CURRENT_DIR } /../../green-metrics-tool" )
10
12
sys .path .append (f"{ CURRENT_DIR } /../../green-metrics-tool/tools" )
11
13
sys .path .append (f"{ CURRENT_DIR } /../../green-metrics-tool/lib" )
17
19
from db import DB
18
20
19
21
#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
21
23
22
24
def example_directories ():
23
25
example_dirs = []
You can’t perform that action at this time.
0 commit comments