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

zope.configuration failure to find dependency #912

Open
berdario opened this issue Jan 5, 2017 · 20 comments
Open

zope.configuration failure to find dependency #912

berdario opened this issue Jan 5, 2017 · 20 comments
Labels
Needs Triage Issues that need to be evaluated for severity and status.

Comments

@berdario
Copy link

berdario commented Jan 5, 2017

While trying to upgrade zope.configuration for Nixos, I found this problem, which sounds similar to:

#870

I tried already with Setuptools 32.3.1, but the result is the same. This is not Nix specific, but happens also in a normal Python3.6 virtualenv

======================================================================
ERROR: test_wo_parents (zope.configuration.tests.test_docutils.Test_makeDocStructures)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/tmp/zope.configuration/src/zope/configuration/tests/test_docutils.py", line 61, in test_wo_parents
    from zope.interface import Interface
ModuleNotFoundError: No module named 'zope.interface'

----------------------------------------------------------------------
Ran 252 tests in 0.195s

FAILED (errors=229)
Test failed: <unittest.runner.TextTestResult run=252 errors=229 failures=0>
error: Test failed: <unittest.runner.TextTestResult run=252 errors=229 failures=0>
@jaraco
Copy link
Member

jaraco commented Jan 5, 2017

Thanks for the report and the reference to a previous issue. It's possible it's related to #900.

I think I'm going to need more to go on, though. When I try to replicate your issue by installing the packages and using PYTHONPATH, they work fine:

$ python -m pip install -t env zope.configuration
Collecting zope.configuration
  Downloading zope.configuration-4.0.3.tar.gz (487kB)
    100% |████████████████████████████████| 491kB 1.8MB/s 
Collecting zope.i18nmessageid (from zope.configuration)
  Downloading zope.i18nmessageid-4.0.3.tar.gz (409kB)
    100% |████████████████████████████████| 419kB 2.4MB/s 
Collecting zope.interface (from zope.configuration)
  Using cached zope.interface-4.3.3.tar.gz
Collecting zope.schema (from zope.configuration)
  Downloading zope.schema-4.4.2.tar.gz (252kB)
    100% |████████████████████████████████| 256kB 3.3MB/s 
Collecting setuptools (from zope.configuration)
  Using cached setuptools-32.3.1-py2.py3-none-any.whl
Collecting zope.event (from zope.schema->zope.configuration)
  Using cached zope.event-4.2.0.tar.gz
Installing collected packages: setuptools, zope.i18nmessageid, zope.interface, zope.event, zope.schema, zope.configuration
  Running setup.py install for zope.i18nmessageid ... done
  Running setup.py install for zope.interface ... done
  Running setup.py install for zope.event ... done
  Running setup.py install for zope.schema ... done
  Running setup.py install for zope.configuration ... done
Successfully installed setuptools-32.3.1 zope.configuration-4.0.3 zope.event-4.2.0 zope.i18nmessageid-4.0.3 zope.interface-4.3.3 zope.schema-4.4.2
$ PYTHONPATH=env python -c "import zope.configuration.tests.test_docutils"
$ python -V
Python 3.6.0
$ python -m easy_install --version
psetuptools 32.3.1 from /Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages (Python 3.6)
$ python -m pip -V
pip 9.0.1 from /Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages (python 3.6)

Same with virtualenv:

$ virtualenv env
Using base prefix '/Library/Frameworks/Python.framework/Versions/3.6'
New python executable in /Users/jaraco/Dropbox/code/main/setuptools/issues/912/env/bin/python3
Also creating executable in /Users/jaraco/Dropbox/code/main/setuptools/issues/912/env/bin/python
Installing setuptools, pip, wheel...done.
$ env/bin/python -m pip install zope.configuration
Collecting zope.configuration
  Using cached zope.configuration-4.0.3.tar.gz
Collecting zope.i18nmessageid (from zope.configuration)
  Using cached zope.i18nmessageid-4.0.3.tar.gz
Collecting zope.interface (from zope.configuration)
  Using cached zope.interface-4.3.3.tar.gz
Collecting zope.schema (from zope.configuration)
  Using cached zope.schema-4.4.2.tar.gz
Requirement already satisfied: setuptools in ./env/lib/python3.6/site-packages (from zope.configuration)
Collecting zope.event (from zope.schema->zope.configuration)
  Using cached zope.event-4.2.0.tar.gz
Building wheels for collected packages: zope.configuration, zope.i18nmessageid, zope.interface, zope.schema, zope.event
  Running setup.py bdist_wheel for zope.configuration ... done
  Stored in directory: /Users/jaraco/Library/Caches/pip/wheels/aa/86/30/8de165c32e1cbe4ed7c68c6e8359cd078b637ad1b120a506e3
  Running setup.py bdist_wheel for zope.i18nmessageid ... done
  Stored in directory: /Users/jaraco/Library/Caches/pip/wheels/64/69/34/63b188c365786e66281411acf1269fa476feefb84a69a5481f
  Running setup.py bdist_wheel for zope.interface ... done
  Stored in directory: /Users/jaraco/Library/Caches/pip/wheels/00/aa/8b/f1d1eb398423e59894b45ee151344e243808156c2d182c9f4e
  Running setup.py bdist_wheel for zope.schema ... done
  Stored in directory: /Users/jaraco/Library/Caches/pip/wheels/cb/d2/69/63b1820e46ace3f1ef25eeee696ddf1230e3aeee9d64f00507
  Running setup.py bdist_wheel for zope.event ... done
  Stored in directory: /Users/jaraco/Library/Caches/pip/wheels/cf/ed/fd/4c2faa3443eae658d56776fa75f883726e6ae6874c9304140d
Successfully built zope.configuration zope.i18nmessageid zope.interface zope.schema zope.event
Installing collected packages: zope.i18nmessageid, zope.interface, zope.event, zope.schema, zope.configuration
Successfully installed zope.configuration-4.0.3 zope.event-4.2.0 zope.i18nmessageid-4.0.3 zope.interface-4.3.3 zope.schema-4.4.2
$ env/bin/python -c "import zope.configuration.tests.test_docutils"
$

So there's some other factor involved that's triggering your error. Can you help track the issue by describing the steps you have to take to encounter it, and preferably distill those steps to their most essential?

@berdario
Copy link
Author

berdario commented Jan 5, 2017

I simply ran python setup.py test in a brand new virtualenv

@mgedmin
Copy link
Contributor

mgedmin commented Jan 5, 2017

This has something to do with namespace packages, see this comment: zopefoundation/zope.configuration#16 (comment)

I cannot explain why mixing an old-style explicit namespace package with a PEP-420 implicit namespace package works on Python 3.4, but fails on 3.5 and 3.6.

I've just double-checked that I have the latest versions of virtualenv, pip and setuptools installed.

@jaraco
Copy link
Member

jaraco commented Jan 7, 2017

Well, the issue just doesn't happen to me:

$ git clone gh://zopefoundation/zope.configuration
Cloning into 'zope.configuration'...
remote: Counting objects: 1541, done.
remote: Total 1541 (delta 0), reused 0 (delta 0), pack-reused 1541
Receiving objects: 100% (1541/1541), 270.88 KiB | 0 bytes/s, done.
Resolving deltas: 100% (900/900), done.
$ cd zope.configuration 
$ tox -e python
python create: /Users/jaraco/Dropbox/code/public/zope/zope.configuration/.tox/python
python installdeps: zope.event, zope.i18nmessageid, zope.interface, zope.schema
python develop-inst: /Users/jaraco/Dropbox/code/public/zope/zope.configuration
python installed: -e git+gh://zopefoundation/zope.configuration@6e09fee3a67116babff6d9b3182792499ec3fe83#egg=zope.configuration,zope.event==4.2.0,zope.i18nmessageid==4.0.3,zope.interface==4.3.3,zope.schema==4.4.2
python runtests: PYTHONHASHSEED='1879386832'
python runtests: commands[0] | python setup.py -q test -q
warning: no previously-included files matching '*.pyc' found anywhere in distribution
............................................................................................................................................................................................................................................................
----------------------------------------------------------------------
Ran 252 tests in 0.316s

OK
____________________________________________ summary _____________________________________________
  python: commands succeeded
  congratulations :)
$ tox -e py35  
py35 create: /Users/jaraco/Dropbox/code/public/zope/zope.configuration/.tox/py35
py35 installdeps: zope.event, zope.i18nmessageid, zope.interface, zope.schema
py35 develop-inst: /Users/jaraco/Dropbox/code/public/zope/zope.configuration
py35 installed: -e git+gh://zopefoundation/zope.configuration@6e09fee3a67116babff6d9b3182792499ec3fe83#egg=zope.configuration,zope.event==4.2.0,zope.i18nmessageid==4.0.3,zope.interface==4.3.3,zope.schema==4.4.2
py35 runtests: PYTHONHASHSEED='1186025203'
py35 runtests: commands[0] | python setup.py -q test -q
warning: no previously-included files matching '*.pyc' found anywhere in distribution
............................................................................................................................................................................................................................................................
----------------------------------------------------------------------
Ran 252 tests in 0.353s

