port tests to new async interface

This commit is contained in:
boyska 2021-09-29 00:37:10 +02:00
parent c8bf2c2071
commit ef97c952d2
2 changed files with 15 additions and 10 deletions

View file

@ -14,8 +14,8 @@ mypy:
test:
stage: test
before_script:
- pip install pytest
- pip install pytest pytest-asyncio
- pip install -r requirements.txt
- mkdir output
- mkdir techrec/output
script:
- pytest

View file

@ -1,5 +1,6 @@
from datetime import datetime, timedelta
import pytest
from pytest import raises
from .forge import (
@ -21,8 +22,9 @@ get_config()["FFMPEG_PATH"] = "ffmpeg"
get_config()["FFMPEG_OUT_CODEC"] = ["-acodec", "copy"]
def eq_(a,b):
assert a==b, "%r != %r" % (a,b)
def eq_(a, b):
assert a == b, "%r != %r" % (a, b)
def minutes(n):
return timedelta(minutes=n)
@ -35,8 +37,9 @@ def seconds(n):
# timefile
def test_timefile_exact():
eq_(get_timefile_exact(eight), "2014-05/30/2014-05-30-20-00-00.mp3")
@pytest.mark.asyncio
async def test_timefile_exact():
eq_(await get_timefile_exact(eight), "2014-05/30/2014-05-30-20-00-00.mp3")
# Rounding
@ -55,12 +58,14 @@ def test_rounding_value():
# Rounding + timefile
def test_timefile_alreadyround():
eq_(get_timefile(eight), "2014-05/30/2014-05-30-20-00-00.mp3")
@pytest.mark.asyncio
async def test_timefile_alreadyround():
eq_(await get_timefile(eight), "2014-05/30/2014-05-30-20-00-00.mp3")
def test_timefile_toround():
eq_(get_timefile(eight + minutes(20)), "2014-05/30/2014-05-30-20-00-00.mp3")
@pytest.mark.asyncio
async def test_timefile_toround():
eq_(await get_timefile(eight + minutes(20)), "2014-05/30/2014-05-30-20-00-00.mp3")
# Intervals