Skip to content

Commit

Permalink
Change script_runner.run(x, x) to ret = script_runner.run([x, x]).
Browse files Browse the repository at this point in the history
  • Loading branch information
hendriks73 committed Oct 11, 2024
1 parent f79941b commit 927c302
Showing 1 changed file with 15 additions and 15 deletions.
30 changes: 15 additions & 15 deletions test/test_commands.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ def test_track():
@pytest.mark.parametrize('entry_point', entry_points)
def test_help(script_runner, entry_point):
# sanity check -- can it be called at all
ret = script_runner.run(entry_point, '--help')
ret = script_runner.run([entry_point, '--help'])
assert ret.success
assert ret.stdout.startswith('usage:')
assert ret.stderr == ''
Expand All @@ -27,63 +27,63 @@ def test_help(script_runner, entry_point):
@pytest.mark.parametrize('entry_point', entry_points)
def test_version(script_runner, entry_point):
# sanity check -- can it be called at all
ret = script_runner.run(entry_point, '--version')
ret = script_runner.run([entry_point, '--version'])
assert ret.success
assert ret.stdout.startswith(entry_point)
assert version.__version__ in ret.stdout
assert ret.stderr == ''


def test_tempo(script_runner, test_track):
ret = script_runner.run('tempo', '-i', test_track)
ret = script_runner.run(['tempo', '-i', test_track])
assert ret.success
assert 'Loading model' in ret.stdout
assert '100' in ret.stdout


def test_tempogram(script_runner, test_track):
ret = script_runner.run('tempogram', '-p', test_track)
ret = script_runner.run(['tempogram', '-p', test_track])
assert ret.success
assert 'Loading model' in ret.stdout
assert os.path.exists(test_track + '.png')


def test_meter(script_runner, test_track):
ret = script_runner.run('meter', '-i', test_track)
ret = script_runner.run(['meter', '-i', test_track])
assert ret.success
assert 'Loading model' in ret.stdout
assert '9' in ret.stdout


def test_greekfolk(script_runner, tmpdir, test_track):
ret = script_runner.run('greekfolk', dirname(test_track), str(tmpdir))
ret = script_runner.run(['greekfolk', dirname(test_track), str(tmpdir)])
assert ret.success
assert 'No .wav files found in' in ret.stdout


def test_tempo_interpolate(script_runner, test_track):
ret = script_runner.run('tempo', '--interpolate', '-i', test_track)
ret = script_runner.run(['tempo', '--interpolate', '-i', test_track])
assert ret.success
assert 'Loading model' in ret.stdout
assert '100' in ret.stdout


def test_tempo_model(script_runner, test_track):
ret = script_runner.run('tempo', '-m', 'deeptemp', '-i', test_track)
ret = script_runner.run(['tempo', '-m', 'deeptemp', '-i', test_track])
assert ret.success
assert 'Loading model' in ret.stdout
assert '100' in ret.stdout


def test_tempo_mirex(script_runner, test_track):
ret = script_runner.run('tempo', '--mirex', '-i', test_track)
ret = script_runner.run(['tempo', '--mirex', '-i', test_track])
assert ret.success
assert 'Loading model' in ret.stdout
assert '100 201 0.99' in ret.stdout


def test_tempo_jams(script_runner, test_track):
ret = script_runner.run('tempo', '--jams', '-i', test_track)
ret = script_runner.run(['tempo', '--jams', '-i', test_track])
assert ret.success
assert 'Loading model' in ret.stdout
assert 'Processing file' in ret.stdout
Expand All @@ -107,12 +107,12 @@ def test_tempo_jams(script_runner, test_track):


def test_tempo_jams_and_mirex(script_runner, test_track):
ret = script_runner.run('tempo', '--jams', '--mirex', '-i', test_track)
ret = script_runner.run(['tempo', '--jams', '--mirex', '-i', test_track])
assert not ret.success


def test_tempo_extension(script_runner, test_track):
ret = script_runner.run('tempo', '-e', '.fancy_pants', '-i', test_track)
ret = script_runner.run(['tempo', '-e', '.fancy_pants', '-i', test_track])
assert ret.success
extension_name = test_track + '.fancy_pants'
assert os.path.exists(extension_name)
Expand All @@ -121,7 +121,7 @@ def test_tempo_extension(script_runner, test_track):


def test_tempo_replace_extension(script_runner, test_track):
ret = script_runner.run('tempo', '-re', '.fancy_pants', '-i', test_track)
ret = script_runner.run(['tempo', '-re', '.fancy_pants', '-i', test_track])
assert ret.success
extension_name = test_track.replace('.mp3', '.fancy_pants')
assert os.path.exists(extension_name)
Expand All @@ -130,12 +130,12 @@ def test_tempo_replace_extension(script_runner, test_track):


def test_tempo_replace_exclusive(script_runner, test_track):
ret = script_runner.run('tempo', '-e', '.fancy_pants', '-re', '.fancy_pants2', '-i', test_track)
ret = script_runner.run(['tempo', '-e', '.fancy_pants', '-re', '.fancy_pants2', '-i', test_track])
assert not ret.success


def test_tempo_cont(script_runner, test_track):
ret = script_runner.run('tempo', '--cont', '-i', test_track)
ret = script_runner.run(['tempo', '--cont', '-i', test_track])
assert ret.success

# TODO: more comprehensive testing

0 comments on commit 927c302

Please sign in to comment.