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

0.6.0: pytest is failing in two units #19

Closed
kloczek opened this issue Jul 1, 2023 · 7 comments
Closed

0.6.0: pytest is failing in two units #19

kloczek opened this issue Jul 1, 2023 · 7 comments

Comments

@kloczek
Copy link

kloczek commented Jul 1, 2023

I'm packaging 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
  • because I'm calling build with --no-isolation I'm using during all processes only locally installed modules
  • install .whl file in </install/prefix> using 'installer` module
  • run pytest with $PYTHONPATH pointing to sitearch and sitelib inside </install/prefix>
  • build is performed in env which is cut off from access to the public network (pytest is executed with -m "not network")

Here is pytest output:

+ PYTHONPATH=/home/tkloczko/rpmbuild/BUILDROOT/python-parse-type-0.6.0-2.fc35.x86_64/usr/lib64/python3.8/site-packages:/home/tkloczko/rpmbuild/BUILDROOT/python-parse-type-0.6.0-2.fc35.x86_64/usr/lib/python3.8/site-packages
+ /usr/bin/pytest -ra -m 'not network'
==================================================================================== test session starts ====================================================================================
platform linux -- Python 3.8.17, pytest-7.4.0, pluggy-1.0.0
rootdir: /home/tkloczko/rpmbuild/BUILD/parse_type-0.6.0
configfile: pytest.ini
testpaths: tests
plugins: metadata-2.0.4, html-3.2.0
collected 218 items

tests/test_builder.py .........................                                                                                                                                       [ 11%]
tests/test_cardinality.py ................................                                                                                                                            [ 26%]
tests/test_cardinality_field.py ..........................                                                                                                                            [ 38%]
tests/test_cfparse.py .........                                                                                                                                                       [ 42%]
tests/test_parse.py ............................................................FF................                                                                                    [ 77%]
tests/test_parse_decorator.py .....                                                                                                                                                   [ 80%]
tests/test_parse_number.py ..........                                                                                                                                                 [ 84%]
tests/test_parse_util.py .................................                                                                                                                            [100%]

========================================================================================= FAILURES ==========================================================================================
___________________________________________________________________________ TestBugs.test_search_centered_bug_112 ___________________________________________________________________________

self = <tests.test_parse.TestBugs testMethod=test_search_centered_bug_112>

    def test_search_centered_bug_112(self):
        r = parse.parse("{:^},{:^}", " 12 , 34 ")
        self.assertEqual(r[1], "34")
        r = parse.search("{:^},{:^}", " 12 , 34 ")
>       self.assertEqual(r[1], "34")
E       AssertionError: '3' != '34'
E       - 3
E       + 34
E       ?  +

tests/test_parse.py:881: AssertionError
__________________________________________________________________________ TestBugs.test_search_left_align_bug_112 __________________________________________________________________________

self = <tests.test_parse.TestBugs testMethod=test_search_left_align_bug_112>

    def test_search_left_align_bug_112(self):
        r = parse.parse("{:<},{:<}", "12 ,34 ")
        self.assertEqual(r[1], "34")
        r = parse.search("{:<},{:<}", "12 ,34 ")
>       self.assertEqual(r[1], "34")
E       AssertionError: '3' != '34'
E       - 3
E       + 34
E       ?  +

tests/test_parse.py:887: AssertionError
------------------------------------------------ generated xml file: /home/tkloczko/rpmbuild/BUILD/parse_type-0.6.0/build/testing/report.xml ------------------------------------------------
------------------------------------------- generated html file: file:///home/tkloczko/rpmbuild/BUILD/parse_type-0.6.0/build/testing/report.html --------------------------------------------
================================================================================== short test summary info ==================================================================================
FAILED tests/test_parse.py::TestBugs::test_search_centered_bug_112 - AssertionError: '3' != '34'
FAILED tests/test_parse.py::TestBugs::test_search_left_align_bug_112 - AssertionError: '3' != '34'
=============================================================================== 2 failed, 216 passed in 0.70s ===============================================================================

Here is list of installed modules in build env

