File: test_parser.py

package info (click to toggle)
pontos 25.8.1-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 3,744 kB
  • sloc: python: 44,602; makefile: 21; sh: 10; xml: 3
file content (19 lines) | stat: -rw-r--r-- 498 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
# Copyright (C) 2023 Greenbone AG
#
# SPDX-License-Identifier: GPL-3.0-or-later
#

import unittest
from contextlib import redirect_stderr
from io import StringIO

from pontos.version._parser import parse_args


class ParserTestCase(unittest.TestCase):
    def test_error_while_parsing(self):
        with redirect_stderr(StringIO()), self.assertRaises(SystemExit) as cm:
            parse_args(["update", "foo"])

        # exception code in argparse
        self.assertEqual(cm.exception.code, 2)