Skip to content

Commit d3c7511

Browse files
fix: Restore mypy linting (#1156)
* fix: Restore mypy linting * update ci * delete extra * Update readme
1 parent 7af0fd4 commit d3c7511

File tree

7 files changed

+99
-35
lines changed

7 files changed

+99
-35
lines changed

.github/workflows/unit-test.yml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,5 +21,7 @@ jobs:
2121
python-version: ${{ matrix.python-version }}
2222
- name: Install uv
2323
run: make install-uv
24+
- name: Run Checks
25+
run: make check
2426
- name: Run Unit Tests
25-
run: uv run pytest test/unit
27+
run: make unittest

Makefile

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,15 @@
11
.PHONY: Commands for developers
22

33
.PHONY: check-all
4-
check-all: ## Run all lint checks and unittest
5-
@echo "[Notice] If you'd like to run commands with same env to CI, please run \`tox\`."
6-
@bash ci.sh
4+
check-all: check unittest
75

86
.PHONY: check
97
check: check-lint check-format
108

119
.PHONY: check-lint
1210
check-lint:
1311
uv run ruff check .
12+
uv run mypy appium
1413

1514
.PHONY: check-format
1615
check-format:

README.md

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -483,18 +483,32 @@ or add it to PATH:
483483
export "PATH=/venv/root/folder/bin:$PATH"
484484
```
485485
486+
### Linting And Formatting
487+
488+
Run linter and format checks
489+
490+
```bash
491+
make check
492+
```
493+
494+
Address autofixable linter and formatting issues
495+
496+
```bash
497+
make fix
498+
```
499+
486500
### Testing
487501
488502
#### Unit
489503
490504
```bash
491-
uv run pytest test/unit
505+
make unittest
492506
```
493507
494508
Run in parallel (2 threads)
495509
496510
```bash
497-
uv run pytest -n 2 test/unit
511+
make unittest ARGS="-n 2"
498512
```
499513
500514
#### Functional

appium/webdriver/switch_to.py

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -12,21 +12,15 @@
1212
# See the License for the specific language governing permissions and
1313
# limitations under the License.
1414

15-
from typing import Optional, Protocol
15+
from typing import Optional
1616

1717
from selenium.webdriver.remote.switch_to import SwitchTo
1818
from typing_extensions import Self
1919

20-
from appium.protocols.webdriver.can_execute_commands import CanExecuteCommands
21-
2220
from .mobilecommand import MobileCommand
2321

2422

25-
class HasDriver(Protocol):
26-
_driver: CanExecuteCommands
27-
28-
29-
class MobileSwitchTo(SwitchTo, HasDriver):
23+
class MobileSwitchTo(SwitchTo):
3024
def context(self, context_name: Optional[str]) -> Self:
3125
"""Sets the context for the current session.
3226
Passing `None` is equal to switching to native context.

ci.sh

Lines changed: 0 additions & 17 deletions
This file was deleted.

pyproject.toml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,19 +13,20 @@ dynamic = [
1313
requires-python = ">=3.9"
1414
dependencies = [
1515
"selenium>=4.26,<5.0",
16-
"typing-extensions~=4.13.2",
16+
"typing-extensions~=4.13",
1717
]
1818

1919
[tool.uv]
2020
dev-dependencies = [
2121
"httpretty~=1.1",
2222
"mock~=5.2",
23+
"mypy~=1.17",
2324
"pre-commit~=4.2",
2425
"pytest~=8.4",
2526
"pytest-cov~=6.2",
2627
"pytest-xdist~=3.8",
2728
"python-dateutil~=2.9",
28-
"ruff~=0.12.7",
29+
"ruff~=0.12",
2930
"types-python-dateutil~=2.9",
3031
]
3132

uv.lock

Lines changed: 73 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)