Skip to content

Commit

Permalink
Add test to avclass_labeler
Browse files Browse the repository at this point in the history
  • Loading branch information
CrimsonGlory committed Oct 9, 2018
1 parent 21806f3 commit e072e30
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 1 deletion.
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
lib/*.pyc
*.pyc
.cache/
22 changes: 22 additions & 0 deletions tests/test_avclass_labeler.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
import pytest
import subprocess
import os


def call_with_output(array):
p = subprocess.Popen(array, stdout=subprocess.PIPE,
stderr=subprocess.PIPE)
output, err = p.communicate()
return output, err


def avclass_labeler_bin():
base_path = os.path.dirname(os.path.abspath(__file__))
return os.path.join(base_path, '../avclass_labeler.py')


def test_avclass_labeler_subprocess():
params = ['python', avclass_labeler_bin(), '-lb', 'data/malheurReference_lb.json', '-v', '-fam']
output, err = call_with_output(params)
err = err.split('\n')
assert err[-4].find('[-] Samples: 3131 NoLabels:') != -1, "err=%s" % err

0 comments on commit e072e30

Please sign in to comment.