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
Tests failing with latest backports.unittest_mock #1038
Comments
Looking first at the two failures causing a SandboxViolation, the traceback looks like this:
The first thing I notice is that the attempted import is
And that package isn't installed, so I would expect that call to raise an ImportError, but before that happens, the pytest assertion rewrite triggers a sandbox violation. |
The fact that code is being reached by the rewrite logic suggests that pytest thinks the module is a module under test requiring rewriting. |
The issue seems to be related to pytest thinking
|
Backports ends up there when the |
Aah. The reason the other tests aren't failing is because only on Python 2.6 and (presumably) pypy as found on Travis does the fallback to backports.ssl_match_hostname happen in ssl_support. On Python 2.7 and later, the imports happen from the |
So then the question becomes - why with backports.unittest_mock 1.2 does the issue not occur? With 1.2, the This leads me to believe that any package that installs backports.unittest_mock and imports any backports module in its tests or under its tests will fail with this same error. So then the question becomes - what is pytest doing and should |
I was wrong. I tried to replicate the issue in a clean environment and could not. That's because there's a third factor - the sandboxing logic. |
Setuptools is getting out of the business of managing environments, so the sandboxing logic should be obsolete soon. I'm closing this. |
Following the report in jaraco/backports.functools_lru_cache#9, I went through the six backports modules I maintain and updated them accordingly. This effort led to the release of backports.unittest_mock 1.3, the presence of which is triggering three new test failures on Python 2.6 and pypy. Pinning to backports.unittest_mock 1.2 works around the issue.
The text was updated successfully, but these errors were encountered: