Re: Running unittests on different databases

2015-12-27 Thread varun naganathan
Thanks a lot.That really helped. -- You received this message because you are subscribed to the Google Groups "Django users" group. To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscr...@googlegroups.com. To post to this group, send email to

Re: Running unittests on different databases

2015-12-25 Thread Mike Dewhirst
On 25/12/2015 7:09 PM, varun naganathan wrote: Hi, I basically want to know how i can run unittests on different databases like Postgres and Mysql.The documnetation says something about writing a custom settings file.However I'm unable to actually understand how actually the settings file

Running unittests on different databases

2015-12-25 Thread varun naganathan
Hi, I basically want to know how i can run unittests on different databases like Postgres and Mysql.The documnetation says something about writing a custom settings file.However I'm unable to actually understand how actually the settings file must look. Could someone perhaps post a sample

Re: KeyError in UnitTests

2011-07-07 Thread Daniel França
Problem solved: nose.tools.set_trace :) 2011/7/8 Daniel França > but my set_trace still freezes =/ If anyone have any idea what could be > that. > > I'm on a Mac OS 10.6 > > > 2011/7/8 Daniel França > >> yeah, thanks a lot, it's not 'BR' but I passed the ID of country and state >> and it worked

Re: KeyError in UnitTests

2011-07-07 Thread Daniel França
but my set_trace still freezes =/ If anyone have any idea what could be that. I'm on a Mac OS 10.6 2011/7/8 Daniel França > yeah, thanks a lot, it's not 'BR' but I passed the ID of country and state > and it worked. =) > > > On Fri, Jul 8, 2011 at 12:15 AM, Shawn Milochik wrote: > >> Could it b

Re: KeyError in UnitTests

2011-07-07 Thread Daniel França
yeah, thanks a lot, it's not 'BR' but I passed the ID of country and state and it worked. =) On Fri, Jul 8, 2011 at 12:15 AM, Shawn Milochik wrote: > Could it be because the test is passing 'Brasil' instead of 'BR'? I'm > assuming 'BR' is a valid choice and 'Brasil' is invalid. That's why you're

Re: KeyError in UnitTests

2011-07-07 Thread Shawn Milochik
Could it be because the test is passing 'Brasil' instead of 'BR'? I'm assuming 'BR' is a valid choice and 'Brasil' is invalid. That's why you're passing 'PR' instead of 'Paraná' in your data dictionary. If the field isn't a required field, then your form.is_valid() would be true, but there wou

Re: KeyError in UnitTests

2011-07-07 Thread Daniel França
Here's the verbosity result of tests running (using nose), the most important part, I guess Creating table cadastroav_country == ERROR: Tests Novo Usuario Cliente --

Re: KeyError in UnitTests

2011-07-07 Thread Daniel França
I was thinking, if country isn't created, so this test should fail, but that's not what happen when I was using nose *country = Country.objects.get(pk=35)* *self.assertEqual( country.name, 'Brasil' )* * * On Thu, Jul 7, 2011 at 11:47 PM, Shawn Milochik wrote: > On 07/07/2011 10:

Re: KeyError in UnitTests

2011-07-07 Thread Shawn Milochik
On 07/07/2011 10:44 PM, Daniel França wrote: I changed the test runner to default and the error message is a lot more clear. I got a DatabaseError: no such table: cadastroav_country but this should be created by tests, right? I'm using South, maybe it's a problem? The problem could be with y

Re: KeyError in UnitTests

2011-07-07 Thread Daniel França
I changed the test runner to default and the error message is a lot more clear. I got a DatabaseError: no such table: cadastroav_country but this should be created by tests, right? I'm using South, maybe it's a problem? 2011/7/7 Daniel França > I did some tests > I put self.cleaned_data['X'] >

Re: KeyError in UnitTests

2011-07-07 Thread Daniel França
I did some tests I put self.cleaned_data['X'] where X I change to all the fields of my form, it in *def clean() *function and it seems only 2 fields aren't available, state and country, I believe that it's not a coincidence that both of them are foreign key(objects). I'm using a sqlite database an

