Getting 'Not Found' across all routes
Nadie ha tomado este issue todavía.
Evaluación
- Dificultad
- 3/5
- Tiempo estimado
- 1-2 días
- Aptitud para principiantes
- 35/100
Línea de trabajo
Ejecuta pytest src/tests/system/guest/test_login.py desde la rama vinculada tests/login_example y, después, inspecciona las fixtures app, live_server y el controlador de Selenium que se muestran en la issue. Compara las rutas registradas en app.url_map con las URLs solicitadas por el test; la tarea está terminada cuando la ruta de login y el test ya no devuelvan 404.
Escrito por el modelo de indexación a partir del texto del issue.
Descripción
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()
- Lenguaje dominante
- Python
- Estrellas
- 499
- Forks
- 93
- Métricas de merge de PR
- Sin PR fusionados en 30 d
Preparar el entorno
Primeros pasos
- Lee el issue completo y luego la guía de contribución del proyecto.
- Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
- Haz un fork del repositorio y trabaja en una rama.
- Abre un pull request que haga referencia al número del issue.
Más de pytest-dev/pytest-flask
-
Incompatibility with flask-babelAbiertobug
Dificultad 4/5 3-5 días Aptitud para principiantes 35/100
pytest-dev/pytest-flask#187 · 7 comentarios ·
-
bug
Dificultad 2/5 1-3 horas Aptitud para principiantes 45/100
pytest-dev/pytest-flask#175 · 3 comentarios ·
-
Dificultad 4/5 3-5 días Aptitud para principiantes 35/100
pytest-dev/pytest-flask#163 · 1 comentario · 1 reacción ·
-
feature request
Dificultad 4/5 3-5 días Aptitud para principiantes 45/100
pytest-dev/pytest-flask#153 · 1 comentario ·
-
stale
Dificultad 5/5 Más de una semana Aptitud para principiantes 20/100
pytest-dev/pytest-flask#103 ·
Todos los issues de pytest-dev/pytest-flask
Issues similares
-
bug
Dificultad 2/5 1-3 horas Aptitud para principiantes 85/100
Los mantenedores suelen responder en 1 día
-
Dificultad 1/5 Menos de una hora Aptitud para principiantes 90/100
Los mantenedores suelen responder en 1 día
-
https://search.utilibre.orgAbiertoinstance instance add
Dificultad 2/5 1-3 horas Aptitud para principiantes 68/100
searxng/searx-instances#941 · 1 comentario ·
-
Dificultad 1/5 Menos de una hora Aptitud para principiantes 92/100
FluidNumerics/fluid-walk-blocker#89 ·
Los mantenedores suelen responder en 1 día
-
bug
Dificultad 2/5 1-3 horas Aptitud para principiantes 84/100
Los mantenedores suelen responder en 1 día