diff --git a/.github/workflows/ci_simple_compilation_and_test.yml b/.github/workflows/ci_simple_compilation_and_test.yml index 96ea3a61..d5360133 100644 --- a/.github/workflows/ci_simple_compilation_and_test.yml +++ b/.github/workflows/ci_simple_compilation_and_test.yml @@ -21,7 +21,6 @@ jobs: uses: actions/checkout@v4 with: repository: tdep-developers/tdep - ref: fk_github_ci - run: echo "💡 The ${{ github.repository }} repository has been cloned to the runner." - run: echo "🔎 The name of your branch is ${{ github.ref }} and your repository is ${{ github.repository }}." - name: Install packages required for building TDEP diff --git a/tests/thermal_conductivity/reference/outfile.thermal_conductivity_grid.hdf5 b/tests/thermal_conductivity/reference/outfile.thermal_conductivity_grid.hdf5 deleted file mode 100644 index f8bd4e9e..00000000 Binary files a/tests/thermal_conductivity/reference/outfile.thermal_conductivity_grid.hdf5 and /dev/null differ diff --git a/tests/thermal_conductivity/test_thermal_conductivity.py b/tests/thermal_conductivity/test_thermal_conductivity.py index 7b4bd2f2..92772dc6 100644 --- a/tests/thermal_conductivity/test_thermal_conductivity.py +++ b/tests/thermal_conductivity/test_thermal_conductivity.py @@ -1,17 +1,15 @@ import numpy as np import xarray as xr from pathlib import Path -import pytest parent = Path(__file__).parent folder = parent / "reference" -files_hdf5 = [ - "outfile.thermal_conductivity_grid.hdf5", -] +file = "outfile.thermal_conductivity" +file_hdf5 = "outfile.thermal_conductivity_grid.hdf5" -def test_thermal_conductivity(file="outfile.thermal_conductivity", atol=20, rtol=5): +def test_thermal_conductivity(file=file, atol=1, rtol=0.1): file_ref = folder / file file_new = parent / file @@ -23,39 +21,9 @@ def test_thermal_conductivity(file="outfile.thermal_conductivity", atol=20, rtol ) -def get_variables(file): - """Helper function to get variables from a dataset""" - return list(xr.load_dataset(folder / file).data_vars) - - -def generate_test_cases(files=files_hdf5): - """Generate test cases combining files and their variables""" - test_cases = [] - for file in files: - vars = get_variables(file) - for var in vars: - test_cases.append((file, var)) - return test_cases - - -@pytest.mark.parametrize("file,var", generate_test_cases()) -def test_hdf5(file, var, atol=1, rtol=0.01): - """Test HDF5 files by comparing variables between reference and new datasets""" - file_ref = folder / file - file_new = parent / file - - ds_ref = xr.load_dataset(file_ref) - ds_new = xr.load_dataset(file_new) - - x = ds_ref[var] - y = ds_new[var] - - np.testing.assert_allclose(x, y, atol=atol, rtol=rtol, err_msg=var) - - def test_conductivity_comparison( - file="outfile.thermal_conductivity", - file_grid="outfile.thermal_conductivity_grid.hdf5", + file=parent / file, + file_grid=parent / file_hdf5, ): """Check if the thermal conducivities conincide""" data1 = np.loadtxt(file) @@ -72,5 +40,4 @@ def test_conductivity_comparison( if __name__ == "__main__": test_thermal_conductivity() - test_hdf5() test_conductivity_comparison()