Code review comment for lp:~pwlars/lava-test/list

Revision history for this message
James Westby (james-w) wrote :

> > * Tests of the command logic using test doubles for things like
> > sys.stdout.
> I was able to something for this pretty easily for testing the command to list
> known tests. However writing a test for listing the installed tests and the
> results is something I'm having trouble seeing past. Obviously it's unlikely
> that tests would be installed or results would exist at the time of running
> the unittest, and I really don't want to rely on the actual default
> directories. I'd much rather have the config object return a fake path, that
> I can pre-fill with test data. I don't know of a way to do that though. Is
> it just because of how I handled the config object?

Having a global config makes this tricky.

If you are not forking a subprocess to run these commands then you can do
something like replace AbrekConfig with an object with known values.

If you are forking then you can set the env to point $HOME to a tempdir
that you create, containing config files with the desired contents.

Thanks,

James

« Back to merge proposal