pasteorg / paste

Python Paste (core) repository

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

3.10.0: Testing fails with some other Python module installed

mtelka opened this issue · comments

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

What command are you using to initiate the tests? I'm struggling to replicate this.

Based on the errors you're seeing, even after adding the pkg_resources thing you're either not changing directories to the build dir

Or something is wrong with your Makefile handling perhaps?

File "$(BUILD_DIR)/tests/cgiapp_data/form.cgi"

suggests that something is not getting expanded on your side of the processing: paste doesn't know what $(BUILD_DIR) is

I modified the output of test and replaced the actual path by $(BUILD_DIR). To replicate the failure I run pytest.

The full command to run tests is this:

/usr/bin/env -i PATH="/usr/gcc/13/bin:/usr/clang/18.1/bin:/usr/postgres/16/bin:/usr/mariadb/10.6/bin:/usr/openssl/3.1/bin:/usr/bin/amd64:/usr/bin:/usr/gnu/bin:/usr/sbin/amd64:/usr/sbin" CC="/usr/gcc/13/bin/gcc" CFLAGS="-m64 -O3 " CXX="/usr/gcc/13/bin/g++" CXXFLAGS="-m64 -O3 " LDFLAGS="-m64" PKG_CONFIG_PATH="/usr/openssl/3.1/lib/64/pkgconfig:/usr/mariadb/10.6/lib/amd64/pkgconfig:/usr/lib/amd64/pkgconfig:/usr/lib/pkgconfig" PYTHONPATH=/data/builds/ul-workspace/components/python/Paste/build/prototype/i386//usr/lib/python3.9/vendor-packages PATH=/data/builds/ul-workspace/components/python/Paste/build/prototype/i386//usr/bin:/usr/gcc/13/bin:/usr/clang/18.1/bin:/usr/postgres/16/bin:/usr/mariadb/10.6/bin:/usr/openssl/3.1/bin:/usr/bin/amd64:/usr/bin:/usr/gnu/bin:/usr/sbin/amd64:/usr/sbin \
        /usr/bin/python3.9 -m pytest \
        --verbose --color=no -p 'no:anyio' -p 'no:asyncio' -p 'no:benchmark' -p 'no:black' -p 'no:check' -p 'no:checkdocs' -p 'no:console-scripts' -p 'no:cov' -p 'no:custom_exit_code' -p 'no:enabler' -p 'no:env' -p 'no:faker' -p 'no:flake8' -p 'no:flaky' -p 'no:freezer' -p 'no:helpers_namespace' -p 'no:hypothesispytest' -p 'no:jaraco.test.http' -p 'no:kgb' -p 'no:metadata' -p 'no:mypy' -p 'no:perf' -p 'no:pytest home' -p 'no:pytest-datadir' -p 'no:pytest-mypy-plugins' -p 'no:pytest-teamcity' -p 'no:pytest_expect' -p 'no:pytest_fakefs' -p 'no:pytest_forked' -p 'no:pytest_httpserver' -p 'no:pytest_ignore_flaky' -p 'no:pytest_lazyfixture' -p 'no:pytest_mock' -p 'no:randomly' -p 'no:regressions' -p 'no:relaxed' -p 'no:reporter' -p 'no:rerunfailures' -p 'no:salt-factories' -p 'no:salt-factories-event-listener' -p 'no:salt-factories-factories' -p 'no:salt-factories-loader-mock' -p 'no:salt-factories-log-server' -p 'no:salt-factories-markers' -p 'no:salt-factories-sysinfo' -p 'no:salt-factories-sysstats' -p 'no:shell-utilities' -p 'no:skip-markers' -p 'no:socket' -p 'no:subprocess' -p 'no:subtests' -p 'no:system-statistics' -p 'no:time_machine' -p 'no:timeout' -p 'no:travis-fold' -p 'no:typeguard' -p 'no:xdist' -p 'no:xdist.looponfail' -p 'no:xprocess' -x --tb=line

And with the above command I get this result:

============================= 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: /data/builds/ul-workspace/components/python/Paste/build/amd64-3.9
configfile: setup.cfg
testpaths: tests
collecting ... collected 90 items / 1 error

==================================== ERRORS ====================================
___________________ ERROR collecting tests/test_multidict.py ___________________
ImportError while importing test module '/data/builds/ul-workspace/components/python/Paste/build/amd64-3.9/tests/test_multidict.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_multidict.py:9: in <module>
    from paste.util.field_storage import FieldStorage
