Lines Matching refs:tmp_path

47 def test_download_verify_and_reuse(tmp_path):  argument
49 assert fetch.fetch(cache=tmp_path, opener=op, items=[ITEM]) == {"x": "downloaded"}
50 assert (tmp_path / "g/x.rng").read_bytes() == PAYLOAD
51 assert fetch.fetch(cache=tmp_path, opener=op, items=[ITEM]) == {"x": "present"}
55 def test_checksum_mismatch_leaves_nothing_behind(tmp_path): argument
56 res = fetch.fetch(cache=tmp_path, opener=Opener(b"tampered"), items=[ITEM])
58 assert list((tmp_path / "g").iterdir()) == []
61 def test_corrupt_cached_file_is_replaced_only_by_a_verified_download(tmp_path): argument
62 (tmp_path / "g").mkdir()
63 (tmp_path / "g/x.rng").write_bytes(b"corrupt")
64 assert fetch.status(ITEM, tmp_path) == "bad"
65 …assert fetch.fetch(cache=tmp_path, opener=Opener(b"still wrong"), items=[ITEM])["x"].startswith("f…
66 assert (tmp_path / "g/x.rng").read_bytes() == b"corrupt"
67 assert fetch.fetch(cache=tmp_path, opener=Opener(), items=[ITEM]) == {"x": "downloaded"}
68 assert fetch.status(ITEM, tmp_path) == "ok"
71 def test_offline_downloads_nothing(tmp_path): argument
73 assert fetch.fetch(offline=True, cache=tmp_path, opener=op, items=[ITEM]) == {"x": "missing"}
77 def test_network_error_is_reported_not_raised(tmp_path): argument
80 assert fetch.fetch(cache=tmp_path, opener=broken, items=[ITEM]) == {"x": "failed: no route"}
83 def test_only_https_is_fetched(tmp_path): argument
86 … assert fetch.fetch(cache=tmp_path, opener=op, items=[http])["x"].startswith("failed: only https")
90 def test_cache_dir_override(monkeypatch, tmp_path): argument
91 monkeypatch.setenv("AOO_TEST_CACHE", str(tmp_path))
92 assert fetch.cache_dir() == tmp_path
107 def test_tools_prefer_the_environment_then_the_cache(monkeypatch, tmp_path): argument
108 jar = tmp_path / "cache" / "jing" / "jing-20181222.jar"
110 monkeypatch.setenv("AOO_TEST_CACHE", str(tmp_path / "cache"))
118 own = tmp_path / "own.jar"