Coverage for tests/test_usage.py: 40%

18 statements  

« prev     ^ index     » next       coverage.py v6.5.0, created at 2023-03-09 03:04 -0800

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 

14from astropy import units as u 

15from lsst.utils.usage import get_current_mem_usage, get_peak_mem_usage 

16 

17 

18class UsageTestCase(unittest.TestCase): 

19 def testGetCurrentMemUsage(self): 

20 main, children = get_current_mem_usage() 

21 self.assertGreater(main, 0 * u.byte) 

22 self.assertGreaterEqual(children, 0 * u.byte) 

23 

24 self.assertTrue(main.unit.is_equivalent(u.byte)) 

25 self.assertTrue(children.unit.is_equivalent(u.byte)) 

26 

27 def testGetPeakMemUsage(self): 

28 main, child = get_peak_mem_usage() 

29 self.assertGreater(main, 0 * u.byte) 

30 self.assertGreaterEqual(child, 0 * u.byte) 

31 

32 self.assertTrue(main.unit.is_equivalent(u.byte)) 

33 self.assertTrue(child.unit.is_equivalent(u.byte)) 

34 

35 

36if __name__ == "__main__": 36 ↛ 37line 36 didn't jump to line 37, because the condition on line 36 was never true

37 unittest.main()