Skip to content

Commit cf640a9

Browse files
authored
Merge pull request #7292 from kerizane/7259_iniconfig
2 parents e755317 + da5851c commit cf640a9

File tree

4 files changed

+9
-4
lines changed

4 files changed

+9
-4
lines changed

changelog/7291.trivial.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Replaced ``py.iniconfig`` with `iniconfig <https://pypi.org/project/iniconfig/>`__.

setup.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
'colorama;sys_platform=="win32"',
1313
"pluggy>=0.12,<1.0",
1414
'importlib-metadata>=0.12;python_version<"3.8"',
15+
"iniconfig",
1516
]
1617

1718

src/_pytest/config/findpaths.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@
66
from typing import Tuple
77

88
import py
9+
from iniconfig import IniConfig
10+
from iniconfig import ParseError
911

1012
from .exceptions import UsageError
1113
from _pytest.compat import TYPE_CHECKING
@@ -40,8 +42,8 @@ def getcfg(args, config=None):
4042
p = base.join(inibasename)
4143
if exists(p):
4244
try:
43-
iniconfig = py.iniconfig.IniConfig(p)
44-
except py.iniconfig.ParseError as exc:
45+
iniconfig = IniConfig(p)
46+
except ParseError as exc:
4547
raise UsageError(str(exc))
4648

4749
if (
@@ -119,7 +121,7 @@ def determine_setup(
119121
) -> Tuple[py.path.local, Optional[str], Any]:
120122
dirs = get_dirs_from_args(args)
121123
if inifile:
122-
iniconfig = py.iniconfig.IniConfig(inifile)
124+
iniconfig = IniConfig(inifile)
123125
is_cfg_file = str(inifile).endswith(".cfg")
124126
sections = ["tool:pytest", "pytest"] if is_cfg_file else ["pytest"]
125127
for section in sections:

src/_pytest/pytester.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
from weakref import WeakKeyDictionary
2222

2323
import py
24+
from iniconfig import IniConfig
2425

2526
import pytest
2627
from _pytest import timing
@@ -683,7 +684,7 @@ def makeini(self, source):
683684
def getinicfg(self, source):
684685
"""Return the pytest section from the tox.ini config file."""
685686
p = self.makeini(source)
686-
return py.iniconfig.IniConfig(p)["pytest"]
687+
return IniConfig(p)["pytest"]
687688

688689
def makepyfile(self, *args, **kwargs):
689690
r"""Shortcut for .makefile() with a .py extension.

0 commit comments

Comments
 (0)