@@ -1221,3 +1221,38 @@ def test_tree_updates_lock(
12211221[options]
12221222exclude-newer = "2023-02-01T02:00:00Z"
12231223""" )
1224+
1225+
1226+ def test_clear_lock (
1227+ tmp_path : pathlib .Path ,
1228+ monkeypatch : pytest .MonkeyPatch ,
1229+ ) -> None :
1230+ monkeypatch .chdir (tmp_path )
1231+
1232+ invoke (["init" , "test.ipynb" ])
1233+ invoke (["add" , "test.ipynb" , "attrs" ])
1234+ invoke (["lock" , "test.ipynb" ])
1235+ assert jupytext .read (tmp_path / "test.ipynb" ).metadata .get ("uv.lock" ) == snapshot ("""\
1236+ version = 1
1237+ requires-python = ">=3.13"
1238+
1239+ [options]
1240+ exclude-newer = "2023-02-01T02:00:00Z"
1241+
1242+ [manifest]
1243+ requirements = [{ name = "attrs" }]
1244+
1245+ [[package]]
1246+ name = "attrs"
1247+ version = "22.2.0"
1248+ source = { registry = "https://pypi.org/simple" }
1249+ sdist = { url = "https://files.pythonhosted.org/packages/21/31/3f468da74c7de4fcf9b25591e682856389b3400b4b62f201e65f15ea3e07/attrs-22.2.0.tar.gz", hash = "sha256:c9227bfc2f01993c03f68db37d1d15c9690188323c067c641f1a35ca58185f99", size = 215900 }
1250+ wheels = [
1251+ { url = "https://files.pythonhosted.org/packages/fb/6e/6f83bf616d2becdf333a1640f1d463fef3150e2e926b7010cb0f81c95e88/attrs-22.2.0-py3-none-any.whl", hash = "sha256:29e95c7f6778868dbd49170f98f8818f78f3dc5e0e37c0b1f474e3561b240836", size = 60018 },
1252+ ]
1253+ """ )
1254+
1255+ result = invoke (["lock" , "test.ipynb" , "--clear" ])
1256+ assert result .exit_code == 0
1257+ assert result .stdout == snapshot ("Cleared lockfile `test.ipynb`\n " )
1258+ assert jupytext .read (tmp_path / "test.ipynb" ).metadata .get ("uv.lock" ) is None
0 commit comments