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 22import sys
33import 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
712from lib .global_config import GlobalConfig
813from 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
1116def pytest_addoption (parser ):
1217 parser .addoption ("--name" , action = "store" )
Original file line number Diff line number Diff line change 66# These tests assumes the green-metrics-tool directory lives side by side with the examples-repository
77CURRENT_DIR = os .path .dirname (os .path .abspath (__file__ ))
88ROOT_DIR = os .path .abspath (f"{ CURRENT_DIR } /../" )
9+ GMT_TEST_DIR = os .path .abspath (f"{ CURRENT_DIR } /../../green-metrics-tool/tests" )
10+
911sys .path .append (f"{ CURRENT_DIR } /../../green-metrics-tool" )
1012sys .path .append (f"{ CURRENT_DIR } /../../green-metrics-tool/tools" )
1113sys .path .append (f"{ CURRENT_DIR } /../../green-metrics-tool/lib" )
1719from 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
2224def example_directories ():
2325 example_dirs = []
You can’t perform that action at this time.
0 commit comments