Plugin tests accessing private API

Summary

At present plugins are accessing private API in testing. This isn't too much of a problem now, while they're in the same source tree, but I don't think that bst-plugins-foo should be using internal BuildStream API in testing.

In particular there seem to be two places where plugins are accessing internal API:

  1. buildstream.testing.runcli.Result.assert_{main,task}_error() expect an ErrorDomain as the first argument, and often a LoadErrorReason as the second argument. These are defined in buildstream._exceptions and are not accessible through the testing API
  2. Many plugins are testing by generating projects and elements on the fly. To do this they use the internal yaml loader and dumper.

Possible fixes

To fix (1) I think it'd be best to just allow access to these two classes through buildstream.testing. To fix (2) I think we should make some wrapper functions to generate projects and elements, without projects having to fall back to using the internal yaml dumper.