-
Notifications
You must be signed in to change notification settings - Fork 11
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added a test that replicates the error
- Loading branch information
1 parent
697b5db
commit d93d828
Showing
8 changed files
with
60 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
from pathlib import Path | ||
|
||
import pytest | ||
|
||
|
||
@pytest.fixture | ||
def data_dir() -> Path: | ||
dir = Path(__file__).parent / "data" | ||
assert dir.exists() | ||
return dir | ||
|
||
|
||
@pytest.fixture | ||
def contrib_dir(data_dir) -> Path: | ||
dir = data_dir / "contrib" | ||
assert dir.exists() | ||
return dir |
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
"""Test suite to ensure user provided files are correctly processed.""" | ||
|
||
from pathlib import Path | ||
|
||
from click.testing import CliRunner | ||
|
||
from batdetect2.cli import cli | ||
|
||
runner = CliRunner() | ||
|
||
|
||
def test_files_negative_dimensions_are_not_allowed( | ||
contrib_dir: Path, | ||
tmp_path: Path, | ||
): | ||
"""This test stems from issue #31. | ||
A user provided a set of files which which batdetect2 cli failed and | ||
generated the following error message: | ||
[2272] "Error processing file!: negative dimensions are not allowed" | ||
This test ensures that the error message is not generated when running | ||
batdetect2 cli with the same set of files. | ||
""" | ||
path = contrib_dir / "jeff37" | ||
assert path.exists() | ||
|
||
results_dir = tmp_path / "results" | ||
result = runner.invoke( | ||
cli, | ||
[ | ||
"detect", | ||
str(path), | ||
str(results_dir), | ||
"0.3", | ||
], | ||
) | ||
assert result.exit_code == 0 | ||
assert results_dir.exists() | ||
assert len(list(results_dir.glob("*.csv"))) == 3 | ||
assert len(list(results_dir.glob("*.json"))) == 3 |