Skip to content

Commit 35dfb24

Browse files
committed
Pylint fixes
Pylint was complaining about an IMDSv2 get request without a timeout. Added a 2 sec timeout to silence it. Also, added .git as an ignore path to pylint test. Signed-off-by: Babis Chalios <[email protected]>
1 parent 06b4702 commit 35dfb24

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

tests/framework/utils_imdsv2.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ def get_token(self):
4040
headers = {IMDSV2_HDR_TOKEN_TTL: str(self.ttl)}
4141
# To get a token, docs say to always use latest
4242
url = f"{self.endpoint}/latest/api/token"
43-
res = requests.put(url, headers=headers)
43+
res = requests.put(url, headers=headers, timeout=2)
4444
self.token = res.content
4545
self.token_expiry_time = time.time() + self.ttl
4646
return self.token
@@ -53,7 +53,7 @@ def get(self, path):
5353
"""
5454
headers = {IMDSV2_HDR_TOKEN: self.get_token()}
5555
url = f"{self.endpoint}/{self.version}{path}"
56-
res = requests.get(url, headers=headers)
56+
res = requests.get(url, headers=headers, timeout=2)
5757
if res.status_code != 200:
5858
raise Exception(f"IMDSv2 returned {res.status_code} for {url}")
5959
return res.text

tests/integration_tests/build/test_pylint.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ def test_python_pylint():
2525

2626
# Get all *.py files from the project
2727
python_files = utils.get_files_from(
28-
find_path="..", pattern="*.py", exclude_names=["build", ".kernel"]
28+
find_path="..", pattern="*.py", exclude_names=["build", ".kernel", ".git"]
2929
)
3030

3131
# Assert if somehow no python files were found

0 commit comments

Comments
 (0)