+++ /dev/null
-from flask import Flask, Response
-import time
-import webbrowser
-
-app = Flask(__name__)
-
-@app.route("/")
-def home():
- time.sleep(3) # simulate slow work
- html = "Hello from Flask :)"
- return Response(html, mimetype="text/html")
-
-if __name__ == "__main__":
- host = "127.0.0.1"
- port = 3000
- url = f"http://{host}:{port}/"
-
- # Open the URL in a new browser tab
- webbrowser.open_new_tab(url)
-
- app.run(host=host, port=port)
\ No newline at end of file
--- /dev/null
+from flask import Flask, Response
+import time
+import webbrowser
+
+app = Flask(__name__)
+
+@app.route("/")
+def home():
+ time.sleep(3) # simulate slow work
+ html = "Hello from Flask :)"
+ return Response(html, mimetype="text/html")
+
+if __name__ == "__main__":
+ host = "127.0.0.1"
+ port = 3000
+ url = f"http://{host}:{port}/"
+
+ # Open the URL in a new browser tab
+ webbrowser.open_new_tab(url)
+
+ app.run(host=host, port=port)
\ No newline at end of file
def start_server():
# Ensure the Python interpreter can find the app_flask module.
# This might require adjusting PYTHONPATH or running pytest from the project root.
- proc = subprocess.Popen(["python", "-m", "app_flask.app"]) # Removed cwd=".."
+ proc = subprocess.Popen(["python", "-m", "app_flask.flask_application"]) # Updated module name
time.sleep(1) # Increased sleep to allow server startup, especially on slower systems
return proc
def test_home_returns_html():
proc = start_server()
try:
- r = httpx.get("http://127.0.0.1:5000/", timeout=10)
+ r = httpx.get("http://127.0.0.1:3000/", timeout=10)
assert r.status_code == 200
assert "Hello from Flask :)" in r.text # Corrected assertion
finally: