Skip to content

Commit 2ec0fa8

Browse files
committed
Remove mention of versioned sunsch format
The v1 format has been purged from the code 3 years ago.
1 parent 16b8d8c commit 2ec0fa8

File tree

3 files changed

+20
-26
lines changed

3 files changed

+20
-26
lines changed

src/subscript/sunsch/sunsch.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,7 @@ def _shuffle_start_refdate(config: dict) -> dict:
103103
return config
104104

105105

106-
CONFIG_SCHEMA_V2 = {
106+
CONFIG_SCHEMA = {
107107
MK.Type: types.NamedDict,
108108
MK.Transformation: _defaults_handling,
109109
MK.Content: {
@@ -235,7 +235,7 @@ def _shuffle_start_refdate(config: dict) -> dict:
235235

236236
def get_schema() -> dict:
237237
"""Return the ConfigSuite schema"""
238-
return CONFIG_SCHEMA_V2
238+
return CONFIG_SCHEMA
239239

240240

241241
def datetime_from_date(
@@ -266,7 +266,7 @@ def process_sch_config(conf) -> TimeVector:
266266
# config - convert it to a configsuite snapshot:
267267
if isinstance(conf, dict):
268268
conf = configsuite.ConfigSuite(
269-
conf, CONFIG_SCHEMA_V2, deduce_required=True
269+
conf, CONFIG_SCHEMA, deduce_required=True
270270
).snapshot
271271

272272
# Rerun this to ensure error is caught (already done in transformation)

tests/test_sunsch.py

Lines changed: 17 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -42,9 +42,9 @@ def fixture_testdata(tmp_path):
4242

4343
def test_main(testdata, caplog, mocker):
4444
"""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
4646

47-
mocker.patch("sys.argv", ["sunsch", "config_v2.yml"])
47+
mocker.patch("sys.argv", ["sunsch", "config.yml"])
4848
sunsch.main()
4949
assert "DEPRECATED" not in caplog.text
5050
assert Path(outfile).exists()
@@ -70,7 +70,7 @@ def test_main(testdata, caplog, mocker):
7070
# Test that we can have statements in the init file
7171
# before the first DATES that are kept:
7272

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"))
7474
print(sch_conf)
7575
sch_conf["init"] = "initwithdates.sch"
7676
sunsch.process_sch_config(sch_conf)
@@ -82,7 +82,7 @@ def test_main(testdata, caplog, mocker):
8282
def test_cmdline_output(testdata, mocker):
8383
"""Test that command line options can override configuration file"""
8484
mocker.patch(
85-
"sys.argv", ["sunsch", "--output", "subdir/schedule.inc", "config_v2.yml"]
85+
"sys.argv", ["sunsch", "--output", "subdir/schedule.inc", "config.yml"]
8686
)
8787
with pytest.warns(FutureWarning, match="Implicit mkdir"):
8888
sunsch.main()
@@ -91,27 +91,27 @@ def test_cmdline_output(testdata, mocker):
9191

9292
def test_cmdline_startdate(testdata, mocker):
9393
"""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"])
9595
sunsch.main()
9696
assert "2018" not in Path("schedule.inc").read_text(encoding="utf8")
9797

9898

9999
def test_cmdline_enddate(testdata, mocker):
100100
"""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"])
102102
sunsch.main()
103103
assert "2021" not in Path("schedule.inc").read_text(encoding="utf8")
104104

105105

106106
def test_cmdline_refdate(testdata, mocker):
107107
"""Test that --refdate on command line overrides config"""
108108
# 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"])
110110
sunsch.main()
111111
# 40 days after refdate, which is 2018-01-01 in yaml:
112112
assert "10 'FEB' 2018" in Path("schedule.inc").read_text(encoding="utf8")
113113

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"])
115115
sunsch.main()
116116
# It should not be 40 days after startdate,
117117
assert "10 'FEB' 2018" not in Path("schedule.inc").read_text(encoding="utf8")
@@ -121,7 +121,7 @@ def test_cmdline_refdate(testdata, mocker):
121121

122122
def test_cmdline_dategrid(testdata, mocker):
123123
"""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"])
125125
sunsch.main()
126126
assert "6 'JAN' 2017" in Path("schedule.inc").read_text(encoding="utf8")
127127
assert "7 'JAN' 2017" in Path("schedule.inc").read_text(encoding="utf8")
@@ -132,14 +132,14 @@ def test_cmdline_dategrid(testdata, mocker):
132132
def test_dump_stdout(testdata, mocker):
133133
"""Test that we can write to stdout"""
134134
result = subprocess.run(
135-
["sunsch", "--output", "-", "config_v2.yml"], check=True, stdout=subprocess.PIPE
135+
["sunsch", "--output", "-", "config.yml"], check=True, stdout=subprocess.PIPE
136136
)
137137
assert "1 'FEB' 2020" in result.stdout.decode()
138138
assert "subscript" not in result.stdout.decode()
139139

140140
# Verify that INFO logging is not included while writing to stdout:
141141
result = subprocess.run(
142-
["sunsch", "--verbose", "--output", "-", "config_v2.yml"],
142+
["sunsch", "--verbose", "--output", "-", "config.yml"],
143143
check=True,
144144
stdout=subprocess.PIPE,
145145
)
@@ -149,7 +149,7 @@ def test_dump_stdout(testdata, mocker):
149149

150150
# Verify that DEBUG logging is not included while writing to stdout:
151151
result = subprocess.run(
152-
["sunsch", "--debug", "--output", "-", "config_v2.yml"],
152+
["sunsch", "--debug", "--output", "-", "config.yml"],
153153
check=True,
154154
stdout=subprocess.PIPE,
155155
)
@@ -163,15 +163,11 @@ def test_config_schema(tmp_path):
163163
"""Test the implementation of configsuite"""
164164
os.chdir(tmp_path)
165165
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)
169167
assert not cfg_suite.valid # file missing
170168

171169
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)
175171
print(cfg_suite.errors)
176172
assert not cfg_suite.valid # "foo" is not valid configuration.
177173

@@ -181,9 +177,7 @@ def test_config_schema(tmp_path):
181177
"startdate": datetime.date(2018, 2, 2),
182178
"insert": [],
183179
}
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)
187181
print(cfg_suite.errors)
188182
assert cfg_suite.valid
189183

@@ -211,7 +205,7 @@ def test_templating(tmp_path):
211205
assert "200.3" in str(sch)
212206
assert "1400000" in str(sch)
213207
cfg_suite = configsuite.ConfigSuite(
214-
sunschconf, sunsch.CONFIG_SCHEMA_V2, deduce_required=True
208+
sunschconf, sunsch.CONFIG_SCHEMA, deduce_required=True
215209
)
216210
assert cfg_suite.valid
217211

@@ -920,7 +914,7 @@ def test_ert_forward_model(testdata):
920914
"NUM_REALIZATIONS 1",
921915
"RUNPATH <CONFIG_PATH>",
922916
"",
923-
"FORWARD_MODEL SUNSCH(<config>=config_v2.yml)",
917+
"FORWARD_MODEL SUNSCH(<config>=config.yml)",
924918
]
925919
),
926920
encoding="utf8",

0 commit comments

Comments
 (0)