Move short_tmpdir fixture to conftest.py
This commit is contained in:
parent
ece85dc903
commit
2df971a79c
@ -27,6 +27,7 @@ See https://pytest.org/latest/fixture.html
|
|||||||
|
|
||||||
import sys
|
import sys
|
||||||
import collections
|
import collections
|
||||||
|
import tempfile
|
||||||
import itertools
|
import itertools
|
||||||
import textwrap
|
import textwrap
|
||||||
import unittest.mock
|
import unittest.mock
|
||||||
@ -34,6 +35,7 @@ import types
|
|||||||
import os
|
import os
|
||||||
|
|
||||||
import pytest
|
import pytest
|
||||||
|
import py.path # pylint: disable=no-name-in-module
|
||||||
|
|
||||||
import helpers.stubs as stubsmod
|
import helpers.stubs as stubsmod
|
||||||
from qutebrowser.config import config
|
from qutebrowser.config import config
|
||||||
@ -470,3 +472,10 @@ def redirect_xdg_data(data_tmpdir, monkeypatch):
|
|||||||
we need to set the environment variable to redirect data access.
|
we need to set the environment variable to redirect data access.
|
||||||
"""
|
"""
|
||||||
monkeypatch.setenv('XDG_DATA_HOME', str(data_tmpdir))
|
monkeypatch.setenv('XDG_DATA_HOME', str(data_tmpdir))
|
||||||
|
|
||||||
|
|
||||||
|
@pytest.fixture()
|
||||||
|
def short_tmpdir():
|
||||||
|
"""A short temporary directory for a XDG_RUNTIME_DIR."""
|
||||||
|
with tempfile.TemporaryDirectory() as tdir:
|
||||||
|
yield py.path.local(tdir) # pylint: disable=no-member
|
||||||
|
@ -26,12 +26,10 @@ import collections
|
|||||||
import logging
|
import logging
|
||||||
import json
|
import json
|
||||||
import hashlib
|
import hashlib
|
||||||
import tempfile
|
|
||||||
import subprocess
|
import subprocess
|
||||||
from unittest import mock
|
from unittest import mock
|
||||||
|
|
||||||
import pytest
|
import pytest
|
||||||
import py.path # pylint: disable=no-name-in-module
|
|
||||||
from PyQt5.QtCore import pyqtSignal, QObject
|
from PyQt5.QtCore import pyqtSignal, QObject
|
||||||
from PyQt5.QtNetwork import QLocalServer, QLocalSocket, QAbstractSocket
|
from PyQt5.QtNetwork import QLocalServer, QLocalSocket, QAbstractSocket
|
||||||
from PyQt5.QtTest import QSignalSpy
|
from PyQt5.QtTest import QSignalSpy
|
||||||
@ -45,12 +43,6 @@ from helpers import stubs
|
|||||||
pytestmark = pytest.mark.usefixtures('qapp')
|
pytestmark = pytest.mark.usefixtures('qapp')
|
||||||
|
|
||||||
|
|
||||||
@pytest.fixture()
|
|
||||||
def short_tmpdir():
|
|
||||||
with tempfile.TemporaryDirectory() as tdir:
|
|
||||||
yield py.path.local(tdir) # pylint: disable=no-member
|
|
||||||
|
|
||||||
|
|
||||||
@pytest.fixture(autouse=True)
|
@pytest.fixture(autouse=True)
|
||||||
def shutdown_server():
|
def shutdown_server():
|
||||||
"""If ipc.send_or_listen was called, make sure to shut server down."""
|
"""If ipc.send_or_listen was called, make sure to shut server down."""
|
||||||
|
Loading…
Reference in New Issue
Block a user