Skip to content
Snippets Groups Projects
Commit 25dbef8a authored by Srikanth Ravipati's avatar Srikanth Ravipati
Browse files

Deleted memorywidget related tests from workbench

as they are part of mantidqt now
parent c2487706
No related branches found
No related tags found
No related merge requests found
# Mantid Repository : https://github.com/mantidproject/mantid
#
# Copyright © 2018 ISIS Rutherford Appleton Laboratory UKRI,
# NScD Oak Ridge National Laboratory, European Spallation Source,
# Institut Laue - Langevin & CSNS, Institute of High Energy Physics, CAS
# SPDX - License - Identifier: GPL - 3.0 +
# Mantid Repository : https://github.com/mantidproject/mantid
#
# Copyright © 2019 ISIS Rutherford Appleton Laboratory UKRI,
# NScD Oak Ridge National Laboratory, European Spallation Source,
# Institut Laue - Langevin & CSNS, Institute of High Energy Physics, CAS
# SPDX - License - Identifier: GPL - 3.0 +
# This file is part of the mantid workbench.
#
#
import unittest
from workbench.plugins.memorywidget.memoryinfo import get_memory_info
class MemoryInfoTest(unittest.TestCase):
def test_memoryinfo(self):
mem_used_percent, mem_used, mem_total = get_memory_info()
self.assertTrue(isinstance(mem_used_percent, int))
self.assertTrue(0 <= mem_used_percent <= 100)
if __name__ == "__main__":
unittest.main()
# Mantid Repository : https://github.com/mantidproject/mantid
#
# Copyright &copy; 2019 ISIS Rutherford Appleton Laboratory UKRI,
# NScD Oak Ridge National Laboratory, European Spallation Source,
# Institut Laue - Langevin & CSNS, Institute of High Energy Physics, CAS
# SPDX - License - Identifier: GPL - 3.0 +
# This file is part of the mantid workbench.
#
#
from workbench.plugins.memorywidget.memoryview import MemoryView, \
from_normal_to_critical, from_critical_to_normal
from workbench.plugins.memorywidget.memorypresenter import MemoryPresenter
import unittest
from unittest import mock
class MemoryPresenterTest(unittest.TestCase):
def setUp(self):
self.view = mock.create_autospec(MemoryView)
self.mock_view_internals()
self.presenter = MemoryPresenter(self.view)
def mock_view_internals(self):
self.view.critical = 90
self.view.memory_bar = mock.Mock()
self.view.memory_bar.value.return_value = 0
self.view.set_bar_color = mock.Mock()
self.view.set_value = mock.Mock()
def test_presenter(self):
self.assertTrue(from_normal_to_critical(self.presenter.view.critical,
75, 95))
self.assertFalse(from_critical_to_normal(self.presenter.view.critical,
75, 95))
self.assertFalse(from_normal_to_critical(self.presenter.view.critical,
95, 75))
self.assertTrue(from_critical_to_normal(self.presenter.view.critical,
95, 75))
self.assertEqual(self.presenter.view.set_value.call_count, 1)
self.assertEqual(self.presenter.view.set_bar_color.call_count, 1)
self.presenter.update_memory_usage()
self.assertEqual(self.presenter.view.set_value.call_count, 2)
if __name__ == "__main__":
unittest.main()
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment