Skip to content

Commit

Permalink
try to fix unittest
Browse files Browse the repository at this point in the history
  • Loading branch information
lbesnard committed May 2, 2024
1 parent 7d057ff commit 2718e98
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions aodn_cloud_optimised/lib/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import os
import importlib.resources
from collections import OrderedDict
from importlib.resources import path


def load_variable_from_file(file_path, variable_name) -> str:
Expand All @@ -24,10 +25,9 @@ def load_variable_from_file(file_path, variable_name) -> str:


def load_variable_from_config(variable_name) -> str:
# Construct the path to common.py relative to the current directory
common_config_path = str(importlib.resources.path("aodn_cloud_optimised.config", "common.json"))

return load_variable_from_file(common_config_path, variable_name)
# Obtain the file path using the context manager
with path("aodn_cloud_optimised.config", "common.json") as common_config_path:
return load_variable_from_file(str(common_config_path), variable_name)


def load_dataset_config(config_path) -> dict:
Expand Down

0 comments on commit 2718e98

Please sign in to comment.