Skip to content

Commit

Permalink
add empty file tests
Browse files Browse the repository at this point in the history
  • Loading branch information
oschwengers committed Jan 3, 2022
1 parent d284fe1 commit 4e6c35d
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 4 deletions.
Empty file added test/data/empty
Empty file.
14 changes: 10 additions & 4 deletions test/test_args.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
(['']), # empty
(['foo.fasta']), # not existing
(['fo o.fasta']), # not existing (whitespace)
(['test/data/empty']), # empty file
(['test/data/invalid.fasta']), # invalid fasta DNA alphabet
(['test/data/NC_002127.1.fna', 'foo']), # additional argument
]
Expand Down Expand Up @@ -45,6 +46,7 @@ def test_genome_ok(parameters, tmpdir):
(['--db']), # missing path
(['--db', '', ]), # empty
(['--db', 'test/foo']), # not existing
(['--db', 'test/data/empty']) # empty file
]
)
def test_database_failing_parameter(parameters, tmpdir):
Expand All @@ -60,7 +62,8 @@ def test_database_failing_parameter(parameters, tmpdir):
[
('foo', ''), # not provided
('BAKTA_DB', ''), # missing path
('BAKTA_DB', 'test/foo') # not existing path
('BAKTA_DB', 'test/foo'), # not existing path
('BAKTA_DB', 'test/data/empty') # empty file
]
)
def test_database_failing_environment(env_key, env_value, tmpdir):
Expand Down Expand Up @@ -120,7 +123,8 @@ def test_tmp_dir_ok(tmpdir):
[
(['--prodigal-tf']), # not provided
(['--prodigal-tf', '']), # empty
(['--prodigal-tf', 'foo']) # not existing
(['--prodigal-tf', 'foo']), # not existing
(['--prodigal-tf', 'test/data/empty']) # empty file
]
)
def test_prodigal_tf_failiing(parameters, tmpdir):
Expand Down Expand Up @@ -148,7 +152,8 @@ def test_prodigal_tf_ok(tmpdir):
[
(['--replicons']), # not provided
(['--replicons', '']), # empty
(['--replicons', 'foo']) # not existing
(['--replicons', 'foo']), # not existing
(['--replicons', 'test/data/empty']) # empty file
]
)
def test_replicons_failiing(parameters, tmpdir):
Expand Down Expand Up @@ -183,7 +188,8 @@ def test_replicons_ok(tmpdir):
[
(['--proteins']), # not provided
(['--proteins', '']), # empty
(['--proteins', 'foo']) # not existing
(['--proteins', 'foo']), # not existing
(['--proteins', 'test/data/empty']) # empty file
]
)
def test_proteins_failiing(parameters, tmpdir):
Expand Down
13 changes: 13 additions & 0 deletions test/test_user_proteins.py
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,19 @@ def write_tmp_faa(aa, aa_path):
fh.write(f">{aa['id']} {aa['description']}\n{aa['sequence']}\n")


@pytest.mark.slow
def test_user_proteins_empty(tmpdir):
# fast test skipping all feature detections
proc = run(
[
'bin/bakta', '--db', 'test/db', '--output', tmpdir, '--prefix', 'test', '--proteins', 'test/data/empty', '-v',
'--skip-tmrna', '--skip-trna', '--skip-rrna', '--skip-ncrna', '--skip-ncrna-region', '--skip-crispr', '--skip-sorf', '--skip-ori', '--skip-gap',
'test/data/NC_002127.1.fna'
]
)
assert proc.returncode != 0


@pytest.mark.slow
@pytest.mark.parametrize(
"parameters",
Expand Down

0 comments on commit 4e6c35d

Please sign in to comment.