Skip to content

Commit

Permalink
minor updates for tougher tests
Browse files Browse the repository at this point in the history
  • Loading branch information
shapiromatron committed Jul 9, 2024
1 parent f6491fb commit 753b332
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
4 changes: 1 addition & 3 deletions bmds_ui/desktop/components/database_form.py
Original file line number Diff line number Diff line change
Expand Up @@ -146,9 +146,6 @@ def compose(self) -> ComposeResult:

@on(Button.Pressed, "#db-create")
async def on_db_create(self) -> None:
await self.create_db()

async def create_db(self) -> None:
name = self.query_one("#name").value
path = self.query_one("#path").value
db = self.query_one("#filename").value
Expand All @@ -163,6 +160,7 @@ async def create_db(self) -> None:

@work(exclusive=True)
async def _create_django_db(self, config, db):
# sleeps are required for loading indicator to show/hide properly
actions = self.get_widget_by_id("actions-row")
actions.loading = True
await sleep(0.1)
Expand Down
8 changes: 7 additions & 1 deletion tests/desktop/test_app.py
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,13 @@ async def test_db_form(self, rollback_get_app):
# create a new db
app.query_one("#path").value = resolved_temp_dir
await pilot.click("#db-create")
await pilot.pause(delay=1) # delay for thread worker to finish
# wait for db creation to finish or max of 60 seconds
max = 1
while max < 60 and isinstance(
app.screen, components.database_form.DatabaseFormModel
):
await pilot.pause(delay=1)
max += 1
assert app.screen.name == "main"

# make sure a new one appears on the list page
Expand Down

0 comments on commit 753b332

Please sign in to comment.