mirror of
https://github.com/Mic92/nix-update.git
synced 2024-09-19 06:17:14 +03:00
add integration tests for the diff feature
This commit is contained in:
parent
baf3779e54
commit
8eed06941b
36
tests/test_github.py
Normal file
36
tests/test_github.py
Normal file
@ -0,0 +1,36 @@
|
|||||||
|
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", "github"])
|
||||||
|
version = subprocess.run(
|
||||||
|
[
|
||||||
|
"nix",
|
||||||
|
"eval",
|
||||||
|
"--raw",
|
||||||
|
"--extra-experimental-features",
|
||||||
|
"nix-command",
|
||||||
|
"-f",
|
||||||
|
path,
|
||||||
|
"github.version",
|
||||||
|
],
|
||||||
|
check=True,
|
||||||
|
text=True,
|
||||||
|
stdout=subprocess.PIPE,
|
||||||
|
).stdout.strip()
|
||||||
|
assert version >= "8.5.2"
|
||||||
|
commit = subprocess.run(
|
||||||
|
["git", "-C", path, "log", "-1"],
|
||||||
|
text=True,
|
||||||
|
stdout=subprocess.PIPE,
|
||||||
|
check=True,
|
||||||
|
).stdout.strip()
|
||||||
|
print(commit)
|
||||||
|
assert version in commit
|
||||||
|
assert "github" in commit
|
||||||
|
assert "https://github.com/sharkdp/fd/compare/v8.0.0...v" in commit
|
38
tests/test_gitlab.py
Normal file
38
tests/test_gitlab.py
Normal file
@ -0,0 +1,38 @@
|
|||||||
|
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", "gitlab"])
|
||||||
|
version = subprocess.run(
|
||||||
|
[
|
||||||
|
"nix",
|
||||||
|
"eval",
|
||||||
|
"--raw",
|
||||||
|
"--extra-experimental-features",
|
||||||
|
"nix-command",
|
||||||
|
"-f",
|
||||||
|
path,
|
||||||
|
"gitlab.version",
|
||||||
|
],
|
||||||
|
check=True,
|
||||||
|
text=True,
|
||||||
|
stdout=subprocess.PIPE,
|
||||||
|
).stdout.strip()
|
||||||
|
assert version >= "0.22.0"
|
||||||
|
commit = subprocess.run(
|
||||||
|
["git", "-C", path, "log", "-1"],
|
||||||
|
text=True,
|
||||||
|
stdout=subprocess.PIPE,
|
||||||
|
check=True,
|
||||||
|
).stdout.strip()
|
||||||
|
print(commit)
|
||||||
|
assert version in commit
|
||||||
|
assert "gitlab" in commit
|
||||||
|
assert (
|
||||||
|
"https://gitlab.gnome.org/world/phosh/phosh/-/compare/v0.20.0...v" in commit
|
||||||
|
)
|
@ -1,6 +1,8 @@
|
|||||||
{ pkgs ? import <nixpkgs> {} }:
|
{ pkgs ? import <nixpkgs> {} }:
|
||||||
{
|
{
|
||||||
crate = pkgs.callPackage ./crate.nix {};
|
crate = pkgs.callPackage ./crate.nix {};
|
||||||
|
github = pkgs.callPackage ./github.nix {};
|
||||||
|
gitlab = pkgs.callPackage ./gitlab.nix {};
|
||||||
pypi = pkgs.python3.pkgs.callPackage ./pypi.nix {};
|
pypi = pkgs.python3.pkgs.callPackage ./pypi.nix {};
|
||||||
sourcehut = pkgs.python3.pkgs.callPackage ./sourcehut.nix {};
|
sourcehut = pkgs.python3.pkgs.callPackage ./sourcehut.nix {};
|
||||||
savanna = pkgs.python3.pkgs.callPackage ./savanna.nix {};
|
savanna = pkgs.python3.pkgs.callPackage ./savanna.nix {};
|
||||||
|
13
tests/testpkgs/github.nix
Normal file
13
tests/testpkgs/github.nix
Normal file
@ -0,0 +1,13 @@
|
|||||||
|
{ stdenv, fetchFromGitHub }:
|
||||||
|
|
||||||
|
stdenv.mkDerivation rec {
|
||||||
|
pname = "fd";
|
||||||
|
version = "8.0.0";
|
||||||
|
|
||||||
|
src = fetchFromGitHub {
|
||||||
|
owner = "sharkdp";
|
||||||
|
repo = pname;
|
||||||
|
rev = "v${version}";
|
||||||
|
sha256 = "sha256-AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA=";
|
||||||
|
};
|
||||||
|
}
|
15
tests/testpkgs/gitlab.nix
Normal file
15
tests/testpkgs/gitlab.nix
Normal file
@ -0,0 +1,15 @@
|
|||||||
|
{ stdenv, fetchFromGitLab }:
|
||||||
|
|
||||||
|
stdenv.mkDerivation rec {
|
||||||
|
pname = "phosh";
|
||||||
|
version = "0.20.0";
|
||||||
|
|
||||||
|
src = fetchFromGitLab {
|
||||||
|
domain = "gitlab.gnome.org";
|
||||||
|
group = "world";
|
||||||
|
owner = "phosh";
|
||||||
|
repo = pname;
|
||||||
|
rev = "v${version}";
|
||||||
|
sha256 = "sha256-AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA=";
|
||||||
|
};
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user