]> git.ipfire.org Git - thirdparty/sqlalchemy/sqlalchemy.git/commitdiff
- reorganize tox options
authorMike Bayer <mike_mp@zzzcomputing.com>
Sun, 27 Jul 2014 01:18:19 +0000 (21:18 -0400)
committerMike Bayer <mike_mp@zzzcomputing.com>
Sun, 27 Jul 2014 01:18:19 +0000 (21:18 -0400)
README.unittests.rst
tox.ini

index 99ee1d9977658f2f700167ff31fc479ce0e08ea1..375d0737ce2ad3b0ddbfe8614182d20a371065cb 100644 (file)
@@ -285,44 +285,48 @@ coverage numbers are coming out as low/zero, try deleting all .pyc files.
 DEVELOPING AND TESTING NEW DIALECTS
 -----------------------------------
 
-See the new file README.dialects.rst for detail on dialects.
+See the file README.dialects.rst for detail on dialects.
 
 
 TESTING WITH MULTIPLE PYTHON VERSIONS USING TOX
 -----------------------------------------------
 
 If you want to test across multiple versions of Python, you may find `tox
-<http://tox.testrun.org/>`_ useful. To use it:
+<http://tox.testrun.org/>`_ useful.  SQLAlchemy includes a tox.ini file::
 
-1. Create a ``tox.ini`` file with the following:
+    tox -e full
 
-.. code-block:: ini
+SQLAlchemy uses tox mostly for pre-fab testing configurations, to simplify
+configuration of Jenkins jobs, and *not* for testing different Python
+interpreters simultaneously.  You can of course create whatever alternate
+tox.ini file you want.
 
-    # Tox (http://tox.testrun.org/) is a tool for running tests
-    # in multiple virtualenvs. This configuration file will run the
-    # test suite on all supported python versions. To use it, "pip install tox"
-    # and then run "tox" from this directory.
+Environments include::
 
-    [tox]
-    envlist = py26, py27, py33, py34, pypy
+    "full" - runs a full py.test
 
-    [testenv]
-    deps =
-        mock
-        nose
-    commands = {envpython} ./sqla_nose.py
+    "coverage" - runs a full py.test plus coverage, minus memusage
 
-2. Run::
+    "lightweight" - runs tests without the very heavy "memusage" tests, without
+    coverage.  Suitable running tests against pypy and for parallel testing.
 
-    pip install tox
+    "memusage" - runs only the memusage tests (very slow and heavy)
 
-3. Run::
+    "pep8" - runs flake8 against the codebase (useful with --diff to check
+    against a patch)
 
-    tox
 
-This will run the test suite on all the Python versions listed in the
-``envlist`` in the ``tox.ini`` file. You can also manually specify the versions
-to test against::
+PARALLEL TESTING
+----------------
+
+Parallel testing is supported using the Pytest xdist plugin.   Supported
+databases currently include sqlite, postgresql, and mysql.  The username
+for the database should have CREATE DATABASE and DROP DATABASE privileges.
+After installing pytest-xdist, testing is run adding the -n<num> option.
+For example, to run against sqlite, mysql, postgresql with four processes::
 
-    tox -e py26,py27,py33
+    tox -e lightweight -- -n 4 --db sqlite --db postgresql --db mysql
 
+Each backend has a different scheme for setting up the database.  Postgresql
+still needs the "test_schema" and "test_schema_2" schemas present, as the
+parallel databases are created using the base database as a "template".
diff --git a/tox.ini b/tox.ini
index 3a4caf5754240aaa90ffb6d65ca6c8a4bd98afbe..836831d31d75710fbef5771b5c4739e1bca81e60 100644 (file)
--- a/tox.ini
+++ b/tox.ini
@@ -1,5 +1,5 @@
 [tox]
-envlist = pyXX
+envlist = coverage, full, lightweight, memusage
 
 [testenv]
 deps=pytest
@@ -12,19 +12,25 @@ usedevelop=True
 
 commands=
   python -m pytest {posargs}
+envdir=pytest
 
+[testenv:full]
 
-[testenv:pyXX]
 
+[testenv:memusage]
+commands=
+  python -m pytest test/aaa_profiling/test_memusage.py {posargs}
 
-[testenv:pypyXX]
+[testenv:lightweight]
 commands=
   python -m pytest -k "not memusage" {posargs}
 
 [testenv:coverage]
 commands=
   python -m pytest \
-        --cov=sqlalchemy {posargs}
+        --cov=lib/sqlalchemy \
+        -k "not memusage" \
+        {posargs}
   python -m coverage xml --include=lib/sqlalchemy/*
 
 [testenv:pep8]