mirror of
https://github.com/saltstack/salt.git
synced 2025-04-17 10:10:20 +00:00
Python 3-compatibility fix to unit test
This should not be returning a string type for stderr, since Popen.communicate() returns a bytestring. In Python 2, the str and bytes types are the same, but the same is not true in Python 3. Additionally, the mocking here seems not to consider the fact that Popen is called when runas is used to get the runas user's environment. Since this test doesn't care about the output, we can just make the mocked Popen.communicate() return an empty bytestring.
This commit is contained in:
parent
27f651906d
commit
e8582e80f2
1 changed files with 1 additions and 1 deletions
|
@ -274,7 +274,7 @@ class CMDMODTestCase(TestCase, LoaderModuleMockMixin):
|
|||
environment = os.environ.copy()
|
||||
|
||||
popen_mock.return_value = Mock(
|
||||
communicate=lambda *args, **kwags: ['{}', None],
|
||||
communicate=lambda *args, **kwags: [b'', None],
|
||||
pid=lambda: 1,
|
||||
retcode=0
|
||||
)
|
||||
|
|
Loading…
Add table
Reference in a new issue