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

Parameter corruption for parameterized tests #1843

Closed
4 tasks
prot0man opened this issue Aug 22, 2016 · 2 comments
Closed
4 tasks

Parameter corruption for parameterized tests #1843

prot0man opened this issue Aug 22, 2016 · 2 comments

Comments

@prot0man
Copy link

It looks like between pytest 2.9.2 and 3.0.0, some change has been introduced that causes incorrect values to be passed to parameterized tests. For instance, given the two tests:

@pytest.mark.parametrize("xid, fromPath, toPath, result", [
("xid1", "/usr/bin/who", "/tmp/who", True),
])
def testFileXferLocal(network, xid, fromPath, toPath, result):
...

AND
@pytest.mark.parametrize("xid, fromPath, toPath, result", [
("xid3-1","/tmp/fwd-test-dir-copy", "/tmp/fwd-output-dir-copy", True)
])
def testFolderXferLocal(network, xid, fromPath, toPath, result):
...

The value '/usr/bin/who' is being passed to our test 'testFolderXferLocal' for 'fromPath' instead of the expected '/tmp/fwd-test-dir-copy'.

The version of pytest that works correctly is 2.9.2, while pytest 3.0.0 causes the erroneus behavior described.

Thanks for submitting an issue!

Here's a quick checklist in what to include:

  • Include a detailed description of the bug or suggestion
  • pip list of the virtual environment you are using
  • pytest and operating system versions
  • Minimal example if possible
@The-Compiler
Copy link
Member

Closing as a duplicate of #1832 - we'll hopefully have a fix ready and release a 3.0.1 soon.

As a workaround, you can add an autouse function-scoped fixture to your conftest.py, like in qutebrowser/qutebrowser@bd1c63e

@prot0man
Copy link
Author

That was quick! Thanks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants