I am trying to run a test in locust, however I am getting the following exception:
Python: __init__() missing 1 required positional argument: 'ecu_model_id'.
I was writing the tests against other ones and they didn't have anything more in constructor. Do you have an idea what's wrong in this code? Let me know if you need anything more to provide.
from locust import task, HttpUser
from apicall.ecu import EcuModelApi
from common.configuration import config
ECU_TO_CREATE_1K = 1000
ECU_NAME = config['vehicle']['ecuModel']
global_counter = 0
lock = threading.Lock()
class Add1KECUs(HttpUser):
def on_start(self):
super().on_start()
self.ecu_model_id = EcuModelApi(self.client).get_ecu_model_id_by_name(ECU_NAME)
self.ecu_api = EcuModelApi(self.client, self.ecu_model_id)
Traceback:
Traceback (most recent call last):
File "src/gevent/greenlet.py", line 906, in gevent._gevent_cgreenlet.Greenlet.run
File "/home/bgryczka/pythonEnvironment/lib/python3.8/site-packages/locust/user/users.py", line 166, in run_user
user.run()
File "/home/bgryczka/pythonEnvironment/lib/python3.8/site-packages/locust/user/users.py", line 132, in run
self.on_start()
File "/home/bgryczka/dev/sources/locust-swm-performance-tests/tests/add1KECUs.py", line 19, in on_start
self.ecu_model_id = EcuModelApi(self.client).get_ecu_model_id_by_name(ECU_NAME)
TypeError: __init__() missing 1 required positional argument: 'ecu_model_id'
2021-09-15T11:09:55Z <Greenlet at 0x7f4351a65e10: run_user(<add1KECUs.Add1KECUs object at 0x7f4351193070>)> failed with TypeError