Bug 2120019

Summary: fedpkg tests require depracated python3-mock
Product: [Fedora] Fedora Reporter: Troy Dawson <tdawson>
Component: fedpkgAssignee: Ondřej Nosek <onosek>
Status: CLOSED CURRENTRELEASE QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: rawhideCC: cqi, jkeating, lsedlar, onosek, orion, s
Target Milestone: ---   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2022-09-21 13:22:23 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Troy Dawson 2022-08-20 23:44:04 UTC
Description of problem:
python-mock has been deprated in fedora.
https://fedoraproject.org/wiki/Changes/DeprecatePythonMock
fedpkg still uses it in it's test suite.

Version-Release number of selected component (if applicable):
fedpkg-1.42-5.fc37 (And every stable version before it)

How reproducible:
100%

Steps to Reproduce:
1. Comment out "BuildRequires:  python3-mock"
2. Create a new srpm
3. Try to build that srpm in Koji, Copr, or mock

Actual results:
Fails with


+ /usr/bin/pytest
============================= test session starts ==============================
platform linux -- Python 3.10.6, pytest-6.2.5, py-1.11.0, pluggy-1.0.0
rootdir: /builddir/build/BUILD/fedpkg-1.42, configfile: setup.cfg, testpaths: test
collected 0 items / 5 errors

==================================== ERRORS ====================================
____________________ ERROR collecting test/test_bugzilla.py ____________________
ImportError while importing test module '/builddir/build/BUILD/fedpkg-1.42/test/test_bugzilla.py'.
Hint: make sure your test modules/packages have valid Python names.
Traceback:
/usr/lib64/python3.10/importlib/__init__.py:126: in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
test/test_bugzilla.py:14: in <module>
    from mock import Mock, patch
E   ModuleNotFoundError: No module named 'mock'
______________________ ERROR collecting test/test_cli.py _______________________
ImportError while importing test module '/builddir/build/BUILD/fedpkg-1.42/test/test_cli.py'.
Hint: make sure your test modules/packages have valid Python names.
Traceback:
/usr/lib64/python3.10/importlib/__init__.py:126: in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
test/test_cli.py:25: in <module>
    from mock import Mock, PropertyMock, call, patch
E   ModuleNotFoundError: No module named 'mock'
____________________ ERROR collecting test/test_commands.py ____________________
ImportError while importing test module '/builddir/build/BUILD/fedpkg-1.42/test/test_commands.py'.
Hint: make sure your test modules/packages have valid Python names.
Traceback:
/usr/lib64/python3.10/importlib/__init__.py:126: in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
test/test_commands.py:13: in <module>
    from mock import Mock, PropertyMock, call, mock_open, patch
E   ModuleNotFoundError: No module named 'mock'
_____________________ ERROR collecting test/test_retire.py _____________________
ImportError while importing test module '/builddir/build/BUILD/fedpkg-1.42/test/test_retire.py'.
Hint: make sure your test modules/packages have valid Python names.
Traceback:
/usr/lib64/python3.10/importlib/__init__.py:126: in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
test/test_retire.py:8: in <module>
    import mock
E   ModuleNotFoundError: No module named 'mock'
_____________________ ERROR collecting test/test_utils.py ______________________
ImportError while importing test module '/builddir/build/BUILD/fedpkg-1.42/test/test_utils.py'.
Hint: make sure your test modules/packages have valid Python names.
Traceback:
/usr/lib64/python3.10/importlib/__init__.py:126: in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
test/test_utils.py:16: in <module>
    from mock import Mock, patch
E   ModuleNotFoundError: No module named 'mock'
=========================== short test summary info ============================
ERROR test/test_bugzilla.py
ERROR test/test_cli.py
ERROR test/test_commands.py
ERROR test/test_retire.py
ERROR test/test_utils.py
!!!!!!!!!!!!!!!!!!! Interrupted: 5 errors during collection !!!!!!!!!!!!!!!!!!!!
============================== 5 errors in 0.23s ===============================


Expected results:
Tests should pass without python3-mock.


Additional info:

Comment 1 Orion Poplawski 2022-09-02 02:55:08 UTC
This should hopefully be fixed in this upstream commit: https://pagure.io/fedpkg/c/308ac3138c2739feaf1587a598e4d77b7068c936?branch=master

Comment 2 Troy Dawson 2022-09-21 13:22:23 UTC
Yes.  It is fixed and it allowed us to build fedpkg in epel9 without python3-mock.
Thank You