You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm testing ini2toml 0.15 in an environment with pyproject-fmt 2.0.3 installed and I see the following test to fail:
_____________________________ test_auto_formatting _____________________________
tmp_path = PosixPath('/tmp/pytest-of-marcel/pytest-15/test_auto_formatting0')
capsys = <_pytest.capture.CaptureFixture object at 0x7fffac3c30d0>
@pytest.mark.skipif(
sys.version_info < (3, 7),
reason="pyproject-fmt is only available on Python 3.7+",
)
def test_auto_formatting(tmp_path, capsys):
setupcfg = """
[metadata]
version = 42
name = myproj
"""
normal_output = """
requires = ["setuptools>=61.2"]
"""
expected = """
requires = [
"setuptools>=61.2",
]
"""
# Check if the underlying function works
formatted = cli.apply_auto_formatting(cleandoc(expected))
assert formatted.strip() == cleandoc(expected).strip()
(tmp_path / "setup.cfg").write_text(cleandoc(setupcfg), encoding="utf-8")
assert (tmp_path / "setup.cfg").exists()
# Check the output when formatting in off
cli.run([str(tmp_path / "setup.cfg")])
out, _ = capsys.readouterr()
assert cleandoc(normal_output) in out
assert cleandoc(expected) not in out
# Check the output when formatting in on
cli.run(["-F", str(tmp_path / "setup.cfg")])
out, _ = capsys.readouterr()
> assert cleandoc(normal_output) not in out
E assert 'requires = ["setuptools>=61.2"]' not in '[build-system]\nrequires = ["setuptools>=61.2"]\nbuild-backend = "setuptools.build_meta"\n\n[project]\nversion = "42"\nname = "myproj"\n\n[tool.setuptools]\ninclude-package-data = false\n'
E
E 'requires = ["setuptools>=61.2"]' is contained here:
E [build-system]
E requires = ["setuptools>=61.2"]
E build-backend = "setuptools.build_meta"
E
E [project]
E version = "42"
E name = "myproj"
E
E [tool.setuptools]
E include-package-data = false
tests/test_cli.py:161: AssertionError
------------------------------ Captured log call -------------------------------
WARNING ini2toml:cli.py:103 Auto-formatting failed, falling back to original text
WARNING ini2toml:cli.py:103 Auto-formatting failed, falling back to original text
The text was updated successfully, but these errors were encountered:
For the moment I am trying to figure it out, as pyproject-fmt 2+ removed the public API.
v0.15should have a version cap on the dependency as a temporary workaround for this problem. But as anything with extras is complicated (because pip does not support extras in entry-points). Now, I am not sure why the cap is not enforced.
For the moment I am trying to figure it out, as pyproject-fmt 2+ removed the public API.
v0.15should have a version cap on the dependency as a temporary workaround for this problem. But as anything with extras is complicated (because pip does not support extras in entry-points). Now, I am not sure why the cap is not enforced.
Cap is not enforced here intentionally because I'm testing in real environment where there is simply newer pyproject-fmt installed. So this could be simply considered as: please add support for pyproject-fmt 2.
I'm testing
ini2toml 0.15
in an environment withpyproject-fmt 2.0.3
installed and I see the following test to fail:The text was updated successfully, but these errors were encountered: