summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorLembrun <amadeusk7@free.fr>2021-02-28 20:35:25 +0100
committerLembrun <amadeusk7@free.fr>2021-02-28 20:35:25 +0100
commit07303a2a03a2f0ab44a1c451d7b7ce1208e2abaf (patch)
tree2a67280c7b3c0124bfd09916af5a30767b8ae998 /tests
parentc586dc272f999898833cf58681ece358fc7b438d (diff)
downloadqutebrowser-07303a2a03a2f0ab44a1c451d7b7ce1208e2abaf.tar.gz
qutebrowser-07303a2a03a2f0ab44a1c451d7b7ce1208e2abaf.zip
Replaced os.stat by the pathlib equivalent
Diffstat (limited to 'tests')
-rw-r--r--tests/unit/misc/test_editor.py5
-rw-r--r--tests/unit/misc/test_ipc.py9
2 files changed, 9 insertions, 5 deletions
diff --git a/tests/unit/misc/test_editor.py b/tests/unit/misc/test_editor.py
index d27c2f885..ee167e8bb 100644
--- a/tests/unit/misc/test_editor.py
+++ b/tests/unit/misc/test_editor.py
@@ -223,12 +223,13 @@ def _update_file(filename, contents):
This might write the file multiple times, but different systems have
different mtime's, so we can't be sure how long to wait otherwise.
"""
- old_mtime = new_mtime = os.stat(filename).st_mtime
+ file_path = pathlib.Path(filename)
+ old_mtime = new_mtime = file_path.stat().st_mtime
while old_mtime == new_mtime:
time.sleep(0.1)
with open(filename, 'w', encoding='utf-8') as f:
f.write(contents)
- new_mtime = os.stat(filename).st_mtime
+ new_mtime = file_path.stat().st_mtime
def test_modify_watch(qtbot):
diff --git a/tests/unit/misc/test_ipc.py b/tests/unit/misc/test_ipc.py
index ef500f9e5..9d16368aa 100644
--- a/tests/unit/misc/test_ipc.py
+++ b/tests/unit/misc/test_ipc.py
@@ -309,7 +309,8 @@ class TestListen:
sockfile = ipc_server._server.fullServerName()
sockdir = pathlib.Path(sockfile).parent
- file_stat = os.stat(sockfile)
+ sockfile_path = pathlib.Path(sockfile)
+ file_stat = sockfile_path.stat()
dir_stat = sockdir.stat()
# pylint: disable=no-member,useless-suppression
@@ -331,7 +332,9 @@ class TestListen:
def test_atime_update(self, qtbot, ipc_server):
ipc_server._atime_timer.setInterval(500) # We don't want to wait
ipc_server.listen()
- old_atime = os.stat(ipc_server._server.fullServerName()).st_atime_ns
+
+ sockfile_path = pathlib.Path(ipc_server._server.fullServerName())
+ old_atime = sockfile_path.stat().st_atime_ns
with qtbot.waitSignal(ipc_server._atime_timer.timeout, timeout=2000):
pass
@@ -340,7 +343,7 @@ class TestListen:
with qtbot.waitSignal(ipc_server._atime_timer.timeout, timeout=2000):
pass
- new_atime = os.stat(ipc_server._server.fullServerName()).st_atime_ns
+ new_atime = sockfile_path.stat().st_atime_ns
assert old_atime != new_atime