The modifications in this commit allows the unit tests to run on both, pytest 6.x (nose test layout) and the new pytest 7.x (xunit test layout). This Fixes #2072 in a much nicer way. Thanks much to @smarlowucf
26 lines
707 B
Python
26 lines
707 B
Python
from mock import patch
|
|
|
|
from kiwi.utils.temporary import Temporary
|
|
|
|
|
|
class TestTemporary:
|
|
def setup(self):
|
|
self.temporary = Temporary()
|
|
|
|
def setup_method(self, cls):
|
|
self.setup()
|
|
|
|
@patch('kiwi.utils.temporary.NamedTemporaryFile')
|
|
def test_new_file(self, mock_NamedTemporaryFile):
|
|
self.temporary.new_file()
|
|
mock_NamedTemporaryFile.assert_called_once_with(
|
|
dir='/var/tmp', prefix='kiwi_'
|
|
)
|
|
|
|
@patch('kiwi.utils.temporary.TemporaryDirectory')
|
|
def test_new_dir(self, mock_TemporaryDirectory):
|
|
self.temporary.new_dir()
|
|
mock_TemporaryDirectory.assert_called_once_with(
|
|
dir='/var/tmp', prefix='kiwi_'
|
|
)
|