Skip to content

Commit

Permalink
ok, test only works for windows
Browse files Browse the repository at this point in the history
  • Loading branch information
forman committed Jun 16, 2019
1 parent 25547ac commit 1be98be
Showing 1 changed file with 11 additions and 10 deletions.
21 changes: 11 additions & 10 deletions test/cli/test_prune.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import os.path

import sys
import numpy as np
import xarray as xr

Expand Down Expand Up @@ -102,12 +102,13 @@ def monitor(message):
self.assertEqual(None, actual_message)
self.assertFalse(os.path.exists(os.path.join(self.TEST_CUBE, 'precipitation', '1.1.0')))

# Open block, so we cannot delete
path = os.path.join(self.TEST_CUBE, 'precipitation', '1.1.1')
# noinspection PyUnusedLocal
with open(path, 'wb') as fp:
actual_message = None
ok = _delete_block_file(self.TEST_CUBE, 'precipitation', (1, 1, 1), False, monitor=monitor)
self.assertFalse(ok)
self.assertIsNotNone(actual_message)
self.assertTrue(actual_message.startswith(f'error: failed to delete block file {path}: '))
if sys.platform == 'win32':
path = os.path.join(self.TEST_CUBE, 'precipitation', '1.1.1')
# Open block, so we cannot delete (Windows only)
# noinspection PyUnusedLocal
with open(path, 'wb') as fp:
actual_message = None
ok = _delete_block_file(self.TEST_CUBE, 'precipitation', (1, 1, 1), False, monitor=monitor)
self.assertFalse(ok)
self.assertIsNotNone(actual_message)
self.assertTrue(actual_message.startswith(f'error: failed to delete block file {path}: '))

0 comments on commit 1be98be

Please sign in to comment.