E   ModuleNotFoundError: No module named 'paste.util.field_storage'
=========================== short test summary info ============================
ERROR tests/test_multidict.py
!!!!!!!!!!!!!!!!!!!!!!!!!! stopping after 1 failures !!!!!!!!!!!!!!!!!!!!!!!!!!!
=============================== 1 error in 0.34s ===============================

If I run a similar version of your command things work fine for me:

cdent4F9PG:~/src/paste(master) $ python3.10 -m pytest --verbose --color=no -p 'no:anyio' -p 'no:asyncio' -p 'no:benchmark' -p 'no:black' -p 'no:check' -p 'no:checkdocs' -p 'no:console-scripts' -p 'no:cov' -p 'no:custom_exit_code' -p 'no:enabler' -p 'no:env' -p 'no:faker' -p 'no:flake8' -p 'no:flaky' -p 'no:freezer' -p 'no:helpers_namespace' -p 'no:hypothesispytest' -p 'no:jaraco.test.http' -p 'no:kgb' -p 'no:metadata' -p 'no:mypy' -p 'no:perf' -p 'no:pytest home' -p 'no:pytest-datadir' -p 'no:pytest-mypy-plugins' -p 'no:pytest-teamcity' -p 'no:pytest_expect' -p 'no:pytest_fakefs' -p 'no:pytest_forked' -p 'no:pytest_httpserver' -p 'no:pytest_ignore_flaky' -p 'no:pytest_lazyfixture' -p 'no:pytest_mock' -p 'no:randomly' -p 'no:regressions' -p 'no:relaxed' -p 'no:reporter' -p 'no:rerunfailures' -p 'no:salt-factories' -p 'no:salt-factories-event-listener' -p 'no:salt-factories-factories' -p 'no:salt-factories-loader-mock' -p 'no:salt-factories-log-server' -p 'no:salt-factories-markers' -p 'no:salt-factories-sysinfo' -p 'no:salt-factories-sysstats' -p 'no:shell-utilities' -p 'no:skip-markers' -p 'no:socket' -p 'no:subprocess' -p 'no:subtests' -p 'no:system-statistics' -p 'no:time_machine' -p 'no:timeout' -p 'no:travis-fold' -p 'no:typeguard' -p 'no:xdist' -p 'no:xdist.looponfail' -p 'no:xprocess' -x --tb=line

leading to:

platform darwin -- Python 3.10.13, pytest-8.2.0, pluggy-1.5.0 -- /opt/homebrew/opt/python@3.10/bin/python3.10
cachedir: .pytest_cache
rootdir: /Users/cdent/src/paste
configfile: setup.cfg
testpaths: tests
collected 176 items

tests/test_auth/test_auth_cookie.py::test_noop PASSED                                                                                                                                                                                                                                                                                                                                 [  0%]
tests/test_auth/test_auth_cookie.py::test_basic PASSED                                                                                                                                                                                                                                                                                                                                [  1%]
tests/test_auth/test_auth_cookie.py::test_roundtrip PASSED                                                                                                                                                                                                                                                                                                                            [  1%]
tests/test_auth/test_auth_digest.py::test_digest PASSED                                                                                                                                                                                                                                                                                                                               [  2%]
tests/test_auth/test_auth_tkt.py::test_auth_ticket_digest_and_cookie_value PASSED                                                                                                                                                                                                                                                                                                     [  2%]
tests/test_auth/test_auth_tkt.py::test_auth_ticket_cookie PASSED
[...]

Is your tests dir a direct child of Paste/build/amd64-3.9?

If I downgrade to your version of pytest, things still work.

If I downgrade to python 3.9.19 they also work then.

Based on searching around you might have some luck by upgrading setuptools and/or importlib_metadata

I know you're probably thinking "but it used to work, now it doesn't!" and I sympathise but unless I'm able to replicate the problem I can't gain any more insight into what's going on.

Please report back here if you learn anything more.

The Paste/build/amd64-3.9 contains unpacked sdist, but PYTHONPATH points to different directory where the wheel (produced from sdist) is installed.

Anyway, I tried this directly in the unpacked sdist:

