reflex/tests/test_testing.py
Thomas Brandého 0d39237b3c
upgrade to latest ruff (#3497)
* upgrade to latest ruff

* try to fix dep review

* try to fix dep review (2)

* upgrade black

* upgrade black (2)

* update allowed dependencies

* update allowed dependencies (2)

* update allowed dependencies (3)

* wait between interim and final in yield test

* remove previous commit, increase delay between yield

* forgot to save on the time.sleep(1) removal

* fix integration (maybe?)

* fix pyi?

* what even is going on

* what is realityi?

* test another fix for app harness

* try to wait even longer?

* force uvloop to be optional

* downpin fastapi < 0.111, remove changes to test
2024-06-19 12:32:13 +02:00

41 lines
1.0 KiB
Python

"""Unit tests for the included testing tools."""
import pytest
from reflex.constants import IS_WINDOWS
from reflex.testing import AppHarness
@pytest.mark.skip("Slow test that makes network requests.")
def test_app_harness(tmp_path):
"""Ensure that AppHarness can compile and start an app.
Args:
tmp_path: pytest tmp_path fixture
"""
# Skip in Windows CI.
if IS_WINDOWS:
return
def BasicApp():
import reflex as rx
class State(rx.State):
pass
app = rx.App(state=State)
app.add_page(lambda: rx.text("Basic App"), route="/", title="index")
app._compile()
with AppHarness.create(
root=tmp_path,
app_source=BasicApp, # type: ignore
) as harness:
assert harness.app_instance is not None
assert harness.backend is not None
assert harness.frontend_url is not None
assert harness.frontend_process is not None
assert harness.frontend_process.poll() is None
assert harness.frontend_process.poll() is not None