conftest.db()   A
last analyzed

Complexity

Conditions 1

Size

Total Lines 6
Code Lines 6

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 6
nop 0
dl 0
loc 6
rs 10
c 0
b 0
f 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