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

Assertion rewriting does not work in packages. #68

Closed
pytestbot opened this issue Aug 29, 2011 · 1 comment
Closed

Assertion rewriting does not work in packages. #68

pytestbot opened this issue Aug 29, 2011 · 1 comment
Labels
type: bug problem that needs to be addressed

Comments

@pytestbot
Copy link
Contributor

Originally reported by: Michał Bartoszkiewicz (BitBucket: embe, GitHub: embe)


Assertion rewriting seems inactive in modules that reside in a package.

pkg/test_foo.py, containing:

#!python
from StringIO import StringIO
def test_foo():
    s = StringIO('foo')
    assert s.read() == ''

fails with "AssertionError: (assertion failed, but when it was re-run for printing intermediate values, it did not fail. Suggestions: compute assert expression before the assert or use --assert=plain)" when pkg/init.py exists, but with "assert 'foo' == ''" when it is deleted.


@pytestbot
Copy link
Contributor Author

Original comment by Benjamin Peterson (BitBucket: gutworth, GitHub: gutworth):


only use the last part of the module name in the filename (fixes #68)

@pytestbot pytestbot added the type: bug problem that needs to be addressed label Jun 15, 2015
fkohlgrueber pushed a commit to fkohlgrueber/pytest that referenced this issue Oct 27, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: bug problem that needs to be addressed
Projects
None yet
Development

No branches or pull requests

1 participant