コード例 #1
0
    def test_cli_register_verbose(self, mock_config: Mock,
                                  run_config: CliObjectRunner):
        run_config.invoke(cli.main, ['-V', ':register', 'test'])

        mock_config.load.assert_called_once_with()
        mock_config.set_verbose.assert_called_once_with()
        mock_config.register.assert_not_called()
コード例 #2
0
ファイル: test_options.py プロジェクト: NeonGraal/script-venv
    def test_cli_search_path(self, mock_config: Mock,
                             run_config: CliObjectRunner):
        run_config.invoke(cli.main, ['-S', 'Test', 'test'])

        mock_config.set_verbose.assert_not_called()
        mock_config.search_path.assert_called_once_with('Test')
        mock_config.load.assert_called_once_with()
コード例 #3
0
    def test_cli_register_package(self, mock_config: Mock,
                                  run_config: CliObjectRunner):
        run_config.invoke(cli.main, [':register', 'test', 'package'])

        mock_config.load.assert_called_once_with()
        mock_config.register.assert_called_once_with('test', ('package', ),
                                                     config_path=None,
                                                     venv_path=None)
コード例 #4
0
 def run_config(self, mock_config: Mock) -> Iterable[CliObjectRunner]:
     old_cwd = getcwd()
     try:
         chdir(path.dirname(__file__))
         yield CliObjectRunner(mock_config)
     finally:
         chdir(old_cwd)
コード例 #5
0
    def test_cli_create(self, mock_config: Mock, run_config: CliObjectRunner):
        run_config.invoke(cli.main, [':create'])

        mock_config.load.assert_called_once_with()
        mock_config.create.assert_not_called()
コード例 #6
0
    def test_cli_create_update(self, mock_config: Mock, run_config: CliObjectRunner):
        run_config.invoke(cli.main, [':create', 'test', '-U'])

        mock_config.load.assert_called_once_with()
        mock_config.create.assert_called_once_with('test', clean=False, update=True)
コード例 #7
0
    def test_cli_list_help(self, run_config: CliObjectRunner) -> None:
        result = run_config.invoke(cli.main, [':list', '--help'])

        assert result.exit_code == 0
        assert 'Show this message and exit.' in result.output
コード例 #8
0
    def test_cli_version(self, run_config: CliObjectRunner):
        result = run_config.invoke(cli.main, ['--version'])

        assert result.exit_code == 0
        assert 'sv, version' in result.output
コード例 #9
0
    def test_cli_default(self, run_config: CliObjectRunner):
        result = run_config.invoke(cli.main)

        assert result.exit_code == 0
        assert 'Show this message and exit.' in result.output
コード例 #10
0
    def test_cli_register(self, mock_config: Mock,
                          run_config: CliObjectRunner):
        run_config.invoke(cli.main, [':register'])

        mock_config.load.assert_called_once_with()
        mock_config.register.assert_not_called()