Skip to content

Commit

Permalink
Merge pull request #1592 from djhoese/bugfix-xr-engine-guess
Browse files Browse the repository at this point in the history
Fix tests where xarray was unable to guess backend engine
  • Loading branch information
mraspaud committed Mar 10, 2021
2 parents f56a089 + ece20d4 commit 288c0bc
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 5 deletions.
2 changes: 1 addition & 1 deletion satpy/tests/reader_tests/test_vii_base_nc.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ def setUp(self, pgi_):
"""Set up the test."""
# Easiest way to test the reader is to create a test netCDF file on the fly
# uses a UUID to avoid permission conflicts during execution of tests in parallel
self.test_file_name = TEST_FILE + str(uuid.uuid1())
self.test_file_name = TEST_FILE + str(uuid.uuid1()) + ".nc"

with Dataset(self.test_file_name, 'w') as nc:
# Add global attributes
Expand Down
2 changes: 1 addition & 1 deletion satpy/tests/reader_tests/test_vii_l1b_nc.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ def setUp(self):
"""Set up the test."""
# Easiest way to test the reader is to create a test netCDF file on the fly
# uses a UUID to avoid permission conflicts during execution of tests in parallel
self.test_file_name = TEST_FILE + str(uuid.uuid1())
self.test_file_name = TEST_FILE + str(uuid.uuid1()) + ".nc"

with Dataset(self.test_file_name, 'w') as nc:
# Create data group
Expand Down
2 changes: 1 addition & 1 deletion satpy/tests/reader_tests/test_vii_l2_nc.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ def setUp(self):
"""Set up the test."""
# Easiest way to test the reader is to create a test netCDF file on the fly
# uses a UUID to avoid permission conflicts during execution of tests in parallel
self.test_file_name = TEST_FILE + str(uuid.uuid1())
self.test_file_name = TEST_FILE + str(uuid.uuid1()) + ".nc"

with Dataset(self.test_file_name, 'w') as nc:
# Create data group
Expand Down
5 changes: 3 additions & 2 deletions satpy/tests/writer_tests/test_cf.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,13 +36,14 @@
class TempFile(object):
"""A temporary filename class."""

def __init__(self):
def __init__(self, suffix=".nc"):
"""Initialize."""
self.filename = None
self.suffix = suffix

def __enter__(self):
"""Enter."""
self.handle, self.filename = tempfile.mkstemp()
self.handle, self.filename = tempfile.mkstemp(suffix=self.suffix)
os.close(self.handle)
return self.filename

Expand Down

0 comments on commit 288c0bc

Please sign in to comment.