/usr/bin/env -i /usr/bin/python3.9 -m pytest         --verbose --color=no -p 'no:anyio' -p 'no:asyncio' -p 'no:benchmark' -p 'no:black' -p 'no:check' -p 'no:checkdocs' -p 'no:console-scripts' -p 'no:cov' -p 'no:custom_exit_code' -p 'no:enabler' -p 'no:env' -p 'no:faker' -p 'no:flake8' -p 'no:flaky' -p 'no:freezer' -p 'no:helpers_namespace' -p 'no:hypothesispytest' -p 'no:jaraco.test.http' -p 'no:kgb' -p 'no:metadata' -p 'no:mypy' -p 'no:perf' -p 'no:pytest home' -p 'no:pytest-datadir' -p 'no:pytest-mypy-plugins' -p 'no:pytest-teamcity' -p 'no:pytest_expect' -p 'no:pytest_fakefs' -p 'no:pytest_forked' -p 'no:pytest_httpserver' -p 'no:pytest_ignore_flaky' -p 'no:pytest_lazyfixture' -p 'no:pytest_mock' -p 'no:randomly' -p 'no:regressions' -p 'no:relaxed' -p 'no:reporter' -p 'no:rerunfailures' -p 'no:salt-factories' -p 'no:salt-factories-event-listener' -p 'no:salt-factories-factories' -p 'no:salt-factories-loader-mock' -p 'no:salt-factories-log-server' -p 'no:salt-factories-markers' -p 'no:salt-factories-sysinfo' -p 'no:salt-factories-sysstats' -p 'no:shell-utilities' -p 'no:skip-markers' -p 'no:socket' -p 'no:subprocess' -p 'no:subtests' -p 'no:system-statistics' -p 'no:time_machine' -p 'no:timeout' -p 'no:travis-fold' -p 'no:typeguard' -p 'no:xdist' -p 'no:xdist.looponfail' -p 'no:xprocess' -x --tb=line

and it still fails. Even without PYTHONPATH set. So apparently there is some interference with some other Python module(s) installed. And there are many on my testing host:

