Skip to content
Discussion options

You must be logged in to vote

Ah. With 3.0 you do not need to do the separation hack via create_pages anymore. You can keep your create_dashboard command if you need it. Just make sure that main_file from pytest.ini finds the ui.run. Simplest changes:

Delete your conftest.py

Set main.py to:

from nicegui import ui

@ui.page('/')
def main():
    ui.label('Hello World!')

def run_dashboard():
    ui.run()

if __name__ in {'__main__', '__mp_main__'}:
    run_dashboard()

In your pyproject.toml:

[project.scripts]
run_dashboard = 'main:run_dashboard'

And test_app.py:

async def test_app(user: User) -> None:
    await user.open('/')
    await user.should_see('Hello World!')

The pytest.ini can stay as before:

[pytest]
asyncio_mode

Replies: 6 comments 6 replies

Comment options

You must be logged in to vote
1 reply
@BayerSe
Comment options

Comment options

You must be logged in to vote
0 replies
Answer selected by BayerSe
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
1 reply
@BayerSe
Comment options

Comment options

You must be logged in to vote
2 replies
@rodja
Comment options

@rodja
Comment options

Comment options

You must be logged in to vote
2 replies
@BayerSe
Comment options

@BayerSe
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants