Close the inotify and watchdog instances after each test

This commit is contained in:
Daniel A. Wozniak 2023-08-23 12:38:32 +01:00 committed by Pedro Algarvio
parent 673e6ecccb
commit 07033471bd
No known key found for this signature in database
GPG key ID: BB36BF6584A298FF
2 changed files with 18 additions and 2 deletions

View file

@ -26,6 +26,14 @@ def configure_loader_modules():
return {inotify: {}}
@pytest.fixture(autouse=True)
def _close_inotify(configure_loader_modules):
try:
yield
finally:
inotify.close({})
def test_non_list_config():
config = {}
@ -212,8 +220,8 @@ def test_multi_files_exclude(tmp_path):
dp2 = str(tmp_path / "subdir2")
os.mkdir(dp1)
os.mkdir(dp2)
_exclude1 = "{}/subdir1/*tmpfile*$".format(str(tmp_path))
_exclude2 = "{}/subdir2/*filetmp*$".format(str(tmp_path))
_exclude1 = f"{str(tmp_path)}/subdir1/*tmpfile*$"
_exclude2 = f"{str(tmp_path)}/subdir2/*filetmp*$"
config = [
{
"files": {

View file

@ -45,6 +45,14 @@ def configure_loader_modules():
return {watchdog: {}}
@pytest.fixture(autouse=True)
def _close_watchdog(configure_loader_modules):
try:
yield
finally:
watchdog.close({})
def assertValid(config):
ret = watchdog.validate(config)
assert ret == (True, "Valid beacon configuration")