Skip to content

Commit

Permalink
Adapted the tests to the new pytest syntax
Browse files Browse the repository at this point in the history
  • Loading branch information
set-soft committed Mar 25, 2022
1 parent b6aa098 commit 93337b1
Show file tree
Hide file tree
Showing 4 changed files with 68 additions and 63 deletions.
6 changes: 6 additions & 0 deletions tests/conftest.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,15 @@
"""
Test configuration
"""
import pytest


def pytest_addoption(parser):
parser.addoption("--test_dir", action="store", default=None,
help="the test output dir to use (omit to use a temp dir). "
"If given, outputs will _not_ be cleared after testing.")


@pytest.fixture
def test_dir(request):
return request.config.getoption("--test_dir")
16 changes: 8 additions & 8 deletions tests/test_bom/test_bugs.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,11 @@
from utils import context # noqa: E402


def test_column_sensitive():
def test_column_sensitive(test_dir):
""" Test if the COLUMN_ORDER section can contain columns in lowercase """
prj = 'links'
ext = 'csv'
ctx = context.TestContext('ColumnSensitive', prj, ext, 'column_sensitive')
ctx = context.TestContext(test_dir, 'ColumnSensitive', prj, ext, 'column_sensitive')
ctx.run()
out = prj + '.' + ext
heads = ctx.load_csv_header(out)
Expand All @@ -32,10 +32,10 @@ def test_column_sensitive():
ctx.clean_up()


def test_variants_issue_SG136_default():
def test_variants_issue_SG136_default(test_dir):
prj = 'kibom-variant_2'
ext = 'csv'
ctx = context.TestContext('test_variants_issue_SG136_default', prj, ext)
ctx = context.TestContext(test_dir, 'test_variants_issue_SG136_default', prj, ext)
extra = ['-r', 'default']
ctx.run(no_config_file=True, extra=extra)
out = prj + '_bom_A_(default).' + ext
Expand All @@ -49,10 +49,10 @@ def test_variants_issue_SG136_default():
ctx.clean_up()


def test_variants_issue_SG136_production():
def test_variants_issue_SG136_production(test_dir):
prj = 'kibom-variant_2'
ext = 'csv'
ctx = context.TestContext('test_variants_issue_SG136_production', prj, ext, 'production')
ctx = context.TestContext(test_dir, 'test_variants_issue_SG136_production', prj, ext, 'production')
ctx.run()
# ctx.run(no_config_file=True, extra=['-r', 'production'])
out = prj + '_bom_A_(production).' + ext
Expand All @@ -66,10 +66,10 @@ def test_variants_issue_SG136_production():
ctx.clean_up()


def test_variants_issue_SG136_test():
def test_variants_issue_SG136_test(test_dir):
prj = 'kibom-variant_2'
ext = 'csv'
ctx = context.TestContext('test_variants_issue_SG136_test', prj, ext)
ctx = context.TestContext(test_dir, 'test_variants_issue_SG136_test', prj, ext)
extra = ['-r', 'test']
ctx.run(no_config_file=True, extra=extra)
out = prj + '_bom_A_(test).' + ext
Expand Down
Loading

0 comments on commit 93337b1

Please sign in to comment.