diff options
author | Lovett, Trevor <trevor.lovett@att.com> | 2019-02-06 10:50:37 -0600 |
---|---|---|
committer | Trevor Lovett <trevor.lovett@att.com> | 2019-02-06 22:27:54 +0000 |
commit | 20c6955caddbb6e126755bbf4cc2412279d0a11f (patch) | |
tree | 4fa226c62a32dc2d4db5679c45a865edacdfc550 /ice_validator | |
parent | feed1b900bfd975cfd8f382d290c9bb8901e9f49 (diff) |
[VVP] Fix errors on tests with no fixtures
Change-Id: I4ad24979128902b4e0e502c76d6503e2876b960a
Issue-ID: VVP-161
Signed-off-by: Lovett, Trevor (tl2972) <tl2972@att.com>
Diffstat (limited to 'ice_validator')
-rw-r--r-- | ice_validator/tests/conftest.py | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/ice_validator/tests/conftest.py b/ice_validator/tests/conftest.py index a2f4321..4668045 100644 --- a/ice_validator/tests/conftest.py +++ b/ice_validator/tests/conftest.py @@ -283,7 +283,8 @@ class TestResult: elif "yaml_files" in self.item.fixturenames: return self.item.funcargs["yaml_files"] else: - return [self.result.nodeid.split("[")[1][:-1]] + parts = self.result.nodeid.split("[") + return "" if len(parts) == 1 else parts[1][:-1] def _get_error_message(self): """ @@ -1038,7 +1039,7 @@ def build_rst_json(reqs): if "none" in (values["validation_mode"]): del data[key] else: - """Creates links in RST format to requirements and test cases""" + # Creates links in RST format to requirements and test cases if values["test_case"]: val_list = re.findall(r'(?<=\.).*', values["test_case"]) val = TEST_SCRIPT_SITE + val_list[0] + ".py" @@ -1093,7 +1094,8 @@ def pytest_report_collectionfinish(config, startdir, items): if req_id not in req_to_test: req_to_test[req_id].add(item) if req_id in requirements: - reqs[req_id].update({'test_case': item.function.__module__, 'validated_by': item.function.__name__}) + reqs[req_id].update({'test_case': item.function.__module__, + 'validated_by': item.function.__name__}) if req_id not in requirements: mapping_errors.add( (req_id, item.function.__module__, item.function.__name__) @@ -1142,8 +1144,8 @@ def pytest_report_collectionfinish(config, startdir, items): ""), # test function ) # now write out any test methods that weren't mapped to requirements - unmapped_tests = {(item.function.__module__, item.function.__name__) - for item in unmapped} + unmapped_tests = {(item.function.__module__, item.function.__name__) for item in + unmapped} for test_module, test_name in unmapped_tests: out.writerow( ("", # req ID |