Skip to content

Commit

Permalink
Add pytest check to CI
Browse files Browse the repository at this point in the history
  • Loading branch information
nadzyah committed Feb 2, 2024
1 parent fa39682 commit de715e7
Show file tree
Hide file tree
Showing 3 changed files with 50 additions and 0 deletions.
20 changes: 20 additions & 0 deletions .github/workflows/test_client.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -26,3 +26,23 @@ jobs:
- run: cargo clippy --all-features --verbose
- name: Run cargo test
run: cargo test -- --test-threads=1

py-bindings-test:
runs-on: [self-hosted, linux, large]
- uses: actions/checkout@v4
- name: Install dependencies
run: |
sudo apt-get update
sudo apt-get install -y pkg-config libssl-dev
- uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: stable
override: true
- uses: actions/setup-python@v5
- run: pip install black pytest maturin
- name: Check tests style with black
run: black --check client/hwlib/pytests/
- name: Prepare the Rust lib with Python bindings
run: cd client/hwlib && maturin develop
- run: pytest pytests/
1 change: 1 addition & 0 deletions client/.gitignore
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
target
__pycache__/
29 changes: 29 additions & 0 deletions client/hwlib/pytests/test_cert_status.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
# Copyright 2024 Canonical Ltd.
# All rights reserved.
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
# Written by:
# Nadzeya Hutsko <[email protected]>


from hwlib import get_certification_status


def test_get_certification_status():
"""Verify that we can use the library in the python code"""
url = "http://example.com"

result = get_certification_status(url)
assert isinstance(result, dict)

0 comments on commit de715e7

Please sign in to comment.