Skip to content

Commit

Permalink
renamed cloud-energy-collection dir to iriscasttols
Browse files Browse the repository at this point in the history
changed file structure to fix pylint error
  • Loading branch information
anish-mudaraddi committed Mar 30, 2023
1 parent 7ec7de3 commit 0961698
Show file tree
Hide file tree
Showing 10 changed files with 16 additions and 23 deletions.
6 changes: 3 additions & 3 deletions .github/workflows/iriscast_package_build.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -26,11 +26,11 @@ jobs:
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -r cloud-energy-collection/iriscasttools/requirements.txt
pip install -r iriscasttools/requirements.txt
- name: Run tests
run: cd cloud-energy-collection/iriscasttools/ && python3 -m pytest .
run: cd iriscasttools/ && python3 -m pytest .

- name: Analyse with pylint
run: |
cd cloud-energy-collection/iriscasttools && pylint --recursive yes . test
cd iriscasttools && pylint --recursive yes test iriscasttools
Original file line number Diff line number Diff line change
Expand Up @@ -394,7 +394,6 @@ logging-modules=logging
# all. Valid levels: HIGH, CONTROL_FLOW, INFERENCE, INFERENCE_FAILURE,
# UNDEFINED.
confidence=HIGH,
CONTROL_FLOW,
INFERENCE,
INFERENCE_FAILURE,
UNDEFINED
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
"""
Collects energy usage metrics using IPMI, as well as other metrics such as CPU and RAM usage.
"""
import sys
import argparse
import logging
import utils
from iriscasttools import utils

logger = logging.getLogger(__name__)

Expand Down Expand Up @@ -56,8 +55,3 @@ def parse_args(inp_args):
args.include_header = False

return args


if __name__ == "__main__":
cmd_args = parse_args(sys.argv[1:])
print(get_iriscast_stats(cmd_args.as_csv, cmd_args.include_header))
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
from unittest.mock import patch
import pytest

from main import get_iriscast_stats, parse_args
from iriscasttools.main import get_iriscast_stats, parse_args


@pytest.mark.parametrize(
Expand All @@ -28,10 +28,10 @@ def test_parse_args(test_args, expected_arg_values):
"test_csv_flag, test_include_header",
[(False, False), (True, True), (True, False)],
)
@patch("utils.get_ipmi_power_stats")
@patch("utils.get_os_load")
@patch("utils.get_ram_usage")
@patch("utils.to_csv")
@patch("iriscasttools.utils.get_ipmi_power_stats")
@patch("iriscasttools.utils.get_os_load")
@patch("iriscasttools.utils.get_ram_usage")
@patch("iriscasttools.utils.to_csv")
def test_get_iriscast_stats(
mock_to_csv,
mock_get_ram_usage,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
import pathlib
from unittest.mock import NonCallableMock, patch
import pytest
from utils import (
from iriscasttools.utils import (
to_csv,
run_cmd,
ipmi_raw_power_query,
Expand Down Expand Up @@ -71,7 +71,7 @@ def test_to_csv(mock_input, include_headers, expected_out):
assert to_csv(mock_input, include_headers) == expected_out


@patch("utils.subprocess")
@patch("iriscasttools.utils.subprocess")
def test_run_cmd_success(mock_subprocess):
"""
Test "run_cmd" function
Expand Down Expand Up @@ -148,7 +148,7 @@ def test_check_ipmi_conn_fail():
assert not check_ipmi_conn()


@patch("utils.run_cmd")
@patch("iriscasttools.utils.run_cmd")
def test_ipmi_raw_power_query(mock_run_cmd):
"""
Test "ipmi_raw_power_query" function
Expand Down Expand Up @@ -180,8 +180,8 @@ def test_ipmi_raw_power_query(mock_run_cmd):
(["some_invalid_arg"]),
],
)
@patch("utils.ipmi_raw_power_query")
@patch("utils.check_ipmi_conn")
@patch("iriscasttools.utils.ipmi_raw_power_query")
@patch("iriscasttools.utils.check_ipmi_conn")
def test_get_ipmi_power_stats(mock_check_ipmi_conn, mock_raw_power_query, test_args):
"""
Test "ipmi_raw_power_query" function
Expand Down Expand Up @@ -218,7 +218,7 @@ def test_get_ipmi_power_stats(mock_check_ipmi_conn, mock_raw_power_query, test_a
"test_args",
[(["max_ram_kb", "used_ram_kb", "ram_usage_percentage"]), (["some_invalid_arg"])],
)
@patch("utils.os.getloadavg")
@patch("iriscasttools.utils.os.getloadavg")
def test_get_os_load(mock_os_get_load_avg, test_args):
"""
Test "get_os_load" function
Expand Down Expand Up @@ -247,7 +247,7 @@ def test_get_os_load(mock_os_get_load_avg, test_args):
"test_args",
[(["max_ram_kb", "used_ram_kb", "ram_usage_percentage"]), (["some_invalid_arg"])],
)
@patch("utils.run_cmd")
@patch("iriscasttools.utils.run_cmd")
def test_get_ram_usage(mock_run_cmd, test_args):
"""
Test "get_ram_usage" function
Expand Down

0 comments on commit 0961698

Please sign in to comment.