add cargo-lock-update test

This commit is contained in:
figsoda 2023-03-21 09:07:26 -04:00
parent 6fb7778ddf
commit 4bde7565ab
4 changed files with 3336 additions and 0 deletions

View File

@ -0,0 +1,46 @@
import subprocess
import conftest
from nix_update import main
def test_main(helpers: conftest.Helpers) -> None:
with helpers.testpkgs(init_git=True) as path:
main(
[
"--file",
str(path),
"--commit",
"cargoLockUpdate",
"--version",
"v0.0.255",
]
)
subprocess.run(
[
"nix",
"eval",
"--raw",
"--extra-experimental-features",
"nix-command",
"-f",
path,
"cargoLockUpdate.cargoDeps",
],
check=True,
text=True,
stdout=subprocess.PIPE,
).stdout.strip()
diff = subprocess.run(
["git", "-C", path, "show"],
text=True,
stdout=subprocess.PIPE,
check=True,
).stdout.strip()
print(diff)
assert "Cargo.lock" in diff
assert '+source = "git+' in diff
assert (
"https://github.com/charliermarsh/ruff/compare/v0.0.254...v0.0.255" in diff
)

3263
tests/testpkgs/cargo-lock-update/Cargo.lock generated Normal file

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,26 @@
{ rustPlatform, fetchFromGitHub }:
rustPlatform.buildRustPackage rec {
pname = "ruff";
version = "0.0.254";
src = fetchFromGitHub {
owner = "charliermarsh";
repo = pname;
rev = "v${version}";
hash = "sha256-61Yw4YWolMZbi9nqDdkSH4UxIpPxUO4Aq44ABXZxMbU=";
};
cargoLock = {
lockFile = ./Cargo.lock;
outputHashes = {
"libcst-0.1.0" = "sha256-jG9jYJP4reACkFLrQBWOYH6nbKniNyFVItD0cTZ+nW0=";
"libcst_derive-0.1.0" = "sha256-jG9jYJP4reACkFLrQBWOYH6nbKniNyFVItD0cTZ+nW0=";
"rustpython-ast-0.2.0" = "sha256-Q2PVP+noPvdjoe8OMzEZOHprSwvpu/rmMkllghnf/yI=";
"rustpython-common-0.2.0" = "sha256-Q2PVP+noPvdjoe8OMzEZOHprSwvpu/rmMkllghnf/yI=";
"rustpython-compiler-core-0.2.0" = "sha256-Q2PVP+noPvdjoe8OMzEZOHprSwvpu/rmMkllghnf/yI=";
"rustpython-parser-0.2.0" = "sha256-Q2PVP+noPvdjoe8OMzEZOHprSwvpu/rmMkllghnf/yI=";
"unicode_names2-0.6.0" = "sha256-eWg9+ISm/vztB0KIdjhq5il2ZnwGJQCleCYfznCI3Wg=";
};
};
}

View File

@ -1,6 +1,7 @@
{ pkgs ? import <nixpkgs> { } }:
{
cargoLockExpand = pkgs.callPackage ./cargo-lock-expand { };
cargoLockUpdate = pkgs.callPackage ./cargo-lock-update { };
crate = pkgs.callPackage ./crate.nix { };
gitea = pkgs.callPackage ./gitea.nix { };
github = pkgs.callPackage ./github.nix { };