Fix tests on windows
This commit is contained in:
parent
bda3c9b1d0
commit
f8d8e1507a
@ -19,6 +19,7 @@
|
||||
|
||||
"""Tests for qutebrowser.utils.jinja."""
|
||||
|
||||
import os.path
|
||||
import unittest
|
||||
import unittest.mock
|
||||
|
||||
@ -27,7 +28,7 @@ from qutebrowser.utils import jinja
|
||||
|
||||
def _read_file(path):
|
||||
"""Mocked utils.read_file."""
|
||||
if path == 'html/test.html':
|
||||
if path == os.path.join('html', 'test.html'):
|
||||
return """Hello {{var}}"""
|
||||
else:
|
||||
raise ValueError("Invalid path {}!".format(path))
|
||||
|
@ -117,11 +117,8 @@ class GetStandardDirWindowsTests(unittest.TestCase):
|
||||
def test_data(self):
|
||||
"""Test data dir."""
|
||||
cur_dir = standarddir.get(QStandardPaths.DataLocation)
|
||||
self.assertEqual(cur_dir.split(os.sep)[-1], 'qutebrowser_test',
|
||||
cur_dir)
|
||||
# We clean up here as we don't dare to clean up if the path doesn't end
|
||||
# with qutebrowser_test - it could be *anywhere* after all.
|
||||
shutil.rmtree(cur_dir)
|
||||
self.assertEqual(cur_dir.split(os.sep)[-2:],
|
||||
['qutebrowser_test', 'data'], cur_dir)
|
||||
|
||||
@unittest.skipUnless(sys.platform.startswith("win"), "requires Windows")
|
||||
def test_config(self):
|
||||
@ -129,9 +126,6 @@ class GetStandardDirWindowsTests(unittest.TestCase):
|
||||
cur_dir = standarddir.get(QStandardPaths.ConfigLocation)
|
||||
self.assertEqual(cur_dir.split(os.sep)[-1], 'qutebrowser_test',
|
||||
cur_dir)
|
||||
# We clean up here as we don't dare to clean up if the path doesn't end
|
||||
# with qutebrowser_test - it could be *anywhere* after all.
|
||||
shutil.rmtree(cur_dir)
|
||||
|
||||
@unittest.skipUnless(sys.platform.startswith("win"), "requires Windows")
|
||||
def test_cache(self):
|
||||
@ -139,9 +133,6 @@ class GetStandardDirWindowsTests(unittest.TestCase):
|
||||
cur_dir = standarddir.get(QStandardPaths.CacheLocation)
|
||||
self.assertEqual(cur_dir.split(os.sep)[-2:],
|
||||
['qutebrowser_test', 'cache'], cur_dir)
|
||||
# We clean up here as we don't dare to clean up if the path doesn't end
|
||||
# with qutebrowser_test - it could be *anywhere* after all.
|
||||
shutil.rmtree(cur_dir)
|
||||
|
||||
def tearDown(self):
|
||||
self.app.quit()
|
||||
|
Loading…
Reference in New Issue
Block a user