Merge pull request #2249 from pfhayes/anydbmfix

Fix importing anydbm within pytest
This commit is contained in:
Bruno Oliveira 2017-03-01 14:41:31 -03:00 committed by GitHub
commit 5721d8aed1
3 changed files with 11 additions and 1 deletions

View File

@ -113,6 +113,7 @@ Nicolas Delaby
Oleg Pidsadnyi Oleg Pidsadnyi
Oliver Bestwalter Oliver Bestwalter
Omar Kohl Omar Kohl
Patrick Hayes
Pieter Mulder Pieter Mulder
Piotr Banaszkiewicz Piotr Banaszkiewicz
Punyashloka Biswal Punyashloka Biswal

View File

@ -1,6 +1,12 @@
3.0.7 (unreleased) 3.0.7 (unreleased)
================== ==================
* Fix issue in assertion rewriting breaking due to modules silently discarding
other modules when importing fails
Notably, importing the `anydbm` module is fixed. (`#2248`_).
Thanks `@pfhayes`_ for the PR.
* junitxml: Fix problematic case where system-out tag occured twice per testcase * junitxml: Fix problematic case where system-out tag occured twice per testcase
element in the XML report. Thanks `@kkoukiou`_ for the PR. element in the XML report. Thanks `@kkoukiou`_ for the PR.
@ -30,12 +36,14 @@
* *
.. _@pfhayes: https://github.com/pfhayes
.. _@bluetech: https://github.com/bluetech .. _@bluetech: https://github.com/bluetech
.. _@gst: https://github.com/gst .. _@gst: https://github.com/gst
.. _@sirex: https://github.com/sirex .. _@sirex: https://github.com/sirex
.. _@vidartf: https://github.com/vidartf .. _@vidartf: https://github.com/vidartf
.. _@kkoukiou: https://github.com/KKoukiou .. _@kkoukiou: https://github.com/KKoukiou
.. _#2248: https://github.com/pytest-dev/pytest/issues/2248
.. _#2137: https://github.com/pytest-dev/pytest/issues/2137 .. _#2137: https://github.com/pytest-dev/pytest/issues/2137
.. _#2160: https://github.com/pytest-dev/pytest/issues/2160 .. _#2160: https://github.com/pytest-dev/pytest/issues/2160
.. _#2231: https://github.com/pytest-dev/pytest/issues/2231 .. _#2231: https://github.com/pytest-dev/pytest/issues/2231

View File

@ -215,6 +215,7 @@ class AssertionRewritingHook(object):
mod.__loader__ = self mod.__loader__ = self
py.builtin.exec_(co, mod.__dict__) py.builtin.exec_(co, mod.__dict__)
except: except:
if name in sys.modules:
del sys.modules[name] del sys.modules[name]
raise raise
return sys.modules[name] return sys.modules[name]