コード例 #1
0
    def testMetNoFramesSupport(self):
        info = PyDBAdditionalThreadInfoWithoutCurrentFramesSupport()

        mainDebugger = Null()
        filename = ''
        base = ''
        additionalInfo = Null()
        t = Null()
        frame = Null()

        times = 10
        for i in range(times):
            info.CreateDbFrame(
                (mainDebugger, filename, additionalInfo, t, frame))

        #we haven't kept any reference, so, they must have been garbage-collected already!
        self.assertEqual(0, len(info.IterFrames()))

        kept_frames = []
        for i in range(times):
            kept_frames.append(
                info.CreateDbFrame(
                    (mainDebugger, filename, additionalInfo, t, frame)))

        for i in range(times):
            self.assertEqual(times, len(info.IterFrames()))
コード例 #2
0
def StartCoverageSupport(configuration):
    coverage_files = []
    coverage_instance = Null()
    if configuration.coverage_output_dir or configuration.coverage_output_file:
        try:
            import coverage #@UnresolvedImport
        except:
            sys.stderr.write('Error: coverage module could not be imported\n')
            sys.stderr.write('Please make sure that the coverage module (http://nedbatchelder.com/code/coverage/)\n')
            sys.stderr.write('is properly installed in your interpreter: %s\n' % (sys.executable,))
            
            import traceback;traceback.print_exc()
        else:
            if configuration.coverage_output_dir:
                if not os.path.exists(configuration.coverage_output_dir):
                    sys.stderr.write('Error: directory for coverage output (%s) does not exist.\n' % (configuration.coverage_output_dir,))
                    
                elif not os.path.isdir(configuration.coverage_output_dir):
                    sys.stderr.write('Error: expected (%s) to be a directory.\n' % (configuration.coverage_output_dir,))
                    
                else:
                    n = configuration.jobs
                    if n <= 0:
                        n += 1
                    n += 1 #Add 1 more for the current process (which will do the initial import).
                    coverage_files = GetCoverageFiles(configuration, n)
                    os.environ['COVERAGE_FILE'] = coverage_files.pop(0)
                    
                    coverage_instance = coverage.coverage(source=[configuration.coverage_include])
                    coverage_instance.start()
                    
            elif configuration.coverage_output_file:
                #Client of parallel run.
                os.environ['COVERAGE_FILE'] = configuration.coverage_output_file
                coverage_instance = coverage.coverage(source=[configuration.coverage_include])
                coverage_instance.start()
                
    return coverage_files, coverage_instance
コード例 #3
0
def StartCoverageSupport(configuration):
    coverage_files = []
    coverage_instance = Null()
    if configuration.coverage_output_dir or configuration.coverage_output_file:
        try:
            import coverage  #@UnresolvedImport
        except:
            sys.stderr.write('Error: coverage module could not be imported\n')
            sys.stderr.write(
                'Please make sure that the coverage module (http://nedbatchelder.com/code/coverage/)\n'
            )
            sys.stderr.write(
                'is properly installed in your interpreter: %s\n' %
                (sys.executable, ))

            import traceback
            traceback.print_exc()
        else:
            if configuration.coverage_output_dir:
                if not os.path.exists(configuration.coverage_output_dir):
                    sys.stderr.write(
                        'Error: directory for coverage output (%s) does not exist.\n'
                        % (configuration.coverage_output_dir, ))

                elif not os.path.isdir(configuration.coverage_output_dir):
                    sys.stderr.write(
                        'Error: expected (%s) to be a directory.\n' %
                        (configuration.coverage_output_dir, ))

                else:
                    n = configuration.jobs
                    if n <= 0:
                        n += 1
                    n += 1  #Add 1 more for the current process (which will do the initial import).
                    coverage_files = GetCoverageFiles(configuration, n)
                    os.environ['COVERAGE_FILE'] = coverage_files.pop(0)

                    coverage_instance = coverage.coverage(
                        source=[configuration.coverage_include], include=['*'])
                    coverage_instance.start()

            elif configuration.coverage_output_file:
                #Client of parallel run.
                os.environ[
                    'COVERAGE_FILE'] = configuration.coverage_output_file
                coverage_instance = coverage.coverage(
                    source=[configuration.coverage_include], include=['*'])
                coverage_instance.start()

    return coverage_files, coverage_instance