-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
2 changed files
with
36 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
name: Run Unit Tests | ||
on: [push, workflow_dispatch] | ||
jobs: | ||
test: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v3 | ||
- name: Update Python | ||
uses: actions/setup-python@v3 | ||
with: | ||
python-version: '3.12' | ||
- name: Install dependencies | ||
run: | | ||
python -m pip install --upgrade pip | ||
pip install -r requirements.txt | ||
- name: Run tests | ||
run: | | ||
source venv/bin/activate | ||
pytest test/create_layer_unit_test.py |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
import pytest | ||
from create_layer import _get_platform, _format_size | ||
|
||
def test_get_platform(): | ||
assert _get_platform("arm64") == "manylinux2014_aarch64" | ||
assert _get_platform("x86_64") == "manylinux2014_x86_64" | ||
with pytest.raises(ValueError, match="Unknown architecture: unknown"): | ||
_get_platform("unknown") | ||
|
||
def test_format_size(): | ||
assert _format_size(500) == "500.00 B" | ||
assert _format_size(1024) == "1.00 KiB" | ||
assert _format_size(1048576) == "1.00 MiB" | ||
assert _format_size(1073741824) == "1.00 GiB" | ||
assert _format_size(1099511627776) == "1.00 TiB" | ||
assert _format_size(1125899906842624) == "1.00 PiB" |