-
-
Notifications
You must be signed in to change notification settings - Fork 2.7k
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
Importing anydbm within pytest fails #2248
Comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
When trying to import the
anydbm
module from within pytest on a machine that does not havebsddb
installed, the import will fail. This appears to be becauseanydbm
tries to importdbhash
which importsbsddb
. Ifbsddb
is not present on the machine, this fails with anImportError
, whichanydbm
catches and silences.pytest
, importing a module is overridden byload_module
in _pytest/assertion/rewrite.pydbhash
fails, it tries todel sys.modules['dbhash']
but this throws a KeyError since'dbhash'
is not present insys.modules
anydbm
fails to catch theKeyError
since it is expectingImportError
Observed in pytest 3.0.5 on both OS X and Ubuntu.
This can be reproduced by including
import anydbm
in any test file. For exampleThis error occurs:
The text was updated successfully, but these errors were encountered: