'pycharm pytest.main(['xx:py::xx::xx']) should be run single function, however it always run all the tests

E.g.

import pytest

def test1():
    print("test1")

def test2():
    print("test2")

if __name__ == '__main__':
    pytest.main(['test_main.py::test1'])

pic below show the result enter image description here



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source