From c8a781c7c594846e01ee1fc54cde2ee7b2d25145 Mon Sep 17 00:00:00 2001 From: Dmitri Bogomolov <4glitch@gmail.com> Date: Tue, 8 May 2018 17:39:07 +0300 Subject: [PATCH] Marked use of random, subprocess and xmlrpclib in tests for skipping by bandit --- src/tests/core.py | 6 +++--- src/tests/test_api.py | 2 +- src/tests/test_process.py | 4 ++-- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/tests/core.py b/src/tests/core.py index f937bc47..0f66754b 100644 --- a/src/tests/core.py +++ b/src/tests/core.py @@ -3,7 +3,7 @@ Tests for core and those that do not work outside (because of import error for example) """ -import random +import random # nosec import string import unittest @@ -17,10 +17,10 @@ class TestCore(unittest.TestCase): """test encoding and decoding (originally from helper_msgcoding)""" msg_data = { 'subject': ''.join( - random.choice(string.ascii_lowercase + string.digits) + random.choice(string.ascii_lowercase + string.digits) # nosec for _ in range(40)), 'body': ''.join( - random.choice(string.ascii_lowercase + string.digits) + random.choice(string.ascii_lowercase + string.digits) # nosec for _ in range(10000)) } diff --git a/src/tests/test_api.py b/src/tests/test_api.py index 8915a735..eb76d382 100644 --- a/src/tests/test_api.py +++ b/src/tests/test_api.py @@ -4,7 +4,7 @@ Tests using API. import base64 import json -import xmlrpclib +import xmlrpclib # nosec from time import sleep from test_process import TestProcessProto diff --git a/src/tests/test_process.py b/src/tests/test_process.py index 45e0317e..b32cfeb6 100644 --- a/src/tests/test_process.py +++ b/src/tests/test_process.py @@ -4,7 +4,7 @@ Common reusable code for tests and tests for pybitmessage process. import os import signal -import subprocess +import subprocess # nosec import tempfile import time import unittest @@ -34,7 +34,7 @@ class TestProcessProto(unittest.TestCase): """Setup environment and start pybitmessage""" cls.home = os.environ['BITMESSAGE_HOME'] = tempfile.gettempdir() put_signal_file(cls.home, 'unittest.lock') - subprocess.call(cls._process_cmd) + subprocess.call(cls._process_cmd) # nosec time.sleep(5) cls.pid = int(cls._get_readline('singleton.lock')) cls.process = psutil.Process(cls.pid)