*Note*: Before submitting this pull request, please review our [contributing
guidelines](https://docs.celeryq.dev/en/main/contributing.html).

## Description

<!-- Please describe your pull request.

NOTE: All patches should be made against main, not a maintenance branch like
3.1, 2.5, etc.  That is unless the bug is already fixed in main, but not in
that version series.

If it fixes a bug or resolves a feature request,
be sure to link to that issue via (Fixes #4412) for example.
-->
Avoid tests interference from each others.
integration test: cleanup worker after test case. *Note*: Before submitting this pull request, please review our [contributing
guidelines](https://docs.celeryq.dev/en/main/contributing.html).

## Description

<!-- Please describe your pull request.

NOTE: All patches should be made against main, not a maintenance branch like
3.1, 2.5, etc.  That is unless the bug is already fixed in main, but not in
that version series.

If it fixes a bug or resolves a feature request,
be sure to link to that issue via (Fixes #4412) for example.
-->
Avoid tests interference from each others.
import importlib
import os

import pytest

from celery.utils.sysinfo import df, load_average

try:
    posix = importlib.import_module('posix')
except Exception:
    posix = None


@pytest.mark.skipif(
    not hasattr(os, 'getloadavg'),
    reason='Function os.getloadavg is not defined'
)
def test_load_average(patching):
    getloadavg = patching('os.getloadavg')
    getloadavg.return_value = 0.54736328125, 0.6357421875, 0.69921875
    l = load_average()
    assert l
    assert l == (0.55, 0.64, 0.7)


@pytest.mark.skipif(
    not hasattr(posix, 'statvfs_result'),
    reason='Function posix.statvfs_result is not defined'
)
def test_df():
    x = df('/')
    assert x.total_blocks
    assert x.available
    assert x.capacity
    assert x.stat

import importlib
import os

import pytest

from celery.utils.sysinfo import df, load_average

try:
    posix = importlib.import_module('posix')
except Exception:
    posix = None


@pytest.mark.skipif(
    not hasattr(os, 'getloadavg'),
    reason='Function os.getloadavg is not defined'
)
def test_load_average(patching):
    getloadavg = patching('os.getloadavg')
    getloadavg.return_value = 0.54736328125, 0.6357421875, 0.69921875
    l = load_average()
    assert l
    assert l == (0.55, 0.64, 0.7)


@pytest.mark.skipif(
    not hasattr(posix, 'statvfs_result'),
    reason='Function posix.statvfs_result is not defined'
)
def test_df():
    x = df('/')
    assert x.total_blocks
    assert x.available
    assert x.capacity
    assert x.stat
