From 64ea82bd65b9a529db7d288b4e549cb15fd486e9 Mon Sep 17 00:00:00 2001 From: dweinholz Date: Thu, 4 Jan 2024 09:56:17 +0100 Subject: [PATCH] added pytest.ini and .coveragerc --- .coveragerc | 14 ++++++++++++++ .github/workflows/coverage.yml | 2 +- pytest.ini | 6 ++++++ simple_vm_client/test_openstack_connector.py | 6 +++--- 4 files changed, 24 insertions(+), 4 deletions(-) create mode 100644 .coveragerc create mode 100644 pytest.ini diff --git a/.coveragerc b/.coveragerc new file mode 100644 index 0000000..02e7226 --- /dev/null +++ b/.coveragerc @@ -0,0 +1,14 @@ +[run] +omit = + simple_vm_client/VirtualMachineService.py + simple_vm_client/constants.py + simple_vm_client/test_openstack_connector.py + simple_vm_client/ttypes.py + simple_vm_client/forc_connector/template/test_templates.py + simple_vm_client/util/logger.py + +[report] +exclude_lines = + pragma: no cover + raise NotImplementedError + if __name__ == .__main__.: diff --git a/.github/workflows/coverage.yml b/.github/workflows/coverage.yml index bdea76c..949ab55 100644 --- a/.github/workflows/coverage.yml +++ b/.github/workflows/coverage.yml @@ -24,7 +24,7 @@ jobs: - name: Build coverage file run: | - pytest --junitxml=pytest.xml --cov-report=term-missing:skip-covered --cov=simple_vm_client/openstack_connector --cov=simple_vm_client/bibigrid_connector --cov=simple_vm_client/util --cov=simple_vm_client/forc_connector | tee pytest-coverage.txt + pytest --junitxml=pytest.xml | tee pytest-coverage.txt - name: Pytest coverage comment uses: MishaKav/pytest-coverage-comment@main diff --git a/pytest.ini b/pytest.ini new file mode 100644 index 0000000..4d84681 --- /dev/null +++ b/pytest.ini @@ -0,0 +1,6 @@ +# pytest.ini + +[pytest] +addopts = --cov=. --cov-config=.coveragerc + +# Add other configuration options as needed diff --git a/simple_vm_client/test_openstack_connector.py b/simple_vm_client/test_openstack_connector.py index 00d3237..fd4edb4 100644 --- a/simple_vm_client/test_openstack_connector.py +++ b/simple_vm_client/test_openstack_connector.py @@ -2909,7 +2909,7 @@ def test___init__(self, mock_authorize): with tempfile.NamedTemporaryFile(mode="w+", delete=False) as temp_file: temp_file.write(CONFIG_DATA) # Call the __init__ method - OpenStackConnector(config_file=temp_file.name) + OpenStackConnector(config_file=temp_file.name) os.remove(temp_file.name) # Assertions @@ -2922,7 +2922,7 @@ def test___init__failed_auth(self): temp_file.write(CONFIG_DATA) # Call the __init__ method with self.assertRaises(Exception): - openstack_connector = OpenStackConnector(config_file=temp_file.name) + OpenStackConnector(config_file=temp_file.name) os.remove(temp_file.name) # Assertions @@ -2941,7 +2941,7 @@ def test___init__os_creds(self, mock_authorize): with tempfile.NamedTemporaryFile(mode="w+", delete=False) as temp_file: temp_file.write(CONFIG_DATA) # Call the __init__ method - OpenStackConnector(config_file=temp_file.name) + OpenStackConnector(config_file=temp_file.name) os.remove(temp_file.name) # Assertions