URL: https://github.com/freeipa/freeipa/pull/439 Author: MartinBasti Title: #439: [Py3] tests: fix various bytes related issues in tests Action: synchronized
To pull the PR as Git branch: git remote add ghfreeipa https://github.com/freeipa/freeipa git fetch ghfreeipa pull/439/head:pr439 git checkout pr439
From 182650cef909592963e9f30423d2f3a7c045bd07 Mon Sep 17 00:00:00 2001 From: Martin Basti <mba...@redhat.com> Date: Tue, 7 Feb 2017 14:56:39 +0100 Subject: [PATCH 1/2] Build: allow to build only py2 rpms for fedora This is more or less for testing purposes of py2/py3 compatibility --- BUILD.txt | 5 +++++ Makefile.am | 4 ++-- freeipa.spec.in | 4 ++++ 3 files changed, 11 insertions(+), 2 deletions(-) diff --git a/BUILD.txt b/BUILD.txt index 620adc3..9b5ff1d 100644 --- a/BUILD.txt +++ b/BUILD.txt @@ -30,6 +30,11 @@ It may be possible to do a simple make install but this has not been well-tested. Additional work is done in pre/post install scripts in the ipa spec file. +To build only python2 packages on fedora following steps are required: +$ autoreconf -i +$ ./configure +$ make rpms RPMBUILD_OPTS="--define 'with_python3 0'" + Developing plugins ------------------ diff --git a/Makefile.am b/Makefile.am index 9bfc899..0ad50e4 100644 --- a/Makefile.am +++ b/Makefile.am @@ -106,7 +106,7 @@ rpms: $(VERSION_UPDATE_TARGET) $(MAKE) _rpms-body _rpms-body: _rpms-prep - rpmbuild --define "_topdir $(RPMBUILD)" -ba $(top_builddir)/$(PACKAGE).spec + rpmbuild --define "_topdir $(RPMBUILD)" -ba $(top_builddir)/$(PACKAGE).spec $(RPMBUILD_OPTS) cp $(RPMBUILD)/RPMS/*/*$$(cat $(top_builddir)/.version)*.rpm $(top_builddir)/dist/rpms/ cp $(RPMBUILD)/SRPMS/*$$(cat $(top_builddir)/.version)*.src.rpm $(top_builddir)/dist/srpms/ rm -f rm -f $(top_builddir)/.version @@ -115,7 +115,7 @@ srpms: $(VERSION_UPDATE_TARGET) $(MAKE) _srpms-body _srpms-body: _rpms-prep - rpmbuild --define "_topdir $(RPMBUILD)" -bs $(top_builddir)/$(PACKAGE).spec + rpmbuild --define "_topdir $(RPMBUILD)" -bs $(top_builddir)/$(PACKAGE).spec $(RPMBUILD_OPTS) cp $(RPMBUILD)/SRPMS/*$$(cat $(top_builddir)/.version)*.src.rpm $(top_builddir)/dist/srpms/ rm -f rm -f $(top_builddir)/.version diff --git a/freeipa.spec.in b/freeipa.spec.in index 27a979c..7e77b32 100644 --- a/freeipa.spec.in +++ b/freeipa.spec.in @@ -2,11 +2,15 @@ # subpackages %{!?ONLY_CLIENT:%global ONLY_CLIENT 0} +%if 0%{?with_python3:1} +# with_python3 already defined +%else %if 0%{?rhel} %global with_python3 0 %else %global with_python3 1 %endif +%endif # lint is not executed during rpmbuild # %%global with_lint 1 From 1a0142addfacd4cee29cc8da1f0a86c238d00599 Mon Sep 17 00:00:00 2001 From: Martin Basti <mba...@redhat.com> Date: Tue, 7 Feb 2017 17:23:54 +0100 Subject: [PATCH 2/2] Travis: build only py2 packages for py2 testing We will testing both py2 and py3 packages, first step is use only py2 builds for testing py2 packages --- .travis.yml | 2 ++ .travis_run_task.sh | 10 +++++++++- 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 6301974..402c3ee 100644 --- a/.travis.yml +++ b/.travis.yml @@ -15,8 +15,10 @@ env: matrix: - TASK_TO_RUN="lint" - TASK_TO_RUN="run-tests" + PYTHON=/usr/bin/python2 TESTS_TO_RUN="test_xmlrpc/test_[a-k]*.py" - TASK_TO_RUN="run-tests" + PYTHON=/usr/bin/python2 TESTS_TO_RUN="test_cmdline test_install test_ipalib diff --git a/.travis_run_task.sh b/.travis_run_task.sh index 7d050b0..b51a712 100755 --- a/.travis_run_task.sh +++ b/.travis_run_task.sh @@ -4,10 +4,17 @@ # # NOTE: this script is intended to run in Travis CI only -PYTHON="/usr/bin/python${TRAVIS_PYTHON_VERSION}" test_set="" developer_mode_opt="--developer-mode" +if [[ $PYTHON == "/usr/bin/python2" ]] +then +env_opt="RPMBUILD_OPTS=--define \'with_python3 0\'" +else +env_opt="RPMBUILD_OPTS=" +fi + + function truncate_log_to_test_failures() { # chop off everything in the CI_RESULTS_LOG preceding pytest error output # if there are pytest errors in the log @@ -43,6 +50,7 @@ ipa-docker-test-runner -l $CI_RESULTS_LOG \ -c $TEST_RUNNER_CONFIG \ $developer_mode_opt \ --container-environment "PYTHON=$PYTHON" \ + --container-environment $env_opt \ --container-image $TEST_RUNNER_IMAGE \ --git-repo $TRAVIS_BUILD_DIR \ $TASK_TO_RUN $test_set
-- Manage your subscription for the Freeipa-devel mailing list: https://www.redhat.com/mailman/listinfo/freeipa-devel Contribute to FreeIPA: http://www.freeipa.org/page/Contribute/Code