-
Notifications
You must be signed in to change notification settings - Fork 5.5k
Adding Python Django test docs #7516
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
Conversation
eleanorjboyd
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
looks great thank you! Added few comments
docs/python/testing.md
Outdated
| - Create a file named `.env` at the root of your project. | ||
| - Add `MANAGE_PY_PATH='path-string-to-manange.py-path'` to the `.env` file, replacing `path-string-to-manange.py-path` with the path to your application's `manage.py` file (Note: you can copy the path by right clicking on the file and selecting **Copy Path**). | ||
| - Add the following to your `settings.json` file `"python.envFile": "${workspaceFolder}/.env”` to incorporate this file in your environment (edit path as necessary if `.env` is not at root). | ||
|
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
some users have run into the problem that we populate python.testing.unittestArgs if they go through the UI setup flow right now and these args don't work for Django. Could we add somewhere to edit that variable to remove args and add any Django necessary args
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Moved this reminder up to the steps
docs/python/testing.md
Outdated
| In the case your tests are not discovered, try the following troubleshooting steps: | ||
|
|
||
| - Add `"python.testing.unittestArgs": []` in `settings.json` | ||
| - Look at the Python Output Panel for any error messages that may have triggered. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
do we want to remind people how to change logging verbosity or is that elsewhere in our docs?
Co-authored-by: Luciana Abud <45497113+luabud@users.noreply.github.com>
ntrogh
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Added some minor text suggestions.
Co-authored-by: Nick Trogh <1908215+ntrogh@users.noreply.github.com>
ntrogh
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looking good! I added a few final text suggestions.
Co-authored-by: Nick Trogh <1908215+ntrogh@users.noreply.github.com>
ntrogh
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM!
docs/python/testing.md
Outdated
| > **Tip**: you can copy the path by right clicking on the file in the Explorer view and selecting **Copy Path**. | ||
| 4. Add Django test arguments to `"python.testing.unittestArgs": []` in the `settings.json` [file](/docs/getstarted/settings.md#settingsjson) as needed, and remove any arguments that are not compatible with Django. | ||
|
|
||
| > **Note**: By default, the Python extension looks for and loads `.env` files at the project root. If your `.env` file is not at the project root or you are using [VS Code variable substitution](https://code.visualstudio.com/docs/editor/variables-reference), add `"python.envFile": "${workspaceFolder}/<path-to-.env>"` to your `settings.json` [file](/docs/getstarted/settings.md#settingsjson), so the Python extension can load the environment variables in this file when running and discovering tests. See our [Python environment variables](https://code.visualstudio.com/docs/python/environments#_environment-variables) docs for more information on environment variables. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@luabud @ntrogh I moved this step to a note since this step is not needed to get it working by default. Please suggest edits as needed!
cc/ @eleanorjboyd
docs/python/testing.md
Outdated
| 1. Create a `.env` file at the root of your project. | ||
| 2. Add `MANAGE_PY_PATH='<path-to-manage.py>'` to the `.env` file, replacing `<path-to-manage.py>` with the path to your application's `manage.py` file. | ||
| > **Tip**: you can copy the path by right clicking on the file in the Explorer view and selecting **Copy Path**. | ||
| 4. Add Django test arguments to `"python.testing.unittestArgs": []` in the `settings.json` [file](/docs/getstarted/settings.md#settingsjson) as needed, and remove any arguments that are not compatible with Django. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| 4. Add Django test arguments to `"python.testing.unittestArgs": []` in the `settings.json` [file](/docs/getstarted/settings.md#settingsjson) as needed, and remove any arguments that are not compatible with Django. | |
| 3. Add Django test arguments to `"python.testing.unittestArgs": []` in the `settings.json` [file](/docs/getstarted/settings.md#settingsjson) as needed, and remove any arguments that are not compatible with Django. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should this step be nested or represented top-level # 3
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It should probably be top-level #3 because it is not part of setting that environment variable.
ntrogh
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Minor formatting updates
|
@cwebster-99 merging this PR to make sure it's included in today's release. |
Updating python/testing.md to include setup and troubleshooting for Django testing.