50 lines
1.3 KiB
Python
50 lines
1.3 KiB
Python
"""
|
|
Just try to call our plugin
|
|
"""
|
|
from typing import Callable
|
|
|
|
from _pytest.pytester import Pytester
|
|
|
|
|
|
def test_plugin_test_multiplication(
|
|
pytester: Pytester, simple_test_csv: str, simple_fruit_test: Callable[[str], str]
|
|
) -> None:
|
|
"""
|
|
Simple Roundtrip Smoke Test
|
|
"""
|
|
|
|
csv_file = str(pytester.makefile(".csv", simple_test_csv).absolute())
|
|
|
|
pytester.makepyfile(simple_fruit_test(csv_file))
|
|
|
|
result = pytester.runpytest("-p", "no:bandit")
|
|
result.assert_outcomes(passed=3, failed=1)
|
|
|
|
|
|
def test_plugin_test_error(pytester: Pytester, bad_test_csv: str, simple_fruit_test: Callable[[str], str]) -> None:
|
|
"""
|
|
Simple Error Behaviour Test
|
|
"""
|
|
|
|
csv_file = str(pytester.makefile(".csv", bad_test_csv).absolute())
|
|
|
|
pytester.makepyfile(simple_fruit_test(csv_file))
|
|
|
|
result = pytester.runpytest("-p", "no:bandit")
|
|
result.assert_outcomes(errors=1)
|
|
|
|
|
|
def test_plugin_test_text_shorthand(
|
|
pytester: Pytester, text_test_csv: str, simple_text_test: Callable[[str], str]
|
|
) -> None:
|
|
"""
|
|
Simple Roundtrip Smoke Test
|
|
"""
|
|
|
|
csv_file = str(pytester.makefile(".csv", text_test_csv).absolute())
|
|
|
|
pytester.makepyfile(simple_text_test(csv_file))
|
|
|
|
result = pytester.runpytest("-p", "no:bandit")
|
|
result.assert_outcomes(passed=2, failed=1)
|