Re: Speeding up test database creation

2012-11-27 Thread John Maxwell
Hm, I tried commenting out the line 'NAME': '/home/john/database.sqlite', and it still seems to be just as slow, if not slower... On Monday, November 26, 2012 5:56:30 AM UTC-8, Andres Reyes Monge wrote: > > The tutorial uses a sqlite file database not a in memory database, try > omitting the

Speeding up test database creation

2012-11-26 Thread Andres Reyes Monge
The tutorial uses a sqlite file database not a in memory database, try omitting the name parameter and it should speed things up -- You received this message because you are subscribed to the Google Groups "Django users" group. To view this discussion on the web visit

Speeding up test database creation

2012-11-26 Thread John Maxwell
Hi all, I've been doing the test-driven Django tutorial at http://www.tdd-django-tutorial.com/ I'm partway through the tutorial, and when I run the command "python manage.py test fts", the message "Creating test database for alias 'default'..." gets shown for 4-5 seconds

Re: selenium test for fallback page loaded from app cache when server is unavailable

2012-11-03 Thread Brad Pitcher
Are you having the selenium test go to online.html first like in your manual test? Maybe you need to have selenium hit offline.html first and cache that page? On Nov 3, 2012 6:14 AM, "Joao Coelho" <redcoelh...@gmail.com> wrote: > Hi. I haven't been able to figure this one o

selenium test for fallback page loaded from app cache when server is unavailable

2012-11-03 Thread Joao Coelho
Hi. I haven't been able to figure this one out. Trying to write an automated test that uses selenium.webdriver.firefox.webdriver The manifest file has FALLBACK: /online.html /offline.html So that at /online.html the browser displays the cached copy of /offline.html when the server is offline

Re: Problems with simple "hello world" test - "ImportError: Could not import settings"

2012-09-19 Thread Stephen Anto
Hi, There are only 7 steps ahead to say 'Hello World' via Django project. Visit http://www.f2finterview.com/web/Django/17/ its tells how to make simple django project with seven steps. Thank you for visiting On Thu, Sep 13, 2012 at 2:55 PM, DJ-Tom

Re: Problems with simple "hello world" test - "ImportError: Could not import settings"

2012-09-19 Thread DJ-Tom
I have now found extensive documentation as to why and how Apache has to be configured with Django and mod_wsgi here http://code.google.com/p/modwsgi/wiki/IntegrationWithDjango -- You received this message because you are subscribed to the Google Groups "Django users" group. To view this

Re: Problems with simple "hello world" test - "ImportError: Could not import settings"

2012-09-13 Thread James Bennett
On Thu, Sep 13, 2012 at 4:25 AM, DJ-Tom wrote: > Basically I always try to have the same environment for development as I > also use for actual production - I'm lucky that my projects are small enough > so i can do that :-) to avoid last minute surprises when trying to

Re: Problems with simple "hello world" test - "ImportError: Could not import settings"

2012-09-13 Thread DJ-Tom
> Ok... GREAT! Now it works :-) (well... sort of, more below... ) but I had >> to restart Apache to make config changes effective... is that "normal"? >> >> I think important things like "you have to restart the webserver to make >> changes life" should go into the tutorial in *BIG RED

Re: Problems with simple "hello world" test - "ImportError: Could not import settings"

2012-09-11 Thread Daniel Roseman
On Tuesday, 11 September 2012 16:33:31 UTC+1, DJ-Tom wrote: > > > > Am Dienstag, 11. September 2012 10:20:16 UTC+2 schrieb Chang.Jian: >> >> "d:/wwwroot/djtest/djtest/" was already in system path, so I think you >> should set DJANGO_SETTINGS_MODULE like this: >>

Re: Problems with simple "hello world" test - "ImportError: Could not import settings"

2012-09-11 Thread DJ-Tom
Am Dienstag, 11. September 2012 10:20:16 UTC+2 schrieb Chang.Jian: > > "d:/wwwroot/djtest/djtest/" was already in system path, so I think you > should set DJANGO_SETTINGS_MODULE like this: > os.environ.setdefault("DJANGO_SETTINGS_MODULE", "settings") > > try it! > > Ok... GREAT! Now it works

Re: Problems with simple "hello world" test - "ImportError: Could not import settings"

2012-09-11 Thread Jian Chang
"d:/wwwroot/djtest/djtest/" was already in system path, so I think you should set DJANGO_SETTINGS_MODULE like this: os.environ.setdefault("DJANGO_SETTINGS_MODULE", "settings") try it![?][?][?] 2012/9/11 DJ-Tom > Am Dienstag, 11. September 2012 00:43:44 UTC+2 schrieb Mike

Re: Problems with simple "hello world" test - "ImportError: Could not import settings"

2012-09-11 Thread DJ-Tom
Am Dienstag, 11. September 2012 00:43:44 UTC+2 schrieb Mike Dewhirst: > > > Try dropping this down to "djtest.settings". Also make sure you have a > file in each of your folders called __init__.py > > This tells Python the folder is part of the package. > Sorry - but this does not help. Just

Re: Problems with simple "hello world" test - "ImportError: Could not import settings"

2012-09-10 Thread Mike Dewhirst
as a service under Windows 7 - mod_wsgi - Python 2.7.3 - django 1.4.1 - web server docroot under d:\wwwroot - test project under d:\wwwroot\djtest\djtest set up with django-admin.py startproject djtest Basically I think that almost everything is set up correctly, things like "python manage.py s

Problems with simple "hello world" test - "ImportError: Could not import settings"

2012-09-10 Thread DJ-Tom
- Python 2.7.3 - django 1.4.1 - web server docroot under d:\wwwroot - test project under d:\wwwroot\djtest\djtest set up with django-admin.py startproject djtest Basically I think that almost everything is set up correctly, things like "python manage.py syncdb" work without probkem

Re: Test driven development in Django framework

2012-09-08 Thread Steven Cummings
I think when people say "unit" tests to mean fully isolated tests, what they really mean is *whitebox* tests. You define the size of the unit under test and context runs from full isolation (whitebox test) to full integration/user-experience (blackbox test) -- Steven On Fri, Sep 7, 20

Re: Test driven development in Django framework

2012-09-07 Thread Harry P
Hey, glad to hear someone's been found it useful! re: whether my unit tests are unit tests or not... some people have a very restrictive definition of what a unit test is - they want it to be 100% isolated from other tests, always mock out the filesystem and the database, etc. That's fine

Re: Test driven development in Django framework

2012-09-07 Thread jyria
, driving a real web browser, and following a > test script that is essential a user story. We then write unit tests that > we can run using a python manage.py test. > > I've written a "TDD for beginners" tutorial, that covers both of these > types of test: > > http://www.t

Re: Test driven development in Django framework

2012-09-06 Thread Harry P
Hi there, I work for a bunch of XP fanatics, so we do quite religious TDD in our Python/Django development. We start with functional/acceptance tests, which we write using Selenium, driving a real web browser, and following a test script that is essential a user story. We then write unit

Re: Test driven development in Django framework

2012-09-05 Thread Mike Dewhirst
q=tdd%20is%20not%20unit%20testing in short, it's like you've found: the tests you easily get with TDD are more (but not exactly) like integration tests, because you test features, not units. The "test isolated units" mantra of unit-testing requires different work. There's nothing wrong i

Re: Test driven development in Django framework

2012-09-05 Thread Javier Guerra Giraldez
oogle.com/webhp?q=tdd%20is%20not%20unit%20testing in short, it's like you've found: the tests you easily get with TDD are more (but not exactly) like integration tests, because you test features, not units. The "test isolated units" mantra of unit-testing requires different work.

Test driven development in Django framework

2012-09-05 Thread jyria
What is your experience? Is it worth it, and is it possible? I tried it and found it quite difficult to follow guideline of unit testing -- testing a unit of code, a class for example. Maybe Im just ignorant, but I didnt see, how can I create registration app only with unit tests. The only

Re: skip fixtures loading on 'manage.py test myapp'

2012-08-22 Thread Anton Baklanov
exactly On Wed, Aug 22, 2012 at 2:24 AM, Karen Tracey wrote: > That link doesn't really explain why south would be loading fixtures that > Django itself wouldn't ordinarily load. Unless...do you have migrations > that are loading fixtures? > -- Regards, Anton Baklanov

Re: skip fixtures loading on 'manage.py test myapp'

