pytest2/_pytest
Jurko Gospodnetić 8e457338ee fix handling MarkDecorators called with a single positional plus keyword args
When a MarkDecorator instance is called it does the following:
  1. If called with a single class as its only positional argument and no
     additional keyword arguments, it attaches itself to the class so it gets
     applied automatically to all test cases found in that class.
  2. If called with a single function as its only positional argument and no
     additional keyword arguments, it attaches a MarkInfo object to the
     function, containing all the arguments already stored internally in the
     MarkDecorator.
  3. When called in any other case, it performs a 'fake construction' call, i.e.
     it returns a new MarkDecorator instance with the original MarkDecorator's
     content updated with the arguments passed to this call.

When Python applies a function decorator it always passes the target class/
function to the decorator as its positional argument with no additional
positional or keyword arguments. However, when MarkDecorator was deciding
whether it was being called to decorate a target function/class (cases 1. & 2.
as documented above) or to return an updated MarkDecorator (case 3. as
documented above), it only checked that it received a single callable positional
argument and did not take into consideration whether additional keyword
arguments were being passed in as well.

With this change, it is now possible to create a pytest mark storing a function/
class parameter passed as its only positional argument and accompanied by one or
more additional keyword arguments. Before, it was only possible to do so if the
function/class parameter argument was accompanied by at least one other
positional argument.

Added a related unit test.

Updated MarkDecorator doc-string.
2014-01-20 01:27:33 +01:00
..
assertion replace py.test module references with pytest 2014-01-18 12:31:33 +01:00
__init__.py fix issue409 -- better interoperate with cx_freeze by not 2013-12-18 14:56:45 +01:00
_argcomplete.py complete_dotted: fix for #361, filecompleter on dot files had differing behaviour from bash 2013-10-01 16:33:15 +02:00
capture.py avoid "IOError: Bad Filedescriptor" on pytest shutdown by not closing 2013-10-02 12:39:01 +02:00
config.py replace py.test module references with pytest 2014-01-18 12:31:33 +01:00
core.py replace py.test module references with pytest 2014-01-18 12:31:33 +01:00
doctest.py fix issue275 - allow usefixtures and autouse fixtures 2013-11-22 15:35:20 +01:00
genscript.py replace py.test module references with pytest 2014-01-18 12:31:33 +01:00
helpconfig.py replace py.test module references with pytest 2014-01-18 12:31:33 +01:00
hookspec.py replace py.test module references with pytest 2014-01-18 12:31:33 +01:00
impl - enhance ordering of tests using parametrized resources 2012-08-01 09:07:32 +02:00
junitxml.py fix issue404 by more strict junitxml escape 2013-12-13 10:28:23 +01:00
main.py replace py.test module references with pytest 2014-01-18 12:31:33 +01:00
mark.py fix handling MarkDecorators called with a single positional plus keyword args 2014-01-20 01:27:33 +01:00
monkeypatch.py fix tests on py32/py33 2013-10-22 11:26:29 +02:00
nose.py replace py.test module references with pytest 2014-01-18 12:31:33 +01:00
pastebin.py moving from optparse to argparse. Major difficulty is 2013-07-25 15:33:43 +02:00
pdb.py make "import pdb ; pdb.set_trace()" work natively wrt capturing (no "-s" needed 2013-09-06 15:29:00 +02:00
pytester.py fix comment typos 2014-01-18 12:39:16 +01:00
python.py fix comment typos 2014-01-18 12:39:16 +01:00
recwarn.py remove unused imports (using "importchecker" project) 2013-10-02 14:32:40 +02:00
resultlog.py fix issue380 by making --resultlog only rely on longrepr instead 2013-11-19 14:19:29 +01:00
runner.py replace py.test module references with pytest 2014-01-18 12:31:33 +01:00
skipping.py replace py.test module references with pytest 2014-01-18 12:31:33 +01:00
standalonetemplate.py fix flakes issues and make --flakes run part of tox runs 2013-10-12 15:39:22 +02:00
terminal.py replace py.test module references with pytest 2014-01-18 12:31:33 +01:00
tmpdir.py fix issue354: avoid tmpdir fixture to create too long filenames especially 2013-10-03 14:22:54 +02:00
unittest.py fix issue384 by removing the trial support code 2013-11-19 10:58:24 +01:00