Re: [Numpy-discussion] Test framework changes
On Fri, Jun 20, 2008 at 6:22 PM, Alan McIntyre [EMAIL PROTECTED] wrote: On Fri, Jun 20, 2008 at 7:22 PM, Fernando Perez [EMAIL PROTECTED] wrote: It may be worth bringing it up wtih the nose guys here: http://lists.idyll.org/listinfo/testing-in-python The nose author seems very responsive, and Titus Brown is on the list and cares a lot about numpy/scipy, and he may offer suggestions as well. Speaking of nose, I discovered why it couldn't find test_linalg.py; there was a working copy in the tests directory named test_linalg.pure.py that got copied into the numpy install and the name apparently confused nose. Moral: don't leave working files in the test directories. Chuck ___ Numpy-discussion mailing list Numpy-discussion@scipy.org http://projects.scipy.org/mailman/listinfo/numpy-discussion
Re: [Numpy-discussion] Test framework changes
These changes are now checked in, with the changes Robert suggested: numpy.test() returns a TextTestResult object again, and coverage (if enabled) is limited to the package from which test is called. The tests still fail because the buildbots don't have nose installed, though. On Fri, Jun 20, 2008 at 5:01 PM, Alan McIntyre [EMAIL PROTECTED] wrote: Hi all, Just wanted to get feedback about the following changes before I make them. Please speak up if any of this seems objectionable to you. - The old test framework classes will be restored, but will not be used anywhere in NumPy's tests. If your old tests still don't work with the restored classes, please let me know and I'll fix it. - Add a function to numpy.testing to execute a module's tests via the if __name__ == '__main__' hook. It takes one optional argument, the name of the file to run (if not present, it uses the same method as NoseTester to look it up from the stack). The intent is to make the boilerplate as simple as possible. if __name__ == '__main__': run_module_suite() If somebody has a suggestion for a better name, I'd love to hear it. I didn't want test in the name, because then I have to explicitly tell nose to ignore it when it's looking for test functions. - Remove numpy/testing/pkgtester.py since it now just has one line of code that imports NoseTester (as Tester) from nosetester.py (it used to create a null tester if nose wasn't present, but this was removed by porting of r4424 from SciPy). NoseTester will still be made available as numpy.testing.Tester. - numpy.test (and all the other test functions in subpackages) will take the following positional arguments: label, verbose, extra_argv, doctests, coverage (the same arguments as SciPy.test except for the new coverage option). The old arguments can be passed in as keyword arguments (which seems to be how they were passed in in all the examples I could find), and they will be emulated as much as possible by the new test suite, but a deprecation warning will be issued. - numpy.test now returns an object with a wasSuccessful method; under the old test framework it returned a unittest._TextTestResult, but since nose.run only returns success/failure, I'm just wrapping this result in a dummy object to match the old behavior until I can figure out how to get a real _TextTestResult from nose. (The two changes to numpy.test should allow the buildbots to run the tests properly again) Thanks, Alan ___ Numpy-discussion mailing list Numpy-discussion@scipy.org http://projects.scipy.org/mailman/listinfo/numpy-discussion
[Numpy-discussion] Test framework changes
Hi all, Just wanted to get feedback about the following changes before I make them. Please speak up if any of this seems objectionable to you. - The old test framework classes will be restored, but will not be used anywhere in NumPy's tests. If your old tests still don't work with the restored classes, please let me know and I'll fix it. - Add a function to numpy.testing to execute a module's tests via the if __name__ == '__main__' hook. It takes one optional argument, the name of the file to run (if not present, it uses the same method as NoseTester to look it up from the stack). The intent is to make the boilerplate as simple as possible. if __name__ == '__main__': run_module_suite() If somebody has a suggestion for a better name, I'd love to hear it. I didn't want test in the name, because then I have to explicitly tell nose to ignore it when it's looking for test functions. - Remove numpy/testing/pkgtester.py since it now just has one line of code that imports NoseTester (as Tester) from nosetester.py (it used to create a null tester if nose wasn't present, but this was removed by porting of r4424 from SciPy). NoseTester will still be made available as numpy.testing.Tester. - numpy.test (and all the other test functions in subpackages) will take the following positional arguments: label, verbose, extra_argv, doctests, coverage (the same arguments as SciPy.test except for the new coverage option). The old arguments can be passed in as keyword arguments (which seems to be how they were passed in in all the examples I could find), and they will be emulated as much as possible by the new test suite, but a deprecation warning will be issued. - numpy.test now returns an object with a wasSuccessful method; under the old test framework it returned a unittest._TextTestResult, but since nose.run only returns success/failure, I'm just wrapping this result in a dummy object to match the old behavior until I can figure out how to get a real _TextTestResult from nose. (The two changes to numpy.test should allow the buildbots to run the tests properly again) Thanks, Alan ___ Numpy-discussion mailing list Numpy-discussion@scipy.org http://projects.scipy.org/mailman/listinfo/numpy-discussion
Re: [Numpy-discussion] Test framework changes
On Fri, Jun 20, 2008 at 16:01, Alan McIntyre [EMAIL PROTECTED] wrote: - numpy.test now returns an object with a wasSuccessful method; under the old test framework it returned a unittest._TextTestResult, but since nose.run only returns success/failure, I'm just wrapping this result in a dummy object to match the old behavior until I can figure out how to get a real _TextTestResult from nose. So NoseTester.run() basically just calls nose.run(). That basically just instantiates nose.core.TestProgram and returns the .success attribute of it. Unfortunately, the TextTestResults object (a nose subclass of unittest._TextTestResults) gets created and discarded inside the nose.core.TestProgram.runTests() method. However, if you were to subclass it and override that method to store the TextTestResults to an attribute, you could return it from NoseTester.run(). -- Robert Kern I have come to believe that the whole world is an enigma, a harmless enigma that is made terrible by our own mad attempt to interpret it as though it had an underlying truth. -- Umberto Eco ___ Numpy-discussion mailing list Numpy-discussion@scipy.org http://projects.scipy.org/mailman/listinfo/numpy-discussion
Re: [Numpy-discussion] Test framework changes
On Fri, Jun 20, 2008 at 5:35 PM, Robert Kern [EMAIL PROTECTED] wrote: So NoseTester.run() basically just calls nose.run(). That basically just instantiates nose.core.TestProgram and returns the .success attribute of it. Unfortunately, the TextTestResults object (a nose subclass of unittest._TextTestResults) gets created and discarded inside the nose.core.TestProgram.runTests() method. However, if you were to subclass it and override that method to store the TextTestResults to an attribute, you could return it from NoseTester.run(). Yep. I was hoping there was some built-in way to get to the details of the results via the nose API, but that doesn't appear to be something the nose developers considered. I'll probably go ahead and do as you suggested instead of making a temporary class to hold the result. ___ Numpy-discussion mailing list Numpy-discussion@scipy.org http://projects.scipy.org/mailman/listinfo/numpy-discussion
Re: [Numpy-discussion] Test framework changes
On Fri, Jun 20, 2008 at 3:04 PM, Alan McIntyre [EMAIL PROTECTED] wrote: On Fri, Jun 20, 2008 at 5:35 PM, Robert Kern [EMAIL PROTECTED] wrote: So NoseTester.run() basically just calls nose.run(). That basically just instantiates nose.core.TestProgram and returns the .success attribute of it. Unfortunately, the TextTestResults object (a nose subclass of unittest._TextTestResults) gets created and discarded inside the nose.core.TestProgram.runTests() method. However, if you were to subclass it and override that method to store the TextTestResults to an attribute, you could return it from NoseTester.run(). Yep. I was hoping there was some built-in way to get to the details of the results via the nose API, but that doesn't appear to be something the nose developers considered. I'll probably go ahead and do as you suggested instead of making a temporary class to hold the result. It may be worth bringing it up wtih the nose guys here: http://lists.idyll.org/listinfo/testing-in-python The nose author seems very responsive, and Titus Brown is on the list and cares a lot about numpy/scipy, and he may offer suggestions as well. Cheers, f ___ Numpy-discussion mailing list Numpy-discussion@scipy.org http://projects.scipy.org/mailman/listinfo/numpy-discussion
Re: [Numpy-discussion] Test framework changes
On Fri, Jun 20, 2008 at 7:22 PM, Fernando Perez [EMAIL PROTECTED] wrote: It may be worth bringing it up wtih the nose guys here: http://lists.idyll.org/listinfo/testing-in-python The nose author seems very responsive, and Titus Brown is on the list and cares a lot about numpy/scipy, and he may offer suggestions as well. Thanks, I'll do that. :) ___ Numpy-discussion mailing list Numpy-discussion@scipy.org http://projects.scipy.org/mailman/listinfo/numpy-discussion