| Total Complexity | 3 |
| Total Lines | 26 |
| Duplicated Lines | 0 % |
| Changes | 0 | ||
| 1 | import os |
||
| 2 | import sys |
||
| 3 | |||
| 4 | import pytest |
||
| 5 | |||
| 6 | ROOT_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__))) |
||
| 7 | |||
| 8 | sys.path.insert(0, ROOT_DIR) |
||
| 9 | sys.path.insert(0, os.path.join(ROOT_DIR, 'weakorm')) |
||
| 10 | |||
| 11 | DB_NAME = 'test.db' |
||
| 12 | |||
| 13 | |||
| 14 | def pytest_sessionfinish(session, exitstatus): |
||
| 15 | """ whole test run finishes. """ |
||
| 16 | if os.path.exists(os.path.join(ROOT_DIR, DB_NAME)): |
||
| 17 | os.remove(os.path.join(ROOT_DIR, DB_NAME)) |
||
| 18 | |||
| 19 | |||
| 20 | @pytest.fixture |
||
| 21 | def db(): |
||
| 22 | from weekorm.db import DataBase |
||
| 23 | name_db = DB_NAME |
||
| 24 | base = DataBase(name_db) |
||
| 25 | return base |
||
| 26 |