Package                       Version
----------------------------- -------
alabaster                     0.7.13
asttokens                     2.2.1
Babel                         2.12.1
backcall                      0.2.0
build                         0.10.0
charset-normalizer            3.1.0
decorator                     5.1.1
distro                        1.8.0
docutils                      0.19
exceptiongroup                1.1.1
executing                     1.2.0
gpg                           1.20.0
idna                          3.4
imagesize                     1.4.1
importlib-metadata            6.7.0
iniconfig                     2.0.0
installer                     0.7.0
ipython                       8.12.0
jedi                          0.18.2
Jinja2                        3.1.2
libcomps                      0.1.19
MarkupSafe                    2.1.2
matplotlib-inline             0.1.6
packaging                     23.1
parse                         1.19.1
parso                         0.8.3
pexpect                       4.8.0
pickleshare                   0.7.5
pluggy                        1.0.0
prompt-toolkit                3.0.38
ptyprocess                    0.7.0
pure-eval                     0.2.2
py                            1.11.0
Pygments                      2.15.1
pyproject_hooks               1.0.0
pytest                        7.4.0
pytest-html                   3.2.0
pytest-metadata               2.0.4
python-dateutil               2.8.2
pytz                          2023.2
requests                      2.31.0
setuptools                    68.0.0
six                           1.16.0
snowballstemmer               2.2.0
Sphinx                        6.2.1
sphinxcontrib-applehelp       1.0.4
sphinxcontrib-devhelp         1.0.2
sphinxcontrib-htmlhelp        2.0.0
sphinxcontrib-jsmath          1.0.1
sphinxcontrib-qthelp          1.0.3
sphinxcontrib-serializinghtml 1.1.5
stack-data                    0.6.2
tomli                         2.0.1
traitlets                     5.9.0
typing_extensions             4.6.3
urllib3                       1.26.15
wcwidth                       0.2.6
wheel                         0.40.0
zipp                          3.15.0
@jenisys
Copy link
Owner

jenisys commented Jul 1, 2023

Thanks for the detailed description.
I will look into it.

HINT:
test_parse.py is the test file copied from the parse module.
I basically use it as safety net to detect problems related to parse.
Therefore, the test use only parse module functionality (or the copy of the parse module in parse_type.parse).

@jenisys
Copy link
Owner

jenisys commented Jul 1, 2023

The bug was introduced by parse v1.19.1.
Using parse v1.19.0.post0 still works fine.
The two failing tests were test to verify that issue parse #112 works.

HINT:
The related tests were removed in parse v1.19.1.

@jenisys jenisys closed this as completed in e97375e Jul 1, 2023
@jenisys
Copy link
Owner

jenisys commented Jul 2, 2023

RELATED TO:

The original fix was reverted and the underlying tests changed.

@jenisys
Copy link
Owner

jenisys commented Jul 2, 2023

INTEGRATED INTO: v0.6.1

@kloczek
Copy link
Author

kloczek commented Jul 2, 2023

Just tested 0.6.1 and all looks good now

+ PYTHONPATH=/home/tkloczko/rpmbuild/BUILDROOT/python-parse-type-0.6.1-2.fc35.x86_64/usr/lib64/python3.8/site-packages:/home/tkloczko/rpmbuild/BUILDROOT/python-parse-type-0.6.1-2.fc35.x86_64/usr/lib/python3.8/site-packages
+ /usr/bin/pytest -ra -m 'not network'
==================================================================================== test session starts ====================================================================================
platform linux -- Python 3.8.17, pytest-7.4.0, pluggy-1.0.0
rootdir: /home/tkloczko/rpmbuild/BUILD/parse_type-0.6.1
configfile: pytest.ini
testpaths: tests
plugins: metadata-2.0.4, html-3.2.0
collected 222 items

tests/test_builder.py .........................                                                                                                                                       [ 11%]
tests/test_cardinality.py ................................                                                                                                                            [ 25%]
tests/test_cardinality_field.py ..........................                                                                                                                            [ 37%]
tests/test_cfparse.py .........                                                                                                                                                       [ 41%]
tests/test_parse.py ..................................................................................                                                                                [ 78%]
tests/test_parse_decorator.py .....                                                                                                                                                   [ 80%]
tests/test_parse_number.py ..........                                                                                                                                                 [ 85%]
tests/test_parse_util.py .................................                                                                                                                            [100%]

------------------------------------------------ generated xml file: /home/tkloczko/rpmbuild/BUILD/parse_type-0.6.1/build/testing/report.xml ------------------------------------------------
------------------------------------------- generated html file: file:///home/tkloczko/rpmbuild/BUILD/parse_type-0.6.1/build/testing/report.html --------------------------------------------
==================================================================================== 222 passed in 0.51s ====================================================================================

Thank you 👍 😄

@jenisys
Copy link
Owner

jenisys commented Jul 2, 2023

@kloczek I just uploaded the version to https://pypi.org .
I needed to make two minor corrections in setup.py and pyproject.toml for publishing it.
Therefore, the hash from the version that you tested should have changed.

@kloczek
Copy link
Author

kloczek commented Jul 2, 2023

I'm using as input source I'm not using pypi sdist but tar ball automatically generated from git tag/

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants