Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Python 3.3 support #156

Closed
davidmalcolm opened this issue Aug 3, 2012 · 3 comments
Closed

Python 3.3 support #156

davidmalcolm opened this issue Aug 3, 2012 · 3 comments
Assignees
Milestone

Comments

@davidmalcolm
Copy link

I'm attempting to run cement under python 3.3b1 (as part of https://fedoraproject.org/wiki/Features/Python_3.3 ).

The test suite fails in 4 places with a traceback due to attempting to call __import__ with level=-1

In python prior to 3.3. this means "The default is -1 which indicates both absolute and relative imports will be attempted." (c.f. http://docs.python.org/library/functions.html#__import__)

In python 3.3, 0 became the default, meaning to only perform absolute imports and "Changed in version 3.3: Negative values for level are no longer supported." (c.f. http://docs.python.org/dev/library/functions.html#__import__ )

======================================================================
ERROR: test_load_bogus_extension (tests.core.extension_tests.ExtensionTestCase)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/usr/lib/python3.3/site-packages/nose/tools.py", line 80, in newfunc
    func(*arg, **kw)
  File "/builddir/build/BUILD/python3-python-cement-1.9.14-2.fc18/tests/core/extension_tests.py", line 36, in test_load_bogus_extension
    ext.load_extensions(['bogus'])
  File "/builddir/build/BUILD/python3-python-cement-1.9.14-2.fc18/cement/core/extension.py", line 164, in load_extensions
    self.load_extension(ext)
  File "/builddir/build/BUILD/python3-python-cement-1.9.14-2.fc18/cement/core/extension.py", line 141, in load_extension
    __import__(ext_module, globals(), locals(), [], -1)
ValueError: level must be >= 0
======================================================================
ERROR: test_bootstrap (tests.core.foundation_tests.FoundationTestCase)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/builddir/build/BUILD/python3-python-cement-1.9.14-2.fc18/tests/core/foundation_tests.py", line 43, in test_bootstrap
    app.setup()
  File "/builddir/build/BUILD/python3-python-cement-1.9.14-2.fc18/cement/core/foundation.py", line 431, in setup
    __import__(self._meta.bootstrap, globals(), locals(), [], -1)
ValueError: level must be >= 0
======================================================================
ERROR: test_load_plugin_from_module (tests.core.plugin_tests.PluginTestCase)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/builddir/build/BUILD/python3-python-cement-1.9.14-2.fc18/tests/core/plugin_tests.py", line 210, in test_load_plugin_from_module
    app.setup()
  File "/builddir/build/BUILD/python3-python-cement-1.9.14-2.fc18/cement/core/foundation.py", line 448, in setup
    self._setup_plugin_handler()
  File "/builddir/build/BUILD/python3-python-cement-1.9.14-2.fc18/cement/core/foundation.py", line 706, in _setup_plugin_handler
    self.plugin.load_plugins(self.plugin.enabled_plugins)
  File "/builddir/build/BUILD/python3-python-cement-1.9.14-2.fc18/cement/ext/ext_plugin.py", line 189, in load_plugins
    self.load_plugin(plugin_name)
  File "/builddir/build/BUILD/python3-python-cement-1.9.14-2.fc18/cement/ext/ext_plugin.py", line 170, in load_plugin
    elif self._load_plugin_from_bootstrap(plugin_name, self.bootstrap):
  File "/builddir/build/BUILD/python3-python-cement-1.9.14-2.fc18/cement/ext/ext_plugin.py", line 140, in _load_plugin_from_bootstrap
    __import__(full_module, globals(), locals(), [], -1)
ValueError: level must be >= 0
======================================================================
ERROR: test_json (tests.ext.json_tests.JsonExtTestCase)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/builddir/build/BUILD/python3-python-cement-1.9.14-2.fc18/tests/ext/json_tests.py", line 17, in test_json
    self.app.setup()
  File "/builddir/build/BUILD/python3-python-cement-1.9.14-2.fc18/cement/core/foundation.py", line 443, in setup
    self._setup_extension_handler()
  File "/builddir/build/BUILD/python3-python-cement-1.9.14-2.fc18/cement/core/foundation.py", line 656, in _setup_extension_handler
    self.ext.load_extensions(self._meta.extensions)
  File "/builddir/build/BUILD/python3-python-cement-1.9.14-2.fc18/cement/core/extension.py", line 164, in load_extensions
    self.load_extension(ext)
  File "/builddir/build/BUILD/python3-python-cement-1.9.14-2.fc18/cement/core/extension.py", line 141, in load_extension
    __import__(ext_module, globals(), locals(), [], -1)
ValueError: level must be >= 0
@davidmalcolm
Copy link
Author

I took the liberty of applying this patch to the Fedora packages:
http://pkgs.fedoraproject.org/cgit/python-cement.git/plain/py33-fixes.patch
In local test builds this allows the test suite to succeed with python 3.3b1, also with 2.7 and 3.2

@ghost ghost assigned derks Aug 21, 2012
@derks
Copy link
Member

derks commented Aug 21, 2012

Thanks @davidmalcolm, I saw that in the Fedora commits. I think I got it all added here:

810b1d8
f2453f1

Though I don't have Py3.3 locally to test right now. That said, once I'm ready to tag 2.0.2 I'll obviously need to revert that patch in Fedora and should be good to go. Thank you for the feedback!

@derks
Copy link
Member

derks commented Sep 7, 2012

This should be good to go.

@derks derks closed this as completed Sep 7, 2012
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants