$69 GRAYBYTE WORDPRESS FILE MANAGER $20

SERVER : vnpttt-amd7f72-h1.vietnix.vn #1 SMP Fri May 24 12:42:50 UTC 2024
SERVER IP : 103.200.23.149 | ADMIN IP 216.73.216.22
OPTIONS : CRL = ON | WGT = ON | SDO = OFF | PKEX = OFF
DEACTIVATED : NONE

/opt/cloudlinux/venv/lib/python3.11/site-packages/_pytest/

HOME
Current File : /opt/cloudlinux/venv/lib/python3.11/site-packages/_pytest//scope.py
"""
Scope definition and related utilities.

Those are defined here, instead of in the 'fixtures' module because
their use is spread across many other pytest modules, and centralizing it in 'fixtures'
would cause circular references.

Also this makes the module light to import, as it should.
"""
from enum import Enum
from functools import total_ordering
from typing import Optional
from typing import TYPE_CHECKING

if TYPE_CHECKING:
    from typing_extensions import Literal

    _ScopeName = Literal["session", "package", "module", "class", "function"]


@total_ordering
class Scope(Enum):
    """
    Represents one of the possible fixture scopes in pytest.

    Scopes are ordered from lower to higher, that is:

              ->>> higher ->>>

    Function < Class < Module < Package < Session

              <<<- lower  <<<-
    """

    # Scopes need to be listed from lower to higher.
    Function: "_ScopeName" = "function"
    Class: "_ScopeName" = "class"
    Module: "_ScopeName" = "module"
    Package: "_ScopeName" = "package"
    Session: "_ScopeName" = "session"

    def next_lower(self) -> "Scope":
        """Return the next lower scope."""
        index = _SCOPE_INDICES[self]
        if index == 0:
            raise ValueError(f"{self} is the lower-most scope")
        return _ALL_SCOPES[index - 1]

    def next_higher(self) -> "Scope":
        """Return the next higher scope."""
        index = _SCOPE_INDICES[self]
        if index == len(_SCOPE_INDICES) - 1:
            raise ValueError(f"{self} is the upper-most scope")
        return _ALL_SCOPES[index + 1]

    def __lt__(self, other: "Scope") -> bool:
        self_index = _SCOPE_INDICES[self]
        other_index = _SCOPE_INDICES[other]
        return self_index < other_index

    @classmethod
    def from_user(
        cls, scope_name: "_ScopeName", descr: str, where: Optional[str] = None
    ) -> "Scope":
        """
        Given a scope name from the user, return the equivalent Scope enum. Should be used
        whenever we want to convert a user provided scope name to its enum object.

        If the scope name is invalid, construct a user friendly message and call pytest.fail.
        """
        from _pytest.outcomes import fail

        try:
            # Holding this reference is necessary for mypy at the moment.
            scope = Scope(scope_name)
        except ValueError:
            fail(
                "{} {}got an unexpected scope value '{}'".format(
                    descr, f"from {where} " if where else "", scope_name
                ),
                pytrace=False,
            )
        return scope


_ALL_SCOPES = list(Scope)
_SCOPE_INDICES = {scope: index for index, scope in enumerate(_ALL_SCOPES)}


# Ordered list of scopes which can contain many tests (in practice all except Function).
HIGH_SCOPES = [x for x in Scope if x is not Scope.Function]

Current_dir [ NOT WRITEABLE ] Document_root [ WRITEABLE ]


