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