2012-08-21 Thread Karen Tracey
On Mon, Aug 20, 2012 at 12:40 PM, Anton Baklanov wrote: > and, if anyone is interested, here is the answer - > http://south.readthedocs.org/en/latest/settings.html#south-tests-migrate > > That link doesn't really explain why south would be loading fixtures that Django

Re: skip fixtures loading on 'manage.py test myapp'

2012-08-20 Thread Anton Baklanov
ngo itself does > not do anything like that. > Problem is in South - when i remove it from INSTALLED_APPS 'manage.py test > myapp' does not load any fixtures except 'initial_data'. > > So, i'm going to south sources now. > > Thanks! > > > On Mon, Aug 20, 2012 at 12:01 PM

Re: skip fixtures loading on 'manage.py test myapp'

2012-08-20 Thread Anton Baklanov
Hi Melvyn! Just tested it on dummy project, and you are right - django itself does not do anything like that. Problem is in South - when i remove it from INSTALLED_APPS 'manage.py test myapp' does not load any fixtures except 'initial_data'. So, i'm going to south sources now. Thanks! On Mon

Re: skip fixtures loading on 'manage.py test myapp'

2012-08-20 Thread Melvyn Sopacua
On 19-8-2012 19:05, Anton Baklanov wrote: > When I'm running 'manage.py test myapp' it loads all fixtures that are in > 'myapp/fixtures' directory. Are you sure about that? I think it only loads what is loaded also with syncdb, so initial_data.*. > And what I want is to find a wa

skip fixtures loading on 'manage.py test myapp'

2012-08-19 Thread Anton Baklanov
Hi! When I'm running 'manage.py test myapp' it loads all fixtures that are in 'myapp/fixtures' directory. And what I want is to find a way to tell django skip this fixtures and instead load some other ones or maybe no fixtures at all for certain tests. Is it possible? -- Regards, Anton Baklanov

Re: Weird test-behaviour in combination with localization

2012-08-02 Thread Melvyn Sopacua
On 31-7-2012 21:21, Andre Schemschat wrote: > Now, if i run all tests, not just for that specific view, the test fails, > because the view returnes {'fielda':'This field is required.'} instead of > the german localization. I checked the settings.LANGUAGE_CODE-value in th

Re: Weird test-behaviour in combination with localization

2012-07-31 Thread Andre Schemschat
within its own tests, which affect my other tests? On Tuesday, July 31, 2012 9:21:28 PM UTC+2, Andre Schemschat wrote: > > Hey together, > I was just writing some tests for my views and i stumbled upon a > localization error, which i cant figure out :/ > I have a test that

Weird test-behaviour in combination with localization

2012-07-31 Thread Andre Schemschat
Hey together, I was just writing some tests for my views and i stumbled upon a localization error, which i cant figure out :/ I have a test that checks the form-validation returnes the correct errors-messages for specific input data. Basicly what i feed to the view are the field-names

Getting an error: FATAL: Peer authentication failed for user "test"

2012-07-21 Thread Sylar
tion_factory=connection_factory, async=async) psycopg2.OperationalError: FATAL: Peer authentication failed for user "test" I'm going insane, please help me! -- You received this message because you are subscribed to the Google Groups "Django users" group. To view this dis

Error:psycopg2.OperationalError: FATAL: Peer authentication failed for user "test"

2012-07-21 Thread Juraj Malenica
b/python2.7/dist-packages/django/db/backends/postgresql_psycopg2/base.py", line 177, in _cursor self.connection = Database.connect(**conn_params) File "/usr/lib/python2.7/dist-packages/psycopg2/__init__.py", line 179, in connect connection_factory=connection_factory, a

Re: Unit test an app using ContentType?

2012-07-18 Thread Aron Griffis
a registration > function. It's working well for me, but I'd like to write > standalone unit tests and I'm not sure how. > > The problem is that there's only one model in this app, and it's > the one that uses ContentType, so there are no other models with > which to test it unless I i

Unit test an app using ContentType?

2012-07-18 Thread Aron Griffis
. The problem is that there's only one model in this app, and it's the one that uses ContentType, so there are no other models with which to test it unless I involve an extra app. How does one write unit tests for a model that uses ContentType? Is there a way to put test-only models into tests.py

