Update test_init.py
This commit is contained in:
parent
d37e7088d3
commit
6a9937ad56
|
@ -1,93 +1,26 @@
|
||||||
# mypy: allow-untyped-defs
|
# mypy: allow-untyped-defs
|
||||||
"""Command line options, ini-file and conftest.py processing."""
|
"""Command line options, ini-file and conftest.py processing."""
|
||||||
|
|
||||||
import argparse
|
|
||||||
import collections.abc
|
|
||||||
import copy
|
|
||||||
import dataclasses
|
|
||||||
import enum
|
|
||||||
from functools import lru_cache
|
|
||||||
import glob
|
|
||||||
import importlib.metadata
|
|
||||||
import inspect
|
|
||||||
import os
|
import os
|
||||||
from pathlib import Path
|
|
||||||
import re
|
|
||||||
import shlex
|
|
||||||
import sys
|
import sys
|
||||||
from textwrap import dedent
|
|
||||||
import types
|
|
||||||
from types import FunctionType
|
|
||||||
from typing import Any
|
|
||||||
from typing import Callable
|
|
||||||
from typing import cast
|
|
||||||
from typing import Dict
|
|
||||||
from typing import Final
|
|
||||||
from typing import final
|
|
||||||
from typing import Generator
|
|
||||||
from typing import IO
|
|
||||||
from typing import Iterable
|
|
||||||
from typing import Iterator
|
|
||||||
from typing import List
|
|
||||||
from typing import Optional
|
|
||||||
from typing import Sequence
|
|
||||||
from typing import Set
|
|
||||||
from typing import TextIO
|
|
||||||
from typing import Tuple
|
|
||||||
from typing import Type
|
|
||||||
from typing import TYPE_CHECKING
|
|
||||||
from typing import Union
|
|
||||||
import warnings
|
|
||||||
|
|
||||||
import pluggy
|
from _pytest.config import Config
|
||||||
from pluggy import HookimplMarker
|
from _pytest.config import PytestPluginManager
|
||||||
from pluggy import HookimplOpts
|
from _pytest.config.__init__ import _strtobool
|
||||||
from pluggy import HookspecMarker
|
from _pytest.config.__init__ import Config
|
||||||
from pluggy import HookspecOpts
|
from _pytest.config.__init__ import create_terminal_writer
|
||||||
from pluggy import PluginManager
|
|
||||||
|
|
||||||
# from .compat import PathAwareHookProxy
|
# from .compat import PathAwareHookProxy
|
||||||
# from .exceptions import PrintHelp as PrintHelp
|
# from .exceptions import PrintHelp as PrintHelp
|
||||||
# from .exceptions import UsageError as UsageError
|
# from .exceptions import UsageError as UsageError
|
||||||
# from .findpaths import determine_setup
|
# from .findpaths import determine_setup
|
||||||
from _pytest import __version__
|
|
||||||
import _pytest._code
|
|
||||||
from _pytest._code import ExceptionInfo
|
|
||||||
from _pytest._code import filter_traceback
|
|
||||||
|
|
||||||
# from _pytest._code.code import TracebackStyle
|
# from _pytest._code.code import TracebackStyle
|
||||||
from _pytest._io import TerminalWriter
|
|
||||||
from _pytest.config.argparsing import Argument
|
|
||||||
from _pytest.config.argparsing import Parser
|
|
||||||
import _pytest.deprecated
|
|
||||||
import _pytest.hookspec
|
|
||||||
from _pytest.outcomes import fail
|
|
||||||
from _pytest.outcomes import Skipped
|
|
||||||
from _pytest.pathlib import absolutepath
|
|
||||||
from _pytest.pathlib import bestrelpath
|
|
||||||
from _pytest.pathlib import import_path
|
|
||||||
from _pytest.pathlib import ImportMode
|
|
||||||
from _pytest.pathlib import resolve_package_path
|
|
||||||
from _pytest.pathlib import safe_exists
|
|
||||||
from _pytest.stash import Stash
|
|
||||||
from _pytest.warning_types import PytestConfigWarning
|
|
||||||
from _pytest.warning_types import warn_explicit_for
|
|
||||||
from _pytest.config import PytestPluginManager
|
|
||||||
from _pytest.config import Config
|
|
||||||
from _pytest.config.__init__ import create_terminal_writer
|
|
||||||
from _pytest.config.__init__ import Config
|
|
||||||
from _pytest.config.__init__ import _strtobool
|
|
||||||
import pytest
|
import pytest
|
||||||
|
|
||||||
|
|
||||||
if TYPE_CHECKING:
|
sys.path.insert(
|
||||||
from _pytest.cacheprovider import Cache
|
0, os.path.abspath(os.path.join(os.path.dirname(__file__), "../../src"))
|
||||||
from _pytest.terminal import TerminalReporter
|
)
|
||||||
|
|
||||||
from _pytest._code import __init__
|
|
||||||
import sys
|
|
||||||
import os
|
|
||||||
sys.path.insert(0, os.path.abspath(os.path.join(os.path.dirname(__file__), '../../src')))
|
|
||||||
|
|
||||||
|
|
||||||
# Test branches 1,3 in create_terminal_writer
|
# Test branches 1,3 in create_terminal_writer
|
||||||
|
@ -110,14 +43,14 @@ tw = create_terminal_writer(config)
|
||||||
assert tw.hasmarkup == False
|
assert tw.hasmarkup == False
|
||||||
assert tw.code_highlight == False
|
assert tw.code_highlight == False
|
||||||
|
|
||||||
# # Test branch 1 in _strtobool
|
# Test branch 1 in _strtobool
|
||||||
# assert _strtobool("y") == True
|
assert _strtobool("y") == True
|
||||||
|
|
||||||
# # Test branch 2 in _strtobool
|
# Test branch 2 in _strtobool
|
||||||
# assert _strtobool("n") == False
|
assert _strtobool("n") == False
|
||||||
|
|
||||||
# # Test branch 3 in _strtobool
|
# Test branch 3 in _strtobool
|
||||||
# with pytest.raises(ValueError) as excinfo:
|
with pytest.raises(ValueError) as excinfo:
|
||||||
# _strtobool("a")
|
_strtobool("a")
|
||||||
|
|
||||||
# assert str(excinfo.value) == "invalid truth value 'a'"
|
assert str(excinfo.value) == "invalid truth value 'a'"
|
||||||
|
|
Loading…
Reference in New Issue