File: conftest.py

package info (click to toggle)
debputy 0.1.78
  • links: PTS, VCS
  • area: main
  • in suites: forky
  • size: 4,616 kB
  • sloc: python: 66,232; perl: 155; sh: 102; makefile: 39
file content (21 lines) | stat: -rw-r--r-- 752 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
import os
from collections.abc import Iterator

import pytest


@pytest.fixture(autouse=True)
def workaround_debputys_own_test_suite() -> Iterator[None]:
    # This fixture is only required as long as the tests are run inside `debputy`'s
    # own test suite.  If you copy out a plugin + tests, you should *not* need this
    # fixture.
    #
    # The problem appears because in the debputy source package, these plugins are
    # always provided in their "installed" location.
    orig = os.environ.get("DEBPUTY_TEST_PLUGIN_LOCATION")
    os.environ["DEBPUTY_TEST_PLUGIN_LOCATION"] = "installed"
    yield
    if orig is None:
        del os.environ["DEBPUTY_TEST_PLUGIN_LOCATION"]
    else:
        os.environ["DEBPUTY_TEST_PLUGIN_LOCATION"] = orig