Skip to content

Commit

Permalink
docs: add pytest django setting specification to docs (openedx#33564)
Browse files Browse the repository at this point in the history
  • Loading branch information
connorhaugh authored Oct 24, 2023
1 parent c41db87 commit b0a004d
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion docs/concepts/testing/testing.rst
Original file line number Diff line number Diff line change
Expand Up @@ -114,10 +114,16 @@ For example, this command runs a single python unit test file::
pytest xmodule/tests/test_stringify.py

Note -
edx-platorm has multiple services (lms, cms) in it. The environment for each service is different enough that we run some tests in both environments in jenkins. To make sure tests will pass in each of these environments (especially for tests in "common" directory), you will need to test in each seperately. Add --rootdir flag at end of your pytest call and specify the env you are testing in::
edx-platorm has multiple services (lms, cms) in it. The environment for each service is different enough that we run some tests in both environments in Github Actions.
To test in each of these environments (especially for tests in "common" and "xmodule" directories), you will need to test in each seperately.
To specify that the tests are run with the relevant service as root, Add --rootdir flag at end of your pytest call and specify the env to test in::

pytest test --rootdir <lms or cms>

Or, if you need django settings from a particular enviroment, add --ds flag to the end of your pytest call and specify the django settings object::

pytest test --ds=<lms.envs.test or cms.envs.test>

Various tools like ddt create tests with very complex names, rather than figuring out the name yourself, you can:

1. Select tests to run based on their name, provide an expression to the `pytest -k option`_ which performs a substring match on test names::
Expand Down

0 comments on commit b0a004d

Please sign in to comment.