Re: Speficy a Database for Testing
You can define a custom test runner to do this. For example: https://docs.djangoproject.com/en/dev/topics/testing/#django.test.simple.DjangoTestSuiteRunner.setup_databases On Wed, Feb 8, 2012 at 7:42 AM, xina townerwrote: > Yes, but django makes a new testDatabase and that's my problem, I want > django to use a database I've previously done. -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
Re: Speficy a Database for Testing
I'm not sure that you can specify a different existing database. I think (not certain) that Django's testing is built to have no effect on real data, hence creating a blank test database. You can, however, use fixtures to create data in the test database after it is created and before the unit tests are performed. I assume the reason you want to use a previously, externally created DB is that you want to test based on the data in that DB. If this is the case, it is perfect to use a fixture of that DB's data. Mark On Wed, Feb 8, 2012 at 7:42 AM, xina townerwrote: > Yes, but django makes a new testDatabase and that's my problem, I want > django to use a database I've previously done. > > > On 8 February 2012 16:34, Mark Furbee wrote: > >> Denis Darii already answered this on February 1st: >> >> "You can redefine your database connection by adding somewhere at the >> end of your settings.py something like: >> >> import sys >> >> if 'test' in sys.argv: >> >> DATABASES = ... >> >> hope this helps." >> >> >> Did you try this? >> >> On Wed, Feb 8, 2012 at 7:19 AM, xina towner wrote: >> >>> Can I create a Database manually and then specify to the testing unit to >>> use that? >>> >>> -- >>> Gràcies, >>> >>> Rubén >>> >>> -- >>> You received this message because you are subscribed to the Google >>> Groups "Django users" group. >>> To post to this group, send email to django-users@googlegroups.com. >>> To unsubscribe from this group, send email to >>> django-users+unsubscr...@googlegroups.com. >>> For more options, visit this group at >>> http://groups.google.com/group/django-users?hl=en. >>> >> >> -- >> You received this message because you are subscribed to the Google Groups >> "Django users" group. >> To post to this group, send email to django-users@googlegroups.com. >> To unsubscribe from this group, send email to >> django-users+unsubscr...@googlegroups.com. >> For more options, visit this group at >> http://groups.google.com/group/django-users?hl=en. >> > > > > -- > Gràcies, > > Rubén > > -- > You received this message because you are subscribed to the Google Groups > "Django users" group. > To post to this group, send email to django-users@googlegroups.com. > To unsubscribe from this group, send email to > django-users+unsubscr...@googlegroups.com. > For more options, visit this group at > http://groups.google.com/group/django-users?hl=en. > -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
Re: Speficy a Database for Testing
Yes, but django makes a new testDatabase and that's my problem, I want django to use a database I've previously done. On 8 February 2012 16:34, Mark Furbeewrote: > Denis Darii already answered this on February 1st: > > "You can redefine your database connection by adding somewhere at the end > of your settings.py something like: > > import sys > > if 'test' in sys.argv: > > DATABASES = ... > > hope this helps." > > > Did you try this? > > On Wed, Feb 8, 2012 at 7:19 AM, xina towner wrote: > >> Can I create a Database manually and then specify to the testing unit to >> use that? >> >> -- >> Gràcies, >> >> Rubén >> >> -- >> You received this message because you are subscribed to the Google Groups >> "Django users" group. >> To post to this group, send email to django-users@googlegroups.com. >> To unsubscribe from this group, send email to >> django-users+unsubscr...@googlegroups.com. >> For more options, visit this group at >> http://groups.google.com/group/django-users?hl=en. >> > > -- > You received this message because you are subscribed to the Google Groups > "Django users" group. > To post to this group, send email to django-users@googlegroups.com. > To unsubscribe from this group, send email to > django-users+unsubscr...@googlegroups.com. > For more options, visit this group at > http://groups.google.com/group/django-users?hl=en. > -- Gràcies, Rubén -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
Re: Speficy a Database for Testing
Denis Darii already answered this on February 1st: "You can redefine your database connection by adding somewhere at the end of your settings.py something like: import sys if 'test' in sys.argv: DATABASES = ... hope this helps." Did you try this? On Wed, Feb 8, 2012 at 7:19 AM, xina townerwrote: > Can I create a Database manually and then specify to the testing unit to > use that? > > -- > Gràcies, > > Rubén > > -- > You received this message because you are subscribed to the Google Groups > "Django users" group. > To post to this group, send email to django-users@googlegroups.com. > To unsubscribe from this group, send email to > django-users+unsubscr...@googlegroups.com. > For more options, visit this group at > http://groups.google.com/group/django-users?hl=en. > -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
Speficy a Database for Testing
Can I create a Database manually and then specify to the testing unit to use that? -- Gràcies, Rubén -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.