How To Install python3-mock.noarch on Amazon Linux 2

In this tutorial we learn how to install python3-mock.noarch in Amazon Linux 2. python3-mock.noarch is A Python Mocking and Patching Library for Testing

Introduction

In this tutorial we learn how to install python3-mock.noarch on Amazon Linux 2.

What is python3-mock.noarch

Mock is a Python module that provides a core mock class. It removes the need to create a host of stubs throughout your test suite. After performing an action, you can make assertions about which methods / attributes were used and arguments they were called with. You can also specify return values and set needed attributes in the normal way.

We can use yum to install python3-mock.noarch on Amazon Linux 2. In this tutorial we discuss both methods but you only need to choose one of method to install python3-mock.noarch.

Install python3-mock.noarch on Amazon Linux 2 Using yum

Update yum database with yum using the following command.

sudo yum makecache --refresh

After updating yum database, We can install python3-mock.noarch using yum by running the following command:

sudo yum -y install python3-mock.noarch

How To Uninstall python3-mock.noarch on Amazon Linux 2

To uninstall only the python3-mock.noarch package we can use the following command:

sudo yum remove python3-mock.noarch

python3-mock.noarch Package Contents on Amazon Linux 2

/usr/lib/python3.7/site-packages/mock
/usr/lib/python3.7/site-packages/mock-3.0.5-py3.7.egg-info
/usr/lib/python3.7/site-packages/mock-3.0.5-py3.7.egg-info/PKG-INFO
/usr/lib/python3.7/site-packages/mock-3.0.5-py3.7.egg-info/SOURCES.txt
/usr/lib/python3.7/site-packages/mock-3.0.5-py3.7.egg-info/dependency_links.txt
/usr/lib/python3.7/site-packages/mock-3.0.5-py3.7.egg-info/requires.txt
/usr/lib/python3.7/site-packages/mock-3.0.5-py3.7.egg-info/top_level.txt
/usr/lib/python3.7/site-packages/mock/__init__.py
/usr/lib/python3.7/site-packages/mock/__pycache__
/usr/lib/python3.7/site-packages/mock/__pycache__/__init__.cpython-37.opt-1.pyc
/usr/lib/python3.7/site-packages/mock/__pycache__/__init__.cpython-37.pyc
/usr/lib/python3.7/site-packages/mock/__pycache__/mock.cpython-37.opt-1.pyc
/usr/lib/python3.7/site-packages/mock/__pycache__/mock.cpython-37.pyc
/usr/lib/python3.7/site-packages/mock/mock.py
/usr/share/doc/python3-mock-3.0.5
/usr/share/doc/python3-mock-3.0.5/README.rst
/usr/share/licenses/python3-mock-3.0.5
/usr/share/licenses/python3-mock-3.0.5/LICENSE.txt

References

Summary

In this tutorial we learn how to install python3-mock.noarch on Amazon Linux 2 using yum.