7291: Replace py.iniconfig with iniconfig
This commit is contained in:
parent
2f406bb9cb
commit
2748feed38
|
@ -0,0 +1 @@
|
||||||
|
Replaced usages of py.iniconfig with iniconfig.
|
1
setup.py
1
setup.py
|
@ -12,6 +12,7 @@ INSTALL_REQUIRES = [
|
||||||
'colorama;sys_platform=="win32"',
|
'colorama;sys_platform=="win32"',
|
||||||
"pluggy>=0.12,<1.0",
|
"pluggy>=0.12,<1.0",
|
||||||
'importlib-metadata>=0.12;python_version<"3.8"',
|
'importlib-metadata>=0.12;python_version<"3.8"',
|
||||||
|
"iniconfig",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -6,6 +6,8 @@ from typing import Optional
|
||||||
from typing import Tuple
|
from typing import Tuple
|
||||||
|
|
||||||
import py
|
import py
|
||||||
|
from iniconfig import IniConfig
|
||||||
|
from iniconfig import ParseError
|
||||||
|
|
||||||
from .exceptions import UsageError
|
from .exceptions import UsageError
|
||||||
from _pytest.compat import TYPE_CHECKING
|
from _pytest.compat import TYPE_CHECKING
|
||||||
|
@ -40,8 +42,8 @@ def getcfg(args, config=None):
|
||||||
p = base.join(inibasename)
|
p = base.join(inibasename)
|
||||||
if exists(p):
|
if exists(p):
|
||||||
try:
|
try:
|
||||||
iniconfig = py.iniconfig.IniConfig(p)
|
iniconfig = IniConfig(p)
|
||||||
except py.iniconfig.ParseError as exc:
|
except ParseError as exc:
|
||||||
raise UsageError(str(exc))
|
raise UsageError(str(exc))
|
||||||
|
|
||||||
if (
|
if (
|
||||||
|
@ -119,7 +121,7 @@ def determine_setup(
|
||||||
) -> Tuple[py.path.local, Optional[str], Any]:
|
) -> Tuple[py.path.local, Optional[str], Any]:
|
||||||
dirs = get_dirs_from_args(args)
|
dirs = get_dirs_from_args(args)
|
||||||
if inifile:
|
if inifile:
|
||||||
iniconfig = py.iniconfig.IniConfig(inifile)
|
iniconfig = IniConfig(inifile)
|
||||||
is_cfg_file = str(inifile).endswith(".cfg")
|
is_cfg_file = str(inifile).endswith(".cfg")
|
||||||
sections = ["tool:pytest", "pytest"] if is_cfg_file else ["pytest"]
|
sections = ["tool:pytest", "pytest"] if is_cfg_file else ["pytest"]
|
||||||
for section in sections:
|
for section in sections:
|
||||||
|
|
|
@ -22,6 +22,7 @@ from typing import Union
|
||||||
from weakref import WeakKeyDictionary
|
from weakref import WeakKeyDictionary
|
||||||
|
|
||||||
import py
|
import py
|
||||||
|
from iniconfig import IniConfig
|
||||||
|
|
||||||
import pytest
|
import pytest
|
||||||
from _pytest._code import Source
|
from _pytest._code import Source
|
||||||
|
@ -683,7 +684,7 @@ class Testdir:
|
||||||
def getinicfg(self, source):
|
def getinicfg(self, source):
|
||||||
"""Return the pytest section from the tox.ini config file."""
|
"""Return the pytest section from the tox.ini config file."""
|
||||||
p = self.makeini(source)
|
p = self.makeini(source)
|
||||||
return py.iniconfig.IniConfig(p)["pytest"]
|
return IniConfig(p)["pytest"]
|
||||||
|
|
||||||
def makepyfile(self, *args, **kwargs):
|
def makepyfile(self, *args, **kwargs):
|
||||||
r"""Shortcut for .makefile() with a .py extension.
|
r"""Shortcut for .makefile() with a .py extension.
|
||||||
|
|
Loading…
Reference in New Issue