In the past I’ve ran unit test by going to the lms-shell
and executing pytest
. I am now working on a modified openedx devstack and I get error if I try to execute tests.
There are a lot of settings modules and I do not know which one requires modification.
root@studio:/edx/app/edxapp/edx-platform# pytest
Traceback (most recent call last):
File "/edx/app/edxapp/venvs/edxapp/bin/pytest", line 8, in <module>
sys.exit(console_main())
File "/edx/app/edxapp/venvs/edxapp/lib/python3.8/site-packages/_pytest/config/__init__.py", line 187, in console_main
code = main()
File "/edx/app/edxapp/venvs/edxapp/lib/python3.8/site-packages/_pytest/config/__init__.py", line 145, in main
config = _prepareconfig(args, plugins)
File "/edx/app/edxapp/venvs/edxapp/lib/python3.8/site-packages/_pytest/config/__init__.py", line 324, in _prepareconfig
config = pluginmanager.hook.pytest_cmdline_parse(
File "/edx/app/edxapp/venvs/edxapp/lib/python3.8/site-packages/pluggy/_hooks.py", line 265, in __call__
return self._hookexec(self.name, self.get_hookimpls(), kwargs, firstresult)
File "/edx/app/edxapp/venvs/edxapp/lib/python3.8/site-packages/pluggy/_manager.py", line 80, in _hookexec
return self._inner_hookexec(hook_name, methods, kwargs, firstresult)
File "/edx/app/edxapp/venvs/edxapp/lib/python3.8/site-packages/pluggy/_callers.py", line 55, in _multicall
gen.send(outcome)
File "/edx/app/edxapp/venvs/edxapp/lib/python3.8/site-packages/_pytest/helpconfig.py", line 102, in pytest_cmdline_parse
config: Config = outcome.get_result()
File "/edx/app/edxapp/venvs/edxapp/lib/python3.8/site-packages/pluggy/_result.py", line 60, in get_result
raise ex[1].with_traceback(ex[2])
File "/edx/app/edxapp/venvs/edxapp/lib/python3.8/site-packages/pluggy/_callers.py", line 39, in _multicall
res = hook_impl.function(*args)
File "/edx/app/edxapp/venvs/edxapp/lib/python3.8/site-packages/_pytest/config/__init__.py", line 1016, in pytest_cmdline_parse
self.parse(args)
File "/edx/app/edxapp/venvs/edxapp/lib/python3.8/site-packages/_pytest/config/__init__.py", line 1304, in parse
self._preparse(args, addopts=addopts)
File "/edx/app/edxapp/venvs/edxapp/lib/python3.8/site-packages/_pytest/config/__init__.py", line 1206, in _preparse
self.hook.pytest_load_initial_conftests(
File "/edx/app/edxapp/venvs/edxapp/lib/python3.8/site-packages/pluggy/_hooks.py", line 265, in __call__
return self._hookexec(self.name, self.get_hookimpls(), kwargs, firstresult)
File "/edx/app/edxapp/venvs/edxapp/lib/python3.8/site-packages/pluggy/_manager.py", line 80, in _hookexec
return self._inner_hookexec(hook_name, methods, kwargs, firstresult)
File "/edx/app/edxapp/venvs/edxapp/lib/python3.8/site-packages/pluggy/_callers.py", line 60, in _multicall
return outcome.get_result()
File "/edx/app/edxapp/venvs/edxapp/lib/python3.8/site-packages/pluggy/_result.py", line 60, in get_result
raise ex[1].with_traceback(ex[2])
File "/edx/app/edxapp/venvs/edxapp/lib/python3.8/site-packages/pluggy/_callers.py", line 39, in _multicall
res = hook_impl.function(*args)
File "/edx/app/edxapp/venvs/edxapp/lib/python3.8/site-packages/pytest_django/plugin.py", line 353, in pytest_load_initial_conftests
_setup_django()
File "/edx/app/edxapp/venvs/edxapp/lib/python3.8/site-packages/pytest_django/plugin.py", line 236, in _setup_django
django.setup()
File "/edx/app/edxapp/venvs/edxapp/lib/python3.8/site-packages/django/__init__.py", line 24, in setup
apps.populate(settings.INSTALLED_APPS)
File "/edx/app/edxapp/venvs/edxapp/lib/python3.8/site-packages/django/apps/registry.py", line 122, in populate
app_config.ready()
File "/edx/app/edxapp/venvs/edxapp/lib/python3.8/site-packages/django/contrib/admin/apps.py", line 27, in ready
self.module.autodiscover()
File "/edx/app/edxapp/venvs/edxapp/lib/python3.8/site-packages/django/contrib/admin/__init__.py", line 24, in autodiscover
autodiscover_modules('admin', register_to=site)
File "/edx/app/edxapp/venvs/edxapp/lib/python3.8/site-packages/django/utils/module_loading.py", line 47, in autodiscover_modules
import_module('%s.%s' % (app_config.name, module_to_search))
File "/edx/app/edxapp/venvs/edxapp/lib/python3.8/importlib/__init__.py", line 127, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "<frozen importlib._bootstrap>", line 1014, in _gcd_import
File "<frozen importlib._bootstrap>", line 991, in _find_and_load
File "<frozen importlib._bootstrap>", line 975, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 671, in _load_unlocked
File "<frozen importlib._bootstrap_external>", line 848, in exec_module
File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
File "/edx/app/edxapp/edx-platform/openedx/features/toastmasters_features/suggested_learning/admin.py", line 4, in <module>
from openedx.features.toastmasters_features.suggested_learning.forms import (
File "/edx/app/edxapp/edx-platform/openedx/features/toastmasters_features/suggested_learning/forms.py", line 9, in <module>
class LevelSuggestedLearningForm(forms.ModelForm):
File "/edx/app/edxapp/edx-platform/openedx/features/toastmasters_features/suggested_learning/forms.py", line 15, in LevelSuggestedLearningForm
queryset=get_suggested_course_overviews(),
File "/edx/app/edxapp/edx-platform/openedx/features/toastmasters_features/suggested_learning/helpers.py", line 10, in get_suggested_course_overviews
site_conf = get_site_configuration(site_names.LMS)
File "/edx/app/edxapp/edx-platform/openedx/features/toastmasters_features/utils/helpers.py", line 200, in get_site_configuration
site = Site.objects.filter(name=site_name).first()
File "/edx/app/edxapp/venvs/edxapp/lib/python3.8/site-packages/django/db/models/query.py", line 674, in first
for obj in (self if self.ordered else self.order_by('pk'))[:1]:
File "/edx/app/edxapp/venvs/edxapp/lib/python3.8/site-packages/django/db/models/query.py", line 280, in __iter__
self._fetch_all()
File "/edx/app/edxapp/venvs/edxapp/lib/python3.8/site-packages/django/db/models/query.py", line 1324, in _fetch_all
self._result_cache = list(self._iterable_class(self))
File "/edx/app/edxapp/venvs/edxapp/lib/python3.8/site-packages/django/db/models/query.py", line 51, in __iter__
results = compiler.execute_sql(chunked_fetch=self.chunked_fetch, chunk_size=self.chunk_size)
File "/edx/app/edxapp/venvs/edxapp/lib/python3.8/site-packages/django/db/models/sql/compiler.py", line 1173, in execute_sql
cursor = self.connection.cursor()
File "/edx/app/edxapp/venvs/edxapp/lib/python3.8/site-packages/django/utils/asyncio.py", line 33, in inner
return func(*args, **kwargs)
File "/edx/app/edxapp/venvs/edxapp/lib/python3.8/site-packages/django/db/backends/base/base.py", line 259, in cursor
return self._cursor()
File "/edx/app/edxapp/venvs/edxapp/lib/python3.8/site-packages/django/db/backends/base/base.py", line 235, in _cursor
self.ensure_connection()
File "/edx/app/edxapp/venvs/edxapp/lib/python3.8/site-packages/django/utils/asyncio.py", line 33, in inner
return func(*args, **kwargs)
File "/edx/app/edxapp/venvs/edxapp/lib/python3.8/site-packages/django/db/backends/base/base.py", line 219, in ensure_connection
self.connect()
File "/edx/app/edxapp/venvs/edxapp/lib/python3.8/site-packages/django/utils/asyncio.py", line 33, in inner
return func(*args, **kwargs)
File "/edx/app/edxapp/venvs/edxapp/lib/python3.8/site-packages/django/db/backends/base/base.py", line 199, in connect
conn_params = self.get_connection_params()
File "/edx/app/edxapp/venvs/edxapp/lib/python3.8/site-packages/django/db/backends/sqlite3/base.py", line 180, in get_connection_params
raise ImproperlyConfigured(
django.core.exceptions.ImproperlyConfigured: settings.DATABASES is improperly configured. Please supply the NAME value.