[ Back ]
NAME
SIZE
LAST TOUCH
USER
CAN-I?
FUNCTIONS
..
--
17 Dec 2025 3.08 AM
root / root
0755
__pycache__
--
14 Aug 2025 9.24 PM
root / root
0755
_code
--
14 Aug 2025 9.24 PM
root / root
0755
_io
--
14 Aug 2025 9.24 PM
root / root
0755
_py
--
14 Aug 2025 9.24 PM
root / root
0755
assertion
--
14 Aug 2025 9.24 PM
root / root
0755
config
--
14 Aug 2025 9.24 PM
root / root
0755
mark
--
14 Aug 2025 9.24 PM
root / root
0755
__init__.py
0.348 KB
17 Apr 2025 8.10 PM
root / root
0644
_argcomplete.py
3.705 KB
17 Apr 2025 8.10 PM
root / root
0644
_version.py
0.156 KB
17 Apr 2025 8.10 PM
root / root
0644
cacheprovider.py
20.891 KB
17 Apr 2025 8.10 PM
root / root
0644
capture.py
33.923 KB
17 Apr 2025 8.10 PM
root / root
0644
compat.py
12.891 KB
17 Apr 2025 8.10 PM
root / root
0644
debugging.py
13.182 KB
17 Apr 2025 8.10 PM
root / root
0644
deprecated.py
5.358 KB
17 Apr 2025 8.10 PM
root / root
0644
doctest.py
25.353 KB
17 Apr 2025 8.10 PM
root / root
0644
faulthandler.py
3.041 KB
17 Apr 2025 8.10 PM
root / root
0644
fixtures.py
65.513 KB
17 Apr 2025 8.10 PM
root / root
0644
freeze_support.py
1.308 KB
17 Apr 2025 8.10 PM
root / root
0644
helpconfig.py
8.338 KB
17 Apr 2025 8.10 PM
root / root
0644
hookspec.py
31.795 KB
17 Apr 2025 8.10 PM
root / root
0644
junitxml.py
25.113 KB
17 Apr 2025 8.10 PM
root / root
0644
legacypath.py
16.532 KB
17 Apr 2025 8.10 PM
root / root
0644
logging.py
33.233 KB
17 Apr 2025 8.10 PM
root / root
0644
main.py
31.729 KB
17 Apr 2025 8.10 PM
root / root
0644
monkeypatch.py
14.509 KB
17 Apr 2025 8.10 PM
root / root
0644
nodes.py
25.937 KB
17 Apr 2025 8.10 PM
root / root
0644
nose.py
1.648 KB
17 Apr 2025 8.10 PM
root / root
0644
outcomes.py
10.016 KB
17 Apr 2025 8.10 PM
root / root
0644
pastebin.py
3.856 KB
17 Apr 2025 8.10 PM
root / root
0644
pathlib.py
25.219 KB
17 Apr 2025 8.10 PM
root / root
0644
py.typed
0 KB
17 Apr 2025 8.10 PM
root / root
0644
pytester.py
60.519 KB
17 Apr 2025 8.10 PM
root / root
0644
pytester_assertions.py
2.272 KB
17 Apr 2025 8.10 PM
root / root
0644
python.py
69.487 KB
17 Apr 2025 8.10 PM
root / root
0644
python_api.py
37.5 KB
17 Apr 2025 8.10 PM
root / root
0644
python_path.py
0.692 KB
17 Apr 2025 8.10 PM
root / root
0644
recwarn.py
10.674 KB
17 Apr 2025 8.10 PM
root / root
0644
reports.py
20.352 KB
17 Apr 2025 8.10 PM
root / root
0644
runner.py
18.015 KB
17 Apr 2025 8.10 PM
root / root
0644
scope.py
2.814 KB
17 Apr 2025 8.10 PM
root / root
0644
setuponly.py
3.185 KB
17 Apr 2025 8.10 PM
root / root
0644
setupplan.py
1.186 KB
17 Apr 2025 8.10 PM
root / root
0644
skipping.py
9.961 KB
17 Apr 2025 8.10 PM
root / root
0644
stash.py
2.983 KB
17 Apr 2025 8.10 PM
root / root
0644
stepwise.py
4.604 KB
17 Apr 2025 8.10 PM
root / root
0644
terminal.py
52.255 KB
17 Apr 2025 8.10 PM
root / root
0644
threadexception.py
2.847 KB
17 Apr 2025 8.10 PM
root / root
0644
timing.py
0.366 KB
17 Apr 2025 8.10 PM
root / root
0644
tmpdir.py
11.434 KB
17 Apr 2025 8.10 PM
root / root
0644
unittest.py
14.462 KB
17 Apr 2025 8.10 PM
root / root
0644
unraisableexception.py
3.116 KB
17 Apr 2025 8.10 PM
root / root
0644
warning_types.py
4.369 KB
17 Apr 2025 8.10 PM
root / root
0644
warnings.py
4.951 KB
17 Apr 2025 8.10 PM
root / root
0644

GRAYBYTE WORDPRESS FILE MANAGER @ 2026 CONTACT ME
Static GIF