zestsoftware / zest.releaser

Python software releasing made easy and repeatable
https://zestreleaser.readthedocs.io
GNU General Public License v2.0
198 stars 62 forks source link

testing: bumpversion and postrelease tests fails #405

Open mtelka opened 1 year ago

mtelka commented 1 year ago

Many bumpversion and postrelease tests fails at OpenIndiana. Typical example is this:

File "$(BUILD_DIR)/zest/releaser/tests/bumpversion.txt", line 44, in bumpversion.txt
Failed example:
    githead('setup.py')
Expected:
    from setuptools import setup, find_packages
    version = '2.9.5.dev0'
Got:
    from setuptools import setup, find_packages
    version = '0.2.dev0'

In addition, there is one different failure:

File "$(BUILD_DIR)/zest/releaser/tests/bumpversion.txt", line 62, in bumpversion.txt
Failed example:
    bumpversion.main()
Exception raised:
    Traceback (most recent call last):
      File "/usr/lib/python3.7/doctest.py", line 1337, in __run
        compileflags, 1), test.globs)
      File "<doctest bumpversion.txt[16]>", line 1, in <module>
        bumpversion.main()
      File "$(BUILD_DIR)/zest/releaser/bumpversion.py", line 178, in main
        bumpversion.run()
      File "$(BUILD_DIR)/zest/releaser/baserelease.py", line 431, in run
        self.prepare()
      File "$(BUILD_DIR)/zest/releaser/bumpversion.py", line 67, in prepare
        self._grab_version(initial=True)
      File "$(BUILD_DIR)/zest/releaser/bumpversion.py", line 127, in _grab_version
        sys.exit(0)
      File "$(BUILD_DIR)/zest/releaser/tests/functional.py", line 35, in _exit
        raise RuntimeError(msg)
    RuntimeError: SYSTEM EXIT (code=0)

git version is 2.39.1

mauritsvanrees commented 1 year ago

The tests try to set the version to 2.9.5.dev0, but this fails, and the error is swallowed. Can you remove the three dots from this line and run the tests again? That should tell what the error is. https://github.com/zestsoftware/zest.releaser/blob/8.0.0a1/zest/releaser/tests/bumpversion.txt#L37

mtelka commented 1 year ago

The test around line 37 shows same results with and without three dots (the only difference seems to be in 'Expected'):

File "$(BUILD_DIR)/zest/releaser/tests/bumpversion.txt", line 33, in bumpversion.txt
Failed example:
    fullrelease.main()
Expected:
    Question...
    Question: Enter version [0.1]:
    Our reply: 2.9.4
Got:
    Question: Do you want to run check-manifest? (Y/n)? 
    Our reply: <ENTER>
    lists of files in version control and sdist match
    Changelog entries for version 0.1:
    <BLANKLINE>
    0.1 (unreleased)
    ----------------
    <BLANKLINE>
    - Initial library skeleton created by thaskel.  [your name]
    <BLANKLINE>
    Question: Enter version [0.1]: 
    Our reply: <ENTER>
    Checking data dict
    Question: OK to commit this (Y/n)? 
    Our reply: 2.9.4
    Please explicitly answer y/n
    Question: OK to commit this (Y/n)? 
    Our reply: <ENTER>
    Checking data dict
    Tag needed to proceed, you can use the following command:
    git tag 0.1 -m 'Tagging 0.1'
    Question: Run this command (Y/n)? 
    Our reply: <ENTER>
    <BLANKLINE>
    Question: Check out the tag (for tweaks or pypi/distutils server upload) (Y/n)? 
    Our reply: <ENTER>
    RED Note: switching to '0.1'.
    <BLANKLINE>
    RED You are in 'detached HEAD' state. You can look around, make experimental
    RED changes and commit them, and you can discard any commits you make in this
    RED state without impacting any branches by switching back to a branch.
    <BLANKLINE>
    RED If you want to create a new branch to retain commits you create, you may
    RED do so (now or later) by using -c with the switch command. Example:
    <BLANKLINE>
    RED git switch -c <new-branch-name>
    <BLANKLINE>
    RED Or undo this operation with:
    <BLANKLINE>
    RED git switch -
    <BLANKLINE>
    RED Turn off this advice by setting config variable advice.detachedHead to false
    <BLANKLINE>
    RED HEAD is now at 65165e0 [TAG] Preparing release 0.1
    <BLANKLINE>
    Question: Fix setup.cfg (and commit to tag if possible) (Y/n)? 
    Our reply: <ENTER>
    [egg_info]
    tag_build = 
    tag_svn_revision = false
    <BLANKLINE>
    <BLANKLINE>
    Showing first few lines...
    running sdist
    running egg_info
    creating src/tha.example.egg-info
    writing src/tha.example.egg-info/PKG-INFO
    writing dependency_links to src/tha.example.egg-info/dependency_links.txt
    ...
    Showing last few lines...
    Writing tha.example-0.1/setup.cfg
    creating dist
    Creating tar archive
    removing 'tha.example-0.1' (and everything under it)
    <BLANKLINE>
    Showing first few lines...
    running sdist
    running egg_info
    creating src/tha.example.egg-info
    writing src/tha.example.egg-info/PKG-INFO
    writing dependency_links to src/tha.example.egg-info/dependency_links.txt
    ...
    Showing last few lines...
    Writing tha.example-0.1/setup.cfg
    creating dist
    Creating tar archive
    removing 'tha.example-0.1' (and everything under it)
    <BLANKLINE>
    Question: Upload to pypi (y/N)? 
    Our reply: <ENTER>
    Current version is 0.1
    Question: Enter new development version ('.dev0' will be appended) [0.2]: 
    Our reply: <ENTER>
    Checking data dict
    Question: OK to commit this (Y/n)? 
    Our reply: <ENTER>
    Question: OK to push commits to the server? (Y/n)? 
    Our reply: n
reinout commented 1 year ago

The list of "our reply" seens to be off by one. We answer "enter" on the version question (turning it into 0.1 instead of 2.9.4) and answer "2.9.4" where a yes/no or enter is expected:

Question: Enter version [0.1]: 
Our reply: <ENTER>
Checking data dict
Question: OK to commit this (Y/n)? 
Our reply: 2.9.4
Please explicitly answer y/n

The first question is "do you want to run check-manifest", I initially thought that might be the cause, that there could be an extra dependency that snuck into the test install. But actually it seems that there should even be an extra question to push the answer list further down?

(Well, that's what you get with 15 year old software that's still very useful: it has older, more cumbersome test methods :-) )