(filename, cls)
| 136 | |
| 137 | |
| 138 | def regenerate_expected_output(filename, cls): |
| 139 | filename = filename.rstrip('co') |
| 140 | print('Regenerating %s...' % filename) |
| 141 | results = cls.do_profiling() |
| 142 | |
| 143 | newfile = [] |
| 144 | with open(filename, 'r') as f: |
| 145 | for line in f: |
| 146 | newfile.append(line) |
| 147 | if line.startswith('#--cut'): |
| 148 | break |
| 149 | |
| 150 | with open(filename, 'w') as f: |
| 151 | f.writelines(newfile) |
| 152 | f.write("_ProfileOutput = {}\n") |
| 153 | for i, method in enumerate(cls.methodnames): |
| 154 | f.write('_ProfileOutput[%r] = """\\\n%s"""\n' % ( |
| 155 | method, results[i+1])) |
| 156 | f.write('\nif __name__ == "__main__":\n main()\n') |
| 157 | |
| 158 | @contextmanager |
| 159 | def silent(): |
no test coverage detected
searching dependent graphs…