mercurial-reviewboard / TESTING

RUNNING TESTS
-------------

* WITHOUT VIRTUALENV

Install Python Mock, nose and Mercurial and run:

    nosetests

* WITH VIRTUALENV

You can use virtualenv to set up a virtual environment for testing.  This
is useful in environments such as automated continuous integration process,
where you want to isolate yourself from the global python environment and
pick up new dependencies automatically.

In order to set up the plugin tests for the first time, install virtualenv
and run:

    python mercurial_reviewboard/tests/virtualenv/bootstrap.py ENV --no-site-packages
    
or, optionally, target a particular version of Mercurial rather than the 
most recent one:

   HG_VERSION="Mercurial==1.4" python mercurial_reviewboard/tests/virtualenv/bootstrap.py ENV --no-site-packages

In order to run the tests, run:

    ENV/bin/nosetests
    

TEST DATA
---------

The test directory is structured like this:

  +-tests/  
    +-diffs/
    | +-<canonical diffs for testing>
    |
    +-repo_tars/
    | +-<tar files containing testing repositories>
    |
    +-repos/ (generated by test runner)
    | +-<expanded repo tars>
    |
    +-scripts/
    | +-<scripts that were used to create the diffs and repo tars>
    |
    +-<python scripts for unit and integration tests>
    
There is a package-level setup function in mercurial_reviewboard.tests.__init__
that will automatically recreate the repos directory for every test run.
Some tests use the diffs/ and repos/ data to exercise various aspects of the
tool.  When creating a new diff or repo for testing, place a shell script in the 
scripts directory with the appropriate logic and commit the script and 
the resulting diff or repo tar.
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.