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

Disable ordinal numbering of tests with a decorator argument #61

Open
interrogator opened this issue Apr 12, 2018 · 2 comments
Open

Disable ordinal numbering of tests with a decorator argument #61

interrogator opened this issue Apr 12, 2018 · 2 comments

Comments

@interrogator
Copy link

interrogator commented Apr 12, 2018

We use a combination of dynamic (ddt) tests and vcr-unittest, which records HTTP requests and replays them when tests are rerun. This is all well and good, but we bump into an issue:

  1. Tests are given names based on arguments plus an ordinal integer
  2. Our set of arguments is always unique, so the integer is not necessary
  3. When tests are run, vcr saves them based on test name with the ordinal
  4. When a new test gets added, all the ordinals get changed, causing git armageddon on hundreds of files with slight changes

It would therefore be awesome if we could specify that we do not want ordinal numbers appended:

@data(*datapoints, ordinal=False)
def f(x, y, z):
    pass

The argument name could be anything, ordinal, suppress_ordinal, or even unique=True, meaning that all test names are unique and thus that ordinals aren't necessary.

Currently we just monkey patch mk_test_name, but shouldn't do this because it causes other issues later.

@interrogator
Copy link
Author

I guess another nice approach would be a nice decorator that allowed a format string for the test name, or something like that

@wswld
Copy link
Contributor

wswld commented Aug 29, 2018

Greetings. Do you still need this feature? Would you like to step in and provide a pull request for this?

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

No branches or pull requests

2 participants