<s> from distutils . core import setup , Command <EOL> def discover_and_run_tests ( ) : <EOL> import os <EOL> import sys <EOL> import unittest <EOL> setup_file = sys . modules [ '<STR_LIT:__main__>' ] . __file__ <EOL> setup_dir = os . path . abspath ( os . path . dirname ( setup_file ) ) <EOL> test_loader = unittest . defaultTestLoader <EOL> test_runner = unittest . TextTestRunner ( ) <EOL> test_suite = test_loader . discover ( setup_dir ) <EOL> result = test_runner . run ( test_suite ) <EOL> if len ( result . failures ) + len ( result . errors ) > <NUM_LIT:0> : <EOL> exit ( <NUM_LIT:1> ) <EOL> class DiscoverTest ( Command ) : <EOL> user_options = [ ] <EOL> def initialize_options ( self ) : <EOL> pass <EOL> def finalize_options ( self ) : <EOL> pass <EOL> def run ( self ) : <EOL> discover_and_run_tests ( ) <EOL> setup ( <EOL> name = '<STR_LIT>' , <EOL> version = '<STR_LIT>' , <EOL> packages = [ '<STR_LIT>' ] , <EOL> url = '<STR_LIT>' , <EOL> license = '<STR_LIT>' , <EOL> author = '<STR_LIT>' , <EOL> author_email = '<STR_LIT>' , <EOL> description = '<STR_LIT>' , <EOL> cmdclass = { '<STR_LIT:test>' : DiscoverTest } , <EOL> ) </s>
