| 1 |
# Copyright 2009-2026 Joshua Bronson. All rights reserved. |
| 2 |
# |
| 3 |
# This Source Code Form is subject to the terms of the Mozilla Public |
| 4 |
# License, v. 2.0. If a copy of the MPL was not distributed with this |
| 5 |
# file, You can obtain one at http://mozilla.org/MPL/2.0/. |
| 6 |
|
| 7 |
from __future__ import annotations |
| 8 |
|
| 9 |
import sys |
| 10 |
import typing as t |
| 11 |
from collections.abc import Mapping |
| 12 |
from collections.abc import MutableMapping |
| 13 |
|
| 14 |
import pytest |
| 15 |
|
| 16 |
import bidict |
| 17 |
|
| 18 |
|
| 19 |
# https://github.com/thisch/pytest-sphinx/issues/5#issuecomment-618072237 |
| 20 |
@pytest.fixture(autouse=True) |
| 21 |
def _add_doctest_globals(doctest_namespace: MutableMapping[str, t.Any]) -> None: |
| 22 |
doctest_namespace['Mapping'] = Mapping |
| 23 |
doctest_namespace['MutableMapping'] = MutableMapping |
| 24 |
doctest_namespace['pypy'] = sys.implementation.name == 'pypy' |
| 25 |
doctest_namespace['sys'] = sys |
| 26 |
doctest_namespace.update(i for i in vars(bidict).items() if not i[0].startswith('_')) |