Fix the test for proofofwork.LogOutput()

This commit is contained in:
Lee Miller 2023-09-27 03:00:05 +03:00
parent b66dfcaebb
commit e8af6201e1
Signed by untrusted user: lee.miller
GPG Key ID: 4F97A5EA88F4AB63

View File

@ -14,8 +14,8 @@ class TestLog(unittest.TestCase):
sys.hexversion < 0x3000000, 'assertLogs is new in version 3.4') sys.hexversion < 0x3000000, 'assertLogs is new in version 3.4')
def test_LogOutput(self): def test_LogOutput(self):
"""Use proofofwork.LogOutput to log output of a shell command""" """Use proofofwork.LogOutput to log output of a shell command"""
def echo(): with self.assertLogs('default') as cm: # pylint: disable=no-member
"""Call the echo shell command""" with proofofwork.LogOutput('+'):
with proofofwork.LogOutput():
subprocess.call(['echo', 'HELLO']) subprocess.call(['echo', 'HELLO'])
self.assertLogs(echo(), 'HELLO') # pylint: disable=no-member
self.assertEqual(cm.output, ['INFO:default:+: HELLO\n'])