Tests / test_and_lint (push) Successful in 7s
Reviewed-on: #1 Co-authored-by: Mathias Scheider <mathias2784@web.de>
31 lines
887 B
Python
31 lines
887 B
Python
"""Live dialog tests for ``utils.filedialogs``.
|
|
|
|
These tests open a real OS dialog and require a working display.
|
|
They are excluded from the default (and pipeline) runs by the
|
|
``live`` marker configured in ``pyproject.toml`` and only run when
|
|
explicitly requested, e.g.::
|
|
|
|
uv run pytest -m live
|
|
|
|
Choose a path in the dialog (or cancel it) — either outcome passes,
|
|
as long as the dialog returns consistently.
|
|
"""
|
|
|
|
import os
|
|
|
|
import pytest
|
|
|
|
from utils.filedialogs import get_dir_path_from_dialog, get_file_path_from_dialog
|
|
|
|
|
|
@pytest.mark.live
|
|
def test_get_dir_path_from_dialog_live():
|
|
result = get_dir_path_from_dialog(title="Test: pick a directory")
|
|
assert result == "" or os.path.isdir(result)
|
|
|
|
|
|
@pytest.mark.live
|
|
def test_get_file_path_from_dialog_live():
|
|
result = get_file_path_from_dialog(title="Test: pick a file")
|
|
assert result == "" or os.path.isfile(result)
|