• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

localstack / localstack / 22048723723

13 Feb 2026 06:59PM UTC coverage: 87.006% (+0.1%) from 86.883%
22048723723

push

github

web-flow
CW Logs: Test suite for service internalization (#13692)

22 of 22 new or added lines in 1 file covered. (100.0%)

928 existing lines in 33 files now uncovered.

69716 of 80128 relevant lines covered (87.01%)

0.87 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

70.73
/localstack-core/localstack/utils/platform.py
1
import platform
1✔
2
from functools import lru_cache
1✔
3

4

5
def is_mac_os() -> bool:
1✔
6
    return "darwin" == platform.system().lower()
1✔
7

8

9
def is_linux() -> bool:
1✔
10
    return "linux" == platform.system().lower()
1✔
11

12

13
def is_windows() -> bool:
1✔
UNCOV
14
    return "windows" == platform.system().lower()
×
15

16

17
@lru_cache
1✔
18
def is_debian() -> bool:
1✔
19
    from localstack.utils.files import load_file
1✔
20

21
    return "Debian" in load_file("/etc/issue", "")
1✔
22

23

24
@lru_cache
1✔
25
def is_redhat() -> bool:
1✔
26
    from localstack.utils.files import load_file
×
27

28
    return "rhel" in load_file("/etc/os-release", "")
×
29

30

31
class Arch(str):
1✔
32
    """LocalStack standardised machine architecture names"""
33

34
    amd64 = "amd64"
1✔
35
    arm64 = "arm64"
1✔
36

37

38
def standardized_arch(arch: str):
1✔
39
    """
40
    Returns LocalStack standardised machine architecture name.
41
    """
42
    if arch == "x86_64":
1✔
43
        return Arch.amd64
1✔
44
    if arch == "aarch64":
1✔
45
        return Arch.arm64
1✔
46
    return arch
×
47

48

49
def get_arch() -> str:
1✔
50
    """
51
    Returns the current machine architecture.
52
    """
53
    arch = platform.machine()
1✔
54
    return standardized_arch(arch)
1✔
55

56

57
# TODO: implement proper architecture detection (e.g., test whether an architecture-specific binary actually runs)
58
#   because this naive implementation does not cover cross-architecture emulation
59
def is_arm_compatible() -> bool:
1✔
60
    """Returns true if the current machine is compatible with ARM instructions and false otherwise."""
61
    return get_arch() == Arch.arm64
×
62

63

64
def get_os() -> str:
1✔
65
    if is_mac_os():
×
66
        return "osx"
×
67
    if is_linux():
×
68
        return "linux"
×
69
    if is_windows():
×
70
        return "windows"
×
71
    raise ValueError("Unable to determine local operating system")
×
72

73

74
def in_docker() -> bool:
1✔
75
    from localstack import config
1✔
76

77
    return config.in_docker()
1✔
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc