|
@@ -1,6 +1,7 @@
|
|
|
from datetime import datetime, timedelta
|
|
|
|
|
|
-from nose.tools import raises, eq_
|
|
|
+import pytest
|
|
|
+from pytest import raises
|
|
|
|
|
|
from .forge import (
|
|
|
get_files_and_intervals,
|
|
@@ -21,6 +22,10 @@ get_config()["FFMPEG_PATH"] = "ffmpeg"
|
|
|
get_config()["FFMPEG_OUT_CODEC"] = ["-acodec", "copy"]
|
|
|
|
|
|
|
|
|
+def eq_(a, b):
|
|
|
+ assert a == b, "%r != %r" % (a, b)
|
|
|
+
|
|
|
+
|
|
|
def minutes(n):
|
|
|
return timedelta(minutes=n)
|
|
|
|
|
@@ -32,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
|
|
@@ -52,25 +58,27 @@ 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
|
|
|
|
|
|
|
|
|
-@raises(ValueError)
|
|
|
def test_intervals_same():
|
|
|
- tuple(get_files_and_intervals(eight, eight))
|
|
|
+ with raises(ValueError):
|
|
|
+ tuple(get_files_and_intervals(eight, eight))
|
|
|
|
|
|
|
|
|
-@raises(ValueError)
|
|
|
def test_intervals_before():
|
|
|
- tuple(get_files_and_intervals(nine, eight))
|
|
|
+ with raises(ValueError):
|
|
|
+ tuple(get_files_and_intervals(nine, eight))
|
|
|
|
|
|
|
|
|
def test_intervals_full_1():
|