11# Extra fixtures used for wasm testing, including some that override the default pytest fixtures.
2- from functools import partial
32import os
43import pathlib
5- from playwright .sync_api import Page
6- import pytest
74import re
85import subprocess
96import time
7+ from functools import partial
8+
9+ import pytest
10+ from playwright .sync_api import Page
1011
1112
1213# Only include particular test files when testing wasm.
@@ -94,8 +95,7 @@ def read_bytes(self) -> bytes:
9495 def read_text (self ) -> str :
9596 p = subprocess .run (["cat" , str (self )], capture_output = True , text = True , check = True )
9697 text = p .stdout
97- if text .endswith ("\n " ):
98- text = text [:- 1 ]
98+ text = text .removesuffix ("\n " )
9999 return text
100100
101101 def write_bytes (self , data : bytes ):
@@ -110,8 +110,7 @@ def write_text(self, data: str):
110110 # Note that in general it is not valid to direct output of a subprocess.run call to a file,
111111 # but we get away with it here as the command arguments are passed straight through to
112112 # cockle without being checked.
113- if data .endswith ("\n " ):
114- data = data [:- 1 ]
113+ data = data .removesuffix ("\n " )
115114 cmd = ["echo" , data , ">" , str (self )]
116115 subprocess .run (cmd , capture_output = True , text = True , check = True )
117116 return len (data )
0 commit comments