How to import settings and modules while running the bokchoy acceptance test cases.

23 views
Skip to first unread message

Pravin Chavre

unread,
May 9, 2018, 2:17:35 AM5/9/18
to General Open edX discussion
Hi!

I ran the acceptance tests for a particular class. The steps I followed are as follows:

cd /edx/app/edxapp/edx-platform
sudo -H -u edxapp bash
source /edx/app/edxapp/edxapp_env
paver test_bokchoy -t lms/test_account_settings.py:AccountSettingsPageTest

I got the following error:

ImproperlyConfigured: Requested setting AUTH_USER_MODEL, but settings are not configured. You must either define the environment variable DJANGO_SETTINGS_MODULE or call settings.configure() before accessing settings.

How to fix this?

Please let me know in the test environment which settings, packages or modules are imported when the bokchoy acceptance test cases are run/executed and how to import settings, packages or modules for running open edX the test cases successfully.

Jeremy Bowman

unread,
May 9, 2018, 11:40:57 AM5/9/18
to edx-...@googlegroups.com
None of the existing bok-choy tests in edx-platform reference the Django settings, because the tests are running against servers in separate processes with two different sets of settings (one for LMS, one for Studio).  You should be able to work around the need for AUTH_USER_MODEL by using django.contrib.auth.models.User directly, but you generally shouldn't try to work with Django models in bok-choy tests.  You can import some code from the openedx and xmodule packages in the bok-choy tests, but without Django running in the same process it usually isn't very useful.  The vast majority of our test cases rely primarily on the selenium and bok-choy APIs to work with the browser, not the server implementation.

--
You received this message because you are subscribed to the Google Groups "General Open edX discussion" group.
To view this discussion on the web visit https://groups.google.com/d/msgid/edx-code/c34ec7fe-63c9-4eaa-a7ed-ebb69f6ff030%40googlegroups.com.



--
Jeremy Bowman
Principal Software Engineer
edX
141 Portland St.
Cambridge, MA 02139
Reply all
Reply to author
Forward
0 new messages