Skip to content

Commit 67364b0

Browse files
author
Matt Bertrand
committed
Skip convert test if cdo/netcdf not installed
1 parent 02a4f39 commit 67364b0

1 file changed

Lines changed: 8 additions & 3 deletions

File tree

dataqs/udatp/tests.py

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919

2020
import glob
2121
import os
22+
import unittest
2223
from datetime import date
2324
from django.test import TestCase
2425
from dataqs.udatp.udatp import UoDAirTempPrecipProcessor
@@ -103,9 +104,13 @@ def test_date(self):
103104
def test_convert(self, ftp_mock):
104105
cdf_files = self.processor.download()
105106
for cdf in cdf_files:
106-
self.processor.convert(cdf)
107-
self.assertNotEqual([], glob.glob(cdf.replace(
108-
'.nc', '.classic.lng.nc')))
107+
try:
108+
self.processor.convert(cdf)
109+
self.assertNotEqual([], glob.glob(cdf.replace(
110+
'.nc', '.classic.lng.nc')))
111+
except OSError:
112+
# cdo and/or netcdf not installed
113+
raise unittest.SkipTest()
109114

110115
@patch('ftplib.FTP', autospec=True)
111116
@patch('ftplib.FTP.retrbinary', mock_retrbinary_tif)

0 commit comments

Comments
 (0)