1. `tests` and `--tb=short` is not necessary, since it is in
`pytest.addopts` already.
2. removes `-s` (shortcut for --capture=no): it is typically a good idea
to not display output from successful tests.
Currently you cannot import something from rest_framework without
configuring Django, since accessing `settings.INSTALLED_APPS` for the
django-guardian throws an ImproperlyConfigured error:
from rest_framework.exceptions import ErrorDetail
~/Vcs/django-rest-framework/rest_framework/exceptions.py in <module>()
16
17 from rest_framework import status
---> 18 from rest_framework.compat import unicode_to_repr
19 from rest_framework.utils.serializer_helpers import ReturnDict, ReturnList
20
~/Vcs/django-rest-framework/rest_framework/compat.py in <module>()
144 guardian = None
145 try:
--> 146 if 'guardian' in settings.INSTALLED_APPS:
147 import guardian # noqa
148 except ImportError:
~/Vcs/django-rest-framework/.venv/lib/python3.6/site-packages/django/conf/__init__.py in __getattr__(self, name)
54 """Return the value of a setting and cache it in self.__dict__."""
55 if self._wrapped is empty:
---> 56 self._setup(name)
57 val = getattr(self._wrapped, name)
58 self.__dict__[name] = val
~/Vcs/django-rest-framework/.venv/lib/python3.6/site-packages/django/conf/__init__.py in _setup(self, name)
39 "You must either define the environment variable %s "
40 "or call settings.configure() before accessing settings."
---> 41 % (desc, ENVIRONMENT_VARIABLE))
42
43 self._wrapped = Settings(settings_module)
ImproperlyConfigured: Requested setting INSTALLED_APPS, but settings are not configured. You must either define the environment variable DJANGO_SETTINGS_MODULE or call settings.configure() before accessing settings.
I've thought about just trying to import it always, but that is some
overhead for something optional, and would also regress #1712 - except
for when handling the `ImproperlyConfigured` from there.
Since it only gets used by a single class this patch moves the code
there.
* Update the http signature auth library ref link
It seems that the djangorestframework-httpsignature package is outdated
and there is updated fork named drf-httpsig.
* Fixing the link ref format in the http signature section
It is useful to see if tests itself are covered after all - missing
coverage there typically indicates dead/missed code paths.
This also uses `source=.` and includes (with run and report), to help
Codecov with reporting.
Ref: https://github.com/encode/django-rest-framework/pull/5956
With 2.7.3 I am seeing an ImportError on Arch Linux:
> ImportError: …/.venv/lib/python3.6/site-packages/psycopg2/.libs/libresolv-2-c4c53def.5.so:
> symbol __res_maybe_init version GLIBC_PRIVATE not defined in file libc.so.6 with link time reference