MCPcopy Create free account
hub / github.com/bleachbit/bleachbit / test_pacman_cache_mock

Method test_pacman_cache_mock

tests/TestUnix.py:783–796  ·  view source on GitHub ↗

Unit test pacman_cache() parse logic without pacman installed

(self, mock_path, mock_exe_exists, mock_run)

Source from the content-addressed store, hash-verified

781 @mock.patch('bleachbit.Unix.exe_exists')
782 @mock.patch('bleachbit.Unix.os.path')
783 def test_pacman_cache_mock(self, mock_path, mock_exe_exists, mock_run):
784 """Unit test pacman_cache() parse logic without pacman installed"""
785 mock_path.exists.return_value = False
786 mock_exe_exists.return_value = True
787 mock_run.return_value = (
788 0,
789 "==> finished: 3 packages removed (42.31 M freed)\n",
790 ''
791 )
792
793 bytes_freed = pacman_cache()
794 self.assertEqual(bytes_freed, 42310000)
795
796 mock_run.assert_called_once_with(['paccache', '-rk0'])
797
798 @common.skipIfWindows
799 @common.skipUnlessDestructive

Callers

nothing calls this directly

Calls 1

pacman_cacheFunction · 0.90

Tested by

no test coverage detected