Installation
There are several ways to install micropython-mock-machine depending on your use case.
Using mip (Recommended)
The easiest way to install micropython-mock-machine is using MicroPython's built-in package manager, mip:
This will download and install the latest version directly to your MicroPython device.
Installing a specific version
Using mpremote
If you're working with a device connected to your computer, you can use mpremote:
Manual Installation
For development or when working with the Unix port of MicroPython:
-
Clone the repository:
-
Copy
mock_machine.pyto your project:
As a Git Submodule
For projects that need version control of dependencies:
Development Installation
For contributing to micropython-mock-machine:
# Clone the repository
git clone https://github.com/planetinnovation/micropython-mock-machine.git
cd micropython-mock-machine
# Install development dependencies
pip install -r requirements-dev.txt
# Run tests
pytest
Verifying Installation
After installation, verify everything is working:
import mock_machine
# Check version
print(mock_machine.__version__)
# Test basic functionality
mock_machine.register_as_machine()
import machine
pin = machine.Pin(0)
print("Installation successful!")
Next Steps
Now that you have micropython-mock-machine installed, check out the Quick Start Guide to begin using it in your tests.