kiwi-el8/test/unit/system_size_test.py
Marcus Schäfer e6cc5bfa09 Move from nose to pytest
nose is no longer maintained, thus we have to move to another
testing system. This commit updates the tox setup and all tests
to use pytest instead of nose.
2016-03-14 12:23:14 +01:00

41 lines
1.1 KiB
Python

from mock import patch
import mock
from .test_helper import *
from collections import namedtuple
from kiwi.system.size import SystemSize
class TestSystemSize(object):
def setup(self):
self.size = SystemSize('directory')
def test_customize_ext(self):
self.size.accumulate_files = mock.Mock(
return_value=10000
)
assert self.size.customize(42, 'ext3') == 67
def test_customize_btrfs(self):
assert self.size.customize(42, 'btrfs') == 63
def test_customize_xfs(self):
assert self.size.customize(42, 'xfs') == 50
@patch('kiwi.system.size.Command.run')
def test_accumulate_mbyte_file_sizes(self, mock_command):
self.size.accumulate_mbyte_file_sizes()
mock_command.assert_called_once_with(
['du', '-s', '--apparent-size', '--block-size', '1', 'directory']
)
@patch('kiwi.system.size.Command.run')
def test_accumulate_files(self, mock_command):
self.size.accumulate_files()
mock_command.assert_called_once_with(
['bash', '-c', 'find directory | wc -l']
)