-
Notifications
You must be signed in to change notification settings - Fork 56
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3 changed files
with
110 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,80 @@ | ||
import subprocess | ||
|
||
import conftest | ||
|
||
from nix_update import main | ||
|
||
|
||
# integration test for bitbucket versions (fetch_bitbucket_versions), mostly | ||
# copied from test_gitea.py. | ||
# run directly with 'nix develop -c pytest -s ./tests/test_bitbucket.py'. | ||
def test_version(helpers: conftest.Helpers) -> None: | ||
with helpers.testpkgs(init_git=True) as path: | ||
main(["--file", str(path), "--commit", "bitbucket"]) | ||
version = subprocess.run( | ||
[ | ||
"nix", | ||
"eval", | ||
"--raw", | ||
"--extra-experimental-features", | ||
"nix-command", | ||
"-f", | ||
path, | ||
"bitbucket.version", | ||
], | ||
check=True, | ||
text=True, | ||
stdout=subprocess.PIPE, | ||
).stdout.strip() | ||
assert tuple(map(int, version.split("."))) > (1, 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 "bitbucket" in commit | ||
assert "/jongsoftdev/youless-python-bridge/branches/compare/" in commit | ||
assert "%0D1.0" in commit | ||
|
||
|
||
# integration test for bitbucket snapshots | ||
def test_snapshot(helpers: conftest.Helpers) -> None: | ||
with helpers.testpkgs(init_git=True) as path: | ||
main( | ||
[ | ||
"--file", | ||
str(path), | ||
"--commit", | ||
"--version=branch=master", | ||
"bitbucket-snapshot", | ||
] | ||
) | ||
version = subprocess.run( | ||
[ | ||
"nix", | ||
"eval", | ||
"--raw", | ||
"--extra-experimental-features", | ||
"nix-command", | ||
"-f", | ||
path, | ||
"bitbucket-snapshot.version", | ||
], | ||
check=True, | ||
text=True, | ||
stdout=subprocess.PIPE, | ||
).stdout.strip() | ||
commit = subprocess.run( | ||
["git", "-C", path, "log", "-1"], | ||
text=True, | ||
stdout=subprocess.PIPE, | ||
check=True, | ||
).stdout.strip() | ||
print(commit) | ||
assert version in commit | ||
assert "bitbucket" in commit | ||
assert "/jongsoftdev/youless-python-bridge/branches/compare/" in commit | ||
assert "%0Dc04342ef36dd5ba8f7d9b9fce2fb4926ef401fd5" in commit |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
{ stdenv, fetchFromBitbucket, isSnapshot }: | ||
|
||
let | ||
# Why this package? No reason, I just found a small package that uses tags | ||
# for release by grepping through nixpkgs for fetchFromBitbucket. | ||
owner = "jongsoftdev"; | ||
repo = "youless-python-bridge"; | ||
# As of 2023-11-22, latest version is 1.0.1, so we will be testing that it | ||
# finds a version greater than 1.0. The rev from 2022-10-01 is an untagged | ||
# commit. | ||
version = | ||
if (isSnapshot) | ||
then "unstable-2022-10-01" | ||
else "1.0"; | ||
rev = | ||
if (isSnapshot) | ||
then "c04342ef36dd5ba8f7d9b9fce2fb4926ef401fd5" | ||
else "1.0"; | ||
in | ||
stdenv.mkDerivation rec { | ||
pname = repo; | ||
inherit version; | ||
src = fetchFromBitbucket { | ||
inherit owner repo version rev; | ||
# dont care about hash | ||
hash = "sha256-AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA="; | ||
}; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters