Bug 2274119 - python-glob2 fails to build with pytest 8: AttributeError: 'TestPatterns' object has no attribute 'basedir'
Summary: python-glob2 fails to build with pytest 8: AttributeError: 'TestPatterns' obj...
Keywords:
Status: CLOSED RAWHIDE
Alias: None
Product: Fedora
Classification: Fedora
Component: python-glob2
Version: rawhide
Hardware: Unspecified
OS: Unspecified
unspecified
unspecified
Target Milestone: ---
Assignee: Julien Enselme
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
Depends On:
Blocks: 2256331
TreeView+ depends on / blocked
 
Reported: 2024-04-09 08:25 UTC by Tomáš Hrnčiar
Modified: 2024-04-19 12:21 UTC (History)
4 users (show)

Fixed In Version:
Clone Of:
Environment:
Last Closed: 2024-04-19 12:21:44 UTC
Type: Bug
Embargoed:


Attachments (Terms of Use)

Description Tomáš Hrnčiar 2024-04-09 08:25:18 UTC
python-glob2 fails to build with pytest 8.


=================================== FAILURES ===================================
______________________________ TestPatterns.test _______________________________

self = <test.TestPatterns object at 0x7f092c8c6f90>

    def test(self):
>       self.makedirs('dir1', 'dir22')

test.py:75: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = <test.TestPatterns object at 0x7f092c8c6f90>, names = ('dir1', 'dir22')
name = 'dir1'

    def makedirs(self, *names):
        for name in names:
>           os.makedirs(path.join(self.basedir, name))
E           AttributeError: 'TestPatterns' object has no attribute 'basedir'. Did you mean: 'makedirs'?

test.py:65: AttributeError
_________________________ TestRecursive.test_recursive _________________________

self = <test.TestRecursive object at 0x7f092c8c6510>

    def test_recursive(self):
        # ** includes the current directory
>       assert sorted(glob2.glob('**/*.py', True)) == [
            ('a/bar.py', ('a', 'bar')),
            ('a/foo/hello.py', ('a/foo', 'hello')),
            ('b/bar.py', ('b', 'bar')),
            ('file.py', ('', 'file')),
        ]
E       AssertionError: assert [('build/lib/...ompat')), ...] == [('a/bar.py',...('', 'file'))]
E         
E         At index 0 diff: ('build/lib/glob2/__init__.py', ('build/lib/glob2', '__init__')) != ('a/bar.py', ('a', 'bar'))
E         Left contains 6 more items, first extra item: ('glob2/__init__.py', ('glob2', '__init__'))
E         Use -v to get more diff

test.py:92: AssertionError
__________________ TestRecursive.test_exclude_root_directory ___________________

self = <test.TestRecursive object at 0x7f092c8c66c0>

    def test_exclude_root_directory(self):
        # If files from the root directory should not be included,
        # this is the syntax to use:
>       assert sorted(glob2.glob('*/**/*.py', True)) == [
            ('a/bar.py', ('a', '', 'bar')),
            ('a/foo/hello.py', ('a', 'foo', 'hello')),
            ('b/bar.py', ('b', '', 'bar'))
        ]
E       AssertionError: assert [('build/lib/...ompat')), ...] == [('a/bar.py',..., '', 'bar'))]
E         
E         At index 0 diff: ('build/lib/glob2/__init__.py', ('build', 'lib/glob2', '__init__')) != ('a/bar.py', ('a', '', 'bar'))
E         Left contains 5 more items, first extra item: ('build/lib/glob2/impl.py', ('build', 'lib/glob2', 'impl'))
E         Use -v to get more diff

test.py:102: AssertionError
_____________________ TestRecursive.test_only_directories ______________________

self = <test.TestRecursive object at 0x7f092c8c6a50>

    def test_only_directories(self):
        # Return directories only
>       assert sorted(glob2.glob('**/', True)) == [
            ('a/', ('a',)),
            ('a/foo/', ('a/foo',)),
            ('b/', ('b',)),
        ]
E       AssertionError: assert [('build/', (..., ('glob2',))] == [('a/', ('a',...'b/', ('b',))]
E         
E         At index 0 diff: ('build/', ('build',)) != ('a/', ('a',))
E         Left contains 2 more items, first extra item: ('glob2.egg-info/', ('glob2.egg-info',))
E         Use -v to get more diff

test.py:110: AssertionError
________________________ TestRecursive.test_parent_dir _________________________

self = <test.TestRecursive object at 0x7f092c8c6ab0>

    def test_parent_dir(self):
        # Make sure ".." can be used
>       os.chdir(path.join(self.basedir, 'b'))
E       AttributeError: 'TestRecursive' object has no attribute 'basedir'. Did you mean: 'makedirs'?

test.py:118: AttributeError
______________________ TestRecursive.test_fixed_basename _______________________

self = <test.TestRecursive object at 0x7f092c8c7da0>

    def test_fixed_basename(self):
>       assert sorted(glob2.glob('**/bar.py', True)) == [
            ('a/bar.py', ('a',)),
            ('b/bar.py', ('b',)),
        ]
E       AssertionError: assert [] == [('a/bar.py',....py', ('b',))]
E         
E         Right contains 2 more items, first extra item: ('a/bar.py', ('a',))
E         Use -v to get more diff

test.py:125: AssertionError
_________________________ TestRecursive.test_all_files _________________________

self = <test.TestRecursive object at 0x7f092c8c6480>

    def test_all_files(self):
        # Return all files
>       os.chdir(path.join(self.basedir, 'a'))
E       AttributeError: 'TestRecursive' object has no attribute 'basedir'. Did you mean: 'makedirs'?

test.py:132: AttributeError
________________ TestRecursive.test_root_directory_not_returned ________________

self = <test.TestRecursive object at 0x7f092c8c63c0>

    def test_root_directory_not_returned(self):
        # Ensure that a certain codepath (when the basename is globbed
        # with ** as opposed to the dirname) does not cause
        # the root directory to be part of the result.
        # -> b/ is NOT in the result!
>       assert sorted(glob2.glob('b/**', True)) == [
            ('b/bar.py', ('bar.py',)),
            ('b/py', ('py',)),
        ]
E       AssertionError: assert [] == [('b/bar.py',...py', ('py',))]
E         
E         Right contains 2 more items, first extra item: ('b/bar.py', ('bar.py',))
E         Use -v to get more diff

test.py:145: AssertionError
=============================== warnings summary ===============================
glob2/fnmatch.py:141
  /builddir/build/BUILD/glob2-0.7/glob2/fnmatch.py:141: SyntaxWarning: invalid escape sequence '\Z'
    return '(?ms)' + res + '\Z'

-- Docs: https://docs.pytest.org/en/stable/how-to/capture-warnings.html
=========================== short test summary info ============================
FAILED test.py::TestPatterns::test - AttributeError: 'TestPatterns' object ha...
FAILED test.py::TestRecursive::test_recursive - AssertionError: assert [('bui...
FAILED test.py::TestRecursive::test_exclude_root_directory - AssertionError: ...
FAILED test.py::TestRecursive::test_only_directories - AssertionError: assert...
FAILED test.py::TestRecursive::test_parent_dir - AttributeError: 'TestRecursi...
FAILED test.py::TestRecursive::test_fixed_basename - AssertionError: assert [...
FAILED test.py::TestRecursive::test_all_files - AttributeError: 'TestRecursiv...
FAILED test.py::TestRecursive::test_root_directory_not_returned - AssertionEr...
==================== 8 failed, 5 passed, 1 warning in 0.05s ====================

https://docs.pytest.org/en/stable/changelog.html

For the build logs, see:
https://copr-be.cloud.fedoraproject.org/results/thrnciar/pytest/fedora-rawhide-x86_64/07248151-python-glob2/

For all our attempts to build python-glob2 with pytest 8, see:
https://copr.fedorainfracloud.org/coprs/thrnciar/pytest/package/python-glob2/

Let us know here if you have any questions.

Pytest 8 is planned to be included in Fedora 41. And this bugzilla is a
heads up before we merge new pytest into rawhide. For more info see a Fedora Change
proposal https://fedoraproject.org/wiki/Changes/Pytest_8

We'd appreciate help from the people who know this package best,
but if you don't want to work on this now, let us know so we can try to work around it on our side.

Comment 2 Lumír Balhar 2024-04-19 12:21:44 UTC
Merged into rawhide.


Note You need to log in before you can comment on or make changes to this bug.