Code Monkey home page Code Monkey logo

swagger-to-locustfile's Issues

[BUG] ImportError: The HttpLocust class has been renamed to HttpUser in version 1.0

Hello folks :),
first of all, thanks for this amazing tool!

Locust team did a lot of renaming https://docs.locust.io/en/latest/changelog.html#changelog-1-0
so when I try to run tests generated by the swagger-to-locustfile lib I get:

$ locust -f my/path/locustfile.py -H http://127.0.0.1:8000
Traceback (most recent call last):
  File "/some/path/clm/bin/locust", line 8, in <module>
    sys.exit(main())
  File "/some/path/clm/lib/python3.8/site-packages/locust/main.py", line 125, in main
    docstring, user_classes, shape_class = load_locustfile(locustfile)
  File "/some/path/clm/lib/python3.8/site-packages/locust/main.py", line 82, in load_locustfile
    imported = source.load_module()
  File "<frozen importlib._bootstrap_external>", line 522, in _check_name_wrapper
  File "<frozen importlib._bootstrap_external>", line 1027, in load_module
  File "<frozen importlib._bootstrap_external>", line 852, in load_module
  File "<frozen importlib._bootstrap>", line 265, in _load_module_shim
  File "<frozen importlib._bootstrap>", line 702, in _load
  File "<frozen importlib._bootstrap>", line 671, in _load_unlocked
  File "<frozen importlib._bootstrap_external>", line 848, in exec_module
  File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
  File "/path/to/locustfile/locustfile.py", line 34, in <module>
    class MyLocust(HttpLocust):
  File "/some/path/lib/python3.8/site-packages/locust/util/deprecation.py", line 27, in __new__
    raise ImportError(deprecation_message)
ImportError: The HttpLocust class has been renamed to HttpUser in version 1.0. For more info see: https://docs.locust.io/en/latest/changelog.html#changelog-1-0

Support special `x-lucust-X` fields

for example:

...
    "paths": {
        "/availability": {
            "get": {
                "x-lucust-min" : 50,
...
  • Support x-locust-default-value for fields.
  • Support x-locust-min and x-locust-max on endpoints (or on root level?)

Follow $ref (at least for parameters)

Currently not recognizing required parameters that are defined in the definition object and referenced from a path.

Workaround

use swagger-codegen to generate a json w/o param's $ref :
swagger-codegen generate -i input.yaml -l swagger

And then use the swagger.json output file with swagger2locustfile

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.