kiwi-el8/test/unit/path_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

46 lines
1.2 KiB
Python

from mock import patch
import mock
from .test_helper import *
from kiwi.exceptions import *
from kiwi.path import Path
class TestPath(object):
def test_sort_by_hierarchy(self):
ordered = Path.sort_by_hierarchy(
['usr', 'usr/bin', 'etc', 'usr/lib']
)
assert ordered == ['usr', 'etc', 'usr/bin', 'usr/lib']
@patch('kiwi.command.Command.run')
def test_create(self, mock_command):
Path.create('foo')
mock_command.assert_called_once_with(
['mkdir', '-p', 'foo']
)
@patch('kiwi.command.Command.run')
def test_wipe(self, mock_command):
Path.wipe('foo')
mock_command.assert_called_once_with(
['rm', '-r', '-f', 'foo']
)
@patch('kiwi.command.Command.run')
def test_remove(self, mock_command):
Path.remove('foo')
mock_command.assert_called_once_with(
['rmdir', 'foo']
)
@patch('kiwi.command.Command.run')
def test_remove_hierarchy(self, mock_command):
Path.remove_hierarchy('foo')
mock_command.assert_called_once_with(
['rmdir', '-p', '--ignore-fail-on-non-empty', 'foo']
)