8
8
9
9
10
10
class CmdLineTest (CoverageTest ):
11
+ """Tests of command-line processing for coverage.py."""
12
+
11
13
def help_fn (self , error = None ):
12
14
raise Exception (error or "__doc__" )
13
15
@@ -16,27 +18,49 @@ def command_line(self, argv):
16
18
17
19
def testHelp (self ):
18
20
self .assertRaisesMsg (Exception , "__doc__" , self .command_line , ['-h' ])
19
- self .assertRaisesMsg (Exception , "__doc__" , self .command_line , ['--help' ])
21
+ self .assertRaisesMsg (Exception , "__doc__" , self .command_line ,
22
+ ['--help' ])
20
23
21
24
def testUnknownOption (self ):
22
- self .assertRaisesMsg (Exception , "option -z not recognized" , self .command_line , ['-z' ])
25
+ self .assertRaisesMsg (Exception , "option -z not recognized" ,
26
+ self .command_line , ['-z' ])
23
27
24
28
def testBadActionCombinations (self ):
25
- self .assertRaisesMsg (Exception , "You can't specify the 'erase' and 'annotate' options at the same time." , self .command_line , ['-e' , '-a' ])
26
- self .assertRaisesMsg (Exception , "You can't specify the 'erase' and 'report' options at the same time." , self .command_line , ['-e' , '-r' ])
27
- self .assertRaisesMsg (Exception , "You can't specify the 'erase' and 'html' options at the same time." , self .command_line , ['-e' , '-b' ])
28
- self .assertRaisesMsg (Exception , "You can't specify the 'erase' and 'combine' options at the same time." , self .command_line , ['-e' , '-c' ])
29
- self .assertRaisesMsg (Exception , "You can't specify the 'execute' and 'annotate' options at the same time." , self .command_line , ['-x' , '-a' ])
30
- self .assertRaisesMsg (Exception , "You can't specify the 'execute' and 'report' options at the same time." , self .command_line , ['-x' , '-r' ])
31
- self .assertRaisesMsg (Exception , "You can't specify the 'execute' and 'html' options at the same time." , self .command_line , ['-x' , '-b' ])
32
- self .assertRaisesMsg (Exception , "You can't specify the 'execute' and 'combine' options at the same time." , self .command_line , ['-x' , '-c' ])
29
+ self .assertRaisesMsg (Exception ,
30
+ "You can't specify the 'erase' and 'annotate' "
31
+ "options at the same time." , self .command_line , ['-e' , '-a' ])
32
+ self .assertRaisesMsg (Exception ,
33
+ "You can't specify the 'erase' and 'report' "
34
+ "options at the same time." , self .command_line , ['-e' , '-r' ])
35
+ self .assertRaisesMsg (Exception ,
36
+ "You can't specify the 'erase' and 'html' "
37
+ "options at the same time." , self .command_line , ['-e' , '-b' ])
38
+ self .assertRaisesMsg (Exception ,
39
+ "You can't specify the 'erase' and 'combine' "
40
+ "options at the same time." , self .command_line , ['-e' , '-c' ])
41
+ self .assertRaisesMsg (Exception ,
42
+ "You can't specify the 'execute' and 'annotate' "
43
+ "options at the same time." , self .command_line , ['-x' , '-a' ])
44
+ self .assertRaisesMsg (Exception ,
45
+ "You can't specify the 'execute' and 'report' "
46
+ "options at the same time." , self .command_line , ['-x' , '-r' ])
47
+ self .assertRaisesMsg (Exception ,
48
+ "You can't specify the 'execute' and 'html' "
49
+ "options at the same time." , self .command_line , ['-x' , '-b' ])
50
+ self .assertRaisesMsg (Exception ,
51
+ "You can't specify the 'execute' and 'combine' "
52
+ "options at the same time." , self .command_line , ['-x' , '-c' ])
33
53
34
54
def testNeedAction (self ):
35
- self .assertRaisesMsg (Exception , "You must specify at least one of -e, -x, -c, -r, -a, or -b." , self .command_line , ['-p' ])
55
+ self .assertRaisesMsg (Exception ,
56
+ "You must specify at least one of -e, -x, -c, -r, -a, or -b." ,
57
+ self .command_line , ['-p' ])
36
58
37
59
def testArglessActions (self ):
38
- self .assertRaisesMsg (Exception , "Unexpected arguments: foo bar" , self .command_line , ['-e' , 'foo' , 'bar' ])
39
- self .assertRaisesMsg (Exception , "Unexpected arguments: baz quux" , self .command_line , ['-c' , 'baz' , 'quux' ])
60
+ self .assertRaisesMsg (Exception , "Unexpected arguments: foo bar" ,
61
+ self .command_line , ['-e' , 'foo' , 'bar' ])
62
+ self .assertRaisesMsg (Exception , "Unexpected arguments: baz quux" ,
63
+ self .command_line , ['-c' , 'baz' , 'quux' ])
40
64
41
65
42
66
if __name__ == '__main__' :
0 commit comments