-
Notifications
You must be signed in to change notification settings - Fork 59
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix windows tests #1104
Merged
Merged
Fix windows tests #1104
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -20,6 +20,13 @@ | |
|
||
from .conftest import datadir, static_files | ||
|
||
on_windows = platform.system() == "Windows" | ||
|
||
if on_windows: | ||
ncconfig = ["sh", f"{os.environ['CONDA_PREFIX']}\\Library\\bin\\nc-config"] | ||
else: | ||
ncconfig = ["nc-config"] | ||
Comment on lines
+23
to
+28
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @benjwadams while this works, I'm not sure we need this. We can find the version with netCDF4 and let the zarr availability be checked by the failing test. What do you think? |
||
|
||
|
||
@pytest.mark.usefixtures("checksuite_setup") | ||
class TestCLI: | ||
|
@@ -221,32 +228,19 @@ def test_multi_checker_return_value(self, tmp_txt_file): | |
assert not return_value | ||
|
||
def _check_libnetcdf_version(): | ||
if platform.system() == "Linux": | ||
# nc-config doesn't work on windows... and neither does NCZarr so this skipif is mutually exclusive to the OS check skipif | ||
return ( | ||
float( | ||
subprocess.check_output( | ||
["nc-config", "--version"], | ||
encoding="UTF-8", | ||
)[9:12], | ||
) | ||
< 8.0 | ||
return ( | ||
float( | ||
subprocess.check_output( | ||
ncconfig + ["--version"], | ||
encoding="UTF-8", | ||
)[9:12], | ||
) | ||
else: | ||
return True | ||
< 8.0 | ||
) | ||
|
||
# TODO uncomment the third parameter once S3 support is working | ||
@pytest.mark.skipif( | ||
_check_libnetcdf_version(), | ||
reason="NCZarr support was not available until netCDF version 4.8.0. Please upgrade to the latest libnetcdf version to test this functionality", | ||
) | ||
@pytest.mark.skipif( | ||
platform.system() != "Linux", | ||
reason="NCZarr is not officially supported for your OS as of when this API was written", | ||
) | ||
@pytest.mark.skipif( | ||
subprocess.check_output(["nc-config", "--has-nczarr"]) != b"yes\n", | ||
reason="NCZarr support was not built with this netCDF version", | ||
subprocess.check_output(ncconfig + ["--has-nczarr"]) != b"yes\n", | ||
reason="NCZarr is not available.", | ||
) | ||
@pytest.mark.parametrize( | ||
"zarr_url", | ||
|
@@ -255,7 +249,12 @@ def _check_libnetcdf_version(): | |
str(datadir / "zip.zarr"), | ||
# "s3://hrrrzarr/sfc/20210408/20210408_10z_anl.zarr#mode=nczarr,s3" | ||
], | ||
ids=["local_file", "zip_file"], # ,'s3_url' | ||
ids=[ | ||
"local_file", | ||
"zip_file", | ||
# TODO uncomment once S3 support is working. | ||
# "s3_url", | ||
], | ||
) | ||
def test_nczarr_pass_through(self, zarr_url): | ||
""" | ||
|
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This one had me chasing red herrings all over the code base. I'm not sure if nczarr has a bug, or Python as_uri, or something else. All I know is that we can't have 3 / on Windows, only 2!