Brad Bishop | c342db3 | 2019-05-15 21:57:59 -0400 | [diff] [blame] | 1 | # |
Brad Bishop | 6e60e8b | 2018-02-01 10:27:11 -0500 | [diff] [blame] | 2 | # Copyright (C) 2016 Intel Corporation |
Brad Bishop | c342db3 | 2019-05-15 21:57:59 -0400 | [diff] [blame] | 3 | # |
| 4 | # SPDX-License-Identifier: MIT |
| 5 | # |
Brad Bishop | 6e60e8b | 2018-02-01 10:27:11 -0500 | [diff] [blame] | 6 | |
| 7 | from time import sleep |
| 8 | |
| 9 | from oeqa.core.case import OETestCase |
| 10 | from oeqa.core.decorator.oetimeout import OETimeout |
Andrew Geissler | c926e17 | 2021-05-07 16:11:35 -0500 | [diff] [blame^] | 11 | from oeqa.core.decorator.depends import OETestDepends |
Brad Bishop | 6e60e8b | 2018-02-01 10:27:11 -0500 | [diff] [blame] | 12 | |
| 13 | class 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 Geissler | c926e17 | 2021-05-07 16:11:35 -0500 | [diff] [blame^] | 23 | |
| 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) |