headless-safe filedialog tests with optional live dialog tests and ruff fixes
Tests / test_and_lint (push) Failing after 7s
Tests / test_and_lint (push) Failing after 7s
This commit is contained in:
@@ -0,0 +1,30 @@
|
||||
"""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)
|
||||
Reference in New Issue
Block a user