-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fixup perfmon #10
base: master
Are you sure you want to change the base?
Fixup perfmon #10
Conversation
Signed-off-by: Stephen Cheng <stephen.cheng@cloud.com>
Codecov ReportAttention:
Additional details and impacted files@@ Coverage Diff @@
## master #10 +/- ##
==========================================
+ Coverage 45.38% 46.71% +1.33%
==========================================
Files 18 21 +3
Lines 2937 3033 +96
==========================================
+ Hits 1333 1417 +84
- Misses 1604 1616 +12
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Remaining comments which cannot be posted as a review comment to avoid GitHub Rate Limit
pylint
scripts/test_hfx_filename.py|45 col 4| C0116: Missing function or method docstring (missing-function-docstring)
scripts/test_hfx_filename.py|71 col 4| C0116: Missing function or method docstring (missing-function-docstring)
scripts/test_hfx_filename.py|84 col 4| C0116: Missing function or method docstring (missing-function-docstring)
scripts/test_hfx_filename.py|99| C0115: Missing class docstring (missing-class-docstring)
scripts/test_hfx_filename.py|101 col 4| C0116: Missing function or method docstring (missing-function-docstring)
scripts/test_hfx_filename.py|8| C0411: standard import "import sys" should be placed before "from mock import MagicMock, patch, call" (wrong-import-order)
|
||
def get_module(module_name, file_path): | ||
testdir = os.path.dirname(__file__) | ||
return import_from_file(module_name, testdir + file_path) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[pylint] reported by reviewdog 🐶
C0304: Final newline missing (missing-final-newline)
@@ -0,0 +1,24 @@ | |||
# Used for importing a non-".py" file as a module |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[pylint] reported by reviewdog 🐶
C0114: Missing module docstring (missing-module-docstring)
# Only for python3, but CI has python2 pytest check, so add this line | ||
if sys.version_info.major == 2: | ||
return None | ||
from importlib import machinery, util |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[pylint] reported by reviewdog 🐶
C0415: Import outside toplevel (importlib.machinery, importlib.util) (import-outside-toplevel)
spec.loader.exec_module(module) | ||
return module | ||
|
||
def get_module(module_name, file_path): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[pylint] reported by reviewdog 🐶
C0116: Missing function or method docstring (missing-function-docstring)
@unittest.skipIf(sys.version_info < (3, 0), reason="requires python3") | ||
@patch("socket.socket") | ||
class TestRpc(unittest.TestCase): | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[pylint] reported by reviewdog 🐶
C0303: Trailing whitespace (trailing-whitespace)
class TestParse(unittest.TestCase): | ||
|
||
def test_parse_string(self): | ||
txt = "<value><array><data><value>success</value><value>abcde</value></data></array></value>" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[pylint] reported by reviewdog 🐶
C0301: Line too long (101/100) (line-too-long)
expected_txt = "abcde" | ||
return_txt = hfx_filename.parse_string(txt) | ||
self.assertEqual(expected_txt, return_txt) | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[pylint] reported by reviewdog 🐶
C0303: Trailing whitespace (trailing-whitespace)
@@ -0,0 +1,107 @@ | |||
#!/usr/bin/env python3 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[pylint] reported by reviewdog 🐶
C0114: Missing module docstring (missing-module-docstring)
|
||
@unittest.skipIf(sys.version_info < (3, 0), reason="requires python3") | ||
@patch("socket.socket") | ||
class TestRpc(unittest.TestCase): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[pylint] reported by reviewdog 🐶
C0115: Missing class docstring (missing-class-docstring)
@patch("socket.socket") | ||
class TestRpc(unittest.TestCase): | ||
|
||
def test_rpc(self, mock_socket): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[pylint] reported by reviewdog 🐶
C0116: Missing function or method docstring (missing-function-docstring)
106b9f2
to
434073a
Compare
scripts/hfx_filename
Outdated
@@ -55,13 +51,14 @@ def rpc(session_id, request): | |||
s.close() | |||
|
|||
def parse_string(txt): | |||
assert isinstance(txt, str): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[pylint] reported by reviewdog 🐶
E0001: Parsing failed: 'invalid syntax (, line 54)' (syntax-error)
@@ -380,7 +380,7 @@ def get_percent_mem_usage(ignored): | |||
memlist = memfd.readlines() | |||
memfd.close() | |||
memdict = [ m.split(':', 1) for m in memlist ] | |||
memdict = dict([(k.strip(), float(re.search('\d+', v.strip()).group(0))) for (k,v) in memdict]) | |||
memdict = dict([(k.strip(), float(re.search(r'\d+', v.strip()).group(0))) for (k,v) in memdict]) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[pylint] reported by reviewdog 🐶
C0301: Line too long (104/100) (line-too-long)
|
||
|
||
@unittest.skipIf(sys.version_info < (3, 0), reason="requires python3") | ||
class TestParse(unittest.TestCase): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[pylint] reported by reviewdog 🐶
C0115: Missing class docstring (missing-class-docstring)
|
||
import unittest | ||
from mock import MagicMock, patch, call | ||
import sys |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[pylint] reported by reviewdog 🐶
C0411: standard import "import sys" should be placed before "from mock import MagicMock, patch, call" (wrong-import-order)
return import_from_file("perfmon", testdir + "/perfmon") | ||
|
||
perfmon = get_module() | ||
perfmon = get_module("perfmon", "/perfmon") | ||
@unittest.skipIf(sys.version_info < (3, 0), reason="requires python3") | ||
@patch("subprocess.getoutput") | ||
class TestGetPercentage(unittest.TestCase): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[pylint] reported by reviewdog 🐶
C0115: Missing class docstring (missing-class-docstring)
@@ -5,35 +5,13 @@ | |||
import unittest | |||
from mock import MagicMock, patch | |||
import sys |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[pylint] reported by reviewdog 🐶
C0411: standard import "import sys" should be placed before "from mock import MagicMock, patch" (wrong-import-order)
@@ -5,35 +5,13 @@ | |||
import unittest | |||
from mock import MagicMock, patch | |||
import sys | |||
import os | |||
import subprocess | |||
import math |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[pylint] reported by reviewdog 🐶
C0411: standard import "import math" should be placed before "from mock import MagicMock, patch" (wrong-import-order)
return import_from_file("static_vdis", testdir + "/static-vdis") | ||
|
||
static_vdis = get_module() | ||
static_vdis = get_module("static_vdis", "/static-vdis") | ||
|
||
@unittest.skipIf(sys.version_info < (3, 0), reason="requires python3") | ||
class TestReadWriteFile(unittest.TestCase): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[pylint] reported by reviewdog 🐶
C0115: Missing class docstring (missing-class-docstring)
@@ -5,36 +5,14 @@ | |||
import unittest | |||
from mock import MagicMock | |||
import sys |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[pylint] reported by reviewdog 🐶
C0411: standard import "import sys" should be placed before "from mock import MagicMock" (wrong-import-order)
@@ -5,36 +5,14 @@ | |||
import unittest | |||
from mock import MagicMock | |||
import sys | |||
import os | |||
import subprocess | |||
import tempfile |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[pylint] reported by reviewdog 🐶
C0411: standard import "import tempfile" should be placed before "from mock import MagicMock" (wrong-import-order)
434073a
to
3fb1ed0
Compare
prefix = "<value><array><data><value>success</value><value>" | ||
if not txt.startswith(prefix): | ||
raise "Unable to parse string response" | ||
raise Exception("Unable to parse string response") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[pylint] reported by reviewdog 🐶
W0719: Raising too general exception: Exception (broad-exception-raised)
txt = txt[len(prefix):] | ||
suffix = "</value></data></array></value>" | ||
if not txt.endswith(suffix): | ||
raise "Unable to parse string response" | ||
raise Exception("Unable to parse string response") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[pylint] reported by reviewdog 🐶
W0719: Raising too general exception: Exception (broad-exception-raised)
expected_return = "HelloWorld" | ||
self.assertEqual(expected_return, body) | ||
|
||
def test_rpc_international_character(self, mock_socket): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[pylint] reported by reviewdog 🐶
C0116: Missing function or method docstring (missing-function-docstring)
expected_return = "HelloWorld" | ||
self.assertEqual(expected_return, body) | ||
|
||
def test_db_get_uuid(self, mock_socket): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[pylint] reported by reviewdog 🐶
C0116: Missing function or method docstring (missing-function-docstring)
response = hfx_filename.db_get_by_uuid(0, "pool_patch", "22345") | ||
self.assertEqual(expected_response, response) | ||
|
||
def test_read_field(self, mock_socket): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[pylint] reported by reviewdog 🐶
C0116: Missing function or method docstring (missing-function-docstring)
@unittest.skipIf(sys.version_info < (3, 0), reason="requires python3") | ||
class TestParse(unittest.TestCase): | ||
|
||
def test_parse_string(self): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[pylint] reported by reviewdog 🐶
C0116: Missing function or method docstring (missing-function-docstring)
a66e9e3
to
9216ab6
Compare
No description provided.