123456789101112131415161718192021222324252627282930313233
  1. #!/usr/bin/perl
  2. # list tests that would be ran by nose but in a format
  3. # that can be passed to nose itself, line by line (see
  4. # http://stackoverflow.com/questions/21685260)
  5. use strict;
  6. use warnings;
  7. my $list = `nosetests -vvv --collect-only 2>&1`;
  8. my $db;
  9. ## parse
  10. #
  11. my $file = "UNKNOWN";
  12. my $method = "UNKNOWN";
  13. LINE: foreach (split "\n", $list) {
  14. if (m|wantFile (.*)\? True$|) {
  15. $file = $1;
  16. next LINE;
  17. } elsif (m|wantMethod (.*)\? True$|) {
  18. m|<unbound method (.*)>|;
  19. $method = $1;
  20. push @{$db->{$file}}, $method;
  21. }
  22. }
  23. ## print out
  24. #
  25. foreach my $f (keys %$db) {
  26. printf "%s:%s\n", $f, $_ foreach @{$db->{$f}};
  27. }