google / google/makerspace-auth

Fix module overloading for python2 on Raspbian

Open
#37 1 comment 0 reactions 0 assignees View on GitHub
Dominant language
Python
Stars
69
Forks
30
PR merge metrics
No merged PRs in 30d

Description

One other change that I think is worth making: In `authbox/__init__.py` we have logic to replace RPi.GPIO on the import path with a fake if the real one is missing. But if you try running unit tests outside of venv, on Raspbian, and with Python2, then the real GPIO is already installed by default and it prevents unit tests from working.

Now that tests are in their own module, I think `authbox/tests/__init__.py` should instead do the fake RPi.GPIO replacement unconditionally.

A higher level design question though is how do we want to handle this kind of dependency injection going forward? We're doing it globally for GPIO, but via `__init__() `for fake queue/timer. We could also have each unit test patch the module under test.

_Originally posted by @thvortex in https://github.com/google/makerspace-auth/pull/36#issuecomment-556425506_

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.