Move short_tmpdir fixture to conftest.py

This commit is contained in:
Florian Bruhin 2016-09-09 18:38:52 +02:00
parent ece85dc903
commit 2df971a79c
2 changed files with 9 additions and 8 deletions

View File

@ -27,6 +27,7 @@ See https://pytest.org/latest/fixture.html
import sys
import collections
import tempfile
import itertools
import textwrap
import unittest.mock
@ -34,6 +35,7 @@ import types
import os
import pytest
import py.path # pylint: disable=no-name-in-module
import helpers.stubs as stubsmod
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.
"""
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

View File

@ -26,12 +26,10 @@ import collections
import logging
import json
import hashlib
import tempfile
import subprocess
from unittest import mock
import pytest
import py.path # pylint: disable=no-name-in-module
from PyQt5.QtCore import pyqtSignal, QObject
from PyQt5.QtNetwork import QLocalServer, QLocalSocket, QAbstractSocket
from PyQt5.QtTest import QSignalSpy
@ -45,12 +43,6 @@ from helpers import stubs
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)
def shutdown_server():
"""If ipc.send_or_listen was called, make sure to shut server down."""