Make check files with python bindings.

John Ralls jralls at ceridwen.us
Sat May 17 13:19:52 EDT 2014


On May 17, 2014, at 4:34 AM, Mike Evans <mikee at saxicola.co.uk> wrote:

> On Sat, 17 May 2014 13:06 +0200
> Geert Janssens <janssens-geert at telenet.be> wrote:
> 
>> Do you have the python-test package installed ? Fedora has separated the 
>> test support from python-devel. I ran into this a few months back on 
>> Fedora 19 (20?) as well.
>> 
>> Geert
>> 
> Yes I do.
> Package python-test-2.7.3-13.fc18.i686 already installed and latest version
> 
> On My system:
> 
> rpm -qi --whatprovides /usr/lib/python2.7/test/test_support.py
> Name        : python-libs
> Version     : 2.7.3
> Release     : 13.fc18
> ...
> 
> So test support is installed it seems.  I can "import test" but there are no modules in test.
> 
> NB: Reading the Python docs at https://docs.python.org/2/library/test.html
> The top of the page says:
> 
> '''
> Note
> 
> The test package is meant for internal use by Python only. It is documented for the benefit of the core developers of Python. Any use of this package outside of Python’s standard library is discouraged as code mentioned here can change or be removed without notice between releases of Python.
> '''
> ?

You have to research in the appropriate historical context, which in this case would be Python 2.5: 
https://docs.python.org/2.5/lib/module-test.html
doesn't have that note, and the way the code was written is correct for the time it was written (2008).

Which doesn't mean that you shouldn't rewrite it in a more modern idiom, something like:
	import unittest
	import os

	os.environ["GNC_UNINSTALLED"] = "1"

	suite = unittest.TestLoader().discover('.')
	unittest.TextTestRunner(verbosity=2).run(suite)

Your change works too, although it produces a rather sparse runTests.py.log and relies on explicitly importing all of the test modules. This allows adding tests simply by adding new test modules to the directory; one needn't remember to import them in runTests.py.

While we're on the subject of runTests.py, we've got a configure substitution for the shebang. Is there some platform (MinGW maybe?) where `#!/usr/bin/env python` doesn't work?

Regards,
John Ralls





More information about the gnucash-devel mailing list