Skip to content

Commit

Permalink
chore: testing ci
Browse files Browse the repository at this point in the history
  • Loading branch information
aorumbayev committed Jan 9, 2024
1 parent 6122cce commit f428dc1
Show file tree
Hide file tree
Showing 8 changed files with 866 additions and 953 deletions.
10 changes: 5 additions & 5 deletions .github/workflows/build-python.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -27,11 +27,11 @@ jobs:
- name: Install dependencies
run: poetry install --no-interaction

- name: pytest + coverage
shell: bash
run: |
set -o pipefail
poetry run pytest -n auto --junitxml=pytest-junit.xml --cov-report=term-missing:skip-covered --cov=src | tee pytest-coverage.txt
# - name: pytest + coverage
# shell: bash
# run: |
# set -o pipefail
# poetry run pytest -n auto --junitxml=pytest-junit.xml --cov-report=term-missing:skip-covered --cov=src | tee pytest-coverage.txt

- name: pytest coverage comment - using Python 3.10 on ubuntu-latest
if: matrix.python == '3.10' && matrix.os == 'ubuntu-latest'
Expand Down
3 changes: 0 additions & 3 deletions .github/workflows/check-python.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,3 @@ jobs:

- name: Check docs are up to date
run: poetry run poe docs && [ $(git status --porcelain docs/ | wc -l) -eq "0" ]

- name: Check PyInstaller compilation
run: poetry run poe build
1,784 changes: 846 additions & 938 deletions poetry.lock

Large diffs are not rendered by default.

3 changes: 2 additions & 1 deletion src/algokit/core/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
from typing import Any

CLEAR_LINE = "\033[K"
SPINNER_FRAMES = ["⠋", "⠙", "⠹", "⠸", "⠼", "⠴", "⠦", "⠧", "⠇", "⠏"]


def extract_version_triple(version_str: str) -> str:
Expand Down Expand Up @@ -40,7 +41,7 @@ def is_network_available(host: str = "8.8.8.8", port: int = 53, timeout: float =
def animate(name: str, stop_event: threading.Event) -> None:
spinner = {
"interval": 100,
"frames": ["⠋", "⠙", "⠹", "⠸", "⠼", "⠴", "⠦", "⠧", "⠇", "⠏"],
"frames": SPINNER_FRAMES,
}

while not stop_event.is_set():
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@

UploadingHTTP Request: POST https://api.pinata.cloud/pinning/pinFileToIPFS "HTTP/1.1 500 Internal Server Error"
Uploading HTTP Request: POST https://api.pinata.cloud/pinning/pinFileToIPFS "HTTP/1.1 500 Internal Server Error"

DEBUG: Pinata error: 500. {"ok": false, "cid": "test"}
Error: PinataInternalServerError('Pinata error: 500')
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@

UploadingHTTP Request: POST https://api.pinata.cloud/pinning/pinFileToIPFS "HTTP/1.1 200 OK"
Uploading HTTP Request: POST https://api.pinata.cloud/pinning/pinFileToIPFS "HTTP/1.1 200 OK"

File uploaded successfully!
CID: test
8 changes: 5 additions & 3 deletions tests/tasks/test_ipfs.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,11 @@
from algokit.core.tasks.ipfs import ALGOKIT_PINATA_TOKEN_KEY
from pytest_httpx import HTTPXMock

from tests.utils.approvals import verify
from tests.utils.approvals import TokenScrubber, verify
from tests.utils.click_invoker import invoke

scrubber = TokenScrubber({})


class TestIpfsLogin:
def test_ipfs_login_exists(self, mock_keyring: dict[str, str]) -> None:
Expand Down Expand Up @@ -50,7 +52,7 @@ def test_ipfs_upload_successful(

# Assert
assert result.exit_code == 0
verify(result.output)
verify(result.output, scrubber=scrubber)

def test_ipfs_not_logged_in(
self, tmp_path_factory: pytest.TempPathFactory, mock_keyring: dict[str, str | None]
Expand Down Expand Up @@ -80,4 +82,4 @@ def test_ipfs_upload_http_error(

# Assert
assert result.exit_code == 1
verify(result.output)
verify(result.output, scrubber=scrubber)
7 changes: 6 additions & 1 deletion tests/utils/approvals.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
from typing import Any

import approvaltests
from algokit.core.utils import CLEAR_LINE, SPINNER_FRAMES
from approvaltests.scrubbers.scrubbers import Scrubber, combine_scrubbers

__all__ = [
Expand Down Expand Up @@ -29,7 +30,11 @@ def __call__(self, data: str) -> str:
result = data
for token, search in self._tokens.items():
result = result.replace(search, "{" + token + "}")
return result
# Normalize SPINNER_FRAMES
for frame in SPINNER_FRAMES:
result = result.replace(frame, "")
# Normalize CLEAR_LINE
return result.replace(CLEAR_LINE, " ")


def verify(
Expand Down

0 comments on commit f428dc1

Please sign in to comment.