Tests: removed unused variables.

This commit is contained in:
Andrei Zeliankou
2023-05-25 14:26:12 +01:00
parent 47cdfb6f30
commit 3e4fa1e202
34 changed files with 87 additions and 91 deletions

View File

@@ -175,7 +175,7 @@ Unexpected prerequisite version "{prereq_version}" for module "{module}" in
)
def pytest_sessionstart(session):
def pytest_sessionstart():
option.available = {'modules': {}, 'features': {}}
unit = unit_run()
@@ -185,7 +185,7 @@ def pytest_sessionstart(session):
# read unit.log
for i in range(50):
for _ in range(50):
with open(Log.get_path(), 'r') as f:
log = f.read()
m = re.search('controller started', log)
@@ -237,7 +237,7 @@ def pytest_sessionstart(session):
@pytest.hookimpl(tryfirst=True, hookwrapper=True)
def pytest_runtest_makereport(item, call):
def pytest_runtest_makereport(item):
# execute all other hooks to obtain the report object
outcome = yield
rep = outcome.get_result()
@@ -567,7 +567,7 @@ def _clear_temp_dir():
if os.path.isfile(path) or stat.S_ISSOCK(os.stat(path).st_mode):
os.remove(path)
else:
for attempt in range(10):
for _ in range(10):
try:
shutil.rmtree(path)
break
@@ -582,7 +582,7 @@ def _check_processes():
controller_pid = _fds_info['controller']['pid']
unit_pid = unit_instance['pid']
for i in range(600):
for _ in range(600):
out = (
subprocess.check_output(
['ps', '-ax', '-o', 'pid', '-o', 'ppid', '-o', 'command']
@@ -625,7 +625,7 @@ def _check_processes():
@print_log_on_assert
def _check_fds(*, log=None):
def waitforfds(diff):
for i in range(600):
for _ in range(600):
fds_diff = diff()
if fds_diff <= option.fds_threshold:
@@ -748,7 +748,7 @@ def skip_fds_check():
@pytest.fixture
def temp_dir(request):
def temp_dir():
return unit_instance['temp_dir']
@@ -758,16 +758,16 @@ def is_unsafe(request):
@pytest.fixture
def is_su(request):
def is_su():
return os.geteuid() == 0
@pytest.fixture
def unit_pid(request):
def unit_pid():
return unit_instance['process'].pid
def pytest_sessionfinish(session):
def pytest_sessionfinish():
if not option.restart and option.save_log:
print(f'Path to unit.log:\n{Log.get_path()}\n')