Re: can the Django test server serve cgi scripts?

2012-05-13 Thread Russell Keith-Magee
On Mon, May 14, 2012 at 2:15 AM, Gelonida N <gelon...@gmail.com> wrote: > I know, that performance would be entire crap. > However sometimes this could be useful for a minimalist setup. > > So let me explain: > > For testing I'd like start no web server at all, just

can the Django test server serve cgi scripts?

2012-05-13 Thread Gelonida N
I know, that performance would be entire crap. However sometimes this could be useful for a minimalist setup. So let me explain: For testing I'd like start no web server at all, just the django test server. (./manage.py ./runserver ) It will handle all static files and all django views. Now

Re: Django unit test. Access the 'real data base'

2012-05-11 Thread akaariai
On May 11, 4:38 pm, Gelonida <gelon...@gmail.com> wrote: > For one unit test I would like to use the real data base and not the > test data base. > > Basically this unit test shall verify that the server database fulfills > certain consistency criterea. > > How

Django unit test. Access the 'real data base'

2012-05-11 Thread Gelonida
For one unit test I would like to use the real data base and not the test data base. Basically this unit test shall verify that the server database fulfills certain consistency criterea. How can I write one django test, that uses the 'default' (non test database) I tried to use

Re: Saving test user as a foreign key in unit tests

2012-04-11 Thread jondbaker
Problem solved. Within my view I needed use the following: def create_tasting(request): if request.method =='POST': form = TastingForm(request.POST) if form.is_valid(): *obj = form.save(commit=False)* *obj.author = request.user* *obj.save()*

Saving test user as a foreign key in unit tests

2012-04-11 Thread jondbaker
I have a Tasting model with an 'author' field that is a ForeignKey to the User model. Within my unit test I'm attempting to create a test user, and pass that user object as the author of a test Tasting, but I keep getting the following error: "IntegrityError: tastings_tasting.author_i

Re: Can't create a test suite for a Django app

2012-04-11 Thread Benedict Verheyen
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 > Hi all, > > I'm having trouble creating a test suite in Django 1.3. > > Say I have an installed app in a directory called app_name. One of the > files in that directory is foo.py which defines a class named Foo. I > want to

Can't create a test suite for a Django app

2012-04-10 Thread Michael Parker
Hi all, I'm having trouble creating a test suite in Django 1.3. Say I have an installed app in a directory called app_name. One of the files in that directory is foo.py which defines a class named Foo. I want to test that, so I also have a file that directory called foo_test.py which defines

Should I always provide a return value when writing my test using mock library?

2012-04-10 Thread John Yeukhon Wong
ame]}), I would get this: /greeting/birthday/username/ I am going to patch the `reverse` function that's local to render_reverse, and inside the test, should I always provide a return value like this? with patch('myproject.myapps.mylibrary.reverse') as mock_reverse: mock_f

Re: Upgrading to 1.4, now a test is skipped?

2012-03-27 Thread Tim Chase
On 03/27/12 18:22, Russell Keith-Magee wrote: On 28/03/2012, at 2:02 AM, Tim Chase wrote: I'm in the process of upgrading from 1.3 to 1.4, and noticed that my test results now say that one of the tests is being skipped. Any way to tell "./manage.py test" to be verbose, or to

Re: Upgrading to 1.4, now a test is skipped?

2012-03-27 Thread Russell Keith-Magee
On 28/03/2012, at 2:02 AM, Tim Chase wrote: > I'm in the process of upgrading from 1.3 to 1.4, and noticed that my test > results now say that one of the tests is being skipped. As best I can tell, > this is an internal Django test, rather than one of mine. Since it's not an > ac

Upgrading to 1.4, now a test is skipped?

2012-03-27 Thread Tim Chase
I'm in the process of upgrading from 1.3 to 1.4, and noticed that my test results now say that one of the tests is being skipped. As best I can tell, this is an internal Django test, rather than one of mine. Since it's not an actual failure, I'm mostly curious about what it is and what

Re: Weird stacktrace coming from manage.py test

2012-03-23 Thread Jeff Heard
No, it turned out that my django-startproject.py was still the one for 1.3... On Fri, Mar 23, 2012 at 10:47 AM, Reinout van Rees wrote: > On 22-03-12 17:34, Jeff Heard wrote: >> >> Has anyone seen this before?  Am I missing something?  This hasn't even >> gotten to my code

