[BUG] - Cryptic error with pytest when you don't call pytest with the settings variable #254
Labels
bug
Something isn't working
Severity: high
Bug severity level
Severity: low
Bug severity level
Severity: medium
Bug severity level
Describe the bug
You can run the tests in this project by just calling
pytest
.When you do, you see cryptic error that isn't very easy to debug.
If you run pytest and you are explicit about using the testing settings with
pytest --ds=greenweb.settings.testing
then you'll see the culprit.In this case the error was as follows:
How to get these tests passing properly
Rather than remembering to pass the correct params to pytest, you can also run
make test
instead.Under the hood, this will call
Explained in more detail, this command runs:
create-db
-s
greenweb.settings.testing
, with the flag--ds=greenweb.settings.testing
.Fixing this
It might make sense to get pytest to throw an exception when it's run with the development or production settings, to catch this in future.
I think you can either do that, or make sure that the pytest.ini file is honoured, ahead of any set environment variables:
The text was updated successfully, but these errors were encountered: