@@ -42,9 +42,9 @@ def fixture_testdata(tmp_path):
42
42
43
43
def test_main (testdata , caplog , mocker ):
44
44
"""Test command line sunsch, loading a yaml file"""
45
- outfile = "schedule.inc" # also in config_v2 .yml
45
+ outfile = "schedule.inc" # also in config .yml
46
46
47
- mocker .patch ("sys.argv" , ["sunsch" , "config_v2 .yml" ])
47
+ mocker .patch ("sys.argv" , ["sunsch" , "config .yml" ])
48
48
sunsch .main ()
49
49
assert "DEPRECATED" not in caplog .text
50
50
assert Path (outfile ).exists ()
@@ -70,7 +70,7 @@ def test_main(testdata, caplog, mocker):
70
70
# Test that we can have statements in the init file
71
71
# before the first DATES that are kept:
72
72
73
- sch_conf = yaml .safe_load (Path ("config_v2 .yml" ).read_text (encoding = "utf8" ))
73
+ sch_conf = yaml .safe_load (Path ("config .yml" ).read_text (encoding = "utf8" ))
74
74
print (sch_conf )
75
75
sch_conf ["init" ] = "initwithdates.sch"
76
76
sunsch .process_sch_config (sch_conf )
@@ -82,7 +82,7 @@ def test_main(testdata, caplog, mocker):
82
82
def test_cmdline_output (testdata , mocker ):
83
83
"""Test that command line options can override configuration file"""
84
84
mocker .patch (
85
- "sys.argv" , ["sunsch" , "--output" , "subdir/schedule.inc" , "config_v2 .yml" ]
85
+ "sys.argv" , ["sunsch" , "--output" , "subdir/schedule.inc" , "config .yml" ]
86
86
)
87
87
with pytest .warns (FutureWarning , match = "Implicit mkdir" ):
88
88
sunsch .main ()
@@ -91,27 +91,27 @@ def test_cmdline_output(testdata, mocker):
91
91
92
92
def test_cmdline_startdate (testdata , mocker ):
93
93
"""Test that --startdate on command line overrides config"""
94
- mocker .patch ("sys.argv" , ["sunsch" , "--startdate" , "2020-01-01" , "config_v2 .yml" ])
94
+ mocker .patch ("sys.argv" , ["sunsch" , "--startdate" , "2020-01-01" , "config .yml" ])
95
95
sunsch .main ()
96
96
assert "2018" not in Path ("schedule.inc" ).read_text (encoding = "utf8" )
97
97
98
98
99
99
def test_cmdline_enddate (testdata , mocker ):
100
100
"""Test that --enddate on command line overrides config"""
101
- mocker .patch ("sys.argv" , ["sunsch" , "--enddate" , "2020-01-01" , "config_v2 .yml" ])
101
+ mocker .patch ("sys.argv" , ["sunsch" , "--enddate" , "2020-01-01" , "config .yml" ])
102
102
sunsch .main ()
103
103
assert "2021" not in Path ("schedule.inc" ).read_text (encoding = "utf8" )
104
104
105
105
106
106
def test_cmdline_refdate (testdata , mocker ):
107
107
"""Test that --refdate on command line overrides config"""
108
108
# Baseline run, proving refdate follows refdate in config yaml:
109
- mocker .patch ("sys.argv" , ["sunsch" , "config_v2 .yml" ])
109
+ mocker .patch ("sys.argv" , ["sunsch" , "config .yml" ])
110
110
sunsch .main ()
111
111
# 40 days after refdate, which is 2018-01-01 in yaml:
112
112
assert "10 'FEB' 2018" in Path ("schedule.inc" ).read_text (encoding = "utf8" )
113
113
114
- mocker .patch ("sys.argv" , ["sunsch" , "--refdate" , "2019-01-01" , "config_v2 .yml" ])
114
+ mocker .patch ("sys.argv" , ["sunsch" , "--refdate" , "2019-01-01" , "config .yml" ])
115
115
sunsch .main ()
116
116
# It should not be 40 days after startdate,
117
117
assert "10 'FEB' 2018" not in Path ("schedule.inc" ).read_text (encoding = "utf8" )
@@ -121,7 +121,7 @@ def test_cmdline_refdate(testdata, mocker):
121
121
122
122
def test_cmdline_dategrid (testdata , mocker ):
123
123
"""Test that dategrid can be overridden on command line"""
124
- mocker .patch ("sys.argv" , ["sunsch" , "--dategrid" , "daily" , "config_v2 .yml" ])
124
+ mocker .patch ("sys.argv" , ["sunsch" , "--dategrid" , "daily" , "config .yml" ])
125
125
sunsch .main ()
126
126
assert "6 'JAN' 2017" in Path ("schedule.inc" ).read_text (encoding = "utf8" )
127
127
assert "7 'JAN' 2017" in Path ("schedule.inc" ).read_text (encoding = "utf8" )
@@ -132,14 +132,14 @@ def test_cmdline_dategrid(testdata, mocker):
132
132
def test_dump_stdout (testdata , mocker ):
133
133
"""Test that we can write to stdout"""
134
134
result = subprocess .run (
135
- ["sunsch" , "--output" , "-" , "config_v2 .yml" ], check = True , stdout = subprocess .PIPE
135
+ ["sunsch" , "--output" , "-" , "config .yml" ], check = True , stdout = subprocess .PIPE
136
136
)
137
137
assert "1 'FEB' 2020" in result .stdout .decode ()
138
138
assert "subscript" not in result .stdout .decode ()
139
139
140
140
# Verify that INFO logging is not included while writing to stdout:
141
141
result = subprocess .run (
142
- ["sunsch" , "--verbose" , "--output" , "-" , "config_v2 .yml" ],
142
+ ["sunsch" , "--verbose" , "--output" , "-" , "config .yml" ],
143
143
check = True ,
144
144
stdout = subprocess .PIPE ,
145
145
)
@@ -149,7 +149,7 @@ def test_dump_stdout(testdata, mocker):
149
149
150
150
# Verify that DEBUG logging is not included while writing to stdout:
151
151
result = subprocess .run (
152
- ["sunsch" , "--debug" , "--output" , "-" , "config_v2 .yml" ],
152
+ ["sunsch" , "--debug" , "--output" , "-" , "config .yml" ],
153
153
check = True ,
154
154
stdout = subprocess .PIPE ,
155
155
)
@@ -163,15 +163,11 @@ def test_config_schema(tmp_path):
163
163
"""Test the implementation of configsuite"""
164
164
os .chdir (tmp_path )
165
165
cfg = {"init" : "existingfile.sch" , "output" : "newfile.sch" }
166
- cfg_suite = configsuite .ConfigSuite (
167
- cfg , sunsch .CONFIG_SCHEMA_V2 , deduce_required = True
168
- )
166
+ cfg_suite = configsuite .ConfigSuite (cfg , sunsch .CONFIG_SCHEMA , deduce_required = True )
169
167
assert not cfg_suite .valid # file missing
170
168
171
169
Path ("existingfile.sch" ).write_text ("foo" , encoding = "utf8" )
172
- cfg_suite = configsuite .ConfigSuite (
173
- cfg , sunsch .CONFIG_SCHEMA_V2 , deduce_required = True
174
- )
170
+ cfg_suite = configsuite .ConfigSuite (cfg , sunsch .CONFIG_SCHEMA , deduce_required = True )
175
171
print (cfg_suite .errors )
176
172
assert not cfg_suite .valid # "foo" is not valid configuration.
177
173
@@ -181,9 +177,7 @@ def test_config_schema(tmp_path):
181
177
"startdate" : datetime .date (2018 , 2 , 2 ),
182
178
"insert" : [],
183
179
}
184
- cfg_suite = configsuite .ConfigSuite (
185
- cfg , sunsch .CONFIG_SCHEMA_V2 , deduce_required = True
186
- )
180
+ cfg_suite = configsuite .ConfigSuite (cfg , sunsch .CONFIG_SCHEMA , deduce_required = True )
187
181
print (cfg_suite .errors )
188
182
assert cfg_suite .valid
189
183
@@ -211,7 +205,7 @@ def test_templating(tmp_path):
211
205
assert "200.3" in str (sch )
212
206
assert "1400000" in str (sch )
213
207
cfg_suite = configsuite .ConfigSuite (
214
- sunschconf , sunsch .CONFIG_SCHEMA_V2 , deduce_required = True
208
+ sunschconf , sunsch .CONFIG_SCHEMA , deduce_required = True
215
209
)
216
210
assert cfg_suite .valid
217
211
@@ -920,7 +914,7 @@ def test_ert_forward_model(testdata):
920
914
"NUM_REALIZATIONS 1" ,
921
915
"RUNPATH <CONFIG_PATH>" ,
922
916
"" ,
923
- "FORWARD_MODEL SUNSCH(<config>=config_v2 .yml)" ,
917
+ "FORWARD_MODEL SUNSCH(<config>=config .yml)" ,
924
918
]
925
919
),
926
920
encoding = "utf8" ,
0 commit comments