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: test:
stage: test stage: test
before_script: before_script:
- pip install pytest - pip install pytest pytest-asyncio
- pip install -r requirements.txt - pip install -r requirements.txt
- mkdir output - mkdir techrec/output
script: script:
- pytest - pytest

View file

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