Test programs assumptions
Martin Schulze
joey at infodrom.org
Thu Mar 18 13:06:13 CET 2004
Moin!
Hmm, I guess I need more information.
Bernhard Herzog wrote:
> > How are test programs outside the main test/ directory supposed to be
> > executed?
>
> Someday maybe. At first this will only be the case for the code under
> Extensions/. There is already one example of that:
> Extensions/svgexport/test/. You can add additional directories with
> tests in test/runtests.py (look for "svgexport").
Does this imply that other tests outside the test/ directory
(i.e. ../Extension/**/test/test*.py) will be executed from within the
test/ directory if they get included in the normal test suite?
> > I wonder how they will be called and especially which assumptions with
> > regards to the current working directory
>
> It's best if the code makes no assumptions about the current directory.
> The code in test/ unfortunately relies on the current direcory being
> that test/ directory. That ought to be fixed, but I didn't have time
> for that yet.
As soon as you want to import other modules, load files, run external
programs you have to make assumptions on the paths, which is why I
ask, so I know how the tools are supposed to work.
> Furthermore not code anywhere in Thuban, including tests should change
> the current directory.
Ack.
Hmm, I'll rephrase my original question:
[ ] **/test/test_*.py except for the test programs in the test/
directory are supposed to run from the Thuban main directory
(which is not test/ but rather test/../)
[ ] **/test/test_*.py except for the test programs in the test/
directory are supposed to run from the Thuban test/ directory
[ ] **/test/test_*.py are only supposed to run from the directory
they are placed in
> The code can assume that third-party non-optional libraries on which
> Thuban depends are present and can be imported in the normal way.
> Optional libraries should be optional for the test cases too, but tests
> that cannot be run because of missing optional libraries should be
> skipped by raising the SkipTest exception defined in test/support.py so
> that it is obvious that some tests were not run and for what reason.
I see, will adjust test_ogclib accordingly since it just exists if the
PyOGCLib isn't found.
> See test/postgissupport.py for this might be used. If you raise
> SkipTest you need to use support.run_tests instead of unittest.main so
> that it is handled as intended (with the normal unittest it would be
> flagged as an error).
Which leads me back to my initial question, which directory to assume
besides the one the test is stored in, since support.py is either
test.support, support or ../../../test/support.
Regards,
Joey
--
The MS-DOS filesystem is nice for removable media. -- H. Peter Anvin
More information about the Thuban-devel
mailing list
This site is hosted by Intevation GmbH (Datenschutzerklärung und Impressum | Privacy Policy and Imprint)