<s> '''<STR_LIT>''' <EOL> import os <EOL> import sys <EOL> import unittest <EOL> from distutils import log <EOL> from distutils . cmd import Command <EOL> from distutils . core import setup <EOL> from distutils . extension import Extension <EOL> from distutils . sysconfig import get_python_lib , PREFIX <EOL> from Cython . Distutils import build_ext <EOL> NAME = '<STR_LIT>' <EOL> VER = '<STR_LIT>' <EOL> DESC = '<STR_LIT>' <EOL> doc_path = os . path . join ( PREFIX , '<STR_LIT>' , NAME + '<STR_LIT:->' + VER ) <EOL> if os . environ . has_key ( '<STR_LIT>' ) : <EOL> etc_path = os . environ [ '<STR_LIT>' ] <EOL> else : <EOL> etc_path = os . path . join ( os . path . dirname ( PREFIX ) , '<STR_LIT>' ) <EOL> class UnitTest ( Command ) : <EOL> description = "<STR_LIT>" <EOL> user_options = [ ] <EOL> def initialize_options ( self ) : <EOL> self . test_dirs = None <EOL> def finalize_options ( self ) : <EOL> if self . test_dirs is None : <EOL> self . test_dirs = [ "<STR_LIT:test>" ] <EOL> def run ( self ) : <EOL> errors = <NUM_LIT:0> <EOL> failures = <NUM_LIT:0> <EOL> for path in self . test_dirs : <EOL> for root , dirs , files in os . walk ( path ) : <EOL> for filename in files : <EOL> if filename . startswith ( "<STR_LIT>" ) and filename . endswith ( "<STR_LIT>" ) : <EOL> results = self . _run_test ( os . path . join ( root , filename ) ) <EOL> errors += results [ <NUM_LIT:0> ] <EOL> failures += results [ <NUM_LIT:1> ] <EOL> self . announce ( <EOL> "<STR_LIT>" . format ( errors , failures ) , <EOL> level = log . INFO ) <EOL> def _run_test ( self , path ) : <EOL> self . announce ( "<STR_LIT>" + path , log . INFO ) <EOL> dirname , basename = os . path . split ( path ) <EOL> sys . path . insert ( <NUM_LIT:0> , dirname ) <EOL> try : <EOL> modname = os . path . splitext ( basename ) [ <NUM_LIT:0> ] <EOL> mod = __import__ ( modname ) <EOL> if hasattr ( mod , "<STR_LIT>" ) : <EOL> suite = mod . test_suite ( ) <EOL> runner = unittest . TextTestRunner ( verbosity = <NUM_LIT:2> ) <EOL> results = runner . run ( suite ) <EOL> return len ( results . errors ) , len ( results . failures ) <EOL> else : <EOL> return ( <NUM_LIT:0> , <NUM_LIT:0> ) <EOL> finally : <EOL> if sys . path [ <NUM_LIT:0> ] == dirname : <EOL> del sys . path [ <NUM_LIT:0> ] <EOL> setup ( <EOL> name = NAME , <EOL> version = VER , <EOL> cmdclass = { '<STR_LIT:test>' : UnitTest } , <EOL> description = DESC , <EOL> author = '<STR_LIT>' , <EOL> author_email = '<STR_LIT>' , <EOL> url = '<STR_LIT>' , <EOL> classifiers = [ <EOL> '<STR_LIT>' , <EOL> '<STR_LIT>' , <EOL> '<STR_LIT>' , <EOL> '<STR_LIT>' , <EOL> '<STR_LIT>' , <EOL> '<STR_LIT>' , <EOL> '<STR_LIT>' , <EOL> '<STR_LIT>' , <EOL> '<STR_LIT>' , <EOL> '<STR_LIT>' , <EOL> '<STR_LIT>' , <EOL> '<STR_LIT>' , <EOL> '<STR_LIT>' , <EOL> ] , <EOL> packages = [ '<STR_LIT>' , <EOL> '<STR_LIT>' , <EOL> '<STR_LIT>' , <EOL> ] , <EOL> py_modules = [ '<STR_LIT>' ] , <EOL> scripts = [ '<STR_LIT>' ] , <EOL> data_files = [ ( os . path . join ( etc_path , '<STR_LIT>' ) , <EOL> [ '<STR_LIT>' ] ) , <EOL> ( '<STR_LIT>' , <EOL> [ '<STR_LIT>' , <EOL> ] ) , <EOL> ( doc_path , <EOL> [ '<STR_LIT>' <EOL> ] ) , <EOL> ] , <EOL> ) </s>
