Skip to content

Commit

Permalink
experiment with adding pauses to tests for ci
Browse files Browse the repository at this point in the history
  • Loading branch information
TomJGooding committed Nov 15, 2023
1 parent 055d788 commit 5bd8bc2
Showing 1 changed file with 14 additions and 3 deletions.
17 changes: 14 additions & 3 deletions tests/test_month_calendar.py
Original file line number Diff line number Diff line change
Expand Up @@ -62,8 +62,8 @@ def compose(self) -> ComposeResult:
async def test_calendar_table_week_header():
app = MonthCalendarApp()
async with app.run_test() as pilot:
month_calendar = pilot.app.query_one(MonthCalendar)
await pilot.pause()
month_calendar = pilot.app.query_one(MonthCalendar)
table = month_calendar.query_one(DataTable)
actual_labels = [col.label.plain for col in table.columns.values()]
expected_labels = ["Mon", "Tue", "Wed", "Thu", "Fri", "Sat", "Sun"]
Expand All @@ -73,8 +73,8 @@ async def test_calendar_table_week_header():
async def test_calendar_table_days():
app = MonthCalendarApp()
async with app.run_test() as pilot:
month_calendar = pilot.app.query_one(MonthCalendar)
await pilot.pause()
month_calendar = pilot.app.query_one(MonthCalendar)
table = month_calendar.query_one(DataTable)
for row, week in enumerate(month_calendar.calendar_dates):
for column, date in enumerate(week):
Expand All @@ -86,6 +86,7 @@ async def test_calendar_table_days():
async def test_calendar_table_after_reactive_year_change():
app = MonthCalendarApp()
async with app.run_test() as pilot:
await pilot.pause()
month_calendar = pilot.app.query_one(MonthCalendar)
month_calendar.year = 2023
await pilot.pause()
Expand All @@ -99,6 +100,7 @@ async def test_calendar_table_after_reactive_year_change():
async def test_calendar_table_after_reactive_month_change():
app = MonthCalendarApp()
async with app.run_test() as pilot:
await pilot.pause()
month_calendar = pilot.app.query_one(MonthCalendar)
month_calendar.month = 7
await pilot.pause()
Expand All @@ -113,6 +115,7 @@ async def test_calendar_table_after_reactive_month_change():
# app = MonthCalendarApp()
# async with app.run_test() as pilot:
# month_calendar = pilot.app.query_one(MonthCalendar)
# await pilot.pause()
# month_calendar.first_weekday = 6 # Sunday
# await pilot.pause()
# table = month_calendar.query_one(DataTable)
Expand All @@ -130,6 +133,7 @@ async def test_calendar_table_after_reactive_month_change():
async def test_show_cursor():
app = MonthCalendarApp()
async with app.run_test() as pilot:
await pilot.pause()
month_calendar = pilot.app.query_one(MonthCalendar)
table = month_calendar.query_one(DataTable)
assert table.show_cursor is True
Expand All @@ -140,6 +144,7 @@ async def test_show_cursor():
async def test_previous_year():
app = MonthCalendarApp()
async with app.run_test() as pilot:
await pilot.pause()
month_calendar = pilot.app.query_one(MonthCalendar)
month_calendar.previous_year()
await pilot.pause()
Expand All @@ -153,6 +158,7 @@ async def test_previous_year():
async def test_next_year():
app = MonthCalendarApp()
async with app.run_test() as pilot:
await pilot.pause()
month_calendar = pilot.app.query_one(MonthCalendar)
month_calendar.next_year()
await pilot.pause()
Expand All @@ -166,6 +172,7 @@ async def test_next_year():
async def test_previous_month():
app = MonthCalendarApp()
async with app.run_test() as pilot:
await pilot.pause()
month_calendar = pilot.app.query_one(MonthCalendar)
month_calendar.previous_month()
await pilot.pause()
Expand All @@ -179,6 +186,7 @@ async def test_previous_month():
async def test_previous_month_when_month_is_january():
app = MonthCalendarApp()
async with app.run_test() as pilot:
await pilot.pause()
month_calendar = pilot.app.query_one(MonthCalendar)
month_calendar.month = 1
month_calendar.previous_month()
Expand All @@ -193,6 +201,7 @@ async def test_previous_month_when_month_is_january():
async def test_next_month():
app = MonthCalendarApp()
async with app.run_test() as pilot:
await pilot.pause()
month_calendar = pilot.app.query_one(MonthCalendar)
month_calendar.next_month()
await pilot.pause()
Expand All @@ -206,6 +215,7 @@ async def test_next_month():
async def test_next_month_when_month_is_december():
app = MonthCalendarApp()
async with app.run_test() as pilot:
await pilot.pause()
month_calendar = pilot.app.query_one(MonthCalendar)
month_calendar.month = 12
month_calendar.next_month()
Expand All @@ -220,10 +230,11 @@ async def test_next_month_when_month_is_december():
async def test_move_cursor():
app = MonthCalendarApp()
async with app.run_test() as pilot:
month_calendar = pilot.app.query_one(MonthCalendar)
await pilot.pause()
month_calendar = pilot.app.query_one(MonthCalendar)
destination_date = datetime.date(2021, 6, 3)
month_calendar.move_cursor(destination_date)
await pilot.pause()
table = month_calendar.query_one(DataTable)
expected_coordinate = month_calendar.get_date_coordinate(destination_date)
actual_coordinate = table.cursor_coordinate
Expand Down

0 comments on commit 5bd8bc2

Please sign in to comment.