test_computeMetrics.py 988 B

1234567891011121314151617181920212223242526272829303132333435
  1. """
  2. This file will test the differents modules in compute_metrics folder
  3. You must have the pip package pytest installed
  4. """
  5. import os
  6. import sys
  7. import pytest
  8. import shutil
  9. import pandas as pd
  10. fpath = os.path.join(os.path.dirname(__file__),'..', 'compute_metrics')
  11. sys.path.append(fpath)
  12. import compute_metrics.metrics as met
  13. import compute_metrics.metrics_functions as mf
  14. DATASET_PATH = os.path.join('tests','existing_dataset') #dataset already existing, used for tests that don't change it
  15. ############### metrics ##################
  16. def test_get_metrics():
  17. met_file = os.path.join('tests','metrics.csv')
  18. met.get_metrics(DATASET_PATH, met_file)
  19. pd.testing.assert_frame_equal(pd.read_csv(met_file),pd.read_csv(os.path.join(DATASET_PATH,'extra','metrics','metrics.csv')))
  20. ##########################################
  21. ########## metrics_functions #############
  22. #maybe add a part checking calculation of each metric?
  23. ##########################################