Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

7291: Replace py.iniconfig with iniconfig #7292

Merged
merged 2 commits into from
Jun 3, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions changelog/7291.trivial.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Replaced ``py.iniconfig`` with `iniconfig <https://pypi.org/project/iniconfig/>`__.
1 change: 1 addition & 0 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
'colorama;sys_platform=="win32"',
"pluggy>=0.12,<1.0",
'importlib-metadata>=0.12;python_version<"3.8"',
"iniconfig",
]


Expand Down
8 changes: 5 additions & 3 deletions src/_pytest/config/findpaths.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@
from typing import Tuple

import py
from iniconfig import IniConfig
from iniconfig import ParseError

from .exceptions import UsageError
from _pytest.compat import TYPE_CHECKING
Expand Down Expand Up @@ -40,8 +42,8 @@ def getcfg(args, config=None):
p = base.join(inibasename)
if exists(p):
try:
iniconfig = py.iniconfig.IniConfig(p)
except py.iniconfig.ParseError as exc:
iniconfig = IniConfig(p)
except ParseError as exc:
raise UsageError(str(exc))

if (
Expand Down Expand Up @@ -119,7 +121,7 @@ def determine_setup(
) -> Tuple[py.path.local, Optional[str], Any]:
dirs = get_dirs_from_args(args)
if inifile:
iniconfig = py.iniconfig.IniConfig(inifile)
iniconfig = IniConfig(inifile)
is_cfg_file = str(inifile).endswith(".cfg")
sections = ["tool:pytest", "pytest"] if is_cfg_file else ["pytest"]
for section in sections:
Expand Down
3 changes: 2 additions & 1 deletion src/_pytest/pytester.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
from weakref import WeakKeyDictionary

import py
from iniconfig import IniConfig

import pytest
from _pytest._code import Source
Expand Down Expand Up @@ -683,7 +684,7 @@ def makeini(self, source):
def getinicfg(self, source):
"""Return the pytest section from the tox.ini config file."""
p = self.makeini(source)
return py.iniconfig.IniConfig(p)["pytest"]
return IniConfig(p)["pytest"]

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