Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: bumping mypy; making traces object typed to prevent misc mypy error on LogicError #105

Merged
merged 1 commit into from
Aug 8, 2024

Conversation

aorumbayev
Copy link
Contributor

@aorumbayev aorumbayev commented Aug 7, 2024

Proposed Changes

Example of the error:

tests/hello_world_test.py:86: error: Expression type contains "Any" (has type "type[LogicError]")  [misc]

Above is observed in newer mypy versions (>=1.10.x) when using LogicError inside pytest.raises(), a false positive is thrown (likely related to python/mypy#13006) -> however the behaviour can be patched by ensuring that no typing.Any is used on any of the args of the LogicError constructor.

  • patching mypy misc issue with LogicError constructors
  • bumping project's mypy to latest 1.11.1 + minor refreshed vscode setting.json defaults

Further notes

Verified against following simple example:

import pytest
from algokit_utils import LogicError


def test_hello() -> None:
    # Act
    with pytest.raises(LogicError, match="Unauthorized"):
        print("Hello, World!")
  • Verified the fix by Installing local wheel with the changes in this PR into an mvp project replicating the error

Copy link

github-actions bot commented Aug 7, 2024

Coverage

Coverage Report
FileStmtsMissCoverMissing
src/algokit_utils
   _debugging.py140795%20, 41, 76, 80, 89, 129, 157
   _ensure_funded.py69199%99
   _transfer.py67396%13, 76–77
   account.py851385%14–17, 61–65, 96, 109, 136, 139, 183
   application_client.py5287785%59–60, 167, 172, 201, 313, 318–319, 321, 323, 788, 803, 821–824, 914, 954, 966, 979, 1021, 1081–1087, 1091–1096, 1098, 1134, 1141, 1254, 1284, 1298, 1336–1338, 1340, 1350–1407, 1418–1423, 1443–1446
   application_specification.py971189%92, 94, 193–202, 206
   asset.py79594%9, 27–30
   common.py13192%13
   config.py511865%38–39, 50, 55, 60, 64–69, 100–109
   deploy.py4552495%30–33, 168, 172–173, 190, 205, 246, 402, 413–421, 438–441, 451, 459, 652–653, 677
   dispenser_api.py821285%112–113, 117–120, 155–157, 176–178
   logic_error.py39295%8, 31
   models.py131695%45, 50–52, 61–62
   network_clients.py63395%93–94, 125
src/algokit_utils/beta
   account_manager.py551475%39–40, 64, 123–130, 183–187, 198–200
   algorand_client.py1011585%111–112, 121–122, 143–145, 154–155, 224, 259, 274, 290, 303, 319
   client_manager.py371073%40, 61–63, 68–70, 75–78
   composer.py3207178%335–336, 339–340, 343–344, 347–348, 355–356, 359–360, 389, 391, 393, 396, 399, 404, 407, 411, 414, 456–489, 494–505, 510–516, 521–529, 549–562, 566, 590, 593–610, 618, 643, 659–660, 662–663, 665–666, 668–669, 671–672, 678–682
TOTAL242629388% 

Tests Skipped Failures Errors Time
204 0 💤 0 ❌ 0 🔥 2m 25s ⏱️

@aorumbayev aorumbayev merged commit a9ffb78 into main Aug 8, 2024
4 checks passed
@aorumbayev aorumbayev deleted the fix/mypy-issues branch August 8, 2024 08:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants