Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add WAGTAIL_AIRTABLE_TESTING flag to enable the mock API #58

Merged

Conversation

gasman
Copy link
Collaborator

@gasman gasman commented Jan 25, 2024

Currently, this line is used to check whether to use the mock Airtable API in place of the real one:

TESTING = any(x in ["test", "runtests.py"] for x in sys.argv)

I spent far too long wondering why my tests were failing locally, because I was invoking them with python ./runtests.py (which doesn't match the above test) instead of python runtests.py.

This change makes this more robust, by introducing an explicit WAGTAIL_AIRTABLE_TESTING variable in settings - so the mock will be used any time the tests.settings settings module is active.

This is more robust than checking for `runtests.py` or `test` in the command line - this way the API will be mocked whenever the tests.settings module is in use.
Copy link
Collaborator

@zerolab zerolab left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A sensible change!

@gasman gasman merged commit 562804a into wagtail-nest:main Feb 5, 2024
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants