Skip to content

Commit

Permalink
Use module name (-m) to run pytest and pip
Browse files Browse the repository at this point in the history
when using python version other than 3.8
pip and pytest were not using the correct python version
  • Loading branch information
dosas committed Jan 10, 2024
1 parent 3fd2c24 commit affa038
Show file tree
Hide file tree
Showing 7 changed files with 11 additions and 11 deletions.
2 changes: 1 addition & 1 deletion base/container_scripts/install_lint_requirements.sh
Original file line number Diff line number Diff line change
Expand Up @@ -18,5 +18,5 @@ fi
cd "/src/$PROJECT/"

if [[ -f lint_requirements.txt ]]; then
pip install -r lint_requirements.txt
python3 -m pip install -r lint_requirements.txt
fi
4 changes: 2 additions & 2 deletions base/container_scripts/install_performance_requirements.sh
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ fi
cd "/src/$PROJECT/"

if [[ -f perftest_requirements.txt ]]; then
pip install -r perftest_requirements.txt
python3 -m pip install -r perftest_requirements.txt
elif [[ -f functest_requirements.txt ]]; then
pip install -r functest_requirements.txt
python3 -m pip install -r functest_requirements.txt
fi
4 changes: 2 additions & 2 deletions base/container_scripts/install_unit_requirements.sh
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,10 @@ then
exit 1
fi

pip install git+https://github.com/pulp/pulp-smash.git
python3 -m pip install git+https://github.com/pulp/pulp-smash.git

cd "/src/$PROJECT/"

if [[ -f unittest_requirements.txt ]]; then
pip install -r unittest_requirements.txt
python3 -m pip install -r unittest_requirements.txt
fi
4 changes: 2 additions & 2 deletions base/container_scripts/run_functional_tests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ fi
declare PROJECT="${PACKAGE//-/_}"

function check_pytest () {
sudo -u pulp -E type pytest || {
sudo -u pulp -E python3 -m pytest --version || {
cat << EOF
ERROR: pytest is not installed
Expand Down Expand Up @@ -48,4 +48,4 @@ cd "/src/$PACKAGE/"
check_pytest
check_client

sudo -u pulp -E pytest -r sx --rootdir=/var/lib/pulp --color=yes --pyargs "$PROJECT.tests.functional" "${@:2}"
sudo -u pulp -E python3 -m pytest -r sx --rootdir=/var/lib/pulp --color=yes --pyargs "$PROJECT.tests.functional" "${@:2}"
4 changes: 2 additions & 2 deletions base/container_scripts/run_performance_tests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ declare PROJECT="${PACKAGE//-/_}"
set -e

function check_pytest () {
sudo -u pulp -E type pytest || {
sudo -u pulp -E python3 -m pytest --version || {
cat << EOF
ERROR: pytest is not installed
Expand Down Expand Up @@ -48,4 +48,4 @@ cd "/src/$PACKAGE/"
check_pytest
check_client

sudo -u pulp -E pytest -r sx --rootdir=/var/lib/pulp --color=yes --pyargs "$PROJECT.tests.performance" "${@:2}"
sudo -u pulp -E python3 -m pytest -r sx --rootdir=/var/lib/pulp --color=yes --pyargs "$PROJECT.tests.performance" "${@:2}"
2 changes: 1 addition & 1 deletion base/container_scripts/run_unit_tests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -15,4 +15,4 @@ source "/opt/oci_env/base/container_scripts/configure_pulp_smash.sh"

cd "/src/$PACKAGE/"

sudo -u pulp -E PULP_DATABASES__default__USER=postgres pytest -r sx --color=yes --pyargs "$PROJECT.tests.unit" "${@:2}"
sudo -u pulp -E PULP_DATABASES__default__USER=postgres python3 -m pytest -r sx --color=yes --pyargs "$PROJECT.tests.unit" "${@:2}"
2 changes: 1 addition & 1 deletion base/container_scripts/show_urls.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/bin/bash

# this gives us the show_urls django command
pip show django-extensions || pip install django-extensions
python3 -m pip show django-extensions || python3 -m pip install django-extensions

pulpcore-manager show_urls

0 comments on commit affa038

Please sign in to comment.