Skip to content

3.10.0: Testing fails with some other Python module installed #99

@mtelka

Description

@mtelka

I'm packaging Paste for OpenIndiana and during the package creation I run tests. Testing started to fail miserably with version 3.10.0:

============================= test session starts ==============================
platform sunos5 -- Python 3.9.19, pytest-8.1.1, pluggy-1.5.0 -- /usr/bin/python3.9
cachedir: .pytest_cache
rootdir: $(BUILD_DIR)
configfile: setup.cfg
testpaths: tests
collecting ... collected 54 items / 29 errors

==================================== ERRORS ====================================
_____________ ERROR collecting tests/test_auth/test_auth_cookie.py _____________
ImportError while importing test module '$(BUILD_DIR)/tests/test_auth/test_auth_cookie.py'.
Hint: make sure your test modules/packages have valid Python names.
Traceback:
/usr/lib/python3.9/importlib/__init__.py:127: in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
tests/test_auth/test_auth_cookie.py:5: in <module>
    from paste.auth import cookie
E   ModuleNotFoundError: No module named 'paste.auth'
_____________ ERROR collecting tests/test_auth/test_auth_digest.py _____________
ImportError while importing test module '$(BUILD_DIR)/tests/test_auth/test_auth_digest.py'.
Hint: make sure your test modules/packages have valid Python names.
Traceback:
/usr/lib/python3.9/importlib/__init__.py:127: in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
tests/test_auth/test_auth_digest.py:5: in <module>
    from paste.auth.digest import digest_password, AuthDigestHandler
E   ModuleNotFoundError: No module named 'paste.auth'
______________ ERROR collecting tests/test_auth/test_auth_tkt.py _______________
ImportError while importing test module '$(BUILD_DIR)/tests/test_auth/test_auth_tkt.py'.
Hint: make sure your test modules/packages have valid Python names.
Traceback:
/usr/lib/python3.9/importlib/__init__.py:127: in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
tests/test_auth/test_auth_tkt.py:4: in <module>
    from paste.auth.auth_tkt import AuthTicket
E   ModuleNotFoundError: No module named 'paste.auth'
____________________ ERROR collecting tests/test_cgiapp.py _____________________
ImportError while importing test module '$(BUILD_DIR)/tests/test_cgiapp.py'.
Hint: make sure your test modules/packages have valid Python names.
Traceback:
/usr/lib/python3.9/importlib/__init__.py:127: in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
tests/test_cgiapp.py:6: in <module>
    from paste.cgiapp import CGIApplication, CGIError
E   ModuleNotFoundError: No module named 'paste.cgiapp'

...

It looks like the testing started to ignore the PYTHONPATH variable so it is unable to find the paste that it is supposed to test.

When I do this:

--- Paste-3.10.0/tests/__init__.py.orig
+++ Paste-3.10.0/tests/__init__.py
@@ -1 +1,3 @@
 """Tests for Paste"""
+
+import pkg_resources

Then testing behaves far better and almost all tests pass, except this one:

__________________________________ test_form ___________________________________

    def test_form():
        app = TestApp(CGIApplication({}, script='form.cgi', path=[data_dir]))
>       res = app.post('', params={'name': b'joe'},
                       upload_files=[('up', 'file.txt', b'x'*10000)])

tests/test_cgiapp.py:47:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
paste/fixture.py:264: in post
    return self._gen_request('POST', url, params=params, headers=headers,
paste/fixture.py:248: in _gen_request
    return self.do_request(req, status=status)
paste/wsgilib.py:350: in raw_interactive
    app_iter = application(basic_environ, start_response)
paste/lint.py:169: in lint_app
    iterator = application(environ, start_response_wrapper)
paste/cgiapp.py:105: in __call__
    proc_communicate(
paste/cgiapp.py:260: in proc_communicate
    stderr.write(ensure_text(data))
paste/lint.py:220: in write
    self.errors.write(s)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

self = <paste.wsgilib.ErrorRaiser object at 0x7ffface1a220>
value = 'Traceback (most recent call last):\n  File "$(BUILD_DIR)/test...<module>\n    from paste.util.field_storage import FieldStorage\nModuleNotFoundError: No module named \'paste.util\'\n'

    def write(self, value):
        if not value:
            return
>       raise AssertionError(
            "No errors should be written (got: %r)" % value)
E       AssertionError: No errors should be written (got: 'Traceback (most recent call last):\n  File "$(BUILD_DIR)/tests/cgiapp_data/form.cgi", line 12, in <module>\n    from paste.util.field_storage import FieldStorage\nModuleNotFoundError: No module named \'paste.util\'\n')

paste/wsgilib.py:381: AssertionError

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions