File tree Expand file tree Collapse file tree 2 files changed +0
-26
lines changed Expand file tree Collapse file tree 2 files changed +0
-26
lines changed Original file line number Diff line number Diff line change @@ -18,20 +18,8 @@ def set_next_run(self, next_time: datetime):
18
18
raise AssertionError ("The next_time parameter should be a datetime object." )
19
19
self .at_time = next_time
20
20
self .next_run = next_time
21
- self .should_run = True
22
-
23
- @property
24
- def should_run (self ):
25
- return self ._keep_running and super ().should_run
26
-
27
- @should_run .setter
28
- def should_run (self , value ):
29
- self ._keep_running = value
30
21
31
22
def run (self ):
32
- # This prevents the job from running more than once
33
- self .should_run = False
34
-
35
23
super ().run ()
36
24
return schedule .CancelJob ()
37
25
Original file line number Diff line number Diff line change 3
3
from datetime import datetime
4
4
from pathlib import Path
5
5
from typing import Dict
6
- from unittest .mock import Mock
7
6
8
7
import pytest
9
8
@@ -32,19 +31,6 @@ def job(path: str):
32
31
assert float (file .readline ()) - 2 == pytest .approx (start , abs = 0.3 )
33
32
34
33
35
- def test_once_single_call ():
36
- mock = Mock ()
37
- mock .side_effect = lambda : time .sleep (0.2 )
38
-
39
- schedule .once ().do (mock )
40
-
41
- for _ in range (10 ):
42
- schedule .run_pending ()
43
- time .sleep (0.05 )
44
-
45
- mock .assert_called_once ()
46
-
47
-
48
34
def test_recurring_thread ():
49
35
def job (modifiable_arg : Dict ):
50
36
# Modify the variable, which should be shared with the main thread.
You can’t perform that action at this time.
0 commit comments