File: conftest.py

package info (click to toggle)
vitables 3.1.0-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 17,044 kB
  • sloc: python: 9,695; makefile: 214; sh: 90
file content (38 lines) | stat: -rw-r--r-- 1,013 bytes parent folder | download
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
37
38
"""Configuration file for our tests.

Here we create fixtures that are not directly required by test functions.
"""

import os
import sys

import pytest
import tables
from qtpy import QtWidgets

import vitables.vtapp
from vitables.preferences import vtconfig


class Launcher:
    def __init__(self):
        self.app = QtWidgets.QApplication(sys.argv)
        self.app.setOrganizationDomain('vitables.org')
        self.app.setOrganizationName('ViTables')
        self.app.setApplicationName('ViTables')
        self.app.setApplicationVersion(vtconfig.getVersion())
        self.vtapp_object = vitables.vtapp.VTApp(keep_splash=False)
        self.gui = self.vtapp_object.gui


@pytest.fixture(scope='module')
def launcher():
    return Launcher()

@pytest.fixture(scope='module')
def h5file():
    if not os.path.exists('testfile.h5'):
        import create_testfile
        print(create_testfile)
    yield tables.open_file('testfile.h5', 'r')
    os.remove('testfile.h5')