Datasets:
Download tests/conftest.py from pushkar87dg/pypi-api-drift: direct link, hf CLI and curl.
- Browser
- Download file 2.04 kB
-
https://huggingface.co/datasets/pushkar87dg/pypi-api-drift/resolve/main/tests/conftest.py
- Command line
-
hf download hf://datasets/pushkar87dg/pypi-api-drift/tests/conftest.py
-
curl -L -o conftest.py https://huggingface.co/datasets/pushkar87dg/pypi-api-drift/resolve/main/tests/conftest.py
2.04 kB
| import os, sys | |
| import pytest | |
| HERE = os.path.dirname(os.path.abspath(__file__)) | |
| sys.path.insert(0, HERE) | |
| sys.path.insert(0, os.path.join(HERE, "..")) | |
| sys.path.insert(0, os.path.join(HERE, "..", "pipeline")) | |
| from helpers import build_dataset # noqa: E402 | |
| DEMO_V1 = { | |
| "demo/__init__.py": ( | |
| "from .frame import Frame, read\n" | |
| "from . import util\n" | |
| "def old_helper(x): pass\n" | |
| "def connect(host, port=80, timeout=None): pass\n" | |
| ), | |
| "demo/frame.py": ( | |
| "class Frame:\n" | |
| " def __init__(self, data=None, copy=False): pass\n" | |
| " def append(self, other, ignore_index=False): pass\n" | |
| " def to_csv(self, path, line_terminator='\\n'): pass\n" | |
| "def read(path, error_bad_lines=True, sep=','): pass\n" | |
| ), | |
| "demo/util.py": "def tool(a, b=1): pass\n", | |
| } | |
| DEMO_V2 = { | |
| "demo/__init__.py": ( | |
| "import warnings\n" | |
| "from .frame import Frame, read\n" | |
| "from . import util\n" | |
| "def connect(host, port=80, *, timeout=None): pass\n" | |
| "def legacy():\n warnings.warn('legacy is deprecated', DeprecationWarning)\n" | |
| "def brand_new(): pass\n" | |
| ), | |
| "demo/frame.py": ( | |
| "class Frame:\n" | |
| " def __init__(self, data=None, copy=False): pass\n" | |
| " def to_csv(self, path, lineterminator='\\n'): pass\n" | |
| " def concat(self, other): pass\n" | |
| "def read(path, on_bad_lines='error', sep=','): pass\n" | |
| ), | |
| "demo/util.py": "def tool(a, b=1): pass\n", | |
| } | |
| def data_dir(tmp_path_factory): | |
| d = tmp_path_factory.mktemp("data") | |
| v15 = dict(DEMO_V1) | |
| v15["demo/__init__.py"] = DEMO_V1["demo/__init__.py"] + ( | |
| "import warnings\ndef legacy():\n warnings.warn('legacy is deprecated', DeprecationWarning)\n") | |
| return build_dataset(str(d), {"demo-lib": [("1.0.0", DEMO_V1), ("1.5.0", v15), ("2.0.0", DEMO_V2)]}) | |
| def store(data_dir): | |
| from apidrift.check import Store | |
| return Store(data_dir) | |