diff --git a/app/test/conftest.py b/app/test/conftest.py index fe64e5c..734ca87 100644 --- a/app/test/conftest.py +++ b/app/test/conftest.py @@ -1,6 +1,8 @@ import pytest import sqlite3 +import time from selenium import webdriver +from pathlib import Path @pytest.fixture def URL(): @@ -12,7 +14,7 @@ def driver(): return webdriver.Edge() # uncomment this line if you wish to run the test on your laptop -@pytest.fixture(autouse=True) +@pytest.fixture def restore_sqlite_database(): ''' Automatically restore SQLite database file app/db/wordfreqapp.db @@ -24,3 +26,9 @@ def restore_sqlite_database(): con.executescript('DROP TABLE IF EXISTS article;') con.executescript(open('../static/wordfreqapp.sql', encoding='utf8').read()) con.close() + + +@pytest.fixture(autouse=True) +def restart_englishpal(restore_sqlite_database): + (Path(__file__).parent / '../main.py').touch() + time.sleep(1)