Re: Weird stacktrace coming from manage.py test

2012-03-23 Thread Reinout van Rees
On 22-03-12 17:34, Jeff Heard wrote: Has anyone seen this before? Am I missing something? This hasn't even gotten to my code yet. I'm using this in my settings.py: TEST_RUNNER = 'django.contrib.gis.tests.GeoDjangoTestSuiteRunner' I have a template PostGIS database setup properly. And I'm

Weird stacktrace coming from manage.py test

2012-03-22 Thread Jeff Heard
/Source/geoanalytics/lib/python2.7/site-packages/django/core/management/commands/test.py", line 37, in handle failures = test_runner.run_tests(test_labels) File "/Users/jeffersonheard/Source/geoanalytics/lib/python2.7/site-packages/django/test/simple.py", line 359, in run_tests o

Re: How can I print form errors from inside the test

2012-03-15 Thread Mario Gudelj
gt;> Thanks Daniel and Karen, >> >> Karen, I;'m not entirely sure what an unbound form is. :) >> > > Then you must not have read the documentation[1], which goes into great > detail about bound and unbound forms. That's pretty much a prerequisite > before asking for

Re: How can I print form errors from inside the test

2012-03-14 Thread Daniel Roseman
t's pretty much a prerequisite before asking for help, I'm afraid. > > Anyway, this is my test code: > > def test_appointment_form(self): > > c = Client() > > base_data = { > 'name':'Foo name', > 'slug':'foo-sessi

Re: How can I print form errors from inside the test

2012-03-14 Thread Mario Gudelj
Thanks Daniel and Karen, Karen, I;'m not entirely sure what an unbound form is. :) Anyway, this is my test code: def test_appointment_form(self): c = Client() base_data = { 'name':'Foo name', 'slug':'foo-session', 'short_descr':'foo tagline

Re: How can I print form errors from inside the test

2012-03-14 Thread Karen Tracey
The most common reason I have seen for is_valid() to return False but errors to be empty is for the form to be unbound. Unbound forms are never valid, but they also don't have any errors. Which goes to Daniel's question: how exactly have you "preloaded" the form with data? Karen --

Re: How can I print form errors from inside the test

2012-03-13 Thread Daniel Roseman
On Tuesday, 13 March 2012 19:06:13 UTC-7, somecallitblues wrote: > > I preload the data into the form and when I validate it returns False. > > *How* do you "preload" the data? How do you validate it? -- DR. -- You received this message because you are subscribed to the Google Groups "Django

How can I print form errors from inside the test

2012-03-13 Thread Mario Gudelj
Hi djangoers, I have a problem where I'm running some form tests, the form validation is failing, and I'm not sure why it's failing and I can't figure out how to print the errors. I preload the data into the form and when I validate it returns False. >>> form.is_valid() False If I print the

Re: User.objects.get() doesn't return anything in unit test.

2012-03-12 Thread RM
Putting the correct view in the c.post() method worked. Thanks! -- 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

Re: Bump to Django 1.4rc1 causes near doubling of test run time

2012-03-12 Thread Philip Kimmey
Sorry - I was going to try and reproduce this result with a little bit more rigor, but didn't have time. My test environment is running against SQLite & Django's file based cache system. Frankly, I probably should have done more side-by-side testing of the two different revs before submit

Re: User.objects.get() doesn't return anything in unit test.

2012-03-11 Thread Russell Keith-Magee
On 11/03/2012, at 4:30 PM, RM wrote: > When my django test case executes, I'm testing my code's ability to > create a new user. But when I use the User.objects.get() method the > user isn't found. The view being tested actually creates users (I > checked it in the browser), but ho

User.objects.get() doesn't return anything in unit test.

2012-03-11 Thread RM
When my django test case executes, I'm testing my code's ability to create a new user. But when I use the User.objects.get() method the user isn't found. The view being tested actually creates users (I checked it in the browser), but how do I write a test that verifies it? Thanks for your help

Re: Bump to Django 1.4rc1 causes near doubling of test run time

2012-03-10 Thread Ramiro Morales
On Sat, Mar 10, 2012 at 4:16 PM, Philip Kimmey <phi...@rover.com> wrote: > Hi folks, > > I bumped Django from 1.4 alpha to 1.4rc1 and all of a sudden my unit > test runs went from ~16mins to ~29mins. The 16 minutes was extremely > stable before (many hundreds of runs in Jen

Bump to Django 1.4rc1 causes near doubling of test run time

2012-03-10 Thread Philip Kimmey
Hi folks, I bumped Django from 1.4 alpha to 1.4rc1 and all of a sudden my unit test runs went from ~16mins to ~29mins. The 16 minutes was extremely stable before (many hundreds of runs in Jenkins) and the 29 mins is very consistent now (about 10 runs.) Any ideas what might have changed between

Re: Database test error

2012-02-14 Thread akaariai
On Feb 13, 11:09 am, xina towner wrote: > Hello, I still get this error: > The problem es the order that django creates the tables in the database. > Can I change this? Are you sure the problem is not that importing the tests will generate a query? The offending place

Re: Unit test example for web froms

2012-02-12 Thread veearrsix
Coming from a non python/django background (my experience is groovy/ grails), but when we test our controllers (I think this is equivalent to django views). We simply set up mock params on the request and set expectations on the controller properties. Simple example: given: request.params

Unit test example for web froms

2012-02-11 Thread Mario Gudelj
Hi guys, I was wandering if anyone has a good example of a unit test where they have a view which processes a web form. I'm not sure how you'd test something like that. Thanks, mario -- You received this message because you are subscribed to the Google Groups "Django users" grou

Re: Error with test database

2012-02-08 Thread xina towner
ocha <m...@rennerocha.com> wrote: >> >>> You can configure the setting TEST_DEPENDENCIES. See the docs for more >>> info: >>> >>> >>> https://docs.djangoproject.com/en/1.3/topics/testing/#controlling-creation-order-for-test-databases >>

Re: Error with test database

2012-02-08 Thread Renne Rocha
gt;> https://docs.djangoproject.com/en/1.3/topics/testing/#controlling-creation-order-for-test-databases >> >> >> Renne Rocha >> http://rennerocha.com/ >> >> >> >> On Wed, Feb 8, 2012 at 10:57 AM, xina towner <xinatow...@gmail.com>wrote: &g

Re: Error with test database

2012-02-08 Thread xina towner
Can I specify to test tool to use an specific database? On 8 February 2012 14:07, xina towner <xinatow...@gmail.com> wrote: > I've already done that, > this works with databases, but with tables too? > > > On 8 February 2012 14:04, Renne Rocha <m...@rennerocha.co

Re: Error with test database

2012-02-08 Thread xina towner
/testing/#controlling-creation-order-for-test-databases > > > Renne Rocha > http://rennerocha.com/ > > > > On Wed, Feb 8, 2012 at 10:57 AM, xina towner <xinatow...@gmail.com> wrote: > >> Hello, I've a problem, I have to created a script that makes my datab

Re: Error with test database

2012-02-08 Thread Renne Rocha
You can configure the setting TEST_DEPENDENCIES. See the docs for more info: https://docs.djangoproject.com/en/1.3/topics/testing/#controlling-creation-order-for-test-databases Renne Rocha http://rennerocha.com/ On Wed, Feb 8, 2012 at 10:57 AM, xina towner <xinatow...@gmail.com>

Error with test database

2012-02-08 Thread xina towner
Hello, I've a problem, I have to created a script that makes my database in a specifically order but when I want to make test django do it in a different order. How can I solve this? because it can't create the database so I can't test my app. Can I change the order how django initiates

Re: Staging (dev,test,prod) in django

2012-01-12 Thread Mike Dewhirst
On 12/01/2012 8:55pm, Thomas Guettler wrote: Hi, How do you handle staging? - Deploy the source code and static files dev (winXP) commit to svn (linux) svn wakes up buildbot (same linux) buildbot wipes out the test site (same linux) buildbot rebuilds the test site (including

Staging (dev,test,prod) in django

2012-01-12 Thread Thomas Guettler
Hi, in my environment there are three stages: dev, test, prod. Every stage has its own linux user, and all three stages can live on different hosts. The application is installed in $HOME of a user with this name schema: proj_customer_S (S is d=dev q=qualtitytest p=prod) There are some

logging sql queries during unit test

2012-01-03 Thread Brian Craft
Is overwriting settings.DEBUG the recommended way to get connections[db].queries to work during a unit test? -- 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 unsubs

Re: Transaction not working with test

2011-12-05 Thread Javier Guerra Giraldez
On Mon, Dec 5, 2011 at 10:52 AM, anthony tresontani wrote: > I am using Django 1.3, django-nose, sqlite inmemory database. > > I tried with TestCase,TransactionTestCase, commit_on_success > (decorator and context manager) and commit_manually. None of them > worked. i'm

Transaction not working with test

2011-12-05 Thread anthony tresontani
Hey Guys, I am trying to test a transaction rollback in a unit test and it seems to not work properly. I am using Django 1.3, django-nose, sqlite inmemory database. I tried with TestCase,TransactionTestCase, commit_on_success (decorator and context manager) and commit_manually. None of them

Re: Boolean test on queryset

2011-11-28 Thread Ian Clelland
On Monday, November 28, 2011, Adam Nelson wrote: > Jirka, > That doesn't solve the problem. That will still do a very expensive count() operation on the queryset. In fact, examples.count() is what happens when you do bool(examples) anyway. I'm confused here -- examples.count()

Re: Boolean test on queryset

2011-11-28 Thread Adam Nelson
Jirka, That doesn't solve the problem. That will still do a very expensive count() operation on the queryset. In fact, examples.count() is what happens when you do bool(examples) anyway. Thanks, Adam On Mon, Nov 28, 2011 at 8:11 PM, Jirka Vejrazka wrote: > Hi Adam,

Re: Boolean test on queryset

2011-11-28 Thread Jirka Vejrazka
Hi Adam, I tend to use: if examples.count(): ...something... HTH Jirka -- 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

Boolean test on queryset

2011-11-28 Thread Adam Nelson
When one tests for the boolean value of a queryset in the following way: examples = Example.objects.all() if examples: . do something You might think (I did) that Django will call a __nonzero__ special attribute that would either execute an EXISTS SQL STATEMENT or a SELECT statement

Re: django testing. random test order with some 'dependency constraints'

2011-11-28 Thread Gelonida N
quisite other than those specified > as part of the setUp()/teardown() methods. As a result, you won't find > a whole lot of documentation on how to do what you're describing. > > The right way to approach this is to identify the required > preconditions for each test, and eit

Re: django testing. random test order with some 'dependency constraints'

2011-11-27 Thread Russell Keith-Magee
he right way to approach this is to identify the required preconditions for each test, and either construct those preconditions in the setUp() method, or use Django's test fixtures to install test data. This is all covered in the documentation for Django's testing system; most notably in the section

django testing. random test order with some 'dependency constraints'

2011-11-27 Thread Gelonida N
I'd like to create some unit tests whch should be executed in random order. However some tests could benefit from results of some predecessor tests. Therefore they should be executed only after certain tests. Did anybody try to implement such a test setup with Django's default unit tests

django 1.3 and django-test-utils Persistent Database Test Runner

2011-11-25 Thread Gelonida N
I just discovered django-test-utils on the web and noticed, that it has some functionality, that looks interesting to me. http://readthedocs.org/docs/django-test-utils/en/latest/keep_database_runner.html# this shall introduce a management command 'quicktest', which is supposed to keep the test

help on test cases.

2011-11-16 Thread Jv
i need to modify the content (article) but its not creating history when i used .save() method . But when i create article in admin module and continue editing , its keep on creating history and also publishing status is being changed from public to draft. How can i test the same from test case

Re: Test DB Connection

2011-10-14 Thread akshar raaj
>From what i can understand, you want to test whether you can connect to database from your django project or not. If this is your need then try the following: Go to the shell using following command: python manage.py shell On the shell, issue the following statements: from django.db imp

Re: Test DB Connection

2011-10-14 Thread Cal Leeming [Simplicity Media Ltd]
n it can't connect. > > But later if I do: > > from passion.cg.models import * > users = User.objects.filter( username='julian') > print users > > then I get > > # OperationalError: (1044, "Access denied for user ''@'localhost' to > database 'djangostack'") > # - [l

Test DB Connection

2011-10-14 Thread Julian Hodgson
lhost' to database 'djangostack'") # - [line 3] So I need a way to test the connection before trying to use the django models. I can just check for exceptions, but is there a better way? Julian -- You received this message because you are subscribed to the Google Groups "Django users&

Re: Still getting IntegrityError in test fixture using dumpdata --natural

2011-10-12 Thread bobhaugen
On Oct 12, 9:12 am, Russell Keith-Magee wrote: > --natural isn't a magic wand Dang! I knew that "magic removal" was a bad idea... > Contenttypes are automatically created by syncdb. If your fixtures > *also* contain content types, you can potentially get

Re: Still getting IntegrityError in test fixture using dumpdata --natural

2011-10-12 Thread Russell Keith-Magee
On Wed, Oct 12, 2011 at 3:05 AM, bobhaugen <bob.hau...@gmail.com> wrote: > Replying to myself:  temporary fix for dumpdata: --exclude > contenttypes --exclude auth.permission This isn't a temporary fix -- it's the *actual* fix. > The result now works as a test fixture. &g

Re: Still getting IntegrityError in test fixture using dumpdata --natural

2011-10-11 Thread bobhaugen
Replying to myself: temporary fix for dumpdata: --exclude contenttypes --exclude auth.permission The result now works as a test fixture. Not sure what to conclude: * the fix for issue #7052 does not work? * --natural does not fix the IntegrityErrors with contenttypes in test fixtures

Still getting IntegrityError in test fixture using dumpdata --natural

2011-10-11 Thread bobhaugen
Still getting "IntegrityError: columns app_label, model are not unique" when loading a test fixture created by dumpdata using the keyword --natural. I am probably missing something, but I understood the resolution to https://code.djangoproject.com/ticket/7052 to be to use the new

Getting testing to report multiple tests per-assertion vs. per test-method

2011-09-28 Thread Tim Chase
Is there an easy way to get Django's test framework to report on the number of assertions performed instead of the number of test-methods called? I have things like def test_date_fenceposts(self): date_result_tuples_to_test = ( (date(2011,4,1), 35), ... #however many

Re: Beginner's unit test question

2011-09-05 Thread Rodney Topor
Never mind. I've found the answer. The problem was that my app name "messages" somehow clashed with the app "django.contrib.messages" which was earlier in my INSTALLED_APPS. This didn't prevent my project from working, but did confuse the test framework, which looked in &quo

Re: Beginner's unit test question

2011-09-05 Thread Rodney Topor
I'm sorry for my inconsistency. I tried to "simplify", but made a mistake. In fact, I used the app "messages" throughout, in my code and in the test command. The project containing the app works fine. In particular, the app "messages" is included in INSTALLED_APPS.

Re: Beginner's unit test question

2011-09-05 Thread bruno desthuilliers
(self): >         client = Client() >         response = client.get('/index/') >         self.assertEqual(response.status_code, 200) > > In the enclosing project directory, I write > > manage.py test app.IndexTest > > and get the error > > "Test label 'messages.IndexTe

Beginner's unit test question

2011-09-04 Thread Rodney Topor
(response.status_code, 200) In the enclosing project directory, I write manage.py test app.IndexTest and get the error "Test label 'messages.IndexTest' does not refer to a test" I also tried "from django.utils import unittest" in tests.py but that made no difference. The command mana

Re: possible fix for auth test template

2011-09-01 Thread Mike Dewhirst
My apologies - please ignore my last email. I think I'm closer this time. The test is still failing but for a different reason. In my fossicking around I had adjusted the test expectation to 'Session accessed' and had forgotten to reverse that prior to 'fixing' the problem. I have now looked

possible fix for auth test template

2011-09-01 Thread Mike Dewhirst
Django trunk revision 16715 manage.py test is producing one failure out of 326 tests which might be due to an empty template. The test is asserting that response contains 'Session not accessed' With an empty template the assertion should succeed if it said the response does not contain

manage.py test app can't find tests

2011-08-30 Thread Mike Dewhirst
in 0.141s OK but in the project directory can someone tell me why this runs zero tests? python manage.py test app says Creating test database for alias 'default'... -- Ran 0 tests in 0.000s OK Destroying test database

<    1   2   3   4   5   6   7   8   9   10   >