Mocking OpenOffice in python?

P

PaoloB

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

Méta-MCI

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
 
C

Carsten Haese

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
 
S

Shane Geiger

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 said:
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
(e-mail address removed) | 402-438-8958 | http://www.ncee.net

Leading the Campaign for Economic and Financial Literacy
 
P

PaoloB

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
 
P

PaoloB

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
 
O

olive

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.
 
G

Gerrit Muller

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>
 

Ask a Question

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

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,756
Messages
2,569,535
Members
45,008
Latest member
obedient dusk

Latest Threads

Top