import os import tempfile import pytest from app import create_app, db, Vehicle from flask import json @pytest.fixture def client(): app = create_app() db_fd, app.config['DATABASE'] = tempfile.mkstemp() app.config['TESTING'] = True client = app.test_client() with app.app_context(): db.drop_all() db.create_all() yield client os.close(db_fd) os.unlink(app.config['DATABASE'])