0

I want to test some simple code for pep8 compliance using pytest pep8 in Ubuntu 18.04. The command I use in the terminal is

my_name@my_name's-laptop:~/my_folder$ py.test --pep8 simple_flask.py

But it gets stuck at 'collecting 1 item'. But if I press ctrl-c, it executes. I wonder what is wrong. My simple_flask.py code is from flask import Flask

app = Flask(__name__)


@app.route('/')
def hello() -> str:
    return 'Hi there from Flask!'

app.run()

Any suggestions on how to solve this?

  • Look at that question, do it. py.test imports your code and involuntarily starts the flask development server (with `app.run`). You should not call that when the module is being imported. – YSelf Jun 13 '18 at 10:06
  • Thank you @YSelf. Actually your comment helped more in solving the issue than the explanation on the duplicate question.(solved by commenting out app.run) – Jomesh George Jun 13 '18 at 13:09

0 Answers0