This repository has been archived by the owner. It is now read-only.
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
bin
clickreviews
data
debian
.gitignore
COPYING
Makefile
README
check-names.list
collect-check-names
collect-check-names-from-tests
run-pep8
run-pyflakes
run-tests
setup.cfg
setup.py

README

Runnable click and snap v1 tests:
- bin/click-check-bin-path: snappy bin-path tests
- bin/click-check-content-hub: content-hub hook tests
- bin/click-check-desktop: desktop hook tests
- bin/click-check-framework: click framework tests
- bin/click-check-functional: a few functional tests
- bin/click-check-lint: lint tests
- bin/click-check-online-accounts: online accounts tests
- bin/click-check-push-helper: push-helper tests
- bin/click-check-scope: scope tests
- bin/click-check-security: security hook tests
- bin/click-check-systemd: snappy systemd tests
- bin/click-check-url-dispatcher: url-dispatcher hook tests
- bin/click-run-checks: all tests

Runnable snap v2 tests:
- bin/snap-check-lint: lint tests
- bin/snap-run-checks: all tests

This gives an alternate view on bin/click-run-checks:
- bin/click-review

Running tests locally:
$ PYTHONPATH=$PWD ./bin/click-review /path/to/click

Importable tests:
- clickreviews/cr_lint.py: lint tests
- clickreviews/cr_security.py: security hook tests
- clickreviews/cr_desktop.py: desktop hook tests
- ...

In general, add or modify tests and report by using:
 self._add_result(<type>, <name>, <message>)

Where <type> is one of 'info', 'warn', 'error'. <name> is the name of the
test (prefixed by <review_type>_), which is set when creating a ClickReview
object. After all tests are run, if there are any errors, the exit status is
'2', if there are no errors but some warnings, the exit status is '1',
otherwise it is '0.

See click-check-skeleton and cr_skeleton.py for how to create new tests. In
short:
 * create a click-check-<something> and a cr_<something>.py script based off of
   the skeleton. IMPORTANT: the new script must be click-check-<something> so
   other tools that use click-reviewers-tools (eg, ubuntu-sdk) can find them.
 * modify click-check-<something> to use cr_<something>.py
 * add tests to cr_<something>.py. If you name the tests 'check_<sometest>'
   ClickReview.do_checks() will enumerate and run them automatically

(substitute 'sr_' for 'cr_' for snap v2 checks)

To run tests, just execute:
$ ./run-tests                       # all tests
$ ./run-tests test_cr_security.py   # only security tests


If you are going to develop the tools regularly, you might want to add a bzr
hook to run the testsuite before committing. Eg, add something like this to
~/.bazaar/plugins/hooks/__init__.py:

  #!/usr/bin/python
  from bzrlib.branch import Branch

  def run_tests_crt(local, master, old_revno, old_revid, new_revno, new_revid,
                    seven, eight):
      #print local, master, old_revno, old_revid, new_revno, new_revid, seven, eight
      if 'click-reviewers-tools' in master.base:
          import subprocess
          print ''
          rc = subprocess.call(['./run-tests'])
          if rc != 0:
              import sys
              sys.exit(1)

  Branch.hooks.install_named_hook('pre_commit',
                                  run_tests_crt,
                                  'click-reviewers-tools tests')


Keeping projects in sync
------------------------
In addition to archive uploads and SRUs, the following should also be updated:
- https://launchpad.net/~snappy-dev/+archive/ubuntu/tools-proposed
  then keep an eye on them and when ok, ask someone to push to:
  https://launchpad.net/~snappy-dev/+archive/ubuntu/tools
- https://launchpad.net/~ubuntu-sdk-team/+archive/ubuntu/staging
  then keep an eye on them and when ok, ask someone to push to:
  https://launchpad.net/~ubuntu-sdk-team/+archive/ubuntu/ppa
- the Ubuntu Store (ping beuno or pindonga to pull the changes from trunk)