33import pandas as pd
44import pytest
55from PyStemmusScope import forcing_io
6-
6+ from . import forcing_data_folder
77
88numbers = '0123456789'
99
@@ -28,7 +28,7 @@ def eval_str(fdata):
2828
2929@pytest .fixture (scope = 'session' , autouse = True )
3030def forcing_data ():
31- forcing_file = (Path ( __file__ ). parent / "test_data_forcing" /
31+ forcing_file = (forcing_data_folder /
3232 "FI-Hyy_1996-2014_FLUXNET2015_Met.nc" )
3333 return forcing_io .read_forcing_data (forcing_file )
3434
@@ -58,7 +58,7 @@ def dat_files(tmpdir_factory, forcing_data):
5858
5959
6060def test_mdata (mdata_file ):
61- fn_expected = './tests/test_data_forcing/ Mdata.txt'
61+ fn_expected = forcing_data_folder / ' Mdata.txt'
6262
6363 df_expected = pd .read_fwf (fn_expected )
6464 df_written = pd .read_fwf (mdata_file )
@@ -68,7 +68,7 @@ def test_mdata(mdata_file):
6868
6969# Verifying that the actual data file passes the evaluation
7070def test_true_mdata_format ():
71- with open ('./tests/test_data_forcing/ Mdata.txt' , encoding = 'utf-8' ) as f :
71+ with open (forcing_data_folder / ' Mdata.txt' , encoding = 'utf-8' ) as f :
7272 content_exp = f .read ()
7373 assert eval_str (content_exp )
7474
@@ -81,7 +81,7 @@ def test_mdata_format(mdata_file):
8181
8282
8383def test_lai_file (lai_file ):
84- fn_expected = './tests/test_data_forcing/ LAI_.dat'
84+ fn_expected = forcing_data_folder / ' LAI_.dat'
8585
8686 df_expected = pd .read_fwf (fn_expected )
8787 df_written = pd .read_fwf (lai_file )
@@ -96,7 +96,7 @@ def test_lai_file_format(lai_file):
9696
9797
9898def test_dat_files (dat_files ):
99- expected_path = './tests/test_data_forcing/'
99+ expected_path = forcing_data_folder
100100
101101 fnames , write_dir = dat_files
102102
@@ -115,7 +115,7 @@ def test_dat_file_format(dat_files):
115115
116116
117117def test_full_routine (tmp_path , dat_files ):
118- forcing_file = (Path ( __file__ ). parent / "test_data_forcing" /
118+ forcing_file = (forcing_data_folder /
119119 "FI-Hyy_1996-2014_FLUXNET2015_Met.nc" )
120120 config = {'NumberOfTimeSteps' : 5 }
121121
0 commit comments