docs: clarify locust invocation norms #501

Merged
merged 4 commits into from Dec 13, 2016

Projects

None yet

3 participants

@pwnage101
Contributor

this is an attempt to addresses #500


Push for the following norm: all module imports either reference
installed modules, or modules beneath the "project root" (i.e. the CWD).
To that end, remove any examples where the locustfile is not beneath the
CWD.

Also, provide some example project directory structures.

pwnage101 added some commits Nov 9, 2016
@pwnage101 pwnage101 docs: clarify locust invocation norms
Push for the following norm: all module imports either reference
installed modules, or modules beneath the "project root" (i.e. the CWD).
To that end, remove any examples where the locustfile is not beneath the
CWD.

Also, provide some example project directory structures.
42e884d
@pwnage101 pwnage101 squash me 1
* fix formatting
128941f
docs/writing-a-locustfile.rst
+The locustfiles may import common libraries using, e.g. ``import commonlib_auth.py``. This approach does not
+cleanly separate common libraries from locustfiles, however.
+
+Subdirectories can be a cleaner approach, but locust cannot currenly cope with importing modules which live
@cgoldberg
cgoldberg Nov 9, 2016 Member

s/currenly/currently

@pwnage101 pwnage101 squash me 2
* clarify workaround with code snippet
* fix typos
* use double backticks correctly
* consistently refer to "locust files" using two words
5fb57c6
@pwnage101
Contributor

FYI, this new commit brings some typo fixes and other updates:

  • clarify workaround with code snippet
  • fix typos
  • use double backticks correctly
  • consistently refer to "locust files" using two words
@cgoldberg
Member

👍

@pwnage101
Contributor

@justiniso can you take a look?

docs/writing-a-locustfile.rst
+The locustfiles may import common libraries using, e.g. ``import commonlib_auth``. This approach does not
+cleanly separate common libraries from locust files, however.
+
+Subdirectories can be a cleaner approach (see example below), but locust cannot currently cope with importing
@justiniso
justiniso Dec 1, 2016 edited Member

but locust cannot currently cope with importing modules which live outside the locustfiles directory

I would make the problem statement more explicit:

but locust will only import modules relative to the directory in which the running locustfile is placed. If you wish to import from your the project root (i.e. the path of the location where you are running the locust command), make sure to .....

@pwnage101 pwnage101 squash me 3
* clarify exactly why locust cannot cope with locustfiles in
  subdirectories which import libraries in a different subdirectories.
dad1e78
@pwnage101
Contributor

@justiniso see updated text

@justiniso

👍

@pwnage101
Contributor

Thanks! This now has two member approvals, please merge.

@justiniso justiniso merged commit 3cddb18 into locustio:master Dec 13, 2016

1 check passed

continuous-integration/travis-ci/pr The Travis CI build passed
Details
@pwnage101
Contributor

bahhh i just realized i hadn't squashed :( so sorry...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment