forked from rc/aircox
Feat: packaging (#127)
- Add configuration files for packaging - Precommit now uses ruff Co-authored-by: bkfox <thomas bkfox net> Reviewed-on: rc/aircox#127
This commit is contained in:
@ -43,10 +43,7 @@ def source(monitor, streamer, sound, diffusion):
|
||||
|
||||
@pytest.fixture
|
||||
def tracks(sound):
|
||||
items = [
|
||||
baker.prepare(models.Track, sound=sound, position=i, timestamp=i * 60)
|
||||
for i in range(0, 4)
|
||||
]
|
||||
items = [baker.prepare(models.Track, sound=sound, position=i, timestamp=i * 60) for i in range(0, 4)]
|
||||
models.Track.objects.bulk_create(items)
|
||||
return items
|
||||
|
||||
@ -178,9 +175,7 @@ class TestMonitor:
|
||||
assert all(log_by_track.count(track) for track in tracks)
|
||||
|
||||
@pytest.mark.django_db(transaction=True)
|
||||
def test_trace_tracks_returns_on_log_diffusion(
|
||||
self, monitor, log, diffusion, tracks
|
||||
):
|
||||
def test_trace_tracks_returns_on_log_diffusion(self, monitor, log, diffusion, tracks):
|
||||
log.diffusion = None
|
||||
monitor.trace_tracks(log)
|
||||
|
||||
@ -210,9 +205,7 @@ class TestMonitor:
|
||||
assert not monitor.calls["cancel_diff"]
|
||||
|
||||
@pytest.mark.django_db(transaction=True)
|
||||
def test_handle_diffusions_returns_on_diff(
|
||||
self, monitor, streamer, diffusion, log
|
||||
):
|
||||
def test_handle_diffusions_returns_on_diff(self, monitor, streamer, diffusion, log):
|
||||
interface(
|
||||
monitor,
|
||||
{
|
||||
@ -232,9 +225,7 @@ class TestMonitor:
|
||||
assert not monitor.calls["cancel_diff"]
|
||||
|
||||
@pytest.mark.django_db(transaction=True)
|
||||
def test_handle_diffusions_returns_on_diff_log_exists(
|
||||
self, monitor, streamer, diffusion, log
|
||||
):
|
||||
def test_handle_diffusions_returns_on_diff_log_exists(self, monitor, streamer, diffusion, log):
|
||||
interface(
|
||||
monitor,
|
||||
{
|
||||
@ -264,9 +255,7 @@ class TestMonitor:
|
||||
streamer.dealer.queue = None
|
||||
streamer.dealer.rid = "13"
|
||||
streamer.dealer.remaining = monitor.delay.total_seconds() + 10
|
||||
diffusion.start = (
|
||||
tz.now() - monitor.cancel_timeout - tz.timedelta(seconds=30)
|
||||
)
|
||||
diffusion.start = tz.now() - monitor.cancel_timeout - tz.timedelta(seconds=30)
|
||||
diffusion.end = tz.now() + tz.timedelta(minutes=30)
|
||||
diffusion.save()
|
||||
|
||||
@ -285,9 +274,7 @@ class TestMonitor:
|
||||
assert log.comment == "test"
|
||||
|
||||
@pytest.mark.django_db(transaction=True)
|
||||
def test_start_diff(
|
||||
self, monitor, diffusion, source, episode, sound, tracks
|
||||
):
|
||||
def test_start_diff(self, monitor, diffusion, source, episode, sound, tracks):
|
||||
result = {}
|
||||
monitor.log = lambda **kw: result.update(kw)
|
||||
|
||||
@ -321,17 +308,10 @@ class TestMonitor:
|
||||
monitor.sync()
|
||||
|
||||
assert monitor.sync_next >= now + monitor.sync_timeout
|
||||
assert all(
|
||||
source.calls.get("sync") for source in monitor.streamer.playlists
|
||||
)
|
||||
assert all(source.calls.get("sync") for source in monitor.streamer.playlists)
|
||||
|
||||
@pytest.mark.django_db(transaction=True)
|
||||
def test_sync_timeout_not_reached_skip_sync(self, monitor):
|
||||
monitor.sync_next = tz.now() + tz.timedelta(
|
||||
seconds=monitor.sync_timeout.total_seconds() + 20
|
||||
)
|
||||
monitor.sync_next = tz.now() + tz.timedelta(seconds=monitor.sync_timeout.total_seconds() + 20)
|
||||
monitor.sync()
|
||||
assert all(
|
||||
not source.calls.get("sync")
|
||||
for source in monitor.streamer.playlists
|
||||
)
|
||||
assert all(not source.calls.get("sync") for source in monitor.streamer.playlists)
|
||||
|
Reference in New Issue
Block a user