11"""Testing qcforward method gridquality"""
22
3- import pathlib
3+ from pathlib import Path
4+ from typing import Any
45
56import pandas as pd
67import pytest
78
89import fmu .tools .qcforward as qcf
910
10- PATH = pathlib .Path ("." ).resolve ().as_posix ()
11- REPORT = "/tmp/somefile_gridquality.csv"
12- SOMEYAML = "/tmp/somefile.yml"
13-
1411
1512@pytest .fixture ()
16- def gridfile_data (testdata_path ) :
13+ def gridfile_data (tmp_path : Path , testdata_path : Path ) -> dict [ str , Any ] :
1714 gridfile = str (testdata_path / "3dgrids/reek/reek_sim_grid.roff" )
1815
1916 ACTIONS = {
@@ -27,26 +24,23 @@ def gridfile_data(testdata_path):
2724 return {
2825 "nametag" : "MYDATA1" ,
2926 "verbosity" : "info" ,
30- "path" : PATH ,
27+ "path" : str ( Path . cwd ()) ,
3128 "grid" : gridfile ,
3229 "actions" : ACTIONS ,
33- "report" : {"file" : REPORT , "mode" : "write" },
34- "dump_yaml" : SOMEYAML ,
30+ "report" : {"file" : str ( tmp_path / "somefile_gradquality.csv" ) , "mode" : "write" },
31+ "dump_yaml" : str ( tmp_path / "somefile.yml" ) ,
3532 }
3633
3734
38- def test_gridquality_asfiles (gridfile_data ) :
35+ def test_gridquality_asfiles (gridfile_data : dict [ str , Any ]) -> None :
3936 """Testing grid quality using files."""
4037 qcf .grid_quality (gridfile_data )
4138
42- dfr = pd .read_csv (REPORT )
39+ dfr = pd .read_csv (gridfile_data [ "report" ][ "file" ] )
4340 assert dfr .loc [0 , "WARN%" ] == pytest .approx (2.715 , 0.01 )
4441
45- pathlib .Path (REPORT ).unlink ()
46- pathlib .Path (SOMEYAML ).unlink ()
47-
4842
49- def test_gridquality_asfiles_shall_stop (gridfile_data ) :
43+ def test_gridquality_asfiles_shall_stop (gridfile_data : dict [ str , Any ]) -> None :
5044 """Testing gridquality using files which should trigger a stop.
5145
5246 Here. also abbrevation "all" should here work as "allcells".
@@ -56,6 +50,3 @@ def test_gridquality_asfiles_shall_stop(gridfile_data):
5650
5751 with pytest .raises (SystemExit ):
5852 qcf .grid_quality (newdata )
59-
60- pathlib .Path (REPORT ).unlink ()
61- pathlib .Path (SOMEYAML ).unlink ()
0 commit comments