From 58c48cfa0dabe43ca40ad121cd8299d3954b31da Mon Sep 17 00:00:00 2001 From: figsoda Date: Sun, 6 Aug 2023 14:17:25 -0400 Subject: [PATCH 1/2] fix escaping for non-toplevel attributes --- nix_update/options.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/nix_update/options.py b/nix_update/options.py index 532164c..6ccb03a 100644 --- a/nix_update/options.py +++ b/nix_update/options.py @@ -29,4 +29,4 @@ class Options: extra_flags: List[str] = field(default_factory=list) def __post_init__(self) -> None: - self.escaped_attribute = json.dumps(self.attribute) + self.escaped_attribute = ".".join(map(json.dumps, self.attribute.split("."))) From fd07282345df09cbb000f20750b245ff6f9ec772 Mon Sep 17 00:00:00 2001 From: figsoda Date: Sun, 6 Aug 2023 14:40:40 -0400 Subject: [PATCH 2/2] test non-toplevel attributes --- tests/test_cargo_lock_expand.py | 5 +++-- tests/test_cargo_lock_update.py | 4 ++-- tests/testpkgs/default.nix | 4 ++-- 3 files changed, 7 insertions(+), 6 deletions(-) diff --git a/tests/test_cargo_lock_expand.py b/tests/test_cargo_lock_expand.py index 5cf50bd..bfb7f71 100644 --- a/tests/test_cargo_lock_expand.py +++ b/tests/test_cargo_lock_expand.py @@ -8,7 +8,7 @@ def test_main(helpers: conftest.Helpers) -> None: with helpers.testpkgs(init_git=True) as path: main( - ["--file", str(path), "--commit", "cargoLockExpand", "--version", "v0.3.8"] + ["--file", str(path), "--commit", "cargoLock.expand", "--version", "v0.3.8"] ) subprocess.run( [ @@ -19,7 +19,7 @@ def test_main(helpers: conftest.Helpers) -> None: "nix-command", "-f", path, - "cargoLockExpand.cargoDeps", + "cargoLock.expand.cargoDeps", ], check=True, text=True, @@ -32,6 +32,7 @@ def test_main(helpers: conftest.Helpers) -> None: check=True, ).stdout.strip() print(diff) + assert "cargoLock.expand: 0.3.7 -> 0.3.8" assert "Cargo.lock" in diff assert '+source = "git+' in diff assert "outputHashes" in diff diff --git a/tests/test_cargo_lock_update.py b/tests/test_cargo_lock_update.py index 7bb1d23..3ee5678 100644 --- a/tests/test_cargo_lock_update.py +++ b/tests/test_cargo_lock_update.py @@ -12,7 +12,7 @@ def test_main(helpers: conftest.Helpers) -> None: "--file", str(path), "--commit", - "cargoLockUpdate", + "cargoLock.update", "--version", "v0.0.255", ] @@ -26,7 +26,7 @@ def test_main(helpers: conftest.Helpers) -> None: "nix-command", "-f", path, - "cargoLockUpdate.cargoDeps", + "cargoLock.update.cargoDeps", ], check=True, text=True, diff --git a/tests/testpkgs/default.nix b/tests/testpkgs/default.nix index f19ec9a..28d535f 100644 --- a/tests/testpkgs/default.nix +++ b/tests/testpkgs/default.nix @@ -1,7 +1,7 @@ { pkgs ? import { } }: { - cargoLockExpand = pkgs.callPackage ./cargo-lock-expand { }; - cargoLockUpdate = pkgs.callPackage ./cargo-lock-update { }; + cargoLock.expand = pkgs.callPackage ./cargo-lock-expand { }; + cargoLock.update = pkgs.callPackage ./cargo-lock-update { }; crate = pkgs.callPackage ./crate.nix { }; gitea = pkgs.callPackage ./gitea.nix { }; github = pkgs.callPackage ./github.nix { };