Skip to content

Commit

Permalink
Merge pull request #117 from tanishq-ids/test
Browse files Browse the repository at this point in the history
added tests in  test_cli . coverage=100%
  • Loading branch information
DaBeIDS authored Jul 12, 2024
2 parents 323717e + f35b65e commit 8c721d8
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion tests/osc_transformer_presteps/test_cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,9 @@

import pytest
from typer.testing import CliRunner
from osc_transformer_presteps.cli import app # Import the Typer app
from osc_transformer_presteps.cli import app, run # Import the run function
import re
from unittest.mock import patch


@pytest.fixture
Expand Down Expand Up @@ -106,3 +107,11 @@ def test_invalid_command(runner):
output = strip_ansi(result.output)
assert result.exit_code != 0
assert "No such command" in output


def test_run_function():
"""Test the run function directly to ensure it is covered."""
# Patch sys.exit to prevent it from stopping the test execution
with patch("sys.exit") as exit_mock:
run()
exit_mock.assert_called_once_with(0)

0 comments on commit 8c721d8

Please sign in to comment.