How do I configure PyCharm to run py.test tests?
--------------------------------------------------
Hire the world's top talent on demand or became one of them at Toptal: https://topt.al/25cXVn
--------------------------------------------------
Music by Eric Matyas
https://www.soundimage.org
Track title: Puzzle Game Looping
--
Chapters
00:00 How Do I Configure Pycharm To Run Py.Test Tests?
02:21 Answer 1 Score 21
02:44 Accepted Answer Score 302
02:58 Answer 3 Score 78
03:36 Answer 4 Score 21
04:22 Thank you
--
Full question
https://stackoverflow.com/questions/6397...
--
Content licensed under CC BY-SA
https://meta.stackexchange.com/help/lice...
--
Tags
#python #pycharm #pytest
#avk47
    Hire the world's top talent on demand or became one of them at Toptal: https://topt.al/25cXVn
--------------------------------------------------
Music by Eric Matyas
https://www.soundimage.org
Track title: Puzzle Game Looping
--
Chapters
00:00 How Do I Configure Pycharm To Run Py.Test Tests?
02:21 Answer 1 Score 21
02:44 Accepted Answer Score 302
02:58 Answer 3 Score 78
03:36 Answer 4 Score 21
04:22 Thank you
--
Full question
https://stackoverflow.com/questions/6397...
--
Content licensed under CC BY-SA
https://meta.stackexchange.com/help/lice...
--
Tags
#python #pycharm #pytest
#avk47
ACCEPTED ANSWER
Score 302
Please go to File| Settings | Tools | Python Integrated Tools and change the default test runner to py.test. Then you'll get the py.test option to create tests instead of the unittest one.
ANSWER 2
Score 78
PyCharm 2017.3
Preference -> Tools -> Python integrated Tools- Choosepy.testasDefault test runner.- If you use Django 
Preference -> Languages&Frameworks -> Django- Set tick onDo not use Django Test runner - Clear all previously existing test configurations from 
Run/Debug configuration, otherwise tests will be run with those older configurations. - To set some default additional arguments update py.test default configuration. 
Run/Debug Configuration -> Defaults -> Python tests -> py.test -> Additional Arguments 
ANSWER 3
Score 21
I think you need to use the Run/Debug Configuration item on the toolbar. Click it and 'Edit Configurations' (or alternatively use the menu item Run->Edit Configurations). In the 'Defaults' section in the left pane there is a 'py.test' item which I think is what you want.
I also found that the manual didn't match up to the UI for this. Hope I've understood the problem correctly and that helps.
ANSWER 4
Score 21
Here is how I made it work with pytest 3.7.2 (installed via pip) and pycharms 2017.3:
- Go to 
edit configurations 

- Add a new run config and select 
py.test 

- In the run config details, you need to set 
target=pythonand the unnamed field below totests. It looks like this is the name of your test folder. Not too sure tough. I also recommend the-sargument so that if you debug your tests, the console will behave properly. Without the argument pytest captures the output and makes the debug console buggy. 

- My tests folder looks like that. This is just below the root of my project (
my_project/tests). 

- My 
foobar_test.pyfile: (no imports needed): 
def test_foobar():
    print("hello pytest")
    assert True
- Run it with the normal run command
 
