From 9451c9bb7d48224bb6251e56a45aa1d4c9891b2b Mon Sep 17 00:00:00 2001 From: Vitaly Gavensky Date: Wed, 15 May 2024 16:13:15 +0300 Subject: [PATCH] First simple pytest test --- .github/workflows/pdr_plugin_ci_workflow.yml | 7 ++++- .../tests/exclude_list_tests.py | 26 +++++++++++++++++++ 2 files changed, 32 insertions(+), 1 deletion(-) create mode 100644 plugins/pdr_deterministic_plugin/tests/exclude_list_tests.py diff --git a/.github/workflows/pdr_plugin_ci_workflow.yml b/.github/workflows/pdr_plugin_ci_workflow.yml index fded0b46f..7e98265f8 100644 --- a/.github/workflows/pdr_plugin_ci_workflow.yml +++ b/.github/workflows/pdr_plugin_ci_workflow.yml @@ -20,5 +20,10 @@ jobs: run: | pip install -r plugins/pdr_deterministic_plugin/requirements.txt pip install pylint + pip install pytest pytest-cov + - name: Run PyLint - run: pylint --rcfile=plugins/pdr_deterministic_plugin/.pylintrc plugins/pdr_deterministic_plugin \ No newline at end of file + run: pylint --rcfile=plugins/pdr_deterministic_plugin/.pylintrc plugins/pdr_deterministic_plugin + + - name: Test exclude list with pytest + run: pytest exclude_list_tests.py --doctest-modules --junitxml=junit/exclude_list_tests_results.xml --cov=com --cov-report=xml --cov-report=html \ No newline at end of file diff --git a/plugins/pdr_deterministic_plugin/tests/exclude_list_tests.py b/plugins/pdr_deterministic_plugin/tests/exclude_list_tests.py new file mode 100644 index 000000000..0f504475a --- /dev/null +++ b/plugins/pdr_deterministic_plugin/tests/exclude_list_tests.py @@ -0,0 +1,26 @@ +# +# Copyright © 2013-2024 NVIDIA CORPORATION & AFFILIATES. ALL RIGHTS RESERVED. +# +# This software product is a proprietary product of Nvidia Corporation and its affiliates +# (the "Company") and all right, title, and interest in and to the software +# product, including all associated intellectual property rights, are and +# shall remain exclusively with the Company. +# +# This software product is governed by the End User License Agreement +# provided with the software product. +# + +#import pytest +from plugins.pdr_deterministic_plugin.ufm_sim_web_service.constants import PDRConstants as Constants +from plugins.pdr_deterministic_plugin.ufm_sim_web_service.exclude_list import ExcludeList +from plugins.pdr_deterministic_plugin.ufm_sim_web_service.isolation_algo import create_logger + +def test_get_from_empty_list(): + """ + Create exclude list and ensure its empty via its method + """ + + logger = create_logger(Constants.LOG_FILE) + exclude_list = ExcludeList(logger) + items = exclude_list.items() + assert not items