From 38311a69a898dd44ea76fd80e271f10a6b235114 Mon Sep 17 00:00:00 2001 From: Lembrun Date: Wed, 3 Mar 2021 12:59:17 +0100 Subject: Replaced os.path by the pathlib equivalent --- tests/unit/completion/test_models.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/tests/unit/completion/test_models.py b/tests/unit/completion/test_models.py index 8a6b24557..15ebe7110 100644 --- a/tests/unit/completion/test_models.py +++ b/tests/unit/completion/test_models.py @@ -21,6 +21,7 @@ import collections import os +import pathlib import random import string import time @@ -426,11 +427,11 @@ def test_filesystem_completion(qtmodeltester, config_stub, info, homedir = str(local_files_path) monkeypatch.setenv('HOME', homedir) # POSIX monkeypatch.setenv('USERPROFILE', homedir) # Windows - assert os.path.expanduser('~') == homedir + assert str(pathlib.Path('~').expanduser()) == homedir base = '~' - expected_1 = os.path.join('~', 'file1.txt') - expected_2 = os.path.join('~', 'file2.txt') + expected_1 = str(pathlib.Path('~').joinpath('file1.txt')) + expected_2 = str(pathlib.Path('~').joinpath('file2.txt')) config_stub.val.completion.open_categories = ['filesystem'] model = urlmodel.url(info=info) -- cgit v1.2.3-54-g00ecf From e21c4a0664672ccb3b60734eb38585c75f47b4a8 Mon Sep 17 00:00:00 2001 From: Lembrun Date: Thu, 11 Mar 2021 08:20:39 +0100 Subject: Changed joinpath to / --- tests/unit/completion/test_models.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/unit/completion/test_models.py b/tests/unit/completion/test_models.py index f4d27dfbb..ac64c5d1a 100644 --- a/tests/unit/completion/test_models.py +++ b/tests/unit/completion/test_models.py @@ -430,8 +430,8 @@ def test_filesystem_completion(qtmodeltester, config_stub, info, assert str(pathlib.Path('~').expanduser()) == homedir base = '~' - expected_1 = str(pathlib.Path('~').joinpath('file1.txt')) - expected_2 = str(pathlib.Path('~').joinpath('file2.txt')) + expected_1 = str(pathlib.Path('~') / 'file1.txt') + expected_2 = str(pathlib.Path('~') / 'file2.txt') config_stub.val.completion.open_categories = ['filesystem'] model = urlmodel.url(info=info) -- cgit v1.2.3-54-g00ecf From 28f4c40bc7fe1c744d0c0206485cb57a6540719e Mon Sep 17 00:00:00 2001 From: Lembrun Date: Thu, 11 Mar 2021 19:17:39 +0100 Subject: Changed pathlib.Path.expanduser to pathlib.Path.home --- tests/unit/completion/test_models.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/unit/completion/test_models.py b/tests/unit/completion/test_models.py index ac64c5d1a..12e623517 100644 --- a/tests/unit/completion/test_models.py +++ b/tests/unit/completion/test_models.py @@ -427,7 +427,7 @@ def test_filesystem_completion(qtmodeltester, config_stub, info, homedir = str(local_files_path) monkeypatch.setenv('HOME', homedir) # POSIX monkeypatch.setenv('USERPROFILE', homedir) # Windows - assert str(pathlib.Path('~').expanduser()) == homedir + assert str(pathlib.Path.home()) == homedir base = '~' expected_1 = str(pathlib.Path('~') / 'file1.txt') -- cgit v1.2.3-54-g00ecf