Changeset - 2d2decce586f
[Not reviewed]
default
0 3 0
Thomas De Schampheleire - 10 years ago 2016-02-03 22:26:25
thomas.de.schampheleire@gmail.com
pytest migration: update documentation

Update documentation and comments to refer to pytest instead of nose.
3 files changed with 25 insertions and 21 deletions:
0 comments (0 inline, 0 general)
docs/contributing.rst
Show inline comments
 
@@ -46,33 +46,47 @@ on Bitbucket_ and create a local clone o
 

	
 

	
 
Running tests
 
-------------
 

	
 
After finishing your changes make sure all tests pass cleanly. You can run
 
the testsuite running ``nosetests`` from the project root, or if you use tox
 
the testsuite running ``py.test`` from the project root, or if you use tox
 
run ``tox`` for Python 2.6--2.7 with multiple database test.
 

	
 
When running tests, Kallithea uses `kallithea/tests/test.ini` and populates the
 
SQLite database specified there.
 

	
 
It is possible to avoid recreating the full test database on each invocation of
 
the tests, thus eliminating the initial delay. To achieve this, run the tests as::
 

	
 
    paster serve kallithea/tests/test.ini --pid-file=test.pid --daemon
 
    KALLITHEA_WHOOSH_TEST_DISABLE=1 KALLITHEA_NO_TMP_PATH=1 nosetests
 
    KALLITHEA_WHOOSH_TEST_DISABLE=1 KALLITHEA_NO_TMP_PATH=1 py.test
 
    kill -9 $(cat test.pid)
 

	
 
You can run individual tests by specifying their path as argument to nosetests.
 
nosetests also has many more options, see `nosetests -h`. Some useful options
 
In these commands, the following variables are used::
 

	
 
    KALLITHEA_WHOOSH_TEST_DISABLE=1 - skip whoosh index building and tests
 
    KALLITHEA_NO_TMP_PATH=1 - disable new temp path for tests, used mostly for testing_vcs_operations
 

	
 
You can run individual tests by specifying their path as argument to py.test.
 
py.test also has many more options, see `py.test -h`. Some useful options
 
are::
 

	
 
    -x, --stop            Stop running tests after the first error or failure
 
    -s, --nocapture       Don't capture stdout (any stdout output will be
 
                          printed immediately) [NOSE_NOCAPTURE]
 
    --failed              Run the tests that failed in the last test run.
 
    -k EXPRESSION         only run tests which match the given substring
 
                          expression. An expression is a python evaluatable
 
                          expression where all names are substring-matched
 
                          against test names and their parent classes. Example:
 
    -x, --exitfirst       exit instantly on first error or failed test.
 
    --lf                  rerun only the tests that failed at the last run (or
 
                          all if none failed)
 
    --ff                  run all tests but run the last failures first. This
 
                          may re-order tests and thus lead to repeated fixture
 
                          setup/teardown
 
    --pdb                 start the interactive Python debugger on errors.
 
    -s, --capture=no      don't capture stdout (any stdout output will be
 
                          printed immediately)
 

	
 

	
 
Coding/contribution guidelines
 
------------------------------
 

	
 
Kallithea is GPLv3 and we assume all contributions are made by the
kallithea/i18n/how_to
Show inline comments
 
@@ -91,7 +91,7 @@ Testing translations
 
Edit kallithea/tests/test.ini file and set lang attribute to::
 

	
 
    lang=<new_language_code>
 

	
 
Run Kallithea tests by executing::
 

	
 
    nosetests
 
    py.test
kallithea/tests/__init__.py
Show inline comments
 
@@ -12,28 +12,18 @@
 
# You should have received a copy of the GNU General Public License
 
# along with this program.  If not, see <http://www.gnu.org/licenses/>.
 

	
 
"""
 
Pylons application test package
 

	
 
This package assumes the Pylons environment is already loaded, such as
 
when this script is imported from the `nosetests --with-pylons=test.ini`
 
command.
 
This package assumes the Pylons environment is already loaded.
 

	
 
This module initializes the application via ``websetup`` (`paster
 
setup-app`) and provides the base testing objects.
 

	
 
nosetests -x - fail on first error
 
nosetests kallithea.tests.functional.test_admin_settings:TestSettingsController.test_my_account
 
nosetests --pdb --pdb-failures
 
nosetests --with-coverage --cover-package=kallithea.model.validators kallithea.tests.test_validators
 

	
 
optional FLAGS:
 
    KALLITHEA_WHOOSH_TEST_DISABLE=1 - skip whoosh index building and tests
 
    KALLITHEA_NO_TMP_PATH=1 - disable new temp path for tests, used mostly for test_vcs_operations
 

	
 
Refer to docs/contributing.rst for details on running the test suite.
 
"""
 
import os
 
import re
 
import time
 
import logging
 
import datetime
0 comments (0 inline, 0 general)