okami.mom/strata

git clone https://git.nkp.pet/okami.mom/strata

Niko1221Merge main 6c642df75 into f-own-int (round 16: network waits, robustness, Windows kill-on-close job start, GitHub and transfer fixes)cd9745050

main
23.0 KiB449 linesraw
1"""Tests for setup.py's reproducible installs (#214): the engine of the checkout's own release first (the latest as
2the fallback), Hugging Face files at pinned revisions (a gone revision stops the download), the pinned
3requirements file, and an existing install left as it is.  Mocked network - nothing is downloaded.
4
5    python -m unittest tools.test_setup_pins
6"""
7from __future__ import annotations
8
9import contextlib
10import hashlib
11import io
12import json
13import re
14import sys
15import tempfile
16import unittest
17import urllib.error
18import zipfile
19from pathlib import Path
20from unittest import mock
21
22ROOT = Path(__file__).resolve().parents[1]
23sys.path.insert(0, str(ROOT))
24sys.path.insert(0, str(ROOT / "tools"))
25import setup  # noqa: E402
26
27SHA = re.compile(r"/resolve/[0-9a-f]{40}/")
28
29
30class Response(io.BytesIO):
31    def __init__(self, body=b"", status=200):
32        super().__init__(body)
33        self.status = status
34        self.headers = {"Content-Length": str(len(body))}
35
36    def __enter__(self):
37        return self
38
39    def __exit__(self, *exc):
40        self.close()
41
42
43def not_found(url):
44    return urllib.error.HTTPError(url, 404, "Not Found", {}, None)
45
46
47def quiet(fn, *args, **kw):
48    out = io.StringIO()
49    with contextlib.redirect_stdout(out):
50        return fn(*args, **kw), out.getvalue()
51
52
53class HuggingFacePins(unittest.TestCase):
54    def test_every_model_url_is_pinned(self):
55        for name, fam in setup.FAMILIES.items():
56            if fam.get("ready"):                       # ready-made packs: pinned per file (test_ready_packs_pinned)
57                continue
58            for key in ("hf", "mmproj_hf"):
59                with self.subTest(family=name, key=key):
60                    self.assertRegex(fam[key], SHA)
61                    self.assertNotIn("/resolve/main/", fam[key])
62        self.assertRegex(setup.HF, SHA)
63
64    def test_ready_packs_pinned(self):
65        """NVFP4: every size names a repository of NVFP4_REPOS, pinned by a commit; every file has a size and a
66        SHA-256, and the pack folder, dense GGUF, n-gram table and embedding are each there."""
67        sizes = [m for m, d in setup.MODELS.items() if d.get("repo")]
68        self.assertEqual(sorted(sizes), ["NVFP4", "NVFP4-NVIDIA", "NVFP4-QAD"])
69        for m in sizes:
70            if setup.MODELS[m].get("prepare"):         # NVIDIA's checkpoint: pinned files, prepared on the PC
71                t = setup.NVFP4_REPOS[setup.MODELS[m]["repo"]]
72                self.assertRegex(t["revision"], r"^[0-9a-f]{40}$")
73                for path, (role, size, sha) in t["files"].items():
74                    self.assertEqual(role, "src")
75                    self.assertGreater(size, 0)
76                    self.assertRegex(sha, r"^[0-9a-f]{64}$")
77                self.assertEqual(sorted(setup.ready_paths(m, setup.Path("M"))), ["dense", "mtp", "pack", "ple"])
78                continue
79            t = setup.NVFP4_REPOS[setup.MODELS[m]["repo"]]
80            self.assertRegex(t["revision"], r"^[0-9a-f]{40}$")
81            for path, (role, size, sha) in t["files"].items():
82                with self.subTest(model=m, path=path):
83                    self.assertIn(role, ("pack", "dense", "ple", "embd"))
84                    self.assertGreater(size, 0)
85                    self.assertRegex(sha, r"^[0-9a-f]{64}$")
86            p = setup.ready_paths(m, setup.Path("M"))
87            self.assertEqual(sorted(p), ["dense", "embd", "pack", "ple"])
88            self.assertEqual(p["pack"].name, "pack")
89            self.assertIn("experts.bin", t["files"] and [x.split("/")[-1] for x in t["files"]])
90
91    def test_unpinned(self):
92        url = setup.FAMILIES["swift"]["hf"] + "x.gguf"
93        self.assertEqual(setup.hf_unpinned(url),
94                         "https://huggingface.co/ukisai/Swift-1.5-Qwen3.8-Flash-Next-GSQ-RCO-GGUF/resolve/main/x.gguf")
95        self.assertEqual(setup.hf_unpinned("https://example.com/a/b"), "https://example.com/a/b")
96
97    def test_a_gone_revision_stops_the_download(self):
98        """The pinned commit answers 404: setup stops with a plain message and fetches no current file."""
99        seen = []
100
101        def urlopen(req, timeout=None):
102            seen.append((req.get_method(), req.full_url))
103            raise not_found(req.full_url)
104
105        with tempfile.TemporaryDirectory() as d, mock.patch.object(setup.netpolicy, "urlopen", urlopen),                 mock.patch.dict(setup.os.environ, {"STRATA_SOURCE": "huggingface"}):
106            setup.os.environ.pop("STRATA_ALLOW_UNPINNED", None)
107            dst = Path(d) / "m.gguf"
108            with self.assertRaises(SystemExit):
109                _, out = quiet(setup.download, setup.FAMILIES["qwen"]["mmproj_hf"] + "m.gguf", dst)
110            self.assertFalse(dst.exists())
111        self.assertEqual([m for m, _ in seen], ["HEAD"])
112        self.assertTrue(all("/resolve/main/" not in u for _, u in seen))
113
114    def test_the_opt_out_downloads_the_current_file(self):
115        """STRATA_ALLOW_UNPINNED=1 (a tester's choice): the repository's current file, announced, off by default."""
116        seen = []
117
118        def urlopen(req, timeout=None):
119            seen.append((req.get_method(), req.full_url))
120            if "/resolve/main/" not in req.full_url:
121                raise not_found(req.full_url)
122            return Response(b"model bytes", status=200)
123
124        # the pinned Hugging Face path itself (setup's --source huggingface; auto may pick ModelScope)
125        with tempfile.TemporaryDirectory() as d, mock.patch.object(setup.netpolicy, "urlopen", urlopen),                 mock.patch.dict(setup.os.environ, {"STRATA_SOURCE": "huggingface", "STRATA_ALLOW_UNPINNED": "1"}),                 mock.patch.object(setup, "_unpinned_said", []):
126            dst = Path(d) / "m.gguf"
127            _, out = quiet(setup.download, setup.FAMILIES["qwen"]["mmproj_hf"] + "m.gguf", dst)
128            self.assertEqual(dst.read_bytes(), b"model bytes")
129        self.assertIn("STRATA_ALLOW_UNPINNED=1", out)
130        self.assertIn("not at the pinned revision any more", out)
131        self.assertEqual([m for m, _ in seen], ["HEAD", "HEAD", "GET"])
132        self.assertTrue(all("/resolve/main/" in u for _, u in seen[1:]))
133
134    def test_a_complete_part_is_finished_without_a_request(self):
135        """A .part with every byte (setup stopped between the last byte and the rename): renamed, not resumed with a
136        range past its end - the server answers that with 416, which download() retried 30 times, 10 s apart."""
137        seen = []
138
139        def urlopen(req, timeout=None):
140            seen.append((req.get_method(), req.headers.get("Range")))
141            if req.get_method() == "HEAD":
142                return Response(b"model bytes")
143            raise urllib.error.HTTPError(req.full_url, 416, "Range Not Satisfiable", {}, None)
144
145        with tempfile.TemporaryDirectory() as d, mock.patch.object(setup.netpolicy, "urlopen", urlopen), \
146                mock.patch.object(setup.time, "sleep", lambda s: None):
147            dst = Path(d) / "m.gguf"
148            dst.with_name("m.gguf.part").write_bytes(b"model bytes")
149            quiet(setup.download, "https://example.com/m.gguf", dst)
150            self.assertEqual(dst.read_bytes(), b"model bytes")
151            self.assertTrue(setup.done(dst))
152        self.assertEqual(seen, [("HEAD", None)])
153
154    def test_mtp_fetch_is_pinned_and_stops_when_the_revision_is_gone(self):
155        import mtp_fetch
156        self.assertRegex(mtp_fetch.REPO, SHA)
157        self.assertIn(mtp_fetch.REVISION, mtp_fetch.REPO)
158        pinned = mtp_fetch.REPO
159
160        def urlopen(req, timeout=None):
161            raise not_found(req.full_url)
162
163        try:
164            with mock.patch.object(mtp_fetch.netpolicy, "urlopen", urlopen),                     mock.patch.dict(mtp_fetch.os.environ, {"STRATA_ALLOW_UNPINNED": ""}):
165                with self.assertRaises(SystemExit) as stop:
166                    mtp_fetch.resolve_repo()
167                self.assertIn("no longer on Hugging Face", str(stop.exception))
168                self.assertEqual(mtp_fetch.REPO, pinned)
169            with mock.patch.object(mtp_fetch.netpolicy, "urlopen", urlopen),                     mock.patch.dict(mtp_fetch.os.environ, {"STRATA_ALLOW_UNPINNED": "1"}),                     contextlib.redirect_stderr(io.StringIO()) as err:
170                self.assertEqual(mtp_fetch.resolve_repo(), "https://huggingface.co/Qwen/Qwen3.8-Flash-Next/resolve/main/")
171            self.assertIn("STRATA_ALLOW_UNPINNED=1", err.getvalue())
172        finally:
173            mtp_fetch.REPO = pinned
174
175    def test_hf_endpoint(self):
176        # #495: HF_ENDPOINT (a mirror) serves the same pinned revision; a trailing slash and blanks are dropped
177        repo = "ISTA-DASLab/Qwen3.8-Flash-Next-GSQ-RCO-GGUF"
178        with mock.patch.dict(setup.os.environ, {}, clear=False):
179            setup.os.environ.pop("HF_ENDPOINT", None)
180            self.assertEqual(setup.hf(repo), f"https://huggingface.co/{repo}/resolve/{setup.HF_REVISIONS[repo]}/")
181            for value in ("https://hf-mirror.com", "https://hf-mirror.com/", " https://hf-mirror.com/ "):
182                setup.os.environ["HF_ENDPOINT"] = value
183                url = setup.hf(repo)
184                self.assertEqual(url, f"https://hf-mirror.com/{repo}/resolve/{setup.HF_REVISIONS[repo]}/")
185                self.assertRegex(url, SHA)
186                self.assertEqual(setup.hf_unpinned(url + "x.gguf"), f"https://hf-mirror.com/{repo}/resolve/main/x.gguf")
187            setup.os.environ["HF_ENDPOINT"] = ""
188            self.assertEqual(setup.hf_endpoint(), "https://huggingface.co")
189
190    def test_mtp_fetch_honours_hf_endpoint(self):
191        import importlib
192        import mtp_fetch
193        try:
194            with mock.patch.dict(mtp_fetch.os.environ, {"HF_ENDPOINT": "https://hf-mirror.com/"}):
195                importlib.reload(mtp_fetch)
196                self.assertTrue(mtp_fetch.REPO.startswith("https://hf-mirror.com/Qwen/Qwen3.8-Flash-Next/resolve/"))
197                self.assertRegex(mtp_fetch.REPO, SHA)
198                self.assertTrue(mtp_fetch.pinned())                 # the tensors' SHA-256 checks still apply
199        finally:
200            importlib.reload(mtp_fetch)
201        self.assertTrue(mtp_fetch.REPO.startswith("https://huggingface.co/"))
202
203    def test_step5_names_the_folder(self):
204        # #495: where setup expects the model files, and how to give it files downloaded by hand
205        from test_setup_golden import PROFILES, install
206        ram, found = PROFILES["96GB-1x16GB"]
207        with mock.patch.dict(setup.os.environ, {"HF_ENDPOINT": "https://hf-mirror.com"}):
208            code, out, cfg, _ = install(ram, found, ["--family", "qwen", "--model", "IQ3_XXS", "--no-start"])
209        self.assertEqual(code, 0)
210        text = out.replace("\\", "/")
211        self.assertRegex(text, r"The model files go in .*/models/IQ3_XXS")
212        self.assertIn("put them here with their original names (Qwen3.8-Flash-Next-GSQ-RCO-IQ3_XXS-00001-of-00002.gguf",
213                      text)
214        self.assertIn("--gguf-dir", text)
215        self.assertIn("Downloading from https://hf-mirror.com (HF_ENDPOINT)", text)
216
217
218@unittest.skipIf(setup.is_arm64() and sys.platform.startswith("linux"),
219                 "arm64 Linux takes its ready-made engine from the signed feed, not from the flat x86 zips these tests build "
220                 "(tests/terminal/test_linux_aarch64.py covers that path)")
221class Engine(unittest.TestCase):
222    def setUp(self):
223        self.tmp = tempfile.TemporaryDirectory()
224        self.root = Path(self.tmp.name)
225        (self.root / "engine").mkdir()
226        self.patches = [mock.patch.object(setup, "ROOT", self.root),
227                        mock.patch.object(setup, "source_version", lambda: "0.1.31")]
228        for p in self.patches:
229            p.start()
230
231    def tearDown(self):
232        for p in reversed(self.patches):
233            p.stop()
234        self.tmp.cleanup()
235
236    def fake_download(self, got, wrote=None):
237        def download(url, dst, what=None):
238            got.append(url)
239            if wrote is not None:
240                wrote.append(Path(dst))
241            with zipfile.ZipFile(dst, "w") as z:
242                z.writestr("BUILD.json", json.dumps({"version": ".".join(map(str, setup.MIN_ENGINE)), "archs": [89]}))
243                z.writestr(setup.EXE, b"engine")
244        return download
245
246    def fake_digest(self, wrote):
247        """The SHA-256 of whatever the fake download just wrote, computed for real.
248
249        `get_prebuilt()` now checks the archive against GitHub's size and SHA-256 before it unpacks
250        anything, so a test that mocks the download has to supply a hash or it stops at the check. These
251        tests are about WHICH release and WHICH asset are chosen, not about the bytes; what happens when
252        the hash is wrong has its own file (tools/test_setup_engine_hash.py).
253        """
254        def digest(asset, base):
255            data = Path(wrote[-1]).read_bytes()
256            return len(data), hashlib.sha256(data).hexdigest()
257        return digest
258
259    def run_get(self, published):
260        heads, got, wrote = [], [], []
261
262        def urlopen(req, timeout=None):
263            heads.append(req.full_url)
264            if not any(req.full_url.startswith(p) for p in published):
265                raise not_found(req.full_url)
266            return Response()
267
268        with mock.patch.object(setup.netpolicy, "urlopen", urlopen), \
269                mock.patch.object(setup, "download", self.fake_download(got, wrote)), \
270                mock.patch.object(setup, "engine_digest", self.fake_digest(wrote)):
271            eng, out = quiet(setup.get_prebuilt, setup.PREBUILT_URL, {"arch": 89}, "gpu")
272        return eng, out, heads, got
273
274    def test_bases(self):
275        self.assertEqual(setup.prebuilt_bases(setup.PREBUILT_URL),
276                         ["https://github.com/Niko1221/Strata/releases/download/v0.1.31/", setup.PREBUILT_URL])
277        self.assertEqual(setup.prebuilt_bases("https://mirror.example/x"), ["https://mirror.example/x/"])
278
279    def test_the_checkout_s_release_first(self):
280        tag = "https://github.com/Niko1221/Strata/releases/download/v0.1.31/"
281        eng, out, heads, got = self.run_get([tag, setup.PREBUILT_URL])
282        self.assertEqual(eng, self.root / "engine")
283        self.assertEqual(got, [tag + setup.PREBUILT_ASSET])
284        self.assertEqual(len(heads), 1)
285
286    def test_latest_when_it_is_not_published(self):
287        eng, out, heads, got = self.run_get([setup.PREBUILT_URL])
288        self.assertEqual(eng, self.root / "engine")
289        self.assertEqual(got, [setup.PREBUILT_URL + setup.PREBUILT_ASSET])
290        self.assertIn("No ready-made engine for v0.1.31", out)
291
292    def test_a_refused_archive_is_not_kept(self):
293        """PR #324: a refused archive (too old, or no code for the GPU) kept its zip and .done mark, and every later
294        run reused it ("already downloaded") instead of the published one."""
295        for meta in ({"version": "0.1.0", "archs": [89]},
296                     {"version": ".".join(map(str, setup.MIN_ENGINE)), "archs": [120]}):
297            with self.subTest(meta=meta):
298                wrote = []
299
300                def download(url, dst, what=None):
301                    wrote.append(Path(dst))
302                    with zipfile.ZipFile(dst, "w") as z:
303                        z.writestr("BUILD.json", json.dumps(meta))
304                        z.writestr(setup.EXE, b"engine")
305                    setup.mark(dst)
306
307                with mock.patch.object(setup.netpolicy, "urlopen", lambda req, timeout=None: Response()), \
308                        mock.patch.object(setup, "download", download), \
309                        mock.patch.object(setup, "engine_digest", self.fake_digest(wrote)):
310                    eng, _ = quiet(setup.get_prebuilt, setup.PREBUILT_URL, {"arch": 89}, "gpu")
311                self.assertIsNone(eng)
312                z = self.root / "engine" / setup.PREBUILT_ASSET
313                self.assertFalse(z.exists())
314                self.assertFalse(z.with_name(z.name + ".done").exists())
315
316    def test_an_archive_that_does_not_unpack_is_not_kept(self):
317        """#397, for an archive that does not unpack (not a zip, or a damaged one): it kept its zip and .done mark,
318        so every later run failed on it, even after the right one was published."""
319        with tempfile.TemporaryDirectory() as folder:  # a --prebuilt folder, through the real download()
320            asset = Path(folder) / setup.PREBUILT_ASSET
321            asset.write_bytes(b"<html>not a zip</html>")
322            with self.assertRaises(zipfile.BadZipFile):
323                quiet(setup.get_prebuilt, folder, {"arch": 89}, "gpu")
324            with zipfile.ZipFile(asset, "w") as z:
325                z.writestr("BUILD.json", json.dumps({"version": ".".join(map(str, setup.MIN_ENGINE)), "archs": [89]}))
326                z.writestr(setup.EXE, b"engine")
327            eng, _ = quiet(setup.get_prebuilt, folder, {"arch": 89}, "gpu")
328        self.assertEqual(eng, self.root / "engine")
329        self.assertEqual((self.root / "engine" / setup.EXE).read_bytes(), b"engine")
330
331    def test_an_installed_engine_is_kept(self):
332        (self.root / "engine" / "BUILD.json").write_text(json.dumps(
333            {"version": ".".join(map(str, setup.MIN_ENGINE)), "archs": [89]}))
334        (self.root / "engine" / setup.EXE).write_bytes(b"old")
335
336        def urlopen(req, timeout=None):
337            raise AssertionError("asked the network for an installed engine")
338
339        with mock.patch.object(setup.netpolicy, "urlopen", urlopen):
340            eng, out = quiet(setup.get_prebuilt, setup.PREBUILT_URL, {"arch": 89}, "gpu")
341        self.assertEqual(eng, self.root / "engine")
342        self.assertEqual((self.root / "engine" / setup.EXE).read_bytes(), b"old")
343
344
345class Requirements(unittest.TestCase):
346    def test_every_package_is_pinned(self):
347        lines = setup.requirement_lines()
348        names = {setup.req_name(x) for x in lines}
349        for p in setup.PY_PACKAGES:
350            self.assertIn(p, names)
351        for x in lines:
352            self.assertIn("==", x, x)
353        self.assertEqual(setup.req_name('numpy==2.5.3; python_version >= "3.12"'), "numpy")
354        self.assertEqual(setup.req_name("charset_normalizer==3"), "charset-normalizer")
355
356    def test_build_helpers_are_pinned_but_absent_from_runtime_install(self):
357        runtime = {setup.req_name(x) for x in setup.requirement_lines()}
358        build = setup.requirement_lines(setup.BUILD_REQUIREMENTS)
359        self.assertEqual({setup.req_name(x) for x in build}, {"cmake", "ninja"})
360        self.assertTrue(all("==" in x for x in build))
361        self.assertTrue(runtime.isdisjoint({"cmake", "ninja"}))
362
363    def test_local_build_installs_only_missing_helper(self):
364        installed = False
365        requests = []
366        commands = []
367
368        def find_tool(name):
369            if name == "cmake":
370                return "/usr/bin/cmake"
371            return "/venv/bin/ninja" if installed else None
372
373        def pip_install(packages, what):
374            nonlocal installed
375            requests.append((packages, what))
376            installed = True
377
378        def run(command, **kwargs):
379            commands.append(command)
380            return mock.Mock(returncode=0)
381
382        with mock.patch.object(setup, "WIN", False), \
383                mock.patch.object(setup, "find_tool", side_effect=find_tool), \
384                mock.patch.object(setup, "_tool_version", return_value=(True, (3, 28, 1))), \
385                mock.patch.object(setup, "pip_install", side_effect=pip_install), \
386                mock.patch.object(setup, "run", side_effect=run):
387            setup.cmake_build(ROOT, ROOT / "build-test", "strata", [], None, "unused.bat")
388        self.assertEqual(requests, [(["ninja==1.13.2"], "CMake and Ninja build tools")])
389        self.assertEqual(commands[0][:4], ["/usr/bin/cmake", "-G", "Ninja", "-DCMAKE_MAKE_PROGRAM=/venv/bin/ninja"])
390        self.assertEqual(commands[1][:3], ["/usr/bin/cmake", "--build", str(ROOT / "build-test")])
391
392    def pip(self, stamp, packages, installed=()):
393        ran = []
394        with tempfile.TemporaryDirectory() as d:
395            if stamp is not None:
396                (Path(d) / ".strata-pip.json").write_text(json.dumps(stamp))
397                # written by this system (#3634's marker): without it the stamp is believed only when numpy/jinja2/regex/yaml import in the
398                # Python running the tests, which made these tests depend on the box
399                (Path(d) / ".strata-pip.json.os").write_text(setup.sys.platform)
400            with mock.patch.object(setup.sys, "prefix", d), \
401                    mock.patch.object(setup, "run", lambda cmd, **kw: ran.append(cmd)), \
402                    mock.patch.object(setup, "_installed", lambda name: name in installed):
403                quiet(setup.pip_install, packages, "the packages")
404            after = json.loads((Path(d) / ".strata-pip.json").read_text()) if ran else stamp
405        return [c for cmd in ran for c in cmd if "==" in c or c in setup.PY_PACKAGES], after
406
407    def test_a_stamp_written_by_another_system_is_not_believed(self):                    # #3634
408        lines = setup.requirement_lines()
409        with tempfile.TemporaryDirectory() as d:
410            (Path(d) / ".strata-pip.json").write_text(json.dumps(lines))
411            (Path(d) / ".strata-pip.json.os").write_text("win32" if setup.sys.platform != "win32" else "linux")
412            ran = []
413            with mock.patch.object(setup.sys, "prefix", d), mock.patch.object(setup, "run", lambda cmd, **kw: ran.append(cmd)):
414                quiet(setup.pip_install, lines, "the packages")
415            self.assertTrue(ran)                                                          # installed again, here
416            self.assertEqual((Path(d) / ".strata-pip.json.os").read_text(), setup.sys.platform)
417            ran.clear()
418            with mock.patch.object(setup.sys, "prefix", d), mock.patch.object(setup, "run", lambda cmd, **kw: ran.append(cmd)):
419                quiet(setup.pip_install, lines, "the packages")
420            self.assertFalse(ran)                                                         # and then skipped as before
421
422    def test_fresh_install_gets_every_pin(self):
423        lines = setup.requirement_lines()
424        ran, stamp = self.pip(None, lines)
425        self.assertEqual(ran, lines)
426        self.assertEqual(sorted(stamp), sorted(lines))
427        self.assertEqual(self.pip(stamp, lines)[0], [])                       # the second run: nothing
428
429    def test_an_install_from_before_the_pins_is_left_alone(self):
430        lines = setup.requirement_lines()
431        legacy = sorted(setup.PY_PACKAGES) + ["nvidia-cublas==13.0.2.14"]
432        deps = {"markupsafe", "certifi", "charset-normalizer", "idna", "urllib3", "colorama"}
433        # the packages it has stay as they are; only truststore (#3722: the operating system's certificates) is new, and it is wanted
434        self.assertEqual(self.pip(legacy, lines, installed=deps)[0], ['truststore==0.10.5; python_version >= "3.10"'])
435        deps.add("truststore")
436        self.assertEqual(self.pip(legacy, lines, installed=deps)[0], [])
437        missing = [p for p in legacy if p != "psutil"]                         # an older list without psutil
438        ran, _ = self.pip(missing, lines, installed=deps)
439        self.assertEqual(ran, ["psutil==7.2.2"])
440
441    def test_a_changed_pin_is_installed(self):
442        lines = setup.requirement_lines()
443        old = [x.replace("tqdm==4.70.1", "tqdm==4.60.0") for x in lines]
444        ran, _ = self.pip(old, lines)
445        self.assertEqual(ran, ["tqdm==4.70.1"])
446
447
448if __name__ == "__main__":
449    unittest.main()