MCPcopy Create free account
hub / github.com/pytest-dev/pytest / spy_write_pyc

Function spy_write_pyc

testing/test_assertrewrite.py:1360–1365  ·  view source on GitHub ↗
(*args, **kwargs)

Source from the content-addressed store, hash-verified

1358 write_pyc_called = []
1359
1360 def spy_write_pyc(*args, **kwargs):
1361 # make a note that we have called _write_pyc
1362 write_pyc_called.append(True)
1363 # try to import a module at this point: we should not try to rewrite this module
1364 assert hook.find_spec("test_bar") is None
1365 return original_write_pyc(*args, **kwargs)
1366
1367 monkeypatch.setattr(rewritemod, "_write_pyc", spy_write_pyc)
1368 monkeypatch.setattr(sys, "dont_write_bytecode", False)

Callers

nothing calls this directly

Calls 2

appendMethod · 0.80
find_specMethod · 0.80

Tested by

no test coverage detected