# Path: lcopt/data_store.py
# class LcoptStorage():
#     def __init__(self):
#     def load_config(self):
#     def refresh(self):
#     def write_default_config(self):
#     def write_config(self, config):
#     def models(self):
#     def search_indices(self):
#     def project_type(self):
#     def single_project_name(self):
#     def ecoinvent_version(self):
#     def ecoinvent_system_model(self):
#     def save_option(self):
# 
# Path: lcopt/constants.py
# DEFAULT_BIOSPHERE_PROJECT = "LCOPT_Setup_biosphere"
# 
# Path: lcopt/utils.py
# def bw2_project_exists(project_name):
#     return project_name in bw2.projects


import pytest
import os
import brightway2 as bw2
import yaml
from lcopt.data_store import storage
from copy import deepcopy
from lcopt.constants import DEFAULT_BIOSPHERE_PROJECT
from lcopt.utils import bw2_project_exists

#print(storage.config_file)

#with open(storage.config_file, 'r') as f:
#    ORIGINAL_CONFIG = yaml.load(f)

#print(ORIGINAL_CONFIG)

ORIGINAL_CONFIG = deepcopy(storage.config)

FULL_SETUP = True

@pytest.fixture(scope="session", autouse=True)
def setup_fixtures(request):

    print('RUNNING SETUP FIXTURE')
    
    storage.config['ecoinvent']['version'] = '3.3'
    storage.config['ecoinvent']['system_model'] = 'cutoff'
    storage.config['model_storage']['project'] = 'unique'
    storage.config['model_storage']['location'] = 'currdir'



    if FULL_SETUP:
        bw2.projects.purge_deleted_directories()
        if TEST_MODEL_NAME in bw2.projects:
            bw2.projects.delete_project(name=TEST_MODEL_NAME, delete_dir=True)

        if bw2_project_exists(DEFAULT_BIOSPHERE_PROJECT):

# Path: lcopt/data_store.py
# class LcoptStorage():
#     def __init__(self):
#     def load_config(self):
#     def refresh(self):
#     def write_default_config(self):
#     def write_config(self, config):
#     def models(self):
#     def search_indices(self):
#     def project_type(self):
#     def single_project_name(self):
#     def ecoinvent_version(self):
#     def ecoinvent_system_model(self):
#     def save_option(self):
# 
# Path: lcopt/constants.py
# DEFAULT_BIOSPHERE_PROJECT = "LCOPT_Setup_biosphere"
# 
# Path: lcopt/utils.py
# def bw2_project_exists(project_name):
#     return project_name in bw2.projects


# Path: conftest.py
import pytest
import os
import brightway2 as bw2
import yaml
from lcopt.data_store import storage
from copy import deepcopy
from lcopt.constants import DEFAULT_BIOSPHERE_PROJECT
from lcopt.utils import bw2_project_exists


#print(storage.config_file)

#with open(storage.config_file, 'r') as f:
#    ORIGINAL_CONFIG = yaml.load(f)

#print(ORIGINAL_CONFIG)

ORIGINAL_CONFIG = deepcopy(storage.config)

FULL_SETUP = True

@pytest.fixture(scope="session", autouse=True)
def setup_fixtures(request):

    print('RUNNING SETUP FIXTURE')
    
    storage.config['ecoinvent']['version'] = '3.3'
    storage.config['ecoinvent']['system_model'] = 'cutoff'
    storage.config['model_storage']['project'] = 'unique'
    storage.config['model_storage']['location'] = 'currdir'



    if FULL_SETUP:
        bw2.projects.purge_deleted_directories()
        if TEST_MODEL_NAME in bw2.projects:
            bw2.projects.delete_project(name=TEST_MODEL_NAME, delete_dir=True)

        if bw2_project_exists(DEFAULT_BIOSPHERE_PROJECT):

            bw2.projects.set_current(DEFAULT_BIOSPHERE_PROJECT)