How do you configure PyCharm to run py.test with command-line options like -s?
24,445
D'oh, I figured it out after all:
You add it in the py.tests Options area of the Run/Edit configuration dialog.
Author by
Jason S
Updated on January 10, 2020Comments
-
Jason S over 4 years
I figured out how to run py.test files from PyCharm:
- Run/Debug configurations
- in the Python tests category, click the "+" button to add a new configuration
- choose
py.test
- enter the full path for the Target script and the working directory
but I can't seem to add the
-s
option to allow my test script to run with standard output not captured and hidden. (I tried-s
under interpreter options but it appears not to do anything.)How can I enable
-s
? -
Tuukka Mustonen over 8 yearsTo expand: if you want to configure defaults (so PyCharm auto-sets this when it auto-creates launch configs), there is separate
Defaults
category underRun/Debug Edit Configurations
. Just set it there underPython tests > py.test
. -
Charles Merriam about 8 yearsStill won't work for me. I'm trying to add ".py", which means to look in all py files for functions named test_. It gets swallowed by the test running scripts.
-
canyon289 almost 8 yearsCould you show how you got to this screen? I can't seem to find it. Edit Nevermind. Found it as well
-
zeal almost 8 yearsHow can we configure similar setup in Eclipse with PyDev plugin?
-
Jason S almost 8 years@zeal -- no idea, ask that as a separate question.
-
zeal almost 8 years@JasonS - yep, raised it as separate question link - adding the link here for the benefit of getting some expert(s) attention!!!
-
sorin almost 8 yearsThis does not make much sense as is quite likely for the user to want to run pytest against its entire project, not a specific file. Target parameter seems to be mandatory. Still looking for a solution to this.
-
gzzzur about 3 yearsWhere is this magical Options area? I see: "Parameters" and "Additional Arguments". I see "Interpreter Options" - but that is for something else.