this is my test script:
@pytest.mark.parametrize('data', [0, 1], ids=['有效', '无效'])
def test_a(data):
assert 1
but the name of each id is escaped both in Pycharm and Terminal:
So, how to fix this?
this is my test script:
@pytest.mark.parametrize('data', [0, 1], ids=['有效', '无效'])
def test_a(data):
assert 1
but the name of each id is escaped both in Pycharm and Terminal:
So, how to fix this?
As of April 2019, pytest supports this via the following configuration setting in pytest.ini
or other configuration:
disable_test_id_escaping_and_forfeit_all_rights_to_community_support = True
With that configuration, the example in the question works as designed without changes.
This setting is documented here.
Note: as the name implies, community support may be unavailable for issues caused while running in this configuration, and it may cause issues on Windows, use it with care.
The change was merged via pull request no. 4995, and a discussion of the somewhat esoteric-née-discouraging name (and possible issues that can occur with this setting) can be found in the linked issue (no. 2482).