-
Notifications
You must be signed in to change notification settings - Fork 23
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
77a72e8
commit 311ed71
Showing
6 changed files
with
57 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
from time import sleep | ||
|
||
from HABApp import Rule | ||
from HABApp.core.internals import get_current_context | ||
from HABAppTests import TestBaseRule | ||
|
||
|
||
class OtherRule(Rule): | ||
|
||
def check_context(self): | ||
assert get_current_context() is self._habapp_ctx | ||
|
||
|
||
other_rule = OtherRule() | ||
|
||
|
||
def func_no_context(target_context): | ||
assert get_current_context() is target_context | ||
|
||
|
||
class TestContext(TestBaseRule): | ||
|
||
def __init__(self): | ||
super().__init__() | ||
self.add_test('TestGetContext', self.test_get_context) | ||
self.add_test('TestSchedulerContext', self.test_scheduler_context) | ||
|
||
def test_get_context(self): | ||
assert get_current_context() is self._habapp_ctx | ||
other_rule.check_context() | ||
|
||
def test_scheduler_context(self): | ||
self.run.soon(func_no_context, self._habapp_ctx) | ||
self.run.soon(other_rule.check_context) | ||
sleep(0.1) | ||
|
||
|
||
TestContext() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
# Version scheme: | ||
# X.X[.X] or X.X[.X].DEV-X | ||
|
||
__version__ = '1.1.0' | ||
__version__ = '1.1.1' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters