fix pexpect.spawn.match AttributeError
Jenkins randomly throws AttributeErrors on pexpect.spawn.match, mock the return value to fix this. Co-Authored-By: Denis M. <dmakogon@mirantis.com> Change-Id: I8b0ed7f8c474bedbbd60944bdd5a4119b0a6faea Closes-Bug: #1348601
This commit is contained in:
parent
8bbcc3949c
commit
d2b95d18b7
|
@ -440,6 +440,7 @@ class PkgRPMRemoveTestCase(testtools.TestCase):
|
|||
def test_package_not_found(self):
|
||||
# test
|
||||
pexpect.spawn.expect = Mock(return_value=1)
|
||||
pexpect.spawn.match = False
|
||||
# test and verify
|
||||
self.assertRaises(pkg.PkgNotFoundError, self.pkg.pkg_remove,
|
||||
self.pkgName, 5000)
|
||||
|
@ -447,12 +448,14 @@ class PkgRPMRemoveTestCase(testtools.TestCase):
|
|||
def test_success_remove(self):
|
||||
# test
|
||||
pexpect.spawn.expect = Mock(return_value=2)
|
||||
pexpect.spawn.match = False
|
||||
self.assertTrue(self.pkg.pkg_remove(self.pkgName, 5000) is None)
|
||||
|
||||
def test_timeout_error(self):
|
||||
# test timeout error
|
||||
pexpect.spawn.expect = Mock(side_effect=pexpect.
|
||||
TIMEOUT('timeout error'))
|
||||
pexpect.spawn.match = False
|
||||
# test and verify
|
||||
self.assertRaises(pkg.PkgTimeout, self.pkg.pkg_remove,
|
||||
self.pkgName, 5000)
|
||||
|
|
Loading…
Reference in New Issue