Skip to content

Commit

Permalink
stubber: clean tests and bump version
Browse files Browse the repository at this point in the history
  • Loading branch information
Josverl committed Jun 12, 2024
1 parent 8f3caa0 commit 8e20e1c
Show file tree
Hide file tree
Showing 22 changed files with 45 additions and 42 deletions.
17 changes: 10 additions & 7 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,26 +26,29 @@
},
{
"name": "CLI: mpflash",
"type": "python",
"type": "debugpy",
"request": "launch",
"module": "mpflash.cli_main",
"justMyCode": false,
"justMyCode": true,
"cwd": "${workspaceFolder}",
"args": [
// "-V",
// "--ignore",
// "/dev/ttyAMA0",
"-VV",
"flash",
// "--board",
// "SEEED_WIO_TERMINAL",
// "PICO",
// "--serial",
// "COM22",
// "--board",
// "--ignore",
// "/dev/ttyAMA0",
// "/dev/ttyACM0",
// "--version",
// "?",
// "preview",
// "--board",
// "--no-erase",
// "v1.22.2",
// "--serial",
// "/dev/ttyACM0",
// "--port",
// "samd",
]
Expand Down
5 changes: 3 additions & 2 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"python.analysis.autoSearchPaths": true,
"python.analysis.diagnosticMode": "openFilesOnly",
"python.analysis.diagnosticMode": "workspace",
// "python.analysis.logLevel": "Trace",
//////////////////////////////////////////////////////////////
"python.testing.pytestEnabled": true,
Expand Down Expand Up @@ -135,5 +135,6 @@
"typings"
],
"austin.mode": "Wall time",
"austin.binaryMode": true
"austin.binaryMode": true,
"python.languageServer": "Pylance"
}
2 changes: 1 addition & 1 deletion mip/full.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,5 +18,5 @@
]
],
"deps": [],
"version": "1.20.2"
"version": "1.20.4"
}
2 changes: 1 addition & 1 deletion mip/minified.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,5 +18,5 @@
]
],
"deps": [],
"version": "1.20.2"
"version": "1.20.4"
}
2 changes: 1 addition & 1 deletion mip/mpy_v5.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,5 +18,5 @@
]
],
"deps": [],
"version": "1.20.2"
"version": "1.20.4"
}
2 changes: 1 addition & 1 deletion mip/mpy_v6.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,5 +18,5 @@
]
],
"deps": [],
"version": "1.20.2"
"version": "1.20.4"
}
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,5 +18,5 @@
]
],
"deps": [],
"version": "1.20.2"
"version": "1.20.4"
}
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ repo-path = "./repos"

[tool.poetry]
name = "micropython-stubber"
version = "1.20.3b1"
version = "1.20.4"
description = "Tooling to create and maintain stubs for MicroPython"
authors = ["Jos Verlinde <jos_verlinde@hotmail.com>"]
license = "MIT"
Expand Down
2 changes: 1 addition & 1 deletion src/stubber/__init__.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
"""get the version"""

__version__ = "1.20.2"
__version__ = "1.20.4"
6 changes: 3 additions & 3 deletions src/stubber/board/createstubs.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
except ImportError:
from ucollections import OrderedDict # type: ignore

__version__ = "v1.20.2"
__version__ = "v1.20.4"
ENOENT = 2
_MAX_CLASS_LEVEL = 2 # Max class nesting
LIBS = ["lib", "/lib", "/sd/lib", "/flash/lib", "."]
Expand Down Expand Up @@ -596,10 +596,10 @@ def _info(): # type:() -> dict[str, str]
if (
info["version"]
and info["version"].endswith(".0")
and info["version"] >= "1.10.0" # versions from 1.10.0 to 1.20.2 do not have a micro .0
and info["version"] >= "1.10.0" # versions from 1.10.0 to 1.20.4 do not have a micro .0
and info["version"] <= "1.19.9"
):
# versions from 1.10.0 to 1.20.2 do not have a micro .0
# versions from 1.10.0 to 1.20.4 do not have a micro .0
info["version"] = info["version"][:-2]

