My god, I was an idiot. I need to start reading the error messages more thoroughly.
The code that actually caused the problem wasn't in here actually. It was several lines inside the constructor. Here it is:
class LocalTestHost:
def __init__(self, mst, port, local_ip, remote_if_mac, remote_if_ip, service_port):
.
. <some initialization code>
.
# This is the faulty line
self.__host_operations = HostOperationsFactory().create(
local_ip, port, mst, remote_if_ip)
And here is the error message, I kept not reading, and foolishly did not post with my question:
>>> test_hosts.LocalTestHost(1,2,3,4,5,6)
Traceback (most recent call last):
File "<stdin>", line 1, in ?
File "test_hosts.py", line 709, in __init__
self.__host_operations = HostOperationsFactory().create(
File "test_hosts.py", line 339, in create
remote_ip)
File "test_hosts.py", line 110, in __init__
packet_size, remote_ip)
TypeError: __init__() takes exactly 7 arguments (6 given)
I've refactored my code a bit, and added parameters to several methods and constructors, but I forgot to update their usage in several places. This create
function actually returns another object it instantiates, and it's constructor (incidentally has the same parameters as the constructor I picked on) did not receive all the parameters it should have.
I did not read the message thoroughly, and my confusion came from the last line stating I have passed the constructor too few parameters. Now, I also tried adding too many parameters as a sanity check, and there it actually was the constructor I was picking on. I'm surprised I didn't see that in this case the error trace was significantly shorter.
I've learned a valuable lesson today. The problem is I think I've leaned it several times already for some years.