mirror of
https://github.com/TagStudioDev/TagStudio.git
synced 2026-01-31 07:10:45 +00:00
fix: remove/rework windows path tests (#625)
* fix: tagstudio/tests/test_driver.py::test_evaluate_path_last_lib_present always fails in windows. * refactor: removal tagstudio/tests/test_library.py::test_save_windows_path Fixes #616
This commit is contained in:
committed by
GitHub
parent
8ba23c5d54
commit
a630b09b4f
@@ -53,9 +53,12 @@ def test_evaluate_path_last_lib_not_exists():
|
||||
|
||||
def test_evaluate_path_last_lib_present():
|
||||
# Given
|
||||
settings = QSettings()
|
||||
with TemporaryDirectory() as tmpdir:
|
||||
settings_file = tmpdir + "/test_settings.ini"
|
||||
settings = QSettings(settings_file, QSettings.Format.IniFormat)
|
||||
settings.setValue(SettingItems.LAST_LIBRARY, tmpdir)
|
||||
settings.sync()
|
||||
|
||||
makedirs(Path(tmpdir) / TS_FOLDER_NAME)
|
||||
driver = TestDriver(settings)
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
from pathlib import Path, PureWindowsPath
|
||||
from pathlib import Path
|
||||
from tempfile import TemporaryDirectory
|
||||
|
||||
import pytest
|
||||
@@ -264,28 +264,6 @@ def test_preferences(library):
|
||||
assert library.prefs(pref) == pref.default
|
||||
|
||||
|
||||
def test_save_windows_path(library, generate_tag):
|
||||
# pretend we are on windows and create `Path`
|
||||
|
||||
entry = Entry(
|
||||
path=PureWindowsPath("foo\\bar.txt"),
|
||||
folder=library.folder,
|
||||
fields=library.default_fields,
|
||||
)
|
||||
tag = generate_tag("win_path")
|
||||
tag_name = tag.name
|
||||
|
||||
library.add_entries([entry])
|
||||
# library.add_tag(tag)
|
||||
library.add_field_tag(entry, tag, create_field=True)
|
||||
|
||||
results = library.search_library(FilterState(tag=tag_name))
|
||||
assert results
|
||||
|
||||
# path should be saved in posix format
|
||||
assert str(results[0].path) == "foo/bar.txt"
|
||||
|
||||
|
||||
def test_remove_entry_field(library, entry_full):
|
||||
title_field = entry_full.text_fields[0]
|
||||
|
||||
|
||||
Reference in New Issue
Block a user