File: conftest.py

package info (click to toggle)
python-binary-memcached 0.31.4%2Bdfsg1-1
  • links: PTS, VCS
  • area: main
  • in suites: experimental
  • size: 316 kB
  • sloc: python: 1,763; makefile: 17
file content (56 lines) | stat: -rw-r--r-- 1,153 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
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
import os
import subprocess
import time

import pytest


os.environ.setdefault("MEMCACHED_HOST", "localhost")


@pytest.yield_fixture(scope="session", autouse=True)
def memcached_standard_port():
    p = subprocess.Popen(
        ["memcached"], stdout=subprocess.PIPE, stderr=subprocess.PIPE
    )
    time.sleep(0.1)
    yield p
    p.kill()
    p.wait()


@pytest.yield_fixture(scope="session", autouse=True)
def memcached_other_port():
    p = subprocess.Popen(
        ["memcached", "-p5000"], stdout=subprocess.PIPE, stderr=subprocess.PIPE
    )
    time.sleep(0.1)
    yield p
    p.kill()
    p.wait()


@pytest.yield_fixture(scope="session", autouse=True)
def memcached_socket():
    p = subprocess.Popen(
        ["memcached", "-s/tmp/memcached.sock"],
        stdout=subprocess.PIPE,
        stderr=subprocess.PIPE,
    )
    time.sleep(0.1)
    yield p
    p.kill()
    p.wait()


@pytest.yield_fixture(scope="session", autouse=True)
def memcached_ipv6():
    p = subprocess.Popen(
        ["memcached", "-l::1"],
        stdout=subprocess.PIPE,
        stderr=subprocess.PIPE,
    )
    time.sleep(0.1)
    yield p
    p.kill()
    p.wait()