<s> """<STR_LIT>""" <EOL> import pkg_resources <EOL> from os . path import dirname , join <EOL> from traits . testing . unittest_tools import unittest <EOL> class EggBasedTestCase ( unittest . TestCase ) : <EOL> """<STR_LIT>""" <EOL> def setUp ( self ) : <EOL> """<STR_LIT>""" <EOL> self . egg_dir = join ( dirname ( __file__ ) , '<STR_LIT>' ) <EOL> return <EOL> def tearDown ( self ) : <EOL> """<STR_LIT>""" <EOL> return <EOL> def _add_egg ( self , filename , working_set = None ) : <EOL> """<STR_LIT>""" <EOL> if working_set is None : <EOL> working_set = pkg_resources . working_set <EOL> filename = join ( dirname ( __file__ ) , '<STR_LIT>' , filename ) <EOL> distributions = pkg_resources . find_distributions ( filename ) <EOL> for distribution in distributions : <EOL> working_set . add ( distribution ) <EOL> return <EOL> def _add_eggs_on_path ( self , path , working_set = None ) : <EOL> """<STR_LIT>""" <EOL> if working_set is None : <EOL> working_set = pkg_resources . working_set <EOL> environment = pkg_resources . Environment ( path ) <EOL> distributions , errors = working_set . find_plugins ( environment ) <EOL> if len ( errors ) > <NUM_LIT:0> : <EOL> raise SystemError ( '<STR_LIT>' % errors ) <EOL> for distribution in distributions : <EOL> working_set . add ( distribution ) <EOL> return </s>
