File: test_exit_codes.py

package info (click to toggle)
python3-proselint 0.14.0-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 1,220 kB
  • sloc: python: 7,173; sh: 6; makefile: 3
file content (26 lines) | stat: -rw-r--r-- 725 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
"""Check that the CLI returns the appropriate exit code."""

from click.testing import CliRunner

from proselint.command_line import proselint

from .check import Check


class TestExitCodes(Check):
    """Test class for CLI exit codes"""

    __test__ = True

    def setUp(self):
        self.runner = CliRunner()

    def test_exit_code_demo(self):
        """Ensure that linting the demo returns an exit code of 1."""
        output = self.runner.invoke(proselint, "--demo")
        assert output.exit_code == 1

    def test_exit_code_version(self):
        """Ensure that getting the version returns an exit code of 0."""
        output = self.runner.invoke(proselint, "--version")
        assert output.exit_code == 0