File: test_issue519.py

package info (click to toggle)
python-thinc 9.1.1-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 5,896 kB
  • sloc: python: 17,122; javascript: 1,559; ansic: 342; makefile: 15; sh: 13
file content (29 lines) | stat: -rw-r--r-- 817 bytes parent folder | download | duplicates (2)
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
import subprocess
import sys

try:
    import importlib.resources as importlib_resources
except ImportError:
    import importlib_resources  # type: ignore


import pytest


@pytest.mark.slow
def test_issue519():
    """
    Test ability of Thinc mypy plugin to handle variadic arguments.

    This test can take up to 45 seconds, and is thus marked as slow.
    """
    # Determine the name of the parent module (which contains the test program)
    parent_module_name = __name__[: __name__.rfind(".")]

    # Load test program that calls a Thinc API with variadic arguments
    program_text = importlib_resources.read_text(parent_module_name, "program.py")

    # Ask Mypy to type-check the loaded program text
    subprocess.run(
        [sys.executable, "-m", "mypy", "--command", program_text], check=True
    )