3 new changesets in pytest: http://bitbucket.org/hpk42/pytest/changeset/4fe8f195ca70/ changeset: 4fe8f195ca70 user: hpk42 date: 2011-08-19 07:58:50 summary: bump version number, refine goodpractises wrt to importing test modules affected #: 4 files (639 bytes)
--- a/CHANGELOG Thu Aug 18 22:52:02 2011 +0200 +++ b/CHANGELOG Fri Aug 19 07:58:50 2011 +0200 @@ -1,4 +1,4 @@ -Changes between 2.1.0 and 2.1.1.DEV +Changes between 2.1.0 and 2.1.1 ---------------------------------------------- - fix error conditions involving the creation of __pycache__ --- a/_pytest/__init__.py Thu Aug 18 22:52:02 2011 +0200 +++ b/_pytest/__init__.py Fri Aug 19 07:58:50 2011 +0200 @@ -1,2 +1,2 @@ # -__version__ = '2.1.1.dev4' +__version__ = '2.1.1.dev5' --- a/doc/goodpractises.txt Thu Aug 18 22:52:02 2011 +0200 +++ b/doc/goodpractises.txt Fri Aug 19 07:58:50 2011 +0200 @@ -53,7 +53,7 @@ Integrating with distutils / ``python setup.py test`` -------------------------------------------------------- -You can easily integrate test runs into your distutils or +You can integrate test runs into your distutils or setuptools based project. Use the `genscript method`_ to generate a standalone py.test script:: @@ -106,9 +106,9 @@ * ``Test`` prefixed test classes (without an ``__init__`` method) * ``test_`` prefixed test functions or methods are test items -For examples of how to cnd cusotmize your test discovery :doc:`example/pythoncollection`. +For examples of how to customize your test discovery :doc:`example/pythoncollection`. -py.test additionally discovers tests using the standard +Within Python modules, py.test also discovers tests using the standard :ref:`unittest.TestCase <unittest.TestCase>` subclassing technique. Choosing a test layout / import rules @@ -138,7 +138,10 @@ test_app.py ... -You can always run your tests by pointing to it:: +In both cases you usually need to make sure that ``mypkg`` is importable, +for example by using the setuptools ``python setup.py develop`` method. + +You can run your tests by pointing to it:: py.test tests/test_app.py # for external test dirs py.test mypkg/test/test_app.py # for inlined test dirs @@ -150,18 +153,27 @@ .. note:: - Test modules are imported under their fully qualified name as follows: + If py.test finds a "a/b/test_module.py" test file while + recursing into the filesystem it determines the import name + as follows: * find ``basedir`` -- this is the first "upward" (towards the root) - directory not containing an ``__init__.py`` + directory not containing an ``__init__.py``. If both the ``a`` + and ``b`` directories contain an ``__init__.py`` the basedir will + be the parent dir of ``a``. - * perform ``sys.path.insert(0, basedir)`` to make the fully - qualified test module path importable. + * perform ``sys.path.insert(0, basedir)`` to make the test module + importable under the fully qualified import name. - * ``import path.to.test_module`` where the path is determined - by converting path separators into "." files. This means + * ``import a.b.test_module`` where the path is determined + by converting path separators ``/`` into "." characters. This means you must follow the convention of having directory and file - names map to the import names. + names map directly to the import names. + + The reason for this somewhat evolved importing technique is + that in larger projects multiple test modules might import + from each other and thus deriving a canonical import name helps + to avoid surprises such as a test modules getting imported twice. .. include:: links.inc --- a/setup.py Thu Aug 18 22:52:02 2011 +0200 +++ b/setup.py Fri Aug 19 07:58:50 2011 +0200 @@ -24,7 +24,7 @@ name='pytest', description='py.test: simple powerful testing with Python', long_description = long_description, - version='2.1.1.dev4', + version='2.1.1.dev5', url='http://pytest.org', license='MIT license', platforms=['unix', 'linux', 'osx', 'cygwin', 'win32'], http://bitbucket.org/hpk42/pytest/changeset/6c76059864ff/ changeset: 6c76059864ff user: hpk42 date: 2011-08-19 18:07:39 summary: merge affected #: 1 file (60 bytes) --- a/_pytest/assertion/rewrite.py Fri Aug 19 07:58:50 2011 +0200 +++ b/_pytest/assertion/rewrite.py Fri Aug 19 18:07:39 2011 +0200 @@ -15,6 +15,12 @@ from _pytest.assertion import util +# Windows gives ENOENT in places *nix gives ENOTDIR. +if sys.platform.startswith("win"): + PATH_COMPONENT_NOT_DIR = errno.ENOENT +else: + PATH_COMPONENT_NOT_DIR = errno.ENOTDIR + # py.test caches rewritten pycs in __pycache__. if hasattr(imp, "get_tag"): PYTEST_TAG = imp.get_tag() + "-PYTEST" @@ -106,8 +112,7 @@ # common case) or it's blocked by a non-dir node. In the # latter case, we'll ignore it in _write_pyc. pass - elif (e == errno.ENOTDIR or - sys.platform == "win32" and e == errno.ENOENT): + elif e == PATH_COMPONENT_NOT_DIR: # One of the path components was not a directory, likely # because we're in a zip file. write = False @@ -160,8 +165,7 @@ fp = open(pyc, "wb") except IOError: err = sys.exc_info()[1].errno - if (err == errno.ENOTDIR or - sys.platform == "win32" and err == errno.ENOENT): + if err == PATH_COMPONENT_NOT_DIR: # This happens when we get a EEXIST in find_module creating the # __pycache__ directory and __pycache__ is by some non-dir node. return False http://bitbucket.org/hpk42/pytest/changeset/e84d2d438b1a/ changeset: e84d2d438b1a user: hpk42 date: 2011-08-19 18:06:46 summary: adding issue numbers to the CHANGELOG affected #: 1 file (111 bytes) --- a/CHANGELOG Fri Aug 19 18:07:39 2011 +0200 +++ b/CHANGELOG Fri Aug 19 18:06:46 2011 +0200 @@ -1,13 +1,14 @@ Changes between 2.1.0 and 2.1.1 ---------------------------------------------- -- fix error conditions involving the creation of __pycache__ -- fix assertion rewriting on inserts involving strings containing '%' +- fix issue64 / pytest.set_trace now works within pytest_generate_tests hooks +- fix issue60 / fix error conditions involving the creation of __pycache__ +- fix issue63 / assertion rewriting on inserts involving strings containing '%' - fix assertion rewriting on calls with a ** arg - don't cache rewritten modules if bytecode generation is disabled - fix assertion rewriting in read-only directories - fix issue59: provide system-out/err tags for junitxml output -- fix assertion rewriting on boolean operations with 3 or more operands +- fix issue61: assertion rewriting on boolean operations with 3 or more operands - you can now build a man page with "cd doc ; make man" Changes between 2.0.3 and 2.1.0.DEV Repository URL: https://bitbucket.org/hpk42/pytest/ -- This is a commit notification from bitbucket.org. You are receiving this because you have the service enabled, addressing the recipient of this email. _______________________________________________ py-svn mailing list py-svn@codespeak.net http://codespeak.net/mailman/listinfo/py-svn