Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

Python Django Basics Test Time View Tests

Testing and DB

Are the steps and courses created in the tests persisted in the DB?

2 Answers

When I run the tests I see the following:

Creating test database for alias 'default'...
.....
----------------------------------------------------------------------
Ran 5 tests in 0.062s

OK
Destroying test database for alias 'default'...

Which I assume means another database is created and then destroyed each time you run the tests, and leaves the database used by the app/project alone.

Kenneth Love
STAFF
Kenneth Love
Treehouse Guest Teacher

In the code challenges or in the course itself?

For the code challenge but also in general. Looks like the test is adding new objects. Are those just in memory? or is it a separate test db? So it's not polluting the production DB for example. I'm probably missing something.

Kenneth Love
Kenneth Love
Treehouse Guest Teacher

Your course db is persistent because your Workspace is.

The database is thrown away at the end of each code challenge, though.