test_ok2/testing
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
..
python remove unused var (fixes flakes tests) 2013-12-16 12:38:15 +01:00
acceptance_test.py trim trailing spaces 2014-01-18 10:40:20 +01:00
conftest.py simplify basedir isolation 2013-11-21 14:54:46 +01:00
test_argcomplete.py ignore argcomplete on darwin 2013-11-12 13:52:16 +01:00
test_assertinterpret.py replace py.test module references with pytest 2014-01-18 12:31:33 +01:00
test_assertion.py fix expicit assert messages for Python2.6: it turns out python2.6 2013-12-12 06:41:48 +01:00
test_assertrewrite.py xfail a test on pypy that checks wrong encoding/ascii (pypy does 2013-11-19 11:18:51 +01:00
test_capture.py remove an old duplicate marker and use recent pytest mechanism for parametrization 2013-11-21 14:40:14 +01:00
test_collection.py fix flakes issues and make --flakes run part of tox runs 2013-10-12 15:39:22 +02:00
test_config.py fix comment typos 2014-01-18 12:39:16 +01:00
test_conftest.py remove an old duplicate marker and use recent pytest mechanism for parametrization 2013-11-21 14:40:14 +01:00
test_core.py replace py.test module references with pytest 2014-01-18 12:31:33 +01:00
test_doctest.py fix issue275 - allow usefixtures and autouse fixtures 2013-11-22 15:35:20 +01:00
test_genscript.py fix py32 failures and remove random print from commit accident 2013-12-16 07:19:49 +01:00
test_helpconfig.py replace py.test module references with pytest 2014-01-18 12:31:33 +01:00
test_junitxml.py Still print this, but use py2/py3 compat syntax 2013-12-16 10:51:04 +00:00
test_mark.py fix handling MarkDecorators called with a single positional plus keyword args 2014-01-20 01:27:33 +01:00
test_monkeypatch.py support python32 2013-11-12 13:48:17 +01:00
test_nose.py replace py.test module references with pytest 2014-01-18 12:31:33 +01:00
test_parseopt.py fix flakes issues and make --flakes run part of tox runs 2013-10-12 15:39:22 +02:00
test_pastebin.py fix flakes issues and make --flakes run part of tox runs 2013-10-12 15:39:22 +02:00
test_pdb.py fix pexpect-3.0 compatibility for pytest's own tests. 2013-11-19 10:10:27 +01:00
test_pytester.py replace py.test module references with pytest 2014-01-18 12:31:33 +01:00
test_recwarn.py replace py.test module references with pytest 2014-01-18 12:31:33 +01:00
test_resultlog.py fix issue380 by making --resultlog only rely on longrepr instead 2013-11-19 14:19:29 +01:00
test_runner.py replace py.test module references with pytest 2014-01-18 12:31:33 +01:00
test_runner_xunit.py ref #322 cleanup all teardown calling to only happen when setup succeeded. 2013-08-02 09:52:40 +02:00
test_session.py replace py.test module references with pytest 2014-01-18 12:31:33 +01:00
test_skipping.py fix flakes issues and make --flakes run part of tox runs 2013-10-12 15:39:22 +02:00
test_terminal.py remove unusued import 2013-12-12 06:55:05 +01:00
test_tmpdir.py replace py.test module references with pytest 2014-01-18 12:31:33 +01:00
test_unittest.py remove an old duplicate marker and use recent pytest mechanism for parametrization 2013-11-21 14:40:14 +01:00