Tests: pathlib used where appropriate

Also fixed various pylint errors and style issues.
This commit is contained in:
Andrei Zeliankou
2024-01-15 15:48:58 +00:00
parent e95a91cbfa
commit 5a8337933d
72 changed files with 306 additions and 256 deletions

View File

@@ -1,9 +1,9 @@
import os
import re
import subprocess
from pathlib import Path
import pytest
from unit.applications.lang.python import ApplicationPython
from unit.option import option
from unit.utils import findmnt
@@ -24,10 +24,10 @@ def get_cgroup(app_name):
cgroup = f'/proc/{pid}/cgroup'
if not os.path.isfile(cgroup):
if not Path(cgroup).is_file():
pytest.skip(f'no cgroup at {cgroup}')
with open(cgroup, 'r') as f:
with open(cgroup, 'r', encoding='utf-8') as f:
return f.read().rstrip()