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() |
so the diff from before was…
diff --git a/.bash_aliases b/.bash_aliases
index d34bb11..e935612 100644
--- a/.bash_aliases
+++ b/.bash_aliases
@@ -44,7 +44,7 @@
alias failed_open="pbpaste | grep ', in test' | sed -e 's/^[^\"]*\"//' -e 's/\", line /:/' -e 's/,.*//' -e 's,.*/buildout/,,' | xargs subl"
-alias failed_tests="pbpaste | egrep '^ *(test.*\(|/.*\.txt)' | cut -d\( -f1 | sed 's,.*/,,' | xargs | tr ' ' '\|' | xargs -J% bin/alltests -v -v -v -t '%'"
+alias failed_tests="pbpaste | egrep '^ *(test.*\)|/.*\.txt)' | cut -d\) -f1 | sed -e 's, (,##s.*,' -e 's,.*/,,' | xargs | tr ' #' '\|\\' | xargs -J% bin/alltests -v -v -v
alias find="gfind"
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
nice catch regarding the additional module spec…
my pimped shell alias version is now:
:)