Login | Register For Free | Help
Search for: (Advanced)

Mailing List Archive: Zope: Dev

Unittests with different zope configuration?

 

 

Zope dev RSS feed   Index | Next | Previous | View Threaded


lists at zopyx

Jun 5, 2006, 2:50 AM

Post #1 of 8 (1089 views)
Permalink
Unittests with different zope configuration?

Does anyone know how to write unittests that have to deal with different
configurations in zope.conf? In my particular case I need write some tests
for sequence.sort() that deal with the 'locale' configuration in zope.conf.
So how do I setup a different configurations in a unit test?

Andreas


stefan at epy

Jun 7, 2006, 3:04 AM

Post #2 of 8 (1045 views)
Permalink
Re: Unittests with different zope configuration? [In reply to]

I use this to set debug-mode off:

# Switch off debug mode
import App.config
config = App.config.getConfiguration()
config.debug_mode = 0
App.config.setConfiguration(config)

Stefan


On 5. Jun 2006, at 11:50, Andreas Jung wrote:

> Does anyone know how to write unittests that have to deal with
> different configurations in zope.conf? In my particular case I need
> write some tests for sequence.sort() that deal with the 'locale'
> configuration in zope.conf.
> So how do I setup a different configurations in a unit test?
>
> Andreas

--
Anything that happens, happens. --Douglas Adams


