Made it clearer that clearing such references is not mandatory and is only an
optional step which may help the Python interpreter speed up its garbage
collection.
--HG--
branch : document_ExceptionInfo_ref_cycle
pytest.raises() returns an ExceptionInfo object which, if a local reference is
made to it, forms a reference cycle:
ExceptionInfo
--> exception
--> stack frame raising the exception
--> current stack frame
--> current local variables
--> Exception Info
Such a reference cycle would then prevent any local variables in the current
stack frame, or any of its child stack frames involved in the same reference
cycle, from being garbage collected until the next reference cycle garbage
collection phase. This unnecessarily increases the program's memory footprint
and potentially slows it down.
This situation is based on a similar one described in the official 'try'
statement Python documentation for locally stored exception references.
--HG--
branch : document_ExceptionInfo_ref_cycle
When pytest is called with the '--markers' option, it should collect marker
information from the current folder, and they should get loaded and used
correctly before the '--markers' output is constructed.
Audrey's code is BSD, so there should be no problem with licensing.
I've covered:
* contribution types (with hints)
* steps to start with pytest development
* testing pytest
* basics of hg
--HG--
branch : contributiondocs
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.