Skip to content

Commit d2cba20

Browse files
AC - mypy check into run_tests.sh
1 parent 8037faa commit d2cba20

File tree

5 files changed

+16
-9
lines changed

5 files changed

+16
-9
lines changed

docs/adr/assets/ADR-003/examples/python/main.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
#!/usr/bin/env python3
22

3-
import jwt
3+
import jwt # type: ignore
44
import os
5-
import requests
5+
import requests # type: ignore
66
import time
77

88

@@ -13,7 +13,9 @@ def main():
1313
gh_org = os.environ.get("GITHUB_ORG")
1414

1515
if not gh_app_id or not gh_app_pk_file or not gh_org:
16-
raise ValueError("Environment variables GITHUB_APP_ID, GITHUB_APP_PK_FILE and GITHUB_ORG must be passed to this program.")
16+
raise ValueError(
17+
"Environment variables GITHUB_APP_ID, GITHUB_APP_PK_FILE and GITHUB_ORG must be passed to this program."
18+
)
1719

1820
jwt_token = get_jwt_token(gh_app_id, gh_app_pk_file)
1921
installation_id = get_installation_id(jwt_token, gh_org)

pages/login.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
1-
from playwright.sync_api import Page, expect
1+
from playwright.sync_api import Page
2+
3+
24
class BcssLoginPage:
35

46
def __init__(self, page: Page):
@@ -8,8 +10,7 @@ def __init__(self, page: Page):
810
self.password = page.get_by_role("textbox", name="Password")
911
self.submit_button = page.get_by_role("button", name="submit")
1012

11-
1213
def login(self, username, password):
1314
self.username.fill(username)
1415
self.password.fill(password)
15-
self.submit_button.click()
16+
self.submit_button.click()

pytest.ini

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ markers =
1717

1818
# This fixes the issue where python cannot find modules
1919
pythonpath = .
20+
MYPYPATH = .
2021

2122
# Seting for the retry plugin
2223
# timeout is in seconds and effects each individual test, not the entire run

run_tests.sh

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
11
#!/bin/bash
22

3+
mypy tests/*.py pages/*.py utils/*.py --disallow-untyped-defs --explicit-package-bases
34
pytest
Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,14 @@
1-
from flask import Flask
2-
from flask_wtf.csrf import CSRFProtect
1+
from flask import Flask # type: ignore
2+
from flask_wtf.csrf import CSRFProtect # type: ignore
33

44
app = Flask(__name__)
55
csrf = CSRFProtect()
66
csrf.init_app(app)
77

8+
89
@app.route("/")
910
def index():
1011
return "Hello World!"
1112

12-
app.run(host='0.0.0.0', port=8000)
13+
14+
app.run(host="0.0.0.0", port=8000)

0 commit comments

Comments
 (0)