summaryrefslogtreecommitdiffstats
path: root/test/test_mockings.py
blob: 0e8d77a339068c2f9e7b57a0b92f5308167e4e59 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
"""Test mockings module."""
from typing import Any

import pytest

from ansiblelint._mockings import _make_module_stub
from ansiblelint.config import options
from ansiblelint.constants import RC


def test_make_module_stub(mocker: Any) -> None:
    """Test make module stub."""
    mocker.patch("ansiblelint.config.options.cache_dir", return_value=".")
    assert options.cache_dir is not None
    with pytest.raises(SystemExit) as exc:
        _make_module_stub(module_name="", options=options)
    assert exc.type == SystemExit
    assert exc.value.code == RC.INVALID_CONFIG