Re: KeyError in UnitTests

2011-07-07 Thread Shawn Milochik
You should be able to use pdb and then examine variables in scope. Aren't you getting a pdb prompt? Are you redirecting your output? You can also using logging and put a bunch of debug statements in to narrow down where the problem lies. If you can make a bare-bones copy of your app that dupl

Re: KeyError in UnitTests

2011-07-07 Thread Daniel França
I already tried to put the code in def clean(), same error, and I did this change you suggested andré, but same error again. as I said using the manual process the validation works fine I don't know how to debug this in unit tests, pdb.set_trace simply freeze my running tests =/ On Thu, Jul 7, 2

Re: KeyError in UnitTests

2011-07-07 Thread Andre Terra
My guess is that the input for the country field in the test is not the same as when a user POSTs the form. This is probably because you're passing a Country instance rather than country.name in your 'values' variable. Furthermore, if country can be blank, you should use if cleaned_data.get('cou

Re: KeyError in UnitTests

2011-07-07 Thread Shawn Milochik
If you want to mess with 'country' then you write a clean_country(self) function. If you want to mess with 'document' you write a clean_document(self) function. If you want to do something with one and be sure the other is also available, you write a clean(self) function, which executes after

KeyError in UnitTests

2011-07-07 Thread Daniel França
Hi, I'm starting to use unit tests in Django, I got stuck in a client test I can't figure out the solution, As I don't have much experience in Django unit tests maybe the error is easy to solve I got this error message executing unit tests apps/usuarios/forms.py", line 95, in clean_document

Re: Django 1.2 unittests: Second time through, things get weird

2010-08-26 Thread Russell Keith-Magee
On Fri, Aug 27, 2010 at 1:43 AM, Elf_Sternberg wrote: > Is anyone seeing this?  I have this function at the top of my > unittest: > > def create_user(name): >    username = name.replace(' ', '').lower() >    return User.objects.create_user(username, username + '@a.com', > 'password') > > And then

Re: Django 1.2 unittests: Second time through, things get weird

2010-08-26 Thread Karen Tracey
On Thu, Aug 26, 2010 at 1:43 PM, Elf_Sternberg wrote: > Is anyone seeing this? I have this function at the top of my > unittest: > > def create_user(name): >username = name.replace(' ', '').lower() >return User.objects.create_user(username, username + '@a.com', > 'password') > > And then

Django 1.2 unittests: Second time through, things get weird

2010-08-26 Thread Elf_Sternberg
Is anyone seeing this? I have this function at the top of my unittest: def create_user(name): username = name.replace(' ', '').lower() return User.objects.create_user(username, username + '@a.com', 'password') And then (this is ultimately the code I derived to examine this behavior): cl

Many to many relation not saved when running unittests

2010-07-22 Thread dfoerster
Hi there, I have a pretty weird problem: I have a model class MyUser derived from djang.contrib.auth.models.User. It doesn't have any additional fields, but a custom manager, with create_user method that puts the created object in the group MyGroup after creating it. When calling MyUser.objects.c

Re: readonly unittests for production site

2010-04-15 Thread Thomas Guettler
Benjamin Reitzammer wrote: > Hi Thomas, > how did you make sure, that the tests are read-only? Did you apply any > special measures/tricks (like using a special DJANGO_SETTINGS_MODULE, > that has read-ony access to the database), or are your tests read-only > by convention and you trust the develop

Re: readonly unittests for production site

2010-04-15 Thread Benjamin Reitzammer
? Cheers Benjamin On Thu, Apr 15, 2010 at 10:10, Thomas Guettler wrote: > Hi, > > I use django since several months and wrote a lot of > readonly unittests that I run on live systems. > > I think Django has only a infrastructure for test > which use a temporary database. &

readonly unittests for production site

