File: conftest.py

package info (click to toggle)
python-aristaproto 1.2%2Breally0.1.4-3
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 1,600 kB
  • sloc: python: 6,521; java: 106; xml: 84; makefile: 6
file content (29 lines) | stat: -rw-r--r-- 682 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
import copy
import os
import sys

import pytest


# Change in aristaproto fork - moved from test_input.py to conftest.py.
# Force pure-python implementation instead of C++, otherwise imports
# break things because we can't properly reset the symbol database.
os.environ["PROTOCOL_BUFFERS_PYTHON_IMPLEMENTATION"] = "python"


def pytest_addoption(parser):
    parser.addoption(
        "--repeat", type=int, default=1, help="repeat the operation multiple times"
    )


@pytest.fixture(scope="session")
def repeat(request):
    return request.config.getoption("repeat")


@pytest.fixture
def reset_sys_path():
    original = copy.deepcopy(sys.path)
    yield
    sys.path = original