File tree Expand file tree Collapse file tree 3 files changed +23
-1
lines changed Expand file tree Collapse file tree 3 files changed +23
-1
lines changed Original file line number Diff line number Diff line change 2323
2424class RunTest :
2525 """ Response to StartTest indicating that the test can be started"""
26- pass
26+
27+ def __init__ (self , capabilities = []):
28+ self .capabilities = capabilities
2729
2830
2931class SkipTest :
Original file line number Diff line number Diff line change @@ -29,6 +29,22 @@ def new_backend():
2929 return Backend (host , port )
3030
3131
32+ def driver_feature (capability ):
33+ def get_valid_test_case (* args , ** kwargs ):
34+ if not isinstance (args [0 ], TestkitTestCase ):
35+ raise Exception ('Should only decorate TestkitTestCase' )
36+ return args [0 ]
37+
38+ def driver_feature_decorator (func ):
39+ def wrapper (* args , ** kwargs ):
40+ test_case = get_valid_test_case (* args , ** kwargs )
41+ if (capability not in test_case ._driver_capabilities ):
42+ test_case .skipTest ("Needs support for %s" % capability )
43+ return func (* args , ** kwargs )
44+ return wrapper
45+ return driver_feature_decorator
46+
47+
3248def get_driver_name ():
3349 return os .environ ['TEST_DRIVER_NAME' ]
3450
@@ -46,3 +62,4 @@ def setUp(self):
4662 raise Exception ("Should be SkipTest or RunTest, "
4763 "received {}: {}" .format (type (response ),
4864 response ))
65+ self ._driver_capabilities = response .capabilities
Original file line number Diff line number Diff line change 33from tests .shared import (
44 get_driver_name ,
55 TestkitTestCase ,
6+ driver_feature
67)
78from tests .stub .shared import StubServer
89
@@ -698,6 +699,7 @@ def read_return_1_failure_return_2_succeed_script(self):
698699 +}
699700 """
700701
702+ @driver_feature ('AutorizationExpiredTreament' )
701703 def test_should_drop_connection_after_AuthorizationExpired (self ):
702704 self ._server .start (
703705 script = self .read_return_1_failure_return_2_succeed_script ()
@@ -732,6 +734,7 @@ def test_should_drop_connection_after_AuthorizationExpired(self):
732734
733735 driver .close ()
734736
737+ @driver_feature ('AutorizationExpiredTreament' )
735738 def test_should_be_able_to_use_current_sessions_after_AuthorizationExpired (self ):
736739 self ._server .start (
737740 script = self .read_return_1_failure_return_2_succeed_script ()
You can’t perform that action at this time.
0 commit comments