I'm packaging your module as an rpm package so I'm using the typical PEP517 based build, install and test cycle used on building packages from non-root account.
python3 -sBm build -w --no-isolation
because I'm calling build with --no-isolation I'm using during all processes only locally installed modules
install .whl file in </install/prefix> using 'installer` module
run pytest with $PYTHONPATH pointing to sitearch and sitelib inside </install/prefix>
build is performed in env which is cut off from access to the public network (pytest is executed with -m "not network")
Here is pytest output:
```console
+ PYTHONPATH=/home/tkloczko/rpmbuild/BUILDROOT/python-authlib-1.3.0-2.fc35.x86_64/usr/lib64/python3.8/site-packages:/home/tkloczko/rpmbuild/BUILDROOT/python-authlib-1.3.0-2.fc35.x86_64/usr/lib/python3.8/site-packages
+ /usr/bin/pytest -ra -m 'not network'
==================================================================================== test session starts ====================================================================================
platform linux -- Python 3.8.18, pytest-7.4.4, pluggy-1.3.0
rootdir: /home/tkloczko/rpmbuild/BUILD/authlib-1.3.0
configfile: tox.ini
plugins: anyio-4.2.0, asyncio-0.23.3
asyncio: mode=auto
collected 617 items / 10 errors
========================================================================================== ERRORS ===========================================================================================
________________________________________________________________ ERROR collecting tests/django/test_oauth1/test_authorize.py ________________________________________________________________
tests/django/test_oauth1/test_authorize.py:4: in
from .models import User, Client
tests/django/test_oauth1/models.py:3: in
from django.contrib.auth.models import User
/usr/lib/python3.8/site-packages/django/contrib/auth/models.py:3: in
from django.contrib.auth.base_user import AbstractBaseUser, BaseUserManager
/usr/lib/python3.8/site-packages/django/contrib/auth/base_user.py:57: in
class AbstractBaseUser(models.Model):
/usr/lib/python3.8/site-packages/django/db/models/base.py:129: in __new__
app_config = apps.get_containing_app_config(module)
/usr/lib/python3.8/site-packages/django/apps/registry.py:260: in get_containing_app_config
self.check_apps_ready()
/usr/lib/python3.8/site-packages/django/apps/registry.py:137: in check_apps_ready
settings.INSTALLED_APPS
/usr/lib/python3.8/site-packages/django/conf/__init__.py:102: in __getattr__
self._setup(name)
/usr/lib/python3.8/site-packages/django/conf/__init__.py:82: in _setup
raise ImproperlyConfigured(
E django.core.exceptions.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.
___________________________________________________________ ERROR collecting tests/django/test_oauth1/test_resource_protector.py ____________________________________________________________
tests/django/test_oauth1/test_resource_protector.py:10: in
from .models import User, Client, TokenCredential
tests/django/test_oauth1/models.py:3: in
from django.contrib.auth.models import User
/usr/lib/python3.8/site-packages/django/contrib/auth/models.py:3: in
from django.contrib.auth.base_user import AbstractBaseUser, BaseUserManager
/usr/lib/python3.8/site-packages/django/contrib/auth/base_user.py:57: in
class AbstractBaseUser(models.Model):
/usr/lib/python3.8/site-packages/django/db/models/base.py:129: in __new__
app_config = apps.get_containing_app_config(module)
/usr/lib/python3.8/site-packages/django/apps/registry.py:260: in get_containing_app_config
self.check_apps_ready()
/usr/lib/python3.8/site-packages/django/apps/registry.py:137: in check_apps_ready
settings.INSTALLED_APPS
/usr/lib/python3.8/site-packages/django/conf/__init__.py:102: in __getattr__
self._setup(name)
/usr/lib/python3.8/site-packages/django/conf/__init__.py:82: in _setup
raise ImproperlyConfigured(
E django.core.exceptions.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.
____________________________________________________________ ERROR collecting tests/django/test_oauth1/test_token_credentials.py ____________________________________________________________
tests/django/test_oauth1/test_token_credentials.py:6: in
from .models import User, Client
tests/django/test_oauth1/models.py:3: in
from django.contrib.auth.models import User
/usr/lib/python3.8/site-packages/django/contrib/auth/models.py:3: in
from django.contrib.auth.base_user import AbstractBaseUser, BaseUserManager
/usr/lib/python3.8/site-packages/django/contrib/auth/base_user.py:57: in
class AbstractBaseUser(models.Model):
/usr/lib/python3.8/site-packages/django/db/models/base.py:129: in __new__
app_config = apps.get_containing_app_config(module)
/usr/lib/python3.8/site-packages/django/apps/registry.py:260: in get_containing_app_config
self.check_apps_ready()
/usr/lib/python3.8/site-packages/django/apps/registry.py:137: in check_apps_ready
settings.INSTALLED_APPS
/usr/lib/python3.8/site-packages/django/conf/__init__.py:102: in __getattr__
self._setup(name)
/usr/lib/python3.8/site-packages/django/conf/__init__.py:82: in _setup
raise ImproperlyConfigured(
E django.core.exceptions.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.
________________________________________________________ ERROR collecting tests/django/test_oauth2/test_authorization_code_grant.py _________________________________________________________
tests/django/test_oauth2/test_authorization_code_grant.py:5: in
from .models import User, Client, OAuth2Code
tests/django/test_oauth2/models.py:10: in
from django.contrib.auth.models import User
/usr/lib/python3.8/site-packages/django/contrib/auth/models.py:3: in
from django.contrib.auth.base_user import AbstractBaseUser, BaseUserManager
/usr/lib/python3.8/site-packages/django/contrib/auth/base_user.py:57: in
class AbstractBaseUser(models.Model):
/usr/lib/python3.8/site-packages/django/db/models/base.py:129: in __new__
app_config = apps.get_containing_app_config(module)
/usr/lib/python3.8/site-packages/django/apps/registry.py:260: in get_containing_app_config
self.check_apps_ready()
/usr/lib/python3.8/site-packages/django/apps/registry.py:137: in check_apps_ready
settings.INSTALLED_APPS
/usr/lib/python3.8/site-packages/django/conf/__init__.py:102: in __getattr__
self._setup(name)
/usr/lib/python3.8/site-packages/django/conf/__init__.py:82: in _setup
raise ImproperlyConfigured(
E django.core.exceptions.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.
________________________________________________________ ERROR collecting tests/django/test_oauth2/test_client_credentials_grant.py _________________________________________________________
tests/django/test_oauth2/test_client_credentials_grant.py:3: in
from .oauth2_server import TestCase
tests/django/test_oauth2/oauth2_server.py:6: in
from .models import Client, OAuth2Token
tests/django/test_oauth2/models.py:10: in
from django.contrib.auth.models import User
/usr/lib/python3.8/site-packages/django/contrib/auth/models.py:3: in
from django.contrib.auth.base_user import AbstractBaseUser, BaseUserManager
/usr/lib/python3.8/site-packages/django/contrib/auth/base_user.py:57: in
class AbstractBaseUser(models.Model):
/usr/lib/python3.8/site-packages/django/db/models/base.py:129: in __new__
app_config = apps.get_containing_app_config(module)
/usr/lib/python3.8/site-packages/django/apps/registry.py:260: in get_containing_app_config
self.check_apps_ready()
/usr/lib/python3.8/site-packages/django/apps/registry.py:137: in check_apps_ready
settings.INSTALLED_APPS
/usr/lib/python3.8/site-packages/django/conf/__init__.py:102: in __getattr__
self._setup(name)
/usr/lib/python3.8/site-packages/django/conf/__init__.py:82: in _setup
raise ImproperlyConfigured(
E django.core.exceptions.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.
_____________________________________________________________ ERROR collecting tests/django/test_oauth2/test_implicit_grant.py ______________________________________________________________
tests/django/test_oauth2/test_implicit_grant.py:3: in
from .oauth2_server import TestCase
tests/django/test_oauth2/oauth2_server.py:6: in
from .models import Client, OAuth2Token
tests/django/test_oauth2/models.py:10: in
from django.contrib.auth.models import User
/usr/lib/python3.8/site-packages/django/contrib/auth/models.py:3: in
from django.contrib.auth.base_user import AbstractBaseUser, BaseUserManager
/usr/lib/python3.8/site-packages/django/contrib/auth/base_user.py:57: in
class AbstractBaseUser(models.Model):
/usr/lib/python3.8/site-packages/django/db/models/base.py:129: in __new__
app_config = apps.get_containing_app_config(module)
/usr/lib/python3.8/site-packages/django/apps/registry.py:260: in get_containing_app_config
self.check_apps_ready()
/usr/lib/python3.8/site-packages/django/apps/registry.py:137: in check_apps_ready
settings.INSTALLED_APPS
/usr/lib/python3.8/site-packages/django/conf/__init__.py:102: in __getattr__
self._setup(name)
/usr/lib/python3.8/site-packages/django/conf/__init__.py:82: in _setup
raise ImproperlyConfigured(
E django.core.exceptions.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.
_____________________________________________________________ ERROR collecting tests/django/test_oauth2/test_password_grant.py ______________________________________________________________
tests/django/test_oauth2/test_password_grant.py:6: in
from .oauth2_server import TestCase
tests/django/test_oauth2/oauth2_server.py:6: in
from .models import Client, OAuth2Token
tests/django/test_oauth2/models.py:10: in
from django.contrib.auth.models import User
/usr/lib/python3.8/site-packages/django/contrib/auth/models.py:3: in
from django.contrib.auth.base_user import AbstractBaseUser, BaseUserManager
/usr/lib/python3.8/site-packages/django/contrib/auth/base_user.py:57: in
class AbstractBaseUser(models.Model):
/usr/lib/python3.8/site-packages/django/db/models/base.py:129: in __new__
app_config = apps.get_containing_app_config(module)
/usr/lib/python3.8/site-packages/django/apps/registry.py:260: in get_containing_app_config
self.check_apps_ready()
/usr/lib/python3.8/site-packages/django/apps/registry.py:137: in check_apps_ready
settings.INSTALLED_APPS
/usr/lib/python3.8/site-packages/django/conf/__init__.py:102: in __getattr__
self._setup(name)
/usr/lib/python3.8/site-packages/django/conf/__init__.py:82: in _setup
raise ImproperlyConfigured(
E django.core.exceptions.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.
______________________________________________________________ ERROR collecting tests/django/test_oauth2/test_refresh_token.py ______________________________________________________________
tests/django/test_oauth2/test_refresh_token.py:6: in
from .models import User, Client, OAuth2Token
tests/django/test_oauth2/models.py:10: in
from django.contrib.auth.models import User
/usr/lib/python3.8/site-packages/django/contrib/auth/models.py:3: in
from django.contrib.auth.base_user import AbstractBaseUser, BaseUserManager
/usr/lib/python3.8/site-packages/django/contrib/auth/base_user.py:57: in
class AbstractBaseUser(models.Model):
/usr/lib/python3.8/site-packages/django/db/models/base.py:129: in __new__
app_config = apps.get_containing_app_config(module)
/usr/lib/python3.8/site-packages/django/apps/registry.py:260: in get_containing_app_config
self.check_apps_ready()
/usr/lib/python3.8/site-packages/django/apps/registry.py:137: in check_apps_ready
settings.INSTALLED_APPS
/usr/lib/python3.8/site-packages/django/conf/__init__.py:102: in __getattr__
self._setup(name)
/usr/lib/python3.8/site-packages/django/conf/__init__.py:82: in _setup
raise ImproperlyConfigured(
E django.core.exceptions.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.
___________________________________________________________ ERROR collecting tests/django/test_oauth2/test_resource_protector.py ____________________________________________________________
tests/django/test_oauth2/test_resource_protector.py:4: in
from .models import User, Client, OAuth2Token
tests/django/test_oauth2/models.py:10: in
from django.contrib.auth.models import User
/usr/lib/python3.8/site-packages/django/contrib/auth/models.py:3: in
from django.contrib.auth.base_user import AbstractBaseUser, BaseUserManager
/usr/lib/python3.8/site-packages/django/contrib/auth/base_user.py:57: in
class AbstractBaseUser(models.Model):
/usr/lib/python3.8/site-packages/django/db/models/base.py:129: in __new__
app_config = apps.get_containing_app_config(module)
/usr/lib/python3.8/site-packages/django/apps/registry.py:260: in get_containing_app_config
self.check_apps_ready()
/usr/lib/python3.8/site-packages/django/apps/registry.py:137: in check_apps_ready
settings.INSTALLED_APPS
/usr/lib/python3.8/site-packages/django/conf/__init__.py:102: in __getattr__
self._setup(name)
/usr/lib/python3.8/site-packages/django/conf/__init__.py:82: in _setup
raise ImproperlyConfigured(
E django.core.exceptions.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.
___________________________________________________________ ERROR collecting tests/django/test_oauth2/test_revocation_endpoint.py ___________________________________________________________
tests/django/test_oauth2/test_revocation_endpoint.py:3: in
from .oauth2_server import TestCase
tests/django/test_oauth2/oauth2_server.py:6: in
from .models import Client, OAuth2Token
tests/django/test_oauth2/models.py:10: in
from django.contrib.auth.models import User
/usr/lib/python3.8/site-packages/django/contrib/auth/models.py:3: in
from django.contrib.auth.base_user import AbstractBaseUser, BaseUserManager
/usr/lib/python3.8/site-packages/django/contrib/auth/base_user.py:57: in
class AbstractBaseUser(models.Model):
/usr/lib/python3.8/site-packages/django/db/models/base.py:129: in __new__
app_config = apps.get_containing_app_config(module)
/usr/lib/python3.8/site-packages/django/apps/registry.py:260: in get_containing_app_config
self.check_apps_ready()
/usr/lib/python3.8/site-packages/django/apps/registry.py:137: in check_apps_ready
settings.INSTALLED_APPS
/usr/lib/python3.8/site-packages/django/conf/__init__.py:102: in __getattr__
self._setup(name)
/usr/lib/python3.8/site-packages/django/conf/__init__.py:82: in _setup
raise ImproperlyConfigured(
E django.core.exceptions.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.
================================================================================== short test summary info ==================================================================================
ERROR tests/django/test_oauth1/test_authorize.py - django.core.exceptions.ImproperlyConfigured: Requested setting INSTALLED_APPS, but settings are not configured. You must either define the environment variable DJANGO_SETTINGS_MODULE o...
ERROR tests/django/test_oauth1/test_resource_protector.py - django.core.exceptions.ImproperlyConfigured: Requested setting INSTALLED_APPS, but settings are not configured. You must either define the environment variable DJANGO_SETTINGS_MODULE o...
ERROR tests/django/test_oauth1/test_token_credentials.py - django.core.exceptions.ImproperlyConfigured: Requested setting INSTALLED_APPS, but settings are not configured. You must either define the environment variable DJANGO_SETTINGS_MODULE o...
ERROR tests/django/test_oauth2/test_authorization_code_grant.py - django.core.exceptions.ImproperlyConfigured: Requested setting INSTALLED_APPS, but settings are not configured. You must either define the environment variable DJANGO_SETTINGS_MODULE o...
ERROR tests/django/test_oauth2/test_client_credentials_grant.py - django.core.exceptions.ImproperlyConfigured: Requested setting INSTALLED_APPS, but settings are not configured. You must either define the environment variable DJANGO_SETTINGS_MODULE o...
ERROR tests/django/test_oauth2/test_implicit_grant.py - django.core.exceptions.ImproperlyConfigured: Requested setting INSTALLED_APPS, but settings are not configured. You must either define the environment variable DJANGO_SETTINGS_MODULE o...
ERROR tests/django/test_oauth2/test_password_grant.py - django.core.exceptions.ImproperlyConfigured: Requested setting INSTALLED_APPS, but settings are not configured. You must either define the environment variable DJANGO_SETTINGS_MODULE o...
ERROR tests/django/test_oauth2/test_refresh_token.py - django.core.exceptions.ImproperlyConfigured: Requested setting INSTALLED_APPS, but settings are not configured. You must either define the environment variable DJANGO_SETTINGS_MODULE o...
ERROR tests/django/test_oauth2/test_resource_protector.py - django.core.exceptions.ImproperlyConfigured: Requested setting INSTALLED_APPS, but settings are not configured. You must either define the environment variable DJANGO_SETTINGS_MODULE o...
ERROR tests/django/test_oauth2/test_revocation_endpoint.py - django.core.exceptions.ImproperlyConfigured: Requested setting INSTALLED_APPS, but settings are not configured. You must either define the environment variable DJANGO_SETTINGS_MODULE o...
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! Interrupted: 10 errors during collection !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
==================================================================================== 10 errors in 2.47s =====================================================================================
```
I'm packaging your module as an rpm package so I'm using the typical PEP517 based build, install and test cycle used on building packages from non-root account.
python3 -sBm build -w --no-isolation
build
with--no-isolation
I'm using during all processes only locally installed modulescut off from access to the public network
(pytest is executed with-m "not network"
)Here is pytest output:
```console + PYTHONPATH=/home/tkloczko/rpmbuild/BUILDROOT/python-authlib-1.3.0-2.fc35.x86_64/usr/lib64/python3.8/site-packages:/home/tkloczko/rpmbuild/BUILDROOT/python-authlib-1.3.0-2.fc35.x86_64/usr/lib/python3.8/site-packages + /usr/bin/pytest -ra -m 'not network' ==================================================================================== test session starts ==================================================================================== platform linux -- Python 3.8.18, pytest-7.4.4, pluggy-1.3.0 rootdir: /home/tkloczko/rpmbuild/BUILD/authlib-1.3.0 configfile: tox.ini plugins: anyio-4.2.0, asyncio-0.23.3 asyncio: mode=auto collected 617 items / 10 errors ========================================================================================== ERRORS =========================================================================================== ________________________________________________________________ ERROR collecting tests/django/test_oauth1/test_authorize.py ________________________________________________________________ tests/django/test_oauth1/test_authorize.py:4: inQ: what should I pass in env variables? 🤔
List of installed modules in build env:
```console Package Version ----------------------------- --------- alabaster 0.7.16 anyio 4.2.0 asgiref 3.7.2 Babel 2.14.0 backports.zoneinfo 0.2.1 blinker 1.6.2 build 1.0.3 cachelib 0.10.2 certifi 2023.7.22 cffi 1.16.0 charset-normalizer 3.3.2 click 8.1.7 cppclean 0.13 cryptography 41.0.5 distro 1.8.0 Django 4.2.6 dnf 4.18.2 docutils 0.20.1 exceptiongroup 1.1.3 Flask 3.0.0 Flask-SQLAlchemy 3.0.5 gpg 1.23.2 greenlet 3.0.3 h11 0.14.0 httpcore 1.0.0 httpx 0.25.2 idna 3.6 imagesize 1.4.1 importlib-metadata 7.0.1 iniconfig 2.0.0 installer 0.7.0 itsdangerous 2.1.2 Jinja2 3.1.2 libdnf 0.72.0 MarkupSafe 2.1.3 packaging 23.2 pluggy 1.3.0 ply 3.11 pycparser 2.21 Pygments 2.17.2 pyproject_hooks 1.0.0 pytest 7.4.4 pytest-asyncio 0.23.3 python-dateutil 2.8.2 pytz 2023.3 requests 2.31.0 setuptools 69.0.3 six 1.16.0 sniffio 1.3.0 snowballstemmer 2.2.0 Sphinx 7.1.2 sphinx-copybutton 0.5.2 sphinx_design 0.5.0 sphinxcontrib-applehelp 1.0.4 sphinxcontrib-devhelp 1.0.5 sphinxcontrib-htmlhelp 2.0.4 sphinxcontrib-jsmath 1.0.1 sphinxcontrib-qthelp 1.0.3 sphinxcontrib-serializinghtml 1.1.9 SQLAlchemy 2.0.25 sqlparse 0.4.4 starlette 0.34.0 tomli 2.0.1 typing_extensions 4.9.0 urllib3 1.26.18 Werkzeug 3.0.1 wheel 0.42.0 zipp 3.17.0 ```Please let me know if you need more details or want me to perform some diagnostics.