Skip to content

Commit

Permalink
Explicit timezones where needed.
Browse files Browse the repository at this point in the history
  • Loading branch information
PeterKraus committed Oct 16, 2024
1 parent c980351 commit 316eca2
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 9 deletions.
6 changes: 0 additions & 6 deletions .github/workflows/workflow-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,12 +31,6 @@ jobs:
- name: Prepare locales
shell: bash
run: sudo locale-gen de_DE.UTF-8 en_GB.UTF-8 || echo windows
# - name: Prepare timezone
# uses: szenius/[email protected]
# with:
# timezoneLinux: Europe/Berlin
# timezoneMacos: Europe/Berlin
# timezoneWindows: W. Europe Standard Time
- name: Print yadg version
shell: bash
run: yadg --version
Expand Down
4 changes: 3 additions & 1 deletion tests/test_extract.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,9 @@
def test_yadg_extractors_extract_with_metadata(filetype, infile, datadir):
os.chdir(datadir)
outfile = f"{infile}.nc"
ret = extract(filetype=filetype, path=infile, locale="en_GB")
ret = extract(
filetype=filetype, path=infile, locale="en_GB", timezone="Europe/Berlin"
)
# ret.to_netcdf(f"C:/Users/Kraus/Code/yadg/tests/test_extract/{outfile}", engine="h5netcdf")
ref = datatree.open_datatree(outfile, engine="h5netcdf")
compare_datatrees(ret, ref, thislevel=True, descend=True)
24 changes: 22 additions & 2 deletions tests/test_yadg.py
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,17 @@ def test_yadg_preset_roundtrip_uts(datadir):
)
def test_yadg_extract_with_metadata(filetype, infile, datadir):
os.chdir(datadir)
command = ["yadg", "extract", filetype, infile, "test.nc", "--locale", "en_GB"]
command = [
"yadg",
"extract",
filetype,
infile,
"test.nc",
"--locale",
"en_GB",
"--timezone",
"Europe/Berlin",
]
subprocess.run(command, check=True)
assert os.path.exists("test.nc")
ret = open_datatree("test.nc", engine="h5netcdf")
Expand All @@ -201,7 +211,17 @@ def test_yadg_extract_with_metadata(filetype, infile, datadir):
)
def test_yadg_extract_meta_only(filetype, infile, flag, datadir):
os.chdir(datadir)
command = ["yadg", "extract", filetype, infile, flag, "--locale", "en_GB"]
command = [
"yadg",
"extract",
filetype,
infile,
flag,
"--locale",
"en_GB",
"--timezone",
"Europe/Berlin",
]
subprocess.run(command, check=True)
outfile = infile.split(".")[0] + ".json"
assert os.path.exists(outfile)
Expand Down

0 comments on commit 316eca2

Please sign in to comment.