Re: Libdoc doesn't appear to parse my library

134 views
Skip to first unread message

Janne Härkönen

unread,
Aug 1, 2012, 3:30:02 AM8/1/12
to robotframe...@googlegroups.com
Hello Stephen,

On 07/05/2012 08:01 PM, Stephen Opalenski wrote:
> I'm trying to use the libdoc utility to generate some documentation for
> my library but it doesn't seem to be working.
>
> I'm using Python 2.7.3 and Robot 2.7.3 on Ubuntu 12.04.
>
> My library is a sub-class of the Selenium2Library and is made up of
> static keywords. The library works fine with Robot normally and RIDE can
> also parse it with no problems.
>
> The library is written in python.
>
> The command i'm trying is like this:
>
> python -m robot.libdoc lib/testlibrary.py doc.html

This at least seems correct.

>
> The command 'python -m robot.libdoc lib/testlibrary.py list' doesn't
> list anything. 'Show' only shows the module docstring.

Can you enable robot syslog with `export ROBOT_SYSLOG_FILE=syslog.txt`,
and sending that for review. I cannot think of any particular reason why
the commands you use should fail.

thanks,
--J

--
Janne H�rk�nen | http://reaktor.fi
http://twitter.com/JanneHarkonen

Pekka Klärck

unread,
Aug 1, 2012, 3:40:20 AM8/1/12
to sopal...@gmail.com, robotframe...@googlegroups.com
2012/7/5 Stephen Opalenski <sopal...@gmail.com>:
>
> The command i'm trying is like this:
>
> python -m robot.libdoc lib/testlibrary.py doc.html
>
> The command 'python -m robot.libdoc lib/testlibrary.py list' doesn't list
> anything. 'Show' only shows the module docstring.
>
> The beginning of the file looks like this:
[snip]
>
> class TestLibrary(Selenium2Library):
> """An extension of the Selenium2Library."""

Your library class TestLibrary is in module testlibrary. Thus you need
to import the library like `testlibrary.TestLibrary` in the test data
and elsewhere. If your class was named the same as the module, Robot
would allow you to use just `LibraryName` (although
`LibraryName.LibraryName` would still work too).

When importing a library using a physical path, like you are doing now
with libdoc, there is no way to specify different class name than
module name. To make documentation generation work, you should thus
use something like this:

python -m robot.libdoc lib/testlibrary.py --pythonpath lib
testlibrary.TestLibrary doc.html

Alternatively you could rename your module and/or class so that they
would have the same name.

Cheers,
.peke
--
Agile Tester/Developer/Consultant :: http://eliga.fi
Lead Developer of Robot Framework :: http://robotframework.org

Stephen Opalenski

unread,
Aug 1, 2012, 10:40:29 AM8/1/12
to Pekka Klärck, robotframe...@googlegroups.com
Thanks for the respone Pekka.

I'll try that out.

Regards,
Steve

Cam Sparr

unread,
Sep 4, 2012, 3:05:52 PM9/4/12
to robotframe...@googlegroups.com, Pekka Klärck
Did this solution work? I am having basically the exact same problem, both renaming the class to the same as the module and adding '--pythonpath modulename.classname' to my call didn't work either.
Reply all
Reply to author
Forward
Message has been deleted
0 new messages