Re: forked processes and testing

Discussion in 'Python' started by Terry Reedy, Sep 12, 2012.

  1. Terry Reedy

    Terry Reedy Guest

    On 9/12/2012 6:20 AM, andrea crotti wrote:
    > I wrote a decorator that takes a function, run it in a forked process
    > and return the PID:


    This strikes me as an abuse of the decorator syntax.

    @wrap
    def f(): pass

    is just syntactic sugar for

    def f(): pass
    f = wrap(f)

    but that is not what you are doing.

    def run_in_fork(func)

    def f(): pass

    run_in_fork(f)

    would let you test run_in_fork with simple test oriented functions and
    separately test your real functions without the complication of the fork
    process.

    My 2 cents anyway.

    --
    Terry Jan Reedy
     
    Terry Reedy, Sep 12, 2012
    #1
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. kmkz

    Kill forked processes

    kmkz, Feb 26, 2006, in forum: Python
    Replies:
    4
    Views:
    423
  2. Pierre Morel
    Replies:
    5
    Views:
    125
    Pierre Morel
    Feb 17, 2010
  3. Tim Uckun
    Replies:
    12
    Views:
    288
    Tim Uckun
    Oct 14, 2010
  4. andrea crotti

    forked processes and testing

    andrea crotti, Sep 12, 2012, in forum: Python
    Replies:
    0
    Views:
    195
    andrea crotti
    Sep 12, 2012
  5. Kushal Kumaran

    Re: forked processes and testing

    Kushal Kumaran, Sep 12, 2012, in forum: Python
    Replies:
    0
    Views:
    182
    Kushal Kumaran
    Sep 12, 2012
Loading...

Share This Page