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

TypeError in sandbox tests #860

Closed
jaraco opened this issue Nov 26, 2016 · 8 comments
Closed

TypeError in sandbox tests #860

jaraco opened this issue Nov 26, 2016 · 8 comments

Comments

@jaraco
Copy link
Member

jaraco commented Nov 26, 2016

About a week ago, tests started failing like so with errors in hide_setuptools when module names are 'None'.

@jaraco
Copy link
Member Author

jaraco commented Nov 26, 2016

I'm able to replicate the failures locally, but not against v28.8.0, so it appears to be a regression with some commit preceding the release of v28.9.0. The failure doesn't occur if I run tests with -k test_sandbox, so the failures seem to have some interaction with other tests.

@jaraco
Copy link
Member Author

jaraco commented Nov 26, 2016

Well, I was able to replicate it locally, but now I'm not, even against master, and even when I run the whole test suite. I'm not sure what's going on.

@jaraco
Copy link
Member Author

jaraco commented Nov 29, 2016

Running the test now, I'm getting the failure again. I think perhaps I hadn't properly gotten back to master.

I can replicate the test failure running only the tests from two files:

python -m tox -- -k 'test_sandbox or test_namespaces' 

@jaraco
Copy link
Member Author

jaraco commented Nov 29, 2016

When it fails, there's a pseudo module in sys.modules[None]:

(Pdb) l
225  	    invocation to import the most appropriate setuptools. This technique is
226  	    necessary to avoid issues such as #315 where setuptools upgrading itself
227  	    would fail to find a function declared in the metadata.
228  	    """
229  	    modules = filter(_needs_hiding, sys.modules)
230  ->	    _clear_modules(modules)
231  	
232  	
233  	def run_setup(setup_script, args):
234  	    """Run a distutils setup script, sandboxed in its directory"""
235  	    setup_dir = os.path.abspath(os.path.dirname(setup_script))
(Pdb) sys.modules[None]
<module '_pycodecompile_pseudo_module' (1)>

@jaraco
Copy link
Member Author

jaraco commented Nov 30, 2016

It appears to me that code is being injected by pytest here. It seems that code has been around a long time, so it's only now that it's been triggered, presumably by something in the new test_namespaces.py.

@jaraco
Copy link
Member Author

jaraco commented Nov 30, 2016

If I remove the pytest skip, the issue doesn't occur.

$ git diff
diff --git a/setuptools/tests/test_namespaces.py b/setuptools/tests/test_namespaces.py
index 21fd69e..c148577 100644
--- a/setuptools/tests/test_namespaces.py
+++ b/setuptools/tests/test_namespaces.py
@@ -13,8 +13,6 @@ class TestNamespaces:
 
     @pytest.mark.xfail(sys.version_info < (3, 3),
         reason="Requires PEP 420")
-    @pytest.mark.skipif('os.environ.get("APPVEYOR")',
-        reason="https://github.com/pypa/setuptools/issues/851")
     def test_mixed_site_and_non_site(self, tmpdir):
         """
         Installing two packages sharing the same namespace, one installed
$ 

@jaraco
Copy link
Member Author

jaraco commented Nov 30, 2016

That explains why the tests started failing recently -- that behavior was added in e8d53c0.

@jaraco
Copy link
Member Author

jaraco commented Nov 30, 2016

Bypassing the string-style expression in the skip condition bypasses the issue, now reported upstream.

@jaraco jaraco closed this as completed Nov 30, 2016
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

1 participant