URL: https://github.com/SSSD/sssd/pull/867
Author: pbrezina
 Title: #867: ci: use python2 version of pytest
Action: synchronized

To pull the PR as Git branch:
git remote add ghsssd https://github.com/SSSD/sssd
git fetch ghsssd pull/867/head:pr867
git checkout pr867
From 59454a8012bbe31ff0f1993f3d6f23a4fb4ea099 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Pavel=20B=C5=99ezina?= <pbrez...@redhat.com>
Date: Mon, 19 Aug 2019 12:28:30 +0200
Subject: [PATCH 1/2] ci: use python2 version of pytest

Fedora 31 changed symlink of /usr/bin/py.test from pytest2 to pytest3.
We need to run the python2 version in order to run our tests with python2.
---
 src/external/intgcheck.m4  | 7 +++++--
 src/tests/intg/Makefile.am | 2 +-
 2 files changed, 6 insertions(+), 3 deletions(-)

diff --git a/src/external/intgcheck.m4 b/src/external/intgcheck.m4
index c14f66978b..05b3616433 100644
--- a/src/external/intgcheck.m4
+++ b/src/external/intgcheck.m4
@@ -1,7 +1,10 @@
 AC_CHECK_PROG([HAVE_FAKEROOT], [fakeroot], [yes], [no])
 
+dnl Check for pytest binary. When available, we will use py.test-2 for python2
+dnl version. If it is not available we will try to use py.test.
 AC_PATH_PROG([PYTEST], [py.test])
-AS_IF([test -n "$PYTEST"], [HAVE_PYTEST=yes], [HAVE_PYTEST=no])
+AC_PATH_PROG([PYTEST2], [py.test-2], [$PYTEST])
+AS_IF([test -n "$PYTEST2"], [HAVE_PYTEST2=yes], [HAVE_PYTEST2=no])
 
 dnl Check for variable and fail unless value is "yes"
 dnl The second argument will be printed in error message in case of error
@@ -27,7 +30,7 @@ AC_DEFUN([SSS_ENABLE_INTGCHECK_REQS], [
         SSS_INTGCHECK_REQ([HAVE_LDAPMODIFY], [ldapmodify])
         SSS_INTGCHECK_REQ([HAVE_FAKEROOT], [fakeroot])
         SSS_INTGCHECK_REQ([HAVE_PYTHON2], [python2])
-        SSS_INTGCHECK_REQ([HAVE_PYTEST], [pytest])
+        SSS_INTGCHECK_REQ([HAVE_PYTEST2], [pytest2])
         SSS_INTGCHECK_REQ([HAVE_PY2MOD_LDAP], [python-ldap])
         SSS_INTGCHECK_REQ([HAVE_PY2MOD_LDAP], [pyldb])
     fi
diff --git a/src/tests/intg/Makefile.am b/src/tests/intg/Makefile.am
index 2aa1566e35..98ddd5f6e3 100644
--- a/src/tests/intg/Makefile.am
+++ b/src/tests/intg/Makefile.am
@@ -184,5 +184,5 @@ intgcheck-installed: config.py passwd group pam_sss_service pam_sss_alt_service
 	DBUS_SESSION_BUS_ADDRESS="unix:path=$$DBUS_SOCK_DIR/fake_socket" \
 	DBUS_SYSTEM_BUS_ADDRESS="unix:path=$$DBUS_SOCK_DIR/system_bus_socket" \
 	DBUS_SYSTEM_BUS_DEFAULT_ADDRESS="$$DBUS_SYSTEM_BUS_ADDRESS" \
-	    fakeroot $(PYTHON2) $(PYTEST) -v -r a --tb=native $(INTGCHECK_PYTEST_ARGS) .
+	    fakeroot $(PYTHON2) $(PYTEST2) -v -r a --tb=native $(INTGCHECK_PYTEST_ARGS) .
 	rm -f $(DESTDIR)$(logpath)/*

From f0145b70e0fe585c1361981f83b968b0b833c222 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Pavel=20B=C5=99ezina?= <pbrez...@redhat.com>
Date: Tue, 20 Aug 2019 12:00:26 +0200
Subject: [PATCH 2/2] ci: pep8 was renamed to pycodestyle in Fedora 31

---
 contrib/ci/deps.sh | 3 ++-
 contrib/ci/run     | 9 ++++++++-
 2 files changed, 10 insertions(+), 2 deletions(-)

diff --git a/contrib/ci/deps.sh b/contrib/ci/deps.sh
index 7570575268..36e84200be 100644
--- a/contrib/ci/deps.sh
+++ b/contrib/ci/deps.sh
@@ -56,7 +56,8 @@ if [[ "$DISTRO_BRANCH" == -redhat-* ]]; then
 
     if [[ "$DISTRO_BRANCH" == -redhat-fedora-3[1-9]* ]]; then
         DEPS_LIST+=(
-            python3-pep8
+            python2-pycodestyle
+            python3-pycodestyle
         )
     else
         DEPS_LIST+=(
diff --git a/contrib/ci/run b/contrib/ci/run
index bf29f87531..deb30093b0 100755
--- a/contrib/ci/run
+++ b/contrib/ci/run
@@ -58,6 +58,13 @@ declare BASE_DIR=`pwd`
 declare MODERATE=false
 declare RIGOROUS=false
 
+# pep8 was renamed to pycodestyle
+declare PEP8_BIN="pep8"
+which pycodestyle-2 &> /dev/null
+if [ $? -eq 0 ]; then
+  PEP8_BIN="pycodestyle-2"
+fi
+
 # Output program usage information.
 function usage()
 {
@@ -398,7 +405,7 @@ if [[ "$DISTRO_BRANCH" != redhat-* ]]; then
     PEP8_IGNORE+=",E722"
 fi
 stage pep8          find . -path ./src/config -prune -o \
-                           -name \*.py -exec pep8 $PEP8_IGNORE {} +
+                           -name \*.py -exec $PEP8_BIN $PEP8_IGNORE {} +
 stage autoreconf    autoreconf --install --force
 run_build debug     build_debug
 if "$RIGOROUS"; then
_______________________________________________
sssd-devel mailing list -- sssd-devel@lists.fedorahosted.org
To unsubscribe send an email to sssd-devel-le...@lists.fedorahosted.org
Fedora Code of Conduct: 
https://docs.fedoraproject.org/en-US/project/code-of-conduct/
List Guidelines: https://fedoraproject.org/wiki/Mailing_list_guidelines
List Archives: 
https://lists.fedorahosted.org/archives/list/sssd-devel@lists.fedorahosted.org

Reply via email to