summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMike Bayer <mike_mp@zzzcomputing.com>2010-11-15 19:25:34 -0500
committerMike Bayer <mike_mp@zzzcomputing.com>2010-11-15 19:25:34 -0500
commit756aa2724e495b8a969bca73d133b27615a343e7 (patch)
tree8e22e4f714c52933ab4cdca538194660524e86f1
parent40d5a32e59a49075129211358f00e857dac73885 (diff)
downloadsqlalchemy-756aa2724e495b8a969bca73d133b27615a343e7.tar.gz
first step of [ticket:1949], remove the setuptools aspect
of the plugin, move it to test/bootstrap
-rw-r--r--README.py3k14
-rw-r--r--README.unittests65
-rw-r--r--lib/sqlalchemy/test/__init__.py2
-rw-r--r--lib/sqlalchemy/test/engines.py2
-rw-r--r--lib/sqlalchemy/test/profiling.py1
-rw-r--r--lib/sqlalchemy/test/testing.py2
-rw-r--r--setup.py7
-rwxr-xr-xsqla_nose.py11
-rw-r--r--test/bootstrap/__init__.py (renamed from lib/sqlalchemy_nose/__init__.py)0
-rw-r--r--test/bootstrap/config.py (renamed from lib/sqlalchemy_nose/config.py)0
-rw-r--r--test/bootstrap/noseplugin.py (renamed from lib/sqlalchemy_nose/noseplugin.py)4
11 files changed, 30 insertions, 78 deletions
diff --git a/README.py3k b/README.py3k
index 95ecb7f3a..b69fe3d2c 100644
--- a/README.py3k
+++ b/README.py3k
@@ -39,17 +39,9 @@ The above will rewrite all files in-place in Python 3 format.
Running Tests
-------------
-To run the unit tests, ensure Distribute is installed as above,
-and also that at least the ./lib/ and ./test/ directories have been converted
-to Python 3 using the source tool above. A Python 3 version of Nose
-can be acquired from Bitbucket using Mercurial:
-
- hg clone http://bitbucket.org/jpellerin/nose3/
- cd nose3
- python3 setup.py install
-
-The tests can then be run using the "nosetests3" script installed by the above,
-using the same instructions in README.unittests.
+To run unit tests in Py3k, Nose 1.0 is required, or a development
+version of Nose that supports Python 3. The tests are run
+using ./sqla_nose.py as described in README.unittests.
Current 3k Issues
-----------------
diff --git a/README.unittests b/README.unittests
index 6b2320907..6c4353b35 100644
--- a/README.unittests
+++ b/README.unittests
@@ -16,48 +16,25 @@ Or using setuptools:
$ easy_install nose
SQLAlchemy implements a nose plugin that must be present when tests are run.
-This plugin is available when SQLAlchemy is installed via setuptools.
+This plugin is invoked when the test runner script provided with
+SQLAlchemy is used.
-INSTANT TEST RUNNER
--------------------
-
-A plain vanilla run of all tests using sqlite can be run via setup.py:
-
- $ python setup.py test
-
-(NOTE: this command is broken for Python 2.7 with nose 0.11.3, see
-Nose issue 340. You will need to use 'nosetests' directly, see below.)
-
-Setuptools will take care of the rest ! To run nose directly and have
-its full set of options available, read on...
-
-SETUP
------
-
-All that's required is for SQLAlchemy to be installed via setuptools.
-For example, to create a local install in a source distribution directory:
-
- $ export PYTHONPATH=.
- $ python setup.py develop -d .
-
-The above will create a setuptools "development" distribution in the local
-path, which allows the Nose plugin to be available when nosetests is run.
-The plugin is enabled using the "with-sqlalchemy=True" configuration
-in setup.cfg.
+**NOTE:** - the nose plugin is no longer installed by setuptools as of
+version 0.7 ! Please use sqla_nose.py to run tests.
RUNNING ALL TESTS
-----------------
To run all tests:
- $ nosetests
+ $ ./sqla_nose.py
(NOTE: if running with Python 2.7 and nose 0.11.3, add "-w test/" to the command.
Again this is a Nose issue, see Nose issue 342.)
If you're running the tests on Microsoft Windows, then there is an additional
-argument that must be passed to nosetests:
+argument that must be passed to ./sqla_nose.py:
- > nosetests --first-package-wins=True
+ > ./sqla_nose.py --first-package-wins=True
This is required because nose’s importer will normally evict a package from
sys.modules if it sees a package with the same name in a different location.
@@ -66,39 +43,29 @@ Setting this argument disables that behavior.
Assuming all tests pass, this is a very unexciting output. To make it more
intersesting:
- $ nosetests -v
-
-ALTERNATE TEST RUNNER
----------------------
-
-The script "sqla_nose.py" is a front-end to Nose which manually associates
-the SQLAlchemy testing plugin with Nose at runtime. This script can run the
-tests without any reliance upon setuptools. In 0.7 we'll be removing the
-Nose plugin from setup, so this will be the way going forward to run tests:
-
- $ python sqla_nose.py -v
+ $ ./sqla_nose.py -v
RUNNING INDIVIDUAL TESTS
-------------------------
Any directory of test modules can be run at once by specifying the directory
path:
- $ nosetest test/dialect
+ $ ./sqla_nose.py test/dialect
Any test module can be run directly by specifying its module name:
- $ nosetests test.orm.test_mapper
+ $ ./sqla_nose.py test.orm.test_mapper
To run a specific test within the module, specify it as module:ClassName.methodname:
- $ nosetests test.orm.test_mapper:MapperTest.test_utils
+ $ ./sqla_nose.py test.orm.test_mapper:MapperTest.test_utils
COMMAND LINE OPTIONS
--------------------
Help is available via --help:
- $ nosetests --help
+ $ ./sqla_nose.py --help
The --help screen is a combination of common nose options and options which
the SQLAlchemy nose plugin adds. The most commonly SQLAlchemy-specific
@@ -186,7 +153,7 @@ Additional steps specific to individual databases are as follows:
If you'll be running the tests frequently, database aliases can save a lot of
typing. The --dbs option lists the built-in aliases and their matching URLs:
- $ nosetests --dbs
+ $ ./sqla_nose.py --dbs
Available --db options (use --dburi to override)
mysql mysql://scott:tiger@127.0.0.1:3306/test
oracle oracle://scott:tiger@127.0.0.1:1521
@@ -195,7 +162,7 @@ typing. The --dbs option lists the built-in aliases and their matching URLs:
To run tests against an aliased database:
- $ nosetests --db=postgresql
+ $ ./sqla_nose.py --db=postgresql
To customize the URLs with your own users or hostnames, make a simple .ini
file called `test.cfg` at the top level of the SQLAlchemy source distribution
@@ -213,7 +180,7 @@ SQLAlchemy logs its activity and debugging through Python's logging package.
Any log target can be directed to the console with command line options, such
as:
- $ nosetests test.orm.unitofwork --log-info=sqlalchemy.orm.mapper \
+ $ ./sqla_nose.py test.orm.unitofwork --log-info=sqlalchemy.orm.mapper \
--log-debug=sqlalchemy.pool --log-info=sqlalchemy.engine
This would log mapper configuration, connection pool checkouts, and SQL
@@ -225,7 +192,7 @@ BUILT-IN COVERAGE REPORTING
Coverage is tracked using Nose's coverage plugin. See the nose
documentation for details. Basic usage is:
- $ nosetests test.sql.test_query --with-coverage
+ $ ./sqla_nose.py test.sql.test_query --with-coverage
BIG COVERAGE TIP !!! There is an issue where existing .pyc files may
store the incorrect filepaths, which will break the coverage system. If
diff --git a/lib/sqlalchemy/test/__init__.py b/lib/sqlalchemy/test/__init__.py
index 7356945d2..e82b3ac91 100644
--- a/lib/sqlalchemy/test/__init__.py
+++ b/lib/sqlalchemy/test/__init__.py
@@ -6,7 +6,7 @@ by noseplugin.NoseSQLAlchemy.
"""
-from sqlalchemy_nose import config
+from test.bootstrap import config
from sqlalchemy.test import testing, engines, requires, profiling, pickleable
from sqlalchemy.test.schema import Column, Table
from sqlalchemy.test.testing import \
diff --git a/lib/sqlalchemy/test/engines.py b/lib/sqlalchemy/test/engines.py
index 870f984ec..d18b8c8cf 100644
--- a/lib/sqlalchemy/test/engines.py
+++ b/lib/sqlalchemy/test/engines.py
@@ -1,6 +1,6 @@
import sys, types, weakref
from collections import deque
-from sqlalchemy_nose import config
+from test.bootstrap import config
from sqlalchemy.util import function_named, callable
import re
import warnings
diff --git a/lib/sqlalchemy/test/profiling.py b/lib/sqlalchemy/test/profiling.py
index 835253a3a..6f839897d 100644
--- a/lib/sqlalchemy/test/profiling.py
+++ b/lib/sqlalchemy/test/profiling.py
@@ -6,7 +6,6 @@ in a more fine-grained way than nose's profiling plugin.
"""
import os, sys
-from sqlalchemy_nose import config
from sqlalchemy.test.util import function_named, gc_collect
from nose import SkipTest
diff --git a/lib/sqlalchemy/test/testing.py b/lib/sqlalchemy/test/testing.py
index 12cbe5e02..46723baa0 100644
--- a/lib/sqlalchemy/test/testing.py
+++ b/lib/sqlalchemy/test/testing.py
@@ -8,7 +8,7 @@ import types
import warnings
from cStringIO import StringIO
-from sqlalchemy_nose import config
+from test.bootstrap import config
from sqlalchemy.test import assertsql, util as testutil
from sqlalchemy.util import function_named, py3k
from engines import drop_all_tables
diff --git a/setup.py b/setup.py
index 7a8a0f3f2..0e9b18c66 100644
--- a/setup.py
+++ b/setup.py
@@ -56,7 +56,7 @@ elif BUILD_CEXTENSIONS:
def find_packages(dir_):
packages = []
- for pkg in ['sqlalchemy', 'sqlalchemy_nose']:
+ for pkg in ['sqlalchemy']:
for _dir, subdirectories, files in os.walk(os.path.join(dir_, pkg)):
if '__init__.py' in files:
lib, fragment = _dir.split(os.sep, 1)
@@ -88,11 +88,6 @@ setup(name = "SQLAlchemy",
tests_require = ['nose >= 0.11'],
test_suite = "nose.collector",
- entry_points = {
- 'nose.plugins.0.10': [
- 'sqlalchemy = sqlalchemy_nose.noseplugin:NoseSQLAlchemy',
- ]
- },
long_description = """\
SQLAlchemy is:
diff --git a/sqla_nose.py b/sqla_nose.py
index 302fb5b08..6482958cb 100755
--- a/sqla_nose.py
+++ b/sqla_nose.py
@@ -8,12 +8,11 @@ require that SQLA's testing plugin be installed via setuptools.
"""
import sys
-try:
- from sqlalchemy_nose.noseplugin import NoseSQLAlchemy
-except ImportError:
- from os import path
- sys.path.append(path.join(path.dirname(path.abspath(__file__)), 'lib'))
- from sqlalchemy_nose.noseplugin import NoseSQLAlchemy
+from os import path
+for pth in ['.', './lib']:
+ sys.path.insert(0, path.join(path.dirname(path.abspath(__file__)), pth))
+
+from test.bootstrap.noseplugin import NoseSQLAlchemy
import nose
diff --git a/lib/sqlalchemy_nose/__init__.py b/test/bootstrap/__init__.py
index e69de29bb..e69de29bb 100644
--- a/lib/sqlalchemy_nose/__init__.py
+++ b/test/bootstrap/__init__.py
diff --git a/lib/sqlalchemy_nose/config.py b/test/bootstrap/config.py
index 7d528a04b..7d528a04b 100644
--- a/lib/sqlalchemy_nose/config.py
+++ b/test/bootstrap/config.py
diff --git a/lib/sqlalchemy_nose/noseplugin.py b/test/bootstrap/noseplugin.py
index 8732142f7..f010641f6 100644
--- a/lib/sqlalchemy_nose/noseplugin.py
+++ b/test/bootstrap/noseplugin.py
@@ -10,9 +10,9 @@ import StringIO
import nose.case
from nose.plugins import Plugin
-from sqlalchemy_nose import config
+from test.bootstrap import config
-from sqlalchemy_nose.config import (
+from test.bootstrap.config import (
_create_testing_engine, _engine_pool, _engine_strategy, _engine_uri, _list_dbs, _log,
_prep_testing_database, _require, _reverse_topological, _server_side_cursors,
_set_table_options, base_config, db, db_label, db_url, file_config, post_configure)