By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
435,294 Members | 2,650 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 435,294 IT Pros & Developers. It's quick & easy.

Mocking OpenOffice in python?

P: n/a
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

Mar 14 '07 #1
Share this Question
Share on Google+
7 Replies


P: n/a
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
Mar 14 '07 #2

P: n/a
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
Mar 14 '07 #3

P: n/a
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
sg*****@ncee.net | 402-438-8958 | http://www.ncee.net

Leading the Campaign for Economic and Financial Literacy
Mar 14 '07 #4

P: n/a
On 14 Mar, 14:48, Carsten Haese <cars...@uniqsys.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
Mar 14 '07 #5

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

Mar 14 '07 #6

P: n/a
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.

Mar 15 '07 #7

P: n/a
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>
Mar 23 '07 #8

This discussion thread is closed

Replies have been disabled for this discussion.