开发者

Need help with KeyError when building epydoc files for project

开发者 https://www.devze.com 2023-01-22 09:16 出处:网络
I have a pylons project with an extensive set of functional tests that I want my manual QA\'s to be able to read from time to time, so I\'m using epydoc to build out the html pydocs on the function开发

I have a pylons project with an extensive set of functional tests that I want my manual QA's to be able to read from time to time, so I'm using epydoc to build out the html pydocs on the function开发者_Go百科al test modules.

It seems to be working fine. It generates the docs, and I can navigate through them without any apparent problems.

However, I'm getting a strange error when I run the epydoc build, and I'm not sure how to fix it:

+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------
| In project.tests.functional.resource:
| Import failed (but source code parsing was successful).
|     Error: KeyError: '__file__' (line 28)
|

+------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | In /Eclipse/product/project/server/src/project/tests/functional/resource/ftest_module1.py: | Import failed (but source code parsing was successful). | Error: KeyError: '__file__' (line 28) |

+------------------------------------------------------------------------------------------

There are a total of 2 packages and 8 modules on which this is happening. I thought at first, it might be the absence of docstrings at the head of the modules, or in the __init__ of the packages, but adding them did not fix it.

Here is a copy of the epydoc config file written specifically for the function tests:

[epydoc]
modules: project.tests.functional.resource,project.tests.functional.views
output: html
sourcecode: yes
#graph: none
target: ../pydoc/ftests
name: PROJECT
# exclude: test
private: no
imports: no
verbosity: 0
include-log: yes

And here is a copy of the shell script used to execute it:

#!/usr/bin/env bash
basedir=${0%/*}
cd "$basedir/../src"

etc="../etc"
pydoc="../pydoc"
pydoc_ftests="../pydoc/ftests"

mkdir -p $pydoc
mkdir -p $pydoc_ftests

epydoc -v --config $etc/epydoc.config
epydoc -v --config $etc/epydoc.ftests.config

Any suggestions?


What I ended up doing, finally, was just including --parse-only on the epydoc command, to force it not to import anything (thus working around the problem of unlocatable imports, but not really answering why it was happening at all). Not a perfect solution, but it satisfied the requirements...

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号