Coverage for tests/test_ordering.py: 27%

15 statements  

« prev     ^ index     » next       coverage.py v7.2.7, created at 2023-07-25 09:27 +0000

1# This file is part of utils. 

2# 

3# Developed for the LSST Data Management System. 

4# This product includes software developed by the LSST Project 

5# (https://www.lsst.org). 

6# See the COPYRIGHT file at the top-level directory of this distribution 

7# for details of code ownership. 

8# 

9# Use of this source code is governed by a 3-clause BSD-style 

10# license that can be found in the LICENSE file. 

11 

12import unittest 

13 

14import lsst.utils.tests 

15 

16 

17class TestCaseOrdering(lsst.utils.tests.TestCase): 

18 """Test that tests are ordered as expected.""" 

19 

20 def testTestOrdering(self): 

21 class DummyTest(lsst.utils.tests.TestCase): 

22 def noOp(self): 

23 pass 

24 

25 class DummyMemoryTest(lsst.utils.tests.MemoryTestCase): 

26 pass 

27 

28 class DummyTest2(unittest.TestCase): 

29 def noOp(self): 

30 pass 

31 

32 suite = unittest.defaultTestLoader.suiteClass( 

33 [DummyTest2("noOp"), DummyMemoryTest("testFileDescriptorLeaks"), DummyTest("noOp")] 

34 ) 

35 

36 self.assertNotIsInstance(suite._tests[0], lsst.utils.tests.MemoryTestCase) 

37 self.assertIsInstance(suite._tests[-1], lsst.utils.tests.MemoryTestCase) 

38 

39 

40if __name__ == "__main__": 

41 unittest.main()