Coverage for tests/test_usage.py: 38%
16 statements
« prev ^ index » next coverage.py v6.5.0, created at 2023-04-13 09:31 +0000
« prev ^ index » next coverage.py v6.5.0, created at 2023-04-13 09:31 +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.
12import unittest
14from astropy import units as u
15from lsst.utils.usage import get_current_mem_usage, get_peak_mem_usage
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)
24 self.assertTrue(main.unit.is_equivalent(u.byte))
25 self.assertTrue(children.unit.is_equivalent(u.byte))
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)
32 self.assertTrue(main.unit.is_equivalent(u.byte))
33 self.assertTrue(child.unit.is_equivalent(u.byte))
36if __name__ == "__main__":
37 unittest.main()