pew-org / pew

A tool to manage multiple virtual environments written in pure python
MIT License
1.17k stars 81 forks source link

Test failures with Python 3.12 #233

Open tjanez opened 1 year ago

tjanez commented 1 year ago

Fedora is rebuilding all Python packages for the upcoming Python 3.12 upgrade in Fedora 39.

Pew's test suite is run as part of the RPM build process and there are 3 new failures:

============================= test session starts ==============================
platform linux -- Python 3.12.0b3, pytest-7.3.2, pluggy-1.0.0 -- /usr/bin/python3
cachedir: .pytest_cache
rootdir: /builddir/build/BUILD/pew-1.2.0
configfile: pyproject.toml
collecting ... collected 64 items
tests/test_cp.py::test_new_env_activated FAILED                          [  1%]
tests/test_cp.py::test_virtualenv_variable PASSED                        [  3%]
tests/test_cp.py::test_source_does_not_exists PASSED                     [  4%]
tests/test_cp.py::test_no_global_site_packages PASSED                    [  6%]
tests/test_dir.py::test_dir PASSED                                       [  7%]
tests/test_getproject.py::test_getproject PASSED                         [  9%]
tests/test_getproject.py::test_project_directory_not_set PASSED          [ 10%]
tests/test_getproject.py::test_unknown_environment PASSED                [ 12%]
tests/test_getproject.py::test_call_without_args_outside_active_venv PASSED [ 14%]
tests/test_in.py::test_no_pew_in_home PASSED                             [ 15%]
tests/test_in.py::test_invalid_pew_workon_env_name PASSED                [ 17%]
tests/test_ls.py::test_ls PASSED                                         [ 18%]
tests/test_ls.py::test_get_site_packages_dir PASSED                      [ 20%]
tests/test_ls.py::test_lssitepackages FAILED                             [ 21%]
tests/test_ls.py::test_lssitepackages_add PASSED                         [ 23%]
tests/test_mktmpenv.py::test_mktmpenv PASSED                             [ 25%]
tests/test_mktmpenv.py::test_mktmpenv_extra_name PASSED                  [ 26%]
tests/test_mktmpenv.py::test_mktmpenv_ngsp PASSED                        [ 28%]
tests/test_mktmpenv.py::test_mktmpenv_autodeletes PASSED                 [ 29%]
tests/test_mkvirtualenv.py::test_create PASSED                           [ 31%]
tests/test_mkvirtualenv.py::test_create_in_symlink SKIPPED (temporar...) [ 32%]
tests/test_mkvirtualenv.py::test_no_args PASSED                          [ 34%]
tests/test_mkvirtualenv.py::test_gsp PASSED                              [ 35%]
tests/test_mkvirtualenv.py::test_associate PASSED                        [ 37%]
tests/test_mkvirtualenv.py::test_install_pkg SKIPPED (An internet co...) [ 39%]
tests/test_mkvirtualenv.py::test_install_2pkgs SKIPPED (An internet ...) [ 40%]
tests/test_mkvirtualenv.py::test_requirements_file SKIPPED (An inter...) [ 42%]
tests/test_pew.py::test_current_pew PASSED                               [ 43%]
tests/test_print_utils.py::test_get_rows PASSED                          [ 45%]
tests/test_print_utils.py::test_get_rows_even PASSED                     [ 46%]
tests/test_print_utils.py::test_get_best_columns_number_empty PASSED     [ 48%]
tests/test_print_utils.py::test_get_best_columns_number PASSED           [ 50%]
tests/test_print_utils.py::test_get_best_columns_number_2 PASSED         [ 51%]
tests/test_print_utils.py::test_get_best_columns_number_3 PASSED         [ 53%]
tests/test_print_utils.py::test_get_best_columns_number_4 PASSED         [ 54%]
tests/test_print_utils.py::test_print_columns PASSED                     [ 56%]
tests/test_print_utils.py::test_print_columns_2 PASSED                   [ 57%]
tests/test_print_utils.py::test_print_columns_3 PASSED                   [ 59%]
tests/test_project.py::test_create_directories PASSED                    [ 60%]
tests/test_project.py::test_create_virtualenv PASSED                     [ 62%]
tests/test_project.py::test_no_project_home PASSED                       [ 64%]
tests/test_project.py::test_project_exists PASSED                        [ 65%]
tests/test_project.py::test_same_workon_and_project_home PASSED          [ 67%]
tests/test_project.py::test_list_templates PASSED                        [ 68%]
tests/test_project.py::test_apply_template PASSED                        [ 70%]
tests/test_restore.py::test_restore FAILED                               [ 71%]
tests/test_rmvirtualenv.py::test_remove PASSED                           [ 73%]
tests/test_rmvirtualenv.py::test_no_such_env PASSED                      [ 75%]
tests/test_setproject.py::test_project_dont_exist PASSED                 [ 76%]
tests/test_setproject.py::test_implicit PASSED                           [ 78%]
tests/test_setproject.py::test_implicit_project PASSED                   [ 79%]
tests/test_setproject.py::test_setproject PASSED                         [ 81%]
tests/test_setproject.py::test_ignore_environ PASSED                     [ 82%]
tests/test_setproject.py::test_workon_when_project_is_relative PASSED    [ 84%]
tests/test_wipe.py::test_wipe SKIPPED (An internet connection is req...) [ 85%]
tests/test_workon.py::test_detect_shell PASSED                           [ 87%]
tests/test_workon.py::test_workon PASSED                                 [ 89%]
tests/test_workon.py::test_workon_no_arg PASSED                          [ 90%]
tests/test_workon.py::test_in PASSED                                     [ 92%]
tests/test_workon.py::test_no_symlink PASSED                             [ 93%]
tests/test_workon.py::test_no_pew_workon_home PASSED                     [ 95%]
tests/test_workon.py::test_invalid_pew_workon_env_name PASSED            [ 96%]
tests/test_workon.py::test_workon_project PASSED                         [ 98%]
tests/test_workon.py::test_workon_project_but_here PASSED                [100%]
=================================== FAILURES ===================================
____________________________ test_new_env_activated ____________________________
workon_home = PosixPath('/tmp/WORKON_HOME'), testpackageenv = None
    def test_new_env_activated(workon_home, testpackageenv):
        invoke('cp', 'source', 'destination', '-d')
        testscript = Path(invoke('in', 'destination', which_cmd, 'testscript.py').out.strip())