OK
____________________________________________ summary _____________________________________________
  py35: commands succeeded
  congratulations :)
$ .tox/python/bin/python -V
Python 3.6.0
$ .tox/python/bin/python -m easy_install --version
setuptools 32.3.1 from /Users/jaraco/Dropbox/code/public/zope/zope.configuration/.tox/python/lib/python3.6/site-packages (Python 3.6)
$ .tox/python/bin/python -m pip -V                
pip 9.0.1 from /Users/jaraco/Dropbox/code/public/zope/zope.configuration/.tox/python/lib/python3.6/site-packages (python 3.6)

Has the issue been fixed?

@jaraco
Copy link
Member

jaraco commented Jan 7, 2017

Even setup.py test from a clean env is working for me:

$ python -m venv .tox/clean
$ .tox/clean/bin/python setup.py test
running test
Searching for zope.schema
Reading https://pypi.python.org/simple/zope.schema/
Downloading https://pypi.python.org/packages/0d/b2/41fdc6c42c4320f326c65810eff785247e65e4ea856cff15120e47b93509/zope.schema-4.4.2.tar.gz#md5=939680fec2a5cf9e214cc80d6665065c
Best match: zope.schema 4.4.2
Processing zope.schema-4.4.2.tar.gz
Writing /var/folders/c6/v7hnmq453xb6p2dbz1gqc6rr0000gn/T/easy_install-0a600q3n/zope.schema-4.4.2/setup.cfg
Running zope.schema-4.4.2/setup.py -q bdist_egg --dist-dir /var/folders/c6/v7hnmq453xb6p2dbz1gqc6rr0000gn/T/easy_install-0a600q3n/zope.schema-4.4.2/egg-dist-tmp-4jvnosse
warning: no previously-included files matching '*.dll' found anywhere in distribution
warning: no previously-included files matching '*.pyc' found anywhere in distribution
warning: no previously-included files matching '*.pyo' found anywhere in distribution
warning: no previously-included files matching '*.so' found anywhere in distribution
creating /Users/jaraco/Dropbox/code/public/zope/zope.configuration/.eggs/zope.schema-4.4.2-py3.6.egg
Extracting zope.schema-4.4.2-py3.6.egg to /Users/jaraco/Dropbox/code/public/zope/zope.configuration/.eggs

Installed /Users/jaraco/Dropbox/code/public/zope/zope.configuration/.eggs/zope.schema-4.4.2-py3.6.egg
Searching for zope.interface
Reading https://pypi.python.org/simple/zope.interface/
Downloading https://pypi.python.org/packages/44/af/cea1e18bc0d3be0e0824762d3236f0e61088eeed75287e7b854d65ec9916/zope.interface-4.3.3.tar.gz#md5=ba3f32eacaea66094b7e2ae2788cec89
Best match: zope.interface 4.3.3
Processing zope.interface-4.3.3.tar.gz
Writing /var/folders/c6/v7hnmq453xb6p2dbz1gqc6rr0000gn/T/easy_install-r9qm1_ws/zope.interface-4.3.3/setup.cfg
Running zope.interface-4.3.3/setup.py -q bdist_egg --dist-dir /var/folders/c6/v7hnmq453xb6p2dbz1gqc6rr0000gn/T/easy_install-r9qm1_ws/zope.interface-4.3.3/egg-dist-tmp-2ykqqwts
warning: no previously-included files matching '*.dll' found anywhere in distribution
warning: no previously-included files matching '*.pyc' found anywhere in distribution
warning: no previously-included files matching '*.pyo' found anywhere in distribution
warning: no previously-included files matching '*.so' found anywhere in distribution
warning: no previously-included files matching 'coverage.xml' found anywhere in distribution
warning: no previously-included files matching 'appveyor.yml' found anywhere in distribution
no previously-included directories found matching 'docs/_build'
src/zope/interface/_zope_interface_coptimizations.c:34:9: warning: 'METH_KEYWORDS' macro redefined
      [-Wmacro-redefined]
#define METH_KEYWORDS 0x0003
        ^
/Library/Frameworks/Python.framework/Versions/3.6/include/python3.6m/methodobject.h:70:9: note: 
      previous definition is here
#define METH_KEYWORDS 0x0002
        ^
1 warning generated.
ld: warning: ignoring file build/temp.macosx-10.6-intel-3.6/src/zope/interface/_zope_interface_coptimizations.o, file was built for x86_64 which is not the architecture being linked (i386): build/temp.macosx-10.6-intel-3.6/src/zope/interface/_zope_interface_coptimizations.o
creating /Users/jaraco/Dropbox/code/public/zope/zope.configuration/.eggs/zope.interface-4.3.3-py3.6-macosx-10.6-intel.egg
Extracting zope.interface-4.3.3-py3.6-macosx-10.6-intel.egg to /Users/jaraco/Dropbox/code/public/zope/zope.configuration/.eggs

Installed /Users/jaraco/Dropbox/code/public/zope/zope.configuration/.eggs/zope.interface-4.3.3-py3.6-macosx-10.6-intel.egg
Searching for zope.i18nmessageid
Reading https://pypi.python.org/simple/zope.i18nmessageid/
Downloading https://pypi.python.org/packages/97/16/e76c4d7833d8e4246e0ebec826b68facbf21c97a1a62a9292f0b2779e3a1/zope.i18nmessageid-4.0.3.tar.gz#md5=fc20d6e548d1671da4ab1d9110667f13
Best match: zope.i18nmessageid 4.0.3
Processing zope.i18nmessageid-4.0.3.tar.gz
Writing /var/folders/c6/v7hnmq453xb6p2dbz1gqc6rr0000gn/T/easy_install-z4_ni3hl/zope.i18nmessageid-4.0.3/setup.cfg
Running zope.i18nmessageid-4.0.3/setup.py -q bdist_egg --dist-dir /var/folders/c6/v7hnmq453xb6p2dbz1gqc6rr0000gn/T/easy_install-z4_ni3hl/zope.i18nmessageid-4.0.3/egg-dist-tmp-lggmnqhh
warning: no previously-included files matching '*.dll' found anywhere in distribution
warning: no previously-included files matching '*.pyc' found anywhere in distribution
warning: no previously-included files matching '*.pyo' found anywhere in distribution
warning: no previously-included files matching '*.so' found anywhere in distribution
ld: warning: ignoring file build/temp.macosx-10.6-intel-3.6/src/zope/i18nmessageid/_zope_i18nmessageid_message.o, file was built for x86_64 which is not the architecture being linked (i386): build/temp.macosx-10.6-intel-3.6/src/zope/i18nmessageid/_zope_i18nmessageid_message.o
creating /Users/jaraco/Dropbox/code/public/zope/zope.configuration/.eggs/zope.i18nmessageid-4.0.3-py3.6-macosx-10.6-intel.egg
Extracting zope.i18nmessageid-4.0.3-py3.6-macosx-10.6-intel.egg to /Users/jaraco/Dropbox/code/public/zope/zope.configuration/.eggs

Installed /Users/jaraco/Dropbox/code/public/zope/zope.configuration/.eggs/zope.i18nmessageid-4.0.3-py3.6-macosx-10.6-intel.egg
Searching for zope.event
Reading https://pypi.python.org/simple/zope.event/
Downloading https://pypi.python.org/packages/cd/a5/4927363244aaa7fd8a696d32005ea8214c4811550d35edea27797ebbd4fd/zope.event-4.2.0.tar.gz#md5=c97ef5c7fd1003c754cf72d7bee0a47c
Best match: zope.event 4.2.0
Processing zope.event-4.2.0.tar.gz
Writing /var/folders/c6/v7hnmq453xb6p2dbz1gqc6rr0000gn/T/easy_install-vkk6uk74/zope.event-4.2.0/setup.cfg
Running zope.event-4.2.0/setup.py -q bdist_egg --dist-dir /var/folders/c6/v7hnmq453xb6p2dbz1gqc6rr0000gn/T/easy_install-vkk6uk74/zope.event-4.2.0/egg-dist-tmp-w187valq
warning: no previously-included files matching '*.dll' found anywhere in distribution
warning: no previously-included files matching '*.pyc' found anywhere in distribution
warning: no previously-included files matching '*.pyo' found anywhere in distribution
warning: no previously-included files matching '*.so' found anywhere in distribution
warning: no previously-included files matching '*.class' found anywhere in distribution
creating /Users/jaraco/Dropbox/code/public/zope/zope.configuration/.eggs/zope.event-4.2.0-py3.6.egg
Extracting zope.event-4.2.0-py3.6.egg to /Users/jaraco/Dropbox/code/public/zope/zope.configuration/.eggs

Installed /Users/jaraco/Dropbox/code/public/zope/zope.configuration/.eggs/zope.event-4.2.0-py3.6.egg
running egg_info
writing src/zope.configuration.egg-info/PKG-INFO
writing dependency_links to src/zope.configuration.egg-info/dependency_links.txt
writing namespace_packages to src/zope.configuration.egg-info/namespace_packages.txt
writing requirements to src/zope.configuration.egg-info/requires.txt
writing top-level names to src/zope.configuration.egg-info/top_level.txt
reading manifest file 'src/zope.configuration.egg-info/SOURCES.txt'
reading manifest template 'MANIFEST.in'
warning: no previously-included files matching '*.pyc' found anywhere in distribution
writing manifest file 'src/zope.configuration.egg-info/SOURCES.txt'
running build_ext
test_empty (zope.configuration.tests.test___init__.Test_namespace) ... ok
test_non_empty (zope.configuration.tests.test___init__.Test_namespace) ... ok
test_action_defaults_no_info_no_includepath (zope.configuration.tests.test_config.ConfigurationContextTests) ... ok
test_action_defaults_w_info_w_includepath (zope.configuration.tests.test_config.ConfigurationContextTests) ... ok
test_action_explicit_no_extra (zope.configuration.tests.test_config.ConfigurationContextTests) ... ok
test_action_explicit_w_extra (zope.configuration.tests.test_config.ConfigurationContextTests) ... ok
test_checkDuplicate_hit (zope.configuration.tests.test_config.ConfigurationContextTests) ... ok
test_checkDuplicate_miss (zope.configuration.tests.test_config.ConfigurationContextTests) ... ok
test_hasFeature_hit (zope.configuration.tests.test_config.ConfigurationContextTests) ... ok
test_hasFeature_miss (zope.configuration.tests.test_config.ConfigurationContextTests) ... ok
test_path_w_absolute_filename (zope.configuration.tests.test_config.ConfigurationContextTests) ... ok
test_path_w_relative_filename_w_basepath (zope.configuration.tests.test_config.ConfigurationContextTests) ... ok
test_path_w_relative_filename_wo_basepath_wo_package (zope.configuration.tests.test_config.ConfigurationContextTests) ... ok
test_path_wo_basepath_w_package_having_file (zope.configuration.tests.test_config.ConfigurationContextTests) ... ok
test_path_wo_basepath_w_package_having_no_file_but_path (zope.configuration.tests.test_config.ConfigurationContextTests) ... ok
test_processFile_hit (zope.configuration.tests.test_config.ConfigurationContextTests) ... ok
test_processFile_miss (zope.configuration.tests.test_config.ConfigurationContextTests) ... ok
test_provideFeature (zope.configuration.tests.test_config.ConfigurationContextTests) ... ok
test_resolve_bad_dotted_import (zope.configuration.tests.test_config.ConfigurationContextTests) ... ok
test_resolve_bad_dotted_last_import (zope.configuration.tests.test_config.ConfigurationContextTests) ... ok
test_resolve_bad_sub_import (zope.configuration.tests.test_config.ConfigurationContextTests) ... ok
test_resolve_bad_sub_last_import (zope.configuration.tests.test_config.ConfigurationContextTests) ... ok
test_resolve_builtin (zope.configuration.tests.test_config.ConfigurationContextTests) ... ok
test_resolve_dot (zope.configuration.tests.test_config.ConfigurationContextTests) ... ok
test_resolve_empty (zope.configuration.tests.test_config.ConfigurationContextTests) ... ok
test_resolve_relative_miss_no_package (zope.configuration.tests.test_config.ConfigurationContextTests) ... ok
test_resolve_relative_miss_w_package_too_many_dots (zope.configuration.tests.test_config.ConfigurationContextTests) ... ok
test_resolve_single_non_builtin (zope.configuration.tests.test_config.ConfigurationContextTests) ... ok
test_resolve_trailing_dot_in_resolve (zope.configuration.tests.test_config.ConfigurationContextTests) ... ok
test_resolve_whitespace (zope.configuration.tests.test_config.ConfigurationContextTests) ... ok
test_ctor (zope.configuration.tests.test_config.ConfigurationAdapterRegistryTests) ... ok
test_document_non_string_name (zope.configuration.tests.test_config.ConfigurationAdapterRegistryTests) ... ok
test_document_w_string_name (zope.configuration.tests.test_config.ConfigurationAdapterRegistryTests) ... ok
test_factory_hit_on_fqn (zope.configuration.tests.test_config.ConfigurationAdapterRegistryTests) ... ok
test_factory_hit_on_fqn_lookup_fails (zope.configuration.tests.test_config.ConfigurationAdapterRegistryTests) ... ok
test_factory_miss (zope.configuration.tests.test_config.ConfigurationAdapterRegistryTests) ... ok
test_factory_miss_on_fqn_hit_on_bare_name (zope.configuration.tests.test_config.ConfigurationAdapterRegistryTests) ... ok
test_register (zope.configuration.tests.test_config.ConfigurationAdapterRegistryTests) ... ok
test_register_new_name (zope.configuration.tests.test_config.ConfigurationAdapterRegistryTests) ... ok
test_register_replacement (zope.configuration.tests.test_config.ConfigurationAdapterRegistryTests) ... ok
test___call__ (zope.configuration.tests.test_config.ConfigurationMachineTests) ... ok
test_begin_w___data_and_kw (zope.configuration.tests.test_config.ConfigurationMachineTests) ... ok
test_begin_w___data_no_kw (zope.configuration.tests.test_config.ConfigurationMachineTests) ... ok
test_begin_wo___data_w_kw (zope.configuration.tests.test_config.ConfigurationMachineTests) ... ok
test_class_conforms_to_IConfigurationContext (zope.configuration.tests.test_config.ConfigurationMachineTests) ... ok
test_ctor (zope.configuration.tests.test_config.ConfigurationMachineTests) ... ok
test_end (zope.configuration.tests.test_config.ConfigurationMachineTests) ... ok
test_execute_actions_empty (zope.configuration.tests.test_config.ConfigurationMachineTests) ... ok
test_execute_actions_w_errors_w_testing (zope.configuration.tests.test_config.ConfigurationMachineTests) ... ok
test_execute_actions_w_errors_wo_testing (zope.configuration.tests.test_config.ConfigurationMachineTests) ... ok
test_execute_actions_wo_errors (zope.configuration.tests.test_config.ConfigurationMachineTests) ... ok
test_getInfo_only_root (zope.configuration.tests.test_config.ConfigurationMachineTests) ... ok
test_getInfo_only_root_default (zope.configuration.tests.test_config.ConfigurationMachineTests) ... ok
test_getInfo_w_item (zope.configuration.tests.test_config.ConfigurationMachineTests) ... ok
test_instance_conforms_to_IConfigurationContext (zope.configuration.tests.test_config.ConfigurationMachineTests) ... ok
test_keyword_handling (zope.configuration.tests.test_config.ConfigurationMachineTests) ... ok
test_setInfo_only_root (zope.configuration.tests.test_config.ConfigurationMachineTests) ... ok
test_setInfo_w_item (zope.configuration.tests.test_config.ConfigurationMachineTests) ... ok
test_class_conforms_to_IStackItem (zope.configuration.tests.test_config.SimpleStackItemTests) ... ok
test_contained_raises (zope.configuration.tests.test_config.SimpleStackItemTests) ... ok
test_ctor (zope.configuration.tests.test_config.SimpleStackItemTests) ... ok
test_finish_handler_returns_newstyle_actions (zope.configuration.tests.test_config.SimpleStackItemTests) ... ok
test_finish_handler_returns_no_actions (zope.configuration.tests.test_config.SimpleStackItemTests) ... ok
test_finish_handler_returns_oldstyle_actions (zope.configuration.tests.test_config.SimpleStackItemTests) ... ok
test_instance_conforms_to_IStackItem (zope.configuration.tests.test_config.SimpleStackItemTests) ... ok
test_class_conforms_to_IStackItem (zope.configuration.tests.test_config.RootStackItemTests) ... ok
test_contained_context_factory_fails (zope.configuration.tests.test_config.RootStackItemTests) ... ok
test_contained_context_factory_normal (zope.configuration.tests.test_config.RootStackItemTests) ... ok
test_finish (zope.configuration.tests.test_config.RootStackItemTests) ... ok
test_instance_conforms_to_IStackItem (zope.configuration.tests.test_config.RootStackItemTests) ... ok
test_class_conforms_to_IStackItem (zope.configuration.tests.test_config.GroupingStackItemTests) ... ok
test_contained_context_before_returns_newstyle_actions (zope.configuration.tests.test_config.GroupingStackItemTests) ... ok
test_contained_context_before_returns_oldstyle_actions (zope.configuration.tests.test_config.GroupingStackItemTests) ... ok
test_finish_calls_before_if_not_already_called (zope.configuration.tests.test_config.GroupingStackItemTests) ... ok
test_instance_conforms_to_IStackItem (zope.configuration.tests.test_config.GroupingStackItemTests) ... ok
test_class_conforms_to_IStackItem (zope.configuration.tests.test_config.ComplexStackItemTests) ... ok
test_contained_hit (zope.configuration.tests.test_config.ComplexStackItemTests) ... ok
test_contained_miss (zope.configuration.tests.test_config.ComplexStackItemTests) ... ok
test_ctor (zope.configuration.tests.test_config.ComplexStackItemTests) ... ok
test_finish_handler_is_noncallable (zope.configuration.tests.test_config.ComplexStackItemTests) ... ok
test_finish_handler_raises_AE_for___call__ (zope.configuration.tests.test_config.ComplexStackItemTests) ... ok
test_finish_handler_raises_AE_for_other (zope.configuration.tests.test_config.ComplexStackItemTests) ... ok
test_finish_handler_returns_newstyle_actions (zope.configuration.tests.test_config.ComplexStackItemTests) ... ok
test_finish_handler_returns_oldstyle_actions (zope.configuration.tests.test_config.ComplexStackItemTests) ... ok
test_instance_conforms_to_IStackItem (zope.configuration.tests.test_config.ComplexStackItemTests) ... ok
test_after (zope.configuration.tests.test_config.GroupingContextDecoratorTests) ... ok
test_before (zope.configuration.tests.test_config.GroupingContextDecoratorTests) ... ok
test_class_conforms_to_IConfigurationContext (zope.configuration.tests.test_config.GroupingContextDecoratorTests) ... ok
test_class_conforms_to_IGroupingContext (zope.configuration.tests.test_config.GroupingContextDecoratorTests) ... ok
test_ctor_no_kwargs (zope.configuration.tests.test_config.GroupingContextDecoratorTests) ... ok
test_ctor_w_kwargs (zope.configuration.tests.test_config.GroupingContextDecoratorTests) ... ok
test_getattr_fetches_from_context_and_caches (zope.configuration.tests.test_config.GroupingContextDecoratorTests) ... ok
test_instance_conforms_to_IConfigurationContext (zope.configuration.tests.test_config.GroupingContextDecoratorTests) ... ok
test_instance_conforms_to_IGroupingContext (zope.configuration.tests.test_config.GroupingContextDecoratorTests) ... ok
test_class_conforms_to_IDirectivesContext (zope.configuration.tests.test_config.DirectivesHandlerTests) ... ok
test_instance_conforms_to_IDirectivesContext (zope.configuration.tests.test_config.DirectivesHandlerTests) ... ok
test_defaults (zope.configuration.tests.test_config.Test_defineSimpleDirective) ... ok
test_explicit_w_star_namespace (zope.configuration.tests.test_config.Test_defineSimpleDirective) ... ok
test_defaults (zope.configuration.tests.test_config.Test_defineGroupingDirective) ... ok
test_explicit_w_star_namespace (zope.configuration.tests.test_config.Test_defineGroupingDirective) ... ok
test_before (zope.configuration.tests.test_config.ComplexDirectiveDefinitionTests) ... ok
test_class_conforms_to_IComplexDirectiveContext (zope.configuration.tests.test_config.ComplexDirectiveDefinitionTests) ... ok
test_instance_conforms_to_IComplexDirectiveContext (zope.configuration.tests.test_config.ComplexDirectiveDefinitionTests) ... ok
test_w_handler_attribute (zope.configuration.tests.test_config.Test_subdirective) ... ok
test_wo_handler_attribute (zope.configuration.tests.test_config.Test_subdirective) ... ok
test_w_multiple (zope.configuration.tests.test_config.Test_provides) ... ok
test_w_single (zope.configuration.tests.test_config.Test_provides) ... ok
test_w_empty_schema_no_data (zope.configuration.tests.test_config.Test_toargs) ... ok
test_w_empty_schema_w_data_no_kwargs_allowed (zope.configuration.tests.test_config.Test_toargs) ... ok
test_w_empty_schema_w_data_w_kwargs_allowed (zope.configuration.tests.test_config.Test_toargs) ... ok
test_w_field_missing_but_default (zope.configuration.tests.test_config.Test_toargs) ... ok
test_w_field_missing_no_default (zope.configuration.tests.test_config.Test_toargs) ... ok
test_w_invalid_value (zope.configuration.tests.test_config.Test_toargs) ... ok
test_w_keyword_sub (zope.configuration.tests.test_config.Test_toargs) ... ok
test_defaults (zope.configuration.tests.test_config.Test_expand_action) ... ok
test_explicit_no_extra (zope.configuration.tests.test_config.Test_expand_action) ... ok
test_explicit_w_extra (zope.configuration.tests.test_config.Test_expand_action) ... ok
test_configuration_conflict_error_has_readable_exception (zope.configuration.tests.test_config.Test_resolveConflicts) ... ok
test_empty (zope.configuration.tests.test_config.Test_resolveConflicts) ... ok
test_expands_oldstyle_actions (zope.configuration.tests.test_config.Test_resolveConflicts) ... ok
test_w_non_resolvable_discriminator_clash_different_paths (zope.configuration.tests.test_config.Test_resolveConflicts) ... ok
test_w_non_resolvable_discriminator_clash_same_path (zope.configuration.tests.test_config.Test_resolveConflicts) ... ok
test_w_resolvable_discriminator_clash (zope.configuration.tests.test_config.Test_resolveConflicts) ... ok
test_wo_discriminator_clash (zope.configuration.tests.test_config.Test_resolveConflicts) ... ok
test_wo_discriminators_final_sorting_order (zope.configuration.tests.test_config.Test_resolveConflicts) ... ok
test_empty (zope.configuration.tests.test_docutils.Test_wrap) ... ok
test_multiple_paragraphs (zope.configuration.tests.test_docutils.Test_wrap) ... ok
test_only_whitespace (zope.configuration.tests.test_docutils.Test_wrap) ... ok
test_single_paragraphs (zope.configuration.tests.test_docutils.Test_wrap) ... ok
test_empty (zope.configuration.tests.test_docutils.Test_makeDocStructures) ... ok
test_w_parents (zope.configuration.tests.test_docutils.Test_makeDocStructures) ... ok
test_wo_parents (zope.configuration.tests.test_docutils.Test_makeDocStructures) ... ok
test__validate_hit (zope.configuration.tests.test_fields.PythonIdentifierTests) ... ok
test__validate_miss (zope.configuration.tests.test_fields.PythonIdentifierTests) ... ok
test_class_conforms_to_IFromUnicode (zope.configuration.tests.test_fields.PythonIdentifierTests) ... ok
test_fromUnicode_empty (zope.configuration.tests.test_fields.PythonIdentifierTests) ... ok
test_fromUnicode_normal (zope.configuration.tests.test_fields.PythonIdentifierTests) ... ok
test_fromUnicode_strips_ws (zope.configuration.tests.test_fields.PythonIdentifierTests) ... ok
test_instance_conforms_to_IFromUnicode (zope.configuration.tests.test_fields.PythonIdentifierTests) ... ok
test__validate_w_value_type (zope.configuration.tests.test_fields.GlobalObjectTests) ... ok
test__validate_wo_value_type (zope.configuration.tests.test_fields.GlobalObjectTests) ... ok
test_class_conforms_to_IFromUnicode (zope.configuration.tests.test_fields.GlobalObjectTests) ... ok
test_fromUnicode_w_resolve_but_validation_fails (zope.configuration.tests.test_fields.GlobalObjectTests) ... ok
test_fromUnicode_w_resolve_fails (zope.configuration.tests.test_fields.GlobalObjectTests) ... ok
test_fromUnicode_w_resolve_success (zope.configuration.tests.test_fields.GlobalObjectTests) ... ok
test_fromUnicode_w_star_and_extra_ws (zope.configuration.tests.test_fields.GlobalObjectTests) ... ok
test_instance_conforms_to_IFromUnicode (zope.configuration.tests.test_fields.GlobalObjectTests) ... ok
test_class_conforms_to_IFromUnicode (zope.configuration.tests.test_fields.GlobalInterfaceTests) ... ok
test_ctor (zope.configuration.tests.test_fields.GlobalInterfaceTests) ... ok
test_instance_conforms_to_IFromUnicode (zope.configuration.tests.test_fields.GlobalInterfaceTests) ... ok
test_class_conforms_to_IFromUnicode (zope.configuration.tests.test_fields.TokensTests) ... ok
test_fromUnicode_empty (zope.configuration.tests.test_fields.TokensTests) ... ok
test_fromUnicode_invalid (zope.configuration.tests.test_fields.TokensTests) ... ok
test_fromUnicode_strips_ws (zope.configuration.tests.test_fields.TokensTests) ... ok
test_instance_conforms_to_IFromUnicode (zope.configuration.tests.test_fields.TokensTests) ... ok
test_class_conforms_to_IFromUnicode (zope.configuration.tests.test_fields.PathTests) ... ok
test_fromUnicode_absolute (zope.configuration.tests.test_fields.PathTests) ... ok
test_fromUnicode_relative (zope.configuration.tests.test_fields.PathTests) ... ok
test_instance_conforms_to_IFromUnicode (zope.configuration.tests.test_fields.PathTests) ... ok
test_class_conforms_to_IFromUnicode (zope.configuration.tests.test_fields.BoolTests) ... ok
test_fromUnicode_w_false_values (zope.configuration.tests.test_fields.BoolTests) ... ok
test_fromUnicode_w_invalid (zope.configuration.tests.test_fields.BoolTests) ... ok
test_fromUnicode_w_true_values (zope.configuration.tests.test_fields.BoolTests) ... ok
test_instance_conforms_to_IFromUnicode (zope.configuration.tests.test_fields.BoolTests) ... ok
test_class_conforms_to_IFromUnicode (zope.configuration.tests.test_fields.MessageIDTests) ... ok
test_instance_conforms_to_IFromUnicode (zope.configuration.tests.test_fields.MessageIDTests) ... ok
test_w_empty_id (zope.configuration.tests.test_fields.MessageIDTests) ... ok
test_w_id_and_default (zope.configuration.tests.test_fields.MessageIDTests) ... ok
test_wo_domain (zope.configuration.tests.test_fields.MessageIDTests) ... ok
test_class_in_module (zope.configuration.tests.test_name.Test_resolve) ... ok
test_class_w_same_name_as_module (zope.configuration.tests.test_name.Test_resolve) ... ok
test_function_in_module (zope.configuration.tests.test_name.Test_resolve) ... ok
test_function_in_module_relative (zope.configuration.tests.test_name.Test_resolve) ... ok
test_importable_but_not_attr_of_parent (zope.configuration.tests.test_name.Test_resolve) ... ok
test_nested_module (zope.configuration.tests.test_name.Test_resolve) ... ok
test_top_level_module (zope.configuration.tests.test_name.Test_resolve) ... ok
test_class_in_module (zope.configuration.tests.test_name.Test_resolve) ... ok
test_class_w_same_name_as_module (zope.configuration.tests.test_name.Test_resolve) ... ok
test_function_in_module (zope.configuration.tests.test_name.Test_resolve) ... ok
test_function_in_module_relative (zope.configuration.tests.test_name.Test_resolve) ... ok
test_importable_but_not_attr_of_parent (zope.configuration.tests.test_name.Test_resolve) ... ok
test_nested_module (zope.configuration.tests.test_name.Test_resolve) ... ok
test_top_level_module (zope.configuration.tests.test_name.Test_resolve) ... ok
test_absolute (zope.configuration.tests.test_name.Test_path) ... ok
test_relative_bogus_package (zope.configuration.tests.test_name.Test_path) ... ok
test_relative_empty (zope.configuration.tests.test_name.Test_path) ... ok
test_relative_w_file (zope.configuration.tests.test_name.Test_path) ... ok
test___str___uses_repr_of_info (zope.configuration.tests.test_xmlconfig.ZopeXMLConfigurationErrorTests) ... ok
test___str___not_a_sax_error (zope.configuration.tests.test_xmlconfig.ZopeSAXParseExceptionTests) ... ok
test___str___w_a_sax_error (zope.configuration.tests.test_xmlconfig.ZopeSAXParseExceptionTests) ... ok
test___repr___w_eline_ecolumn_dont_match_line_column (zope.configuration.tests.test_xmlconfig.ParserInfoTests) ... ok
test___repr___w_eline_ecolumn_match_line_column (zope.configuration.tests.test_xmlconfig.ParserInfoTests) ... ok
test___str___w_eline_ecolumn_dont_match_line_column_bad_file (zope.configuration.tests.test_xmlconfig.ParserInfoTests) ... ok
test___str___w_eline_ecolumn_match_line_column (zope.configuration.tests.test_xmlconfig.ParserInfoTests) ... ok
test___str___w_good_file (zope.configuration.tests.test_xmlconfig.ParserInfoTests) ... ok
test_ctor_defaults (zope.configuration.tests.test_xmlconfig.ConfigurationHandlerTests) ... ok
test_ctor_explicit (zope.configuration.tests.test_xmlconfig.ConfigurationHandlerTests) ... ok
test_endElementNS_context_end_raises_w_testing (zope.configuration.tests.test_xmlconfig.ConfigurationHandlerTests) ... ok
test_endElementNS_context_end_raises_wo_testing (zope.configuration.tests.test_xmlconfig.ConfigurationHandlerTests) ... ok
test_endElementNS_normal (zope.configuration.tests.test_xmlconfig.ConfigurationHandlerTests) ... ok
test_endElementNS_w_ignore_depth_already_set (zope.configuration.tests.test_xmlconfig.ConfigurationHandlerTests) ... ok
test_evaluateCondition_w_have_hit (zope.configuration.tests.test_xmlconfig.ConfigurationHandlerTests) ... ok
test_evaluateCondition_w_have_miss (zope.configuration.tests.test_xmlconfig.ConfigurationHandlerTests) ... ok
test_evaluateCondition_w_have_no_args (zope.configuration.tests.test_xmlconfig.ConfigurationHandlerTests) ... ok
test_evaluateCondition_w_installed_hit (zope.configuration.tests.test_xmlconfig.ConfigurationHandlerTests) ... ok
test_evaluateCondition_w_installed_miss (zope.configuration.tests.test_xmlconfig.ConfigurationHandlerTests) ... ok
test_evaluateCondition_w_installed_no_args (zope.configuration.tests.test_xmlconfig.ConfigurationHandlerTests) ... ok
test_evaluateCondition_w_not_have_hit (zope.configuration.tests.test_xmlconfig.ConfigurationHandlerTests) ... ok
test_evaluateCondition_w_not_have_miss (zope.configuration.tests.test_xmlconfig.ConfigurationHandlerTests) ... ok
test_evaluateCondition_w_not_have_too_many_args (zope.configuration.tests.test_xmlconfig.ConfigurationHandlerTests) ... ok
test_evaluateCondition_w_not_installed_hit (zope.configuration.tests.test_xmlconfig.ConfigurationHandlerTests) ... ok
test_evaluateCondition_w_not_installed_miss (zope.configuration.tests.test_xmlconfig.ConfigurationHandlerTests) ... ok
test_evaluateCondition_w_not_installed_too_many_args (zope.configuration.tests.test_xmlconfig.ConfigurationHandlerTests) ... ok
test_evaluateCondition_w_unknown_verb (zope.configuration.tests.test_xmlconfig.ConfigurationHandlerTests) ... ok
test_setDocumentLocator (zope.configuration.tests.test_xmlconfig.ConfigurationHandlerTests) ... ok
test_startElementNS_context_begin_raises_w_testing (zope.configuration.tests.test_xmlconfig.ConfigurationHandlerTests) ... ok
test_startElementNS_context_begin_raises_wo_testing (zope.configuration.tests.test_xmlconfig.ConfigurationHandlerTests) ... ok
test_startElementNS_normal (zope.configuration.tests.test_xmlconfig.ConfigurationHandlerTests) ... ok
test_startElementNS_w_ignore_depth_already_set (zope.configuration.tests.test_xmlconfig.ConfigurationHandlerTests) ... ok
test_startElementNS_w_zcml_condition_failing (zope.configuration.tests.test_xmlconfig.ConfigurationHandlerTests) ... ok
test_w_empty_xml (zope.configuration.tests.test_xmlconfig.Test_processxmlfile) ... ok
test_w_valid_xml_fp (zope.configuration.tests.test_xmlconfig.Test_processxmlfile) ... ok
test_file_missing_and_dot_in_not_present (zope.configuration.tests.test_xmlconfig.Test_openInOrPlain) ... ok
test_file_missing_but_dot_in_present (zope.configuration.tests.test_xmlconfig.Test_openInOrPlain) ... ok
test_file_present (zope.configuration.tests.test_xmlconfig.Test_openInOrPlain) ... ok
test_both_file_and_files_passed (zope.configuration.tests.test_xmlconfig.Test_include) ... ok
test_neither_file_nor_files_passed (zope.configuration.tests.test_xmlconfig.Test_include) ... ok
test_neither_file_nor_files_passed_already_seen (zope.configuration.tests.test_xmlconfig.Test_include) ... ok
test_w_file_passed (zope.configuration.tests.test_xmlconfig.Test_include) ... ok
test_w_files_passed_and_package (zope.configuration.tests.test_xmlconfig.Test_include) ... ok
test_both_file_and_files_passed (zope.configuration.tests.test_xmlconfig.Test_exclude) ... ok
test_neither_file_nor_files_passed (zope.configuration.tests.test_xmlconfig.Test_exclude) ... ok
test_w_file_passed (zope.configuration.tests.test_xmlconfig.Test_exclude) ... ok
test_w_files_passed_and_package (zope.configuration.tests.test_xmlconfig.Test_exclude) ... ok
test_w_subpackage (zope.configuration.tests.test_xmlconfig.Test_exclude) ... ok
test_actions_have_parents_includepath (zope.configuration.tests.test_xmlconfig.Test_includeOverrides) ... ok
test_w_execute (zope.configuration.tests.test_xmlconfig.Test_file) ... ok
test_wo_execute_w_context (zope.configuration.tests.test_xmlconfig.Test_file) ... ok
test_wo_execute_wo_context_w_package (zope.configuration.tests.test_xmlconfig.Test_file) ... ok
test_wo_execute_wo_context_wo_package (zope.configuration.tests.test_xmlconfig.Test_file) ... ok
test_w_execute (zope.configuration.tests.test_xmlconfig.Test_string) ... ok
test_wo_execute_w_context (zope.configuration.tests.test_xmlconfig.Test_string) ... ok
test_wo_execute_wo_context (zope.configuration.tests.test_xmlconfig.Test_string) ... ok
test___call__ (zope.configuration.tests.test_xmlconfig.XMLConfigTests) ... ok
test_ctor (zope.configuration.tests.test_xmlconfig.XMLConfigTests) ... ok
test_ctor_w_global_context_missing (zope.configuration.tests.test_xmlconfig.XMLConfigTests) ... ok
test_ctor_w_module (zope.configuration.tests.test_xmlconfig.XMLConfigTests) ... ok
test_w_testing_passed (zope.configuration.tests.test_xmlconfig.Test_xmlconfig) ... ok
test_wo_testing_passed (zope.configuration.tests.test_xmlconfig.Test_xmlconfig) ... ok
test_w_testing_passed (zope.configuration.tests.test_xmlconfig.Test_testxmlconfig) ... ok
test_ctor_w_package (zope.configuration.tests.test_zopeconfigure.ZopeConfigureTests) ... ok
test_ctor_wo_package (zope.configuration.tests.test_zopeconfigure.ZopeConfigureTests) ... ok

----------------------------------------------------------------------
Ran 252 tests in 0.365s

OK

@jaraco
Copy link
Member

jaraco commented Jan 7, 2017

I get a similar result if I use virtualenv instead of pyvenv.

@berdario
Copy link
Author

berdario commented Jan 7, 2017

No, there have been no changes on zope.interface side, so it's still not working

As mgedmin pointed out

it seems to happen reproducibly if you install the package non in dev-mode before running the test suite

The consequence is that zope won't be a namespace anymore:

py2 after pip install .:

(Pdb) !zope.__path__
['/tmp/zope.configuration/src/zope', '/home/dario/.local/share/virtualenvs/9739ed15ef40d48/lib/python2.7/site-packages/zope', '/home/dario/.local/share/virtualenvs/9739ed15ef40d48/lib/python2.7/site-packages/zope']

py3.6:

(Pdb) !sys.path
['/tmp/zope.configuration/src', '/tmp/zope.configuration/.eggs/zope.event-4.2.0-py3.6.egg', '/tmp/zope.configuration/.eggs/zope.i18nmessageid-4.0.3-py3.6-linux-x86_64.egg', '/tmp/zope.configuration/.eggs/zope.interface-4.3.3-py3.6-linux-x86_64.egg', '/tmp/zope.configuration/.eggs/zope.schema-4.4.2-py3.6.egg', '/tmp/zope.configuration', '/home/dario/.local/share/virtualenvs/py36/lib/python36.zip', '/home/dario/.local/share/virtualenvs/py36/lib/python3.6', '/home/dario/.local/share/virtualenvs/py36/lib/python3.6/lib-dynload', '/home/dario/.pythonz/pythons/CPython-3.6.0/lib/python3.6', '/home/dario/.local/share/virtualenvs/py36/lib/python3.6/site-packages']
(Pdb) !import zope
(Pdb) !zope.path
*** AttributeError: module 'zope' has no attribute 'path'
(Pdb) !zope.__path__
['/tmp/zope.configuration/src/zope', '/tmp/zope.configuration/.eggs/zope.event-4.2.0-py3.6.egg/zope', '/tmp/zope.configuration/.eggs/zope.i18nmessageid-4.0.3-py3.6-linux-x86_64.egg/zope', '/tmp/zope.configuration/.eggs/zope.interface-4.3.3-py3.6-linux-x86_64.egg/zope', '/tmp/zope.configuration/.eggs/zope.schema-4.4.2-py3.6.egg/zope']

py3.6 after pip install .:

(Pdb) !sys.path
['/tmp/zope.configuration/src', '/tmp/zope.configuration', '/home/dario/.local/share/virtualenvs/37ab4affe1ccd48/lib/python36.zip', '/home/dario/.local/share/virtualenvs/37ab4affe1ccd48/lib/python3.6', '/home/dario/.local/share/virtualenvs/37ab4affe1ccd48/lib/python3.6/lib-dynload', '/home/dario/.pythonz/pythons/CPython-3.6.0/lib/python3.6', '/home/dario/.local/share/virtualenvs/37ab4affe1ccd48/lib/python3.6/site-packages']
(Pdb) !import zope
(Pdb) !zope.__path__
['/tmp/zope.configuration/src/zope']
(Pdb) 

@berdario
Copy link
Author

berdario commented Jan 7, 2017

I used this small script

python bootstrap.py
python setup.py install
cd /tmp/du2/zope.configuration-4.0.3/
pew wipeenv
pip install .
python setup.py test

to run a git bisect

e6d7c40652743005e70ddec1a3e5c7466e52a313 is the first bad commit
commit e6d7c40652743005e70ddec1a3e5c7466e52a313
Author: Jason R. Coombs <jaraco@jaraco.com>
Date:   Sat Oct 1 11:59:36 2016 -0400

    Disable nspkg.pth behavior on Python 3.3+. Fixes #805 and fixes pypa/pip#1924.

:100644 100644 7c4ff8138cecb82402f612135da0cf30b9b95c3f c536a7bea47d70da7517824e3f65de3f9caea64a M	CHANGES.rst
:040000 040000 3c8cda208974a250e0fd47dc2ca192a680fe461a d71fa2f8db70057e6687930dad5a92634ecf5b76 M	setuptools

So it seems to indeed be the same as #870 originally caused by the fix for #805

@mgedmin
Copy link
Contributor

mgedmin commented Jan 9, 2017

@jaraco: I've committed a workaround to zope.configuration's tox.ini (specifically, usedevelop = True), which is probably why you couldn't reproduce with tox.

@jaraco
Copy link
Member

jaraco commented Jan 14, 2017

So it seems to indeed be the same as #870 originally caused by the fix for #805

Unfortunately, if you read the final comment in #870, it indicates that the change that caused #870 was backed out in v31, so that doesn't really help.

I've committed a workaround to zope.configuration's tox.ini.

That's good, and begs the question - should this workaround be the recommended fix? It is the technique I've adopted for my namespace packages as a matter of course (and because it's confusing to me when running tests to have two copies of the package, one in source and one installed).

Let's assume for a moment that we desire to continue to support this model (pip installing the package under test, then running setup.py test on it). What is causing the failure? That's what I'll investigate now.

@jaraco
Copy link
Member

jaraco commented Jan 14, 2017

The issue is almost certainly instigated by the code that manipulates the sys.path and working set for the project under test.

If I create a simple environment and even add src to sys.path, only the namespace package is found:

$ python -m venv .tox/clean
$ .tox/clean/bin/pip install -U setuptools
Collecting setuptools
  Using cached setuptools-32.3.1-py2.py3-none-any.whl
Installing collected packages: setuptools
  Found existing installation: setuptools 28.8.0
    Uninstalling setuptools-28.8.0:
      Successfully uninstalled setuptools-28.8.0
Successfully installed setuptools-32.3.1
$ .tox/clean/bin/pip install .            
Processing /Users/jaraco/Dropbox/code/public/zope.configuration
Collecting zope.i18nmessageid (from zope.configuration==4.1.0.dev0)
Collecting zope.interface (from zope.configuration==4.1.0.dev0)
Collecting zope.schema (from zope.configuration==4.1.0.dev0)
Requirement already satisfied: setuptools in ./.tox/clean/lib/python3.6/site-packages (from zope.configuration==4.1.0.dev0)
Collecting zope.event (from zope.schema->zope.configuration==4.1.0.dev0)
Installing collected packages: zope.i18nmessageid, zope.interface, zope.event, zope.schema, zope.configuration
  Running setup.py install for zope.configuration ... done
Successfully installed zope.configuration-4.1.0.dev0 zope.event-4.2.0 zope.i18nmessageid-4.0.3 zope.interface-4.3.3 zope.schema-4.4.2
$ .tox/clean/bin/python                     
Python 3.6.0 (v3.6.0:41df79263a11, Dec 22 2016, 17:23:13) 
[GCC 4.2.1 (Apple Inc. build 5666) (dot 3)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import sys
>>> sys.path.insert(0, 'src')
>>> import zope.configuration, zope.interface
>>> zope.__path__
_NamespacePath(['/Users/jaraco/Dropbox/code/public/zope.configuration/.tox/clean/lib/python3.6/site-packages/zope'])
>>> zope.configuration.__file__
'/Users/jaraco/Dropbox/code/public/zope.configuration/.tox/clean/lib/python3.6/site-packages/zope/configuration/__init__.py'

One would expect this because zope.configuration was pip installed and so exists as a PEP-420 namespace package, so src/zope/__init__.py is ignored. The zope package is resolved at startup time by the -nspkg.pth files in site-packages:

$ .tox/clean/bin/python -q
>>> import sys
>>> sys.modules['zope']
>>> ^D
$ cat .tox/clean/lib/python3.6/site-packages/zope*-nspkg.pth
<module 'zope' (namespace)>
import sys, types, os;has_mfs = sys.version_info > (3, 5);p = os.path.join(sys._getframe(1).f_locals['sitedir'], *('zope',));importlib = has_mfs and __import__('importlib.util');has_mfs and __import__('importlib.machinery');m = has_mfs and sys.modules.setdefault('zope', importlib.util.module_from_spec(importlib.machinery.PathFinder.find_spec('zope', [os.path.dirname(p)])));m = m or not has_mfs and sys.modules.setdefault('zope', types.ModuleType('zope'));mp = (m or []) and m.__dict__.setdefault('__path__',[]);(p not in mp) and mp.append(p)
import sys, types, os;has_mfs = sys.version_info > (3, 5);p = os.path.join(sys._getframe(1).f_locals['sitedir'], *('zope',));importlib = has_mfs and __import__('importlib.util');has_mfs and __import__('importlib.machinery');m = has_mfs and sys.modules.setdefault('zope', importlib.util.module_from_spec(importlib.machinery.PathFinder.find_spec('zope', [os.path.dirname(p)])));m = m or not has_mfs and sys.modules.setdefault('zope', types.ModuleType('zope'));mp = (m or []) and m.__dict__.setdefault('__path__',[]);(p not in mp) and mp.append(p)
import sys, types, os;has_mfs = sys.version_info > (3, 5);p = os.path.join(sys._getframe(1).f_locals['sitedir'], *('zope',));importlib = has_mfs and __import__('importlib.util');has_mfs and __import__('importlib.machinery');m = has_mfs and sys.modules.setdefault('zope', importlib.util.module_from_spec(importlib.machinery.PathFinder.find_spec('zope', [os.path.dirname(p)])));m = m or not has_mfs and sys.modules.setdefault('zope', types.ModuleType('zope'));mp = (m or []) and m.__dict__.setdefault('__path__',[]);(p not in mp) and mp.append(p)
import sys, types, os;has_mfs = sys.version_info > (3, 5);p = os.path.join(sys._getframe(1).f_locals['sitedir'], *('zope',));importlib = has_mfs and __import__('importlib.util');has_mfs and __import__('importlib.machinery');m = has_mfs and sys.modules.setdefault('zope', importlib.util.module_from_spec(importlib.machinery.PathFinder.find_spec('zope', [os.path.dirname(p)])));m = m or not has_mfs and sys.modules.setdefault('zope', types.ModuleType('zope'));mp = (m or []) and m.__dict__.setdefault('__path__',[]);(p not in mp) and mp.append(p)
import sys, types, os;has_mfs = sys.version_info > (3, 5);p = os.path.join(sys._getframe(1).f_locals['sitedir'], *('zope',));importlib = has_mfs and __import__('importlib.util');has_mfs and __import__('importlib.machinery');m = has_mfs and sys.modules.setdefault('zope', importlib.util.module_from_spec(importlib.machinery.PathFinder.find_spec('zope', [os.path.dirname(p)])));m = m or not has_mfs and sys.modules.setdefault('zope', types.ModuleType('zope'));mp = (m or []) and m.__dict__.setdefault('__path__',[]);(p not in mp) and mp.append(p)

In Setuptools 31, we added support for develop-installed packages to also install one of these -nspkg.pth files, additionally including its path in zope.__path__, which is why the tox usedevelop workaround works.

But even with src added to sys.path, Python doesn't have a hook to ensure that directory is included in the __path__ for zope. So everything above is as expected.

The question that remains - should the test command get involved in manipulating paths in order to ensure this project is on the path (and moreover, preferred to any installed version). The extant code and past expectation suggest it should be supported, so I'll dig a little deeper to see if that code segment could be doing something differently to support that expectation.

@jaraco
Copy link
Member

jaraco commented Jan 14, 2017

I spent some time tracing the behavior and I was able to replicate the error prior to the tests starting. For posterity, here's what I found:

$ .tox/clean/bin/python -m pdb setup.py test
> /Users/jaraco/Dropbox/code/public/zope.configuration/setup.py(20)<module>()
-> import os
(Pdb) b setuptools/command/test.py:151
Breakpoint 1 at /Users/jaraco/Dropbox/code/public/zope.configuration/.tox/clean/lib/python3.6/site-packages/setuptools/command/test.py:151
(Pdb) c
running test
running egg_info
writing src/zope.configuration.egg-info/PKG-INFO
writing dependency_links to src/zope.configuration.egg-info/dependency_links.txt
writing namespace_packages to src/zope.configuration.egg-info/namespace_packages.txt
writing requirements to src/zope.configuration.egg-info/requires.txt
writing top-level names to src/zope.configuration.egg-info/top_level.txt
reading manifest file 'src/zope.configuration.egg-info/SOURCES.txt'
reading manifest template 'MANIFEST.in'
warning: no previously-included files matching '*.pyc' found anywhere in distribution
writing manifest file 'src/zope.configuration.egg-info/SOURCES.txt'
running build_ext
> /Users/jaraco/Dropbox/code/public/zope.configuration/.tox/clean/lib/python3.6/site-packages/setuptools/command/test.py(151)project_on_sys_path()
-> working_set.__init__()
(Pdb) project_path
'/Users/jaraco/Dropbox/code/public/zope.configuration/src'
(Pdb) sys.path
['/Users/jaraco/Dropbox/code/public/zope.configuration/src', '', '/Library/Frameworks/Python.framework/Versions/3.6/lib/python36.zip', '/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6', '/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/lib-dynload', '/Users/jaraco/Dropbox/code/public/zope.configuration/.tox/clean/lib/python3.6/site-packages']
(Pdb) working_set
<pkg_resources.WorkingSet object at 0x103588a90>
(Pdb) working_set.entries
['', '/Library/Frameworks/Python.framework/Versions/3.6/lib/python36.zip', '/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6', '/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/lib-dynload', '/Users/jaraco/Dropbox/code/public/zope.configuration/.tox/clean/lib/python3.6/site-packages']
(Pdb) n
> /Users/jaraco/Dropbox/code/public/zope.configuration/.tox/clean/lib/python3.6/site-packages/setuptools/command/test.py(152)project_on_sys_path()
-> add_activation_listener(lambda dist: dist.activate())
(Pdb) working_set.entries
['/Users/jaraco/Dropbox/code/public/zope.configuration/src', '', '/Library/Frameworks/Python.framework/Versions/3.6/lib/python36.zip', '/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6', '/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/lib-dynload', '/Users/jaraco/Dropbox/code/public/zope.configuration/.tox/clean/lib/python3.6/site-packages']
(Pdb) working_set.callbacks
[]
(Pdb) n
> /Users/jaraco/Dropbox/code/public/zope.configuration/.tox/clean/lib/python3.6/site-packages/setuptools/command/test.py(153)project_on_sys_path()
-> require('%s==%s' % (ei_cmd.egg_name, ei_cmd.egg_version))
(Pdb) working_set.callbacks
[<function test.project_on_sys_path.<locals>.<lambda> at 0x103a59730>]
(Pdb) ei_cmd.egg_name
'zope.configuration'
(Pdb) ei_cmd.egg_version
'4.1.0.dev0'
(Pdb) s
--Call--
> /Users/jaraco/Dropbox/code/public/zope.configuration/.tox/clean/lib/python3.6/site-packages/pkg_resources/__init__.py(954)require()
-> def require(self, *requirements):
(Pdb) n
> /Users/jaraco/Dropbox/code/public/zope.configuration/.tox/clean/lib/python3.6/site-packages/pkg_resources/__init__.py(963)require()
-> needed = self.resolve(parse_requirements(requirements))
(Pdb) n
> /Users/jaraco/Dropbox/code/public/zope.configuration/.tox/clean/lib/python3.6/site-packages/pkg_resources/__init__.py(965)require()
-> for dist in needed:
(Pdb) needed
[zope.configuration 4.1.0.dev0 (/Users/jaraco/Dropbox/code/public/zope.configuration/src), setuptools 32.3.1 (/Users/jaraco/Dropbox/code/public/zope.configuration/.tox/clean/lib/python3.6/site-packages), zope.schema 4.4.2 (/Users/jaraco/Dropbox/code/public/zope.configuration/.tox/clean/lib/python3.6/site-packages), zope.interface 4.3.3 (/Users/jaraco/Dropbox/code/public/zope.configuration/.tox/clean/lib/python3.6/site-packages), zope.i18nmessageid 4.0.3 (/Users/jaraco/Dropbox/code/public/zope.configuration/.tox/clean/lib/python3.6/site-packages), zope.interface 4.3.3 (/Users/jaraco/Dropbox/code/public/zope.configuration/.tox/clean/lib/python3.6/site-packages), zope.event 4.2.0 (/Users/jaraco/Dropbox/code/public/zope.configuration/.tox/clean/lib/python3.6/site-packages)]
(Pdb) n
> /Users/jaraco/Dropbox/code/public/zope.configuration/.tox/clean/lib/python3.6/site-packages/pkg_resources/__init__.py(966)require()
-> self.add(dist)
(Pdb) s
--Call--
> /Users/jaraco/Dropbox/code/public/zope.configuration/.tox/clean/lib/python3.6/site-packages/pkg_resources/__init__.py(758)add()
-> def add(self, dist, entry=None, insert=True, replace=False):
(Pdb) n
> /Users/jaraco/Dropbox/code/public/zope.configuration/.tox/clean/lib/python3.6/site-packages/pkg_resources/__init__.py(770)add()
-> if insert:
(Pdb) n
> /Users/jaraco/Dropbox/code/public/zope.configuration/.tox/clean/lib/python3.6/site-packages/pkg_resources/__init__.py(771)add()
-> dist.insert_on(self.entries, entry, replace=replace)
(Pdb) orig_entries = list(self.entries)
(Pdb) n
> /Users/jaraco/Dropbox/code/public/zope.configuration/.tox/clean/lib/python3.6/site-packages/pkg_resources/__init__.py(773)add()
-> if entry is None:
(Pdb) orig_entries == self.entries
True
(Pdb) n
> /Users/jaraco/Dropbox/code/public/zope.configuration/.tox/clean/lib/python3.6/site-packages/pkg_resources/__init__.py(774)add()
-> entry = dist.location
(Pdb) n
> /Users/jaraco/Dropbox/code/public/zope.configuration/.tox/clean/lib/python3.6/site-packages/pkg_resources/__init__.py(775)add()
-> keys = self.entry_keys.setdefault(entry, [])
(Pdb) self.entry_keys[entry]
['zope.configuration']
(Pdb) n
> /Users/jaraco/Dropbox/code/public/zope.configuration/.tox/clean/lib/python3.6/site-packages/pkg_resources/__init__.py(776)add()
-> keys2 = self.entry_keys.setdefault(dist.location, [])
(Pdb) n
> /Users/jaraco/Dropbox/code/public/zope.configuration/.tox/clean/lib/python3.6/site-packages/pkg_resources/__init__.py(777)add()
-> if not replace and dist.key in self.by_key:
(Pdb) n
> /Users/jaraco/Dropbox/code/public/zope.configuration/.tox/clean/lib/python3.6/site-packages/pkg_resources/__init__.py(779)add()
-> return
(Pdb) dist.key
'zope.configuration'
(Pdb) self.by_key[dist.key]
zope.configuration 4.1.0.dev0 (/Users/jaraco/Dropbox/code/public/zope.configuration/src)
(Pdb) n
--Return--
> /Users/jaraco/Dropbox/code/public/zope.configuration/.tox/clean/lib/python3.6/site-packages/pkg_resources/__init__.py(779)add()->None
-> return
(Pdb) n
> /Users/jaraco/Dropbox/code/public/zope.configuration/.tox/clean/lib/python3.6/site-packages/pkg_resources/__init__.py(965)require()
-> for dist in needed:
(Pdb) r
--Return--
> /Users/jaraco/Dropbox/code/public/zope.configuration/.tox/clean/lib/python3.6/site-packages/pkg_resources/__init__.py(968)require()->[zope.configur...iguration/src), setuptools 32...site-packages), zope.schema 4...site-packages), zope.interfac...site-packages), zope.i18nmess...site-packages), zope.interfac...site-packages), ...]
-> return needed
(Pdb) n
> /Users/jaraco/Dropbox/code/public/zope.configuration/.tox/clean/lib/python3.6/site-packages/setuptools/command/test.py(154)project_on_sys_path()
-> with self.paths_on_pythonpath([project_path]):
(Pdb) n
> /Users/jaraco/Dropbox/code/public/zope.configuration/.tox/clean/lib/python3.6/site-packages/setuptools/command/test.py(155)project_on_sys_path()
-> yield
(Pdb) import sys
(Pdb) sys.modules['zope']
<module 'zope' from '/Users/jaraco/Dropbox/code/public/zope.configuration/src/zope/__init__.py'>
(Pdb) import zope.interface
*** ModuleNotFoundError: No module named 'zope.interface'

@jaraco
Copy link
Member

jaraco commented Jan 14, 2017

I've found I can also replicate the error thus:

$ .tox/clean/bin/python 
Python 3.6.0 (v3.6.0:41df79263a11, Dec 22 2016, 17:23:13) 
[GCC 4.2.1 (Apple Inc. build 5666) (dot 3)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import sys
>>> sys.path.insert(0, 'src')
>>> import pkg_resources
>>> import zope.configuration
>>> zope.configuration.__file__
'src/zope/configuration/__init__.py'
>>> import zope.interface
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ModuleNotFoundError: No module named 'zope.interface'

Here, it seems the import of pkg_resources is somehow interfering with the way Python imports namespace packages, and there's probably something pkg_resources can do.

@jaraco
Copy link
Member

jaraco commented Feb 9, 2017

Revisiting my latest finding above, I don't think that demonstration has any value at all because it's not somehow incorporating the zope.interface egg.

Incorporating that egg on sys.path, it does appear to work just fine.

$ .tox/clean/bin/python
Python 3.6.0 (v3.6.0:41df79263a11, Dec 22 2016, 17:23:13) 
[GCC 4.2.1 (Apple Inc. build 5666) (dot 3)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import sys
>>> sys.path.insert(0, 'src')
>>> sys.path.insert(0, '.eggs/zope.interface-4.3.3-py3.6-macosx-10.6-intel.egg')
>>> import pkg_resources
>>> import zope.configuration
>>> import zope.interface
>>> zope.__path__
['/Users/jaraco/Dropbox/code/public/zope/zope.configuration/.eggs/zope.interface-4.3.3-py3.6-macosx-10.6-intel.egg/zope', '/Users/jaraco/Dropbox/code/public/zope/zope.configuration/src/zope']

@jaraco
Copy link
Member

jaraco commented Feb 9, 2017

So once again I'm stuck not fully understanding what it is about the test runner that's breaking the import... I may be able to investigate more later but for now I'm stuck.

@warsaw
Copy link
Contributor

warsaw commented Feb 9, 2017

FWIW, I just ran into this problem with lazr.config:

http://lists.idyll.org/pipermail/testing-in-python/2017-February/007001.html

I solved it differently in my case. I stopped using python setup.py test in my tox.ini and moved the package dir in the source repo to under a src/ directory, but I also had to stop nose from touching sys.path.

It's very perplexing!

@mgorny
Copy link
Contributor

mgorny commented Apr 30, 2017

Yes, It's also frustrating for Gentoo packaging. We already had to implement one workaround for namespaces in the past, and now it turns out we need a second one.

@FRidh
Copy link

FRidh commented May 28, 2017

Possibly related. Some time after we also had an issue with configparser, which is a namespace package but that combined pkg_util and pkg_resources. We patched configparser to only use pkg_util and its working since. https://bitbucket.org/ambv/configparser/issues/17/#comment-36669436

@warsaw maybe that's a fix for your issue?

@mwhudson
Copy link

mwhudson commented Jul 4, 2017

So I encountered this too and my impression as to why this is failing is that it's because the namespace package's __path__ ends up being a importlib._bootstrap_external._NamespacePath object with Python 3.5 and 3.6 and there is an isinstance(path, list) in pkg_resources at https://github.com/pypa/setuptools/blob/master/pkg_resources/__init__.py#L2128 that prevents the __path__ being modified in some way that seems to be important (my guess is that it means the if _normalize_cached(item)==normalized: condition in file_ns_handler never fires, but I'm waaaaay past the point where I understand what's going on now).

@FRidh
Copy link

FRidh commented Oct 23, 2019

In Nixpkgs we recently changed the way we install setuptools from egg to wheel. All packages, including setuptools are explicitly on PYTHONPATH during installation. Importing namespace packages such as zope however fails in case of Python 2.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Needs Triage Issues that need to be evaluated for severity and status.
Projects
None yet
Development

No branches or pull requests

8 participants