File: test_pytester.py

package info (click to toggle)
python-inline-snapshot 0.29.0-2
  • links: PTS, VCS
  • area: main
  • in suites:
  • size: 1,400 kB
  • sloc: python: 8,877; makefile: 37; sh: 30
file content (39 lines) | stat: -rw-r--r-- 814 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
from inline_snapshot import snapshot
from inline_snapshot.testing._example import Example


def test_run_pytester():
    Example(
        {
            "conftest.py": """\
pytest_plugins = ["pytester"]
""",
            "test_things.py": """\
from inline_snapshot import snapshot

def test_not_pytester():
    assert "hey" == snapshot()

def test_pytester(pytester):
    pytester.runpytest()
""",
        }
    ).run_pytest(
        ["--inline-snapshot=create"],
        changed_files=snapshot(
            {
                "test_things.py": """\
from inline_snapshot import snapshot

def test_not_pytester():
    assert "hey" == snapshot("hey")

def test_pytester(pytester):
    pytester.runpytest()
"""
            }
        ),
        returncode=1,
    ).run_pytest(
        ["--inline-snapshot=disable"]
    )