Skip to content

Commit

Permalink
Ensure empty generaldata.ini file is properly populated by default va…
Browse files Browse the repository at this point in the history
…lues
  • Loading branch information
JasonMarechal25 committed Sep 29, 2022
1 parent 72d259e commit fa1ea57
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions tests/python/test_antares_driver.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,17 +64,22 @@ def test_preserve_playlist(self, tmp_path):
assert active_years == [1, 42]
assert inactive_years == [5, 0]

def test_no_changes_in_empty_file(self, tmp_path):
def test_empty_file_should_be_populated_by_default_values(self, tmp_path):
settings_dir = TestGeneralDataProcessor.get_settings_dir(tmp_path)
settings_dir.mkdir()
gen_data_path = settings_dir / self.generaldata_filename
gen_data_path.touch()
gen_data_proc = GeneralDataProcessor(settings_dir, True)
gen_data_proc.change_general_data_file_to_configure_antares_execution()

with open(gen_data_proc.general_data_ini_file, "r") as reader:
lines = reader.readlines()

assert len(lines) == 0
assert len(lines) != 0
parser = configparser.ConfigParser()
parser.read(gen_data_proc.general_data_ini_file)
for option in gen_data_proc._get_values_to_change_general_data_file():
assert parser.get(option[0], option[1]) is not None

def test_values_change_in_general_file_accurate_mode(self, tmp_path):

Expand Down

0 comments on commit fa1ea57

Please sign in to comment.