original_docstring: 
          Interesting magic to get a source dist and running trial on it.
  
          NOTE: there is magic going on here! If you know a better way feel
                free to update it.
          
docstring: Interesting magic to get a source dist and running trial on it.
  NOTE: there is magic going on here. If you know a better way feel
  free to update it.
docstring_tokens: Interesting magic to get a source dist and running trial on it . NOTE : there is magic going on here . If you know a better way feel free to update it .
code: def run(self):
          """
          Interesting magic to get a source dist and running trial on it.
  
          NOTE: there is magic going on here! If you know a better way feel
                free to update it.
          """
          # Clean out dist/
          if os.path.exists('dist'):
              for root, dirs, files in os.walk('dist', topdown=False):
                  for name in files:
                      os.remove(os.path.join(root, name))
                  for name in dirs:
                      os.rmdir(os.path.join(root, name))
          # Import setup making it as if we ran setup.py with the sdist arg
          sys.argv.append('sdist')
          import setup #@Reimport @UnresolvedImport @UnusedImport
          try:
              # attempt to extract the sdist data
              from gzip import GzipFile
              from tarfile import TarFile
              # We open up the gzip as well as using the first item as the sdist
              gz = GzipFile(os.path.join('dist', os.listdir('dist')[0]))
              tf = TarFile(fileobj=gz)
              # Make the output dir and generate the extract path
              os.mkdir(os.path.join('dist', 'sdist_test'))
              ex_path = os.path.join('dist', 'sdist_test',
                  tf.getmembers()[0].name, 'buildbot', 'test')
              # Extract the data and run tests
              print "Extracting to %s" % ex_path
              tf.extractall(os.path.join('dist', 'sdist_test'))
              print "Executing tests ..."
              self._run(os.path.normpath(os.path.abspath(ex_path)))
          except IndexError, ie:
              # We get called twice and the IndexError is OK
              pass
code_tokens: def run ( self ) : if os . path . exists ( 'dist' ) : for root , dirs , files in os . walk ( 'dist' , topdown = False ) : for name in files : os . remove ( os . path . join ( root , name ) ) for name in dirs : os . rmdir ( os . path . join ( root , name ) ) sys . argv . append ( 'sdist' ) import setup try : from gzip import GzipFile from tarfile import TarFile gz = GzipFile ( os . path . join ( 'dist' , os . listdir ( 'dist' ) [ 0 ] ) ) tf = TarFile ( fileobj = gz ) os . mkdir ( os . path . join ( 'dist' , 'sdist_test' ) ) ex_path = os . path . join ( 'dist' , 'sdist_test' , tf . getmembers ( ) [ 0 ] . name , 'buildbot' , 'test' ) print "Extracting to %s" % ex_path tf . extractall ( os . path . join ( 'dist' , 'sdist_test' ) ) print "Executing tests ..." self . _run ( os . path . normpath ( os . path . abspath ( ex_path ) ) ) except IndexError , ie : pass
short_docstring: Interesting magic to get a source dist and running trial on it.
short_docstring_tokens: Interesting magic to get a source dist and running trial on it .
comment: """
          Interesting magic to get a source dist and running trial on it.
  
          NOTE: there is magic going on here! If you know a better way feel
                free to update it.
          """$SEP$# Clean out dist/$SEP$# Import setup making it as if we ran setup.py with the sdist arg$SEP$#@Reimport @UnresolvedImport @UnusedImport$SEP$# attempt to extract the sdist data$SEP$# We open up the gzip as well as using the first item as the sdist$SEP$# Make the output dir and generate the extract path$SEP$# Extract the data and run tests$SEP$# We get called twice and the IndexError is OK