Skip to content

Commit

Permalink
Report coverage
Browse files Browse the repository at this point in the history
  • Loading branch information
tomgross committed Jun 24, 2023
1 parent c85db59 commit f81b9d5
Show file tree
Hide file tree
Showing 6 changed files with 27 additions and 77 deletions.
8 changes: 5 additions & 3 deletions .coveragerc
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
[run]
relative_files = True

[report]
include =
src/collective/*
src/*
omit =
*/test*
*/upgrades/*
*/tests/*
18 changes: 16 additions & 2 deletions .github/workflows/pcloud-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,10 @@ jobs:
matrix:
python-version: [3.7, 3.8, 3.9, "3.10", "3.11"]
max-parallel: 1

steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Setup firefox
uses: browser-actions/setup-firefox@latest
- name: Set up Python ${{ matrix.python-version }}
Expand All @@ -40,9 +41,22 @@ jobs:
flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics
- name: Test with pytest
run: |
pytest src --capture=no -v --timeout=600
pytest src --cov=src/pcloud --cov-report=xml --cov-branch --cov-config=.coveragerc --capture=no -v --timeout=600
env:
PCLOUD_USERNAME: ${{ secrets.PCLOUD_USERNAME }}
PCLOUD_PASSWORD: ${{ secrets.PCLOUD_PASSWORD }}
PCLOUD_OAUTH2_CLIENT_ID: ${{ secrets.PCLOUD_OAUTH2_CLIENT_ID }}
PCLOUD_OAUTH2_CLIENT_SECRET: ${{ secrets.PCLOUD_OAUTH2_CLIENT_SECRET }}
- name: Analyze with SonarCloud
uses: SonarSource/sonarcloud-github-action@master
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # Needed to get PR information
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} # Generate a token on Sonarcloud.io, add it to the secrets of this repo with the name SONAR_TOKEN (Settings > Secrets > Actions > add new repository secret)
with:
args:
-Dsonar.projectKey=tomgross_pycloud
-Dsonar.organization=tomgross-github
-Dsonar.python.version=3
-Dsonar.python.coverage.reportPaths=coverage.xml


70 changes: 0 additions & 70 deletions .github/workflows/sonarcloud.yml

This file was deleted.

1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -40,3 +40,4 @@ pyvenv.cfg
Pipfile*
*.whl
.vscode
coverage.xml
6 changes: 4 additions & 2 deletions src/pcloud/tests/test_integration.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import os
import pytest
import time
import zipfile

from io import BytesIO
Expand Down Expand Up @@ -68,11 +69,12 @@ def test_copyfile(pycloud, testfolder):
tofilename = f"/{folder_for_tests}/{testfilename}"
resp = pycloud.copyfile(path=f"/{testfilename}", topath=tofilename)
assert resp["result"] == 0
time.sleep(1)
resp = pycloud.checksumfile(path=tofilename)
assert (
resp["sha256"]
resp.get("sha256")
== "df745d42f69266c49141ea7270c45240cf883b9cdb6a14fffcdff33c04c5304c"
)
), f"Failure with checksum in {resp}"


def test_listtokens(pycloud):
Expand Down
1 change: 1 addition & 0 deletions test_requirements.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
pytest==7.4.0
pytest-sugar==0.9.7
pytest-timeout==2.1.0
pytest-cov==4.1.0
wheel==0.40.0
flake8==5.0.4
fs==2.4.16
Expand Down

0 comments on commit f81b9d5

Please sign in to comment.