def test_main_empty_argv(): with mock.patch("pynguin.cli.Pynguin") as generator_mock: with mock.patch("pynguin.cli._create_argument_parser") as parser_mock: with mock.patch("pynguin.cli._setup_logging"): generator_mock.return_value.run.return_value = ReturnCode.OK parser = MagicMock() parser_mock.return_value = parser main() assert len(parser.parse_args.call_args[0][0]) > 0
def test_main_with_argv(): with mock.patch("pynguin.cli.Pynguin") as generator_mock: with mock.patch("pynguin.cli._create_argument_parser") as parser_mock: with mock.patch("pynguin.cli._setup_logging"): generator_mock.return_value.run.return_value = ReturnCode.OK parser = MagicMock() parser_mock.return_value = parser args = ["foo", "--help"] main(args) assert parser.parse_args.call_args == call(args[1:])
def test_main_with_argv(): with mock.patch("pynguin.cli.Pynguin") as generator_mock: generator_mock.return_value.run.return_value = 0 assert main(["--help"]) == 0
# This file is part of Pynguin. # # SPDX-FileCopyrightText: 2019–2021 Pynguin Contributors # # SPDX-License-Identifier: LGPL-3.0-or-later # """Pynguin is an automated unit test generation framework for Python. This module provides the main entry location for the program executions. """ import sys from pynguin.cli import main if __name__ == "__main__": sys.exit(main(sys.argv))
def test_main_empty_argv(): with mock.patch("pynguin.cli.Pynguin") as generator_mock: generator_mock.return_value.run.return_value = 0 assert main() == 0