-
Notifications
You must be signed in to change notification settings - Fork 39
Strange test name, used idstyle=None #154
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
the P2toP3 means "from parameter 2 to parameter 3". However I'm not sure it is supposed to appear when idstyle is None. Also when idstyle is not none, it is a bit strange that "inputs_request_data_is_" is not present in all ids ? I'll try to reproduce this one of these days and check what happens. Do you confirm that the usefixtures mark behaves correctly here ? |
Usefixtures mark works correctly. |
Here is a summary of the mess. I modded your example to reference a parametrized fixture too. To convert it into a list of facts for current
|
Proposed solutions so far:
Pending questions:
|
- added an `alternative_index` attribute in `UnionFixtureAlternative` and uniformized the id making process for fixture unions and parametrize alternatives. - in particular added an `id` argument to `fixture_ref` and filled this `id` in `@parametrize_with_cases` so that the id is always the one from the case_id
I have done most of the harmonization work now with #155 The last thing that needs to be settled is the templates for the id styles. Indeed I feel that they could be improved to be more explicit. Here is a proposal using slash
What do you think about this ? any other suggestion welcome. I also thought about putting the index numbers in brackets |
@plammens you might have an opinion on this last comment ? do not hesitate to jump in :) |
Thanks for your hard work. I don't really understand why the name of the test should change if there is a fixture in the arguments of the case function but it is not parameterized? |
Personally I find these aspects of the current naming system confusing:
My stance can be summarised as "introduce more symbols and alternative notations in order to make each have a(n almost) unique meaning, so that the test node id string can become more compact and readable" 🙂 So, to put everything I've said into a single example, it would look something like this:
In any case what you've proposed, @smarie, is already a great improvement, I would say. These are just my personal itches :) |
Hello. What is the status of the issue? |
Thanks to both of you for the feedback ! I am finalizing a PR with the following principles:
|
Finally, all tests pass of all versions of python and pytest: https://travis-ci.com/github/smarie/python-pytest-cases/builds/209061483 . I'll merge this PR #155 and release version 2.8.0 in a few minutes. I opened an issue on pytest because it was quite hard to make the extra useless id from the multi-param fixture disappear in pytest 5.4+ : pytest-dev/pytest#8155 Please let me know of any feedback about the new id system ! Thanks again to both of you for challenging me with this topic, that was the "less interesting" in terms of test running mechanism but was extremely challenging to get done properly including all combinations of custom ids and marks everywhere (and all versions of python and pytest) |
3.0.0 released (I finally chose to make it a major version bump since it was quite a major refactoring!). Let me know ! |
Thank you very much, we are working on) |
Yes, thank you for all the hard work @smarie ! |
You're welcome. Completing this made me realize that there is still progress to do in terms of simplification, I opened #170 . Double-thanks to both of you for taking time to try the features and let me know of the issues ! |
Uh oh!
There was an error while loading. Please reload this page.
Python 3.6.8
pytest-6.1.2
cases-2.7.1
After solving problem #151, some tests took the name from
@case(id)
, but others began to look strange.Example:
test_file
db, flaskClient, clearMongo, mocked_oid, mocked_uuid - fixtures
case file
Names:
test_create[current_object]
test_create[not_valid]
test_create[test_create_inputs_request_data_is_P2toP3-history_object] ?? fixture validationOff not used
test_create[test_create_inputs_request_data_is_P2toP3-xml_without_need_namespace] ?? fixture validationOff not used
test_create[xml_without_need_namespace_not_valid]
test_create[xml_without_need_name]
test_create[xml_without_need_name_not_valid]
test_create[xml_invalid]
Without
idstyle=None
names:test_create[current_object]
test_create[inputs_request_data_is_not_valid]
test_create[inputs_request_data_is_P2toP3-history_object] ?? fixture validationOff not used
test_create[inputs_request_data_is_P2toP3-xml_without_need_namespace] ?? fixture validationOff not used
test_create[inputs_request_data_is_xml_without_need_namespace_not_valid]
test_create[xml_without_need_name]
test_create[inputs_request_data_is_xml_without_need_name_not_valid]
test_create[xml_invalid]
The text was updated successfully, but these errors were encountered: