Skip to content

Commit 6d4b24e

Browse files
committed
Fix test_tsfresh: skip when tsfresh import fails on CPU
tsfresh -> stumpy -> numba.cuda, which requires libcudart.so. Guard the import so the test is skipped on CPU rather than crashing.
1 parent 0887590 commit 6d4b24e

1 file changed

Lines changed: 6 additions & 3 deletions

File tree

tests/test_tsfresh.py

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,13 @@
33
import pandas as pd
44
import numpy as np
55

6-
from tsfresh import extract_features
6+
try:
7+
from tsfresh import extract_features
8+
HAS_TSFRESH = True
9+
except ImportError:
10+
HAS_TSFRESH = False
711

12+
@unittest.skipUnless(HAS_TSFRESH, 'tsfresh is not importable (may require CUDA libs)')
813
class TestTsFresh(unittest.TestCase):
914
def test_extract_feature(self):
1015
ts = pd.DataFrame({
@@ -14,5 +19,3 @@ def test_extract_feature(self):
1419
})
1520
extracted_features = extract_features(ts, column_id='id', column_sort='time', n_jobs=1)
1621
self.assertEqual(2, len(extracted_features))
17-
18-

0 commit comments

Comments
 (0)