Project

General

Profile

0001-tests-simplify-fixture-using-standard-ones-26911.patch

Benjamin Dauvergne, 03 Oct 2018 12:13 AM

Download (1.11 KB)

View differences:

Subject: [PATCH 1/2] tests: simplify fixture using standard ones (#26911)

 tests_authentic/conftest.py | 12 +++---------
 1 file changed, 3 insertions(+), 9 deletions(-)
tests_authentic/conftest.py
1 1
import os
2
import tempfile
3
import shutil
4 2
import json
5 3

  
6 4
import pytest
7 5

  
8 6

  
9 7
@pytest.fixture
10
def tenant_base(request, settings):
11
    base = tempfile.mkdtemp('authentic-tenant-base')
8
def tenant_base(request, settings, tmpdir):
9
    base = str(tmpdir.mkdir('authentic-tenant-base'))
12 10
    settings.TENANT_BASE = base
13

  
14
    def fin():
15
        shutil.rmtree(base)
16
    request.addfinalizer(fin)
17 11
    return base
18 12

  
19 13

  
20
@pytest.fixture(scope='function')
14
@pytest.fixture
21 15
def tenant(transactional_db, request, settings, tenant_base):
22 16
    from hobo.multitenant.models import Tenant
23 17
    base = tenant_base
24
-