>       assert ('destination', 'testscript.py') == (testscript.parts[-3], testscript.parts[-1])
E       IndexError: tuple index out of range
tests/test_cp.py:28: IndexError
_____________________________ test_lssitepackages ______________________________
workon_home = PosixPath('/tmp/WORKON_HOME')
    def test_lssitepackages(workon_home):
        invoke('new', 'env', '-d')
        pkgs = invoke('in', 'env', 'pew', 'lssitepackages').out
>       assert re.search(r'setuptools-((\d+\.)+)dist-info', pkgs)
E       AssertionError: assert None
E        +  where None = <function search at 0x7f92ee89b060>('setuptools-((\\d+\\.)+)dist-info', '.github\n.gitignore\nLICENSE\nMANIFEST.in\nPipfile\nREADME.Fedora.md\nREADME.md\nSPECPARTS\nbuild\ndebian\ndebugfiles.list\ndebuglinks.list\ndebugsourcefiles.list\ndebugsources.list\ndefault.nix\nelfbins.list\npew\npew.egg-info\npyproject.toml\nrequirements.txt\nsetup.cfg\nsetup.py\ntests\ntox.ini')
E        +    where <function search at 0x7f92ee89b060> = re.search
tests/test_ls.py:21: AssertionError
_________________________________ test_restore _________________________________
workon_home = PosixPath('/tmp/WORKON_HOME'), env1 = None
    def test_restore(workon_home, env1):
        # Break the test virtualenv by deleting all setuptools-related files and
        # directories.
        setuptools_patterns = ['lib*/**/setuptools*', 'Lib/**/setuptools*']
        to_be_deleted = set(chain(*((workon_home / 'env1').glob(pat) for pat in setuptools_patterns)))
        for file_path in to_be_deleted:
            try:
                if os.path.isfile(file_path) or os.path.islink(file_path):
                    os.unlink(file_path)
                elif os.path.isdir(file_path):
                    shutil.rmtree(file_path)
            except FileNotFoundError:
                # NOTE: The to_be_deleted list can contain multiple links to the
                # same file so the file could already be deleted.
                pass
        # Importing setuptools in the broken test virtualenv should fail.
        result = invoke('in', 'env1', 'python', '-c', 'import setuptools')
        assert 'ModuleNotFoundError' in result.err
        # Re-create the test virtualenv.
        invoke('restore', 'env1')
        # Importing setuptools in the re-created test virtualenv should not fail.
        result = invoke('in', 'env1', 'python', '-c', 'import setuptools')
>       assert 'Error' not in result.err
E       assert 'Error' not in "Traceback (...'setuptools'"
E         'Error' is contained here:
E           Traceback (most recent call last):
E             File "<string>", line 1, in <module>
E           ModuleNotFoundError: No module named 'setuptools'
E         ?               +++++
tests/test_restore.py:30: AssertionError
=========================== short test summary info ============================
FAILED tests/test_cp.py::test_new_env_activated - IndexError: tuple index out...
FAILED tests/test_ls.py::test_lssitepackages - AssertionError: assert None
FAILED tests/test_restore.py::test_restore - assert 'Error' not in "Traceback...
=================== 3 failed, 56 passed, 5 skipped in 45.59s ===================

This is Fedora's build task in Koji.

Full RPM build log