Skip to content

Commit

Permalink
test run (correct execution)
Browse files Browse the repository at this point in the history
  • Loading branch information
Vincent Lostanlen committed Nov 23, 2018
1 parent 20c25ef commit 27d62fd
Showing 1 changed file with 27 additions and 0 deletions.
27 changes: 27 additions & 0 deletions tests/test_cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -146,3 +146,30 @@ def test_run(capsys):

# nonexistent path
pytest.raises(BirdVoxDetectError, get_file_list, ['/fake/path/to/file'])

# test correct execution on a single file
tempdir = tempfile.mkdtemp()
run(FG_10SEC_PATH, output_dir=tempdir)

# check output file created
outfile = os.path.join(tempdir,
'BirdVox-scaper_example_foreground_timestamps.csv')
assert os.path.isfile(outfile)

# delete output file and temp folder
shutil.rmtree(tempdir)

# test correct execution on a multiple files
tempdir = tempfile.mkdtemp()
run([BG_10SEC_PATH, FG_10SEC_PATH], output_dir=tempdir)

# check output files created
bg_outfile = os.path.join(tempdir,
'BirdVox-scaper_example_background_timestamps.csv')
assert os.path.isfile(bg_outfile)
fg_outfile = os.path.join(tempdir,
'BirdVox-scaper_example_foreground_timestamps.csv')
assert os.path.isfile(bg_outfile)

# delete output file and temp folder
shutil.rmtree(tempdir)

0 comments on commit 27d62fd

Please sign in to comment.