package reportbug severity 495963 wishlist retitle 495963 python-coverage: show same coverage for symlink files as their target thanks
On 21-Aug-2008, Nicolas Évrard wrote: > % nosetests --cover-erase --with-coverage --cover-package=relatorio > > And it shows the following table after the tests has runned: > > Name Stmts Exec Cover Missing > ---------------------------------------------------------------- > relatorio 3 3 100% > relatorio.reporting 78 0 0% 21-146 > relatorio.templates 11 0 0% 21-39 > relatorio.templates.chart 48 0 0% 21-93 > relatorio.templates.opendocument 212 0 0% 21-331 > relatorio.templates.pdf 44 0 0% 21-86 > ---------------------------------------------------------------- > TOTAL 396 3 0% I believe python-coverage is behaving correctly in this case. Python doesn't care whether a module is actually a symlink on disk; different module files are different files. Indeed, modules should be implemented so that they work whether or not the filesystem supports symlinks. Python's namespace support makes this easy. The usual way to have 'relatorio.bar.foo.spam' be the same as 'relatorio.foo.spam' is not to have the module file appear multiple times on the filesystem, but instead to import one namespace into another: ===== relatorio/bar/__init__.py ===== ===== ===== relatorio/bar/foo.py ===== spam = "Spam" ===== ===== relatorio/__init__.py ===== from bar import foo ===== That way, 'spam', which was only defined in one module file, will be accessible both as 'relatorio.bar.foo.spam' and 'relatorio.foo.spam'. ===== >>> import relatorio >>> relatorio.foo.spam is relatorio.bar.foo.spam True ===== No symlinks are required, and your modules will continue to work the same when implemented on a system without symlink support. Based on this, I don't think this is a use case for which python-coverage should be adapted. I'm intending to mark this report "wontfix". -- \ “Military justice is to justice what military music is to | `\ music.” —Groucho Marx | _o__) | Ben Finney <[EMAIL PROTECTED]>
signature.asc
Description: Digital signature