@@ -101,7 +101,7 @@ def find_spec(
101101 state = self .config .stash [assertstate_key ]
102102 if self ._early_rewrite_bailout (name , state ):
103103 return None
104- state .trace ("find_module called for: %s" % name )
104+ state .trace (f "find_module called for: { name } " )
105105
106106 # Type ignored because mypy is confused about the `self` binding here.
107107 spec = self ._find_spec (name , path ) # type: ignore
@@ -273,7 +273,7 @@ def _warn_already_imported(self, name: str) -> None:
273273
274274 self .config .issue_config_time_warning (
275275 PytestAssertRewriteWarning (
276- "Module already imported so cannot be rewritten: %s" % name
276+ f "Module already imported so cannot be rewritten: { name } "
277277 ),
278278 stacklevel = 5 ,
279279 )
@@ -374,29 +374,29 @@ def _read_pyc(
374374 return None
375375 # Check for invalid or out of date pyc file.
376376 if len (data ) != (16 ):
377- trace ("_read_pyc(%s ): invalid pyc (too short)" % source )
377+ trace (f "_read_pyc({ source } ): invalid pyc (too short)" )
378378 return None
379379 if data [:4 ] != importlib .util .MAGIC_NUMBER :
380- trace ("_read_pyc(%s ): invalid pyc (bad magic number)" % source )
380+ trace (f "_read_pyc({ source } ): invalid pyc (bad magic number)" )
381381 return None
382382 if data [4 :8 ] != b"\x00 \x00 \x00 \x00 " :
383- trace ("_read_pyc(%s ): invalid pyc (unsupported flags)" % source )
383+ trace (f "_read_pyc({ source } ): invalid pyc (unsupported flags)" )
384384 return None
385385 mtime_data = data [8 :12 ]
386386 if int .from_bytes (mtime_data , "little" ) != mtime & 0xFFFFFFFF :
387- trace ("_read_pyc(%s ): out of date" % source )
387+ trace (f "_read_pyc({ source } ): out of date" )
388388 return None
389389 size_data = data [12 :16 ]
390390 if int .from_bytes (size_data , "little" ) != size & 0xFFFFFFFF :
391- trace ("_read_pyc(%s ): invalid pyc (incorrect size)" % source )
391+ trace (f "_read_pyc({ source } ): invalid pyc (incorrect size)" )
392392 return None
393393 try :
394394 co = marshal .load (fp )
395395 except Exception as e :
396396 trace (f"_read_pyc({ source } ): marshal.load error { e } " )
397397 return None
398398 if not isinstance (co , types .CodeType ):
399- trace ("_read_pyc(%s ): not a code object" % source )
399+ trace (f "_read_pyc({ source } ): not a code object" )
400400 return None
401401 return co
402402
0 commit comments