Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/christherama/django-test-runner
VS Code extension for running Django tests
https://github.com/christherama/django-test-runner
Last synced: 9 days ago
JSON representation
VS Code extension for running Django tests
- Host: GitHub
- URL: https://github.com/christherama/django-test-runner
- Owner: christherama
- Created: 2020-04-20T04:13:03.000Z (over 4 years ago)
- Default Branch: master
- Last Pushed: 2022-12-30T20:17:03.000Z (almost 2 years ago)
- Last Synced: 2023-03-27T12:15:18.362Z (over 1 year ago)
- Language: TypeScript
- Size: 7.96 MB
- Stars: 3
- Watchers: 1
- Forks: 0
- Open Issues: 10
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
Awesome Lists containing this project
README
# django-test-runner
This VS Code extension gives quick access to running Django tests by invoking `python manage.py test` with the VS Code action `Django Test Runner: Run Tests` or a keyboard shortcut. This will run tests in a VS Code terminal. You can optionally display the status of tests by [configuring an XMLRunner test report](#parsing-an-xmlrunner-testreport).
---
# Configuration
## Using pyenv or another virtual environment
If you aren't using your system's default Python interpreter, complete the following:
1. Add your interpreter's path in the setting `djangoTestRunner.pythonInterpreter`
2. Uncheck `python.terminal.activateEnvironment` to skip the `source` step, which slows testing with this extension (though doesn't interfere with testing)## Parsing an XMLRunner Test Report
If you are using [XMLRunner](https://github.com/xmlrunner/unittest-xml-reporting) to generate an XML test report, complete the following:
1. Set `djangoTestRunner.xmlRunnerReportPath` to the report path, which is relative to the workspace root, e.g. `report.xml`
2. If you require additional arguments to be appended to the `python manage.py test` to generate those reports, you can specify those in the setting `djangoTestRunner.testArgs`## Features
Run Django Tests with a VS Code action or keybinding (defaults to CMD+SHIFT+R for MacOS and CTRL+SHIFT+R for Windows):
![run django tests demo](./images/run-tests.gif)**Notes**
- A test file must be open to invoke a Django test run
- Tests to run are determined by the first function or class definition found on or before the cursor position
- If no class or function definition is found, the entire module will be run## Requirements
If you have any requirements or dependencies, add a section describing those and how to install and configure them.
## Extension Settings
This extension contributes the following settings:
- `djangoTestRunner.pythonInterpreter`: Path to Python interpreter if not using system default `python`. For example, `~/.pyenv/versions/sample-env/bin/python`
- `djangoTestRunner.useDefaultShell`: Whether or not to use VS Code's default shell. If false, will use `/bin/sh`.
- `djangoTestRunner.xmlRunnerReportPath`: Path (relative to workspace root) to XML report generated by XMLRunner
- `djangoTestRunner.testArgs`: Arguments to append to `python manage.py test `.## Known Issues
- This extension has been tested only on MacOS.
- Running Django tests will run a non-test function (e.g. `setUp`) if the first function found on or before the cursor position is not a test function, and a class definition isn't found first## Release Notes
### 0.1.0
This release includes only documentation changes:
- Animated feature gif
- Usage notes
- Known issues### 0.0.1
Initial release