示例#1
0
 def test_no_execute(self):
     runner = Runner(
         ['test.py', 'nohelpnoexecute'],
         commands=[
             'tests.watson.console.support.SampleNoHelpNoExecuteCommand'
         ])
     runner.execute()
示例#2
0
 def test_execute_command_usage(self):
     runner = Runner(commands=[
         'tests.watson.console.support.SampleStringCommand',
         SampleNonStringCommand
     ])
     with raises(SystemExit):
         runner.execute(['test.py', 'nonstring', 'execute', '-h'])  # will print to screen in tests
示例#3
0
 def test_execute_command_usage(self):
     runner = Runner(['test.py', 'nonstring', '-h'], commands=[
         'tests.watson.console.support.SampleStringCommand',
         SampleNonStringCommand
     ])
     output = runner.execute()  # will print to screen in tests
     assert not output
示例#4
0
 def test_execute_command_with_args_options(self):
     runner = Runner(['test.py', 'runargsoptions', 'test', '-f', 'filename.txt'], commands=[
         'tests.watson.console.support.SampleArgumentsCommand',
         'tests.watson.console.support.SampleArgumentsWithOptionsCommand'
     ])
     output = runner.execute()  # will print to screen in tests
     assert output
示例#5
0
 def test_execute_command_with_args_options(self):
     runner = Runner(['test.py', 'runargsoptions', 'test', '-f', 'filename.txt'], commands=[
         'tests.watson.console.support.SampleArgumentsCommand',
         'tests.watson.console.support.SampleArgumentsWithOptionsCommand'
     ])
     output = runner.execute()  # will print to screen in tests
     assert output
示例#6
0
 def test_execute_command_usage(self):
     runner = Runner(['test.py', 'nonstring', '-h'], commands=[
         'tests.watson.console.support.SampleStringCommand',
         SampleNonStringCommand
     ])
     output = runner.execute()  # will print to screen in tests
     assert not output
示例#7
0
 def test_execute_command_with_args(self):
     runner = Runner(
         ['test.py', 'runargs', 'test', 'test2'],
         commands=['tests.watson.console.support.SampleArgumentsCommand'])
     output = runner.execute()  # will print to screen in tests
     assert output
示例#8
0
 def test_execute_command_with_options(self):
     runner = Runner(
         ['test.py', 'runoptions', '-f', 'test'],
         commands=['tests.watson.console.support.SampleOptionsCommand'])
     output = runner.execute()  # will print to screen in tests
     assert output
示例#9
0
 def test_execute_command_with_args(self):
     runner = Runner(['test.py', 'runargs', 'test', 'test2'], commands=[
         'tests.watson.console.support.SampleArgumentsCommand'
     ])
     output = runner.execute()  # will print to screen in tests
     assert output
示例#10
0
 def test_execute_command_with_options(self):
     runner = Runner(['test.py', 'runoptions', '-f', 'test'], commands=[
         'tests.watson.console.support.SampleOptionsCommand'
     ])
     output = runner.execute()  # will print to screen in tests
     assert output
示例#11
0
 def test_no_execute(self):
     with raises(TypeError):
         runner = Runner(['test.py', 'nohelpnoexecute'], commands=[
             'tests.watson.console.support.SampleNoHelpNoExecuteCommand'
         ])
         runner.execute()
示例#12
0
 def test_execute_command_with_options_invalid(self):
     runner = Runner(commands=[
         'tests.watson.console.support.SampleOptionsCommand'
     ])
     with raises(SystemExit):
         runner.execute(['test.py', 'runoptions', 'execute', '-d'])  # will print to screen in tests
示例#13
0
 def test_execute_command_usage_with_args(self):
     runner = Runner(commands=[
         'tests.watson.console.support.SampleArgumentsCommand'
     ])
     with raises(SystemExit):
         runner.execute(['test.py', 'runargs', 'execute', '-h'])  # will print to screen in tests
示例#14
0
 def test_no_execute(self):
     with raises(SystemExit):
         runner = Runner(commands=[
             'tests.watson.console.support.SampleNoHelpNoExecuteCommand'
         ])
         runner.execute(['test.py', 'nohelpnoexecute', 'execute'])