question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Parametrized nodeid not matching with parametrized IDs

See original GitHub issue

This is about this issue in pytest-repeat: https://github.com/pytest-dev/pytest-repeat/issues/21

It seems that the bug doesn’t come from the plugin: I managed to reproduce with a simple test here. It affects all pytest versions, at least since 2.8

I wrote a test and a fix attempt here: https://github.com/vbarbaresi/pytest/commit/12769f0d3bda3c53426ba124e89f0072cc0b320b

The issue is the following: with parametrized IDs and parametrized fixtures, one can’t run a test using its node ID with a [parameter] argument

I tracked it down to the x.name vs name matching, which is in my example: test_foo[1-param] vs test_foo[param]

My fix attempt drops everything after [ on both sides. However, we lose the supplied parameter value so it’s not satisfying. I don’t know where to fix this properly.

Issue Analytics

  • State:open
  • Created 5 years ago
  • Reactions:1
  • Comments:10 (7 by maintainers)

github_iconTop GitHub Comments

2reactions
RonnyPfannschmidtcommented, Nov 14, 2018

@blueyed i actually have a fix on the horizon, but it will at least need 3-4 major releases to sort nodes out - given that outline no more ranting needed

0reactions
RonnyPfannschmidtcommented, Feb 11, 2021

nothing new there, after the rest of the path refactoring lands i’m going to work on setting up the function-definition node, afterwards we can do it more easily

Read more comments on GitHub >

github_iconTop Results From Across the Web

`pytest.mark.parametrize` does not correctly hide fixtures of ...
the arg parameter in the test correctly hides the arg fixture so the unique pytest node has id [1] (instead of there being...
Read more >
Is there a way in pytest to get a list of parameterized test ...
I noticed at one point, when calling pytest with --cache-show , that 'cache/nodeids' was being populated with the exact node id information ...
Read more >
Using parameters in routes
Parameters can be used to pass dynamic values from the URI to the controller.
Read more >
ids for fixtures and parametrize - pytest-tricks
It calls a function called fizzbuzz with an integer and checks that its return value matches a certain string. Now when we run...
Read more >
How do I get the current node ID? - Drupal Answers
The parameter will have been upcasted from nid to full node object by the time you get access to it, so:
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found