Closed kloczek closed 2 years ago
Hi @kloczek, thank you very much for reporting this.
Question: do the errors still proceed if you don't use --no-isolation
?
Currently --no-isolation
is not supported.
If you would like to add support for it, I would be more than happy to review a PR.
Question: do the errors still proceed if you don't use
--no-isolation
?
--no-isolation
affests only pep517 build and theres is no any .whl archive relates issues š
Rwported issues is related to tesring.
To fix thosse issues it is necessaty to know what exatly is tested co I'm not the best person with such knowledge.
On a side comment, please note that I use git + setuptools + setuptools-scm + build isolation
in all my projects.
This means that they will only build correctly if the code is obtained via a git checkout which includes the latest tags.
Question: do the errors still proceed if you don't use
--no-isolation
?
--no-isolation
affests only pep517 build and theres is no any .whl archive relates issues š Rwported issues is related to tesring. To fix thosse issues it is necessaty to know what exatly is tested co I'm not the best person with such knowledge.
Then, can you past here the output of unzip -l
for the wheel file that you are generating?
I suspect that your methodology for building the package is missing some files.
Ok, some of the errors are due to the problem I describe above, but for a test dependency validate-pyproject
, not ini2toml
itself.
@kloczek, you are also running the tests with a bunch of pytest plugins that were never meant to work together with the test suite (e.g. checkdocs
). They are not listed in the test dependencies and should not be present in the test environment you use for ini2toml
.
There is a bunch of moving parts here which makes it extremely difficult to help you. I suspect that all the errors here are caused by some specific configuration of your particular environment.
Please note that the only supported way of running the tests for this project is via tox
.
Therefore I don't expect the tests to succeed unless you emulate EXACTLY the setup provided by tox...
Then, can you past here the output of
unzip -l
for the wheel file that you are generating? I suspect that your methodology for building the package is missing some files.
Here it is the output:
[tkloczko@devel-g2v ini2toml-0.10]$ unzip -l dist/ini2toml-0.10-py3-none-any.whl
Archive: dist/ini2toml-0.10-py3-none-any.whl
Length Date Time Name
--------- ---------- ----- ----
820 03-09-2022 17:51 ini2toml/__init__.py
28 03-09-2022 17:51 ini2toml/__main__.py
1128 03-09-2022 17:51 ini2toml/api.py
6595 03-09-2022 17:51 ini2toml/base_translator.py
8215 03-09-2022 17:51 ini2toml/cli.py
2346 03-09-2022 17:51 ini2toml/errors.py
8961 03-09-2022 17:51 ini2toml/intermediate_repr.py
2396 03-09-2022 17:51 ini2toml/profile.py
9908 03-09-2022 17:51 ini2toml/transformations.py
2712 03-09-2022 17:51 ini2toml/translator.py
3229 03-09-2022 17:51 ini2toml/types.py
0 03-09-2022 17:51 ini2toml/drivers/__init__.py
658 03-09-2022 17:51 ini2toml/drivers/configparser.py
2231 03-09-2022 17:51 ini2toml/drivers/configupdater.py
10456 03-09-2022 17:51 ini2toml/drivers/full_toml.py
656 03-09-2022 17:51 ini2toml/drivers/lite_toml.py
2185 03-09-2022 17:51 ini2toml/drivers/plain_builtins.py
3693 03-09-2022 17:51 ini2toml/plugins/__init__.py
2044 03-09-2022 17:51 ini2toml/plugins/best_effort.py
1823 03-09-2022 17:51 ini2toml/plugins/coverage.py
2387 03-09-2022 17:51 ini2toml/plugins/isort.py
2792 03-09-2022 17:51 ini2toml/plugins/mypy.py
1744 03-09-2022 17:51 ini2toml/plugins/profile_independent_tasks.py
2267 03-09-2022 17:51 ini2toml/plugins/pytest.py
33979 03-09-2022 17:51 ini2toml/plugins/setuptools_pep621.py
15922 04-11-2022 21:01 ini2toml-0.10.dist-info/LICENSE.txt
6388 04-11-2022 21:01 ini2toml-0.10.dist-info/METADATA
92 04-11-2022 21:01 ini2toml-0.10.dist-info/WHEEL
423 04-11-2022 21:01 ini2toml-0.10.dist-info/entry_points.txt
9 04-11-2022 21:01 ini2toml-0.10.dist-info/top_level.txt
2563 04-11-2022 21:01 ini2toml-0.10.dist-info/RECORD
--------- -------
138650 31 files
Only difference which I see comparing above with .whl file from pypi is lack of 0 bytes size py.typed files.
@kloczek, you are also running the tests with a bunch of pytest plugins that were never meant to work together with the test suite (e.g.
checkdocs
). They are not listed in the test dependencies and should not be present in the test environment you use forini2toml
.
Indeed whayt is on top of this ticket was from my devel system. However I've just repeated build on prod builder env created only to build that single package where are installed additionnal packages listed in spec file BuildRequires. Result is the same
Please note that the only supported way of running the tests for this project is via
tox
. Therefore I don't expect the tests to succeed unless you emulate EXACTLY the setup provided by tox...
Thet is guaranteed by what is listed in rpm package BuildRequires š
Nevertheless I'm always trying to use pytest
if it is only possible.
Reson is that this allows me to fire special type of builds with additional pytest extensions to perform additional set of tests like randomly
. tox
does not allow to have such flexibility (without touching source tree). Result is that on almost 900 already packaged python modules only 2 are tested using tox
, almost 800 are tested using pytest
and rest are still tested using setuptools
test command or without test suite because they don;t have at ll any test suite.
That approach allows me easyluy perform several other tests by only precisely alter list of additional pytest extensions and assign to each package set of addition metrics providing proper view about quality of the code exact python module.
To have such possibility all what needs to be done is have proper build of the module. I'n this case I;ve packaged your module because I found that latest setuptools
uses it in own test suite š
As long as base build is done and some found issues resolved taht opens alot of new doors to performs many other (additional and obligatory) tests. I have not yet proper frontend for all those tests results however I'm going to share openly those results.
Result is the same
Please take some time to analyse the scripts output before posting. You can see that the files are missing in validate-pyproject
. This is caused because your process to package validate-pyproject
does not follow the exact methodology supported by that package. If you unzip -l
the validate-pyproject
wheel and compare with the file uploaded to PyPI, you are going to see the difference. Please refer to https://github.com/abravalheri/ini2toml/issues/39#issuecomment-1095486104 and https://github.com/abravalheri/validate-pyproject/issues/36 for more details.
Also note that you are missing pyproject-fmt
in your test environment, which is causing the error with -F
.
(These are all errors that you could have spotted by checking the error logs)
Thet is guaranteed by what is listed in rpm package BuildRequires š
Well, the fact that the tests are failing prove otherwise.
I understand your intentions @kloczek, but please have in mind that I don't support other ways of testing, building etc. Only what is directly encoded in the tox.ini
file.
I appreciate that you are exploring other solutions, but when there is a failure, I will not be able to help you unless you reproduce EXACTLY the methodology I am using.
@kloczek, I am tempted to close this issue because nothing seems to be directly caused by the project, and all the problems seem to derive from the fact that you are trying to use different methodology, or that your environment (and build process for the test dependencies) deviate considerably from the supported approach.
Although I can see the merit in your efforts, I simply cannot handle the onus of supporting these experiments if they differ from the main test/build/doc methodology. I hope you understand that.
As I have previously mentioned in other issues/projects, I am very happy to review PRs that would facilitate your particular methodology, as long as they don't differ considerably from mine.
Please take some time to analyse the scripts output before posting. You can see that the files are missing in
validate-pyproject
. This is caused because your process to packagevalidate-pyproject
does not follow the exact methodology supported by that package. If youunzip -l
thevalidate-pyproject
wheel and compare with the file uploaded to PyPI, you are going to see the difference. Please refer to #39 (comment) and abravalheri/validate-pyproject#36 for more details.
Point taken .. will back if I'll sot that part ansd still will have some issues.
validate-pyproject
in my stash it is very fresh package so .. š
Thank you.
Just tested new 0.11 and lookd like pytest still is failing in two units.
+ PYTHONPATH=/home/tkloczko/rpmbuild/BUILDROOT/python-ini2toml-0.11-2.fc35.x86_64/usr/lib64/python3.8/site-packages:/home/tkloczko/rpmbuild/BUILDROOT/python-ini2toml-0.11-2.fc35.x86_64/usr/lib/python3.8/site-packages
+ /usr/bin/pytest -ra
=========================================================================== test session starts ============================================================================
platform linux -- Python 3.8.13, pytest-7.1.2, pluggy-1.0.0
rootdir: /home/tkloczko/rpmbuild/BUILD/ini2toml-0.11, configfile: setup.cfg, testpaths: tests
plugins: anyio-3.6.1, cov-3.0.0
collected 86 items
tests/test_cli.py ......F [ 8%]
tests/test_examples.py .............................. [ 43%]
tests/test_intermediate_repr.py ...... [ 50%]
tests/test_plugins.py ... [ 53%]
tests/test_transformations.py ..... [ 59%]
tests/test_translator.py ..... [ 65%]
tests/drivers/test_configparser.py . [ 66%]
tests/drivers/test_configupdater.py . [ 67%]
tests/drivers/test_full_toml.py . [ 68%]
tests/drivers/test_lite_toml.py F [ 69%]
tests/drivers/test_plain_builtins.py . [ 70%]
tests/plugins/test_best_effort.py . [ 72%]
tests/plugins/test_coverage.py . [ 73%]
tests/plugins/test_isort.py . [ 74%]
tests/plugins/test_mypy.py . [ 75%]
tests/plugins/test_profile_independent_tasks.py .. [ 77%]
tests/plugins/test_pytest.py . [ 79%]
tests/plugins/test_setuptools_pep621.py .................. [100%]
================================================================================= FAILURES =================================================================================
___________________________________________________________________________ test_auto_formatting ___________________________________________________________________________
tmp_path = PosixPath('/tmp/pytest-of-tkloczko/pytest-152/test_auto_formatting0'), capsys = <_pytest.capture.CaptureFixture object at 0x7f6cb73e29d0>
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")])
tests/test_cli.py:137:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
/usr/lib64/python3.8/contextlib.py:75: in inner
return func(*args, **kwds)
../../BUILDROOT/python-ini2toml-0.11-2.fc35.x86_64/usr/lib/python3.8/site-packages/ini2toml/cli.py:196: in run
params = parse_args(args, profiles, profile_augmentations)
/usr/lib64/python3.8/contextlib.py:75: in inner
return func(*args, **kwds)
../../BUILDROOT/python-ini2toml-0.11-2.fc35.x86_64/usr/lib/python3.8/site-packages/ini2toml/cli.py:150: in parse_args
params = parser.parse_args(args)
/usr/lib64/python3.8/argparse.py:1771: in parse_args
self.error(msg % ' '.join(argv))
/usr/lib64/python3.8/argparse.py:2521: in error
self.exit(2, _('%(prog)s: error: %(message)s\n') % args)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = ArgumentParser(prog='pytest', usage=None, description='Automatically converts .cfg/.ini files into TOML', formatter_class=<class 'ini2toml.cli.Formatter'>, conflict_handler='error', add_help=True)
status = 2, message = 'pytest: error: unrecognized arguments: -F\n'
def exit(self, status=0, message=None):
if message:
self._print_message(message, _sys.stderr)
> _sys.exit(status)
E SystemExit: 2
/usr/lib64/python3.8/argparse.py:2508: SystemExit
--------------------------------------------------------------------------- Captured stderr call ---------------------------------------------------------------------------
usage: pytest [-h] [-V] [-o OUTPUT_FILE] [-p PROFILE]
[-D TRANSFORMATION [TRANSFORMATION ...]] [-v] [-vv]
input_file
pytest: error: unrecognized arguments: -F
_______________________________________________________________________________ test_convert _______________________________________________________________________________
def test_convert():
> assert lib.convert(example_parsed) == example_toml
E assert '[section1]\n...y"\nz = "w"\n' == '[section1]\n...y"\nz = "w"\n'
E Skipping 81 identical leading characters in diff, use -v to show
E + value" = [ 1, 2, 3,]
E - value" = [
E - 1,
E - 2,
E - 3,
E - ]...
E
E ...Full output truncated (18 lines hidden), use '-vv' to show
tests/drivers/test_lite_toml.py:67: AssertionError
---------- coverage: platform linux, python 3.8.13-final-0 -----------
Name Stmts Miss Branch BrPart Cover Missing
-----------------------------------------------------------------------------------------------
src/ini2toml/__init__.py 5 0 0 0 100%
src/ini2toml/base_translator.py 61 0 18 1 99% 137->136
src/ini2toml/cli.py 109 5 45 1 96% 89-98, 202
src/ini2toml/drivers/__init__.py 0 0 0 0 100%
src/ini2toml/drivers/configparser.py 19 0 6 0 100%
src/ini2toml/drivers/configupdater.py 42 0 18 0 100%
src/ini2toml/drivers/full_toml.py 185 9 97 8 93% 159, 203, 220->exit, 221->223, 228-229, 231->195, 257-260, 265
src/ini2toml/drivers/lite_toml.py 8 0 0 0 100%
src/ini2toml/drivers/plain_builtins.py 44 3 18 3 90% 64, 67-68, 71->58
src/ini2toml/errors.py 33 10 12 2 73% 31-34, 41, 48-49, 54, 61-62
src/ini2toml/intermediate_repr.py 160 3 74 3 97% 214-215, 239->exit, 259->261, 288
src/ini2toml/plugins/__init__.py 28 2 14 2 90% 35-36, 86->89
src/ini2toml/plugins/best_effort.py 42 1 16 1 97% 60
src/ini2toml/plugins/coverage.py 30 0 12 0 100%
src/ini2toml/plugins/isort.py 34 0 12 0 100%
src/ini2toml/plugins/mypy.py 53 2 24 3 94% 43, 73, 74->exit
src/ini2toml/plugins/profile_independent_tasks.py 29 0 4 0 100%
src/ini2toml/plugins/pytest.py 33 0 16 0 100%
src/ini2toml/plugins/setuptools_pep621.py 392 7 195 6 98% 276, 310, 546, 738, 748-749, 755, 783->781, 797->783
src/ini2toml/profile.py 30 0 6 0 100%
src/ini2toml/transformations.py 128 4 48 3 95% 155, 228, 368, 376
src/ini2toml/translator.py 17 0 2 0 100%
src/ini2toml/types.py 36 0 8 0 100%
-----------------------------------------------------------------------------------------------
TOTAL 1518 46 645 33 96%
========================================================================= short test summary info ==========================================================================
FAILED tests/test_cli.py::test_auto_formatting - SystemExit: 2
FAILED tests/drivers/test_lite_toml.py::test_convert - assert '[section1]\n...y"\nz = "w"\n' == '[section1]\n...y"\nz = "w"\n'
======================================================================= 2 failed, 84 passed in 4.34s =======================================================================
It seems that you are missing test dependencies in your test environment, or that you are using different versions of the test dependencies required to run the tests.
OK so what could be missing in this case? š¤
Just tested 0.11.1 ans still have the same two failing units. Do you know what could be missing in build anv in this case? Currently in build env I have below list of modules
Package Version
----------------------------- -----------------
alabaster 0.7.12
appdirs 1.4.4
attrs 22.1.0
Babel 2.11.0
Brlapi 0.8.3
build 0.9.0
charset-normalizer 3.0.0
ConfigUpdater 3.1
contourpy 1.0.6
coverage 6.5.0
cssselect 1.1.0
cycler 0.11.0
distro 1.8.0
dnspython 2.2.1
docutils 0.18.1
extras 1.0.0
fixtures 4.0.0
fonttools 4.38.0
gpg 1.17.1-unknown
idna 3.4
imagesize 1.4.1
importlib-metadata 5.0.0
iniconfig 1.1.1
Jinja2 3.1.1
kiwisolver 1.4.4
libcomps 0.1.19
louis 3.23.0
lxml 4.9.1
MarkupSafe 2.1.1
matplotlib 3.6.2
numpy 1.23.1
olefile 0.46
packaging 21.3
pbr 5.9.0
pep517 0.13.0
Pillow 9.3.0
pip 22.2.2
pluggy 1.0.0
py 1.11.0
Pygments 2.13.0
PyGObject 3.42.2
pyparsing 3.0.9
pytest 7.1.3
pytest-cov 3.0.0
python-dateutil 2.8.2
pytz 2022.4
requests 2.28.1
rpm 4.17.0
scour 0.38.2
setuptools 65.5.1
setuptools-scm 7.0.5
six 1.16.0
snowballstemmer 2.2.0
Sphinx 5.3.0
sphinx-argparse 0.4.0
sphinx-copybutton 0.5.0
sphinxcontrib-applehelp 1.0.2.dev20220730
sphinxcontrib-devhelp 1.0.2.dev20220730
sphinxcontrib-htmlhelp 2.0.0
sphinxcontrib-jsmath 1.0.1.dev20220730
sphinxcontrib-qthelp 1.0.3.dev20220730
sphinxcontrib-serializinghtml 1.1.5
sphinxemoji 0.2.0
testtools 2.5.0
toml 0.10.2
tomli 2.0.1
tomlkit 0.11.6
typing_extensions 4.3.0
urllib3 1.26.12
validate-pyproject 0.10.1
wheel 0.37.1
zipp 3.9.0
With new 0.13 still have the same issue š¤
After add pyproject-fmt
to build env still I have on failing unit which shows different output than expected
I'm trying to package your module as an rpm package. So I'm using the typical PEP517 based build, install and test cycle used on building packages from non-root account.
python3 -sBm build -w --no-isolation
build
with--no-isolation
I'm using during all processes only locally installed modulesHere is pytest output: