-
Notifications
You must be signed in to change notification settings - Fork 266
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
4 changed files
with
79 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,10 @@ | ||
import pygit2 | ||
|
||
url = "https://github.com/libgit2/libgit2" | ||
path = "./libgit2_clone" | ||
|
||
try: | ||
pygit2.clone_repository(url, path) | ||
print("Repository cloned successfully to {}".format(path)) | ||
except Exception as e: | ||
print("Error: {}".format(e)) |
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
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
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,63 @@ | ||
# SUSE's openQA tests | ||
# | ||
# Copyright 2024 SUSE LLC | ||
# SPDX-License-Identifier: FSFAP | ||
# | ||
# Summary: Basic libgit2 test via python pygit2 | ||
# - Test should test on sle15sp6+ and tw, see https://jira.suse.com/browse/PED-7228 | ||
# - Package 'pygit2' requires Python '>=3.7' | ||
# - Run some basic test (test_libgit2.py) | ||
# | ||
# Maintainer: QE Core <qe-core@suse.com> | ||
|
||
use base "consoletest"; | ||
use strict; | ||
use warnings; | ||
use testapi; | ||
use serial_terminal 'select_serial_terminal'; | ||
use version_utils 'is_sle'; | ||
use utils "zypper_call"; | ||
use python_version_utils; | ||
use registration 'add_suseconnect_product'; | ||
|
||
my $python3_version; | ||
my $python_sub_version; | ||
|
||
sub run { | ||
select_serial_terminal; | ||
|
||
# Install libgit2 | ||
if (is_sle) { | ||
add_suseconnect_product("sle-module-desktop-applications"); | ||
add_suseconnect_product('sle-module-development-tools'); | ||
} | ||
my $pkg_ver = script_output("zypper se '/^libgit2-[0-9].*[0-9]\$/' | awk -F '|' '/libgit2-[0-9]/ {gsub(\" \", \"\"); print \$2}' | uniq"); | ||
zypper_call "in $pkg_ver libgit2-tools"; | ||
|
||
# Install the latest python3 package | ||
$python3_version = get_available_python_versions('1'); | ||
zypper_call "in $python3_version"; | ||
$python_sub_version = substr($python3_version, 7); | ||
|
||
# Install pygit2 | ||
assert_script_run "pip3.$python_sub_version install pygit2"; | ||
# Run test script | ||
assert_script_run "wget --quiet " . data_url('libgit2/pygit2_test.py') . " -O pygit2_test.py"; | ||
assert_script_run "python3.$python_sub_version pygit2_test.py"; | ||
|
||
# Cleanup | ||
cleanup(); | ||
} | ||
|
||
sub clean_up { | ||
assert_script_run "pip3.$python_sub_version uninstall pygit2"; | ||
zypper_call "rm $python3_version"; | ||
assert_script_run "rm -rf libgit2"; | ||
} | ||
|
||
sub post_fail_hook { | ||
select_console 'log-console'; | ||
cleanup(); | ||
} | ||
|
||
1; |