Add setup.cfg for setuptools

This file is actually generated by the build system, if missing.
This makes debian packaging harder by having to maintain a patch for
the package so that each build & clean cycle results in the same tree.

While we're at it request setuptools to sign all source tarballs

Signed-off-by: Zygmunt Krynicki <zygmunt.krynicki@canonical.com>
Organize additional test utilities in testing_utils module

Signed-off-by: Zygmunt Krynicki <zygmunt.krynicki@canonical.com>
Rename TestResult to JobResult

In accordance with s/test/job/ rename done to definitions earlier
results got the same treatment. In addition, to keep their definition
internal for the moment, move all OUTCOME_xxx constants from abc.py
to result.py

Signed-off-by: Zygmunt Krynicki <zygmunt.krynicki@canonical.com>
Provide default values for some JobResource properties

Those just give the typical empty / none values and make the code
that uses them easier to write correctly.

Signed-off-by: Zygmunt Krynicki <zygmunt.krynicki@canonical.com>
Move a few JobResult methods around

Signed-off-by: Zygmunt Krynicki <zygmunt.krynicki@canonical.com>
Add docstring for JobResult.__init__()

Signed-off-by: Zygmunt Krynicki <zygmunt.krynicki@canonical.com>
Add unit tests for JobResult class

Signed-off-by: Zygmunt Krynicki <zygmunt.krynicki@canonical.com>
Merge branch 'feature/job-result' into develop
Fix incorrect logging messages in depmgr module

Logging module uses %-style formatting mini-language, not format-style
mini-language. This is actually reported at runtime but is hard to spot
at times.

Signed-off-by: Zygmunt Krynicki <zygmunt.krynicki@canonical.com>
Add logging to rfc822 module

There are just a few calls but they were very useful in debugging
some strangeness I've encountered while looking at broken output from
one script.

Signed-off-by: Zygmunt Krynicki <zygmunt.krynicki@canonical.com>
Fix incorrect docstring for rfc822.gen_rfc822_records

This was a copy-paste error from load_rfc82_records.

Signed-off-by: Zygmunt Krynicki <zygmunt.krynicki@canonical.com>
Fix RFC8222Record not to inherit from dict

This class is a simple container for two other variables, it should
not be a dictionary subclass. This was probably done while I experimented
and was left like that until it broke unit tests.

Signed-off-by: Zygmunt Krynicki <zygmunt.krynicki@canonical.com>
Add RFC822Record.__repr__()

Having a sensible repr on this class helps with duebgging. Especially
after adding logging to rfc822 module

Signed-off-by: Zygmunt Krynicki <zygmunt.krynicki@canonical.com>
Merge branch 'feature/rfc822-fixes' into develop
Add resource.ExpressionFailedError

This class is meant to be consumed by the UI layers to provide meaningful
error messages to the operator. The expression attribute can be used to
obtain the text of the expression that failed as well as the resource name
that is used by that expression. The resource name can be used to lookup
the (resource) job that produces such values.

Signed-off-by: Zygmunt Krynicki <zygmunt.krynicki@canonical.com>
Add resource.ExpressionCannotEvaluateError

Exception raised when a resource could not be evaluated because it requires
an unavailable resource.

Unlike the base class, this exception is raised before even running the
expression. As in the base class the exception object is meant to have
enough data to provide rich and meaningful error messages to the operator.
Expand docstrings in resource module

Add detailed docstrings to ResourceProgramError and ResourceExpression.
Reformat in ResourceProgram.

Signed-off-by: Zygmunt Krynicki <zygmunt.krynicki@canonical.com>
Remove ResourceLookupError

This exception was replaced with  the more accurate
ExpressionCannotEvaluateError class that essentially
serves the same function.

Signed-off-by: Zygmunt Krynicki <zygmunt.krynicki@canonical.com>
Drop IResourceContext and ResourceContext

This was a shallow interface that essentially declared an object
holding a map of resources. It was folded into a private attribute
on the upcoming SessionState object.

This commit breaks the code until session state support fully lands

Signed-off-by: Zygmunt Krynicki <zygmunt.krynicki@canonical.com>
Add __repr__() and __str__() to ResourceExpression

Signed-off-by: Zygmunt Krynicki <zygmunt.krynicki@canonical.com>