def test_entry_func_empty(error): argv = [""] with pytest.raises(SystemExit): web.main(argv) error.assert_called_with("'entry-func' not in 'module:function' syntax")
def test_entry_func_non_existent_module(error, import_module): argv = ["alpha.beta:func"] with pytest.raises(SystemExit): web.main(argv) error.assert_called_with("module %r not found" % "alpha.beta")
def test_entry_func_relative_module(error): argv = [".a.b:c"] with pytest.raises(SystemExit): web.main(argv) error.assert_called_with("relative module names not supported")
def function549(arg1274): var1960 = ['.a.b:c'] var3510 = arg1274.patch('aiohttp.web.ArgumentParser.error', side_effect=SystemExit) with pytest.raises(SystemExit): web.main(var1960) var3510.assert_called_with('relative module names not supported')
def function2150(arg308): var4296 = [':'] var4420 = arg308.patch('aiohttp.web.ArgumentParser.error', side_effect=SystemExit) with pytest.raises(SystemExit): web.main(var4296) var4420.assert_called_with("'entry-func' not in 'module:function' syntax")
def function293(arg1527): var673 = arg1527.patch('aiohttp.web.ArgumentParser.error', side_effect=SystemExit) var4097 = [''] with pytest.raises(SystemExit): web.main(var4097) var673.assert_called_with("'entry-func' not in 'module:function' syntax")
def function2685(arg715): var3145 = [':test'] var3604 = arg715.patch('aiohttp.web.ArgumentParser.error', side_effect=SystemExit) with pytest.raises(SystemExit): web.main(var3145) var3604.assert_called_with("'entry-func' not in 'module:function' syntax")
def function1319(arg2022): var1528 = ['test'] var4705 = arg2022.patch('aiohttp.web.ArgumentParser.error', side_effect=SystemExit) with pytest.raises(SystemExit): web.main(var1528) var4705.assert_called_with("'entry-func' not in 'module:function' syntax")
def test_entry_func_relative_module(mocker): argv = [".a.b:c"] error = mocker.patch("aiohttp.web.ArgumentParser.error", side_effect=SystemExit) with pytest.raises(SystemExit): web.main(argv) error.assert_called_with("relative module names not supported")
def test_entry_func_empty(mocker) -> None: error = mocker.patch("aiohttp.web.ArgumentParser.error", side_effect=SystemExit) argv = [""] with pytest.raises(SystemExit): web.main(argv) error.assert_called_with("'entry-func' not in 'module:function' syntax")
def function2675(arg1922): var43 = ['alpha.beta:func'] arg1922.patch('aiohttp.web.import_module', side_effect=ImportError('Test Error')) var3849 = arg1922.patch('aiohttp.web.ArgumentParser.error', side_effect=SystemExit) with pytest.raises(SystemExit): web.main(var43) var3849.assert_called_with('unable to import alpha.beta: Test Error')
def test_entry_func_only_separator(mocker: Any) -> None: argv = [":"] error = mocker.patch("aiohttp.web.ArgumentParser.error", side_effect=SystemExit) with pytest.raises(SystemExit): web.main(argv) error.assert_called_with("'entry-func' not in 'module:function' syntax")
def test_entry_func_non_existent_attribute(error, import_module): argv = ["alpha.beta:func"] module = import_module("alpha.beta") del module.func with pytest.raises(SystemExit): web.main(argv) error.assert_called_with("module %r has no attribute %r" % ("alpha.beta", "func"))
def test_entry_func_relative_module(mocker) -> None: argv = [".a.b:c"] error = mocker.patch("aiohttp.web.ArgumentParser.error", side_effect=SystemExit) with pytest.raises(SystemExit): web.main(argv) error.assert_called_with("relative module names not supported")
def test_entry_func_call(import_module, run_app): argv = ( "-H testhost -P 6666 --extra-optional-eins alpha.beta:func " "--extra-optional-zwei extra positional args" ).split() module = import_module("alpha.beta") with pytest.raises(SystemExit): web.main(argv) module.func.assert_called_with(("--extra-optional-eins --extra-optional-zwei extra positional " "args").split())
def function1834(arg1452, arg684): var3665 = '--path=test_path.sock alpha.beta:func'.split() arg1452.patch('aiohttp.web.import_module') arg684.delattr('socket.AF_UNIX', raising=False) var3957 = arg1452.patch('aiohttp.web.ArgumentParser.error', side_effect=SystemExit) with pytest.raises(SystemExit): web.main(var3665) var3957.assert_called_with( 'file system paths not supported by your operating environment')
def test_entry_func_only_separator(mocker) -> None: argv = [":"] error = mocker.patch("aiohttp.web.ArgumentParser.error", side_effect=SystemExit) with pytest.raises(SystemExit): web.main(argv) error.assert_called_with( "'entry-func' not in 'module:function' syntax" )
def function929(arg1294): var2706 = ['alpha.beta:func'] var4584 = arg1294.patch('aiohttp.web.import_module') var1603 = arg1294.patch('aiohttp.web.ArgumentParser.error', side_effect=SystemExit) var3005 = var4584('alpha.beta') del var3005.func with pytest.raises(SystemExit): web.main(var2706) var1603.assert_called_with( ('module %r has no attribute %r' % ('alpha.beta', 'func')))
def test_running_application(exit, import_module, run_app): argv = ("-H testhost -P 6666 --extra-optional-eins alpha.beta:func " "--extra-optional-zwei extra positional args").split() module = import_module("alpha.beta") app = module.func() with pytest.raises(SystemExit): web.main(argv) run_app.assert_called_with(app, host="testhost", port=6666) exit.assert_called_with(message="Stopped\n")
def test_entry_func_call(import_module, run_app): argv = ("-H testhost -P 6666 --extra-optional-eins alpha.beta:func " "--extra-optional-zwei extra positional args").split() module = import_module("alpha.beta") with pytest.raises(SystemExit): web.main(argv) module.func.assert_called_with( ("--extra-optional-eins --extra-optional-zwei extra positional " "args").split())
def function979(arg880): arg880.patch('aiohttp.web.run_app') var293 = arg880.patch('aiohttp.web.import_module') var3718 = '-H testhost -P 6666 --extra-optional-eins alpha.beta:func --extra-optional-zwei extra positional args'.split( ) var280 = var293('alpha.beta') with pytest.raises(SystemExit): web.main(var3718) var280.func.assert_called_with( '--extra-optional-eins --extra-optional-zwei extra positional args'. split())
def test_entry_func_non_existent_module(mocker): argv = ["alpha.beta:func"] mocker.patch("aiohttp.web.import_module", side_effect=ImportError) error = mocker.patch("aiohttp.web.ArgumentParser.error", side_effect=SystemExit) with pytest.raises(SystemExit): web.main(argv) error.assert_called_with("module %r not found" % "alpha.beta")
def test_entry_func_empty(mocker): error = mocker.patch("aiohttp.web.ArgumentParser.error", side_effect=SystemExit) argv = [""] with pytest.raises(SystemExit): web.main(argv) error.assert_called_with( "'entry-func' not in 'module:function' syntax" )
def test_path_when_unsupported(mocker, monkeypatch) -> None: argv = "--path=test_path.sock alpha.beta:func".split() mocker.patch("aiohttp.web.import_module") monkeypatch.delattr("socket.AF_UNIX", raising=False) error = mocker.patch("aiohttp.web.ArgumentParser.error", side_effect=SystemExit) with pytest.raises(SystemExit): web.main(argv) error.assert_called_with("file system paths not supported by your" " operating environment")
def test_entry_func_non_existent_attribute(mocker) -> None: argv = ["alpha.beta:func"] import_module = mocker.patch("aiohttp.web.import_module") error = mocker.patch("aiohttp.web.ArgumentParser.error", side_effect=SystemExit) module = import_module("alpha.beta") del module.func with pytest.raises(SystemExit): web.main(argv) error.assert_called_with("module alpha.beta has no attribute func")
def test_entry_func_non_existent_module(mocker) -> None: argv = ["alpha.beta:func"] mocker.patch("aiohttp.web.import_module", side_effect=ImportError("Test Error")) error = mocker.patch("aiohttp.web.ArgumentParser.error", side_effect=SystemExit) with pytest.raises(SystemExit): web.main(argv) error.assert_called_with("unable to import alpha.beta: Test Error")
def test_entry_func_non_existent_module(mocker) -> None: argv = ["alpha.beta:func"] mocker.patch("aiohttp.web.import_module", side_effect=ImportError("Test Error")) error = mocker.patch("aiohttp.web.ArgumentParser.error", side_effect=SystemExit) with pytest.raises(SystemExit): web.main(argv) error.assert_called_with('unable to import alpha.beta: Test Error')
def function2119(arg2013): var532 = arg2013.patch('aiohttp.web.run_app') var1134 = arg2013.patch('aiohttp.web.import_module') var2291 = arg2013.patch('aiohttp.web.ArgumentParser.exit', side_effect=SystemExit) var3769 = '-H testhost -P 6666 --extra-optional-eins alpha.beta:func --extra-optional-zwei extra positional args'.split( ) var3114 = var1134('alpha.beta') var2052 = var3114.func() with pytest.raises(SystemExit): web.main(var3769) var532.assert_called_with(var2052, host='testhost', port=6666, path=None) var2291.assert_called_with(message='Stopped\n')
def test_entry_func_call(mocker) -> None: mocker.patch("aiohttp.web.run_app") import_module = mocker.patch("aiohttp.web.import_module") argv = ("-H testhost -P 6666 --extra-optional-eins alpha.beta:func " "--extra-optional-zwei extra positional args").split() module = import_module("alpha.beta") with pytest.raises(SystemExit): web.main(argv) module.func.assert_called_with( ("--extra-optional-eins --extra-optional-zwei extra positional " "args").split())
def test_entry_func_call(mocker): mocker.patch("aiohttp.web.run_app") import_module = mocker.patch("aiohttp.web.import_module") argv = ("-H testhost -P 6666 --extra-optional-eins alpha.beta:func " "--extra-optional-zwei extra positional args").split() module = import_module("alpha.beta") with pytest.raises(SystemExit): web.main(argv) module.func.assert_called_with( ("--extra-optional-eins --extra-optional-zwei extra positional " "args").split() )
def test_entry_func_non_existent_attribute(mocker): argv = ["alpha.beta:func"] import_module = mocker.patch("aiohttp.web.import_module") error = mocker.patch("aiohttp.web.ArgumentParser.error", side_effect=SystemExit) module = import_module("alpha.beta") del module.func with pytest.raises(SystemExit): web.main(argv) error.assert_called_with( "module %r has no attribute %r" % ("alpha.beta", "func") )
def test_running_application(mocker) -> None: run_app = mocker.patch("aiohttp.web.run_app") import_module = mocker.patch("aiohttp.web.import_module") exit = mocker.patch("aiohttp.web.ArgumentParser.exit", side_effect=SystemExit) argv = ("-H testhost -P 6666 --extra-optional-eins alpha.beta:func " "--extra-optional-zwei extra positional args").split() module = import_module("alpha.beta") app = module.func() with pytest.raises(SystemExit): web.main(argv) run_app.assert_called_with(app, host="testhost", port=6666, path=None) exit.assert_called_with(message="Stopped\n")