Initial import

Signed-off-by: Zygmunt Krynicki <zygmunt.krynicki@canonical.com>
Fix README.md shell examples

The examples had (venv) and $ mixed up.

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

Ignore coverage data file (.coverage),
coverage html report (htmlcov), build and dist directories

Signed-off-by: Zygmunt Krynicki <zygmunt.krynicki@canonical.com>
Add mk-venv.sh

This simple scripts assists in creating a virtualenv suitable for
running and testing plainbox

Signed-off-by: Zygmunt Krynicki <zygmunt.krynicki@canonical.com>
Add plainbox.impl:get_plainbox_dir()

This function can locate the directory with the python plainbox package
It is used by various other parts of plainbox to discover resources
when running from a source checkout

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

Initial indent on multi-line values was lost. This made reading job
description harder. To fix this don't strip the whitespace at all
and use the inspect.cleandoc() function to remove all the leading indent
of equal length.

This solution feels hacky, we should migrate to email module later on

Signed-off-by: Zygmunt Krynicki <zygmunt.krynicki@canonical.com>
Update plainbox.abc module

This patch renames many essential symbols to match checkbox naming
more accurately. Many docstrings are updated and improved

ITestDefinition is renamed to IJobDefinition
(as not all jobs are actually testing anything).
IJobDefinition also grew the depends property.

TestResult gains additional OUTCOME_xxx values (unsupported
and unselected). They are temporary so far and this part is expected
to clean up once we run all the checkbox jobs successfully.
The test_name property is replaced with a job property that references
the original job definition.

IJobRunner (renamed from ITestRunner) has only cosmetic changes, having
the 'test' renamed to 'job' so the key method is now run_job()

A new base class, IResourceContext is introduced. The name may need
to change to be less confusing (IResourceManager?).


Signed-off-by: Zygmunt Krynicki <zygmunt.krynicki@canonical.com>
Drop the plainbox.impl.testdef module

This module was large and poorly named. It is being replaced by
multiple additional modules that are being added by subsequent patches.

Signed-off-by: Zygmunt Krynicki <zygmunt.krynicki@canonical.com>
Drop plainbox.impl.{main,utils,test_main} modules

Those modules are replaced by several other modules written almost
entirely from scratch

Signed-off-by: Zygmunt Krynicki <zygmunt.krynicki@canonical.com>
Add the plainbox.impl.{resource,test_resoure} modules

This module contains the implementation of the resource program
interpreter. The interpreter uses python syntax parser to check
if any disallowed syntax is being used. In addition it detects
the names of resources required by each expression.

Signed-off-by: Zygmunt Krynicki <zygmunt.krynicki@canonical.com>
Add plainbox.impl.{job,test_job} modules

The job module contains the implementation of the IJobDefinition interface
The class is pretty basic and may be further simplified as a generic data
container.

The only interesting parts are from_frc822_record() function
that does basic validation and instantiates a new object and the
get_resource_program() that compiles the resource program from the
text in the 'requires' property

Tests are pretty basic and there are a few blank spots

Signed-off-by: Zygmunt Krynicki <zygmunt.krynicki@canonical.com>
Add the plainbox.impl.result module

This module contains the implementation of ITestResult interface.
It is similar to JobDefinition in being a plain data container.
The API may need changes/additions but not all checkbox tests can
be started so no conclusive design process has been done.

There are no tests at all yet.

Signed-off-by: Zygmunt Krynicki <zygmunt.krynicki@canonical.com>
Add the plainbox.impl.checkbox module

This module allows one to use checkbox in a convenient way. It is possible
to both use a copy installed in a global location from a Debian package
and an uninstalled checkout that is added using the git submodule system.

There are no tests yet (apart from the parts that are invoked by running
other plainbox tests).

Signed-off-by: Zygmunt Krynicki <zygmunt.krynicki@canonical.com>
Add plainbox.impl.runner module

This module contains the implementation of the IJobRunner interface.

The JobRunner class has two public methods, the constructor and the
run_job(job) method. Everything else is an implementation detail.

There are multiple methods that implement running a job with
a particular plugin value. The _plugin_shell() and _plugin_resource()
being notable only implemented one.

Running actual commands is implemented in _run_command() with the
aid of _get_checkbox_env(). That part needs some more work to manage
implementing the io_log properly so that IO can be monitored in the UI
in real time.

The run_job() method also allows each _plugin_xxx() to return a TestResult
instance. This is something that may need generalizing so that things
like attachments can be managed sensibly.

There is no way to plug the UI in at all, this needs much more work to
be practical. There are no tests at all (apart from what gets executed
by other tests)

Signed-off-by: Zygmunt Krynicki <zygmunt.krynicki@canonical.com>
Add the plainbox.impl.box module

This module contains an attempt to implement a basic text user interface
and needs much more work to work properly (with the UI callbacks
and the rest of the APIs in a way that would scale to GTK or Qt-based UI)

It is also used as a simple way to implement the plainbox.public interface
but it may need to go away (as the public interface has not been reviewed
at all).

There are some basic smoke tests but nothing that actually runs jobs
yet. This part is a R&D component that allows me to understand how
the job runner should be implemented. As it matures it will influence
the public API design and the UI abstract base classes.

Signed-off-by: Zygmunt Krynicki <zygmunt.krynicki@canonical.com>
Update the plainbox.public module to use the box module

Some docstrings are also updated (to refer to either plainbox or checkbox
clearly). It also got affected by renaming of tests to jobs and similar
changes.

Signed-off-by: Zygmunt Krynicki <zygmunt.krynicki@canonical.com>
Add plainbox.tests module

This module aids the setuptools testrunner to discover all
tests without us having to manually maintain a list test cases

Signed-off-by: Zygmunt Krynicki <zygmunt.krynicki@canonical.com>
Add note on checkbox submodule to README.md

Update README.md with instructions and description on how to use the
checkbox source as submodule or from a global system package

Signed-off-by: Zygmunt Krynicki <zygmunt.krynicki@canonical.com>
Add support for '.' period syntax in RFC822 message body Add a check for duplicated keys Add the corresponding tests
README.MD additions and mk-venv.sh made parametrizable.

Organized and clarified README.md a bit, and made mk-venv.sh more
generically usable by allowing specification of venv directory.