diff --git a/.github/workflows/main.yaml b/.github/workflows/main.yaml new file mode 100644 index 000000000..e9dc16cfa --- /dev/null +++ b/.github/workflows/main.yaml @@ -0,0 +1,38 @@ +name: Test IM + +on: + push: + branches: ["master"] + pull_request: + branches: ["master"] + +jobs: + test: + runs-on: ubuntu-latest + steps: + - name: Check out the codebase. + uses: actions/checkout@v4 + + - name: Set up Python 3. + uses: actions/setup-python@v5 + with: + python-version: '3.10' + + - name: Install dependencies + run: python -m pip install -r requirements-tests.txt + + - name: Check code style + run: pycodestyle --max-line-length=120 --ignore=E402,W504,W605,E722 . --exclude=doc + + - name: Test with nose + #run: nosetests test/unit/connectors/*.py test/unit/*.py test/functional/*.py -v --stop --with-xunit --with-coverage --cover-erase --cover-xml --cover-package=IM,contextualization + run: python -m coverage run --source=. -m unittest discover -s test/unit -p '*.py' + + - name: Generate XML coverage report + run: python -m coverage xml + + - name: Report coverage + uses: codacy/codacy-coverage-reporter-action@v1 + with: + project-token: ${{ secrets.CODACY_PROJECT_TOKEN }} + coverage-reports: coverage.xml \ No newline at end of file diff --git a/requirements-tests.txt b/requirements-tests.txt index 60573b552..046c9c96f 100644 --- a/requirements-tests.txt +++ b/requirements-tests.txt @@ -1,4 +1,5 @@ ansible >= 2.4 +ansible-base paramiko >= 1.14 PyYAML cheroot @@ -11,7 +12,7 @@ requests >= 2.19 scp tosca-parser defusedxml -urllib3>=1.23 +urllib3>=1.23,<2.0 pycodestyle suds-py3 xmltodict @@ -31,7 +32,6 @@ pyVmomi hvac psutil scar -nose mock coverage -requests-cache \ No newline at end of file +requests-cache diff --git a/test/unit/connectors/OpenNebula.py b/test/unit/connectors/OpenNebula.py index e6e51b585..9c8976516 100755 --- a/test/unit/connectors/OpenNebula.py +++ b/test/unit/connectors/OpenNebula.py @@ -190,7 +190,7 @@ def test_30_updateVMInfo(self, server_proxy): server_proxy.return_value = one_server success, vm = one_cloud.updateVMInfo(vm, auth) - self.assertEqual(vm.info.systems[0].getValue("net_interface.1.ip"), "10.0.0.01") + self.assertEqual(vm.info.systems[0].getValue("net_interface.1.ip"), "10.0.0.1") self.assertEqual(vm.info.systems[0].getValue("net_interface.0.ip"), "158.42.1.1") self.assertTrue(success, msg="ERROR: updating VM info.") diff --git a/test/unit/connectors/files/vm_info.xml b/test/unit/connectors/files/vm_info.xml index b594fbbb4..f232a6308 100644 --- a/test/unit/connectors/files/vm_info.xml +++ b/test/unit/connectors/files/vm_info.xml @@ -68,7 +68,7 @@ - + diff --git a/test/unit/connectors/files/vm_info_off.xml b/test/unit/connectors/files/vm_info_off.xml index 1727c2c07..2a3af7b51 100644 --- a/test/unit/connectors/files/vm_info_off.xml +++ b/test/unit/connectors/files/vm_info_off.xml @@ -68,7 +68,7 @@ - +