In pycharm I’ve set pytest to be my default testing framework via file->settings->tools->python integrated tools / Testing
Now when I right click on my test directory I can run all tests using pytest.
However, when I open a python test file and click the play button to run an individual test (eg. run pytest for test_1()), pycharm’s pytest framework is not used and instead the entire file is run as a script.