File tree Expand file tree Collapse file tree 2 files changed +20
-1
lines changed Expand file tree Collapse file tree 2 files changed +20
-1
lines changed Original file line number Diff line number Diff line change @@ -41,10 +41,13 @@ jobs:
41
41
os : [ubuntu-latest, windows-latest, macos-latest]
42
42
include :
43
43
- os : ubuntu-latest
44
+ init_performance_threshold_sec : 0.001
44
45
performance_threshold_sec : 0.006
45
46
- os : windows-latest
47
+ init_performance_threshold_sec : 0.001
46
48
performance_threshold_sec : 0.006
47
49
- os : macos-latest
50
+ init_performance_threshold_sec : 0.001
48
51
performance_threshold_sec : 0.006
49
52
50
53
steps :
62
65
run : pip install -r requirements.txt
63
66
64
67
- name : Test
65
- run : python test_cobra_perf.py ${{secrets.PV_VALID_ACCESS_KEY}} 100 ${{matrix.performance_threshold_sec}}
68
+ run : python test_cobra_perf.py ${{secrets.PV_VALID_ACCESS_KEY}} 100 ${{matrix.performance_threshold_sec}} ${{matrix.init_performance_threshold_sec}}
66
69
67
70
perf-self-hosted :
68
71
runs-on : ${{ matrix.machine }}
Original file line number Diff line number Diff line change @@ -22,8 +22,24 @@ class CobraPerformanceTestCase(unittest.TestCase):
22
22
ACCESS_KEY = sys .argv [1 ]
23
23
NUM_TEST_ITERATIONS = int (sys .argv [2 ])
24
24
PERFORMANCE_THRESHOLD_SEC = float (sys .argv [3 ])
25
+ INIT_THRESHOLD_SEC = float (sys .argv .get (4 , 0.005 ))
25
26
26
27
def test_performance (self ):
28
+ init_results = []
29
+ for i in range (self .NUM_TEST_ITERATIONS ):
30
+ start = time ()
31
+ c = Cobra (access_key = sys .argv [1 ], library_path = pv_library_path ('../..' ))
32
+ init_time = time .time () - start
33
+
34
+ c .delete ()
35
+
36
+ if i > 0 :
37
+ init_results .append (init_time )
38
+
39
+ avg_init = sum (init_results ) / self .NUM_TEST_ITERATIONS
40
+ print ("Average init: %s" % avg_init )
41
+ self .assertLess (avg_init , self .INIT_THRESHOLD_SEC )
42
+
27
43
cobra = Cobra (access_key = sys .argv [1 ], library_path = pv_library_path ('../..' ))
28
44
audio = read_wav_file (
29
45
os .path .join (os .path .dirname (__file__ ), '../../res/audio/sample.wav' ),
You can’t perform that action at this time.
0 commit comments