_______________________________________________
Zope-Dev maillist - Zope-Dev [at] zope
http://mail.zope.org/mailman/listinfo/zope-dev
** No cross posts or HTML encoding! **
(Related lists -
http://mail.zope.org/mailman/listinfo/zope-announce
http://mail.zope.org/mailman/listinfo/zope )


rocky at serverzen

Jun 7, 2006, 4:20 AM

Post #3 of 8 (1047 views)
Permalink
Re: Unittests with different zope configuration? [In reply to]

On Wed, 2006-07-06 at 12:04 +0200, Stefan H. Holek wrote:
> I use this to set debug-mode off:
>
> # Switch off debug mode
> import App.config
> config = App.config.getConfiguration()
> config.debug_mode = 0
> App.config.setConfiguration(config)

Oh wow, this trick should come in handy. Thanks Stefan!

- Rocky

--
Rocky Burt
ServerZen Software -- http://www.serverzen.com
News About The Server (blog) -- http://www.serverzen.net
Attachments: signature.asc (0.19 KB)


lists at zopyx

Jun 7, 2006, 4:48 AM

Post #4 of 8 (1047 views)
Permalink
Re: Re: Unittests with different zope configuration? [In reply to]

--On 7. Juni 2006 08:50:41 -0230 Rocky Burt <rocky [at] serverzen> wrote:

> On Wed, 2006-07-06 at 12:04 +0200, Stefan H. Holek wrote:
>> I use this to set debug-mode off:
>>
>> # Switch off debug mode
>> import App.config
>> config = App.config.getConfiguration()
>> config.debug_mode = 0
>> App.config.setConfiguration(config)
>
> Oh wow, this trick should come in handy. Thanks Stefan!
>

Cheers to Mr. Testing

Andreas


fg at nuxeo

Jun 7, 2006, 5:28 AM

Post #5 of 8 (1041 views)
Permalink
Re: Unittests with different zope configuration? [In reply to]

Stefan H. Holek wrote:
> I use this to set debug-mode off:
>
> # Switch off debug mode
> import App.config
> config = App.config.getConfiguration()
> config.debug_mode = 0
> App.config.setConfiguration(config)

The setConfiguration() is probably unnecessary, you're modifying a mutable
datastructure.

Florent

--
Florent Guillaume, Nuxeo (Paris, France) Director of R&D
+33 1 40 33 71 59 http://nuxeo.com fg [at] nuxeo
_______________________________________________
Zope-Dev maillist - Zope-Dev [at] zope
http://mail.zope.org/mailman/listinfo/zope-dev
** No cross posts or HTML encoding! **
(Related lists -
http://mail.zope.org/mailman/listinfo/zope-announce
http://mail.zope.org/mailman/listinfo/zope )


lists at zopyx

Jun 7, 2006, 5:41 AM

Post #6 of 8 (1050 views)
Permalink
Re: Re: Unittests with different zope configuration? [In reply to]

--On 7. Juni 2006 14:28:03 +0200 Florent Guillaume <fg [at] nuxeo> wrote:

> Stefan H. Holek wrote:
>> I use this to set debug-mode off:
>>
>> # Switch off debug mode
>> import App.config
>> config = App.config.getConfiguration()
>> config.debug_mode = 0
>> App.config.setConfiguration(config)
>
> The setConfiguration() is probably unnecessary, you're modifying a
> mutable datastructure.

Probably unnecessary but one should not depend on an implementation
detail in this case.

-aj


stefan at epy

Jun 7, 2006, 5:47 AM

Post #7 of 8 (1046 views)
Permalink
Re: Unittests with different zope configuration? [In reply to]

It is needed to update "legacy locations", e.g. copying
config.instancehome to the INSTANCE_HOME built-in and into the
environment. The debug_mode flag has a legacy location of
Globals.DevelopmentMode.

Cheers,
Stefan

On 7. Jun 2006, at 14:28, Florent Guillaume wrote:

> Stefan H. Holek wrote:
>> I use this to set debug-mode off:
>> # Switch off debug mode
>> import App.config
>> config = App.config.getConfiguration()
>> config.debug_mode = 0
>> App.config.setConfiguration(config)
>
> The setConfiguration() is probably unnecessary, you're modifying a
> mutable datastructure.
>
> Florent

--
Anything that happens, happens. --Douglas Adams


_______________________________________________
Zope-Dev maillist - Zope-Dev [at] zope
http://mail.zope.org/mailman/listinfo/zope-dev
** No cross posts or HTML encoding! **
(Related lists -
http://mail.zope.org/mailman/listinfo/zope-announce
http://mail.zope.org/mailman/listinfo/zope )


fg at nuxeo

Jun 7, 2006, 5:50 AM

Post #8 of 8 (1029 views)
Permalink
Re: Unittests with different zope configuration? [In reply to]

Zope core doesn't use the legacy locations anymore however, right?
It would potentially impact only third-party products?

Florent

On 7 Jun 2006, at 14:47, Stefan H. Holek wrote:

> It is needed to update "legacy locations", e.g. copying
> config.instancehome to the INSTANCE_HOME built-in and into the
> environment. The debug_mode flag has a legacy location of
> Globals.DevelopmentMode.
>
> Cheers,
> Stefan
>
> On 7. Jun 2006, at 14:28, Florent Guillaume wrote:
>
>> Stefan H. Holek wrote:
>>> I use this to set debug-mode off:
>>> # Switch off debug mode
>>> import App.config
>>> config = App.config.getConfiguration()
>>> config.debug_mode = 0
>>> App.config.setConfiguration(config)
>>
>> The setConfiguration() is probably unnecessary, you're modifying a
>> mutable datastructure.
>>
>> Florent
>
> --
> Anything that happens, happens. --Douglas Adams
>
>

--
Florent Guillaume, Nuxeo (Paris, France) Director of R&D
+33 1 40 33 71 59 http://nuxeo.com fg [at] nuxeo


_______________________________________________
Zope-Dev maillist - Zope-Dev [at] zope
http://mail.zope.org/mailman/listinfo/zope-dev
** No cross posts or HTML encoding! **
(Related lists -
http://mail.zope.org/mailman/listinfo/zope-announce
http://mail.zope.org/mailman/listinfo/zope )

Zope dev RSS feed   Index | Next | Previous | View Threaded
 
 


Interested in having your list archived? Contact Gossamer Threads
 
  Web Applications & Managed Hosting Powered by Gossamer Threads Inc.