doc: note about mutation of parametrized values (#7516)
Fix #7514 by augmenting Note with behaviour when parametrized values are mutated (changes are reflected in subsequent test-case calls).
This commit is contained in:
parent
efcba7759e
commit
07ed197247
doc/en
|
@ -79,11 +79,21 @@ them in turn:
|
||||||
FAILED test_expectation.py::test_eval[6*9-42] - AssertionError: assert 54...
|
FAILED test_expectation.py::test_eval[6*9-42] - AssertionError: assert 54...
|
||||||
======================= 1 failed, 2 passed in 0.12s ========================
|
======================= 1 failed, 2 passed in 0.12s ========================
|
||||||
|
|
||||||
|
.. note::
|
||||||
|
|
||||||
|
Parameter values are passed as-is to tests (no copy whatsoever).
|
||||||
|
|
||||||
|
For example, if you pass a list or a dict as a parameter value, and
|
||||||
|
the test case code mutates it, the mutations will be reflected in subsequent
|
||||||
|
test case calls.
|
||||||
|
|
||||||
.. note::
|
.. note::
|
||||||
|
|
||||||
pytest by default escapes any non-ascii characters used in unicode strings
|
pytest by default escapes any non-ascii characters used in unicode strings
|
||||||
for the parametrization because it has several downsides.
|
for the parametrization because it has several downsides.
|
||||||
If however you would like to use unicode strings in parametrization and see them in the terminal as is (non-escaped), use this option in your ``pytest.ini``:
|
If however you would like to use unicode strings in parametrization
|
||||||
|
and see them in the terminal as is (non-escaped), use this option
|
||||||
|
in your ``pytest.ini``:
|
||||||
|
|
||||||
.. code-block:: ini
|
.. code-block:: ini
|
||||||
|
|
||||||
|
@ -91,7 +101,8 @@ them in turn:
|
||||||
disable_test_id_escaping_and_forfeit_all_rights_to_community_support = True
|
disable_test_id_escaping_and_forfeit_all_rights_to_community_support = True
|
||||||
|
|
||||||
Keep in mind however that this might cause unwanted side effects and
|
Keep in mind however that this might cause unwanted side effects and
|
||||||
even bugs depending on the OS used and plugins currently installed, so use it at your own risk.
|
even bugs depending on the OS used and plugins currently installed,
|
||||||
|
so use it at your own risk.
|
||||||
|
|
||||||
|
|
||||||
As designed in this example, only one pair of input/output values fails
|
As designed in this example, only one pair of input/output values fails
|
||||||
|
|
Loading…
Reference in New Issue