Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@
# The short X.Y version.
version = "v2.0"
# The full version, including alpha/beta/rc tags.
release = "v2.0.3-rc-1"
release = "v2.0.3-rc-3"

# The language for content autogenerated by Sphinx. Refer to documentation
# for a list of supported languages.
Expand Down
2 changes: 1 addition & 1 deletion multicast/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@

global __version__ # skipcq: PYL-W0604

__version__ = """2.0.3-rc-1"""
__version__ = """2.0.3-rc-3"""
"""The version of this program.

Minimal Acceptance Testing:
Expand Down
2 changes: 1 addition & 1 deletion setup.cfg
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[metadata]
name = multicast
version = 2.0.3-rc-1
version = 2.0.3-rc-3
author = Mr. Walls
author_email = [email protected]
description = Multicast Python Module for Send/Recv Stubs.
Expand Down
13 changes: 11 additions & 2 deletions tests/MulticastUDPClient.py
Original file line number Diff line number Diff line change
Expand Up @@ -232,6 +232,7 @@ class MCastClient(object): # skipcq: PYL-R0205
_source_port = None
"""The source port for the client."""

# skipcq: TCV-002
def __init__(self, *args, **kwargs):
"""
Initialize a MCastClient object with optional group address and source port.
Expand Down Expand Up @@ -292,6 +293,7 @@ def __init__(self, *args, **kwargs):


"""
# skipcq: TCV-002
if str("""grp_addr""") in kwargs:
self._group_addr = kwargs.get("""grp_addr""", None) # skipcq: PTC-W0039 - ensure None
if str("""src_port""") in kwargs:
Expand All @@ -308,6 +310,7 @@ def __init__(self, *args, **kwargs):
)
)

# skipcq: TCV-002
@staticmethod
def say(address, port, sock, msg):
"""
Expand Down Expand Up @@ -361,6 +364,7 @@ def say(address, port, sock, msg):
for multicast communication.

"""
# skipcq: TCV-002
sock.sendto(bytes(msg + "\n", "utf-8"), (address, port))
received = str(sock.recv(1024), "utf-8")
sp = " " * 4
Expand Down Expand Up @@ -394,6 +398,7 @@ class MyUDPHandler(socketserver.BaseRequestHandler):

__module__ = """tests.MulticastUDPClient.MyUDPHandler"""

# skipcq: TCV-002
def handle(self):
"""
Handle incoming UDP requests.
Expand Down Expand Up @@ -442,13 +447,15 @@ def handle(self):
as per `socketserver.BaseRequestHandler` for datagram services.

"""
# skipcq: TCV-002
data = self.request[0].strip()
sock = self.request[1]
print(f"{self.client_address[0]} wrote: ")
print(data)
sock.sendto(data.upper(), self.client_address)


# skipcq: TCV-002
def main():
"""
The main test operations.
Expand All @@ -474,6 +481,7 @@ def main():


"""
# skipcq: TCV-002
HOST, PORT = "224.0.0.1", 59991
data = "TEST This is a test"
sock = socket.socket(socket.AF_INET, socket.SOCK_DGRAM, socket.IPPROTO_UDP)
Expand All @@ -484,5 +492,6 @@ def main():


if __name__ == "__main__":
main()
exit(0) # skipcq: PYL-R1722 - intentionally allow overwriteing exit for testing
main() # skipcq: TCV-002
# skipcq: PYL-R1722
exit(0) # skipcq: PYL-R1722 -- intentionally allow overwriteing exit for testing.
18 changes: 13 additions & 5 deletions tests/context.py
Original file line number Diff line number Diff line change
Expand Up @@ -242,9 +242,9 @@
try:
thecov = checkPythonCommand(["command", "-v", "coverage"])
if (str("/coverage") in str(thecov)):
thecov = str("coverage")
thecov = str("coverage") # skipcq: TCV-002
elif str("/coverage3") in str(checkPythonCommand(["command", "-v", "coverage3"])):
thecov = str("coverage3")
thecov = str("coverage3") # skipcq: TCV-002
else: # pragma: no branch
thecov = "exit 1 ; #"
except Exception: # pragma: no branch
Expand Down Expand Up @@ -285,7 +285,7 @@
thepython = str(sys.executable)
thecov = getCoverageCommand()
if (str("coverage") in str(thecov)) and (sys.version_info >= (3, 7)):
thepython = str("{} run -p").format(str(thecov))
thepython = str("{} run -p").format(str(thecov)) # skipcq: TCV-002
else: # pragma: no branch
try:
import coverage as coverage
Expand Down Expand Up @@ -384,6 +384,7 @@
if sys.__name__ is None: # pragma: no branch
raise ImportError("[CWE-758] Failed to import system.") from None
if not args or args[0] is None:
# skipcq: TCV-002
raise ValueError("[CWE-1286] args must be an array of positional arguments") from None
else:
args = [*args] # convert to an array
Expand Down Expand Up @@ -545,7 +546,7 @@
theOutput = None
try:
if (args is None) or (args == [None]) or (len(args) <= 0): # pragma: no branch
theOutput = subprocess.check_output(["exit 1 ; #"])

Check notice on line 549 in tests/context.py

View check run for this annotation

codefactor.io / CodeFactor

tests/context.py#L549

subprocess call - check for execution of untrusted input. (B603)
else:
if str("coverage") in args[0]:
args = checkCovCommand(*args)
Expand Down Expand Up @@ -930,6 +931,13 @@

__name__ = """tests.context.BasicUsageTestSuite"""

NO_PYTHON_ERROR = """No python cmd to test with!""" # skipcq: TCV-002
"""Error message used when Python command is not available for testing.

This constant is used across multiple test methods to maintain consistency
in error reporting when Python command execution is not possible.
"""

@classmethod
def setUpClass(cls):
"""Overrides unittest.TestCase.setUpClass(cls) to set up thepython test fixture."""
Expand All @@ -954,7 +962,7 @@
Defaults is to skip test if class is missing thepython test fixture.
"""
if not self._thepython:
self.skipTest(str("""No python cmd to test with!"""))
self.skipTest(self.NO_PYTHON_ERROR) # skipcq: TCV-002
self._the_test_port = self._always_generate_random_port_WHEN_called()

def _should_get_package_version_WHEN_valid(self):
Expand Down Expand Up @@ -998,7 +1006,7 @@
def test_finds_python_WHEN_testing(self):
"""Test case 1: Class Test-Fixture Meta Test."""
if (self._thepython is not None) and (len(self._thepython) <= 0):
self.fail(str("""No python cmd to test with!"""))
self.fail(self.NO_PYTHON_ERROR) # skipcq: TCV-002
self.test_absolute_truth_and_meaning()

def tearDown(self):
Expand Down
Loading