Closed patrickdepinguin closed 4 years ago
For case 1 I'm surprised it worked at all on PY2.
The normal behaviour I'd expect trying to access tmpl_context
outside of a request is that it would complain that there is no context.
The only object accessible outside of requests is tg.app_globals
, all the other global objects are per-request and usually require the practices described in https://turbogears.readthedocs.io/en/latest/turbogears/testing.html#testing-outside-controllers to work.
Case 2 instead is more interesting, I'm not sure why it's trying to access a request object as a decorator.
I'll have to checkout kallithea codebase locally and check what's going on.
For inspect.unwrap
this is being fixed in #118
For the case where Kallithea is explicitly calling hasattr
instead I think that the proper fix is to trap the TypeError
in Kallithea itself.
So closing this one
The Kallithea project is migrating from Python 2 to Python 3. The codebase itself is ready and works fine on Python 3. But we have two test related issues.
We can workaround it via the changes in
kallithea/lib/utils2.py
in this commit: https://kallithea-scm.org/repos/kallithea-incoming/changeset/490ef571d8dce7fb74f9c7c0bad980f0a47adaf8python -m doctest
directly, thus ruling out the pytest dependency.Here, it is Python itself that tries to read an attribute, and this gets caught by TG2 objectproxy. Also this worked fine in Python2.
Could you please help with this problem?
To reproduce, first pull the latest development code. Assuming you already have a clone of Kallithea (
https://kallithea-scm.org/repos/kallithea
):then proceed with the setup:
Note that at revision 3ddc91818b3c the workaround in kallithea/lib/utils2.py is already in place. If you want to reproduce issue 1, it should be reverted first:
For issue 2, you don't necessarily need to revert that workaround, and can just run:
Thanks in advance.