<commit_before># -*- coding: utf-8 -*-

from __future__ import absolute_import, print_function, unicode_literals

import pytest
import salt.utils.platform
from salt.ext import six
from tests.support.case import ModuleCase
from tests.support.helpers import flaky, slowTest
from tests.support.unit import skipIf


@pytest.mark.windows_whitelisted
class StatusModuleTest(ModuleCase):
    """
    Test the status module
    """

    @skipIf(salt.utils.platform.is_windows(), "minion is windows")
    @flaky
    def test_status_pid(self):
        """
        status.pid
        """
        status_pid = self.run_function("status.pid", ["cli_master"])
        grep_salt = self.run_function("cmd.run", ["pgrep -f cli_master"])
        self.assertEqual(status_pid, grep_salt)

    @skipIf(not salt.utils.platform.is_windows(), "windows only test")
    @slowTest
    def test_status_cpuload(self):
        """
        status.cpuload
        """
        ret = self.run_function("status.cpuload")
        self.assertTrue(isinstance(ret, float))

    @skipIf(not salt.utils.platform.is_windows(), "windows only test")
    @slowTest
    def test_status_saltmem(self):
        """<commit_msg>Revert "Changes test_status_pid to compare full PID list"<commit_after># -*- coding: utf-8 -*-

from __future__ import absolute_import, print_function, unicode_literals

import random

import pytest
import salt.utils.platform
from salt.ext import six
from tests.support.case import ModuleCase
from tests.support.helpers import flaky, slowTest
from tests.support.unit import skipIf


@pytest.mark.windows_whitelisted
class StatusModuleTest(ModuleCase):
    """
    Test the status module
    """

    @skipIf(salt.utils.platform.is_windows(), "minion is windows")
    @flaky
    def test_status_pid(self):
        """
        status.pid
        """
        status_pid = self.run_function("status.pid", ["salt"])
        grab_pids = status_pid.split()[:10]
        random_pid = random.choice(grab_pids)
        grep_salt = self.run_function("cmd.run", ["pgrep -f salt"])
        self.assertIn(random_pid, grep_salt)

    @skipIf(not salt.utils.platform.is_windows(), "windows only test")
    @slowTest
    def test_status_cpuload(self):
        """
        status.cpuload
        """
        ret = self.run_function("status.cpuload")
        self.assertTrue(isinstance(ret, float))

    @skipIf(not salt.utils.platform.is_windows(), "windows only test")
    @slowTest
    def test_status_saltmem(self):
        """
{'fraction_non_alphanumeric': 0.1176706827309237, 'fraction_numerical': 0.001606425702811245, 'mean_word_length': 3.272727272727273, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '238772', 'n_tokens_mistral': 787, 'n_tokens_neox': 769, 'n_words': 165}