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

tag_name option doesn't work in .bumpversion.cfg #9

Closed
kezabelle opened this issue Aug 1, 2013 · 10 comments
Closed

tag_name option doesn't work in .bumpversion.cfg #9

kezabelle opened this issue Aug 1, 2013 · 10 comments

Comments

@kezabelle
Copy link

Using a .bumpversion.cfg like the below, and doing bumpversion minor

[bumpversion]
commit = True
tag = True
tag_name = "{new_version}"

the tag_name argument as specified in the README.rst has no effect - it goes into parser2 as a default correctly, but somewhere along the lines it gets reset to the global default ("v{new_version}") so that when vcs.tag(args.tag_name.format(**formatargs)) is hit, the wrong string is used. I've tried this with and without quotes, without success.

Using it via the CLI, eg: `bumpversion minor --tag-name="{new_version}" works as I'd expect.

Addendum: the example in the README.rst for using it via the CLI is incorrect -- it's using the message example.

Edited to note: using 0.3.3 from PyPI.

@peritus
Copy link
Owner

peritus commented Aug 1, 2013

Thanks! See, I thought I'd spare myself that test and write only one for the CLI case. Damn.

Care to submit a PR w/ a failing test and/or a fix ?

@kezabelle
Copy link
Author

I would, but I don't have a reliable way to verify what I'm doing, and I'm not at all familiar with the inner-workings of argparse, so I can't just eyeball it:

  • The README doesn't cover what I need for testing (perhaps worth tracking as a separate ticket?):
    • I need py.test at a minimum
    • I'm assuming it's ok to ignore tox and hope that a travis build would pass, but if it's not, it'd be useful to cover what versions of python I need (hint: I don't have most of them ;))

But, having overcome that because I recognise the tests format and tox.ini, even running py.test doesn't work:

  • I get 8 failed tests, most of which appear to be OSErrors, possibly relating to the fact that the only vcs I have, or care about, is git (so anything using mercurial etc will fail, by the look of it) and I can't see a way to skip them, or only run the test I care about [this may be because I have no familiarity with py.test]
  • doing py.test --pdb is of little use, because of the aforementioned 8 failures, each of which puts me in some bit of a stacktrace I don't recognise as anything to do with __init__.py
  • putting import pdb; pdb.set_trace() into __init__.py so that I can step through and see where things are going wrong doesn't work, because py.test doesn't like it.

So ... yeah. I tried, but as I can't even get into a state where I can write a test which fails for the reason I expect, I'm afraid I can't get help further.

@kezabelle
Copy link
Author

Alright, playing around with pdb in the source, it seems like a fix is to change this line so that instead of being default='v{new_version}') it is default=defaults.get('tag_name', 'v{new_version}')) ... which is what some of the other lines do - it make sense, and is simple enough to understand, but I'm loathe to assume it's the correct fix, because pre-existing lines like the regex parser don't do the same thing.

@peritus
Copy link
Owner

peritus commented Aug 1, 2013

Yes, tox is optional (i use that mainly to test against multiple python implementations), but just py.test is fine.

I have to admit that this is largely a wrapper for argparse, yes.

@peritus
Copy link
Owner

peritus commented Aug 1, 2013

That looks about right, a test for that should also be pretty straight forward. Thanks for the digging!

@peritus
Copy link
Owner

peritus commented Aug 1, 2013

Note to self: Also check if message works from the config file as that looks like it is handled exactly like tag_name.

@peritus
Copy link
Owner

peritus commented Aug 1, 2013

The regex parser doesn't do that because it's set as a default here.

@kezabelle
Copy link
Author

Well, that's where my understanding of argparse falls over, because tag_name is in defaults, and gets inserted into parser3 in the same way [at least in my experimentation]. I can only assume that because it's using metavar (whatever that does!) instead of dest, it's not being picked up.

peritus added a commit that referenced this issue Aug 2, 2013
@peritus
Copy link
Owner

peritus commented Aug 2, 2013

Hey. Added a failing test to demonstrate the problem (appears to be with message too). It's in the tag_name_message_from_config branch, if you want to work on top of that.

GTG,

@peritus peritus closed this as completed in 9192f7d Aug 3, 2013
@peritus
Copy link
Owner

peritus commented Aug 3, 2013

this is part of bumpversion 0.3.4, available on PyPI as of now.

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

2 participants