From b0a004de3330658f3909e372be81ea72032c41a1 Mon Sep 17 00:00:00 2001 From: connorhaugh <49422820+connorhaugh@users.noreply.github.com> Date: Tue, 24 Oct 2023 11:35:15 -0400 Subject: [PATCH] docs: add pytest django setting specification to docs (#33564) --- docs/concepts/testing/testing.rst | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/docs/concepts/testing/testing.rst b/docs/concepts/testing/testing.rst index 1297b0ee3b..9d448afd5b 100644 --- a/docs/concepts/testing/testing.rst +++ b/docs/concepts/testing/testing.rst @@ -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 +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= + 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::