Skip to content

Commit

Permalink
Merge pull request #102 from grycap/devel
Browse files Browse the repository at this point in the history
Move tests to actions
  • Loading branch information
micafer authored Feb 15, 2024
2 parents 875ae95 + bf64afa commit 7d7f521
Show file tree
Hide file tree
Showing 3 changed files with 48 additions and 2 deletions.
46 changes: 46 additions & 0 deletions .github/workflows/main.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
name: Test IM-Client

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 coverage mock radl netaddr requests pycodestyle

- name: Prepare auth.dat
run: |
cat <<EOT >> oidc-token
#!/bin/sh
echo "token"
EOT
chmod a+x oidc-token
sed -i '/oidc-token/c\type = InfrastructureManager; bearer_token_command = '${GITHUB_WORKSPACE}'/oidc-token OIDC_ACCOUNT' auth.dat
- name: Check code style
run: pycodestyle --max-line-length=120 --ignore=E402,W605 . --exclude=doc

- name: Unit tests
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
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# IM - Infrastructure Manager client

[![PyPI](https://img.shields.io/pypi/v/im-client.svg)](https://pypi.org/project/im-client)
[![Build Status](http://jenkins.i3m.upv.es/buildStatus/icon?job=grycap/im-client-unit-py3)](http://jenkins.i3m.upv.es:8080/job/grycap/job/im-client-unit-py3/)
[![Tests](https://github.com/grycap/im-client/actions/workflows/main.yaml/badge.svg)](https://github.com/grycap/im-client/actions/workflows/main.yaml)
[![Codacy Badge](https://app.codacy.com/project/badge/Grade/c74628a2fc134c2683d3fc57b571ce09)](https://www.codacy.com/gh/grycap/im-client/dashboard?utm_source=github.com&amp;utm_medium=referral&amp;utm_content=grycap/im-client&amp;utm_campaign=Badge_Grade)
[![Codacy Badge](https://api.codacy.com/project/badge/Coverage/c74628a2fc134c2683d3fc57b571ce09)](https://www.codacy.com/app/micafer/im-client?utm_source=github.com&utm_medium=referral&utm_content=grycap/im-client&utm_campaign=Badge_Coverage)
[![License](https://img.shields.io/badge/license-GPL%20v3.0-brightgreen.svg)](LICENSE)
Expand Down
2 changes: 1 addition & 1 deletion test/unit/test_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -1149,7 +1149,7 @@ def test_parser_help(self, option_parser_exit):
sys.stdout = out
parser.parse_args(["--help"])
output = out.getvalue().strip()
self.assertEqual(output[:16], "Usage: nosetests")
self.assertEqual(output[:7], "Usage: ")
self.assertIn("[-u|--xmlrpc-url <url>] [-r|--restapi-url <url>] [-v|--verify-ssl] "
"[-a|--auth_file <filename>] operation op_parameters", output)
sys.stdout = oldstdout
Expand Down

0 comments on commit 7d7f521

Please sign in to comment.