-
-
Notifications
You must be signed in to change notification settings - Fork 2.8k
fix issue #1618 by considering plugin args first #1673
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
Changes from all commits
f33da43
8a4b00d
3c246f5
64cd2f1
5f61109
9e19507
2592c26
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -79,7 +79,7 @@ def test_confcutdir(self, testdir): | |
""") | ||
result = testdir.inline_run("--confcutdir=.") | ||
assert result.ret == 0 | ||
|
||
class TestConfigCmdlineParsing: | ||
def test_parsing_again_fails(self, testdir): | ||
config = testdir.parseconfig() | ||
|
@@ -352,6 +352,25 @@ def test_inifilename(self, tmpdir): | |
assert config.inicfg.get('name') == 'value' | ||
assert config.inicfg.get('should_not_be_set') is None | ||
|
||
@pytest.mark.issue1618 | ||
def test_consider_plugin(self, testdir): | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Please mention #1618 on the docstring. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Also, when creating commit messages you can add a line "Fix #1618" so it closes the issue automatically when merged. |
||
pytest.importorskip('xdist') | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This test failed in CI, but only on There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. the test itself requires xdist, since the bug is triggered in config.from_dictargs There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. the more interesting question is - why do these fail on ci, it works in my local test :/ i wonder where my environment is different There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Are you sure? I'm think I tested this fix on a virtual environment without xdist... Oh yes, I remember, I got the same problem and tested your fix just by running There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. i am certain that xdist is currently the only thing triggering the behavior the problem in question is the worker process ignoring the 'no:foo' plugin spec There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Something is wrong then... just tested on a fresh environment, without any plugins. master
RonnyPfannschmidt:fix-1618
That was on Python 2.7.
Should be I also executed your test on my new environment, and it passes if I don't have import pytest
pytest_plugins = ['pytester']
def test_consider_plugin(testdir):
# pytest.importorskip('xdist')
print (testdir)
testdir.makepyfile(conftest="""
pytest_plugins = ['plugin']
""",
plugin="""
raise ImportError
""",
test_foo="""
def test():
pass
""",
)
res = testdir.inline_run(
#'-n1',
'-p', 'no:plugin')
assert res.ret == 0
The same test fails on master as expected:
So I'm guessing there is something weird with your local environment. |
||
print (testdir) | ||
testdir.makepyfile(conftest=""" | ||
pytest_plugins = ['plugin'] | ||
""", | ||
plugin=""" | ||
raise ImportError | ||
""", | ||
test_foo=""" | ||
def test(): | ||
pass | ||
""", | ||
) | ||
res = testdir.inline_run( | ||
'-n1', | ||
'-p', 'no:plugin') | ||
assert res.res == 0 | ||
|
||
def test_options_on_small_file_do_not_blow_up(testdir): | ||
def runfiletest(opts): | ||
|
@@ -671,4 +690,4 @@ def test_multiple_options(pytestconfig): | |
"ini2:url=/tmp/user2?a=b&d=e", | ||
"ini3:True", | ||
"ini4:False" | ||
]) | ||
]) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could explain this in more detail here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I fear this is too "pytest-internal-specific" and users won't really know what's going on... suggestion:
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is the first time I understand what this PR really solves 😆 👍