Skip to content

Commit

Permalink
Added workaround for handling mock py2 & py3 issue
Browse files Browse the repository at this point in the history
In order to package tempestconf for Train release which supports
also py2, we need to add a workaround which replaces all
'from unittest import mock' by 'import mock' as in py2 mock is
not a part of unittest.

Change-Id: I1fa3749ed88bab68a1ed4b1d28f6088ed318725d
  • Loading branch information
kopecmartin committed Aug 11, 2020
1 parent 9772519 commit 958382d
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions python-tempestconf.spec
Expand Up @@ -43,6 +43,9 @@ BuildRequires: python%{pyver}-testscenarios
BuildRequires: python%{pyver}-testtools
BuildRequires: python%{pyver}-tempest
BuildRequires: python%{pyver}-openstacksdk >= 0.11.3
%if %{pyver} == 2
BuildRequires: python2-mock
%endif

%description
%{common_desc}
Expand Down Expand Up @@ -83,6 +86,9 @@ Requires: python%{pyver}-oslotest
Requires: python%{pyver}-testrepository
Requires: python%{pyver}-testscenarios
Requires: python%{pyver}-testtools
%if %{pyver} == 2
Requires: python2-mock
%endif

%description -n python%{pyver}-%{pname}-tests
%{common_desc}
Expand Down Expand Up @@ -117,6 +123,11 @@ sphinx-build-%{pyver} -W -b html doc/source doc/build/html
rm -rf doc/build/html/.{doctrees,buildinfo}
%endif

# workaround for handling py2 and py3 mock issue
%if %{pyver} == 2
find ./config_tempest/tests -type f -exec sed -i -e 's/from unittest import mock/import mock/g' {} \;
%endif

%install
%{pyver_install}

Expand Down

0 comments on commit 958382d

Please sign in to comment.