2010-04-15 Thread Thomas Guettler
Hi, I use django since several months and wrote a lot of readonly unittests that I run on live systems. I think Django has only a infrastructure for test which use a temporary database. I am happy with my solution, but it would be nice to have the "infrastructure" in django itself.

Re: Error with unittests for django.contrib.auth: ERROR: Error is raised if the provided email address isn't currently registered

2009-10-03 Thread Anderson Santos
Hello, I've run on the same problem and now I see that all my custom templates overrides the default template. I checked that if I rename my custom project/templates/registration folder to something else the test runs ok, but if I rename the template so it doesn't conflicts, it will work fine. Wh

Error with unittests for django.contrib.auth: ERROR: Error is raised if the provided email address isn't currently registered

2009-09-21 Thread tom
Hi, i use django-1.1 with django.contrib.auth and django-registration. When i run the unittests, i become an error. Anybody has an idea? ./manage.py test auth --settings=develsettings /usr/lib/pymodules/python2.6/registration/models.py:4: DeprecationWarning: the sha module is deprecated; use

Re: Django unittests, django.contrib.admin.sites.AlreadyRegistered error

2009-09-07 Thread Karen Tracey
On Mon, Sep 7, 2009 at 6:24 AM, Oleg Oltar wrote: > Hi! > > I am trying to run unitests for one of my application. > > Here is the code of the test (it doesn't do anything yet) > > [snip] > When I run those tests I get an error: > > Installing index for goserver.Game model > . > -

Django unittests, django.contrib.admin.sites.AlreadyRegistered error

2009-09-07 Thread Oleg Oltar
Hi! I am trying to run unitests for one of my application. Here is the code of the test (it doesn't do anything yet) import os import re #import unittest from django.core import management from django.test import TestCase from django.test.client import Client from django.core import mail from d

Re: Unittests

2009-04-17 Thread Alex Gaynor
On Sat, Apr 18, 2009 at 12:31 AM, Russell Keith-Magee < freakboy3...@gmail.com> wrote: > > On Sat, Apr 18, 2009 at 8:06 AM, Daniel Joshua Worth > wrote: > >> No - please don't. The Django docs explicitly state that Django's test > >> framework is based on Python's unittest and doctest frameworks,

Re: Unittests

2009-04-17 Thread Russell Keith-Magee
On Sat, Apr 18, 2009 at 8:06 AM, Daniel Joshua Worth wrote: >> No - please don't. The Django docs explicitly state that Django's test >> framework is based on Python's unittest and doctest frameworks, and >> provides links to the docs for those frameworks. It's not our place to >> including "how

Re: Unittests

2009-04-17 Thread Daniel Joshua Worth
> > No - please don't. The Django docs explicitly state that Django's test > framework is based on Python's unittest and doctest frameworks, and > provides links to the docs for those frameworks. It's not our place to > including "how to use unittest" or "how to use doctest" documentation, > as we

Re: Unittests

2009-04-17 Thread Russell Keith-Magee
On Sat, Apr 18, 2009 at 5:32 AM, Alex Gaynor wrote: > > On Fri, Apr 17, 2009 at 5:28 PM, Daniel Joshua Worth > wrote: >> >> Of course that worked. I would like to put a plug in for adding that the >> tests need to begging with test in the docs. Would have saved me some >> trouble. Thank you guys

Re: Unittests

2009-04-17 Thread Alex Gaynor
On Fri, Apr 17, 2009 at 5:28 PM, Daniel Joshua Worth wrote: > Of course that worked. I would like to put a plug in for adding that the > tests need to begging with test in the docs. Would have saved me some > trouble. Thank you guys so much for your help. > > Daniel Worth > > > > > A cursory revi

Re: Unittests

2009-04-17 Thread Daniel Joshua Worth
Of course that worked. I would like to put a plug in for adding that the tests need to begging with test in the docs. Would have saved me some trouble. Thank you guys so much for your help. Daniel Worth --~--~-~--~~~---~--~~ You received this message because you ar

Re: Unittests

2009-04-17 Thread google torp
Well the docs use camel case for tests, so figured that was the convention in Django. But the there are also some other places where Django doesn't quite follow the rules, like using _ in some of the HTML it generates. Maybe that part of the docs should be cleaned up, I always thought camel cases

Re: Unittests

2009-04-17 Thread Alex Gaynor
On Fri, Apr 17, 2009 at 4:26 PM, google torp wrote: > > Hi. > You have named your test incorectly, so django won't see it as a test. > You need to name testCamelCaseName. Camel cases are probably not > required but that's the convention. Try renaming your test. > > ~Jakob > > On Apr 17, 9:04 pm,

Re: Unittests

2009-04-17 Thread google torp
Hi. You have named your test incorectly, so django won't see it as a test. You need to name testCamelCaseName. Camel cases are probably not required but that's the convention. Try renaming your test. ~Jakob On Apr 17, 9:04 pm, Daniel Joshua Worth wrote: > If I run "./manage.py tests booking" it

Re: Unittests

2009-04-17 Thread Daniel Joshua Worth
If I run "./manage.py tests booking" it returns ok but says it ran 0 tests so I'm obviously not doing something right if it's not running the test at all. I keep reading the docs but it's not coming to me what I messed up. --~--~-~--~~~---~--~~ You received this mes

Re: Unittests

2009-04-16 Thread Daniel Joshua Worth
>>> You should rather not name it "test.py" because there is a standard >>>Python module with that name. The file is named tests.py, plural(I miss typed). I am just trying to follow the docs on unittests. --~--~-~--~~~---~--~~ You receive

Re: Unittests

2009-04-15 Thread Luc Saffre
manage.py test . it returns OK. > If I run manage.py test .. if Fails. > What gives. Am I missing something as far as unittests are concerned? It > should Fail every time or it's not much of a test. Can you send your test.py file to the list? You should rather not name it "test.py&quo

Re: Unittests

2009-04-15 Thread Russell Keith-Magee
; If I run manage.py test . it returns OK. > If I run manage.py test .. if Fails. > What gives. Am I missing something as far as unittests are concerned? It > should Fail every time or it's not much of a test. Without specifics it isn't possible to know the exact problem. Howev

Unittests

2009-04-15 Thread Daniel Joshua Worth
s. Am I missing something as far as unittests are concerned? It should Fail every time or it's not much of a test. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this

Re: Django unittests will not upload non-.txt files

2009-02-12 Thread Robert
Thank you, Karen. That has solved my problem completely. I appreciate the complete explanation as well. Kind regards, Robert --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this gro

Re: Django unittests will not upload non-.txt files

2009-02-12 Thread Karen Tracey
On Thu, Feb 12, 2009 at 1:26 PM, Robert wrote: > > I'm am trying to build an application that handles several types of > uploads. Currently, it will work fine for .txt type files, but for > all other kinds of files, the file is truncated to about 3 KB. > > I have determined that the file gets tr

Django unittests will not upload non-.txt files

2009-02-12 Thread Robert
I'm am trying to build an application that handles several types of uploads. Currently, it will work fine for .txt type files, but for all other kinds of files, the file is truncated to about 3 KB. I have determined that the file gets truncated during the request. I have included some sample co

Re: Confused about unittests and fixtures

2008-11-06 Thread Russell Keith-Magee
On Fri, Nov 7, 2008 at 8:17 AM, Alex Koshelev <[EMAIL PROTECTED]> wrote: > GenericForeignKey and content type application itself look very doubtful for > me. If you have a ForeignKey to the ContentType model then you depends on > order with ContentType objects creates on syncdb. Because ContentTyp

Re: Confused about unittests and fixtures

2008-11-06 Thread Alex Koshelev
GenericForeignKey and content type application itself look very doubtful for me. If you have a ForeignKey to the ContentType model then you depends on order with ContentType objects creates on syncdb. Because ContentType that references to some model can have different primary key any time you flus

Re: Confused about unittests and fixtures

2008-11-06 Thread Russell Keith-Magee
On Fri, Nov 7, 2008 at 1:00 AM, AndyH <[EMAIL PROTECTED]> wrote: > > Hello, > > I have the following simple test which demonstrates the confusing > behaviour I'm seeing: > > class AvailabilityTestCase(django.test.TestCase): >fixtures = FIXTURE_LIST >def setUp(self): >response = sel

Confused about unittests and fixtures

2008-11-06 Thread AndyH
Hello, I have the following simple test which demonstrates the confusing behaviour I'm seeing: class AvailabilityTestCase(django.test.TestCase): fixtures = FIXTURE_LIST def setUp(self): response = self.client.login(username='testuser', password='password') self.assertTrue

Re: admin.site.register breaks unittests

2008-09-28 Thread Malcolm Tredinnick
On Sun, 2008-09-28 at 21:25 +0200, Gerard Petersen wrote: > Russel, > > Replies inline ... > > > The purpose of admin.autodiscover is to discover all the admin.py > > files in your project. Each admin.py file will then need to contain > > the ModelAdmin definitions and site.register() calls req

Re: admin.site.register breaks unittests

2008-09-28 Thread Gerard Petersen
Russel, Replies inline ... > The purpose of admin.autodiscover is to discover all the admin.py > files in your project. Each admin.py file will then need to contain > the ModelAdmin definitions and site.register() calls required. Ok, so the autodiscover is a recursive functionality that gathers

Re: admin.site.register breaks unittests

2008-09-28 Thread Russell Keith-Magee
On Sun, Sep 28, 2008 at 4:39 PM, Gerard Petersen <[EMAIL PROTECTED]> wrote: > > Russell, > > Is it correct to say that the admin.autodiscover statement should register > the models in 'myapp', and therefore I don't need the individual > admin.site.register statement for each model? No - that is

Re: admin.site.register breaks unittests

2008-09-28 Thread Gerard Petersen
Russell, Is it correct to say that the admin.autodiscover statement should register the models in 'myapp', and therefore I don't need the individual admin.site.register statement for each model? Without the register statements I don't see the group of models (for myapp) and myapp itself in th

Re: admin.site.register breaks unittests

2008-09-27 Thread Russell Keith-Magee
On Sat, Sep 27, 2008 at 9:54 PM, Gerard Petersen <[EMAIL PROTECTED]> wrote: > > Russel, > > The example from the docs somehow doesn't work. I've turned on the > autodiscover but under admin it stays empty. I don't know if this is related, > but putting the register statements in urls.py does sto

Re: admin.site.register breaks unittests

2008-09-27 Thread Gerard Petersen
Russel, The example from the docs somehow doesn't work. I've turned on the autodiscover but under admin it stays empty. I don't know if this is related, but putting the register statements in urls.py does stop breaking my tests. Regards, Gerard. Russell Keith-Magee wrote: > On Sat, Sep 27, 2

Re: admin.site.register breaks unittests

2008-09-27 Thread Russell Keith-Magee
On Sat, Sep 27, 2008 at 3:26 AM, Gerard Petersen <[EMAIL PROTECTED]> wrote: > > Hi all, > > When I run my test suite, commands like these 'admin.site.register(Product, > ProductAdmin)' in models.py break my tests with this error: > > django.contrib.admin.sites.AlreadyRegistered: The model Product

admin.site.register breaks unittests

2008-09-26 Thread Gerard Petersen
Hi all, When I run my test suite, commands like these 'admin.site.register(Product, ProductAdmin)' in models.py break my tests with this error: django.contrib.admin.sites.AlreadyRegistered: The model Product is already registered When I (temporarily) remove them the tests run properly. What

Re: application and project coupling in unittests

2007-08-19 Thread Russell Keith-Magee
On 8/20/07, Viraj Alankar <[EMAIL PROTECTED]> wrote: > My question is why does my test in polls need to know anything about > the root url configuration of the project? This seems to couple my > poll-specific unittest to the project and it would be cleaner to not > need to specify the '/polls/' u

application and project coupling in unittests

2007-08-19 Thread Viraj Alankar
Hi, I've just started playing around with Django and have a question on unittesting. The docs mention that tests are looked for in the models.py files of applications and a tests.py file in the application directory. This seems to let me write tests specific to the application. However, when usin

Re: Unittests and coverage

2007-06-27 Thread Michal
> The approach here will be to write your own test runner method. When > you call 'manage.py test', Django is effectively calling a method > called django.test.simple.run_tests(); this method sets up the test > environment, finds the tests, runs the tests, and cleans up the test > environment. Th

Re: Unittests and coverage

2007-06-26 Thread Russell Keith-Magee
On 6/26/07, Michal <[EMAIL PROTECTED]> wrote: > > Hello, > I try to write test together with coverage [1]. This tool could tell me, > which lines of code was or wasn't executed and therefore tell, how my > tests are (or aren't) "superior". > > I put initial code for coverage into setUp, and cleanu

Unittests and coverage

2007-06-25 Thread Michal
Hello, I try to write test together with coverage [1]. This tool could tell me, which lines of code was or wasn't executed and therefore tell, how my tests are (or aren't) "superior". I put initial code for coverage into setUp, and cleanup to tearDown method of Testcase class. Problem is, that

