-
-
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
Assertion rewrite should match files completely and avoid rewriting setup.py #2939
Comments
Ad _should_rewrite: when I think about it, it should either be exact match or it should start with the thing plus dot. |
Heh exactly what I came up with. 😁 I will open a PR shortly. |
diff --git a/_pytest/assertion/rewrite.py b/_pytest/assertion/rewrite.py
index d48b664..27026b0 100644
--- a/_pytest/assertion/rewrite.py
+++ b/_pytest/assertion/rewrite.py
@@ -168,7 +168,7 @@ class AssertionRewritingHook(object):
return True
for marked in self._must_rewrite:
- if name.startswith(marked):
+ if name == marked or name.startswith(marked + '.'):
state.trace("matched marked file %r (from %r)" % (name, marked))
return True 😉 I'm finishing up the test. |
Note that blacklisting setup.py from _pytest.config._mark_plugins_for_rewrite is not needed anymore to fix this particular problem, but I'd still rather do it, because having it there can bring other problems some day. |
Hmm not sure about |
Ok, not blacklist it, but reconsider the code that produces it as it's result for sdist installed packages. (I cannot reopen, not my issue) |
I see, it makes sense to ignore |
Quoting @hroncok in pypa/setuptools#1170:
The text was updated successfully, but these errors were encountered: