CI: Drop STI and use tmt instead

Add tests with python3.14
Add bash completion test from fedora
Improve the bash complation test

Co-authored-by: Charalampos Stratakis <cstratak@redhat.com>
This commit is contained in:
Lukáš Zachar 2026-05-19 17:00:30 +02:00
parent e503c4b5db
commit 9802ec204e
6 changed files with 302 additions and 47 deletions

1
.fmf/version Normal file
View File

@ -0,0 +1 @@
1

85
plan.fmf Normal file
View File

@ -0,0 +1,85 @@
execute:
how: tmt
discover:
- name: tests_python
how: shell
url: https://gitlab.com/redhat/centos-stream/tests/python.git
tests:
- name: smoke312
path: /smoke
test: VERSION=3.12 ./venv.sh
- name: smoke312_virtualenv
path: /smoke
test: VERSION=3.12 METHOD=virtualenv ./venv.sh
- name: smoke314
path: /smoke
test: VERSION=3.14 ./venv.sh
- name: smoke314_virtualenv
path: /smoke
test: VERSION=3.14 METHOD=virtualenv ./venv.sh
- name: rpms_pyproject-rpm-macros
how: shell
url: https://gitlab.com/redhat/centos-stream/rpms/pyproject-rpm-macros.git
ref: c10s
tests:
- name: pyproject_pytest
path: /tests
test: ./mocktest.sh python-pytest
- name: pyproject_entrypoints
path: /tests
test: ./mocktest.sh python-entrypoints
- name: pyproject_pluggy
path: /tests
test: ./mocktest.sh python-pluggy
- name: pyproject_clikit
path: /tests
test: ./mocktest.sh python-clikit
- name: same_repo
how: shell
dist-git-source: true
dist-git-download-only: true
tests:
- name: mock_bootstrap_build
test: |
cd $TMT_SOURCE_DIR &&
$TMT_TREE/../discover/rpms_pyproject-rpm-macros/tests/tests/mocktest.sh python-pip --without tests --without man
- name: pip_install_upgrade
path: /tests/pip_install_upgrade/
test: ./runtest.sh
- name: bash_completion
path: /tests/bash_completion
test: ./pip_completion_full_test.sh
prepare:
- name: Enable CRB
how: feature
crb: enabled
- name: Enable EPEL
how: feature
epel: enabled
- name: Install dependencies
how: install
package:
- gcc
- virtualenv
- python3.12
- python3.12-devel
- python3.14
- python3.14-devel
- python3-tox
- python3-pip
- bash-completion
- mock
- rpmdevtools
- rpm-build
- grep
- util-linux
- shadow-utils
- expect
- dnf
- name: Update packages
how: shell
script: dnf upgrade -y

View File

@ -0,0 +1,88 @@
#!/bin/bash
# Comprehensive PIP bash completion test for RHEL
# Finds completion scripts from RPM, tests all pip binaries, and runs functional tests
PACKAGE="${PACKAGE:-python3-pip}"
# Step 1: Find bash completion scripts in python3-pip RPM package
echo "Step 1: Finding bash completion scripts in $PACKAGE RPM package..."
COMPLETION_FILE=$(rpm -ql "$PACKAGE" 2>/dev/null | grep -E "/usr/share/bash-completion/completions/" || true)
if [[ -z "$COMPLETION_FILE" ]]; then
echo "✗ No bash completion files found in $PACKAGE package"
exit 1
fi
# Check if there's exactly one completion file
COMPLETION_FILE_COUNT=$(echo "$COMPLETION_FILE" | wc -l)
if [[ $COMPLETION_FILE_COUNT -gt 1 ]]; then
echo "✗ Multiple bash completion files found in $PACKAGE package:"
echo "$COMPLETION_FILE" | sed 's/^/ - /'
echo "Expected exactly one completion file, found $COMPLETION_FILE_COUNT"
exit 1
fi
echo "✓ Found completion file from $PACKAGE package:"
echo "$COMPLETION_FILE" | sed 's/^/ - /'
# Step 2: Find all pip binaries
echo
echo "Step 2: Finding all pip binaries..."
PIP_BINARIES=()
PIP_FILES=$(rpm -ql "$PACKAGE" | grep /bin/pip)
for pip_file in $PIP_FILES; do
if [[ -x "$pip_file" ]]; then
pip_cmd=$(basename "$pip_file")
PIP_BINARIES+=("$pip_cmd")
echo "✓ Found: $pip_cmd -> $pip_file"
fi
done
if [[ ${#PIP_BINARIES[@]} -eq 0 ]]; then
echo "✗ No pip binaries found"
exit 1
fi
echo "Total pip binaries found: ${#PIP_BINARIES[@]}"
# Step 3: Source completion scripts and test each binary
echo
echo "Step 3: Testing completion for each pip binary..."
for AS_POSIX in 0 1; do
if [[ $AS_POSIX -eq 1 ]]; then
echo "Testing in POSIX mode"
POSIX="--posix"
else
echo "Testing in non-POSIX mode"
POSIX=""
fi
echo "Sourcing: $COMPLETION_FILE"
if bash --norc $POSIX -c "source $COMPLETION_FILE" ; then
echo "✓ Successfully sourced $COMPLETION_FILE"
else
echo "! Warning: Failed to source $COMPLETION_FILE"
exit 1
fi
export AS_POSIX
for pip_exec in "${PIP_BINARIES[@]}"; do
echo "Running expect test with $COMPLETION_FILE and $pip_exec..."
if ./test_pip_completion.exp "$COMPLETION_FILE" "$pip_exec"; then
echo "✓ Functional test passed"
else
echo "✗ Functional test failed"
exit 1
fi
done
done
echo "✓ All tests completed successfully!"

View File

@ -0,0 +1,126 @@
#!/usr/bin/expect -f
# PIP bash completion smoke test using expect
# Tests actual TAB completion functionality
# Usage: test_pip_completion.exp [completion_file] [pip_binary]
set timeout 5
set completion_file [lindex $argv 0]
set pip_exec [lindex $argv 1]
if {$completion_file eq "" || $pip_exec eq ""} {
puts "Usage: test_pip_completion.exp <completion_file> <pip_binary>"
exit 1
}
puts "=== PIP Bash Completion Test (using expect) ==="
puts "Testing completion file: $completion_file"
puts "Testing pip binary: $pip_exec"
# Check if completion file exists first
if {![file exists $completion_file]} {
puts "✗ Completion file not found: $completion_file"
exit 1
}
puts "✓ Completion file found: $completion_file"
# Start bash shell
if {[info exists env(AS_POSIX)] && $env(AS_POSIX) == "1"} {
spawn bash --norc --posix
} else {
spawn bash --norc
}
send "PS1='READY> '\r"
expect "READY> "
send "\r"
expect "READY> "
# Source the completion file
send "source $completion_file\r"
expect "READY> "
puts "Attempted to source completion file"
# Test 1: Basic pip command completion
puts "\nTest 1: Testing '$pip_exec ' + TAB completion..."
send "$pip_exec "
sleep 0.1
# Send TAB TAB using hex codes
send "\x09\x09"
expect {
-re "(install|uninstall|list|show)" {
puts "✓ Basic pip commands found in completion"
expect "READY> "
}
-re "Display all" {
puts "✓ Completion showing options menu"
send "n\r"
expect "READY> "
}
timeout {
puts "✗ Timeout waiting for completion - test failed"
exit 1
}
}
# Clear the line and ensure clean prompt
send "\x03"
expect "READY> "
send "\r"
expect "READY> "
# Test 2: Test partial command completion (simpler test)
puts "\nTest 2: Testing '$pip_exec insta' + TAB completion..."
send "$pip_exec insta"
sleep 0.1
# Single TAB for completion
send "\x09"
expect {
-re "install" {
puts "✓ Partial command completion works (insta -> install)"
expect "READY> "
}
timeout {
puts "✗ Timeout on partial completion test - test failed"
exit 1
}
}
# Clear the line and ensure clean prompt
send "\x03"
expect "READY> "
send "\r"
expect "READY> "
# Test 3: Test help completion
puts "\nTest 3: Testing '$pip_exec --' + TAB completion..."
send "$pip_exec --"
sleep 0.1
send "\x09\x09"
expect {
-re "(--help|--version)" {
puts "✓ Command options found in completion"
expect "READY> "
}
timeout {
puts "✗ Timeout on options completion test - test failed"
exit 1
}
}
# Final cleanup - make sure we're at clean prompt
send "\x03"
expect "READY> "
send "\r"
expect "READY> "
# Exit bash cleanly
send "exit\r"
expect eof
puts "\n=== Completion Test Complete ==="
puts "PIP bash completion functionality tested!"

View File

@ -18,14 +18,14 @@ RPM_BUILD_ROOT=/ /usr/bin/pip install 'Pello==1.0.1'
/usr/bin/pip freeze | grep '^Pello==1\.0\.2$' /usr/bin/pip freeze | grep '^Pello==1\.0\.2$'
# Both installations should still exist # Both installations should still exist
test -d "${RPM_SITELIB}/Pello-1.0.1-py${PYTHON_VERSION}.egg-info" || test -d "${RPM_SITELIB}/Pello-1.0.1.dist-info" test -d "${RPM_SITELIB}/pello-1.0.1.dist-info"
test -d "${LOCAL_SITELIB}/Pello-1.0.2.dist-info" test -d "${LOCAL_SITELIB}/Pello-1.0.2.dist-info"
# Let's ditch the local one # Let's ditch the local one
/usr/bin/pip uninstall --yes Pello /usr/bin/pip uninstall --yes Pello
# It should only remove one of them # It should only remove one of them
test -d "${RPM_SITELIB}/Pello-1.0.1-py${PYTHON_VERSION}.egg-info" || test -d "${RPM_SITELIB}/Pello-1.0.1.dist-info" test -d "${RPM_SITELIB}/pello-1.0.1.dist-info"
! test -d "${LOCAL_SITELIB}/Pello-1.0.2.dist-info" ! test -d "${LOCAL_SITELIB}/Pello-1.0.2.dist-info"
# And pip should still see the RPM-installed one # And pip should still see the RPM-installed one

View File

@ -1,45 +0,0 @@
---
- hosts: localhost
roles:
- role: standard-test-basic
tags:
- classic
repositories:
- repo: "https://gitlab.com/redhat/centos-stream/tests/python.git"
dest: "python"
- repo: "https://gitlab.com/redhat/centos-stream/rpms/pyproject-rpm-macros.git"
dest: "pyproject-rpm-macros"
version: "c10s"
tests:
- smoke312:
dir: python/smoke
run: VERSION=3.12 ./venv.sh
- smoke312_virtualenv:
dir: python/smoke
run: VERSION=3.12 METHOD=virtualenv ./venv.sh
- pyproject_pytest:
dir: pyproject-rpm-macros/tests
run: ./mocktest.sh python-pytest
- pyproject_entrypoints:
dir: pyproject-rpm-macros/tests
run: ./mocktest.sh python-entrypoints
- pyproject_pluggy:
dir: pyproject-rpm-macros/tests
run: ./mocktest.sh python-pluggy
- pyproject_clikit:
dir: pyproject-rpm-macros/tests
run: ./mocktest.sh python-clikit
- pip_install_upgrade
required_packages:
- 'https://dl.fedoraproject.org/pub/epel/epel-release-latest-10.noarch.rpm'
- gcc
- virtualenv
- python3.12
- python3-devel
- tox
- mock
- rpmdevtools
- rpm-build
- grep
- util-linux
- shadow-utils