Activate a specific locale in your project’s conftest.py:
from django.utils.translation import activate def pytest_runtest_setup(item): activate('en')
By default, py.test looks for tests in files named test*.py. If you have your tests in files with other names, they will not be collected. It is common to put tests under app_directory/tests/views.py. To find those tests, create a pytest.ini file in your project root with the contents:[pytest] python_files=*.py
If you are using virtualenvwrapper, use a postactivate script to set DJANGO_SETTINGS_MODULE when your project’s virtualenv is activated.
This snippet should do the trick (make sure to replace YOUR_VIRTUALENV_NAME):
echo "export DJANGO_SETTINGS_MODULE=yourproject.settings" >> $WORKON_HOME/YOUR_VIRTUALENV_NAME/bin/postactivate
Djangos own syncdb will always be used to create the test database, regardless of wheter South is present or not.
Currently only with the SQLite in-memory database. The problem is that a global test database is created at the start of a session. When distributing the tests across multiple processes each process will try to setup and teardown this database.
This is not an insurmountable problem and will hopefully be fixed in a future version.