$ pip freeze
aiohttp==3.9.3
aiosignal==1.3.1
alabaster==0.7.16
aniso8601==9.0.1
annotated-types==0.6.0
ansi2html==1.9.1
ansible==8.7.0
ansible-core==2.15.10
anyio==4.2.0
appdirs==1.4.4
argcomplete==3.3.0
argh==0.31.2
argon2-cffi==23.1.0
argon2-cffi-bindings==21.2.0
asgiref==3.8.1
asn1crypto==1.5.1
assertpy==1.1
astor==0.8.1
astroid==3.1.0
asttokens==2.4.1
async-generator==1.10
async-timeout==4.0.3
atomicwrites==1.4.1
attrs==23.2.0
autocommand==2.2.2
Automat==22.10.0
autopage==0.5.2
autopep8==2.1.0
Babel==2.14.0
backcall==0.2.0
backports.entry-points-selectable==1.3.0
backports.tarfile==1.1.1
barman==3.10.0
bcrypt==4.1.2
beautifulsoup4==4.12.3
black==24.4.2
bleach==6.1.0
blessings==1.7
blinker==1.8.0
borgbackup==1.2.8
bottle==0.12.25
bracex==2.4
Brotli==1.1.0
brotlicffi==1.1.0.0
BTrees==5.2
build==1.2.1
CacheControl==0.14.0
cached-property==1.5.2
cachetools==5.3.3
calver==2022.6.26
ccsm==0.8.18
certifi==2024.2.2
cffi==1.16.0
cfgv==3.4.0
Chameleon==4.5.4
characteristic==14.3.0
chardet==5.2.0
charset-normalizer==3.3.2
check-manifest==0.49
cheroot==10.0.1
CherryPy==18.9.0
chevron==0.14.0
CJKwrap==2.2
cleo==2.1.0
click==8.1.7
click-help-colors==0.9.4
cliff==4.6.0
cloudpickle==3.0.0
cmarkgfm==2024.1.14
cmd2==2.4.3
codecov==2.1.13
codespell==2.2.6
colorama==0.4.6
colorlog==6.8.2
configobj==5.0.8
ConfigUpdater==3.2
constantly==23.10.4
contextlib2==21.6.0
contextvars==2.4
covdefaults==2.3.0
coverage==7.4.0
coverage-enable-subprocess==1.0
coveralls==3.3.1
crashtest==0.4.1
crmsh==4.5.0
cryptography==42.0.5
cryptography_vectors==42.0.5
cssselect==1.2.0
cupshelpers==1.0
curio==1.6
Cython==3.0.10
cython-test-exception-raiser==1.0.2
dbus-python==1.3.2
ddt==1.7.2
decorator==5.1.1
defusedxml==0.7.1
detect-test-pollution==1.2.0
diff_cover==9.0.0
dill==0.3.8
dirty-equals==0.7.1.post0
distlib==0.3.8
distro==1.9.0
dnspython==2.6.1
docopt==0.6.2
docutils==0.21.2
dogpile.cache==1.3.2
domdf_python_tools==3.8.0.post2
dulwich==0.22.1
dunamai==1.20.0
editables==0.5
elastic-transport==8.13.0
elasticsearch==8.13.0
elementpath==4.4.0
email_validator==2.1.1
ephemeral-port-reserve==1.1.4
eval_type_backport==0.2.0
exceptiongroup==1.2.1
execnet==1.9.0
executing==2.0.1
expandvars==0.12.0
extras==1.0.0
factory-boy==3.3.0
fail2ban==1.0.2
Faker==24.14.0
fastjsonschema==2.19.1
fields==5.0.0
filelock==3.13.4
findpython==0.6.1
fixtures==4.1.0
flake8==7.0.0
flake8-2020==1.8.1
flake8-bugbear==24.4.26
flake8-docstrings==1.7.0
flake8-noqa==1.4.0
flake8-typing-imports==1.15.0
flaky==3.8.1
flamegraph==0.1
Flask==3.0.3
flex==6.14.1
flit_core==3.9.0
flit_scm==1.7.0
flufl.flake8==0.10
freezegun==1.5.0
frozendict==2.4.2
frozenlist==1.4.1
fs==2.4.16
func-timeout==4.3.5
future==1.0.0
gevent==22.10.2
ghp-import==2.1.0
gi-docgen==2023.3
gitdb==4.0.11
GitPython==3.1.43
gprof2dot==2022.7.29
graphviz==0.20.3
greenlet==3.0.3
gunicorn==22.0.0
h11==0.14.0
h2==4.1.0
hatch-fancy-pypi-readme==24.1.0
hatch-nodejs-version==0.3.2
hatch-vcs==0.4.0
hatchling==1.24.2
hpack==4.0.0
http-parser==0.9.0
httpcore==1.0.5
httplib2==0.22.0
httpx==0.27.0
humanize==4.9.0
hupper==1.12.1
hyperframe==6.0.1
hyperlink==21.0.0
hypothesis==6.100.2
icecream==2.1.3
identify==2.5.36
idna==3.7
imagesize==1.4.1
immutables==0.20
importlib_metadata==7.1.0
importlib_resources==6.4.0
incremental==22.10.0
inflect==7.2.1
ini2toml==0.14
iniconfig==2.0.0
installer==0.7.0
invocations==3.3.0
invoke==2.2.0
iocapture==0.1.2
ipdb==0.13.13
ipython==8.18.1
iso8601==2.1.0
isort==5.13.2
itsdangerous==2.2.0
jaraco.classes==3.4.0
jaraco.collections==5.0.1
jaraco.context==5.3.0
jaraco.develop==8.13.0
jaraco.env==1.0.0
jaraco.envs==2.6.0
jaraco.functools==4.0.1
jaraco.itertools==6.4.1
jaraco.packaging==10.1.0
jaraco.path==3.7.0
jaraco.test==5.4.0
jaraco.text==3.12.0
jaraco.ui==2.3.0
jaraco.vcs==2.2.0
jaraco.versioning==1.1.0
jedi==0.19.1
Jinja2==3.1.3
jmespath==1.0.1
jsonpointer==2.4
jsonrpclib-pelix==0.4.3.2
jsonschema==4.21.1
jsonschema-specifications==2023.12.1
jupyter_core==5.7.2
keyring==25.2.0
keyrings.alt==5.0.1
kgb==7.1.1
lazy==1.6
lazy-object-proxy==1.10.0
libcst==1.3.1
lingua==4.15.0
linkify-it-py==2.0.3
littleutils==0.2.2
looseversion==1.3.0
louis==3.29.0
lxml==5.2.1
lxml-stubs==0.5.1
lxml_html_clean==0.1.1
maison==1.4.3
Mako==1.3.3
manuel==1.12.4
Markdown==3.6
markdown-it-py==3.0.0
markdown2==2.4.13
MarkupSafe==2.1.5
marshmallow==3.21.1
matplotlib-inline==0.1.7
maturin==1.5.1
mccabe==0.7.0
mdurl==0.1.2
mercurial==5.9.3
mergedeep==1.3.4
meson==1.4.0
mistune==3.0.2
mkdocs==1.6.0
mkdocs-bootstrap==1.1.1
mkdocs-bootswatch==1.1
mkdocs-get-deps==0.2.0
mock==5.1.0
more-itertools==10.2.0
msgpack==1.0.8
multidict==6.0.5
mutagen==1.47.0
mypy==1.10.0
mypy-extensions==1.0.0
mysqlclient==2.2.4
natsort==8.4.0
nbformat==5.10.4
netsnmp-python==1.0a1
nh3==0.2.17
nodeenv==1.7.0
nose==1.3.7
notify2==0.3.1
nox==2024.4.15
numpy==1.26.4
objgraph==3.6.1
olefile==0.47
outcome==1.3.0.post0
packaging==24.0
parameterized==0.8.1
paramiko==3.4.0
parso==0.8.4
passlib==1.7.4
Paste==3.9.0
PasteDeploy==3.1.0
path==16.14.0
path.py==12.5.0
pathlib2==2.3.7.post1
pathspec==0.12.1
pbr==6.0.0
pcs==0.10.1
pdm-backend==2.2.1
pep440==0.1.2
persistent==5.2
pexpect==4.9.0
pickleshare==0.7.5
pillow==10.3.0
pip-run==12.6.1
pipdeptree==2.18.1
pipenv==2023.12.1
pkg==0.1
pkgconfig==1.5.5
pkginfo==1.10.0
pkgutil_resolve_name==1.3.10
plaster==1.1.2
plaster-pastedeploy==1.0.1
platformdirs==4.2.1
pluggy==1.5.0
ply==3.11
poetry-core==1.9.0
poetry-dynamic-versioning==1.2.0
polib==1.2.0
portend==3.2.0
powerline-status==2.8.3
pre_commit==3.7.0
pretend==1.0.9
prettytable==3.10.0
process-tests==3.0.0
prompt-toolkit==3.0.43
psutil==5.9.8
psycopg2==2.9.9
ptyprocess==0.7.0
pure-eval==0.2.2
py==1.11.0
py-cpuinfo==9.0.0
py3c==1.4
pyasn1==0.6.0
pyasn1_modules==0.4.0
pybind11==2.12.0
pybonjour==1.1.1
pycairo==1.26.0
pycmd==1.2
pycodestyle==2.11.1
PyContracts==2.0.1
pycparser==2.22
pycryptodome==3.20.0
pycryptodome-test-vectors==1.0.14
pycryptodomex==3.20.0
pycups==2.0.4
pycurl==7.45.3
pydantic==1.10.14
pydantic_core==2.18.2
pydiff==0.2
pydiffx==1.1
pydocstyle==6.3.0
pyfakefs==5.4.1
pyflakes==3.2.0
pyftpdlib==1.5.9
Pygments==2.17.2
PyGObject==3.46.0
PyHamcrest==2.1.0
PyJWT==2.8.0
pylint==3.0.3
pymongo==4.7.0
PyNaCl==1.5.0
PyNUTClient==2.8.2
pyOpenSSL==24.1.0
pyparsing==3.1.2
pyperclip==1.8.2
pyproject-api==1.6.1
pyproject-fmt==1.8.0
pyproject-installer==0.5.3
pyproject-metadata==0.8.0
pyproject_hooks==1.0.0
PyQt-builder==1.16.2
PyQt5==5.15.10
PyQt5-sip==12.13.0
pyramid==2.0.1
pyroma==4.2
pyrsistent==0.20.0
PySocks==1.7.1
pytest==8.1.1
pytest-asyncio==0.23.6
pytest-benchmark==4.0.0
pytest-black==0.3.12
pytest-check==2.3.1
pytest-checkdocs==2.12.0
pytest-console-scripts==1.4.1
pytest-cov==5.0.0
pytest-custom-exit-code==0.3.0
pytest-datadir==1.5.0
pytest-enabler==3.1.1
pytest-env==1.1.3
pytest-expect==1.1.0
pytest-fixture-config==1.7.0
pytest-flake8==1.1.1
pytest-forked==1.6.0
pytest-helpers-namespace==2021.12.29
pytest-home==0.5.1
pytest-ignore-flaky==2.2.1
pytest-lazy-fixtures==1.0.7
pytest-metadata==3.1.1
pytest-mock==3.14.0
pytest-mypy==0.10.3
pytest-mypy-plugins==3.1.2
pytest-perf==0.14.0
pytest-randomly==3.15.0
pytest-regressions==2.5.0
pytest-relaxed==2.0.2
pytest-reporter==0.5.3
pytest-rerunfailures==14.0
pytest-salt-factories==1.0.1
pytest-shell-utilities==1.9.0
pytest-skip-markers==1.5.1
pytest-socket==0.7.0
pytest-subprocess==1.5.0
pytest-subtests==0.12.1
pytest-system-statistics==1.0.2
pytest-timeout==2.3.1
pytest-travis-fold==1.3.0
pytest-xdist==3.5.0
pytest-xprocess==0.23.0
pytest_freezer==0.4.8
pytest_httpserver==1.0.10
python-dateutil==2.9.0.post0
python-dotenv==1.0.1
python-magic==0.4.27
python-rapidjson==1.16
python-subunit==1.4.4
python-xlib==0.33
pytidylib==0.3.2
pytoml==0.1.21
pytoolconfig==1.3.1
pytz==2024.1
pyxdg==0.28
PyYAML==6.0.1
pyyaml_env_tag==0.1
pyzmq==25.1.2
qualname==0.1.0
railroad-diagrams==3.0.1
rapidfuzz==3.8.1
RBTools==4.1
rdiff-backup==2.2.6
re-assert==1.1.0
readme_renderer==43.0
readthedocs-sphinx-ext==2.2.5
redis==5.0.4
referencing==0.35.0
regex==2024.4.16
releases==2.1.1
repoze.lru==0.7
repoze.sphinx.autointerface==1.0.0
requests==2.31.0
requests-file==2.0.0
requests-toolbelt==1.0.0
requests-wsgi-adapter==0.4.1
resolvelib==1.0.1
rfc3986==2.0.0
rfc3987==1.3.8
rich==13.7.1
Routes==2.5.1
rpds-py==0.18.0
rrdtool==0.1.10
ruamel.yaml==0.18.6
ruamel.yaml.clib==0.2.8
ruyaml==0.91.0
salt==3007.0
schema==0.7.5
scikit-build==0.17.6
SCons==4.7.0
scour==0.38.2
scripttest==1.3
seedir==0.4.2
semantic-version==2.10.0
serpent==1.41
service-identity==24.1.0
setuptools-declarative-requirements==1.3.0
setuptools-rust==1.9.0
setuptools-scm==8.0.4
sh==1.14.3
shellingham==1.5.4
simplegeneric==0.8.1
simplejson==3.19.2
singledispatch==4.1.0
sip==6.8.3
six==1.16.0
smartypants==2.0.1
smmap==5.0.1
sniffio==1.3.1
snowballstemmer==2.2.0
socksio==1.0.0
sortedcontainers==2.4.0
soupsieve==2.5
spec==1.4.1
Sphinx==7.3.7
sphinx-autodoc-typehints==2.1.0
sphinx-issues==4.1.0
sphinx-rtd-theme==2.0.0
sphinxcontrib-applehelp==1.0.8
sphinxcontrib-devhelp==1.0.6
sphinxcontrib-htmlhelp==2.0.5
sphinxcontrib-jquery==4.1
sphinxcontrib-jsmath==1.0.1
sphinxcontrib-qthelp==1.0.7
sphinxcontrib-serializinghtml==1.1.10
sphobjinv==2.3.1
sqlparse==0.5.0
stack-data==0.6.3
stdio-mgr==1.0.1
stestr==4.1.0
stevedore==5.2.0
strict-rfc3339==0.7
strictyaml==1.7.3
subprocess-tee==0.4.1
sure==2.0.1
sybil==6.1.0
tabulate==0.9.0
teamcity-messages==1.32
tempora==5.5.1
termcolor==2.4.0
terminator==2.1.1
termstyle==0.1.11
testfixtures==8.1.0
testpath==0.6.0
testresources==2.0.1
testscenarios==0.5.0
testtools==2.7.1
texttable==1.7.0
time-machine==2.14.1
tokenize-rt==5.2.0
toml==0.10.2
tomli==2.0.1
tomli_w==1.0.0
tomlkit==0.12.4
tornado==6.4
tox==4.14.2
tox-current-env==0.0.11
tqdm==4.66.2
traitlets==5.14.3
transaction==4.0
translationstring==1.4
trove-classifiers==2024.4.10
trustme==1.1.0
twine==5.0.0
Twisted==24.3.0
typeguard==4.2.1
types-decorator==5.1.8.20240310
types-docutils==0.21.0.20240423
types-mock==5.1.0.20240425
types-paramiko==3.4.0.20240423
types-psutil==5.9.5.20240423
types-python-dateutil==2.9.0.20240316
types-pytz==2024.1.0.20240417
types-PyYAML==6.0.12.20240311
types-requests==2.31.0.20240406
types-setuptools==69.5.0.20240423
types-six==1.16.21.20240425
types-toml==0.10.8.20240310
typing-inspect==0.9.0
typing_extensions==4.11.0
typogrify==2.0.7
tzdata==2024.1
u-msgpack-python==2.8.0
uc-micro-py==1.0.3
ukkonen==1.0.1
UkPostcodeParser==1.1.2
unearth==0.15.2
Unidecode==1.3.8
urllib3==2.1.0
uvicorn==0.29.0
validate-email==1.3
validate-pyproject==0.16
validators==0.28.1
venusian==3.1.0
versioneer==0.29
virtualenv==20.26.0
voluptuous==0.14.2
waitress==3.0.0
watchdog==4.0.0
wcag-contrast-ratio==0.9
wcmatch==8.5.1
wcwidth==0.2.13
webencodings==0.5.1
WebOb==1.8.7
websockets==12.0
WebTest==3.0.0
Werkzeug==3.0.2
wrapt==1.16.0
WSGIProxy2==0.5.1
xmlschema==3.3.0
xmltodict==0.13.0
yamlfix==1.16.0
yamllint==1.35.1
yarl==1.9.4
youtube-dl==2021.12.17
yt-dlp==2024.3.10
zc.lockfile==3.0.post1
ZConfig==4.0
zest.releaser==9.1.3
zipp==3.18.1
ZODB==6.0
zodbpickle==3.3
zope.component==6.0
zope.configuration==5.0.1
zope.copy==4.3
zope.deprecation==5.0
zope.event==5.0
zope.exceptions==5.0.1
zope.hookable==6.0
zope.i18nmessageid==6.1.0
zope.interface==6.3
zope.location==5.0
zope.proxy==5.2
zope.schema==7.0.1
zope.security==6.2
zope.testing==5.0.1
zope.testrunner==6.4
zstandard==0.22.0
zstd==1.5.5.1
$

Now we just need to find what one is causing the issue. I tried to uninstall/disable all pytest plugins and now the minimal reproducible steps are:

$ wget https://files.pythonhosted.org/packages/source/P/Paste/Paste-3.10.0.tar.gz
$ tar xf Paste-3.10.0.tar.gz
$ cd Paste-3.10.0
$ /usr/bin/env -i /usr/bin/pytest
============================================================================================================================= test session starts =============================================================================================================================
platform sunos5 -- Python 3.9.19, pytest-8.1.1, pluggy-1.5.0
rootdir: /tmp/Paste-3.10.0
configfile: setup.cfg
testpaths: tests
collected 143 items / 5 errors                                                                                                                                                                                                                                                

=================================================================================================================================== ERRORS ====================================================================================================================================
__________________________________________________________________________________________________________________ ERROR collecting tests/test_multidict.py ___________________________________________________________________________________________________________________
ImportError while importing test module '/tmp/Paste-3.10.0/tests/test_multidict.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_multidict.py:9: in <module>
    from paste.util.field_storage import FieldStorage
E   ModuleNotFoundError: No module named 'paste.util.field_storage'
___________________________________________________________________________________________________________________ ERROR collecting tests/test_session.py ____________________________________________________________________________________________________________________
ImportError while importing test module '/tmp/Paste-3.10.0/tests/test_session.py'.
Hint: make sure your test modules/packages have valid Python names.
Traceback:
/usr/lib/python3.9/importlib/__init__.py:127: in import_module

... [snip] ...

And yes, it is exactly: "it used to work and now it does not". :-)

If I try to run tests for 3.9.0 then everything works, but with 3.10.0 it fails. Please note that otherwise the testing machine is unchanged:

$ wget https://files.pythonhosted.org/packages/source/P/Paste/Paste-3.9.0.tar.gz
$ tar xf Paste-3.9.0.tar.gz
$ cd Paste-3.9.0
$ /usr/bin/env -i /usr/bin/pytest
============================================================================================================================= test session starts =============================================================================================================================
platform sunos5 -- Python 3.9.19, pytest-8.1.1, pluggy-1.5.0
rootdir: /tmp/Paste-3.9.0
configfile: setup.cfg
testpaths: tests
collected 151 items                                                                                                                                                                                                                                                           

tests/test_auth/test_auth_cookie.py ...                                                                                                                                                                                                                                 [  1%]
tests/test_auth/test_auth_digest.py .                                                                                                                                                                                                                                   [  2%]

... [snip] ...

I would guess that it is conflicting with one or both of:

Paste==3.9.0
PasteDeploy==3.1.0

try pip uninstall on each of those, one at a time, and see if that changes the situation.

In general, however, you really want to be doing package builds in a virtualenv so your environment is not infected by installed packages.

If I install Paste==3.9.0 into my environment, I can replicate your failure.

Can you try the following in your environment and let me know where that gets you?

diff --git a/tests/__init__.py b/tests/__init__.py
index cafcf8a..f07735e 100644
--- a/tests/__init__.py
+++ b/tests/__init__.py
@@ -1 +1,8 @@
 """Tests for Paste"""
+import sys
+import os
+
+sys.path.insert(0, os.path.dirname(os.path.dirname(__file__)))
+
+import pkg_resources
+pkg_resources.require('Paste')

If that fixes it, or fixes it except for a failure with tests/test_cgiapp.py

Then I've got a pretty good idea on how to clean things up to get stuff back to a state where it works for you.

Is bedtime for me, so I won't be responding for a few hours.

We've got two ways to go here:

  1. We fix the Paste code so it does some tricks to manage finding the right namespace package when a different version of Paste is already installed.
  2. You fix the openindiana packaging code so that python libraries are built in a hermetic environment

Both may be good ideas.

Let me know what you discover with the patch, and what you think about the rest of it.

I would guess that it is conflicting with one or both of:

Paste==3.9.0
PasteDeploy==3.1.0

try pip uninstall on each of those, one at a time, and see if that changes the situation.

I found that I need to uninstall both Paste and PasteDeploy to see tests to pass. Thank you for the hint!

In general, however, you really want to be doing package builds in a virtualenv so your environment is not infected by installed packages.

