File: examples_test.py

package info (click to toggle)
python-pook 2.1.3-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 672 kB
  • sloc: python: 3,558; makefile: 13
file content (22 lines) | stat: -rw-r--r-- 545 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
import platform
import subprocess
from pathlib import Path
import sys

import pytest

examples_dir = Path(__file__).parents[2] / "examples"

examples = [f.name for f in examples_dir.glob("*.py")]


if platform.python_implementation() == "PyPy":
    # See pyproject.toml note on mocket dependency
    examples.remove("mocket_example.py")


@pytest.mark.parametrize("example", examples)
def test_examples(example):
    result = subprocess.run([sys.executable, f"examples/{example}"], check=False)

    assert result.returncode == 0, result.stdout