*.pyc
.coverage
+.tox
htmlcov
tags
build
# Eli Bendersky (eliben@gmail.com)
# This code is in the public domain
#-------------------------------------------------------------------------------
-from unittest import TestLoader, TextTestRunner
+try:
+ import unittest2 as unittest
+except ImportError:
+ import unittest
if __name__ == '__main__':
try:
- tests = TestLoader().discover('test', 'test*.py', 'test')
- TextTestRunner().run(tests)
+ tests = unittest.TestLoader().discover('test', 'test*.py', 'test')
+ unittest.TextTestRunner().run(tests)
except ImportError as err:
print err
print '!! Please execute from the root directory of pyelftools'
-import sys, unittest
+try:
+ import unittest2 as unittest
+except ImportError:
+ import unittest
+import sys
from cStringIO import StringIO
sys.path.extend(['.', '..'])
-import sys, unittest
+try:
+ import unittest2 as unittest
+except ImportError:
+ import unittest
+import sys
from cStringIO import StringIO
sys.path.extend(('..', '.'))
-import sys, unittest
+try:
+ import unittest2 as unittest
+except ImportError:
+ import unittest
+import sys
from cStringIO import StringIO
sys.path.extend(['.', '..'])
-import sys, unittest
+try:
+ import unittest2 as unittest
+except ImportError:
+ import unittest
+import sys
sys.path.extend(['.', '..'])
from elftools.dwarf.structs import DWARFStructs
-import sys, unittest
+try:
+ import unittest2 as unittest
+except ImportError:
+ import unittest
+import sys
from cStringIO import StringIO
from random import randint
--- /dev/null
+[tox]
+envlist = py27,py26
+
+[testenv]
+commands =
+ python test/run_all_unittests.py
+ python test/run_readelf_tests.py
+
+[testenv:py26]
+deps =
+ unittest2
+