Open TheMatrix97 opened 5 years ago
return driver.build_tests(test_dir, loader, intercept=application)
Try intercept=lambda: application
and if that works, I'll try to improve the documentation appropriately. There used to be some magic in the guts of gabbi that tried to work around this, but it was too magic.
If that doesn't work let me know what the traceback is and I should be able to offer an alternative solution.
Whatever ends up working we can add to the docs in some fashion.
Hey! It worked! :) Now I'm facing django problems xD I had to disable the ALLOWED_HOSTS as seems the interceptor puts a kind of random hostname: request: http://123c5eca-8d87-4ab1-8cdd-f9a2198023d5/test I'm only getting 404 errors from all requests, but seems wsgi-interceptor is working like charm!
seems the interceptor puts a kind of random hostname
Yeah, that's the combination of the gabbi and wsgi-intercept. You have to tell wsgi-intercept a host because it keeps a dict of intercept hosts to IOBytes that are doing the interceptinng. gabbi doesn't know or care what the host might be so it makes a uuid which works fine as long as nothing internally is caring about hostnames. If this is a limitation there are probably things we can do to gabbi to allow you to declare an intercepted host. I would think in this instance, though, it is probably easy to tell django you don't care abou that for the duration of the tests.
Any suggestions on how the docs should be improved?
Actually this random hostname beahviour isn't a limitation, I just had to disable the allowed hosts check. I'm not a python expert, but maybe you could remark that the intercept param at build_test function (gabbi) expects a function, and you could provide it using lambda, in order to pass an anonymous one... Also you could mention this random hostname behaviour... Thank you for your work!
Hi! I'm trying to run my gabbits tests using wsgi-interceptor against a django 2.2 application Thats my load_tests function, where I import my django application in order to pass it to the interceptor
This is the contain of django_api/wsgi.py (which comes by default with django)
When I run my gabbits tests using
python -m testtools.run -v test/test_racotest.py
I'm getting the following traceback for each test:Does anyone have any idea of where is the error? Could it be a compatibility error between django wsgi default application and wsgi-intercept? Thank you in advance! :)