Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Locust will not work, if there is a custom 'run' @task / function #1893

Closed
joerg1985 opened this issue Sep 27, 2021 · 1 comment
Closed

Locust will not work, if there is a custom 'run' @task / function #1893

joerg1985 opened this issue Sep 27, 2021 · 1 comment
Labels

Comments

@joerg1985
Copy link

Describe the bug

There are some magic methods with common names, like "run".
Creating a @task with those name will totally break locust, see example below.

Expected behavior

Magic methods should use some kind of prefix or not common names to avoid name clashes.

Actual behavior

Locust will not try to rerun the task, the run task is executed only once.

Steps to reproduce

class Dummy(HttpUser):
    @task
    def run(self):
	# a failing test script
        raise RuntimeError("failed to run")

Environment

  • OS: Mixed
  • Python version: 3.8
  • Locust version: 2.2.3
  • Locust command line that you ran:
  • Locust file contents (anonymized if necessary):
@joerg1985 joerg1985 added the bug label Sep 27, 2021
cyberw added a commit that referenced this issue Sep 27, 2021
@cyberw
Copy link
Collaborator

cyberw commented Sep 27, 2021

I agree, it really should be _run.

But because some people might be calling it explicitly and I dont want to break the interface I made a few workarounds. Try them out if you like :) (available in latest dev build in a few minutes...)

@cyberw cyberw closed this as completed Sep 27, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants