Skip to content

Commit

Permalink
Add test coverage to test run script. (#1406)
Browse files Browse the repository at this point in the history
* add coverage to run_tests

* add coverage to test run script

* updated libbde-python

* update yara test message (rules updated)
  • Loading branch information
hacktobeer authored Dec 15, 2023
1 parent 90d1cf8 commit bfc586e
Show file tree
Hide file tree
Showing 3 changed files with 94 additions and 61 deletions.
132 changes: 75 additions & 57 deletions poetry.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

21 changes: 18 additions & 3 deletions run_tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,28 @@
# limitations under the License.
"""Script to run the tests."""

import coverage
import unittest
import sys

if __name__ == '__main__':
test_suite = unittest.TestLoader().discover('turbinia', pattern='*_test.py')
test_suite.addTests(
unittest.TestLoader().discover('turbinia/api/cli', pattern='*_test.py'))
test_results = unittest.TextTestRunner(verbosity=2).run(test_suite)
test_results = None

cov = coverage.Coverage(include='turbinia/**/*.py', omit='*_test.py')
cov.start()

try:
test_suite.addTests(
unittest.TestLoader().discover('turbinia/api/cli', pattern='*_test.py'))
test_results = unittest.TextTestRunner(verbosity=2).run(test_suite)
except Exception:
pass

cov.stop()
cov.save()

cov.report(file=sys.stdout)

if not test_results.wasSuccessful():
sys.exit(1)
2 changes: 1 addition & 1 deletion turbinia/workers/analysis/yara_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
class YaraAnalysisTaskTest(TestTurbiniaTaskBase):
"""Tests for YaraAnalysisTask Task."""

YARA_SUMMARY = 'Yara analysis found 3 alert(s)'
YARA_SUMMARY = 'Yara analysis found 4 alert(s)'

TEST_DATA_DIR = None

Expand Down

0 comments on commit bfc586e

Please sign in to comment.