Mocking OpenOffice in python?

Discussion in 'Python' started by PaoloB, Mar 14, 2007.

  1. PaoloB

    PaoloB Guest

    Hi everyone,

    during our development, we need to write some unit tests that interact
    with OpenOffice through pyUno.

    Is there anyone who has got any experience on it? As OpenOffice is
    quite a large beast, and interaction is rather complex, I would like
    to know if there is someone who is willing to share experience (and,
    possibly, code).

    Ciao

    PaoloB
    PaoloB, Mar 14, 2007
    #1
    1. Advertising

  2. PaoloB

    Méta-MCI Guest

    Hi!


    Under windows, I drive OOo, from Python, via COM/OLE-automation.

    It's run OK, but some bugs, in the OOo-COM-Python, had stop my
    devloppements...

    However, this way is usable (only on Win, ok?)



    @-salutations
    --
    Michel Claveau
    Méta-MCI, Mar 14, 2007
    #2
    1. Advertising

  3. On Wed, 2007-03-14 at 01:39 -0700, PaoloB wrote:
    > Hi everyone,
    >
    > during our development, we need to write some unit tests that interact
    > with OpenOffice through pyUno.
    >
    > Is there anyone who has got any experience on it? As OpenOffice is
    > quite a large beast, and interaction is rather complex, I would like
    > to know if there is someone who is willing to share experience (and,
    > possibly, code).


    I have some experience with pyuno, but your question is very open-ended.
    It would be helpful if you asked specific questions or gave more
    background on what kind of interaction you're trying to achieve.

    The generic answer to your request for code examples is that there's a
    tutorial with example code at
    http://udk.openoffice.org/python/python-bridge.html, and then there's
    the API documentation at
    http://api.openoffice.org/DevelopersGuide/DevelopersGuide.html.

    -Carsten
    Carsten Haese, Mar 14, 2007
    #3
  4. PaoloB

    Shane Geiger Guest

    My take was that this is an effort to manipulate these files without the
    need for Open Office, so I replied as follows:

    Open Office files (.ods and perhaps .odt) are just zipped or gzipped.
    Unpack that and then you are dealing with manipulating regular text
    files--probably HTML.


    Carsten Haese wrote:
    > On Wed, 2007-03-14 at 01:39 -0700, PaoloB wrote:
    >
    >> Hi everyone,
    >>
    >> during our development, we need to write some unit tests that interact
    >> with OpenOffice through pyUno.
    >>
    >> Is there anyone who has got any experience on it? As OpenOffice is
    >> quite a large beast, and interaction is rather complex, I would like
    >> to know if there is someone who is willing to share experience (and,
    >> possibly, code).
    >>

    >
    > I have some experience with pyuno, but your question is very open-ended.
    > It would be helpful if you asked specific questions or gave more
    > background on what kind of interaction you're trying to achieve.
    >
    > The generic answer to your request for code examples is that there's a
    > tutorial with example code at
    > http://udk.openoffice.org/python/python-bridge.html, and then there's
    > the API documentation at
    > http://api.openoffice.org/DevelopersGuide/DevelopersGuide.html.
    >
    > -Carsten
    >
    >
    >


    --
    Shane Geiger
    IT Director
    National Council on Economic Education
    | 402-438-8958 | http://www.ncee.net

    Leading the Campaign for Economic and Financial Literacy
    Shane Geiger, Mar 14, 2007
    #4
  5. PaoloB

    PaoloB Guest

    On 14 Mar, 14:48, Carsten Haese <> wrote:
    > On Wed, 2007-03-14 at 01:39 -0700, PaoloB wrote:
    > > Hi everyone,

    >
    > > during our development, we need to write some unit tests that interact
    > > with OpenOffice through pyUno.

    >
    > > Is there anyone who has got any experience on it? As OpenOffice is
    > > quite a large beast, and interaction is rather complex, I would like
    > > to know if there is someone who is willing to share experience (and,
    > > possibly, code).

    >
    > I have some experience with pyuno, but your question is very open-ended.
    > It would be helpful if you asked specific questions or gave more
    > background on what kind of interaction you're trying to achieve.
    >
    > The generic answer to your request for code examples is that there's a
    > tutorial with example code athttp://udk.openoffice.org/python/python-bridge.html, and then there's
    > the API documentation athttp://api.openoffice.org/DevelopersGuide/DevelopersGuide.html.
    >
    > -Carsten


    Hi Carsten,

    basically, our project (PAFlow) is an application for producing
    documents in public administrations.

    We create templates using OpenOffice, that are filled automatically
    using data from the application itself.

    Now, interacting with OpenOffice is slow, and our tests get a lot of
    time to be executed automatically.

    We are trying to mock OpenOffice, so that we can run our tests without
    using a true OpenOffice for our tests, except when we express test the
    filling of data and production of document.

    Ciao

    PaoloB
    PaoloB, Mar 14, 2007
    #5
  6. PaoloB

    PaoloB Guest

    On 14 Mar, 14:52, Shane Geiger <> wrote:
    > My take was that this is an effort to manipulate these files without the
    > need for Open Office, so I replied as follows:
    >
    > Open Office files (.ods and perhaps .odt) are just zipped or gzipped.
    > Unpack that and then you are dealing with manipulating regular text
    > files--probably HTML.


    No.

    What I was trying was to build a fake OpenOffice server, so that we
    could interact with a fake OpenOffice during our unit test. As
    OpenOffice is quite slow, this could improve the performance of our
    unit tests.

    However, your suggestion is interesting.

    Ciao

    PaoloB
    PaoloB, Mar 14, 2007
    #6
  7. PaoloB

    olive Guest

    On Mar 14, 9:39 am, "PaoloB" <> wrote:
    > Hi everyone,


    Since OO is shipped with Py 2.3 only, I use Jython to drive OO through
    its Java API.

    Our app is a mix of:
    - ODT XML scrapping/templating based on Dom4j which, surprisingly,
    when use with Jython, is the most pythonic XML API I have tried so far
    (I find better than minidom, ElementTree or even lxml which is my
    choice under CPython).
    - OObean integrated in Java Gui and driven by Jython.

    I don't like Java much though, but this is what our management wants
    us to use.
    By chance, Jython is tolerated so far.

    Olive.
    olive, Mar 15, 2007
    #7
  8. Méta-MCI schreef:
    > Hi!
    >
    >
    > Under windows, I drive OOo, from Python, via COM/OLE-automation.
    >
    > It's run OK, but some bugs, in the OOo-COM-Python, had stop my
    > devloppements...
    >
    > However, this way is usable (only on Win, ok?)
    >

    Do you have some (small) example program of using OOo from Python via
    COM/OLE?

    Can you give any indication of the kind of bugs that you hit?

    kind regards, Gerrit Muller

    Gaudi Systems Architecting <www.gaudisite.nl>
    Gerrit Muller, Mar 23, 2007
    #8
    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. gamename

    Unit Testing With Function Mocking

    gamename, Mar 16, 2007, in forum: C Programming
    Replies:
    10
    Views:
    1,061
    gamename
    Mar 19, 2007
  2. Silfheed
    Replies:
    6
    Views:
    323
    Silfheed
    Mar 30, 2007
  3. Olorin

    Mocking HttpFileCollection ?

    Olorin, Jun 6, 2007, in forum: ASP .Net
    Replies:
    0
    Views:
    502
    Olorin
    Jun 6, 2007
  4. mo.sparrow
    Replies:
    0
    Views:
    351
    mo.sparrow
    Aug 22, 2008
  5. Fuzzyman
    Replies:
    0
    Views:
    251
    Fuzzyman
    Aug 22, 2009
Loading...

Share This Page