GeezerVisonThe World Wide Web, restored to 800 pixels of glory. |
| Home|About|Gaming cabinet|Archives|How it works|Starter sites |
GeezerVison is showing github.com — winpython/tests/test_audit.py at master · winpython/winpython Expand file tree/ Copy pathtest_audit.pyMore file actions 40 lines (32 loc) · 2.06 KB / Copy pathtest_audit.pyFile metadata and controls40 lines (32 loc) · 2.06 KB 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 40 # -*- coding: utf-8 -*- """wppm -sa reads pins from files offline; only the osv.dev query needs network.""" from wppm import audit def test_pins_from_requirements(tmp_path): req = tmp_path / "requirements.txt" req.write_text("# comment\nMako==1.3.12\nnbconvert[webpdf] == 7.17.1 ; python_version>'3'\nnumpy>=2\n", encoding="utf-8") assert audit.pins_from_file(req) == [("Mako", "1.3.12"), ("nbconvert", "7.17.1")] def test_pins_from_pylock(tmp_path): lock = tmp_path / "pylock.toml" lock.write_text('lock-version = "1.0"\n[[packages]]\nname = "mako"\nversion = "1.3.12"\n' '[[packages]]\nname = "local"\n', encoding="utf-8") assert audit.pins_from_file(lock) == [("mako", "1.3.12")] def test_fixed_in_picks_lowest_fix_above_installed(): vuln = {"affected": [{"package": {"ecosystem": "PyPI", "name": "Pydantic_AI-slim"}, "ranges": [{"type": "ECOSYSTEM", "events": [{"introduced": "0"}, {"fixed": "1.0"}]}, {"type": "ECOSYSTEM", "events": [{"introduced": "1.100"}, {"fixed": "1.107.4"}]}, {"type": "GIT", "events": [{"fixed": "01e0558825b8"}]}]}]} assert audit._fixed_in(vuln, "pydantic-ai-slim", "1.106.0") == "1.107.4" assert audit._fixed_in(vuln, "other", "1.106.0") == "" def test_upgrades_flags_a_fix_with_advisories_of_its_own(monkeypatch): rows = [{"package": "a", "version": "1.0", "fixed": "1.2"}, {"package": "a", "version": "1.0", "fixed": "1.10"}, {"package": "b", "version": "2.0", "fixed": "2.1"}, {"package": "c", "version": "3.0", "fixed": ""}] asked = [] def fake_audit(pins): asked.extend(pins) return [{"package": "b"}] monkeypatch.setattr(audit, "audit", fake_audit) result = audit.upgrades(rows) assert sorted(asked) == [("a", "1.10"), ("b", "2.1")] assert result == {"a": {"version": "1.0", "to": "1.10", "clean": True}, "b": {"version": "2.0", "to": "2.1", "clean": False}, "c": {"version": "3.0", "to": "", "clean": None}} |
| You are visitor 01402503 — GeezerVison does not store the pages you look up. Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required. |