diff --git a/.github/workflows/python-package.yml b/.github/workflows/python-package.yml index 14e7ee03..18d66fd1 100644 --- a/.github/workflows/python-package.yml +++ b/.github/workflows/python-package.yml @@ -11,10 +11,7 @@ on: - '**.yml' pull_request: branches: [ "master" ] - -concurrency: - group: ${{ github.workflow }}-${{ github.ref }} - cancel-in-progress: true + workflow_dispatch: # allow manual run jobs: build: @@ -28,9 +25,9 @@ jobs: steps: - name: Harden Runner - uses: step-security/harden-runner@1f99358870fe1c846a3ccba386cc2b2246836776 # v2.2.1 + uses: step-security/harden-runner@5c7944e73c4c2a096b17a9cb74d65b6c2bbafbde # v2.9.1 with: - egress-policy: block + egress-policy: audit allowed-endpoints: > azure.archive.ubuntu.com:80 esm.ubuntu.com:443 @@ -39,6 +36,8 @@ jobs: ftp-nyc.osuosl.org:443 get.jenkins.io:443 github.com:443 + api.github.com:443 + int.api.stepsecurity.io:443 mirror.xmission.com:443 motd.ubuntu.com:443 packages.microsoft.com:443 @@ -46,6 +45,7 @@ jobs: pypi.org:443 updates.jenkins-ci.org:80 updates.jenkins.io:443 + mirrors.updates.jenkins.io:443 updates.jenkins.io:80 - name: Checkout @@ -55,23 +55,13 @@ jobs: uses: actions/setup-python@v3 with: python-version: ${{ matrix.python-version }} + cache: 'pip' # caching pip dependencies - - name: Get pip cache dir - id: pip-cache - run: | - echo "::set-output name=dir::$(pip cache dir)" - - - name: Setup the Pip cache - uses: actions/cache@v3 + - name: setup java 17 + uses: actions/setup-java@v3 with: - path: ${{ steps.pip-cache.outputs.dir }} - key: >- - ${{ matrix.python-version }}-pip-${{ hashFiles('setup.cfg') }}-${{ - hashFiles('setup.py') }}-${{ hashFiles('tox.ini') }}-${{ - hashFiles('.pre-commit-config.yaml') }} - restore-keys: | - ${{ matrix.python-version }}-pip- - ${{ matrix.python-version }}- + java-version: '17' + distribution: 'temurin' - name: Install dependencies run: | diff --git a/Makefile b/Makefile index fd547c78..b3dec4eb 100644 --- a/Makefile +++ b/Makefile @@ -1,7 +1,7 @@ .PHONY: test lint tox coverage dist test: - py.test -sv jenkinsapi_tests + pytest -sv jenkinsapi_tests lint: pycodestyle @@ -14,4 +14,4 @@ dist: python setup.py sdist bdist_wheel coverage: - py.test -sv --cov=jenkinsapi --cov-report=term-missing --cov-report=xml jenkinsapi_tests + pytest -sv --cov=jenkinsapi --cov-report=term-missing --cov-report=xml jenkinsapi_tests diff --git a/jenkinsapi_tests/systests/conftest.py b/jenkinsapi_tests/systests/conftest.py index 1ca2960a..d5cf871f 100644 --- a/jenkinsapi_tests/systests/conftest.py +++ b/jenkinsapi_tests/systests/conftest.py @@ -16,6 +16,7 @@ "http://updates.jenkins.io/latest/" "apache-httpcomponents-client-4-api.hpi", "http://updates.jenkins.io/latest/jsch.hpi", + "http://updates.jenkins.io/latest/gson-api.hpi", "http://updates.jenkins.io/latest/trilead-api.hpi", "http://updates.jenkins.io/latest/workflow-api.hpi", "http://updates.jenkins.io/latest/display-url-api.hpi", @@ -25,7 +26,9 @@ "http://updates.jenkins.io/latest/script-security.hpi", "http://updates.jenkins.io/latest/matrix-project.hpi", "http://updates.jenkins.io/latest/credentials.hpi", + "http://updates.jenkins.io/latest/variant.hpi", "http://updates.jenkins.io/latest/ssh-credentials.hpi", + "http://updates.jenkins.io/latest/asm-api.hpi", "http://updates.jenkins.io/latest/scm-api.hpi", "http://updates.jenkins.io/latest/mailer.hpi", "http://updates.jenkins.io/latest/git.hpi", @@ -43,6 +46,7 @@ "http://updates.jenkins.io/latest/caffeine-api.hpi", "http://updates.jenkins.io/latest/script-security.hpi", "http://updates.jenkins.io/latest/checks-api.hpi", + "http://updates.jenkins.io/latest/json-api.hpi", "http://updates.jenkins.io/latest/jackson2-api.hpi", "http://updates.jenkins.io/latest/bootstrap5-api.hpi", "http://updates.jenkins.io/latest/echarts-api.hpi", diff --git a/jenkinsapi_tests/unittests/test_build.py b/jenkinsapi_tests/unittests/test_build.py index a53c439c..37fae50e 100644 --- a/jenkinsapi_tests/unittests/test_build.py +++ b/jenkinsapi_tests/unittests/test_build.py @@ -3,6 +3,7 @@ import pytz from . import configs import datetime +import warnings from typing import List from jenkinsapi.build import Build from jenkinsapi.job import Job @@ -258,7 +259,7 @@ def fake_get_data(cls, tree=None, params=None): monkeypatch.setattr(Build, "get_data", fake_get_data) with pytest.raises(requests.HTTPError) as excinfo: - with pytest.warns(None) as record: + with pytest.warns(UserWarning) as record: build.get_env_vars() assert "404" == str(excinfo.value) assert len(record) == 1 @@ -275,10 +276,9 @@ def fake_get_data(cls, tree=None, params=None): monkeypatch.setattr(Build, "get_data", fake_get_data) with pytest.raises(Exception) as excinfo: - with pytest.warns(None) as record: + with warnings.catch_warnings(): build.get_env_vars() assert "" == str(excinfo.value) - assert len(record) == 0 def test_build_get_status(build) -> None: