Closed jeanconn closed 7 years ago
This still needs testing in a ska, but does this make sense as a fix for an incorrect path guess from testr? I think testr.test expects to go up 2 directories from Chandra/Time to run the tests, but Chandra/Time does not exist as a directory in this package.
If you are going down this path (YES, recommended!) then might as well bring it up to the modern standard: http://cxc.harvard.edu/mta/ASPECT/tool_doc/testr/#python-testing-helpers.
Though regarding moving Time.py to a directory, it looks like quite a few of the namespace package modules are set up this way (Chandra/Time.py, Chandra/Maneuver.py, Ska/File.py). Is there a reasonable way to help testr find either style without getting crazy about it?
That package organization (e.g. Chandra/Time.py) prevents distributing inline tests, so I would rather just bite the bullet and do things right. Basically that is just the wrong way to do things and a remnant of early lack of knowledge.
Note that in testr
a package without bundled inline tests should use a shell test script anyway and call py.test
(or whatever) directly.
Ah. I was confused about the definition of bundled inline tests, because Chandra.Time already had a test() method to call its own test. But I wasn't sure about the py.test magic to get it to work to report failures.
Pytest is really not so magical. When run from the command line it just gives a shell exit value of 1 if tests fail, and that signals testr
that there was a failure. When run as a main script it returns the number of failures.
I put in code to use a version.py but then removed it, because I'm not sure how to require that the code builds _axTime3.so before trying to import Chandra.Time (and that's a apparently problem if I try to import Chandra.Time.version or the like if I put version.py in Chandra/Time/).
No problem on the version. Astropy has some tricky machinery to handle this problem (injecting globals in the Python interpreter built-ins), but we don't need to do this.
Does MANIFEST.in need an update to match this move?
(I email replied with something like this earlier this evening but that looks lost).
Also, does the package and install process need to change? If I do python setup.py sdist
and try to install the package in my dev ska from skare I end up with
ValueError: 'Chandra/Time/_axTime3.pyx' doesn't match any files
It looks like the MANIFEST.in change seems to fix my missing Chandra/Time/_axTime3.pyx
issue, so maybe that's a two-for.
It wouldn't hurt, but I think that the spirit of PEP8 is about making external dependencies visible and well-organized. This is an internal package module and is not really a dependency.
Post-facto :+1: for merge.
Move Time.py to subdir to fix paths for testr