File tree Expand file tree Collapse file tree 4 files changed +44
-12
lines changed Expand file tree Collapse file tree 4 files changed +44
-12
lines changed Original file line number Diff line number Diff line change 75
75
- name : Install
76
76
run : python -m playwright install
77
77
- name : Test
78
- run : pytest -vv --browser=${{ matrix.browser }} --junitxml=junit/test-results-${{ matrix.os }}-${{ matrix.python-version }}-${{ matrix.browser }}.xml --cov=playwright --cov-report xml
78
+ run : pytest -vv --browser=${{ matrix.browser }} --junitxml=junit/test-results-${{ matrix.os }}-${{ matrix.python-version }}-${{ matrix.browser }}.xml --cov=playwright --cov=scripts --cov -report xml
79
79
- name : Coveralls
80
80
run : coveralls
81
81
env :
Original file line number Diff line number Diff line change 1
1
#! /bin/bash
2
2
3
- newfile=" sync_api.py"
4
- oldfile=" playwright/sync_api.py"
3
+ function assert_script {
4
+ newfile=" $2 "
5
+ oldfile=" playwright/$2 "
6
+ echo " Testing $newfile against $oldfile "
5
7
6
- python scripts/generate_sync_api.py > $newfile
8
+ python $1 > $newfile
7
9
8
- pre-commit run --files $newfile
10
+ pre-commit run --files $newfile
9
11
10
- cmp $oldfile $newfile
11
- exit_code=$?
12
+ cmp $oldfile $newfile
13
+ exit_code=$?
14
+ rm $newfile
15
+ return $exit_code
16
+ }
12
17
13
- rm $newfile
14
-
15
- exit $exit_code
18
+ assert_script " scripts/generate_sync_api.py" " sync_api.py"
19
+ assert_script " scripts/generate_async_api.py" " async_api.py"
Original file line number Diff line number Diff line change @@ -71,5 +71,6 @@ def send(self, message: Dict) -> None:
71
71
if "DEBUGP" in os .environ : # pragma: no cover
72
72
print ("\x1b [32mSEND>\x1b [0m" , json .dumps (message , indent = 2 ))
73
73
data = bytes (msg , "utf-8" )
74
- self ._output .write (len (data ).to_bytes (4 , byteorder = "little" , signed = False ))
75
- self ._output .write (data )
74
+ self ._output .write (
75
+ len (data ).to_bytes (4 , byteorder = "little" , signed = False ) + data
76
+ )
Original file line number Diff line number Diff line change
1
+ import sys
2
+ from io import StringIO
3
+ from unittest .mock import patch
4
+
5
+ import pytest
6
+
7
+ CAN_RUN_GENERATION_SCRIPT = sys .version_info >= (3 , 8 )
8
+
9
+ if CAN_RUN_GENERATION_SCRIPT :
10
+ from scripts .generate_async_api import main as generate_async_api
11
+ from scripts .generate_sync_api import main as generate_sync_api
12
+
13
+
14
+ @pytest .mark .skipif (
15
+ not CAN_RUN_GENERATION_SCRIPT , reason = "requires python3.8 or higher"
16
+ )
17
+ def test_generate_sync_api ():
18
+ with patch ("sys.stdout" , new_callable = StringIO ):
19
+ generate_sync_api ()
20
+
21
+
22
+ @pytest .mark .skipif (
23
+ not CAN_RUN_GENERATION_SCRIPT , reason = "requires python3.8 or higher"
24
+ )
25
+ def test_generate_async_api ():
26
+ with patch ("sys.stdout" , new_callable = StringIO ):
27
+ generate_async_api ()
You can’t perform that action at this time.
0 commit comments