blob: 69cf969a67bebd0359792150225f66cada17bfe0 [file] [log] [blame]
Brad Bishopc342db32019-05-15 21:57:59 -04001#
Brad Bishop6e60e8b2018-02-01 10:27:11 -05002# Copyright (C) 2016 Intel Corporation
Brad Bishopc342db32019-05-15 21:57:59 -04003#
4# SPDX-License-Identifier: MIT
5#
Brad Bishop6e60e8b2018-02-01 10:27:11 -05006
7from time import sleep
8
9from oeqa.core.case import OETestCase
10from oeqa.core.decorator.oetimeout import OETimeout
Andrew Geisslerc926e172021-05-07 16:11:35 -050011from oeqa.core.decorator.depends import OETestDepends
Brad Bishop6e60e8b2018-02-01 10:27:11 -050012
13class TimeoutTest(OETestCase):
14
15 @OETimeout(1)
16 def testTimeoutPass(self):
17 self.assertTrue(True, msg='How is this possible?')
18
19 @OETimeout(1)
20 def testTimeoutFail(self):
21 sleep(2)
22 self.assertTrue(True, msg='How is this possible?')
Andrew Geisslerc926e172021-05-07 16:11:35 -050023
24
25 def testTimeoutSkip(self):
26 self.skipTest("This test needs to be skipped, so that testTimeoutDepends()'s OETestDepends kicks in")
27
28 @OETestDepends(["timeout.TimeoutTest.testTimeoutSkip"])
29 @OETimeout(3)
30 def testTimeoutDepends(self):
31 self.assertTrue(False, msg='How is this possible?')
32
33 def testTimeoutUnrelated(self):
34 sleep(6)