Commit cf3da404 by christopher lee Committed by Christopher Lee

Allow pytest to be run locally

parent c714e08c
"""
Set up for running pytest
Pytest is faster than running `./manage.py test` since it will not create a
database. If a test has database dependencies, that test will not pass.
"""
import django
def pytest_configure(config):
print("!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!")
print("! WARNING: Not all tests pass with pytest. Pytest does not create a !\n"
"! database. If a test has database dependencies, that test will not !\n"
"! pass. !")
print("!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!")
django.setup()
......@@ -101,6 +101,12 @@ these models, which are used for multi-tenancy.
ecommerce.courses.tests.test_utils --settings=ecommerce.settings.test
--with-ignore-docstrings --logging-level=DEBUG
* To run tests without creating a database (i.e. really fast), use pytest.
If a test has a database dependency, the test will not pass.
.. code-block:: bash
$ pytest path_to_test
JavaScript Unit Tests
**********************
......
......@@ -255,6 +255,7 @@ class SiteMixin(object):
domain = 'testserver.fake'
self.client = self.client_class(SERVER_NAME=domain)
Partner.objects.all().delete()
Site.objects.all().delete()
self.site_configuration = SiteConfigurationFactory(
from_email='from@example.com',
......
[pytest]
DJANGO_SETTINGS_MODULE = ecommerce.settings.test
testpaths = ecommerce
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment