Testing

PyBBM has good unittest coverage. There is two way to test pybbm: a “multi-env way” via tox (multiple versions of Django, Python...), and a “local env way” with your version of python and locally installed python packages.

Testing in your local environment

If you want to contribute, you should use the “tox way” to test your contributions before creating a pull-request ! This testing way will allow you to test pybbm in your current local environnement. It is usefull if you have a specific environment which is not covered by tox.ini.

If you already have a working pybb in your environnement, you can go to the step 4. Else, steps 1-3 will allow you to have a minimal environnement to run pybb test project.

  1. Your environnement must be ready to use pip and install Pillow and lxml python packages. For Debian, the simplest way is to install debian python packages with their dependencies:

    sudo apt-get install python-pip python-lxml python-pillow
    
  2. Now, your environnement is ready to install python packages via pip. Install pybbm from your github fork with the “-e” option to be able to contribute, and install the test requirements:

    mkdir -p ~/tests/ && cd ~/tests/
    pip install --user -e git+git@github.com:yourGithubUsername/pybbm.git#egg=pybbm
    pip install --user -r src/pybbm/test/test_project/requirements_test.txt
    
  3. Now, add your user-local pip install directory and the pybbm directory to your PYTHONPATH:

    export PYTHONPATH=$PYTHONPATH:~/.local/lib/python2.7/site-packages/:~/tests/src/pybbm
    
  4. Now, you have an editable version of pybbm and you can run tests from the “test_project”:

    cd ~/tests/src/pybbm/test/test_project/
    python manage.py test pybb
    
  5. If you want to display a coverage summary and create a coverage HTML report:

    pip install --user coveralls
    PATH=$PATH:~/.local/bin/
    cd ~/tests/src/pybbm/test/test_project/
    coverage run --rcfile ../../.coveragerc manage.py test pybb
    coverage report
    coverage html
    

    Index HTML report is created in htmlcov/index.html