Comments (9)
@pkrefta No problem. You can set the verbosity by adding a Green config file (see the bottom of the help; the section starts with CONFIG FILES
.
from green.
Ah, my first run-in with Django. Until now, it has only been a word I have seen tossed around in distant forums and conference talks. :-) Thanks for providing the minimal project and example command to start with, that helps a bunch.
This looks like a good place for research to start
I'll check this out and see how hard this looks to do after I finish issues #14 and #7 that I'm deep into.
If anyone wants to check it out further in the meantime, please do!
from green.
Ok, I got curious so I went and looked at things. It looks like the apparently standard Django manage.py
script just hooks into a command-line processing library inside of Django (decent design, there).
The ./manage.py test
subcommand has a --testrunner=TESTRUNNER
option that expects some type of testrunner class. Apparently there are Django-specific expectations for the test runner, as neither green.runner.GreenTestRunner
nor unittest.runner.TextTestRunner
will work when passed in. I bet this is going to be the best integration point with Django.
I need to find Django's expectations (hopefully nicely documented) for the test runner class they want to use. Assuming the expectations are not too crazy, I could write a green.runner.Django
class that conforms to those expectations.
It may be wise for me to implement #20 before implementing this functionality, otherwise there would be no way to configure green when you're running it through Django.
I envision an implementation where the user would end up doing this to run their Django tests through Green:
./manage.py test --testrunner=green.runner.Django
So I think I know where to go for this one, but I want to resolve some of these other issues before I hit this one. (Pull requests welcome in the meantime!)
If there is some other (better) integration point with Django, someone please speak up and let me know!
from green.
#20 has been implemented. No more blockers that I know of.
from green.
Okay, I have been working on this all morning and I'm afraid I am a bit stumped.
Django won't let you import the test stuff without already being configured in the context of a project. That makes it really, really annoying to develop and test something you want to subclass.
>>> from django.test.runner import DiscoverRunner
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/Library/Python/2.7/site-packages/django/test/__init__.py", line 5, in <module>
from django.test.client import Client, RequestFactory
File "/Library/Python/2.7/site-packages/django/test/client.py", line 11, in <module>
from django.contrib.auth import authenticate, login, logout, get_user_model
File "/Library/Python/2.7/site-packages/django/contrib/auth/__init__.py", line 6, in <module>
from django.middleware.csrf import rotate_token
File "/Library/Python/2.7/site-packages/django/middleware/csrf.py", line 14, in <module>
from django.utils.cache import patch_vary_headers
File "/Library/Python/2.7/site-packages/django/utils/cache.py", line 26, in <module>
from django.core.cache import get_cache
File "/Library/Python/2.7/site-packages/django/core/cache/__init__.py", line 69, in <module>
if DEFAULT_CACHE_ALIAS not in settings.CACHES:
File "/Library/Python/2.7/site-packages/django/conf/__init__.py", line 54, in __getattr__
self._setup(name)
File "/Library/Python/2.7/site-packages/django/conf/__init__.py", line 47, in _setup
% (desc, ENVIRONMENT_VARIABLE))
django.core.exceptions.ImproperlyConfigured: Requested setting CACHES, but settings are not configured. You must either define the environment variable DJANGO_SETTINGS_MODULE or call settings.configure() before accessing settings.
from green.
Not stumped anymore! If the django settings env variable is not present, I use stubbed out config settings. I've got a prototype working already. :)
from green.
Django integration documentation is here, at the moment: https://github.com/CleanCut/green#integration
from green.
More specifically, here's a link to the sub-section directly: https://github.com/CleanCut/green#django
from green.
@CleanCut Thanks for django. I don't want to open another to ask simple question - how can I set verbosity for DjangoRunner ? 😄
from green.
Related Issues (20)
- Python 3.9.6 threading compatibility HOT 14
- django.db.utils.ProgrammingError: relation "users_user" does not exist HOT 3
- Combine methode name and doc string in output HOT 2
- Question: What is a "test" in context of --processes HOT 1
- SyntaxError not catched when named explicte but unittest does HOT 4
- Confusing error when I have errors in source code HOT 4
- Problem with -r (coverage) output HOT 1
- Missing git tag for 3.4.2 release HOT 1
- green might hang on async tests HOT 3
- shutil cleanup sometimes fails on python 3.8 HOT 5
- running green -vvv green.test.test_runner on PyPy + macOS errors out HOT 2
- Feature request: option to debug tests
- Python 3.12 support HOT 4
- Join The Project Team HOT 7
- stopTest issue with Python 3.12.1 and skipped tests HOT 15
- Move Release Process to GitHub Actions HOT 7
- Please add me to the project as a maintainer HOT 2
- Fix lack of coverage in CI HOT 3
- Change default branch on coveralls to "main" HOT 2
- Upload wheels to pypi HOT 4
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from green.