summaryrefslogtreecommitdiff
path: root/tests/unit/config/test_configcommands.py
diff options
context:
space:
mode:
authorLembrun <amadeusk7@free.fr>2021-03-02 22:54:51 +0100
committerLembrun <amadeusk7@free.fr>2021-03-02 22:54:51 +0100
commit39e51e9b5082652f5ad0ada46bb3b76824a75f8e (patch)
treeb489dec4e2ab67497d29deeb61986b07ce39cd24 /tests/unit/config/test_configcommands.py
parent024e7ec38d46b1b1759e34cc660d2b3e4f97de4d (diff)
downloadqutebrowser-39e51e9b5082652f5ad0ada46bb3b76824a75f8e.tar.gz
qutebrowser-39e51e9b5082652f5ad0ada46bb3b76824a75f8e.zip
Changing tmpdir fixtures to the pathlib equivalent
Diffstat (limited to 'tests/unit/config/test_configcommands.py')
-rw-r--r--tests/unit/config/test_configcommands.py34
1 files changed, 17 insertions, 17 deletions
diff --git a/tests/unit/config/test_configcommands.py b/tests/unit/config/test_configcommands.py
index a15a6a334..f744f69ff 100644
--- a/tests/unit/config/test_configcommands.py
+++ b/tests/unit/config/test_configcommands.py
@@ -480,7 +480,7 @@ class TestSource:
@pytest.mark.parametrize('location', ['default', 'absolute', 'relative'])
@pytest.mark.parametrize('clear', [True, False])
- def test_config_source(self, tmpdir, commands, config_stub, config_tmpdir,
+ def test_config_source(self, tmp_path, commands, config_stub, config_tmpdir,
location, clear):
assert config_stub.val.content.javascript.enabled
config_stub.val.search.ignore_case = 'always'
@@ -489,7 +489,7 @@ class TestSource:
pyfile = config_tmpdir / 'config.py'
arg = None
elif location == 'absolute':
- pyfile = tmpdir / 'sourced.py'
+ pyfile = tmp_path / 'sourced.py'
arg = str(pyfile)
elif location == 'relative':
pyfile = config_tmpdir / 'sourced.py'
@@ -607,8 +607,8 @@ class TestWritePy:
"""Tests for :config-write-py."""
- def test_custom(self, commands, config_stub, key_config_stub, tmpdir):
- confpy = tmpdir / 'config.py'
+ def test_custom(self, commands, config_stub, key_config_stub, tmp_path):
+ confpy = tmp_path / 'config.py'
config_stub.val.content.javascript.enabled = True
key_config_stub.bind(keyseq(',x'), 'message-info foo', mode='normal')
@@ -618,8 +618,8 @@ class TestWritePy:
assert "c.content.javascript.enabled = True" in lines
assert "config.bind(',x', 'message-info foo')" in lines
- def test_defaults(self, commands, tmpdir):
- confpy = tmpdir / 'config.py'
+ def test_defaults(self, commands, tmp_path):
+ confpy = tmp_path / 'config.py'
commands.config_write_py(str(confpy), defaults=True)
lines = confpy.read_text('utf-8').splitlines()
@@ -639,10 +639,10 @@ class TestWritePy:
assert '# Autogenerated config.py' in lines
@pytest.mark.posix
- def test_expanduser(self, commands, monkeypatch, tmpdir):
+ def test_expanduser(self, commands, monkeypatch, tmp_path):
"""Make sure that using a path with ~/... works correctly."""
- home = tmpdir / 'home'
- home.ensure(dir=True)
+ home = tmp_path / 'home'
+ home.mkdir(exist_ok=True)
monkeypatch.setenv('HOME', str(home))
commands.config_write_py('~/config.py')
@@ -651,9 +651,9 @@ class TestWritePy:
lines = confpy.read_text('utf-8').splitlines()
assert '# Autogenerated config.py' in lines
- def test_existing_file(self, commands, tmpdir):
- confpy = tmpdir / 'config.py'
- confpy.ensure()
+ def test_existing_file(self, commands, tmp_path):
+ confpy = tmp_path / 'config.py'
+ confpy.touch(exist_ok=True)
with pytest.raises(cmdutils.CommandError) as excinfo:
commands.config_write_py(str(confpy))
@@ -661,19 +661,19 @@ class TestWritePy:
expected = " already exists - use --force to overwrite!"
assert str(excinfo.value).endswith(expected)
- def test_existing_file_force(self, commands, tmpdir):
- confpy = tmpdir / 'config.py'
- confpy.ensure()
+ def test_existing_file_force(self, commands, tmp_path):
+ confpy = tmp_path / 'config.py'
+ confpy.touch(exist_ok=True)
commands.config_write_py(str(confpy), force=True)
lines = confpy.read_text('utf-8').splitlines()
assert '# Autogenerated config.py' in lines
- def test_oserror(self, commands, tmpdir):
+ def test_oserror(self, commands, tmp_path):
"""Test writing to a directory which does not exist."""
with pytest.raises(cmdutils.CommandError):
- commands.config_write_py(str(tmpdir / 'foo' / 'config.py'))
+ commands.config_write_py(str(tmp_path / 'foo' / 'config.py'))
def test_config_py_arg(self, commands, config_py_arg):
config_py_arg.ensure()