import os
import sys
import unittest

def additional_tests():
    setup_file = sys.modules['__main__'].__file__
    setup_dir = os.path.abspath(os.path.dirname(setup_file))
    return unittest.defaultTestLoader.discover(setup_dir)

import os
import sys
import unittest

if not hasattr(unittest.defaultTestLoader, 'discover'):
    import unittest2 as unittest

def additional_tests():
    setup_file = sys.modules['__main__'].__file__
    setup_dir = os.path.abspath(os.path.dirname(setup_file))
    return unittest.defaultTestLoader.discover(setup_dir)

Allow test discovery on Py26 with unittest2
Allow test discovery on Py26 with unittest2

  import os
  import sys
  import unittest
+ 
+ if not hasattr(unittest.defaultTestLoader, 'discover'):
+     import unittest2 as unittest
  
  def additional_tests():
      setup_file = sys.modules['__main__'].__file__
      setup_dir = os.path.abspath(os.path.dirname(setup_file))
      return unittest.defaultTestLoader.discover(setup_dir)
  
Allow test discovery on Py26 with unittest2
## Code Before:
import os
import sys
import unittest

def additional_tests():
    setup_file = sys.modules['__main__'].__file__
    setup_dir = os.path.abspath(os.path.dirname(setup_file))
    return unittest.defaultTestLoader.discover(setup_dir)

## Instruction:
Allow test discovery on Py26 with unittest2
## Code After:
import os
import sys
import unittest

if not hasattr(unittest.defaultTestLoader, 'discover'):
    import unittest2 as unittest

def additional_tests():
    setup_file = sys.modules['__main__'].__file__
    setup_dir = os.path.abspath(os.path.dirname(setup_file))
    return unittest.defaultTestLoader.discover(setup_dir)
