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

Allow running tests programmatically #799

Closed
wants to merge 8 commits into from

Conversation

ps-george
Copy link
Contributor

@ps-george ps-george commented May 18, 2018

Fixes #222

  • Added main code into a function called run_locust that takes OptionParser object and additional arguments.
  • Moved parser code into a file called parser.py
  • Added tests to test_main.py for new changes.
  • Added example file to demonstrate new functionality
  • Added new docs for running locust programmatically
  • Changed from gevent import wsgi in test_web.py to from gevent import pywsgi because it was throwing an error (also all uses of wsgi to pywsgi)
  • Added Napoleon to Sphinx conf.py for sane parsing of function docstrings.
  • Added functions is_taskset and load_tasksetfile since would be useful and minimal effort to add.
  • Added create_options function to create default options for new mode

ps-george added 2 commits May 17, 2018 13:27
Merge changes from locustio/locust
* creating run_locust function for running locust from within Python

* fixing error can't import name wsgi

* Passing all tests so far

* Adding napoleon and adding locust dir to path

* Updating documentation for new feature.

* Fixed example file
@ps-george ps-george changed the title Fix to #222 Allow running tests programmatically May 18, 2018
@codecov
Copy link

codecov bot commented May 18, 2018

Codecov Report

Merging #799 into master will increase coverage by 0.25%.
The diff coverage is 76.85%.

Impacted file tree graph

@@            Coverage Diff            @@
##           master    #799      +/-   ##
=========================================
+ Coverage   67.44%   67.7%   +0.25%     
=========================================
  Files          15      15              
  Lines        1588    1483     -105     
  Branches      243     234       -9     
=========================================
- Hits         1071    1004      -67     
+ Misses        456     410      -46     
- Partials       61      69       +8
Impacted Files Coverage Δ
locust/parser.py 100% <100%> (ø)
locust/main.py 30.33% <50.87%> (+4.16%) ⬆️
locust/contrib/fasthttp.py
locust/log.py 84.37% <0%> (+18.75%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 391c4cf...5f9d94e. Read the comment docs.

@ps-george
Copy link
Contributor Author

ps-george commented May 18, 2018

Changed from gevent import wsgi in test_web.py to from gevent import pywsgi because it was throwing an error (also all uses of wsgi to pywsgi)

Note that before this change all Travis builds are failing (see https://travis-ci.org/locustio/locust/jobs/380659365)

@ps-george
Copy link
Contributor Author

Open to any alternative suggestions to dealing with Travis CI no longer supporting python3.3 other than removing it from tox.ini and .travis.yml if anyone has any ideas.

@tysonclugg
Copy link

https://www.python.org/dev/peps/pep-0398/#lifespan

As of 2017-09-29, Python 3.3.x reached end-of-life status.

I'd drop support for 3.3.

@tysonclugg
Copy link

I've had a look through the changes, and I can't see any issues. Especially since the tests pass on this branch, and tests fail on master.

@cgoldberg
Copy link
Member

I think dropping 3.3 support is fine, but not in this PR.. please propose that separately. also... all of the other changes unrelated to this PR (whitespace, refactoring, rearranging, doc theming, etc) really need to be moved into individual PR's.

@ps-george
Copy link
Contributor Author

ps-george commented May 24, 2018

Okay, will do, it was just difficult to submit a PR that failed the CI.

Am on holiday for the next few days so next week some time. In the meantime if anyone else wants to raise PRs for some of the individual changes here feel free.

@cgoldberg
Copy link
Member

it was just difficult to submit a PR that failed the CI

you can add your PR to fix CI first

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants