Mocking OpenOffice in python?

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • PaoloB

    #1

    Mocking OpenOffice in python?

    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

  • Méta-MCI

    #2
    Re: Mocking OpenOffice in python?

    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


    Comment

    • Carsten Haese

      #3
      Re: Mocking OpenOffice in python?

      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/Developers...persGuide.html.

      -Carsten


      Comment

      • Shane Geiger

        #4
        Re: Mocking OpenOffice in python?

        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/Developers...persGuide.html.
        >
        -Carsten
        >
        >
        >
        --
        Shane Geiger
        IT Director
        National Council on Economic Education
        sgeiger@ncee.ne t | 402-438-8958 | http://www.ncee.net

        Leading the Campaign for Economic and Financial Literacy


        Comment

        • PaoloB

          #5
          Re: Mocking OpenOffice in python?

          On 14 Mar, 14:48, Carsten Haese <cars...@uniqsy s.comwrote:
          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


          Comment

          • PaoloB

            #6
            Re: Mocking OpenOffice in python?

            On 14 Mar, 14:52, Shane Geiger <sgei...@ncee.n etwrote:
            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

            Comment

            • olive

              #7
              Re: Mocking OpenOffice in python?

              On Mar 14, 9:39 am, "PaoloB" <pibi...@gmail. comwrote:
              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.

              Comment

              • Gerrit Muller

                #8
                Re: Mocking OpenOffice in python?

                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>

                Comment

                Working...