Example #1
0
    def get_dir_size_test(self):
        """Test the get_dir_size function."""

        # dev null should have a size == 0
        self.assertEqual(get_dir_size('/dev/null'), 0)

        # incorrect path should also return 0
        self.assertEqual(get_dir_size('/dev/null/foo'), 0)

        # check if an int is always returned
        self.assertIsInstance(get_dir_size('/dev/null'), int)
        self.assertIsInstance(get_dir_size('/dev/null/foo'), int)
    def test_get_dir_size(self):
        """Test the get_dir_size function."""

        # dev null should have a size == 0
        assert get_dir_size('/dev/null') == 0

        # incorrect path should also return 0
        assert get_dir_size('/dev/null/foo') == 0

        # check if an int is always returned
        assert isinstance(get_dir_size('/dev/null'), int)
        assert isinstance(get_dir_size('/dev/null/foo'), int)
Example #3
0
    def required_space(self):
        """The space required for the installation.

        :return: required size in bytes
        :rtype: int
        """
        # FIXME: Unify the required space with the installation size.
        return get_dir_size("/") * 1024
Example #4
0
    def _get_required_space():
        # TODO: This is not that fast as I thought (a few seconds). Caching or solved in task?
        size = get_dir_size("/") * 1024

        # we don't know the size -- this should not happen
        if size == 0:
            log.debug("Space required is not known. This should not happen!")
            return None
        else:
            return size
Example #5
0
 def space_required(self):
     from pyanaconda.modules.payloads.base.utils import get_dir_size
     return Size(get_dir_size("/") * 1024)