003 File Manager
Current Path:
/usr/local/lib/python3.8/site-packages/zmq/tests
usr
/
local
/
lib
/
python3.8
/
site-packages
/
zmq
/
tests
/
📁
..
📄
__init__.py
(7.75 KB)
📁
__pycache__
📄
conftest.py
(40 B)
📄
test_asyncio.py
(15.57 KB)
📄
test_auth.py
(20.72 KB)
📄
test_cffi_backend.py
(8.79 KB)
📄
test_constants.py
(4.49 KB)
📄
test_context.py
(12.1 KB)
📄
test_cython.py
(1.03 KB)
📄
test_decorators.py
(9.4 KB)
📄
test_device.py
(6.02 KB)
📄
test_draft.py
(1.42 KB)
📄
test_error.py
(1.17 KB)
📄
test_etc.py
(545 B)
📄
test_future.py
(10.62 KB)
📄
test_imports.py
(1.76 KB)
📄
test_includes.py
(997 B)
📄
test_ioloop.py
(3.84 KB)
📄
test_log.py
(6.51 KB)
📄
test_message.py
(11.68 KB)
📄
test_monitor.py
(3 KB)
📄
test_monqueue.py
(7.97 KB)
📄
test_multipart.py
(941 B)
📄
test_mypy.py
(1.57 KB)
📄
test_pair.py
(1.24 KB)
📄
test_poll.py
(7.17 KB)
📄
test_proxy_steerable.py
(3.7 KB)
📄
test_pubsub.py
(1.07 KB)
📄
test_reqrep.py
(1.8 KB)
📄
test_retry_eintr.py
(2.88 KB)
📄
test_security.py
(8 KB)
📄
test_socket.py
(23.09 KB)
📄
test_ssh.py
(235 B)
📄
test_version.py
(1.3 KB)
📄
test_win32_shim.py
(1.68 KB)
📄
test_z85.py
(2.15 KB)
📄
test_zmqstream.py
(2.35 KB)
Editing: test_mypy.py
""" Test our typing with mypy """ import glob import os import sys import zmq from subprocess import Popen, PIPE, STDOUT import pytest pytest.importorskip("mypy") zmq_dir = os.path.dirname(zmq.__file__) def resolve_repo_dir(path): """Resolve a dir in the repo Resolved relative to zmq dir fallback on CWD (e.g. test run from repo, zmq installed, not -e) """ resolved_path = os.path.join(os.path.dirname(zmq_dir), path) # fallback on CWD if not os.path.exists(resolved_path): resolved_path = path return resolved_path examples_dir = resolve_repo_dir("examples") mypy_dir = resolve_repo_dir("mypy_tests") def run_mypy(path): """Run mypy for a path Captures output and reports it on errors """ p = Popen([sys.executable, "-m", "mypy", path], stdout=PIPE, stderr=STDOUT) o, _ = p.communicate() out = o.decode("utf8", "replace") print(out) assert p.returncode == 0, out if os.path.exists(examples_dir): examples = [ d for d in os.listdir(examples_dir) if os.path.isdir(os.path.join(examples_dir, d)) ] @pytest.mark.skipif( not os.path.exists(examples_dir), reason="only test from examples directory" ) @pytest.mark.parametrize("example", examples) def test_mypy_example(example): example_dir = os.path.join(examples_dir, example) run_mypy(example_dir) if os.path.exists(mypy_dir): mypy_tests = [p for p in os.listdir(mypy_dir) if p.endswith(".py")] @pytest.mark.parametrize("filename", mypy_tests) def test_mypy(filename): run_mypy(os.path.join(mypy_dir, filename))
Upload File
Create Folder