conftest.py 1013 B

1234567891011121314151617181920212223242526272829303132333435
  1. # -*- coding: utf-8 -*-
  2. #!/usr/bin/env python
  3. import os
  4. import django
  5. import hypothesis
  6. from django.conf import settings
  7. # We manually designate which settings we will be using in an environment variable
  8. # This is similar to what occurs in the manage.py
  9. # pytest automatically calls this function once when tests are run.
  10. def pytest_configure():
  11. settings.DEBUG = True
  12. #load_dotenv('.env.testing')
  13. # If you have any test specific settings, you can declare them here,
  14. # e.g.
  15. # settings.PASSWORD_HASHERS = (
  16. # 'django.contrib.auth.hashers.MD5PasswordHasher',
  17. django.setup()
  18. # Note: In Django =< 1.6 you'll need to run this instead
  19. # settings.configure()
  20. def pytest_sessionfinish(session, exitstatus):
  21. """ whole test run finishes. """
  22. import pymongo
  23. client = pymongo.MongoClient()
  24. django.setup()
  25. client.drop_database(os.environ['MONGODB_WASHPAY_NAME'])
  26. client.drop_database(os.environ['MONGODB_REPORT_NAME'])