Nice, Niphlod.

You gave me an idea. I can create a tempfile at the startUp() method
and delete it at tearDown() to achieve this identification.

I'l try something like that.



On Wed, Nov 28, 2012 at 12:26 PM, Niphlod <[email protected]> wrote:
> if it's running from webclient probably it's on localhost , right ?
> usually for tests (and also as a practice for deployment) i save the
> relevant bits in a 0_start.py model and change the data there. For tests you
> can probably simply switch the 0_start.py with a "custom one" just for
> tests.
>
>
> On Wednesday, November 28, 2012 2:56:56 PM UTC+1, viniciusban wrote:
>>
>> Is there a way to my app know it is being run from webclient.py?
>>
>> It would be useful, because in this case, my models.py could allocate
>> my sqlite db file in ramdisk to speed up my tests. BTW, if you use
>> Ubuntu, you already have a ramdisk in /dev/shm.
>>
>> This way, my db.py could be something like that:
>>
>> if not request.env.web2py_runtime_gae:
>>     if its_running_from_webclient:
>>         db = DAL('sqlite://storage.sqlite', folder='/dev/shm/')
>>     else:
>>         db = DAL('sqlite://storage.sqlite')
>>
>>
>> I've tried using DAL('sqlite:memory') to use SQLite's in memory
>> database feature with no success.
>> I think that's because the db lifetime is just for one single request.
>> Am I right?
>>
>> Any ideias about these topics?
>>
>> --
>> Vinicius Assef
>
> --
>
>
>

-- 



Reply via email to