Skip to content

Commit

Permalink
Update UnitTesting for figure generation
Browse files Browse the repository at this point in the history
  • Loading branch information
sarahshi committed Feb 27, 2024
1 parent d49d26b commit 6cd4bf0
Showing 1 changed file with 9 additions and 5 deletions.
14 changes: 9 additions & 5 deletions UnitTests/test_fittingfunc.py
Original file line number Diff line number Diff line change
Expand Up @@ -189,7 +189,8 @@ def test_MCMC_interp(self):
def test_MCMC_exportpath(self):

temp_export_path = "temp_test_dir"
os.makedirs(temp_export_path, exist_ok=True)
figures_path = os.path.join(temp_export_path, "FIGURES")
os.makedirs(figures_path, exist_ok=True)

Volatiles_DF, _ = pig.calculate_baselines(
self.dfs_dict, temp_export_path)
Expand All @@ -202,12 +203,15 @@ def test_MCMC_exportpath(self):
temp_export_path,
"output.csv")))

figure_files = glob.glob(os.path.join(temp_export_path, "*.pdf"))
self.assertTrue(len(figure_files) > 0, "No figure files found in the export path.")
figure_files = glob.glob(os.path.join(figures_path, "*.pdf"))
self.assertTrue(len(figure_files) > 0, "No figure files found in the FIGURES subdirectory.")

# Cleanup
for file_path in glob.glob(os.path.join(temp_export_path, "*")):
os.remove(file_path)
for dirpath, dirnames, filenames in os.walk(temp_export_path, topdown=False):
for filename in filenames:
os.remove(os.path.join(dirpath, filename))
for dirname in dirnames:
os.rmdir(os.path.join(dirpath, dirname))
os.rmdir(temp_export_path)


Expand Down

0 comments on commit 6cd4bf0

Please sign in to comment.