# spell-checker: disable
Expand Down
8 changes: 4 additions & 4 deletions src/stubber/board/createstubs_db.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
- cross compilation, using mpy-cross, to avoid the compilation step on the micropython device
This variant was generated from createstubs.py by micropython-stubber v1.20.2
This variant was generated from createstubs.py by micropython-stubber v1.20.4
"""

# Copyright (c) 2019-2024 Jos Verlinde
Expand All @@ -43,7 +43,7 @@
except ImportError:
from ucollections import OrderedDict # type: ignore

__version__ = "v1.20.2"
__version__ = "v1.20.4"
ENOENT = 2
_MAX_CLASS_LEVEL = 2 # Max class nesting
LIBS = ["lib", "/lib", "/sd/lib", "/flash/lib", "."]
Expand Down Expand Up @@ -607,10 +607,10 @@ def _info(): # type:() -> dict[str, str]
if (
info["version"]
and info["version"].endswith(".0")
and info["version"] >= "1.10.0" # versions from 1.10.0 to 1.20.2 do not have a micro .0
and info["version"] >= "1.10.0" # versions from 1.10.0 to 1.20.4 do not have a micro .0
and info["version"] <= "1.19.9"
):
# versions from 1.10.0 to 1.20.2 do not have a micro .0
# versions from 1.10.0 to 1.20.4 do not have a micro .0
info["version"] = info["version"][:-2]

# spell-checker: disable
Expand Down
2 changes: 1 addition & 1 deletion src/stubber/board/createstubs_db_min.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@
except O:pass
try:from collections import OrderedDict as l
except O:from ucollections import OrderedDict as l
__version__='v1.20.2'
__version__='v1.20.4'
A3=2
A4=2
A5=['lib','/lib','/sd/lib','/flash/lib',J]
Expand Down
8 changes: 4 additions & 4 deletions src/stubber/board/createstubs_mem.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
- cross compilation, using mpy-cross,
to avoid the compilation step on the micropython device
This variant was generated from createstubs.py by micropython-stubber v1.20.2
This variant was generated from createstubs.py by micropython-stubber v1.20.4
"""

# Copyright (c) 2019-2024 Jos Verlinde
Expand All @@ -34,7 +34,7 @@
except ImportError:
from ucollections import OrderedDict # type: ignore

__version__ = "v1.20.2"
__version__ = "v1.20.4"
ENOENT = 2
_MAX_CLASS_LEVEL = 2 # Max class nesting
LIBS = ["lib", "/lib", "/sd/lib", "/flash/lib", "."]
Expand Down Expand Up @@ -598,10 +598,10 @@ def _info(): # type:() -> dict[str, str]
if (
info["version"]
and info["version"].endswith(".0")
and info["version"] >= "1.10.0" # versions from 1.10.0 to 1.20.2 do not have a micro .0
and info["version"] >= "1.10.0" # versions from 1.10.0 to 1.20.4 do not have a micro .0
and info["version"] <= "1.19.9"
):
# versions from 1.10.0 to 1.20.2 do not have a micro .0
# versions from 1.10.0 to 1.20.4 do not have a micro .0
info["version"] = info["version"][:-2]

# spell-checker: disable
Expand Down
2 changes: 1 addition & 1 deletion src/stubber/board/createstubs_mem_min.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@
except N:pass
try:from collections import OrderedDict as g
except N:from ucollections import OrderedDict as g
__version__='v1.20.2'
__version__='v1.20.4'
y=2
z=2
A0=['lib','/lib','/sd/lib','/flash/lib',J]
Expand Down
2 changes: 1 addition & 1 deletion src/stubber/board/createstubs_min.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@
except N:pass
try:from collections import OrderedDict as h
except N:from ucollections import OrderedDict as h
__version__='v1.20.2'
__version__='v1.20.4'
A0=2
A1=2
A5=['lib','/lib','/sd/lib','/flash/lib',J]
Expand Down
8 changes: 4 additions & 4 deletions tests/freeze/freezer_mpy_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
from pathlib import Path

import pytest
from mock import MagicMock


# Mostly: No Mocks, does actual extraction from repro
from pytest_mock import MockerFixture
Expand All @@ -15,7 +15,7 @@

# Module Under Test
from stubber.freeze.get_frozen import freeze_any, get_manifests
from stubber.publish.defaults import GENERIC_L, GENERIC_U
from stubber.publish.defaults import GENERIC_U
from stubber.utils.repos import switch

pytestmark = [pytest.mark.stubber]
Expand Down Expand Up @@ -258,14 +258,14 @@ def test_freeze_any_mocked(
m_freeze_one_manifest_2 = mocker.patch(
"stubber.freeze.get_frozen.freeze_one_manifest_2", autospec=True, return_value=1
)
x = freeze_any(
freeze_any(
tmp_path,
version=mpy_version,
mpy_path=testrepo_micropython,
mpy_lib_path=testrepo_micropython_lib,
)
# calls = m_freeze_folders.call_count + m_freeze_one_manifest_1.call_count + m_freeze_one_manifest_2.call_count
calls = m_freeze_folders.call_count + m_freeze_one_manifest_2.call_count
calls = m_freeze_folders.call_count + m_freeze_one_manifest_2.call_count # type: ignore
print(f" m_freeze_folders.call_count {m_freeze_folders.call_count}")
# print(f" m_freeze_one_manifest_1.call_count {m_freeze_one_manifest_1.call_count}")
print(f" m_freeze_one_manifest_2.call_count {m_freeze_one_manifest_2.call_count}")
Expand Down
3 changes: 1 addition & 2 deletions tests/merge/candidates_test.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
import pytest
from pathlib import Path
from typing import List, Union
from stubber.publish.candidates import board_candidates
from stubber.utils.config import CONFIG


pytestmark = [pytest.mark.stubber]

Expand Down
4 changes: 2 additions & 2 deletions tests/minify/test_minify_script.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ def test_get_whitespace_context(content, index, expected):
# Act
if isinstance(expected, RaisesContext):
# error expected
with expected as exc_info:
with expected :
result = list(get_whitespace_context(content, index))
return

Expand Down Expand Up @@ -100,7 +100,7 @@ def test_minify_script(source_script, expected, keep_report):

# Act
if isinstance(expected, RaisesContext):
with expected as exc_info:
with expected:
minify_script(source, keep_report, diff=False)
else:
result = minify_script(source, keep_report, diff=True)
Expand Down
1 change: 0 additions & 1 deletion tests/native/native_createstubs_test.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
# run createstubs in the unix version of micropython
import json
import os
import subprocess
import sys
from pathlib import Path
Expand Down
5 changes: 4 additions & 1 deletion tests/publish/test_merge.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,10 @@
from stubber.publish.merge_docstubs import copy_and_merge_docstubs, merge_all_docstubs

from .fakeconfig import FakeConfig

pytestmark = [pytest.mark.stubber]


@pytest.mark.mocked
@pytest.mark.integration
def test_merge_all_docstubs_mocked(mocker, tmp_path, pytestconfig):
Expand All @@ -32,7 +34,7 @@ def test_merge_all_docstubs_mocked(mocker, tmp_path, pytestconfig):
)
m_add_machine_pin_call: MagicMock = mocker.patch(
"stubber.publish.merge_docstubs.add_machine_pin_call", autospec=True
)
)

# mock pathlib.Path.exists to return True so there is no dependency of folders existing on the test system
mocker.patch("stubber.publish.merge_docstubs.Path.exists", autospec=True, return_value=True)
Expand All @@ -41,6 +43,7 @@ def test_merge_all_docstubs_mocked(mocker, tmp_path, pytestconfig):
assert result == 2
assert m_board_candidates.call_count == 1
assert m_copy_and_merge_docstubs.call_count == 2
assert m_add_machine_pin_call


@pytest.mark.mocked
Expand Down
1 change: 0 additions & 1 deletion tests/publish/test_multi_build.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
from pathlib import Path

import pytest
from mock import MagicMock
from pytest_mock import MockerFixture

from stubber.publish.publish import build_multiple
Expand Down
1 change: 0 additions & 1 deletion tests/publish/test_multi_publish.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
from pathlib import Path

import pytest
from mock import MagicMock
from pytest_mock import MockerFixture

from stubber.publish.publish import publish_multiple
Expand Down

0 comments on commit 8e20e1c

Please sign in to comment.