Skip to content

Commit

Permalink
test
Browse files Browse the repository at this point in the history
  • Loading branch information
marcin-usielski committed Nov 21, 2024
1 parent 514c494 commit 184c545
Showing 1 changed file with 14 additions and 12 deletions.
26 changes: 14 additions & 12 deletions test/test_scheduler.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
from moler.util.moler_test import MolerTest
import time
import pytest
import sys


def test_job():
Expand Down Expand Up @@ -93,18 +94,19 @@ def test_thread_test_job():
assert (3 == values['number'])


# @pytest.mark.skipif(sys.version_info < (3, 4), reason="requires python3.4 or higher")
# def test_asyncio_test_job():
# loop = asyncio.get_event_loop()
# Scheduler.change_kind("asyncio")
# values = {'number': 0}
# job = Scheduler.get_job(callback=callback, interval=0.1, callback_params={'param_dict': values})
# job.start()
# loop.run_until_complete(asyncio.sleep(0.23))
# job.cancel()
# loop.stop()
# Scheduler.change_kind() # Set the default
# assert (2 == values['number'])
@pytest.mark.skipif(sys.version_info > (3, 12), reason="We don't use asyncio.")
def test_asyncio_test_job():
import asyncio
loop = asyncio.get_event_loop()
Scheduler.change_kind("asyncio")
values = {'number': 0}
job = Scheduler.get_job(callback=callback, interval=0.1, callback_params={'param_dict': values})
job.start()
loop.run_until_complete(asyncio.sleep(0.23))
job.cancel()
loop.stop()
Scheduler.change_kind() # Set the default
assert (2 == values['number'])


def test_cannot_create_more_objects():
Expand Down

0 comments on commit 184c545

Please sign in to comment.