[Forensics-changes] [yara] 280/415: Make tests.py compatible with Python 3

Hilko Bengen bengen at moszumanska.debian.org
Thu Apr 3 05:43:15 UTC 2014


This is an automated email from the git hooks/post-receive script.

bengen pushed a commit to branch debian
in repository yara.

commit 1643e7518443807a71751c9c65a14b4e85026ad1
Author: Victor M. Alvarez <plusvic at gmail.com>
Date:   Tue Dec 3 16:47:53 2013 +0100

    Make tests.py compatible with Python 3
---
 yara-python/tests.py | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/yara-python/tests.py b/yara-python/tests.py
index 8d68ed2..447995e 100644
--- a/yara-python/tests.py
+++ b/yara-python/tests.py
@@ -1,6 +1,7 @@
 import tempfile
 import binascii
 import os
+import sys
 import unittest
 import yara
 
@@ -172,7 +173,10 @@ class TestYara(unittest.TestCase):
           if expected_result == SUCCEED:
             self.assertTrue(matches)
             _, _, matching_string = matches[0].strings[0]
-            self.assertTrue(matching_string == test[3])
+            if sys.version_info.major >= 3:
+              self.assertTrue(matching_string == bytes(test[3], 'utf-8'))
+            else:
+              self.assertTrue(matching_string == test[3])
           else:
             self.assertFalse(matches)
 
@@ -374,7 +378,7 @@ class TestYara(unittest.TestCase):
         for test in RE_TESTS:
             try:
                 self.runReTest(test)
-            except Exception, e:
+            except Exception as e:
                 print '\nFailed test: %s\n' % str(test)
                 raise e
 

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/forensics/yara.git



More information about the forensics-changes mailing list