Getting 'Not Found' across all routes
Nessuno ha ancora preso questa issue.
Valutazione
- Difficoltà
- 3/5
- Tempo stimato
- 1-2 giorni
- Idoneità per principianti
- 35/100
Direzione di ricerca
Esegui pytest src/tests/system/guest/test_login.py dal branch collegato tests/login_example, quindi esamina i fixture app, live_server e il driver Selenium mostrati nella issue. Confronta le route registrate in app.url_map con gli URL richiesti dal test; il lavoro è completato quando la route di login e il test non restituiscono più 404.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
Describe the bug
Hello, I'm trying to run pytest-flask's live server in conjunction with selenium, but every one of my registered routes return a 404 status.
Both my app fixture and the live_server's app are the same (app == live_server.appreturns True, but I haven't checked out if they're the exact same object), and both app objects return the expected routes when calling app.url_map
It not only happens in testing: running the suite via a debugger and stopping the execution just before it fails, and visiting the app's routes in another tab or browser results in the same 404 status responses.
To Reproduce
I have the project open and available in github here, in the tests/login_example branch. Just start a virtual environment, install the requirements and run the following test:
pytest src/tests/system/guest/test_login.py
Expected behavior
The test passes.
Screenshots
Checking url_map in the debugger:
Firefox showing the error:
Environment (please complete the following information):
- OS: ArchLinux with the Linux 6.8.2 kernel
- Python Version: 3.11.8
- pytest-flask version: 1.3.0
Additional context
The test proper:
@pytest.mark.usefixtures('live_server')
class TestLogin(TestSystemBase):
def test_correct_login(db, driver, live_server):
driver.get(f"http://localhost:8888{url_for('sessions_controller.new')}")
assert 'Login' in driver.page_source
My app fixture:
@pytest.fixture(scope='session')
def app():
app = Flask(__name__)
app.config['TESTING'] = True
initializer.init_app(app)
app.config['SECRET_KEY'] = secrets.token_hex(32)
with app.app_context():
yield app
clear_data(app)
My selenium driver fixture:
@pytest.fixture
def driver():
options = webdriver.FirefoxOptions()
#options.add_argument('-headless')
driver = webdriver.Firefox(options=options)
yield driver
driver.close()
- Lingua principale
- Python
- Stelle
- 499
- Fork
- 93
- Metriche di merge delle PR
- Nessuna PR unita negli ultimi 30g
Preparare l'ambiente
- Nessun Dockerfile né file Docker Compose
- Ha un modello di pull request
- Leggi la guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di pytest-dev/pytest-flask
-
bug
Difficoltà 4/5 3-5 giorni Idoneità per principianti 35/100
pytest-dev/pytest-flask#187 · 7 commenti ·
-
bug
Difficoltà 2/5 1-3 ore Idoneità per principianti 45/100
pytest-dev/pytest-flask#175 · 3 commenti ·
-
Difficoltà 4/5 3-5 giorni Idoneità per principianti 35/100
pytest-dev/pytest-flask#163 · 1 commento · 1 reazione ·
-
feature request
Difficoltà 4/5 3-5 giorni Idoneità per principianti 45/100
pytest-dev/pytest-flask#153 · 1 commento ·
-
stale
Difficoltà 5/5 Più di una settimana Idoneità per principianti 20/100
pytest-dev/pytest-flask#103 ·
Tutte le issue di pytest-dev/pytest-flask
Issue simili
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 74/100
aws-samples/sample-per-model-bedrock#243 ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 66/100
FuRongJun-1999/dsh-memory#404 ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 72/100
I maintainer di solito rispondono entro 1 giorno
-
bug frontend
Difficoltà 2/5 1-3 ore Idoneità per principianti 68/100
PennyLaneAI/catalyst#3337 ·
I maintainer di solito rispondono entro 1 giorno
-
Workflow.schedule stops when a cron deadline passes before sleepForse già presa @HuaTNA l’ha presa oggi. Aperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 82/100
I maintainer di solito rispondono entro 1 giorno