-
-
Notifications
You must be signed in to change notification settings - Fork 2.8k
Question: Can the parametrization separator be changed? #3617
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
Comments
GitMate.io thinks possibly related issues are #3273 (Question: How can I parameterize my tests with global variable which changes values on runtime.), #3601 ((question) Cleaning up from parameter generation), #249 (document and/or change display of parametrization values in IDs), #531 (Problems with fixture parametrization), and #3320 ([question] Multithreaded support in a function). |
currently the dash is hardcoded, can you outline your use-case? |
Test names are the source of several reports I use, trying to make it a little more readable. Hardly a major issue. I could try to do this myself if you guys think there's merit to it, been wanting to contribute to pytest directly. Maybe |
at first glance this reads like a feature that doesnt add the value that justifies the extra complexity needed |
Well, not having a clue about the added complexity I cannot comment on that, but I believe that any ability to customize the visibility of the results can be very useful. If you do decide to deem this issue as worthy, I'd be happy to take a stab at it. |
I'd also like to be able to change the separator. In my framework, I'm having to monkeypatch pytest, so I can get commas instead of dashes. Example of a test name before:
Add in a pytest_make_parametrize_id that returns
To me, that name looks like After monkey-patching pytest to use commas:
Re-add the pytest_make_parametrize_id:
Example monkey-patch, on pytest 3.6.1:
|
I share @RonnyPfannschmidt's worry about increasing pytest's code complexity, but seems We have a An ini option has two problems:
|
I also realize that I don't remember why I monkey-patched both of those functions. I'd imagine the two are used in different places, but I don't recall precisely where for each. |
since iths is about reporting why do we think about making the internals more complex instead allowing more information for reporting - neither reporting nor the internals are well served by a hook to make the ids dynamic in that particular way |
It is not clear what you mean here @RonnyPfannschmidt, could you please clarify this a bit? I think you are on to something here. |
Stuff like exposing parameter values in a mapping that people can use |
I see, for example a mapping on the Item itself with the parametrized parameters for that item? I see where you are getting at, you are absolutely right. |
The test IDs themselves are used in the TerminalReporter and in Junit reporting, so if we don't change the actual test IDs, we'll need ways to customize every single plugin that uses test IDs. An alternate approach, if a hook is too complicated: move the separator character into a documented attribute of the Config object. Perhaps you could allow overriding at the instance level, by defining it as a class attribute and then accessing it via |
Closing this as inactive / wontfix: while it's certainly useful in some cases, it has tricky interactions with enough other functionality (including plugins) that the overall impact seems negative 😢 |
This issue's status as What is the status of this feature currently? I too would find it useful, albeit not critical. |
Good to know - TIL! |
Is it possible to change the parameterization separator from dash to another char? Couldn't find the answer, I apologize if it exist.
On a side note, I've been a pytest user both professionally and in open source capacity for years now, and I absolutely love it. You guys created an icon in the software development world.
The text was updated successfully, but these errors were encountered: