Skip to content

Commit

Permalink
Use builtin compile in doc example
Browse files Browse the repository at this point in the history
Follow up to pytest-dev#7438
  • Loading branch information
nicoddemus committed Jul 7, 2020
1 parent ef62b86 commit 36faccc
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions doc/en/example/assertion/failure_demo.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import _pytest._code
import pytest
from pytest import raises

Expand Down Expand Up @@ -197,7 +196,7 @@ def test_dynamic_compile_shows_nicely():
name = "abc-123"
spec = importlib.util.spec_from_loader(name, loader=None)
module = importlib.util.module_from_spec(spec)
code = _pytest._code.compile(src, name, "exec")
code = compile(src, name, "exec")
exec(code, module.__dict__)
sys.modules[name] = module
module.foo()
Expand Down

0 comments on commit 36faccc

Please sign in to comment.