From 5eeb2233384c5c8f1dc4892524ec2f1d65cb75e7 Mon Sep 17 00:00:00 2001 From: Florian Bruhin Date: Mon, 19 Feb 2018 15:35:29 +0100 Subject: [PATCH] Use a different directory for file prompt tests This way they aren't influenced by the config_tmpdir fixture. --- tests/unit/mainwindow/test_prompt.py | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/tests/unit/mainwindow/test_prompt.py b/tests/unit/mainwindow/test_prompt.py index eb0ba9e69..e467b0316 100644 --- a/tests/unit/mainwindow/test_prompt.py +++ b/tests/unit/mainwindow/test_prompt.py @@ -56,22 +56,25 @@ class TestFileCompletion: def test_simple_completion(self, tmpdir, get_prompt, steps, where, subfolder): """Simply trying to tab through items.""" + testdir = tmpdir / 'test' for directory in 'abc': - (tmpdir / directory).ensure(dir=True) + (testdir / directory).ensure(dir=True) - prompt = get_prompt(str(tmpdir) + os.sep) + prompt = get_prompt(str(testdir) + os.sep) for _ in range(steps): prompt.item_focus(where) - assert prompt._lineedit.text() == str(tmpdir / subfolder) + assert prompt._lineedit.text() == str(testdir / subfolder) def test_backspacing_path(self, qtbot, tmpdir, get_prompt): """When we start deleting a path we want to see the subdir.""" - for directory in ['bar', 'foo']: - (tmpdir / directory).ensure(dir=True) + testdir = tmpdir / 'test' - prompt = get_prompt(str(tmpdir / 'foo') + os.sep) + for directory in ['bar', 'foo']: + (testdir / directory).ensure(dir=True) + + prompt = get_prompt(str(testdir / 'foo') + os.sep) # Deleting /f[oo/] with qtbot.wait_signal(prompt._file_model.directoryLoaded): @@ -81,7 +84,7 @@ class TestFileCompletion: # We should now show / again, so tabbing twice gives us .. -> bar prompt.item_focus('next') prompt.item_focus('next') - assert prompt._lineedit.text() == str(tmpdir / 'bar') + assert prompt._lineedit.text() == str(testdir / 'bar') @pytest.mark.linux def test_root_path(self, get_prompt):