@@ -505,15 +505,15 @@ def test_gen_kw_templating(
505
505
506
506
@pytest .mark .usefixtures ("set_site_config" )
507
507
@pytest .mark .parametrize (
508
- "relpath" ,
508
+ "relpath, err_msg " ,
509
509
[
510
- "somepath/" ,
510
+ ( "somepath/" , "" ) ,
511
511
# This test was added to show current behaviour for Ert.
512
512
# If absolute paths should be possible to be used like this is up for debate.
513
- "/tmp/somepath/" , # ert removes leading '/'
513
+ ( "/tmp/somepath/" , "Output file cannot have an absolute path" ),
514
514
],
515
515
)
516
- def test_gen_kw_outfile_will_use_paths (tmpdir , storage , relpath : str ):
516
+ def test_gen_kw_outfile_will_use_paths (tmpdir , storage , relpath : str , err_msg : str ):
517
517
with tmpdir .as_cwd ():
518
518
config = dedent (
519
519
f"""
@@ -530,8 +530,15 @@ def test_gen_kw_outfile_will_use_paths(tmpdir, storage, relpath: str):
530
530
with open ("prior.txt" , mode = "w" , encoding = "utf-8" ) as fh :
531
531
fh .writelines ("MY_KEYWORD NORMAL 0 1" )
532
532
relpath = relpath .removeprefix ("/" )
533
- create_runpath (storage , "config.ert" )
534
- assert os .path .exists (f"simulations/realization-0/iter-0/{ relpath } kw.txt" )
533
+ if err_msg :
534
+ with pytest .raises (
535
+ ConfigValidationError ,
536
+ match = err_msg ,
537
+ ):
538
+ create_runpath (storage , "config.ert" )
539
+ else :
540
+ create_runpath (storage , "config.ert" )
541
+ assert os .path .exists (f"simulations/realization-0/iter-0/{ relpath } kw.txt" )
535
542
536
543
537
544
@pytest .mark .usefixtures ("set_site_config" )
0 commit comments