Merge "adapt to oslo.log changes"
This commit is contained in:
commit
53012f1c55
@ -13,6 +13,7 @@
|
|||||||
# under the License.
|
# under the License.
|
||||||
|
|
||||||
import errno
|
import errno
|
||||||
|
import fixtures
|
||||||
import os
|
import os
|
||||||
from unittest import mock
|
from unittest import mock
|
||||||
|
|
||||||
@ -55,6 +56,13 @@ class SupportDirectIOTestCase(test.NoDBTestCase):
|
|||||||
self.mock_close = close_patcher.start()
|
self.mock_close = close_patcher.start()
|
||||||
self.mock_unlink = unlink_patcher.start()
|
self.mock_unlink = unlink_patcher.start()
|
||||||
random_string_patcher.start()
|
random_string_patcher.start()
|
||||||
|
# as of change Iac1b0891ae584ce4b95964e6cdc0ff2483a4e57d in oslo.log
|
||||||
|
# oslo.log will now internally call os.write() in its PipeMutex code.
|
||||||
|
# This causes the mock_write() to be called which breaks some of
|
||||||
|
# the testcases as we expect mock_write() to be called only
|
||||||
|
# by the code under test.
|
||||||
|
self.useFixture(fixtures.MonkeyPatch(
|
||||||
|
"nova.privsep.utils.LOG", mock.Mock()))
|
||||||
|
|
||||||
def test_supports_direct_io(self):
|
def test_supports_direct_io(self):
|
||||||
self.mock_open.return_value = 3
|
self.mock_open.return_value = 3
|
||||||
@ -85,6 +93,7 @@ class SupportDirectIOTestCase(test.NoDBTestCase):
|
|||||||
def test_supports_direct_io_with_exception_in_open(self):
|
def test_supports_direct_io_with_exception_in_open(self):
|
||||||
self.mock_open.side_effect = ValueError()
|
self.mock_open.side_effect = ValueError()
|
||||||
|
|
||||||
|
self.mock_open.assert_not_called()
|
||||||
self.assertRaises(ValueError, nova.privsep.utils.supports_direct_io,
|
self.assertRaises(ValueError, nova.privsep.utils.supports_direct_io,
|
||||||
'.')
|
'.')
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user