summaryrefslogtreecommitdiff
path: root/tests/conftest.py
blob: f3dbc41faa0b6c5d397fb4b9c76de2a7c9a6db38 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
from src.program import Program
from glob import iglob
import os
import pytest


@pytest.fixture
def row_at_program():
    return Program(args=['-f', './tests/test_table.csv', '-c', 'row-at', '2'])


@pytest.fixture
def get_rows_program():
    return Program(args=['-f', './tests/test_table.csv', '-c', 'get-rows', '2'])


@pytest.fixture
def insert_program():
    return Program(args=['-f', './tests/test_table.csv', '-c', 'insert', '1969,Ubik,Philip K. Dick'])


@pytest.fixture
def search_program():
    return Program(args=['-f', './tests/test_table.csv', '-c', 'search', 'Ten Days that Shook the World'])


@pytest.fixture
def delete_at_program():
    return Program(args=['-f', './tests/test_table.csv', '-c', 'delete-at', '1'])


@pytest.fixture(scope='session', autouse=True)
def delete_created_csv_files():
    yield
    for file in iglob("./new_*.csv"):
        os.remove(file)