Browse Source

List tests by Nose for Nose

Alois Mahdal 10 years ago
parent
commit
0b7a973dbe
1 changed files with 33 additions and 0 deletions
  1. 33
    0
      bin/noselist

+ 33
- 0
bin/noselist View File

@@ -0,0 +1,33 @@
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
+
6
+use strict;
7
+use warnings;
8
+
9
+my $list = `nosetests -vvv --collect-only 2>&1`;
10
+my $db;
11
+
12
+
13
+## parse
14
+#
15
+my $file = "UNKNOWN";
16
+my $method = "UNKNOWN";
17
+LINE: foreach (split "\n", $list) {
18
+    if (m|wantFile (.*)\? True$|) {
19
+        $file = $1;
20
+        next LINE;
21
+    } elsif (m|wantMethod (.*)\? True$|) {
22
+        m|<unbound method (.*)>|;
23
+        $method = $1;
24
+        push @{$db->{$file}}, $method;
25
+    }
26
+}
27
+
28
+
29
+## print out
30
+#
31
+foreach my $f (keys %$db) {
32
+    printf "%s:%s\n", $f, $_ foreach @{$db->{$f}};
33
+}