Skip to content

Commit

Permalink
Merge pull request pycontribs#874 from clintonsteiner/fixSeveralCiIssues
Browse files Browse the repository at this point in the history
  • Loading branch information
clintonsteiner authored Jan 7, 2025
2 parents e666b1a + b7b6262 commit 3dde358
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 26 deletions.
32 changes: 11 additions & 21 deletions .github/workflows/python-package.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand All @@ -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
Expand All @@ -39,13 +36,16 @@ 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
ppa.launchpadcontent.net:443
pypi.org:443
updates.jenkins-ci.org:80
updates.jenkins.io:443
mirrors.updates.jenkins.io:443
updates.jenkins.io:80
- name: Checkout
Expand All @@ -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: |
Expand Down
4 changes: 2 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
.PHONY: test lint tox coverage dist

test:
py.test -sv jenkinsapi_tests
pytest -sv jenkinsapi_tests

lint:
pycodestyle
Expand All @@ -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
4 changes: 4 additions & 0 deletions jenkinsapi_tests/systests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand All @@ -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",
Expand All @@ -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",
Expand Down
6 changes: 3 additions & 3 deletions jenkinsapi_tests/unittests/test_build.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand All @@ -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:
Expand Down

0 comments on commit 3dde358

Please sign in to comment.