[Scons-dev] scons testing fixture dirs stuff has holes
Mats Wichmann
mats at wichmann.us
Sun Dec 1 16:10:10 EST 2019
I have a memory of someone mentioning something related, but I'm without
internet and not finding it in anything local, so writing this here.
This is what the fixture code looks like in part:
def dir_fixture(self, srcdir, dstdir=None):
"""Copies the contents of the specified folder srcdir from
the directory of the called script, to the current
working directory.
The srcdir name may be a list, in which case the elements are
concatenated with the os.path.join() method. The dstdir is
assumed to be under the temporary working directory, it gets
created automatically, if it does not already exist.
"""
if srcdir and self.fixture_dirs and not os.path.isabs(srcdir):
for dir in self.fixture_dirs:
spath = os.path.join(dir, srcdir)
if os.path.isdir(spath):
break
else:
spath = srcdir
Comment #1: the comment about srcdir able to be a list seems bogus,
there's nothing to handle that (trying to join a str and a list of str
will just give a TypeError). Not sure if this was intended to work as
documented?
Comment #2: if all of the joined paths in the loop are found not to
exist, and thus we don't break out with a valid spath, then we fall off
the end of the loop and leave spath set to the last (and invalid) joined
path. This is easy to fix. file_fixture has the same logic, btw.
There's no mention of fixtures in the test-harness tests - I know this
comment was on Discord recently (with no network, I'm just looking at a
black screen there) - so this doesn't get a shakedown.
More information about the Scons-dev
mailing list