Skip to content

Commit 19ce145

Browse files
committed
Fix tests in main. (#192)
* update set-timezone action * Remove timezone setting here * Explicit timezones where needed. * Forgot one test.
1 parent 034e18b commit 19ce145

File tree

3 files changed

+36
-10
lines changed

3 files changed

+36
-10
lines changed

.github/workflows/workflow-test.yml

-6
Original file line numberDiff line numberDiff line change
@@ -31,12 +31,6 @@ jobs:
3131
- name: Prepare locales
3232
shell: bash
3333
run: sudo locale-gen de_DE.UTF-8 en_GB.UTF-8 || echo windows
34-
- name: Prepare timezone
35-
uses: szenius/[email protected]
36-
with:
37-
timezoneLinux: Europe/Berlin
38-
timezoneMacos: Europe/Berlin
39-
timezoneWindows: W. Europe Standard Time
4034
- name: Print yadg version
4135
shell: bash
4236
run: yadg --version

tests/test_extract.py

+3-1
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,9 @@
2323
def test_yadg_extractors_extract_with_metadata(filetype, infile, datadir):
2424
os.chdir(datadir)
2525
outfile = f"{infile}.nc"
26-
ret = extract(filetype=filetype, path=infile, locale="en_GB")
26+
ret = extract(
27+
filetype=filetype, path=infile, locale="en_GB", timezone="Europe/Berlin"
28+
)
2729
# ret.to_netcdf(f"C:/Users/Kraus/Code/yadg/tests/test_extract/{outfile}", engine="h5netcdf")
2830
ref = datatree.open_datatree(outfile, engine="h5netcdf")
2931
compare_datatrees(ret, ref, thislevel=True, descend=True)

tests/test_yadg.py

+33-3
Original file line numberDiff line numberDiff line change
@@ -181,7 +181,17 @@ def test_yadg_preset_roundtrip_uts(datadir):
181181
)
182182
def test_yadg_extract_with_metadata(filetype, infile, datadir):
183183
os.chdir(datadir)
184-
command = ["yadg", "extract", filetype, infile, "test.nc", "--locale", "en_GB"]
184+
command = [
185+
"yadg",
186+
"extract",
187+
filetype,
188+
infile,
189+
"test.nc",
190+
"--locale",
191+
"en_GB",
192+
"--timezone",
193+
"Europe/Berlin",
194+
]
185195
subprocess.run(command, check=True)
186196
assert os.path.exists("test.nc")
187197
ret = open_datatree("test.nc", engine="h5netcdf")
@@ -201,7 +211,17 @@ def test_yadg_extract_with_metadata(filetype, infile, datadir):
201211
)
202212
def test_yadg_extract_meta_only(filetype, infile, flag, datadir):
203213
os.chdir(datadir)
204-
command = ["yadg", "extract", filetype, infile, flag, "--locale", "en_GB"]
214+
command = [
215+
"yadg",
216+
"extract",
217+
filetype,
218+
infile,
219+
flag,
220+
"--locale",
221+
"en_GB",
222+
"--timezone",
223+
"Europe/Berlin",
224+
]
205225
subprocess.run(command, check=True)
206226
outfile = infile.split(".")[0] + ".json"
207227
assert os.path.exists(outfile)
@@ -238,7 +258,17 @@ def test_yadg_preset_dataschema_compat(datadir):
238258
)
239259
def test_yadg_extract_locale(filetype, infile, locale, datadir):
240260
os.chdir(datadir)
241-
command = ["yadg", "extract", "--locale", locale, filetype, infile, "test.nc"]
261+
command = [
262+
"yadg",
263+
"extract",
264+
"--locale",
265+
locale,
266+
filetype,
267+
infile,
268+
"test.nc",
269+
"--timezone",
270+
"Europe/Berlin",
271+
]
242272
subprocess.run(command, check=True)
243273
assert os.path.exists("test.nc")
244274
ret = open_datatree("test.nc", engine="h5netcdf")

0 commit comments

Comments
 (0)