Re: manage.py - "test" not a known action - how do I do unittests?

2006-12-14 Thread Bob
Waylan - I removed the egg and voila! manage.py now knows about "test." Thanks for your help. - Bob --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to djan

Re: manage.py - "test" not a known action - how do I do unittests?

2006-12-14 Thread Waylan Limberg
On 12/14/06, Bob <[EMAIL PROTECTED]> wrote: > > Waylan - > I have revision 4198, so that's okay, and my PYTHONPATH does not have > anything about Django or site-packages in it at all. However, when I > run python and print sys.path, I see: > > ['', 'c:\\Python24\\lib\\site-packages\\setuptools-0.

Re: manage.py - "test" not a known action - how do I do unittests?

2006-12-14 Thread Bob
Waylan - I have revision 4198, so that's okay, and my PYTHONPATH does not have anything about Django or site-packages in it at all. However, when I run python and print sys.path, I see: ['', 'c:\\Python24\\lib\\site-packages\\setuptools-0.6c1-py2.4.egg', 'c:\\Python24\\lib\\site-packages\\django

Re: manage.py - "test" not a known action - how do I do unittests?

2006-12-13 Thread Waylan Limberg
On 12/13/06, Bob <[EMAIL PROTECTED]> wrote: > > Don - > > How do I check the revision? import django; django.__version__ prints > '0.95' but not the revision number. On the command line from within your django_src directory do: svn info That should tell you the revision number among other

Re: manage.py - "test" not a known action - how do I do unittests?

2006-12-13 Thread Bob
ot;. Thanks, Bob On Dec 11, 1:23 pm, Don Arbow <[EMAIL PROTECTED]> wrote: > On Dec 11, 2006, at 7:48 AM, Bob wrote: > > > > >http://www.djangoproject.com/documentation/testing/indicates that > > unittests can be run with > > ./manage.py test > > >

Re: manage.py - "test" not a known action - how do I do unittests?

2006-12-11 Thread Don Arbow
On Dec 11, 2006, at 7:48 AM, Bob wrote: > > http://www.djangoproject.com/documentation/testing/ indicates that > unittests can be run with > ./manage.py test > > However, when I run it, "test" is not known as an action. I get this > output: > --- >

manage.py - "test" not a known action - how do I do unittests?

2006-12-11 Thread Bob
http://www.djangoproject.com/documentation/testing/ indicates that unittests can be run with ./manage.py test However, when I run it, "test" is not known as an action. I get this output: --- $ c:/Python24/Python manage.py test Error: Your action, 'test', was inv