@@ -1995,8 +1995,9 @@ def run(self, *args):
1995
1995
assert ert_config .substitutions ["<FOO2>" ] == "ertconfig_foo2"
1996
1996
1997
1997
1998
+ @pytest .fixture
1998
1999
@pytest .mark .usefixtures ("use_tmpdir" )
1999
- def test_ert_script_hook_pre_experiment_but_asks_for_storage ():
2000
+ def set_me_up ():
2000
2001
workflow_file_path = os .path .join (os .getcwd (), "workflow" )
2001
2002
with open (workflow_file_path , mode = "w" , encoding = "utf-8" ) as fh :
2002
2003
fh .write ("TEST_SCRIPT" )
@@ -2005,14 +2006,16 @@ def test_ert_script_hook_pre_experiment_but_asks_for_storage():
2005
2006
fh .write (
2006
2007
dedent (
2007
2008
f"""
2008
- NUM_REALIZATIONS 1
2009
+ NUM_REALIZATIONS 1
2009
2010
2010
- LOAD_WORKFLOW { workflow_file_path } workflow_alias
2011
- HOOK_WORKFLOW workflow_alias PRE_EXPERIMENT
2012
- """
2011
+ LOAD_WORKFLOW { workflow_file_path } workflow_alias
2012
+ HOOK_WORKFLOW workflow_alias PRE_EXPERIMENT
2013
+ """
2013
2014
)
2014
2015
)
2015
2016
2017
+
2018
+ def test_ert_script_hook_pre_experiment_but_asks_for_storage (set_me_up ):
2016
2019
class SomeScript (ErtScript ):
2017
2020
def run (self , storage : Storage ):
2018
2021
pass
@@ -2032,23 +2035,7 @@ def run(self, storage: Storage):
2032
2035
2033
2036
2034
2037
@pytest .mark .usefixtures ("use_tmpdir" )
2035
- def test_ert_script_hook_pre_experiment_but_asks_for_ensemble ():
2036
- workflow_file_path = os .path .join (os .getcwd (), "workflow" )
2037
- with open (workflow_file_path , mode = "w" , encoding = "utf-8" ) as fh :
2038
- fh .write ("TEST_SCRIPT" )
2039
-
2040
- with open ("config.ert" , mode = "w" , encoding = "utf-8" ) as fh :
2041
- fh .write (
2042
- dedent (
2043
- f"""
2044
- NUM_REALIZATIONS 1
2045
-
2046
- LOAD_WORKFLOW { workflow_file_path } workflow_alias
2047
- HOOK_WORKFLOW workflow_alias PRE_EXPERIMENT
2048
- """
2049
- )
2050
- )
2051
-
2038
+ def test_ert_script_hook_pre_experiment_but_asks_for_ensemble (set_me_up ):
2052
2039
class SomeScript (ErtScript ):
2053
2040
def run (self , ensemble : LocalEnsemble ):
2054
2041
pass
@@ -2068,23 +2055,7 @@ def run(self, ensemble: LocalEnsemble):
2068
2055
2069
2056
2070
2057
@pytest .mark .usefixtures ("use_tmpdir" )
2071
- def test_ert_script_hook_pre_experiment_but_asks_for_random_seed ():
2072
- workflow_file_path = os .path .join (os .getcwd (), "workflow" )
2073
- with open (workflow_file_path , mode = "w" , encoding = "utf-8" ) as fh :
2074
- fh .write ("TEST_SCRIPT" )
2075
-
2076
- with open ("config.ert" , mode = "w" , encoding = "utf-8" ) as fh :
2077
- fh .write (
2078
- dedent (
2079
- f"""
2080
- NUM_REALIZATIONS 1
2081
-
2082
- LOAD_WORKFLOW { workflow_file_path } workflow_alias
2083
- HOOK_WORKFLOW workflow_alias PRE_EXPERIMENT
2084
- """
2085
- )
2086
- )
2087
-
2058
+ def test_ert_script_hook_pre_experiment_but_asks_for_random_seed (set_me_up ):
2088
2059
class SomeScript (ErtScript ):
2089
2060
def run (self , random_seed : int ):
2090
2061
pass
@@ -2099,23 +2070,7 @@ def run(self, random_seed: int):
2099
2070
2100
2071
2101
2072
@pytest .mark .usefixtures ("use_tmpdir" )
2102
- def test_ert_script_hook_pre_experiment_essettings_fails ():
2103
- workflow_file_path = os .path .join (os .getcwd (), "workflow" )
2104
- with open (workflow_file_path , mode = "w" , encoding = "utf-8" ) as fh :
2105
- fh .write ("TEST_SCRIPT" )
2106
-
2107
- with open ("config.ert" , mode = "w" , encoding = "utf-8" ) as fh :
2108
- fh .write (
2109
- dedent (
2110
- f"""
2111
- NUM_REALIZATIONS 1
2112
-
2113
- LOAD_WORKFLOW { workflow_file_path } workflow_alias
2114
- HOOK_WORKFLOW workflow_alias PRE_EXPERIMENT
2115
- """
2116
- )
2117
- )
2118
-
2073
+ def test_ert_script_hook_pre_experiment_essettings_fails (set_me_up ):
2119
2074
class SomeScript (ErtScript ):
2120
2075
def run (self , es_settings : ESSettings ):
2121
2076
pass
0 commit comments