Skip to content

Commit

Permalink
Fix timezone and locale tests on photon
Browse files Browse the repository at this point in the history
  • Loading branch information
dwoz committed Jan 8, 2025
1 parent caefec2 commit 1f08cdf
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 2 deletions.
13 changes: 13 additions & 0 deletions tests/integration/modules/test_localemod.py
Original file line number Diff line number Diff line change
@@ -1,13 +1,26 @@
import subprocess

import pytest

from tests.support.case import ModuleCase


def _check_systemctl():
if not hasattr(_check_systemctl, "memo"):
proc = subprocess.run(["localectl"], capture_output=True, check=False)
_check_systemctl.memo = (
b"Failed to get D-Bus connection: No such file or directory" in proc.stderr
or b"Failed to connect to bus: No such file or directory" in proc.stderr
)
return _check_systemctl.memo


@pytest.mark.skip_on_windows(reason="minion is windows")
@pytest.mark.skip_on_darwin(reason="locale method is not supported on mac")
@pytest.mark.skip_on_freebsd(
reason="locale method is supported only within login classes or environment variables"
)
@pytest.mark.skipif(_check_systemctl(), reason="localectl degraded")
@pytest.mark.requires_salt_modules("locale")
@pytest.mark.windows_whitelisted
class LocaleModuleTest(ModuleCase):
Expand Down
3 changes: 1 addition & 2 deletions tests/integration/modules/test_timezone.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,12 +20,11 @@

def _check_systemctl():
if not hasattr(_check_systemctl, "memo"):
proc = subprocess.run(["systemctl"], capture_output=True, check=False)
proc = subprocess.run(["timedatectl"], capture_output=True, check=False)
_check_systemctl.memo = (
b"Failed to get D-Bus connection: No such file or directory" in proc.stderr
or b"Failed to connect to bus: No such file or directory" in proc.stderr
)
print(repr(proc.stderr))
return _check_systemctl.memo


Expand Down

0 comments on commit 1f08cdf

Please sign in to comment.