# Path: sacred/host_info.py
# class IgnoreHostInfo(Exception):
# class HostInfoGetter:
#     def __init__(self, getter_function, name):
#     def __call__(self):
#     def get_info(self):
# def host_info_gatherer(name):
#     def wrapper(f):
# def check_additional_host_info(additional_host_info: List[HostInfoGetter]):
# def get_host_info(additional_host_info: List[HostInfoGetter] = None):
# def host_info_getter(func, name=None):
# def _hostname():
# def _os():
# def _python_version():
# def _cpu():
# def _gpus():
# def _environment():
# def _get_cpu_by_sysctl():
# def _get_cpu_by_proc_cpuinfo():
# def _get_cpu_by_pycpuinfo():


import pytest
from sacred.host_info import get_host_info, host_info_getter, host_info_gatherers
#!/usr/bin/env python
# coding=utf-8




def test_get_host_info():
    host_info = get_host_info()
    assert isinstance(host_info["hostname"], str)
    assert isinstance(host_info["cpu"], str)
    assert isinstance(host_info["os"], (tuple, list))
    assert isinstance(host_info["python_version"], str)


def test_host_info_decorator():
    try:
        assert "greeting" not in host_info_gatherers

        @host_info_getter
        def greeting():
            return "hello"

        assert "greeting" in host_info_gatherers
        assert host_info_gatherers["greeting"] == greeting

# Path: sacred/host_info.py
# class IgnoreHostInfo(Exception):
# class HostInfoGetter:
#     def __init__(self, getter_function, name):
#     def __call__(self):
#     def get_info(self):
# def host_info_gatherer(name):
#     def wrapper(f):
# def check_additional_host_info(additional_host_info: List[HostInfoGetter]):
# def get_host_info(additional_host_info: List[HostInfoGetter] = None):
# def host_info_getter(func, name=None):
# def _hostname():
# def _os():
# def _python_version():
# def _cpu():
# def _gpus():
# def _environment():
# def _get_cpu_by_sysctl():
# def _get_cpu_by_proc_cpuinfo():
# def _get_cpu_by_pycpuinfo():


# Path: tests/test_host_info.py
import pytest
from sacred.host_info import get_host_info, host_info_getter, host_info_gatherers

#!/usr/bin/env python
# coding=utf-8




def test_get_host_info():
    host_info = get_host_info()
    assert isinstance(host_info["hostname"], str)
    assert isinstance(host_info["cpu"], str)
    assert isinstance(host_info["os"], (tuple, list))
    assert isinstance(host_info["python_version"], str)


def test_host_info_decorator():
    try:
        assert "greeting" not in host_info_gatherers

        @host_info_getter
        def greeting():
            return "hello"

        assert "greeting" in host_info_gatherers
        assert host_info_gatherers["greeting"] == greeting

        assert get_host_info()["greeting"] == "hello"