Created
October 31, 2016 13:44
-
-
Save fschulze/f884807bdbb30b2ecb7dfce7516f3a46 to your computer and use it in GitHub Desktop.
Filters failed tests from zope.testrunner output to be suitable for ```-t $(failed_tests)```
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
import subprocess | |
def get_tests_from_paste_buffer(): | |
return subprocess.check_output('pbpaste') | |
def run(): | |
raw_tests = get_tests_from_paste_buffer() | |
tests = [] | |
for test in raw_tests.splitlines(): | |
test = test.strip() | |
if not test: | |
continue | |
if test.endswith('.txt'): | |
test = test.split('/')[-1] | |
tests.append(test) | |
elif ' (' in test: | |
test = test.replace(' (', '\\s.*').replace(')', '') | |
tests.append(test) | |
print '|'.join(tests) | |
if __name__ == '__main__': | |
run() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
so the diff from before was…