diff --git a/binarycpython/tests/test_grid.py b/binarycpython/tests/test_grid.py index 78fd31415e97ced1cbbcfb842bea2049049481aa..a10e2e65e3b9110526aec2587a7bb528ea3bd0a2 100644 --- a/binarycpython/tests/test_grid.py +++ b/binarycpython/tests/test_grid.py @@ -852,10 +852,7 @@ Printf("TEST_CUSTOM_LOGGING_1 %30.12e %g %g %g %g\\n", with open(output_name, "r") as f: file_content = f.read() - - self.assertTrue(file_content.startswith('\"ENSEMBLE_JSON')) - - ensemble_json = extract_ensemble_json_from_string(file_content) + ensemble_json = json.loads(file_content) self.assertTrue(isinstance(ensemble_json, dict)) self.assertNotEqual(ensemble_json, {}) @@ -919,11 +916,11 @@ Printf("TEST_CUSTOM_LOGGING_1 %30.12e %g %g %g %g\\n", test_pop.grid_ensemble_results["ensemble"]["number_counts"], {} ) - # def test_grid_evolve_2_threads_with_ensemble_comparing_two_methods(self): - # with Capturing() as output: - # self._test_grid_evolve_2_threads_with_ensemble_comparing_two_methods() - def test_grid_evolve_2_threads_with_ensemble_comparing_two_methods(self): + with Capturing() as output: + self._test_grid_evolve_2_threads_with_ensemble_comparing_two_methods() + + def _test_grid_evolve_2_threads_with_ensemble_comparing_two_methods(self): """ Unittests to compare the method of storing the combined ensemble data in the object and writing them to files and combining them later. they have to be the same """ @@ -1022,11 +1019,7 @@ Printf("TEST_CUSTOM_LOGGING_1 %30.12e %g %g %g %g\\n", with open(output_name, "r") as f: file_content = f.read() - self.assertTrue(file_content.startswith('\"ENSEMBLE_JSON')) - - ensemble_json = extract_ensemble_json_from_string(file_content) - - print(ensemble_json) + ensemble_json = json.loads(file_content) ensemble_output_2 = merge_dicts(ensemble_output_2, ensemble_json) diff --git a/binarycpython/utils/grid.py b/binarycpython/utils/grid.py index 807de7c76c58f3420f9e7db577355a4f0b1f3540..0ca70117b45ef4360f8322ec3de8c9be3952803e 100644 --- a/binarycpython/utils/grid.py +++ b/binarycpython/utils/grid.py @@ -1776,8 +1776,10 @@ class Population: self.grid_options["verbosity"], 1, ) + + ensemble_output = extract_ensemble_json_from_string(ensemble_raw_output) - self.write_ensemble(output_file, ensemble_raw_output) + self.write_ensemble(output_file, ensemble_output) # combine ensemble chunks if self.grid_options["combine_ensemble_with_thread_joining"] is True: