0

I am trying to have my prints be live to stdout but they only print after the test is completed. I am using pycharm and a lot of the solutions I have found are for using the command line. For example if I run this code below it doesnt output the hello's until the test has passed. output from test

def test():
    for x in range(6):
        print('hello')
rpuh
  • 24
  • 1
  • 5
  • There is nothing provided that someone can answer to help you. Reference the help for improving your question, such as creating a minimal reproducible example. Typically things that work for the command line would be relevant to running in PyCharm, but it's unclear what your problem is – nanotek Jun 01 '22 at 12:53
  • My print statements in my pytest are not being displayed until the test is done. I want them to display to the logger during the test. – rpuh Jun 01 '22 at 12:55
  • I see you're a new user, so, as someone who answers questions tagged with PyCharm, I'm letting you know that I don't see any way of answering your question as it's written. I see in your other question (which was down voted) that others were also commenting that you needed to create a [minimal reproducible example](https://stackoverflow.com/help/minimal-reproducible-example) and it took a dozen comments to figure out what was actually going on. If you want help on SO, I suggest reading the docs – nanotek Jun 01 '22 at 13:08
  • Alright I have updated the question. I appreciate the input and I will work on having better examples to make my questions more clear! – rpuh Jun 01 '22 at 13:19

1 Answers1

0

Add assert 0 at the end of the test. It will fail and pytest will print what you need in the report. You can also check this one How can I see normal print output created during pytest run?

lubo
  • 3
  • 4