File tree Expand file tree Collapse file tree 1 file changed +16
-4
lines changed
label_studio_ml/examples/timeseries_segmenter/tests Expand file tree Collapse file tree 1 file changed +16
-4
lines changed Original file line number Diff line number Diff line change 33import sys
44from unittest .mock import patch
55
6- sys .path .append (os .path .abspath (os .path .join (os .path .dirname (__file__ ), "../../../.." )))
7-
86import pytest
97
10- from label_studio_ml .examples .timeseries_segmenter .model import TimeSeriesSegmenter
11- from label_studio_ml .examples .timeseries_segmenter ._wsgi import init_app
8+ # Skip tests if scikit-learn isn't available
9+ pytest .importorskip ("sklearn" )
10+
11+ TEST_DIR = os .path .dirname (__file__ )
12+ EXAMPLE_DIR = os .path .abspath (os .path .join (TEST_DIR , ".." ))
13+ REPO_ROOT = os .path .abspath (os .path .join (TEST_DIR , "../../../.." ))
14+ for path in (EXAMPLE_DIR , REPO_ROOT ):
15+ if path not in sys .path :
16+ sys .path .insert (0 , path )
17+
18+ try :
19+ from label_studio_ml .examples .timeseries_segmenter .model import TimeSeriesSegmenter
20+ from label_studio_ml .examples .timeseries_segmenter ._wsgi import init_app
21+ except ImportError : # running inside example Docker image
22+ from model import TimeSeriesSegmenter
23+ from _wsgi import init_app
1224
1325TEST_DIR = os .path .dirname (__file__ )
1426CSV_PATH = os .path .join (TEST_DIR , "time_series.csv" )
You can’t perform that action at this time.
0 commit comments