Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/lime-green/django-spring
Django app preloader for quick testing!
https://github.com/lime-green/django-spring
django python testing
Last synced: about 1 month ago
JSON representation
Django app preloader for quick testing!
- Host: GitHub
- URL: https://github.com/lime-green/django-spring
- Owner: lime-green
- License: mit
- Created: 2019-11-12T05:17:04.000Z (about 5 years ago)
- Default Branch: master
- Last Pushed: 2020-06-16T19:23:48.000Z (over 4 years ago)
- Last Synced: 2024-11-28T21:44:10.995Z (about 2 months ago)
- Topics: django, python, testing
- Language: Python
- Homepage: https://pypi.org/project/django-spring/
- Size: 59.6 KB
- Stars: 15
- Watchers: 2
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Django Spring
### Installing
```bash
pip install django-spring --upgrade
```### Usage
```bash
# First start the server:
spring start# Then run a manage.py command (eg. test)
spring test --keepdb# Optionally, specify a settings module:
DJANGO_SETTINGS_MODULE="base.settings" spring test --keepdb
```### Comparison
For a large project I tested against, it reduced the test time from 27.8s to 14.5s! Most of the time savings are from app startup, so the largest difference will be felt for running small test suites for large projects.#### manage.py
```
# time ./manage.py test --keepdb billing_service/tests/test_user.py
..........
----------------------------------------------------------------------
Ran 10 tests in 5.090sOK
Preserving test database for alias 'default'...real 0m27.773s
user 0m9.490s
sys 0m2.510s
```#### spring
```
# time spring test --keepdb billing_service/tests/test_user.py
[APP] running command `test --keepdb billing_service/tests/test_user.py`
..........
----------------------------------------------------------------------
Ran 10 tests in 4.714sOK
Preserving test database for alias 'default'...real 0m14.457s
user 0m0.180s
sys 0m0.100s
```### Tweakable env vars
`DJANGO_SETTINGS_MODULE`: The path to your settings module (eg. `base.settings`)
`CODE_RELOADER_POLL_PERIOD`: The number of seconds to wait between polling.
Setting this higher will improve performance when using the stat reloader.`LOG_LEVEL`: (DEBUG, INFO, WARN, ERROR, CRITICAL)