Perhaps it depends on the library module you are using to interact with the GPIO pins?
The
gpiozero Python library module, installed by default with current releases of Raspbian, has built-in support:
http://gpiozero.readthedocs.io/en/stabl ... #mock-pins
For RPi.GPIO I'm sure I've seen a blog post describing how to craft a non-functional dummy module. But that module has a very small number of methods, so it would be trivial to create your own if you can't find that blog.
Just a hint that Testing doesn't have a very high profile here, so it might be useful to provide a definition of what you mean by TDD?
Edit: added - a few seconds with an Internet search tool and the string "
RPi.gpio dummy" found -
https://pypi.org/project/fake-rpi/
and
https://raspberrypi.stackexchange.com/q ... developing (scroll down to the reply from skidoo.)