Odd adapter tests

74 views
Skip to first unread message

Alan Etkin

unread,
Dec 29, 2013, 5:07:43 AM12/29/13
to web2py-d...@googlegroups.com
From https://groups.google.com/d/msg/web2py-developers/4hzZ4HkNCTo/jKcZCpV3QHgJ

I could use some help for adding tests for gae, mongodb, couchdb, ..., etc.

mongo and couch seems quite easy, if it is just about enabling the backends at .travis.yml. However, just a small subset will actually pass, so should we add conditional statements to turn off those tests that will fail for each non-sql db? I suppose the alternative way would be a separate test file/section for each adapter or maybe a no-sql test routine (connect then run the test subset)

There are issues about connecting to app engine or imap services. For gae, AFAIK, it is required to import a module from the sdk to emulate a datastore instance. The worst situation is that of imap. I think the only possible way of testing that backend is to mock an imap server or at least creating a dummy driver class returning a static set of messages and statuses. There is a javascript project mocking an imap server for travis-ci, although it does not seem easy to integrate with web2py tests.

Alan Etkin

unread,
Jan 12, 2014, 10:48:44 AM1/12/14
to web2py-d...@googlegroups.com
I could use some help for adding tests for gae, mongodb, couchdb, ..., etc.

How about we use this recipe to run tests with app engine?

https://github.com/travis-ci/travis-ci/issues/738

Massimo DiPierro

unread,
Jan 12, 2014, 10:53:19 AM1/12/14
to web2py-d...@googlegroups.com
I agree. We should do this. It we will need to make some of the dal tests conditional to GAE/non-GAE.

--
-- mail from:GoogleGroups "web2py-developers" mailing list
make speech: web2py-d...@googlegroups.com
unsubscribe: web2py-develop...@googlegroups.com
details : http://groups.google.com/group/web2py-developers
the project: http://code.google.com/p/web2py/
official : http://www.web2py.com/
---
You received this message because you are subscribed to the Google Groups "web2py-developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email to web2py-develop...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

Alan Etkin

unread,
Jan 13, 2014, 5:51:33 AM1/13/14
to web2py-d...@googlegroups.com
I agree. We should do this. It we will need to make some of the dal tests conditional to GAE/non-GAE.

I managed to set gae with travis but there are lot of issues. It is not working with Python 2.6.

Check this build.

https://travis-ci.org/spametki/web2py/builds/16858218

Should I use the testbed cleanup function (deactivate) described here?

https://developers.google.com/appengine/docs/python/tools/localunittesting#Python_Writing_Datastore_and_memcache_tests

Alan Etkin

unread,
Jan 13, 2014, 5:54:53 AM1/13/14
to web2py-d...@googlegroups.com
How about we use this recipe to run tests with app engine?
And for downloading the sdk, there's no way afaik to update to new releases unless we use scrapping  with the google code project page.

Alan Etkin

unread,
Jan 13, 2014, 7:26:03 AM1/13/14
to web2py-d...@googlegroups.com
> I managed to set gae with travis but there are lot of issues. It is not working with Python 2.6.

And very few dal tests work with mongo

https://travis-ci.org/spametki/web2py/jobs/16861934

Alan Etkin

unread,
Jan 16, 2014, 5:48:46 AM1/16/14
to
And for downloading the sdk, there's no way afaik to update to new releases unless we use scrapping  with the google code project page.
I have a workaround for that using wget and bash string manipulation, so the test would always use the last stable release of the sdk. I'm not sure about the way of turning off gae tests in test_dal.py. Should I use something like

>>> if is_gae: return

for each method? Or, perhaps, call a function in each class for deleting methods retrieved from a list?

EDIT: oops, you don't delete methods from class instances, sorry. Perhaps it is possible to override the method if it is listed using setattr

EDIT 2: but it is allowed to delete methods from the class

Niphlod

unread,
Jan 16, 2014, 4:01:15 PM1/16/14
to web2py-d...@googlegroups.com
I was more geared towards either a test_dal_nosql.py with "special methods" and using @unittest.skip .


On Thursday, January 16, 2014 11:10:54 AM UTC+1, Alan Etkin wrote:
And for downloading the sdk, there's no way afaik to update to new releases unless we use scrapping  with the google code project page.
I have a workaround for that using wget and bash string manipulation, so the test would always use the last stable release of the sdk. I'm not sure about the way of turning off gae tests in test_dal.py. Should I use something like

Alan Etkin

unread,
Jan 17, 2014, 4:44:33 PM1/17/14
to web2py-d...@googlegroups.com
I was more geared towards either a test_dal_nosql.py with "special methods" and using @unittest.skip

AFAIK unittest .skip was added in 2.7. It is ok if testing for 2.5 and 2.6 is omitted. Not sure if possible.

Niphlod

unread,
Jan 18, 2014, 1:03:20 PM1/18/14
to web2py-d...@googlegroups.com

Alan Etkin

unread,
Jan 19, 2014, 5:10:32 AM1/19/14
to web2py-d...@googlegroups.com

So everyone agrees in adding a non-sql test file and conditionally importing one or another by testing for the engine value? That way, using .skip would be only needed for disabling tests copied from the sql to the non-sql side. The problem with this approach IMO is that it can duplicate some of the code and will be more difficult to mantain. Some of the changes to tests in sql will need to be updated in non-sql as well.

Alan Etkin

unread,
Jan 19, 2014, 6:41:51 AM1/19/14
to web2py-d...@googlegroups.com
So everyone agrees in adding a non-sql test file and conditionally importing one or another by testing for the engine value?

New tests with the two dal test files approach:

https://travis-ci.org/spametki/web2py/jobs/17217247

Reply all
Reply to author
Forward
0 new messages