Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def test_command_non_unicode(self):
getpreferredencoding_orig = locale.getpreferredencoding
locale.getpreferredencoding = lambda: "ISO-8859-1"
output, __, __ = exec_cmd("echo -n 'this is a test'")
self.assertEqual(output, "this is a test")
locale.getpreferredencoding = getpreferredencoding_orig
def test_command(self):
output, __, __ = exec_cmd("echo -n 'this is a test'")
self.assertEqual(output, "this is a test")