Testing in virtual env while packaging makes no sense for us since the package will be running in the real environment once installed, not in a virtualized one and so we need to make sure it runs properly while installed so we need to test in real environment. Testing in a virtual environment won't find interoperability issues (like this one :-)).

If I install Paste==3.9.0 into my environment, I can replicate your failure.

Can you try the following in your environment and let me know where that gets you?

diff --git a/tests/__init__.py b/tests/__init__.py
index cafcf8a..f07735e 100644
--- a/tests/__init__.py
+++ b/tests/__init__.py
@@ -1 +1,8 @@
 """Tests for Paste"""
+import sys
+import os
+
+sys.path.insert(0, os.path.dirname(os.path.dirname(__file__)))
+
+import pkg_resources
+pkg_resources.require('Paste')

As I wrote in #99 (comment) the import pkg_resources line alone is enough to fix the problem (except test_cgiapp.py). The addition of other lines in your diff fixes test_cgiapp.py too.

If that fixes it, or fixes it except for a failure with tests/test_cgiapp.py

Then I've got a pretty good idea on how to clean things up to get stuff back to a state where it works for you.

Is bedtime for me, so I won't be responding for a few hours.

We've got two ways to go here:

1. We fix the Paste code so it does some tricks to manage finding the right namespace package when a different version of Paste is already installed.

The problem is also there when no other Paste version is installed, but PasteDeploy is installed. So it looks like the interoperability with PasteDeploy does not work well.

Anyway, why are Paste tests affected by the different Paste version/installation elsewhere in the system? This sounds like some flaw in either Paste itself or its tests. Disclaimer: I know nothing about Paste internals and about its tests, so please take this my opinion with grain of salt.

2. You fix the openindiana packaging code so that python libraries are built in a hermetic environment

As I wrote above we test in real environment intentionally, so I'm very sorry this is not the way to go. What I can do here is that I can make sure there are no offending packages installed while testing Paste (in this case it would be different Paste version and PasteDeploy). But I'd go that way only if you won't be able (or refuse to :-)) fix testing of Paste on your side.

Both may be good ideas.

Let me know what you discover with the patch, and what you think about the rest of it.

Oh, I don't refuse, we just needed to get all the details to figure out the right way to fix it.

I've got enough info now to fix it, I think. Thanks for persevering. Will have a 3.10.1 within the next 24 hours or so.

Regarding this:

Anyway, why are Paste tests affected by the different Paste version/installation elsewhere in the system? This sounds like some flaw in either Paste itself or its tests.

It's because Paste is a "namespace package" and uses a deprecated way of managing that. A recent cleanup via a series of patches to try to clean up code made a variety of changes to how namespace packages are handled. The existing tests continued to work so it was assumed that everything still works.

I'll add a test that creates an environment with the previous release of Paste (and maybe PasteDeploy) installed and that should show the way to a solution here and also keep any future releases guarded.

And regarding this:

Disclaimer: I know nothing about Paste internals and about its tests, so please take this my opinion with grain of salt.

Me neither! See #91

Oh, I don't refuse, we just needed to get all the details to figure out the right way to fix it.

Glad to see that ;-).

I've got enough info now to fix it, I think. Thanks for persevering. Will have a 3.10.1 within the next 24 hours or so.

Just FYI, if the fix is going to be just in tests (and not in the core Paste) then I do not need a new Paste release with this testing issue fixed only (but if there is one, I won't complain :-)).

Thank you.

If you could have a look at #100 and let me know if it is happy in your environment that would be great.

It is a test only fix but I will likely release it just for cleanliness.

I tested 3.10.0 + c34a10d + 129a76e and now all tests pass. Thank you.