This project uses gulp, babel,
browserify, and scss for
npm install from the root of the repository. You can then run
gulp to rebuild the static files, or
gulp watch when actively editing
these files to detect changes and rebuild automatically.
django-nested-admin has fairly extensive test coverage.
The best way to run the tests is with tox,
which runs the tests against all supported Django installs. To run the tests
within a virtualenv run
python runtests.py from the repository directory.
The tests require a selenium webdriver to be installed. By default the tests
run with phantomjs, but it is also possible to run the tests with the chrome
webdriver by passing
--selenium=chrome to runtests.py or, if running with tox,
tox -- --selenium=chrome. See
runtests.py --help for a complete
list of the options available.
Pull requests are automatically run through Travis CI upon submission to verify that the changes do not introduce regressions.
The tests for this project are patterned off of the system that the Django project itself uses for tests (including the changes that are being made in 1.10), so Django’s guide on writing unit tests is a good place to start.
Selenium tests are difficult to write, particularly for complicated user
interactions such as drag-and-drop. To assist in writing tests for the
functionality of nested inlines, a base TestCase with methods for
executing the possible user interactions with inlines (e.g.
adding inlines, removing inlines, setting field values, drag-and-drop re-ordering)
is provided with
Depending on what you are trying to test, it might make sense to add the test to one of the existing “test apps” in django-nested-admin. These include:
prepopulated_fieldsor ManyToManyFields with
- Tests for
- Tests for
nested_admin.NestedTabularInlinewhere there is only one “nested” inline (using two levels of inlines, hence “two deep”).
- Tests the same things as
two_deep, except with inlines nested “three deep.”
If your test requires the creation of new test models, then it may make sense
to write a new test app. Create a new subdirectory under
test runner will automatically add this to the list of
and execute the tests defined in
tests.py. The tests in
are the most complete, and can serve as a reference for how to use the
helper methods for simulating user interactions.