Can't execute a test corretly in devstack

32 views
Skip to first unread message

Juanan Pereira

unread,
Dec 4, 2016, 3:03:14 PM12/4/16
to edx-...@googlegroups.com
Hi there!

I'm trying to add some tests to my PR
(https://github.com/edx/edx-platform/pull/13441) and I really could
use some help. First, I'm trying to understand how to execute a single
test (and not all the tests available).

In fact, I succeeded executing a single test using this command from
the documentation page:

$ python ./manage.py lms test --verbosity=1
lms/djangoapps/courseware/tests/test_courses.py --settings=test

But it takes 21 minutes to run it! Am I doing something wrong? Do I
need 20 minutes each time I want to check a single test? o_O

On the other hand, if I add the --traceback option to that command
(as seen here: https://github.com/edx/edx-platform/blob/master/docs/en_us/internal/testing.rst
)

$ python ./manage.py lms test --verbosity=1
openedx/core/djangoapps/lang_pref/tests/test_middleware.py --traceback
--settings=test

I get this error:

manage.py: error: no such option: --traceback

Finally, if I execute this test (this is the test that I really want
to modifiy, but first, I want to double-check that the original test
runs flawlessly):

$ python ./manage.py lms test --verbosity=1
openedx/core/djangoapps/lang_pref/tests/test_middleware.py
--settings=test

It fails, but I can't see the reason (the test shows a long series of
DEBUG statements related to django.db.backends.schema, as seen here:
http://pastebin.com/v8y9DgGQ ) and finally a FAILED (errors=1)
message, but I can't see exactly which specific test has failed and
why.

I also tried to redirect the output of the long error message to a file, using

.... 2>&1 >/tmp/errors

but it seems to ignore my capture attempt :-\

Any help will be greatly appreciated.

--
Greetings,

Juanan Pereira

Ben Patterson

unread,
Dec 4, 2016, 4:12:20 PM12/4/16
to edx-...@googlegroups.com
Hi Juanan -

Thanks for helping us make the platform better!

paver wraps the `manage.py test` commands that you've been running, and you may find it will save time to use the various paver targets pointed out in the documentation (included in the url you referenced). I point this out however, because using paver will, by default, disable table buildout/migrations during the test run, and should be much faster. You can also pass in an explicit --disable-migrations switch to the paver command. Either way, for the test you want to run, you can use:

paver test_system -s lms -t openedx/core/djangoapps/lang_pref/tests/test_middleware.py

As for the reason for your failure, I can't give you much info. However, I should point out that some of the test fixtures are more verbose, giving DEBUG output by default, while others are not as verbose. You might want to pass in the --debug flag into that paver command to see if you get more detail. (I have not tried that, myself...but in general you can go in that direction, I think.)

HTH
Ben





--
Greetings,

Juanan Pereira

--
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/CALc7hq9-36hvxyczyz78UtFctNRuAWccWnePp0xwTxrxn22YGQ%40mail.gmail.com.



--
Ben Patterson

edX | Engineering Manager  | b...@edx.org

141 Portland Street, 9th floor

Cambridge, MA 02139

http://www.edx.org

http://www.e-learn.nl/media/blogs/e-learn/edX_Logo_Col_RGB_FINAL.jpg?mtime=1336074566
Reply all
Reply to author
Forward
0 new messages